e签宝发起签署流程,多个方法调整

This commit is contained in:
Jack 2025-03-17 00:19:39 +08:00
parent 896bdd2e26
commit 985cbf84ac
4 changed files with 80 additions and 9 deletions

View File

@ -55,7 +55,7 @@ public class CommonConstant {
public static final Integer MCH_ENTITY_TYPE_QY = 1; public static final Integer MCH_ENTITY_TYPE_QY = 1;
public static final Integer MCH_ENTITY_TYPE_GR = 2; public static final Integer MCH_ENTITY_TYPE_GR = 2;
// 合作方签署状态-1预备数据阶段1-等待签署2 - 已完成所有签署方完成签署3 - 已撤销发起方撤销签署任务5 - 已过期签署截止日到期后触发7 - 已拒签签署方拒绝签署 // 合作方签署状态-1预备数据阶段1-等待签署2-已完成所有签署方完成签署3-已撤销发起方撤销签署任务5-已过期签署截止日到期后触发7-已拒签签署方拒绝签署
public static final Integer CONTRACT_SIGN_STA_PREPARE = -1; public static final Integer CONTRACT_SIGN_STA_PREPARE = -1;
public static final Integer CONTRACT_SIGN_STA_ING = 1; public static final Integer CONTRACT_SIGN_STA_ING = 1;
public static final Integer CONTRACT_SIGN_STA_FINISH = 2; public static final Integer CONTRACT_SIGN_STA_FINISH = 2;

View File

@ -10,6 +10,7 @@ package com.suisung.mall.shop.esign.service;
import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.modules.esign.EsignContract; import com.suisung.mall.common.modules.esign.EsignContract;
import org.springframework.data.util.Pair;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -44,13 +45,12 @@ public interface EsignContractService {
* 更新合同流程ID和文件地址和状态 * 更新合同流程ID和文件地址和状态
* *
* @param mchMobile * @param mchMobile
* @param contractFileId
* @param signFlowStatus * @param signFlowStatus
* @param signFlowId * @param signFlowId
* @param fileUrl * @param fileUrl
* @return * @return
*/ */
Boolean updateContractFlowIdAndFileUrl(String mchMobile, String contractFileId, String signFlowId, Integer signFlowStatus, String fileUrl); Boolean updateContractFlowIdAndFileUrl(String mchMobile, String signFlowId, Integer signFlowStatus, String fileUrl);
/** /**
* 更新合同流程ID和文件地址和状态 * 更新合同流程ID和文件地址和状态
@ -106,4 +106,12 @@ public interface EsignContractService {
* @return * @return
*/ */
String getSignedContractFileUrl(String signFlowId); String getSignedContractFileUrl(String signFlowId);
/**
* 检查合同签署流程状态更新合同状态和下载地址
*
* @param mchMobile
* @return
*/
Pair<Integer, String> checkSignFlowStatus(String mchMobile);
} }

View File

