From 985cbf84ac2e34f6fa1b3dc81e5e23adc646599b Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Mon, 17 Mar 2025 00:19:39 +0800 Subject: [PATCH] =?UTF-8?q?e=E7=AD=BE=E5=AE=9D=E5=8F=91=E8=B5=B7=E7=AD=BE?= =?UTF-8?q?=E7=BD=B2=E6=B5=81=E7=A8=8B=EF=BC=8C=E5=A4=9A=E4=B8=AA=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/common/constant/CommonConstant.java | 2 +- .../esign/service/EsignContractService.java | 12 ++++- .../impl/EsignContractServiceImpl.java | 52 +++++++++++++++++-- .../impl/ShopMerchEntryServiceImpl.java | 23 ++++++-- 4 files changed, 80 insertions(+), 9 deletions(-) diff --git a/mall-common/src/main/java/com/suisung/mall/common/constant/CommonConstant.java b/mall-common/src/main/java/com/suisung/mall/common/constant/CommonConstant.java index 6a4e9ee5..f6b27f01 100644 --- a/mall-common/src/main/java/com/suisung/mall/common/constant/CommonConstant.java +++ b/mall-common/src/main/java/com/suisung/mall/common/constant/CommonConstant.java @@ -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; diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/EsignContractService.java b/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/EsignContractService.java index aebe50e4..aebeea3d 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/EsignContractService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/EsignContractService.java @@ -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 checkSignFlowStatus(String mchMobile); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignContractServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignContractServiceImpl.java index cc823e9c..ae88ed4b 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignContractServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/esign/service/impl/EsignContractServiceImpl.java @@ -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(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 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签宝签名相关方法 diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMerchEntryServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMerchEntryServiceImpl.java index e6ce7405..b27e761b 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMerchEntryServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopMerchEntryServiceImpl.java @@ -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 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 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 updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("id", id) .set("approval_status", approvalStatus) .set("approval_remark", approvalRemark)