|
@@ -9,6 +9,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
+import com.trade.service.contract.config.ContractConfigProperties;
|
|
|
import com.trade.service.contract.util.esign.bizprocess.BizProcessorFactory;
|
|
|
import com.trade.service.contract.util.esign.bizprocess.SignedBizProcessor;
|
|
|
import org.jsoup.helper.StringUtil;
|
|
@@ -68,6 +69,8 @@ public class ESignContractServiceImpl implements SignPlatformService {
|
|
|
@Resource
|
|
|
@Lazy
|
|
|
private BizProcessorFactory bizProcessorFactory;
|
|
|
+ @Resource
|
|
|
+ private ContractConfigProperties contractConfigProperties;
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -136,7 +139,11 @@ public class ESignContractServiceImpl implements SignPlatformService {
|
|
|
params.put("status", 2);
|
|
|
messageSender.sendSignNotice2BizSys(JSON.toJSONString(params));
|
|
|
}
|
|
|
- // todo 判断所有人签署完成,手动调用归档
|
|
|
+ // 判断所有人签署完成,手动调用归档
|
|
|
+ List<ESignFlowSigner> signerList = esignFlowSignerService.getListByFlowId(eSignFlow.getFlowId());
|
|
|
+ if (signerList.stream().allMatch(e -> e.getStatus() == 1)) {
|
|
|
+ ESignRequest.archivESignFlow(eSignFlow.getFlowId());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -152,10 +159,6 @@ public class ESignContractServiceImpl implements SignPlatformService {
|
|
|
}
|
|
|
// 签署完成
|
|
|
if (ESignConstant.SIGN_FLOW_STATUS_FINISH == eSignCallback.getFlowStatus()) {
|
|
|
- // 归档签署文件
|
|
|
- /*
|
|
|
- * if (!eSignFlow.getAutoArchive()) { ESignRequest.archivESignFlow(eSignFlow.getFlowId()); }
|
|
|
- */
|
|
|
// 下载签署完成后的文件
|
|
|
downloadSignedFile(eSignFlow);
|
|
|
// 更新签署流程状态
|
|
@@ -196,14 +199,9 @@ public class ESignContractServiceImpl implements SignPlatformService {
|
|
|
ESignFlow eSignFlow = esignFlowService.getByFlowId(flowId);
|
|
|
if (ContractConstant.CONTRACT_SIGN_STATUS_SIGNED.equals(eSignFlow.getStatus())) {
|
|
|
List<ESignFile> eSignFileList = esignFileService.getByFlowId(flowId);
|
|
|
- List<SignCallback2Biz.SignedFile2Biz> signedFile2BizList = new ArrayList<>();
|
|
|
- for (ESignFile eSignFile : eSignFileList) {
|
|
|
- SignCallback2Biz.SignedFile2Biz file2Biz = new SignCallback2Biz.SignedFile2Biz();
|
|
|
- file2Biz.setFileId(eSignFile.getSignedFileId());
|
|
|
- file2Biz.setRawFileId(eSignFile.getRawFileId());
|
|
|
- file2Biz.setFileType(eSignFile.getFileType());
|
|
|
- signedFile2BizList.add(file2Biz);
|
|
|
- }
|
|
|
+ List<SignCallback2Biz.SignedFile2Biz> signedFile2BizList = eSignFileList.stream().map(
|
|
|
+ e -> new SignCallback2Biz.SignedFile2Biz(e.getSignedFileId(), e.getRawFileId(), e.getFileType()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
callback.setSignedFiles(signedFile2BizList);
|
|
|
}
|
|
|
callback.setSignStatus(eSignFlow.getStatus());
|
|
@@ -362,8 +360,13 @@ public class ESignContractServiceImpl implements SignPlatformService {
|
|
|
}
|
|
|
signField = new ESignDoc(eSignFileId, accountMap.get(signer.getSignerIdNo()), actorIdentityType,
|
|
|
accountMap.get(salInfo.getSealIdNo()), null, 1, posBean, null, null, null);
|
|
|
+ if (handleAutoSign(flowId, salInfo, signField))
|
|
|
+ continue;
|
|
|
} else if (ESignConstant.CRED_PSN_CH_IDCARD.equals(signer.getSignerIdType())
|
|
|
|| ESignConstant.CRED_PSN_PASSPORT.equals(signer.getSignerIdType())) {
|
|
|
+ if (Boolean.TRUE.equals(salInfo.getAutoSign())) {
|
|
|
+ throw new ServiceException("签署任务-个人签章暂不支持自动签章", HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
signField = new ESignDoc(eSignFileId, accountMap.get(signer.getSignerIdNo()), null, null, null,
|
|
|
1, posBean, "1", null, null);
|
|
|
}
|
|
@@ -379,6 +382,28 @@ public class ESignContractServiceImpl implements SignPlatformService {
|
|
|
saveSignFlowSigner(flowId, accountMap);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理自动签章
|
|
|
+ *
|
|
|
+ * @param flowId 签署流程id
|
|
|
+ * @param sealInfo 签章信息
|
|
|
+ * @param signField e签宝签署任务对象
|
|
|
+ * @return 是否自动签章
|
|
|
+ */
|
|
|
+ private boolean handleAutoSign(String flowId, ContractSeal sealInfo, ESignDoc signField) {
|
|
|
+ if (Boolean.TRUE.equals(sealInfo.getAutoSign())) {
|
|
|
+ String sealId = contractConfigProperties.getESignSealIdByIdNo(sealInfo.getSealIdNo());
|
|
|
+ if (null == sealId) {
|
|
|
+ throw new ServiceException("签署任务-签章信息-企业签章-自动签章-未配置签章ID", HttpStatus.BAD_REQUEST);
|
|
|
+ }
|
|
|
+ signField.setSealId(sealId);
|
|
|
+ // 调用自动签署方法
|
|
|
+ ESignRequest.addPlatformAutoSignArea(flowId, Collections.singletonList(signField));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
private void saveSignFlowSigner(String flowId, Map<String, String> accountMap) {
|
|
|
for (String eAccountId : accountMap.values()) {
|
|
|
ESignFlowSigner flowSigner = ESignFlowSigner.builder().flowId(flowId).eAccountId(eAccountId).build();
|