fix: 导出链接走下载端点;文件记录切到 core 库
This commit is contained in:
@@ -103,7 +103,8 @@ public class ApprovalExportService {
|
||||
record.setLength(target.length());
|
||||
record.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
record.setCreateUserId(user.getUserId());
|
||||
record.setUrl(config.getServerUrl() + "/file/" + filename);
|
||||
record.setUrl(config.getServerUrl() + "/file/download/" + filename);
|
||||
record.setDownloadUrl(record.getUrl());
|
||||
fileService.save(record);
|
||||
return new ApprovalExportResult(record, rows.size());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
@@ -21,6 +22,7 @@ import java.util.List;
|
||||
* @since 2021-08-30 11:21:01
|
||||
*/
|
||||
@Service
|
||||
@DS("server")
|
||||
public class FileRecordServiceImpl extends ServiceImpl<FileRecordMapper, FileRecord> implements FileRecordService {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -169,12 +169,19 @@ class ApprovalCompletionDraftIT {
|
||||
|
||||
@Test
|
||||
void rejectsSubmitWhenArchivistRoleMissing() throws Exception {
|
||||
grantDepartmentLeader(organizationId, TENANT);
|
||||
long instanceId = createCompletion(reporter, organizationId, TENANT, "缺收文员");
|
||||
uploadAttachment(instanceId, reporter, organizationId, "image/png");
|
||||
int tenant = 10023;
|
||||
Integer orgId = data.createOrganization("缺收文员部门" + data.uniqueSuffix(), 136, tenant);
|
||||
ApprovalTestData.TestUser submitter =
|
||||
data.createUser("缺收文员报送人" + data.uniqueSuffix(), orgId, tenant);
|
||||
ApprovalTestData.TestRole leaderRole =
|
||||
data.createRole(data.leaderRoleCode(orgId), "部门负责人", tenant);
|
||||
ApprovalTestData.TestUser leader = data.createUser("缺收文员负责人" + data.uniqueSuffix(), orgId, tenant);
|
||||
data.bindTenant(leader.userId, leaderRole.roleId, tenant);
|
||||
long instanceId = createCompletion(submitter, orgId, tenant, "缺收文员");
|
||||
uploadAttachment(instanceId, submitter, orgId, tenant, "image/png");
|
||||
|
||||
mockMvc.perform(authed(post("/api/approval/instance/" + instanceId + "/submit"),
|
||||
reporter, organizationId, TENANT, SUBMIT))
|
||||
submitter, orgId, tenant, SUBMIT))
|
||||
.andExpect(jsonPath("$.code").value(1))
|
||||
.andExpect(jsonPath("$.message").value(org.hamcrest.Matchers.containsString("收文员角色缺配")));
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ class ApprovalExportIT {
|
||||
assertThat(node.path("id").asInt()).isPositive();
|
||||
String name = node.path("name").asText();
|
||||
assertThat(name).startsWith("excel/审批单据-").endsWith(".xlsx");
|
||||
assertThat(node.path("url").asText()).contains("/file/excel/审批单据-");
|
||||
assertThat(node.path("url").asText()).contains("/file/download/excel/审批单据-");
|
||||
File file = new File(node.path("path").asText());
|
||||
assertThat(file).exists();
|
||||
exportedFiles.add(file.toPath());
|
||||
|
||||
Reference in New Issue
Block a user