From 9039a3523485792a374c9810da82fd671113b4e0 Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Thu, 20 Mar 2025 12:08:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=85=A5=E9=A9=BB=E5=92=8C?= =?UTF-8?q?=E5=90=88=E5=90=8C=E7=94=9F=E6=88=90=EF=BC=8C=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E9=83=BD=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/common/constant/CommonConstant.java | 5 +- .../impl/EsignContractServiceImpl.java | 56 ++++++++++++++++--- .../mobile/UserOrderController.java | 2 +- .../order/mapper/ShopOrderBaseMapper.java | 2 +- .../order/service/ShopOrderBaseService.java | 11 ++-- .../impl/ShopOrderBaseServiceImpl.java | 20 ++++--- .../store/service/ShopMerchEntryService.java | 10 ++++ .../impl/ShopMerchEntryServiceImpl.java | 36 ++++++++++++ .../mapper/order/ShopOrderBaseMapper.xml | 4 +- 9 files changed, 119 insertions(+), 27 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 f6b27f01..291b1090 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,9 +55,10 @@ 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:预备数据阶段;0-等待签署;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_ING = 0; + public static final Integer CONTRACT_SIGN_STA_PARTIALLY = 1; public static final Integer CONTRACT_SIGN_STA_FINISH = 2; public static final Integer CONTRACT_SIGN_STA_CANCEL = 3; public static final Integer CONTRACT_SIGN_STA_EXPIRED = 5; 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 ae88ed4b..9e8176a2 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 @@ -23,6 +23,7 @@ import com.suisung.mall.common.modules.esign.EsignContractFillingFile; import com.suisung.mall.common.modules.esign.EsignPlatformInfo; import com.suisung.mall.common.modules.merch.ShopMerchEntry; import com.suisung.mall.core.web.service.impl.BaseServiceImpl; +import com.suisung.mall.shop.components.TaskService; import com.suisung.mall.shop.esign.mapper.EsignContractMapper; import com.suisung.mall.shop.esign.service.EsignContractFillingFileService; import com.suisung.mall.shop.esign.service.EsignContractService; @@ -34,6 +35,7 @@ import com.suisung.mall.shop.esign.utils.exception.EsignDemoException; import com.suisung.mall.shop.page.service.OssService; import com.suisung.mall.shop.store.service.ShopMerchEntryService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; import org.springframework.data.util.Pair; @@ -89,6 +91,10 @@ public class EsignContractServiceImpl extends BaseServiceImpl(new JSONObject().put("code", 400).put("msg", "appId 有误").toString(), HttpStatus.INTERNAL_SERVER_ERROR); } + //按照规则进行加密 String signData = timestamp + requestBody; String mySignature = getSignature(signData, appSecret, "HmacSHA256", "UTF-8"); @@ -251,11 +258,22 @@ public class EsignContractServiceImpl extends BaseServiceImpl(new JSONObject().put("code", 400).put("msg", "返回数据有误").toString(), HttpStatus.INTERNAL_SERVER_ERROR); } + // 获取合同签署记录 + EsignContract esignContract = baseMapper.selectOne(new QueryWrapper().eq("sign_flow_id", signFlowId)); + if (esignContract == null) { + return new ResponseEntity<>(new JSONObject().put("code", 400).put("msg", "获取不到合同记录").toString(), HttpStatus.INTERNAL_SERVER_ERROR); + } + log.debug("签署流程结束通知:action >>> {}", action); + if (CommonConstant.CONTRACT_SIGN_STA_FINISH.equals(esignContract.getSign_flow_status()) && StrUtil.isNotEmpty(esignContract.getLocal_contract_url())) { + // 已经签署完毕,不用在更改状态 + return new ResponseEntity<>(new JSONObject().put("code", 200).put("msg", "success").toString(), HttpStatus.OK); + } // 获取正式盖章合同文件,上传到 oss 服务器,更状态,保存数据 if (action.equals("SIGN_FLOW_COMPLETE")) {// 签署流程完毕 @@ -268,13 +286,20 @@ public class EsignContractServiceImpl extends BaseServiceImpl(new JSONObject().put("code", 200).put("msg", "success").toString(), HttpStatus.OK); } + } else if (action.equals("SIGN_MISSON_COMPLETE") && ObjectUtil.isNotEmpty(signResult)) {// 签署方-签署结果(含拒签)通知 + Integer signFlowStatus = 1; + if (signResult.equals(2)) { + signFlowStatus = CommonConstant.CONTRACT_SIGN_STA_PARTIALLY; + } else if (signResult.equals(4)) { + signFlowStatus = CommonConstant.CONTRACT_SIGN_STA_REJECT; + } + // 更新合同流程状态和文件地址 + boolean success = updateContractFlowStatusAndFileUrlBySignFlowId(signFlowId, signFlowStatus, ""); + if (success) { + 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); @@ -432,6 +457,7 @@ public class EsignContractServiceImpl extends BaseServiceImpl { + log.debug("###更改同步合同审核状态和下载地址###"); + // 更改同步合同审核状态和下载地址 + if (!shopMerchEntryService.updateMerchEntrySignedStatusAndContractDownloadUrl(esignContract.getMch_mobile(), signFlowStatus, localFileUrl)) { + log.error("###更改同步合同审核状态和下载地址失败###"); + } + }); + } + + return success; } /** diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/order/controller/mobile/UserOrderController.java b/mall-shop/src/main/java/com/suisung/mall/shop/order/controller/mobile/UserOrderController.java index d0ce1131..722e9d27 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/order/controller/mobile/UserOrderController.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/order/controller/mobile/UserOrderController.java @@ -220,7 +220,7 @@ public class UserOrderController extends BaseControllerImpl { @ApiOperation(value = "查询移动商家端订单数据(新)", notes = "查询移动商家端订单数据(新)") @RequestMapping(value = "/mch/order/list", method = RequestMethod.POST) public CommonResult selectMchOrderPageList(@RequestBody JSONObject params) { - return CommonResult.success(shopOrderBaseService.selectMchOrderPageList(params.getInt("storeId"), params.getStr("keyword"), params.getInt("status"), params.getInt("pageNum"), params.getInt("pageSize"))); + return CommonResult.success(shopOrderBaseService.selectMchOrderPageList(params.getInt("storeId"), params.getStr("keyword"), params.getInt("status"), 25, params.getInt("pageNum"), params.getInt("pageSize"))); } @ApiOperation(value = "查询移动商家端订单详情数据", notes = "查询移动商家端订单详情数据") diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/order/mapper/ShopOrderBaseMapper.java b/mall-shop/src/main/java/com/suisung/mall/shop/order/mapper/ShopOrderBaseMapper.java index 84125ec5..ba808126 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/order/mapper/ShopOrderBaseMapper.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/order/mapper/ShopOrderBaseMapper.java @@ -68,5 +68,5 @@ public interface ShopOrderBaseMapper extends BaseMapper { * @param status 订单状态 * @return */ - IPage selectMchOrderPageList(@Param("storeId") Integer storeId, @Param("keyword") String keyword, @Param("status") Integer status, IPage page); + IPage selectMchOrderPageList(@Param("storeId") Integer storeId, @Param("keyword") String keyword, @Param("status") Integer status, @Param("expiredMinute") Integer expiredMinute, IPage page); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/ShopOrderBaseService.java b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/ShopOrderBaseService.java index 8b73c494..baf11462 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/ShopOrderBaseService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/ShopOrderBaseService.java @@ -538,12 +538,13 @@ public interface ShopOrderBaseService extends IBaseService { * 商家版订单列表(新) * * @param storeId - * @param keyword - * @param status - * @param pageNum - * @param pageSize + * @param keyword 订单搜索关键字 + * @param status 查询状态:1-进行中(时效内);2-异常订单(已超时的);3-退款订单 + * @param expiredMinute 配送超时的分钟数,单位分钟 + * @param pageNum 页码 + * @param pageSize 页大小 * @return */ - IPage selectMchOrderPageList(Integer storeId, String keyword, Integer status, Integer pageNum, Integer pageSize); + IPage selectMchOrderPageList(Integer storeId, String keyword, Integer status, Integer expiredMinute, Integer pageNum, Integer pageSize); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java index b1b9fb97..77151983 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/order/service/impl/ShopOrderBaseServiceImpl.java @@ -8484,17 +8484,21 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl selectMchOrderPageList(Integer storeId, String keyword, Integer status, Integer pageNum, Integer pageSize) { - //订单状态(LIST):2011-待订单审核;2013-待财务审核;2020-待配货/待出库审核;2030-待发货;2040-已发货/待收货确认;2060-已完成/已签收;2070-已取消/已作废; + public IPage selectMchOrderPageList(Integer storeId, String keyword, Integer status, Integer expiredMinute, Integer pageNum, Integer pageSize) { + // order_state_id 订单状态(LIST):2011-待订单审核;2013-待财务审核;2020-待配货/待出库审核;2030-待发货;2040-已发货/待收货确认;2060-已完成/已签收;2070-已取消/已作废; Page page = new Page<>(pageNum, pageSize); - return shopOrderBaseMapper.selectMchOrderPageList(storeId, keyword, status, page); + if (expiredMinute == null || expiredMinute <= 0) { + expiredMinute = 25; + } + return shopOrderBaseMapper.selectMchOrderPageList(storeId, keyword, status, expiredMinute, page); } } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMerchEntryService.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMerchEntryService.java index ecc54092..96034688 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMerchEntryService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/ShopMerchEntryService.java @@ -107,4 +107,14 @@ public interface ShopMerchEntryService { * @return */ ShopMerchEntry getShopMerchEntryByLicenseNumber(String loginMobile, String bizLicenseNumber, Integer approvalStatus); + + /** + * 根据商家注册的手机号,更新合同签署状态和合同下载地址 + * + * @param loginMobile + * @param signedStatus + * @param contractDownloadUrl + * @return + */ + Boolean updateMerchEntrySignedStatusAndContractDownloadUrl(String loginMobile, Integer signedStatus, String contractDownloadUrl); } \ No newline at end of file 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 b27e761b..20963311 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 @@ -363,6 +363,14 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl { + log.debug("###更改同步合同审核状态和下载地址###"); + if (!updateMerchEntrySignedStatusAndContractDownloadUrl(record.getLogin_mobile(), record.getSigned_status(), record.getContract_download_url())) { + log.error("###更改同步合同审核状态和下载地址失败###"); + } + }); } } @@ -568,4 +576,32 @@ public class ShopMerchEntryServiceImpl extends BaseServiceImpl updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("login_mobile", loginMobile); + + if (ObjectUtil.isNotEmpty(signedStatus)) { + updateWrapper.eq("signed_status", signedStatus); + } + + if (StrUtil.isNotBlank(contractDownloadUrl)) { + updateWrapper.set("contract_download_url", contractDownloadUrl); + } + + return update(updateWrapper); + } } diff --git a/mall-shop/src/main/resources/mapper/order/ShopOrderBaseMapper.xml b/mall-shop/src/main/resources/mapper/order/ShopOrderBaseMapper.xml index 6c56f3a7..7a80740c 100644 --- a/mall-shop/src/main/resources/mapper/order/ShopOrderBaseMapper.xml +++ b/mall-shop/src/main/resources/mapper/order/ShopOrderBaseMapper.xml @@ -697,12 +697,12 @@ and ob.order_state_id IN (2020, 2030, 2040) - and TIMESTAMPADD(MINUTE, 25, oi.order_time) >= NOW() + and TIMESTAMPADD(MINUTE, #{expiredMinute}, oi.order_time) >= NOW() and ob.order_state_id IN (2020, 2030, 2040) - and TIMESTAMPADD(MINUTE, 25, oi.order_time) <= NOW() + and TIMESTAMPADD(MINUTE, #{expiredMinute}, oi.order_time) <= NOW()