@ -36,6 +36,7 @@ import com.suisung.mall.shop.store.service.ShopMerchEntryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.data.util.Pair;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -267,6 +268,13 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
if (success && StrUtil.isNotBlank(downloadUrl)) { if (success && StrUtil.isNotBlank(downloadUrl)) {
return new ResponseEntity<>(new JSONObject().put("code", 200).put("msg", "success").toString(), HttpStatus.OK); return new ResponseEntity<>(new JSONObject().put("code", 200).put("msg", "success").toString(), HttpStatus.OK);
} }
} else {
log.debug("签署流程未完成,不做处理");
// 更新合同流程状态和文件地址
// boolean success = updateContractFlowStatusAndFileUrlBySignFlowId(signFlowId, CommonConstant.CONTRACT_SIGN_STA_FINISH, "");
// if (success) {
// return new ResponseEntity<>(new JSONObject().put("code", 200).put("msg", "success").toString(), HttpStatus.OK);
// }
} }
return new ResponseEntity<>(new JSONObject().put("code", 400).put("msg", "未更新数据!").toString(), HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(new JSONObject().put("code", 400).put("msg", "未更新数据!").toString(), HttpStatus.INTERNAL_SERVER_ERROR);
@ -314,15 +322,14 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
* 发起合同签署流程后根据返回的流程Id 更改记录收到完成签署异步通知之后更改正式签署合同的地址 * 发起合同签署流程后根据返回的流程Id 更改记录收到完成签署异步通知之后更改正式签署合同的地址
* *
* @param mchMobile 商家注册手机号 * @param mchMobile 商家注册手机号
* @param contractFileId 未签署合同文件Id
* @param signFlowId 合同签署流程IDsignFlowId和fileUrlsignFlowStatus 起码一个是必填的 * @param signFlowId 合同签署流程IDsignFlowId和fileUrlsignFlowStatus 起码一个是必填的
* @param signFlowStatus 签署流程状态signFlowId和fileUrlsignFlowStatus 起码一个是必填的 * @param signFlowStatus 签署流程状态signFlowId和fileUrlsignFlowStatus 起码一个是必填的
* @param fileUrl E签宝的正式签署合同文件地址可空signFlowId和fileUrlsignFlowStatus 起码一个是必填的 * @param fileUrl E签宝的正式签署合同文件地址可空signFlowId和fileUrlsignFlowStatus 起码一个是必填的
* @return * @return
*/ */
@Override @Override
public Boolean updateContractFlowIdAndFileUrl(String mchMobile, String contractFileId, String signFlowId, Integer signFlowStatus, String fileUrl) { public Boolean updateContractFlowIdAndFileUrl(String mchMobile, String signFlowId, Integer signFlowStatus, String fileUrl) {
if (StrUtil.isBlank(mchMobile) || StrUtil.isBlank(contractFileId) || (StrUtil.isBlank(signFlowId) && StrUtil.isBlank(fileUrl))) { if (StrUtil.isBlank(mchMobile) || (StrUtil.isBlank(signFlowId) && StrUtil.isBlank(fileUrl))) {
return false; return false;
} }
@ -573,6 +580,45 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
} }
} }
/**
* 检查合同签署流程状态更新合同状态和下载地址
*
* @param mchMobile
* @return
*/
@Override
public Pair<Integer, String> checkSignFlowStatus(String mchMobile) {
EsignContract esignContract = getEsignContractByMchMobile(mchMobile);
if (esignContract != null && StrUtil.isNotBlank(esignContract.getSign_flow_id())) {
if (CommonConstant.CONTRACT_SIGN_STA_FINISH.equals(esignContract.getSign_flow_status())) {
// 状态已经完成签署的但是没有合同文件的再次获取合同文件地址
if (StrUtil.isBlank(esignContract.getLocal_contract_url())) {
String downloadUrl = getSignedContractFileUrl(esignContract.getSign_flow_id());
if (StrUtil.isNotBlank(downloadUrl)) {
// 更新合同流程文件地址
updateContractFlowIdAndFileUrl(esignContract.getMch_mobile(), esignContract.getSign_flow_id(), CommonConstant.CONTRACT_SIGN_STA_FINISH, downloadUrl);
return Pair.of(CommonConstant.CONTRACT_SIGN_STA_FINISH, downloadUrl);
} else {
return Pair.of(CommonConstant.CONTRACT_SIGN_STA_FINISH, "");
}
} else {
return Pair.of(CommonConstant.CONTRACT_SIGN_STA_FINISH, esignContract.getLocal_contract_url());
}
} else {
String downloadUrl = getSignedContractFileUrl(esignContract.getSign_flow_id());
if (StrUtil.isNotBlank(downloadUrl)) {
// 更新合同流程文件地址
updateContractFlowIdAndFileUrl(esignContract.getMch_mobile(), esignContract.getSign_flow_id(), CommonConstant.CONTRACT_SIGN_STA_FINISH, downloadUrl);
return Pair.of(CommonConstant.CONTRACT_SIGN_STA_FINISH, downloadUrl);
} else {
return Pair.of(esignContract.getSign_flow_status(), "");
}
}
}
return null;
}
// e签宝签名相关方法 // e签宝签名相关方法

