e签宝发起签署流程,多个方法调整
This commit is contained in:
parent
896bdd2e26
commit
985cbf84ac
@ -55,7 +55,7 @@ public class CommonConstant {
|
||||
public static final Integer MCH_ENTITY_TYPE_QY = 1;
|
||||
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_ING = 1;
|
||||
public static final Integer CONTRACT_SIGN_STA_FINISH = 2;
|
||||
|
||||
@ -10,6 +10,7 @@ package com.suisung.mall.shop.esign.service;
|
||||
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.esign.EsignContract;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -44,13 +45,12 @@ public interface EsignContractService {
|
||||
* 更新合同流程ID和文件地址和状态
|
||||
*
|
||||
* @param mchMobile
|
||||
* @param contractFileId
|
||||
* @param signFlowStatus
|
||||
* @param signFlowId
|
||||
* @param fileUrl
|
||||
* @return
|
||||
*/
|
||||
Boolean updateContractFlowIdAndFileUrl(String mchMobile, String contractFileId, String signFlowId, Integer signFlowStatus, String fileUrl);
|
||||
Boolean updateContractFlowIdAndFileUrl(String mchMobile, String signFlowId, Integer signFlowStatus, String fileUrl);
|
||||
|
||||
/**
|
||||
* 更新合同流程ID和文件地址和状态
|
||||
@ -106,4 +106,12 @@ public interface EsignContractService {
|
||||
* @return
|
||||
*/
|
||||
String getSignedContractFileUrl(String signFlowId);
|
||||
|
||||
/**
|
||||
* 检查合同签署流程状态,更新合同状态和下载地址
|
||||
*
|
||||
* @param mchMobile
|
||||
* @return
|
||||
*/
|
||||
Pair<Integer, String> checkSignFlowStatus(String mchMobile);
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ import com.suisung.mall.shop.store.service.ShopMerchEntryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -267,6 +268,13 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
|
||||
if (success && StrUtil.isNotBlank(downloadUrl)) {
|
||||
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);
|
||||
@ -314,15 +322,14 @@ public class EsignContractServiceImpl extends BaseServiceImpl<EsignContractMappe
|
||||
* 发起合同签署流程后,根据返回的流程Id 更改记录;收到完成签署异步通知之后,更改正式签署合同的地址
|
||||
*
|
||||
* @param mchMobile 商家注册手机号
|
||||
* @param contractFileId 未签署合同文件Id
|
||||
* @param signFlowId 合同签署流程ID(signFlowId和fileUrl、signFlowStatus 起码一个是必填的)
|
||||
* @param signFlowStatus 签署流程状态(signFlowId和fileUrl、signFlowStatus 起码一个是必填的)
|
||||
* @param fileUrl E签宝的正式签署合同文件地址(可空)(signFlowId和fileUrl、signFlowStatus 起码一个是必填的)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateContractFlowIdAndFileUrl(String mchMobile, String contractFileId, String signFlowId, Integer signFlowStatus, String fileUrl) {
|
||||
if (StrUtil.isBlank(mchMobile) || StrUtil.isBlank(contractFileId) || (StrUtil.isBlank(signFlowId) && StrUtil.isBlank(fileUrl))) {
|
||||
public Boolean updateContractFlowIdAndFileUrl(String mchMobile, String signFlowId, Integer signFlowStatus, String fileUrl) {
|
||||
if (StrUtil.isBlank(mchMobile) || (StrUtil.isBlank(signFlowId) && StrUtil.isBlank(fileUrl))) {
|
||||
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签宝签名相关方法
|
||||
|
||||
|
||||
@ -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.components.TaskService;
|
||||
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.message.service.ShopMessageTemplateService;
|
||||
import com.suisung.mall.shop.store.mapper.ShopMerchEntryMapper;
|
||||
import com.suisung.mall.shop.store.service.ShopMerchEntryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -57,6 +59,10 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
||||
@Resource
|
||||
private EsignContractFillingFileService esignContractFillingFileService;
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private EsignContractService esignContractService;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
@ -350,7 +356,17 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl<ShopMerchEntryMap
|
||||
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 已经审核通过的,不能再审核了。
|
||||
|
||||
UpdateWrapper<ShopMerchEntry> updateWrapper = new UpdateWrapper<>();
|
||||
if (approvalStatus.equals(CommonConstant.Enable) && StrUtil.isBlank(approvalRemark)) {
|
||||
// 审核通过
|
||||
approvalRemark = "审核通过,后续将向您发起签署电子合同流程。";
|
||||
updateWrapper.set("signed_status", CommonConstant.CONTRACT_SIGN_STA_ING);
|
||||
} else if (approvalStatus.equals(CommonConstant.Disable2) && StrUtil.isBlank(approvalRemark)) {
|
||||
approvalRemark = "审核未通过,请继续完善入驻资料信息。";
|
||||
}
|
||||
|
||||
UpdateWrapper<ShopMerchEntry> updateWrapper = new UpdateWrapper<>();
|
||||
|
||||
updateWrapper.eq("id", id)
|
||||
.set("approval_status", approvalStatus)
|
||||
.set("approval_remark", approvalRemark)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user