|
@@ -26,6 +26,7 @@ import com.jeeplus.finance.reportVerificationSeal.service.dto.CwReportVerificati
|
|
|
import com.jeeplus.finance.reportVerificationSeal.service.mapstruct.CwReportVerificationSealFileWrapper;
|
|
import com.jeeplus.finance.reportVerificationSeal.service.mapstruct.CwReportVerificationSealFileWrapper;
|
|
|
import com.jeeplus.finance.reportVerificationSeal.service.mapstruct.CwReportVerificationSealWrapper;
|
|
import com.jeeplus.finance.reportVerificationSeal.service.mapstruct.CwReportVerificationSealWrapper;
|
|
|
import com.jeeplus.finance.utils.Global;
|
|
import com.jeeplus.finance.utils.Global;
|
|
|
|
|
+import com.jeeplus.sys.domain.WorkAttachmentInfo;
|
|
|
import com.jeeplus.sys.feign.IRoleApi;
|
|
import com.jeeplus.sys.feign.IRoleApi;
|
|
|
import com.jeeplus.sys.feign.IUserApi;
|
|
import com.jeeplus.sys.feign.IUserApi;
|
|
|
import com.jeeplus.sys.feign.IWorkAttachmentApi;
|
|
import com.jeeplus.sys.feign.IWorkAttachmentApi;
|
|
@@ -35,6 +36,7 @@ import com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -42,17 +44,19 @@ import java.io.File;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 报告验证章service
|
|
* 报告验证章service
|
|
|
*
|
|
*
|
|
|
- * E2 实现单据骨架、草稿保存、执业章文件带出和复核角色检查;
|
|
|
|
|
|
|
+ * E2 实现单据骨架、暂存保存、执业章文件带出和复核角色检查;
|
|
|
* E3 接入契约锁建单/签署页/门禁/查看/强制结束/撤回、状态迁移白名单与签署完成回调。
|
|
* E3 接入契约锁建单/签署页/门禁/查看/强制结束/撤回、状态迁移白名单与签署完成回调。
|
|
|
*
|
|
*
|
|
|
- * 三方边界(开发文档第 11 节):契约锁只由本 Service 调用,回调只写 signed_zip_url,
|
|
|
|
|
|
|
+ * 三方边界(开发文档第 11 节):契约锁只由本 Service 调用,回调只落已盖章件与 signed_zip_url,
|
|
|
* 状态只由 save 与 updateStatusById 两个入口写,流程推进由前端表单驱动,本类不 complete 任务。
|
|
* 状态只由 save 与 updateStatusById 两个入口写,流程推进由前端表单驱动,本类不 complete 任务。
|
|
|
*
|
|
*
|
|
|
* @author: 徐滕
|
|
* @author: 徐滕
|
|
@@ -74,28 +78,30 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
/** 报告复核签章完成状态 */
|
|
/** 报告复核签章完成状态 */
|
|
|
private static final String REVIEW_STATUS_FINISHED = "5";
|
|
private static final String REVIEW_STATUS_FINISHED = "5";
|
|
|
|
|
|
|
|
- /** 状态:草稿 */
|
|
|
|
|
- private static final String STATUS_DRAFT = "0";
|
|
|
|
|
|
|
+ /** 状态:暂存 */
|
|
|
|
|
+ private static final String STATUS_DRAFT = "1";
|
|
|
|
|
|
|
|
- /** 状态:待盖章(节点 1) */
|
|
|
|
|
- private static final String STATUS_WAIT_SEAL = "1";
|
|
|
|
|
|
|
+ /** 状态:待盖章(节点 1,验证章扩展状态) */
|
|
|
|
|
+ private static final String STATUS_WAIT_SEAL = "6";
|
|
|
|
|
|
|
|
/** 状态:待复核(节点 2) */
|
|
/** 状态:待复核(节点 2) */
|
|
|
private static final String STATUS_WAIT_REVIEW = "2";
|
|
private static final String STATUS_WAIT_REVIEW = "2";
|
|
|
|
|
|
|
|
- /** 状态:复核通过 */
|
|
|
|
|
- private static final String STATUS_REVIEW_PASSED = "3";
|
|
|
|
|
|
|
+ /** 状态:完成 */
|
|
|
|
|
+ private static final String STATUS_REVIEW_PASSED = "5";
|
|
|
|
|
|
|
|
/** 状态:已驳回 */
|
|
/** 状态:已驳回 */
|
|
|
private static final String STATUS_REJECTED = "4";
|
|
private static final String STATUS_REJECTED = "4";
|
|
|
|
|
|
|
|
/** 状态:已撤回 */
|
|
/** 状态:已撤回 */
|
|
|
- private static final String STATUS_WITHDRAWN = "5";
|
|
|
|
|
|
|
+ private static final String STATUS_WITHDRAWN = "3";
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 状态迁移白名单:目标状态 -> 允许的前置状态(开发文档 14.6 #4)
|
|
* 状态迁移白名单:目标状态 -> 允许的前置状态(开发文档 14.6 #4)
|
|
|
*
|
|
*
|
|
|
- * 送审的 0/4/5 → 1 由 save 建单事务写,不在本表,updateStatusById 收到 status=1 直接拒绝。
|
|
|
|
|
|
|
+ * 送审的 1/4/3 → 6 由 save 建单事务写,不在本表,updateStatusById 收到 status=6 直接拒绝。
|
|
|
|
|
+ * 撤回只允许在 6:合同此时仍在"签署中",recall 才是有效动作。进入 2 后节点 1 签完即"签署完成",
|
|
|
|
|
+ * 发起人不再能撤回,只能由复核人驳回(业务侧作废)。
|
|
|
*/
|
|
*/
|
|
|
private static final Map<String, List<String>> STATUS_FLOW_WRITE = new HashMap<>();
|
|
private static final Map<String, List<String>> STATUS_FLOW_WRITE = new HashMap<>();
|
|
|
|
|
|
|
@@ -103,7 +109,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
STATUS_FLOW_WRITE.put(STATUS_WAIT_REVIEW, Collections.singletonList(STATUS_WAIT_SEAL));
|
|
STATUS_FLOW_WRITE.put(STATUS_WAIT_REVIEW, Collections.singletonList(STATUS_WAIT_SEAL));
|
|
|
STATUS_FLOW_WRITE.put(STATUS_REVIEW_PASSED, Collections.singletonList(STATUS_WAIT_REVIEW));
|
|
STATUS_FLOW_WRITE.put(STATUS_REVIEW_PASSED, Collections.singletonList(STATUS_WAIT_REVIEW));
|
|
|
STATUS_FLOW_WRITE.put(STATUS_REJECTED, Collections.singletonList(STATUS_WAIT_REVIEW));
|
|
STATUS_FLOW_WRITE.put(STATUS_REJECTED, Collections.singletonList(STATUS_WAIT_REVIEW));
|
|
|
- STATUS_FLOW_WRITE.put(STATUS_WITHDRAWN, Arrays.asList(STATUS_WAIT_SEAL, STATUS_WAIT_REVIEW));
|
|
|
|
|
|
|
+ STATUS_FLOW_WRITE.put(STATUS_WITHDRAWN, Collections.singletonList(STATUS_WAIT_SEAL));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 已盖章整包在 OSS 上的落点目录 */
|
|
/** 已盖章整包在 OSS 上的落点目录 */
|
|
@@ -116,6 +122,14 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
*/
|
|
*/
|
|
|
public static final String UPLOAD_ATTACHMENT_FLAG = "verification_report";
|
|
public static final String UPLOAD_ATTACHMENT_FLAG = "verification_report";
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 已盖章件在附件表里的业务标识(work_attachment.attachment_flag)
|
|
|
|
|
+ *
|
|
|
|
|
+ * 与原件的 verification_report 分开:详情页两段列表各取各的标识,
|
|
|
|
|
+ * 已盖章件不会回流成下一轮的待盖章原件(口径同执业章 practice_signed_report)。
|
|
|
|
|
+ */
|
|
|
|
|
+ public static final String SIGNED_ATTACHMENT_FLAG = "verification_signed_report";
|
|
|
|
|
+
|
|
|
/** 附件存储根目录(配置键,与执业章同一 bucket 口径) */
|
|
/** 附件存储根目录(配置键,与执业章同一 bucket 口径) */
|
|
|
private static final String DIRECTORY = Global.getConfig("directory");
|
|
private static final String DIRECTORY = Global.getConfig("directory");
|
|
|
|
|
|
|
@@ -128,7 +142,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
/** OSS 历史遗留域名 */
|
|
/** OSS 历史遗留域名 */
|
|
|
private static final String OSS_LEGACY_URL = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
|
|
private static final String OSS_LEGACY_URL = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
|
|
|
|
|
|
|
|
- /** 允许重新送审的状态(草稿、驳回后回到节点 1、撤回后重新申请) */
|
|
|
|
|
|
|
+ /** 允许重新送审的状态(暂存、驳回后回到节点 1、撤回后重新申请) */
|
|
|
private static final List<String> SUBMITTABLE_STATUS = Arrays.asList(STATUS_DRAFT, STATUS_REJECTED, STATUS_WITHDRAWN);
|
|
private static final List<String> SUBMITTABLE_STATUS = Arrays.asList(STATUS_DRAFT, STATUS_REJECTED, STATUS_WITHDRAWN);
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
@@ -160,7 +174,30 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
queryWrapper.between("a.create_time", createDates[0], createDates[1]);
|
|
queryWrapper.between("a.create_time", createDates[0], createDates[1]);
|
|
|
}
|
|
}
|
|
|
- return cwReportVerificationSealMapper.findList(page, queryWrapper);
|
|
|
|
|
|
|
+ IPage<CwReportVerificationSealDTO> result = cwReportVerificationSealMapper.findList(page, queryWrapper);
|
|
|
|
|
+ if (result != null && result.getRecords() != null) {
|
|
|
|
|
+ for (CwReportVerificationSealDTO record : result.getRecords()) {
|
|
|
|
|
+ hideSignedZipUntilPassed(record);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 完成(状态 5)之前不把已盖章件吐给前端
|
|
|
|
|
+ *
|
|
|
|
|
+ * 页面一旦拿到 signedZipUrl 或逐份已盖章件就能绕过 downloadSignedFile 的状态闸直接下件,
|
|
|
|
|
+ * 所以两件都要一起脱敏。注意验证章是单动作形态,盖章在节点 1 就完成、回调在待复核(2) 期间
|
|
|
|
|
+ * 就会落库,逐份清单不遮的话复核人提前看到成品件,与整包链接的口径也不一致。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param dto 查询结果,可为 null
|
|
|
|
|
+ */
|
|
|
|
|
+ private void hideSignedZipUntilPassed(CwReportVerificationSealDTO dto) {
|
|
|
|
|
+ if (dto == null || STATUS_REVIEW_PASSED.equals(dto.getStatus())) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ dto.setSignedZipUrl(null);
|
|
|
|
|
+ dto.setSignedFiles(null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -177,6 +214,9 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
// 详情同时返回附件路径:办理页只读原件区要靠它取预览/下载地址,缺路径的行前端会显式提示
|
|
// 详情同时返回附件路径:办理页只读原件区要靠它取预览/下载地址,缺路径的行前端会显式提示
|
|
|
result.setFiles(cwReportVerificationSealMapper.selectFilesWithAttachment(id));
|
|
result.setFiles(cwReportVerificationSealMapper.selectFilesWithAttachment(id));
|
|
|
|
|
+ // 已盖章件按列表返回(回调逐份落库后才有内容),详情页逐行下载靠它,不再只给一个整包链接
|
|
|
|
|
+ result.setSignedFiles(cwReportVerificationSealMapper.selectSignedFiles(id));
|
|
|
|
|
+ hideSignedZipUntilPassed(result);
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -256,7 +296,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 保存入口:status 空或 0 走草稿,1 走送审建单,其它状态一律拒绝
|
|
|
|
|
|
|
+ * 保存入口:status 空或 1 走暂存,6 走送审建单,其它状态一律拒绝
|
|
|
*
|
|
*
|
|
|
* @param cwReportVerificationSealDTO 申请内容
|
|
* @param cwReportVerificationSealDTO 申请内容
|
|
|
* @return 申请id
|
|
* @return 申请id
|
|
@@ -270,11 +310,11 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
if (STATUS_WAIT_SEAL.equals(formStatus)) {
|
|
if (STATUS_WAIT_SEAL.equals(formStatus)) {
|
|
|
return submit(cwReportVerificationSealDTO);
|
|
return submit(cwReportVerificationSealDTO);
|
|
|
}
|
|
}
|
|
|
- throw new Exception("保存只支持草稿(0)或送审(1),当前提交状态为 " + formStatus);
|
|
|
|
|
|
|
+ throw new Exception("保存只支持暂存(1)或送审(6),当前提交状态为 " + formStatus);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 保存草稿,文件按本次提交全量替换,不调契约锁、不建流程
|
|
|
|
|
|
|
+ * 保存暂存,文件按本次提交全量替换,不调契约锁、不建流程
|
|
|
*
|
|
*
|
|
|
* @param cwReportVerificationSealDTO 申请内容
|
|
* @param cwReportVerificationSealDTO 申请内容
|
|
|
* @return 申请id
|
|
* @return 申请id
|
|
@@ -295,7 +335,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 送审:校验通过后在同一事务内落主表/文件、建契约锁合同、回填 contractId、状态写 1
|
|
|
|
|
|
|
+ * 送审:校验通过后在同一事务内落主表/文件、建契约锁合同、回填 contractId、状态写 6(待盖章)
|
|
|
*
|
|
*
|
|
|
* 每次送审都新建合同,旧 contractId 追加进 remarks 留痕,不复用已 recall 的合同。
|
|
* 每次送审都新建合同,旧 contractId 追加进 remarks 留痕,不复用已 recall 的合同。
|
|
|
* 契约锁建单成功后本地若再抛异常,数据库回滚但合同留在契约锁侧,
|
|
* 契约锁建单成功后本地若再抛异常,数据库回滚但合同留在契约锁侧,
|
|
@@ -319,7 +359,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
CwReportVerificationSeal old = loadEditable(cwReportVerificationSealDTO.getId(), currentUser);
|
|
CwReportVerificationSeal old = loadEditable(cwReportVerificationSealDTO.getId(), currentUser);
|
|
|
if (old != null && !SUBMITTABLE_STATUS.contains(old.getStatus())) {
|
|
if (old != null && !SUBMITTABLE_STATUS.contains(old.getStatus())) {
|
|
|
- throw new Exception("当前状态【" + old.getStatus() + "】不能送审,只有草稿、已驳回、已撤回的申请可以送审");
|
|
|
|
|
|
|
+ throw new Exception("当前状态【" + old.getStatus() + "】不能送审,只有暂存、已驳回、已撤回的申请可以送审");
|
|
|
}
|
|
}
|
|
|
if (countTodoFiles(cwReportVerificationSealDTO) == 0) {
|
|
if (countTodoFiles(cwReportVerificationSealDTO) == 0) {
|
|
|
throw new Exception("没有待盖章文件,无法送审");
|
|
throw new Exception("没有待盖章文件,无法送审");
|
|
@@ -378,7 +418,11 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
File tempFile = null;
|
|
File tempFile = null;
|
|
|
try {
|
|
try {
|
|
|
if (StringUtils.isBlank(fileDTO.getAttachmentUrl())) {
|
|
if (StringUtils.isBlank(fileDTO.getAttachmentUrl())) {
|
|
|
- throw new Exception("文件【" + StringUtils.defaultString(fileDTO.getFileName()) + "】存储路径为空,请重新上传后再送审");
|
|
|
|
|
|
|
+ String attachmentUrl = readAttachmentUrlFallback(fileDTO);
|
|
|
|
|
+ if (StringUtils.isBlank(attachmentUrl)) {
|
|
|
|
|
+ throw new Exception("文件【" + StringUtils.defaultString(fileDTO.getFileName()) + "】存储路径为空,请重新上传后再送审");
|
|
|
|
|
+ }
|
|
|
|
|
+ fileDTO.setAttachmentUrl(attachmentUrl);
|
|
|
}
|
|
}
|
|
|
String extension = StringUtils.lowerCase(StringUtils.substringAfterLast(fileDTO.getFileName(), "."));
|
|
String extension = StringUtils.lowerCase(StringUtils.substringAfterLast(fileDTO.getFileName(), "."));
|
|
|
if (!Arrays.asList("doc", "docx", "pdf").contains(StringUtils.defaultString(extension))) {
|
|
if (!Arrays.asList("doc", "docx", "pdf").contains(StringUtils.defaultString(extension))) {
|
|
@@ -404,8 +448,8 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
CwReportVerificationSeal main = this.getById(verificationSealId);
|
|
CwReportVerificationSeal main = this.getById(verificationSealId);
|
|
|
String subject = StringUtils.defaultIfBlank(main == null ? null : main.getProjectName(), "报告验证章");
|
|
String subject = StringUtils.defaultIfBlank(main == null ? null : main.getProjectName(), "报告验证章");
|
|
|
- List<String> gateMobiles = reviewerGateMobiles(currentUser);
|
|
|
|
|
- JSONObject response = QiyuesuoVerificationPayloadBuilder.createContract(documentIds, subject, currentUser.getMobile(), gateMobiles);
|
|
|
|
|
|
|
+ // 手机号只进契约锁请求体,不打印、不落库(AGENTS 第十三章)
|
|
|
|
|
+ JSONObject response = QiyuesuoVerificationPayloadBuilder.createContract(documentIds, subject, currentUser.getMobile());
|
|
|
if (!QiyuesuoVerificationPayloadBuilder.isSuccess(response)) {
|
|
if (!QiyuesuoVerificationPayloadBuilder.isSuccess(response)) {
|
|
|
throw new Exception("签章合同创建失败:" + QiyuesuoVerificationPayloadBuilder.message(response, "契约锁未返回可用结果"));
|
|
throw new Exception("签章合同创建失败:" + QiyuesuoVerificationPayloadBuilder.message(response, "契约锁未返回可用结果"));
|
|
|
}
|
|
}
|
|
@@ -417,42 +461,6 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 复核门挡(动作2)的签署操作人:复核角色成员手机号,任意一人签署即完成合同
|
|
|
|
|
- *
|
|
|
|
|
- * 实测口径(2026-11-24 两条新单对照):动作不传操作人时契约锁回落成"该主体全员可签",
|
|
|
|
|
- * 发起人自己就能把门挡签掉、合同提前完成并在签章系统下载,复核形同虚设;传了操作人就只限这些人可签。
|
|
|
|
|
- * 所以门挡绑复核角色成员,并把发起人排除在名单外。
|
|
|
|
|
- * 手机号只进契约锁请求体,不写日志、不落库(AGENTS 第十三章)。
|
|
|
|
|
- *
|
|
|
|
|
- * @param currentUser 发起人,从名单里排除,避免自己签门挡
|
|
|
|
|
- * @return 复核角色成员手机号(已去重、已剔除空值)
|
|
|
|
|
- * @throws Exception 复核角色不存在或除发起人外没有登记手机号的成员
|
|
|
|
|
- */
|
|
|
|
|
- private List<String> reviewerGateMobiles(UserDTO currentUser) throws Exception {
|
|
|
|
|
- RoleDTO role = SpringUtil.getBean(IRoleApi.class).getRoleDTOByNameIgnoreTenant(REVIEWER_ROLE_NAME);
|
|
|
|
|
- if (role == null || StringUtils.isBlank(role.getId())) {
|
|
|
|
|
- throw new Exception("复核角色不存在,无法生成门挡签署人,请先配置【" + REVIEWER_ROLE_NAME + "】");
|
|
|
|
|
- }
|
|
|
|
|
- List<UserDTO> members = SpringUtil.getBean(IUserApi.class).findListByRoleId(role.getId());
|
|
|
|
|
- List<String> mobiles = new ArrayList<>();
|
|
|
|
|
- if (members != null) {
|
|
|
|
|
- for (UserDTO member : members) {
|
|
|
|
|
- if (member == null || StringUtils.isBlank(member.getMobile())
|
|
|
|
|
- || StringUtils.equals(member.getId(), currentUser.getId())) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- if (!mobiles.contains(member.getMobile())) {
|
|
|
|
|
- mobiles.add(member.getMobile());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (mobiles.isEmpty()) {
|
|
|
|
|
- throw new Exception("复核角色【" + REVIEWER_ROLE_NAME + "】里没有除发起人以外、且登记了手机号的成员,门挡无人可签,无法送审");
|
|
|
|
|
- }
|
|
|
|
|
- return mobiles;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
* 流程回调写状态,只接受白名单迁移
|
|
* 流程回调写状态,只接受白名单迁移
|
|
|
*
|
|
*
|
|
|
* @param cwReportVerificationSealDTO 至少含 id 与 status
|
|
* @param cwReportVerificationSealDTO 至少含 id 与 status
|
|
@@ -491,15 +499,21 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
requireSealed(old);
|
|
requireSealed(old);
|
|
|
} else if (STATUS_REVIEW_PASSED.equals(target)) {
|
|
} else if (STATUS_REVIEW_PASSED.equals(target)) {
|
|
|
|
|
+ // 节点 2【同意】不再调任何契约锁接口:合同在节点 1 签完即"签署完成",
|
|
|
|
|
+ // 已盖章件由 CONTRACT_COMPLETE 回调 → 打包 zip → OSS 落 signed_zip_url,这里只做身份与落章校验。
|
|
|
requireReviewer(currentUser.getId());
|
|
requireReviewer(currentUser.getId());
|
|
|
requireSealed(old);
|
|
requireSealed(old);
|
|
|
- ensureReviewerSignedInQiyuesuo(old, currentUser);
|
|
|
|
|
- } else if (STATUS_REJECTED.equals(target) || STATUS_WITHDRAWN.equals(target)) {
|
|
|
|
|
- if (STATUS_REJECTED.equals(target)) {
|
|
|
|
|
- requireReviewer(currentUser.getId());
|
|
|
|
|
- } else if (!StringUtils.equals(old.getApplyUserId(), currentUser.getId())) {
|
|
|
|
|
|
|
+ } else if (STATUS_REJECTED.equals(target)) {
|
|
|
|
|
+ requireReviewer(currentUser.getId());
|
|
|
|
|
+ // 2026-11-24 用户口径=业务侧作废:驳回时合同已完成,契约锁 recall 必撞 3001008、
|
|
|
|
|
+ // /contract/cancel 又要盖章人再签一份作废文件(把人拉回来重签,业务不可接受)。
|
|
|
|
|
+ // 所以这里不调平台接口,只把本地状态落 4 + 换轮次清合同号,签章系统里那份完成件不处理。
|
|
|
|
|
+ } else if (STATUS_WITHDRAWN.equals(target)) {
|
|
|
|
|
+ if (!StringUtils.equals(old.getApplyUserId(), currentUser.getId())) {
|
|
|
throw new Exception("只有发起人本人可以撤回这条申请");
|
|
throw new Exception("只有发起人本人可以撤回这条申请");
|
|
|
}
|
|
}
|
|
|
|
|
+ // 撤回只在状态 6(合同仍在"签署中")才是有效动作;先排掉"章已拖完、合同已完成"这个窗口
|
|
|
|
|
+ rejectWithdrawIfContractFinished(old);
|
|
|
recallContract(old);
|
|
recallContract(old);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -532,13 +546,14 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 取签署页地址:仅状态 1 的发起人本人可调
|
|
|
|
|
|
|
+ * 取签署页地址:仅状态 6(待盖章)的发起人本人可调
|
|
|
*
|
|
*
|
|
|
* @param id 申请id
|
|
* @param id 申请id
|
|
|
|
|
+ * @param callbackPage 签署完成后的跳转页(前端按自身域名拼给我们自己的极简提示页),空则契约锁保持默认行为
|
|
|
* @return 签署页地址,只在办理页短期使用,不落库、不写日志
|
|
* @return 签署页地址,只在办理页短期使用,不落库、不写日志
|
|
|
* @throws Exception 校验或调用异常
|
|
* @throws Exception 校验或调用异常
|
|
|
*/
|
|
*/
|
|
|
- public String getSignUrl(String id) throws Exception {
|
|
|
|
|
|
|
+ public String getSignUrl(String id, String callbackPage) throws Exception {
|
|
|
UserDTO currentUser = getCurrentUser();
|
|
UserDTO currentUser = getCurrentUser();
|
|
|
CwReportVerificationSeal main = loadOwned(id, currentUser);
|
|
CwReportVerificationSeal main = loadOwned(id, currentUser);
|
|
|
if (!STATUS_WAIT_SEAL.equals(main.getStatus())) {
|
|
if (!STATUS_WAIT_SEAL.equals(main.getStatus())) {
|
|
@@ -553,7 +568,8 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
if (StringUtils.isBlank(currentUser.getMobile())) {
|
|
if (StringUtils.isBlank(currentUser.getMobile())) {
|
|
|
throw new Exception("当前登录人没有登记手机号,无法进入盖章页");
|
|
throw new Exception("当前登录人没有登记手机号,无法进入盖章页");
|
|
|
}
|
|
}
|
|
|
- JSONObject response = QiyuesuoVerificationPayloadBuilder.getSignUrl(main.getContractId(), currentUser.getMobile());
|
|
|
|
|
|
|
+ JSONObject response = QiyuesuoVerificationPayloadBuilder.getSignUrl(main.getContractId(), currentUser.getMobile(),
|
|
|
|
|
+ StringUtils.trimToNull(callbackPage));
|
|
|
String signUrl = response == null ? "" : StringUtils.defaultString(response.getString("signUrl"));
|
|
String signUrl = response == null ? "" : StringUtils.defaultString(response.getString("signUrl"));
|
|
|
if (!QiyuesuoVerificationPayloadBuilder.isSuccess(response) || StringUtils.isBlank(signUrl)) {
|
|
if (!QiyuesuoVerificationPayloadBuilder.isSuccess(response) || StringUtils.isBlank(signUrl)) {
|
|
|
throw new Exception("获取盖章页地址失败:" + QiyuesuoVerificationPayloadBuilder.message(response, "契约锁未返回签署地址"));
|
|
throw new Exception("获取盖章页地址失败:" + QiyuesuoVerificationPayloadBuilder.message(response, "契约锁未返回签署地址"));
|
|
@@ -596,7 +612,8 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
/**
|
|
/**
|
|
|
* 手动兜底:强制结束合同,仅状态 2 的复核角色成员可调,用实际操作人手机号
|
|
* 手动兜底:强制结束合同,仅状态 2 的复核角色成员可调,用实际操作人手机号
|
|
|
*
|
|
*
|
|
|
- * 节点 2【同意】自 v3.4 起不再经过本方法(改走 {@link #ensureReviewerSignedInQiyuesuo} 服务端静默签);
|
|
|
|
|
|
|
+ * 2026-11-24 换形态(建单只挂 action1)后节点 1 签完合同即"签署完成",节点 2【同意】不再调任何契约锁接口;
|
|
|
|
|
+ * 本方法只留给"合同确实卡在非终态"时人工尝试。
|
|
|
* 138 实测该接口以复核人身份回「没有权限」,探针定性为操作人身份级拒绝(假手机号先撞「找不到手机号…的用户」),
|
|
* 138 实测该接口以复核人身份回「没有权限」,探针定性为操作人身份级拒绝(假手机号先撞「找不到手机号…的用户」),
|
|
|
* 不是应用未开通接口,所以在厂商确认该身份前调它只会拿到同一个错误。
|
|
* 不是应用未开通接口,所以在厂商确认该身份前调它只会拿到同一个错误。
|
|
|
*
|
|
*
|
|
@@ -617,7 +634,11 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 已盖章件下载直链:终态且回调已落 signed_zip_url 才返回
|
|
|
|
|
|
|
+ * 已盖章件下载直链:只有完成(状态 5)才返回
|
|
|
|
|
+ *
|
|
|
|
|
+ * 2026-11-24 换形态后节点 1 签完合同即"签署完成",回调会在复核之前就落到 signed_zip_url,
|
|
|
|
|
+ * 所以"流程没走完不许下载"这条只能由本方法 + 详情脱敏一起拦:状态不是 5 一律不给出件地址。
|
|
|
|
|
+ * 驳回(4)与撤回(5)同样不放行——业务侧作废后我们侧不再提供那份完成件。
|
|
|
*
|
|
*
|
|
|
* @param id 申请id
|
|
* @param id 申请id
|
|
|
* @return 含 signedZipUrl 的响应
|
|
* @return 含 signedZipUrl 的响应
|
|
@@ -626,7 +647,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
public ResponseEntity downloadSignedFile(String id) throws Exception {
|
|
public ResponseEntity downloadSignedFile(String id) throws Exception {
|
|
|
UserDTO currentUser = getCurrentUser();
|
|
UserDTO currentUser = getCurrentUser();
|
|
|
CwReportVerificationSeal main = loadOwned(id, currentUser);
|
|
CwReportVerificationSeal main = loadOwned(id, currentUser);
|
|
|
- if (!Arrays.asList(STATUS_REVIEW_PASSED, STATUS_REJECTED, STATUS_WITHDRAWN).contains(main.getStatus())) {
|
|
|
|
|
|
|
+ if (!STATUS_REVIEW_PASSED.equals(main.getStatus())) {
|
|
|
return ResponseUtil.newInstance().error("这条申请还在流程中,暂无已盖章件");
|
|
return ResponseUtil.newInstance().error("这条申请还在流程中,暂无已盖章件");
|
|
|
}
|
|
}
|
|
|
if (StringUtils.isBlank(main.getSignedZipUrl())) {
|
|
if (StringUtils.isBlank(main.getSignedZipUrl())) {
|
|
@@ -638,8 +659,9 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
/**
|
|
/**
|
|
|
* 契约锁签署完成回调落库(由回调 Controller 调用,线程无登录态)
|
|
* 契约锁签署完成回调落库(由回调 Controller 调用,线程无登录态)
|
|
|
*
|
|
*
|
|
|
- * 只写 signed_zip_url:不写状态、不推进 Flowable、不取当前用户与租户。
|
|
|
|
|
- * 无论一份还是多份,一律把契约锁整包 zip 传 OSS,不做单文件直出。
|
|
|
|
|
|
|
+ * 处理形态与个人执业章逐字对齐:下载整包 → 解压 → 每一份已盖章件都传 OSS、落 work_attachment、
|
|
|
|
|
+ * 把引用挂回对应的原件文件行;下载件引用按份数区分,单文件直出那份原件、多文件才上传整包 zip。
|
|
|
|
|
+ * 不写状态、不推进 Flowable、不取当前用户与租户(回调线程没有请求上下文,依赖它的取值会填成 null)。
|
|
|
*
|
|
*
|
|
|
* @param presignCallBack 回调载荷
|
|
* @param presignCallBack 回调载荷
|
|
|
* @return 给契约锁侧的可读结论
|
|
* @return 给契约锁侧的可读结论
|
|
@@ -680,7 +702,38 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
log.warn("报告验证章完成回调:解压后没有文件,id={},contractId={}", main.getId(), contractId);
|
|
log.warn("报告验证章完成回调:解压后没有文件,id={},contractId={}", main.getId(), contractId);
|
|
|
return "签章回调已收到,但解压后没有文件,请到契约锁侧核对该合同文档";
|
|
return "签章回调已收到,但解压后没有文件,请到契约锁侧核对该合同文档";
|
|
|
}
|
|
}
|
|
|
- uploadSignedZipToOss(main, zipFile);
|
|
|
|
|
|
|
+ UserDTO creator = SpringUtil.getBean(IUserApi.class).getById(main.getCreateById());
|
|
|
|
|
+ List<CwReportVerificationSealFile> fileList = queryFileRows(main.getId());
|
|
|
|
|
+ int savedCount = 0;
|
|
|
|
|
+ String singleSignedOssPath = null;
|
|
|
|
|
+ for (File item : signedFiles) {
|
|
|
|
|
+ if (!item.isFile()) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ File renamed = renameBracketFile(item);
|
|
|
|
|
+ String ossPath = saveSignedFile(main.getId(), creator, fileList, renamed == null ? item : renamed);
|
|
|
|
|
+ if (StringUtils.isNotBlank(ossPath)) {
|
|
|
|
|
+ savedCount++;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (savedCount == 1) {
|
|
|
|
|
+ // 暂存第一份的现成 OSS 路径,仅当最终只有 1 份时直接复用,不再打包重传
|
|
|
|
|
+ singleSignedOssPath = ossPath;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (savedCount == 0) {
|
|
|
|
|
+ log.warn("报告验证章完成回调:解压出 {} 个文件但一份都没落住,id={},contractId={}",
|
|
|
|
|
+ signedFiles.length, main.getId(), contractId);
|
|
|
|
|
+ return "签章回调已收到,但已盖章件一份都没落住,请看后端日志";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (savedCount == 1) {
|
|
|
|
|
+ setSignedDownloadUrl(main, singleSignedOssPath);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uploadSignedZipToOss(main, zipFile);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (fileList.size() != savedCount) {
|
|
|
|
|
+ log.warn("报告验证章完成回调:已盖章件{}份,与原件清单{}行不一致,id={},contractId={}",
|
|
|
|
|
+ savedCount, fileList.size(), main.getId(), contractId);
|
|
|
|
|
+ }
|
|
|
return "success";
|
|
return "success";
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("报告验证章完成回调处理异常,id=" + main.getId() + ",contractId=" + contractId, e);
|
|
log.error("报告验证章完成回调处理异常,id=" + main.getId() + ",contractId=" + contractId, e);
|
|
@@ -692,8 +745,175 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 本单据的文件行(按 sort 顺序),回调里边落已盖章件边改内存对象,避免同事务再查一次读到改前的值
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param verificationSealId 申请id
|
|
|
|
|
+ * @return 文件行清单
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<CwReportVerificationSealFile> queryFileRows(String verificationSealId) {
|
|
|
|
|
+ QueryWrapper<CwReportVerificationSealFile> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ queryWrapper.eq("verification_seal_id", verificationSealId).orderByAsc("sort", "id");
|
|
|
|
|
+ return cwReportVerificationSealFileMapper.selectList(queryWrapper);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 单个已盖章件:传 OSS + 写附件表 + 把引用挂回对应原件行(原件那行不动)
|
|
|
|
|
+ *
|
|
|
|
|
+ * 匹配原件行按"去后缀的文件名"比:先全等,再退回包含关系,多个疑似命中不猜 ——
|
|
|
|
|
+ * 匹配不上时照样落附件并单独记一行,保证文件在页面上看得见、可追溯,不静默丢件(口径同执业章)。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param verificationSealId 申请id
|
|
|
|
|
+ * @param creator 单据发起人(回调线程没有登录态,附件表的创建人按发起人写,与执业章一致)
|
|
|
|
|
+ * @param fileList 文件行清单(内存对象,落库后就地把引用改进去)
|
|
|
|
|
+ * @param signedFile 解压出来的已盖章文件
|
|
|
|
|
+ * @return 该已盖章件的 OSS 路径(与 work_attachment.url 同值,供单文件直出复用),落住返回空表示失败
|
|
|
|
|
+ * @throws Exception 上传或落库异常
|
|
|
|
|
+ */
|
|
|
|
|
+ private String saveSignedFile(String verificationSealId, UserDTO creator,
|
|
|
|
|
+ List<CwReportVerificationSealFile> fileList, File signedFile) throws Exception {
|
|
|
|
|
+ String realPath = StringUtils.defaultString(DIRECTORY).replaceFirst("/", "") + "/" + SIGNED_OSS_DIRECTORY
|
|
|
|
|
+ + SpringUtil.getBean(IWorkAttachmentApi.class).datePath() + "/" + System.currentTimeMillis();
|
|
|
|
|
+ String newName = signedFile.getName();
|
|
|
|
|
+ SpringUtil.getBean(IWorkAttachmentApi.class).uploadFileSignatureOSS(signedFile.getPath(), realPath, newName);
|
|
|
|
|
+ String filepath = "/" + realPath + newName;
|
|
|
|
|
+
|
|
|
|
|
+ WorkAttachmentInfo workAttachment = new WorkAttachmentInfo();
|
|
|
|
|
+ workAttachment.setDelFlag(0);
|
|
|
|
|
+ workAttachment.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
|
+ workAttachment.setUrl(filepath);
|
|
|
|
|
+ workAttachment.setType(StringUtils.substringAfterLast(newName, "."));
|
|
|
|
|
+ workAttachment.setAttachmentName(newName);
|
|
|
|
|
+ workAttachment.setAttachmentFlag(SIGNED_ATTACHMENT_FLAG);
|
|
|
|
|
+ workAttachment.setFileSize(String.valueOf(signedFile.length()));
|
|
|
|
|
+ workAttachment.setAttachmentId(verificationSealId);
|
|
|
|
|
+ workAttachment.setAttachmentType("");
|
|
|
|
|
+ workAttachment.setCreateTime(new Date());
|
|
|
|
|
+ workAttachment.setUpdateTime(new Date());
|
|
|
|
|
+
|
|
|
|
|
+ CwReportVerificationSealFile fileRow = matchFileRow(fileList, newName);
|
|
|
|
|
+ if (fileRow != null && StringUtils.isNotBlank(fileRow.getSignedAttachmentId())) {
|
|
|
|
|
+ // 回调重投:先删上一版已盖章附件再插新的,页面永远只有一份
|
|
|
|
|
+ SpringUtil.getBean(IWorkAttachmentApi.class).deleteById(fileRow.getSignedAttachmentId());
|
|
|
|
|
+ }
|
|
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
|
|
+ map.put("workAttachment", JSON.toJSONString(workAttachment));
|
|
|
|
|
+ map.put("userDTO", JSON.toJSONString(creator == null ? new UserDTO() : creator));
|
|
|
|
|
+ SpringUtil.getBean(IWorkAttachmentApi.class).insertWorkAttachment(map);
|
|
|
|
|
+
|
|
|
|
|
+ if (fileRow == null) {
|
|
|
|
|
+ log.warn("报告验证章已盖章件没有匹配到原件行,verificationSealId={},文件名={},已单独记一行待人工核对",
|
|
|
|
|
+ verificationSealId, newName);
|
|
|
|
|
+ CwReportVerificationSealFile newRow = new CwReportVerificationSealFile();
|
|
|
|
|
+ newRow.setVerificationSealId(verificationSealId);
|
|
|
|
|
+ // 这一行只是"落不住的已盖章件"的载体,不是原件:source 留空,原件清单查询按"既无 attachment_id
|
|
|
|
|
+ // 又无 ref_practice_file_id"把它排除掉,避免它混进下一轮的待盖章文件与建单 documents
|
|
|
|
|
+ newRow.setFileName(newName);
|
|
|
|
|
+ newRow.setSort(fileList.size() + 1);
|
|
|
|
|
+ newRow.setSignedAttachmentId(workAttachment.getId());
|
|
|
|
|
+ newRow.setSignedFileName(newName);
|
|
|
|
|
+ cwReportVerificationSealFileMapper.insert(newRow);
|
|
|
|
|
+ fileList.add(newRow);
|
|
|
|
|
+ return filepath;
|
|
|
|
|
+ }
|
|
|
|
|
+ CwReportVerificationSealFile update = new CwReportVerificationSealFile();
|
|
|
|
|
+ update.setId(fileRow.getId());
|
|
|
|
|
+ update.setSignedAttachmentId(workAttachment.getId());
|
|
|
|
|
+ update.setSignedFileName(newName);
|
|
|
|
|
+ cwReportVerificationSealFileMapper.updateById(update);
|
|
|
|
|
+ fileRow.setSignedAttachmentId(workAttachment.getId());
|
|
|
|
|
+ fileRow.setSignedFileName(newName);
|
|
|
|
|
+ return filepath;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 单文件直出:把已盖章件现成的 OSS 路径写进 signed_zip_url,不再打包、不再重传
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param main 单据
|
|
|
|
|
+ * @param ossPath 已盖章件的 OSS 路径(saveSignedFile 的返回值)
|
|
|
|
|
+ */
|
|
|
|
|
+ private void setSignedDownloadUrl(CwReportVerificationSeal main, String ossPath) {
|
|
|
|
|
+ if (StringUtils.isBlank(ossPath)) {
|
|
|
|
|
+ log.warn("报告验证章单文件直出:已盖章件 OSS 路径为空,不写 signed_zip_url,id={}", main.getId());
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(main.getSignedZipUrl()) && !StringUtils.equals(main.getSignedZipUrl(), ossPath)) {
|
|
|
|
|
+ log.info("报告验证章单文件直出覆盖旧下载件引用,id={},旧url={}", main.getId(), main.getSignedZipUrl());
|
|
|
|
|
+ }
|
|
|
|
|
+ UpdateWrapper<CwReportVerificationSeal> update = new UpdateWrapper<>();
|
|
|
|
|
+ update.eq("id", main.getId()).eq("del_flag", "0").set("signed_zip_url", ossPath);
|
|
|
|
|
+ cwReportVerificationSealMapper.update(null, update);
|
|
|
|
|
+ main.setSignedZipUrl(ossPath);
|
|
|
|
|
+ log.info("报告验证章单文件直出,signed_zip_url 复用已盖章件路径,id={},url={}", main.getId(), ossPath);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按"去后缀文件名"给已盖章件找它对应的原件行
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param fileList 原件行清单
|
|
|
|
|
+ * @param signedFileName 已盖章件文件名
|
|
|
|
|
+ * @return 匹配到的行,匹配不上或有多个疑似命中返回 null
|
|
|
|
|
+ */
|
|
|
|
|
+ private CwReportVerificationSealFile matchFileRow(List<CwReportVerificationSealFile> fileList, String signedFileName) {
|
|
|
|
|
+ String key = fileNameWithoutExtension(signedFileName);
|
|
|
|
|
+ if (StringUtils.isBlank(key) || fileList == null || fileList.isEmpty()) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ CwReportVerificationSealFile fuzzyHit = null;
|
|
|
|
|
+ int fuzzyCount = 0;
|
|
|
|
|
+ for (CwReportVerificationSealFile file : fileList) {
|
|
|
|
|
+ String origin = fileNameWithoutExtension(file.getFileName());
|
|
|
|
|
+ if (StringUtils.isBlank(origin)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (key.equals(origin)) {
|
|
|
|
|
+ return file;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (key.contains(origin) || origin.contains(key)) {
|
|
|
|
|
+ fuzzyHit = file;
|
|
|
|
|
+ fuzzyCount++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return fuzzyCount == 1 ? fuzzyHit : null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 取去后缀、转小写的文件名,用于原件与已盖章件配对
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param fileName 文件名
|
|
|
|
|
+ * @return 归一化后的文件名
|
|
|
|
|
+ */
|
|
|
|
|
+ private String fileNameWithoutExtension(String fileName) {
|
|
|
|
|
+ return StringUtils.lowerCase(StringUtils.substringBeforeLast(StringUtils.defaultString(fileName), "."));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 报告文号里那对圆括号会让下载链接产生歧义,沿用执业章把"字(2024)"改成"字[2024]"的改名口径
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param file 解压出来的文件
|
|
|
|
|
+ * @return 改名后的文件,没改或改名失败返回 null(调用方继续用原文件)
|
|
|
|
|
+ */
|
|
|
|
|
+ private File renameBracketFile(File file) {
|
|
|
|
|
+ String name = StringUtils.defaultString(file.getName());
|
|
|
|
|
+ if (!name.contains("字(2") || !name.contains("苏兴会")) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ int indexLeft = name.indexOf("字(2") + 1;
|
|
|
|
|
+ String temporaryFileName = name.substring(0, indexLeft) + "[" + name.substring(indexLeft + 1);
|
|
|
|
|
+ temporaryFileName = temporaryFileName.substring(0, indexLeft + 5) + "]" + temporaryFileName.substring(indexLeft + 6);
|
|
|
|
|
+ File newFile = new File(file.getParent() + File.separator + temporaryFileName);
|
|
|
|
|
+ return file.renameTo(newFile) ? newFile : null;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("报告验证章已盖章件改名失败,沿用原文件名:{}", name);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 已盖章整包上传 OSS 并写引用(重投时同名覆盖,只更新引用)
|
|
* 已盖章整包上传 OSS 并写引用(重投时同名覆盖,只更新引用)
|
|
|
*
|
|
*
|
|
|
|
|
+ * 只有多份时才走这里;单份由 setSignedDownloadUrl 直接复用已盖章件的 OSS 路径。
|
|
|
|
|
+ *
|
|
|
* @param main 单据
|
|
* @param main 单据
|
|
|
* @param zipFile 契约锁整包
|
|
* @param zipFile 契约锁整包
|
|
|
* @throws Exception 上传异常
|
|
* @throws Exception 上传异常
|
|
@@ -817,9 +1037,9 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
/**
|
|
/**
|
|
|
* 复核门挡(动作2)是否已被签署
|
|
* 复核门挡(动作2)是否已被签署
|
|
|
*
|
|
*
|
|
|
- * 门挡的操作人建单时已限定为复核角色成员(见 reviewerGateMobiles),所以它被签掉就是"复核人已在契约锁
|
|
|
|
|
- * 侧完成签署"这条合法路径。本方法只用于区分终态来源(复核人签的 vs 我方 force 的)与排查取证,
|
|
|
|
|
- * 不作拦截判据。详情里找不到动作2 时返回 false,认不出形态不误判。
|
|
|
|
|
|
|
+ * 只给 2026-11-24 换形态之前建的老单用(那些合同挂了 action2,操作人限定为复核角色成员):
|
|
|
|
|
+ * 它被签掉就是"复核人已在契约锁侧完成签署"这条合法路径。本方法只用于区分终态来源(复核人签的 vs 我方 force 的)
|
|
|
|
|
+ * 与排查取证,不作拦截判据。详情里找不到动作2 时返回 false,认不出形态不误判(新单本来就没有动作2)。
|
|
|
*
|
|
*
|
|
|
* @param contract 契约锁合同对象
|
|
* @param contract 契约锁合同对象
|
|
|
* @return 门挡是否已被签署
|
|
* @return 门挡是否已被签署
|
|
@@ -888,111 +1108,6 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 节点 2【同意】的契约锁侧动作:合同未结束就静默签掉门挡(形态 B,用户 2026-11-24 拍板)
|
|
|
|
|
- *
|
|
|
|
|
- * 三步:①先查 detail,已是终态就直接放行(复核人自己去签章系统签过、或上次静默签成功但本地状态没落上);
|
|
|
|
|
- * ②没结束就调 `/contract/signbycompany`(形状见该方法注释:contractId + tenantName + 每个文档一条 stampers,
|
|
|
|
|
- * 章字段一律不填 + useDefaultSeal=false + signWithoutAppearance=true ⇒ 落的是**无外观(透明)章面**,
|
|
|
|
|
- * 报告上不会多出一枚看得见的验证章);
|
|
|
|
|
- * ③静默签返回成功**不等于**合同已终态,必须回查 detail 才放行。
|
|
|
|
|
- *
|
|
|
|
|
- * stampers 为什么不能空:2026-11-24 两次真单实测,不传该键与传空数组都回「没有设置参数:stampers」,
|
|
|
|
|
- * 该实例要非空数组;而"不传也能走到合同层"是用不存在的 contractId 探出来的无效推论(参数校验排在合同查询之后)。
|
|
|
|
|
- *
|
|
|
|
|
- * 关于"以复核人名义":本接口参数表里没有操作人字段(1.2.1.1 只有公司三选一 + stampers),
|
|
|
|
|
- * 所以契约锁侧签署主体是**事务所**、不是崇祝艳个人;"谁复核的"落在本方法日志(用户 id)与业务表更新人上。
|
|
|
|
|
- * 因此这里**不再要求复核人登记手机号**——v3.4 第一版把它当硬前置,是因为误以为静默签要用她的账号身份。
|
|
|
|
|
- *
|
|
|
|
|
- * 不用 `/contract/finish/force`:探针显示它先校验操作人(假手机号回"2001003 找不到手机号为…的用户")、
|
|
|
|
|
- * 真手机号回"没有权限",即强制结束受操作人权限限制;form化 B 要的是"把门挡签掉",不是"替她结束"。
|
|
|
|
|
- * 判据 fail-closed:detail 取不到、文档清单取不到、静默签失败、或签完回查仍未结束,都抛错让事务回滚,状态不落 3。
|
|
|
|
|
- *
|
|
|
|
|
- * @param main 单据
|
|
|
|
|
- * @param currentUser 点同意的复核人(仅用于留痕,不再作为契约锁签署身份)
|
|
|
|
|
- * @throws Exception 静默签失败或签署状态取不到
|
|
|
|
|
- */
|
|
|
|
|
- private void ensureReviewerSignedInQiyuesuo(CwReportVerificationSeal main, UserDTO currentUser) throws Exception {
|
|
|
|
|
- if (StringUtils.isBlank(main.getContractId())) {
|
|
|
|
|
- throw new Exception("这条申请还没有生成签署合同");
|
|
|
|
|
- }
|
|
|
|
|
- JSONObject before = readQiyuesuoContract(main.getContractId());
|
|
|
|
|
- if (before == null) {
|
|
|
|
|
- throw new Exception("暂时取不到契约锁的签署状态,请稍后重试【同意】");
|
|
|
|
|
- }
|
|
|
|
|
- if (isContractFinished(before)) {
|
|
|
|
|
- // 复核人已在签章系统签过门挡,或上一次静默签已成功只是本地状态没落上 ⇒ 幂等放行
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- List<String> documentIds = documentIdsOf(before);
|
|
|
|
|
- if (documentIds.isEmpty()) {
|
|
|
|
|
- // 位置类参数不能空,取不到文档就没法构造 stampers,只能拒绝并让用户重试,不能放行为"已复核"
|
|
|
|
|
- throw new Exception("契约锁这边没取到合同的文档清单,暂时无法完成复核签署,请稍后重试【同意】");
|
|
|
|
|
- }
|
|
|
|
|
- JSONObject signResponse = QiyuesuoVerificationPayloadBuilder.signByCompany(main.getContractId(), documentIds);
|
|
|
|
|
- if (!QiyuesuoVerificationPayloadBuilder.isSuccess(signResponse)) {
|
|
|
|
|
- String message = QiyuesuoVerificationPayloadBuilder.message(signResponse, "契约锁未返回结果");
|
|
|
|
|
- // 只打业务码、状态、操作人 id 与文档数,不打手机号(AGENTS 第十三章)
|
|
|
|
|
- log.warn("报告验证章复核静默签失败,id={},contractId={},operatorUserId={},documentCount={},code={},message={},contractStatus={},gateSigned={}",
|
|
|
|
|
- main.getId(), main.getContractId(), currentUser == null ? "" : currentUser.getId(),
|
|
|
|
|
- documentIds.size(),
|
|
|
|
|
- signResponse == null ? "" : signResponse.getString("code"), message,
|
|
|
|
|
- before.getString("status"), isGateActionSigned(before));
|
|
|
|
|
- throw new Exception("复核静默签失败:" + message);
|
|
|
|
|
- }
|
|
|
|
|
- JSONObject after = readQiyuesuoContract(main.getContractId());
|
|
|
|
|
- if (after == null) {
|
|
|
|
|
- throw new Exception("静默签已受理,但回查不到契约锁的合同状态,请稍后重试【同意】");
|
|
|
|
|
- }
|
|
|
|
|
- if (isContractFinished(after)) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- // 受理成功却没进终态:把回查结果打进日志,便于区分"会签还差人""静默签授权没开""章校验拦住自动签"
|
|
|
|
|
- log.warn("报告验证章静默签受理后合同未结束,id={},contractId={},contractStatus={},gateSigned={}",
|
|
|
|
|
- main.getId(), main.getContractId(), after.getString("status"), isGateActionSigned(after));
|
|
|
|
|
- if (isGateActionSigned(after)) {
|
|
|
|
|
- throw new Exception("门挡已静默签署,但契约锁侧合同还没结束(多复核人是会签时要每人各签一遍),"
|
|
|
|
|
- + "请其余复核人各自点一次【同意】后再由最后一人提交");
|
|
|
|
|
- }
|
|
|
|
|
- throw new Exception("契约锁已受理静默签,但门挡动作仍未签署——大概率是该章没开静默签授权、"
|
|
|
|
|
- + "或「签章校验=签章人身份校验」拦住了自动签,请在 138 控制台核对该章的静默签授权后重试");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 从契约锁合同对象里取文档 id 清单(静默签的 stampers 要按文档逐条给,少一条就会"某份文件没签")
|
|
|
|
|
- *
|
|
|
|
|
- * 只取合同正文:detail 的 documents 里 usage=NORMAL 才是正文,ATTACHMENT/EVIDENCE 等不该盖章;
|
|
|
|
|
- * usage 缺失时按正文处理(我们建单只传正文,字段是否回传未实测)。
|
|
|
|
|
- *
|
|
|
|
|
- * @param contract 契约锁合同对象(detail 里的 contract)
|
|
|
|
|
- * @return 文档 id 列表,取不到返回空列表(由调用方决定怎么报错)
|
|
|
|
|
- */
|
|
|
|
|
- private List<String> documentIdsOf(JSONObject contract) {
|
|
|
|
|
- List<String> documentIds = new ArrayList<>();
|
|
|
|
|
- if (contract == null) {
|
|
|
|
|
- return documentIds;
|
|
|
|
|
- }
|
|
|
|
|
- JSONArray documents = contract.getJSONArray("documents");
|
|
|
|
|
- if (documents == null) {
|
|
|
|
|
- return documentIds;
|
|
|
|
|
- }
|
|
|
|
|
- for (int i = 0; i < documents.size(); i++) {
|
|
|
|
|
- JSONObject document = documents.getJSONObject(i);
|
|
|
|
|
- if (document == null) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- String usage = document.getString("usage");
|
|
|
|
|
- if (StringUtils.isNotBlank(usage) && !"NORMAL".equals(usage)) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- String documentId = document.getString("id");
|
|
|
|
|
- if (StringUtils.isNotBlank(documentId)) {
|
|
|
|
|
- documentIds.add(documentId);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return documentIds;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
* 读契约锁合同对象;detail 取不到或里没有 contract 节点时返回 null,由调用方决定怎么报错
|
|
* 读契约锁合同对象;detail 取不到或里没有 contract 节点时返回 null,由调用方决定怎么报错
|
|
|
*
|
|
*
|
|
|
* @param contractId 合同id
|
|
* @param contractId 合同id
|
|
@@ -1056,6 +1171,34 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 撤回前的平台侧一致性校验:合同已"签署完成"时不允许撤回
|
|
|
|
|
+ *
|
|
|
|
|
+ * v3.8 换形态后节点 1 拖完章合同就进终态,于是"业务状态还是 6"与"合同已完成"可以并存一小段时间
|
|
|
|
|
+ * (章拖完但还没点【提交盖章结果】)。这时 recall 必被平台拒,而 `recallContract` 对"已完成"是按幂等放过的
|
|
|
|
|
+ * ⇒ 会出现"本地已撤回、签章侧那份完成件撤不掉还能下载"的不一致,所以在这里先拦下并给出正确出口。
|
|
|
|
|
+ * 详情查不到时不拦(契约锁抖动不该把发起人锁死),后续仍由 recall 的返回码兜底。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param main 单据
|
|
|
|
|
+ * @throws Exception 合同已完成,应走【提交盖章结果】+ 复核驳回
|
|
|
|
|
+ */
|
|
|
|
|
+ private void rejectWithdrawIfContractFinished(CwReportVerificationSeal main) throws Exception {
|
|
|
|
|
+ if (StringUtils.isBlank(main.getContractId())) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONObject response = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ response = QiyuesuoVerificationPayloadBuilder.getContractDetail(main.getContractId());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("报告验证章撤回前查合同状态异常,id={}", main.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONObject contract = response == null ? null : response.getJSONObject("contract");
|
|
|
|
|
+ if (contract != null && QiyuesuoVerificationPayloadBuilder.isContractCompleted(contract.getString("status"))) {
|
|
|
|
|
+ throw new Exception("报告验证章已盖完,签章系统里的合同已经结束,这时撤回只能撤掉我们这边的申请、那份已盖章件撤不掉。"
|
|
|
|
|
+ + "请点【提交盖章结果】进入复核,由复核人驳回");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 驳回/撤回时撤回契约锁合同;合同已终结时按幂等放过
|
|
* 驳回/撤回时撤回契约锁合同;合同已终结时按幂等放过
|
|
|
*
|
|
*
|
|
|
* @param main 单据
|
|
* @param main 单据
|
|
@@ -1101,7 +1244,8 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
cwReportVerificationSealMapper.update(null, clearMain);
|
|
cwReportVerificationSealMapper.update(null, clearMain);
|
|
|
|
|
|
|
|
UpdateWrapper<CwReportVerificationSealFile> clearFiles = new UpdateWrapper<>();
|
|
UpdateWrapper<CwReportVerificationSealFile> clearFiles = new UpdateWrapper<>();
|
|
|
- clearFiles.eq("verification_seal_id", id).eq("del_flag", "0").set("document_id", null);
|
|
|
|
|
|
|
+ clearFiles.eq("verification_seal_id", id).eq("del_flag", "0")
|
|
|
|
|
+ .set("document_id", null).set("signed_attachment_id", null).set("signed_file_name", null);
|
|
|
cwReportVerificationSealFileMapper.update(null, clearFiles);
|
|
cwReportVerificationSealFileMapper.update(null, clearFiles);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1137,7 +1281,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 取可编辑单据:草稿与撤回后可继续编辑,驳回只从待办处理
|
|
|
|
|
|
|
+ * 取可编辑单据:暂存与撤回后可继续编辑,驳回只从待办处理
|
|
|
*
|
|
*
|
|
|
* @param id 申请id
|
|
* @param id 申请id
|
|
|
* @param currentUser 当前用户
|
|
* @param currentUser 当前用户
|
|
@@ -1153,7 +1297,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
throw new Exception("这条申请不存在或已被删除,请刷新列表后重试");
|
|
throw new Exception("这条申请不存在或已被删除,请刷新列表后重试");
|
|
|
}
|
|
}
|
|
|
if (!Arrays.asList(STATUS_DRAFT, STATUS_REJECTED, STATUS_WITHDRAWN).contains(old.getStatus())) {
|
|
if (!Arrays.asList(STATUS_DRAFT, STATUS_REJECTED, STATUS_WITHDRAWN).contains(old.getStatus())) {
|
|
|
- throw new Exception("当前状态不允许修改,只有草稿、已驳回、已撤回可以编辑");
|
|
|
|
|
|
|
+ throw new Exception("当前状态不允许修改,只有暂存、已驳回、已撤回可以编辑");
|
|
|
}
|
|
}
|
|
|
if (!StringUtils.equals(currentUser.getId(), old.getApplyUserId())) {
|
|
if (!StringUtils.equals(currentUser.getId(), old.getApplyUserId())) {
|
|
|
throw new Exception("只有发起人本人可以修改这条申请");
|
|
throw new Exception("只有发起人本人可以修改这条申请");
|
|
@@ -1279,7 +1423,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 删除本人草稿,文件同步逻辑删除
|
|
|
|
|
|
|
+ * 删除本人暂存,文件同步逻辑删除
|
|
|
* @param ids 逗号分隔的申请id
|
|
* @param ids 逗号分隔的申请id
|
|
|
* @return 删除结果
|
|
* @return 删除结果
|
|
|
* @throws Exception 删除异常
|
|
* @throws Exception 删除异常
|
|
@@ -1302,7 +1446,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
String reason = null;
|
|
String reason = null;
|
|
|
if (!"0".equals(old.getStatus())) {
|
|
if (!"0".equals(old.getStatus())) {
|
|
|
- reason = "状态不是草稿";
|
|
|
|
|
|
|
+ reason = "状态不是暂存";
|
|
|
} else if (!StringUtils.equals(currentUser.getId(), old.getApplyUserId())) {
|
|
} else if (!StringUtils.equals(currentUser.getId(), old.getApplyUserId())) {
|
|
|
reason = "只有发起人本人可以删除";
|
|
reason = "只有发起人本人可以删除";
|
|
|
}
|
|
}
|
|
@@ -1316,7 +1460,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
return ResponseUtil.newInstance().error("以下申请不可删除:" + StringUtils.join(refused, ";"));
|
|
return ResponseUtil.newInstance().error("以下申请不可删除:" + StringUtils.join(refused, ";"));
|
|
|
}
|
|
}
|
|
|
if (deletable.isEmpty()) {
|
|
if (deletable.isEmpty()) {
|
|
|
- return ResponseUtil.newInstance().error("没有可删除的草稿,请刷新列表后重试");
|
|
|
|
|
|
|
+ return ResponseUtil.newInstance().error("没有可删除的暂存,请刷新列表后重试");
|
|
|
}
|
|
}
|
|
|
List<String> deleteIds = new ArrayList<>();
|
|
List<String> deleteIds = new ArrayList<>();
|
|
|
for (CwReportVerificationSeal entity : deletable) {
|
|
for (CwReportVerificationSeal entity : deletable) {
|
|
@@ -1479,7 +1623,7 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
List<CwReportVerificationSealFileDTO> uploadedFiles = Collections.emptyList();
|
|
List<CwReportVerificationSealFileDTO> uploadedFiles = Collections.emptyList();
|
|
|
if (uploads != null && !uploads.isEmpty()) {
|
|
if (uploads != null && !uploads.isEmpty()) {
|
|
|
- uploadedFiles = cwReportVerificationSealMapper.selectUploadedAttachments(verificationSealId, UPLOAD_ATTACHMENT_FLAG);
|
|
|
|
|
|
|
+ uploadedFiles = SpringUtil.getBean(CwReportVerificationSealService.class).readBackUploadedFiles(verificationSealId);
|
|
|
if (uploadedFiles == null || uploadedFiles.isEmpty()) {
|
|
if (uploadedFiles == null || uploadedFiles.isEmpty()) {
|
|
|
throw new Exception("待盖章文件保存失败(附件表没有回传到文件),请重试");
|
|
throw new Exception("待盖章文件保存失败(附件表没有回传到文件),请重试");
|
|
|
}
|
|
}
|
|
@@ -1493,6 +1637,50 @@ public class CwReportVerificationSealService extends ServiceImpl<CwReportVerific
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 独立新事务读回手工上传的附件
|
|
|
|
|
+ *
|
|
|
|
|
+ * 附件是 public-modules 另起事务写进 work_attachment 的,本次提交事务在此之前已经查过库,
|
|
|
|
|
+ * MySQL 默认 REPEATABLE READ 下读视图固定在外层事务第一次 SELECT 那一刻,
|
|
|
|
|
+ * 刚提交的附件行读不到,会被误判成"附件表没有回传到文件"。
|
|
|
|
|
+ * 换成 REQUIRES_NEW 后读视图是新的,判据和"读不到就抛异常回滚"的口径都不变。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param verificationSealId 申请id
|
|
|
|
|
+ * @return 附件表查回的文件行
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
|
|
+ public List<CwReportVerificationSealFileDTO> readBackUploadedFiles(String verificationSealId) {
|
|
|
|
|
+ return cwReportVerificationSealMapper.selectUploadedAttachments(verificationSealId, UPLOAD_ATTACHMENT_FLAG);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 建单前的存储路径兜底
|
|
|
|
|
+ *
|
|
|
|
|
+ * 手工上传的附件由 public-modules 另起事务写入 work_attachment,送审事务的读视图固定在这之前,
|
|
|
|
|
+ * selectFilesWithAttachment 关联不到刚提交的附件行,attachment_url 会是空。
|
|
|
|
|
+ * 这里按文件行已落库的 attachment_id 另开新事务单查路径;查不到仍按空处理,交给调用方抛错。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param fileDTO 文件行
|
|
|
|
|
+ * @return 存储路径,取不到返回空
|
|
|
|
|
+ */
|
|
|
|
|
+ private String readAttachmentUrlFallback(CwReportVerificationSealFileDTO fileDTO) {
|
|
|
|
|
+ if (StringUtils.isBlank(fileDTO.getAttachmentId())) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ return SpringUtil.getBean(CwReportVerificationSealService.class).readBackAttachmentUrl(fileDTO.getAttachmentId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 独立新事务按附件id查存储路径
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param attachmentId 附件id
|
|
|
|
|
+ * @return 存储路径
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
|
|
+ public String readBackAttachmentUrl(String attachmentId) {
|
|
|
|
|
+ return cwReportVerificationSealMapper.selectAttachmentUrlById(attachmentId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 写入执业章带出的文件行
|
|
* 写入执业章带出的文件行
|
|
|
*
|
|
*
|
|
|
* @param carriedFiles 带出行
|
|
* @param carriedFiles 带出行
|