View File

@ -26,12 +26,14 @@ import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.base.service.AccountBaseConfigService; import com.suisung.mall.shop.base.service.AccountBaseConfigService;
import com.suisung.mall.shop.components.TaskService; import com.suisung.mall.shop.components.TaskService;
import com.suisung.mall.shop.esign.service.EsignContractFillingFileService; import com.suisung.mall.shop.esign.service.EsignContractFillingFileService;
import com.suisung.mall.shop.esign.service.EsignContractService;
import com.suisung.mall.shop.esign.service.EsignPlatformInfoService; import com.suisung.mall.shop.esign.service.EsignPlatformInfoService;
import com.suisung.mall.shop.message.service.ShopMessageTemplateService; import com.suisung.mall.shop.message.service.ShopMessageTemplateService;
import com.suisung.mall.shop.store.mapper.ShopMerchEntryMapper; import com.suisung.mall.shop.store.mapper.ShopMerchEntryMapper;
import com.suisung.mall.shop.store.service.ShopMerchEntryService; import com.suisung.mall.shop.store.service.ShopMerchEntryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.util.Pair; import org.springframework.data.util.Pair;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -57,6 +59,10 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
@Resource @Resource
private EsignContractFillingFileService esignContractFillingFileService; private EsignContractFillingFileService esignContractFillingFileService;
@Lazy
@Resource
private EsignContractService esignContractService;
@Autowired @Autowired
private TaskService taskService; private TaskService taskService;
@ -350,7 +356,17 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
return CommonResult.success(null, "暂无申请记录!"); return CommonResult.success(null, "暂无申请记录!");
} }
return CommonResult.success(recordList.get(0)); ShopMerchEntry record = recordList.get(0);
if (CommonConstant.MCH_APPR_STA_PASS.equals(record.getApproval_status())
&& StrUtil.isBlank(record.getContract_download_url())) {
Pair<Integer, String> contractInfo = esignContractService.checkSignFlowStatus(record.getLogin_mobile());
if (contractInfo != null) {
record.setSigned_status(contractInfo.getFirst());
record.setContract_download_url(contractInfo.getSecond());
}
}
return CommonResult.success(record);
} }
/** /**
@ -387,15 +403,16 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
} }
// TODO 已经审核通过的不能再审核了 // TODO 已经审核通过的不能再审核了
UpdateWrapper<ShopMerchEntry> updateWrapper = new UpdateWrapper<>();
if (approvalStatus.equals(CommonConstant.Enable) && StrUtil.isBlank(approvalRemark)) { if (approvalStatus.equals(CommonConstant.Enable) && StrUtil.isBlank(approvalRemark)) {
// 审核通过 // 审核通过
approvalRemark = "审核通过,后续将向您发起签署电子合同流程。"; approvalRemark = "审核通过,后续将向您发起签署电子合同流程。";
updateWrapper.set("signed_status", CommonConstant.CONTRACT_SIGN_STA_ING);
} else if (approvalStatus.equals(CommonConstant.Disable2) && StrUtil.isBlank(approvalRemark)) { } else if (approvalStatus.equals(CommonConstant.Disable2) && StrUtil.isBlank(approvalRemark)) {
approvalRemark = "审核未通过,请继续完善入驻资料信息。"; approvalRemark = "审核未通过,请继续完善入驻资料信息。";
} }
UpdateWrapper<ShopMerchEntry> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", id) updateWrapper.eq("id", id)
.set("approval_status", approvalStatus) .set("approval_status", approvalStatus)
.set("approval_remark", approvalRemark) .set("approval_remark", approvalRemark)