From 572fd8325c78965f462cc19847033dac86fc5be6 Mon Sep 17 00:00:00 2001
From: ANDRU-PC\Andru <769883346@qq.com>
Date: 星期日, 08 十月 2023 16:05:38 +0800
Subject: [PATCH] 调整工具类方法

---
 phi_platform_user/src/main/java/com/hx/phip/service/order/OrderServiceV2.java              |    7 +++
 phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java             |    2 
 phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java |    2 
 phi_platform_user/src/main/java/com/hx/phip/service/impl/UserServiceImpl.java              |   31 +++------------
 phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderServiceV2Impl.java     |   61 ++++++++++++++++++++++++++++++
 5 files changed, 75 insertions(+), 28 deletions(-)

diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/impl/UserServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/impl/UserServiceImpl.java
index ad8cc41..1a036f4 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/service/impl/UserServiceImpl.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/service/impl/UserServiceImpl.java
@@ -906,32 +906,13 @@
         }
         if (userDto.getCertificateType() != null) {
             if (!StringUtils.isEmpty(userDto.getCertificateNo())) {
-                if (!userDto.getCertificateNo().equals(user.getCertificateNo())) {
-                    String name = "鏈煡";
-                    switch (userDto.getCertificateType()) {
-                        case User.CERTIFICATE_TYPE_TAIWAN:
-                            name = "鍙拌優璇�";
-                            break;
-                        case User.CERTIFICATE_TYPE_INSURANCE:
-                            name = "淇濋櫓鍗″彿";
-                            break;
-                        case User.CERTIFICATE_TYPE_PASSPORT:
-                            name = "鎶ょ収";
-                            break;
-                        case User.CERTIFICATE_TYPE_ID:
-                            name = "韬唤璇�";
-                            break;
-                        case User.CERTIFICATE_TYPE_FILE:
-                            name = "妗f鍙�";
-                            break;
-                        case User.CERTIFICATE_TYPE_INSURANCE_NO:
-                            name = "淇濋櫓鍏徃";
-                            break;
-                    }
+                // 淇敼璇佷欢鎴栬�呰瘉浠剁紪鍙�
+                if (!userDto.getCertificateType().equals(user.getCertificateType()) || !userDto.getCertificateNo().equals(user.getCertificateNo())) {
+                    // 鏋勫缓鏃ュ織
                     JSONObject jsonObject = new JSONObject();
-                    jsonObject.put("key", String.format("淇敼%s缂栧彿", name));
-                    jsonObject.put("before", user.getCertificateNo());
-                    jsonObject.put("after", userDto.getCertificateNo());
+                    jsonObject.put("key", "淇敼璇佷欢淇℃伅");
+                    jsonObject.put("before", String.format("淇敼璇佷欢绫诲瀷锛�%s,璇佷欢缂栧彿:%s", User.getCertificateTypeName(user.getCertificateType()), user.getCertificateNo()));
+                    jsonObject.put("after", String.format("淇敼璇佷欢绫诲瀷锛�%s,璇佷欢缂栧彿:%s", User.getCertificateTypeName(userDto.getCertificateType()), userDto.getCertificateNo()));
                     logArray.add(jsonObject);
                     // 淇敼鏁版嵁
                     user.setCertificateType(userDto.getCertificateType());
diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/order/OrderServiceV2.java b/phi_platform_user/src/main/java/com/hx/phip/service/order/OrderServiceV2.java
index 1888dc2..22c354d 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/service/order/OrderServiceV2.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/service/order/OrderServiceV2.java
@@ -72,6 +72,13 @@
     void sendPublicNo(String id, CommonService commonService);
 
     /**
+     * 鍙戦�佺煭淇¢�氱煡
+     * @param id                        鎬昏鍗昳d
+     * @param commonService
+     */
+    void sentSMSInfo(String id, CommonService commonService);
+
+    /**
      * 缁撹处鎴愬姛鍙戦�佷紒涓氬井淇¢�氱煡缁欑敤鎴锋墍灞為【闂�
      * @param userId                    鐢ㄦ埛鏍囪瘑
      * @param orderNo                   璁㈠崟鍙�
diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java b/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
index f5c2474..bcd6656 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
@@ -2566,7 +2566,7 @@
                 && oldStatus != ordersTotal.getStatus()){
             // OrderUtil.reCalcOrderBothTheOneData(commonService, VisitRecordMapper.class,null,ordersTotal.getUserId(), BaseEntity.NO);
             // 澶勭悊鏂规硶璋冩暣
-            TimerHandleTool.addTask(commonService, TimerHandleItem.TYPE_RECALC_ORDER_BOTH, ordersTotal.getUserId());
+            TimerHandleTool.addTask(commonService, TimerHandleItem.TYPE_RECALC_ORDER_BOTH, ordersTotal.getUserId(), null);
         }
 
         //棰濆鐨勬搷浣滐紝鍗囬檷绾э紝鏀跺叆纭琛�
diff --git a/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderServiceV2Impl.java b/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderServiceV2Impl.java
index d551367..ad20b63 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderServiceV2Impl.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderServiceV2Impl.java
@@ -23,13 +23,18 @@
 import com.hx.phip.config.ApproveConfig;
 import com.hx.phip.config.CustomParameter;
 import com.hx.phip.dao.mapper.*;
+import com.hx.phip.model.ApplyParameter;
+import com.hx.phip.model.SysParameter;
 import com.hx.phip.service.OrdersTotalService;
 import com.hx.phip.service.ProjectService;
+import com.hx.phip.service.SystemParameterService;
 import com.hx.phip.service.deduction.DeductionSingleService;
 import com.hx.phip.service.init.OrderInitService;
 import com.hx.phip.service.order.OrderRiseService;
 import com.hx.phip.service.order.OrderServiceV2;
 import com.hx.phip.service.userLevel.UserLevelRuleService;
+import com.hx.phip.tool.ApplyParameterTool;
+import com.hx.phip.tool.SendSMSTool;
 import com.hx.phip.tool.deduction.UserDeductionSingleTool;
 import com.hx.phip.util.OrdersSnapshotUtil;
 import com.hx.phip.util.api.ApiPlatformUtil;
@@ -55,6 +60,7 @@
 import com.platform.entity.ThirtApplication;
 import com.platform.exception.PlatTipsException;
 import com.platform.resultTool.PlatformCode;
+import com.platform.resultTool.SystemCode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.annotation.Async;
@@ -115,6 +121,8 @@
     private DeductionSingleService deductionSingleService;
     @Resource
     private OrderRiseService orderRiseService;
+    @Resource
+    private SystemParameterService systemParameterService;
 
     /**
      * @param opShopId 鎿嶄綔浜洪棬搴�
@@ -752,7 +760,7 @@
                 message=e.getMessage();
             }
 
-            //缁撹处鎴愬姛鍙戦�佸叕浼楀彿閫氱煡缁欑敤鎴� -寮傛
+            // 缁撹处鎴愬姛鍙戦�佸叕浼楀彿閫氱煡缁欑敤鎴� -寮傛
             try {
                 sendPublicNo(ordersTotal.getId(),commonService);
             } catch (TipsException | PlatTipsException e){
@@ -761,6 +769,12 @@
                 logger.info("缁撹处鎴愬姛鍙戦�佸叕浼楀彿閫氱煡缁欑敤鎴峰紓甯� -寮傛:{}", e.getMessage(),e);
             }
 
+            // 缁撹处鎴愬姛鍙戦�佺煭淇¢�氱煡缁欑敤鎴� -寮傛
+            try {
+                sentSMSInfo(ordersTotal.getId(), commonService);
+            } catch (Exception e){
+                logger.info("缁撹处鎴愬姛鍙戦�佺煭淇¢�氱煡缁欑敤鎴峰紓甯� -寮傛:{}", e.getMessage(),e);
+            }
 
             //杩斿洖phis璁㈠崟鍙枫�乸his璁㈠崟id
             data.put("orderId",ordersTotal.getId());
@@ -1060,6 +1074,51 @@
 
     @Override
     @Async
+    public void sentSMSInfo(String  orderId, CommonService commonService){
+        // 璺宠浆閾炬帴
+        String secondaryItemStr = getSMSUrl();
+        // 娣诲姞瀹氭椂鍣ㄤ换鍔″鐞�
+        TimerHandleTool.addTask(commonService, TimerHandleItem.TYPE_ORDER_CONFIRM_SMS_INFO, orderId, secondaryItemStr);
+    }
+
+    /**
+     * 鐢熸垚闇�瑕佸彂閫佺煭淇$殑鍦板潃
+     * @return 杩斿洖
+     */
+    private String getSMSUrl() {
+        // 鐢熸垚灏忕▼搴忛摼鎺�
+        String urlLink = null;
+        // 姝e紡鍖哄湪鎷垮彇閾炬帴
+        if (PlatformPattern.PROD.equals(customParameter.getPlatformPatternMoney())) {
+            // 鑾峰彇鐢ㄦ埛CRM灏忕▼搴弔oken
+            ApplyParameter applyParameter = ApplyParameterTool.getMpParameter("wx71e6babac80abcee", commonService);
+            if (applyParameter == null) {
+                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "mpId is error");
+            }
+            // 鑾峰彇鑼冨洿瀵嗛挜
+            SysParameter sysParameter = systemParameterService.getAccessToken(applyParameter.getMpAppId(), applyParameter.getMpSecretKey());
+            if (sysParameter == null) {
+                throw new PlatTipsException(PlatformCode.ERROR_SYSTEM, "鏈嶅姟閿欒" + SystemCode.ERROR_GET_CORP_TOKEN);
+            }
+
+            // 鏇存崲閾炬帴 鍘烠RM 1.0 /pages/recharge/incrementInfo
+            String result = SendSMSTool.getAooLetUrl(sysParameter.getParamValue(), "/packages/order/orderConfirm", "", "release");
+            if (!StringUtils.isEmpty(result)) {
+                JSONObject jsonObject = JSON.parseObject(result);
+                if (jsonObject.getInteger("errcode") != 0) {
+                    throw new PlatTipsException(PlatformCode.ERROR_SYSTEM, "鐢熸垚鐭俊灏忕▼搴忚矾寰勯敊璇細" + jsonObject.getString("msg") + SystemCode.ERROR_GET_CORP_TOKEN);
+                }
+                urlLink = jsonObject.getString("url_link");
+            }
+        } else {
+            // 娴嬭瘯鍖鸿烦杞櫨搴�
+            urlLink = "https://wxaurl.cn/6666";
+        }
+        return urlLink;
+    }
+
+    @Override
+    @Async
     public void sendUserConsultant(String userId,String orderNo,String orderId,JSONObject commissionObject, CommonService commonService) {
         OrdersTotal ordersTotal=commonService.selectOneByKeyBlob(OrdersTotalMapper.class,orderId);
         if(ordersTotal!=null){
diff --git a/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java b/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java
index 855c5be..16deb39 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java
@@ -188,7 +188,7 @@
         if(OrderTotalConstants.STATUS_CANCEL == ordersTotal.getStatus()){
             // OrderUtil.reCalcOrderBothTheOneData(commonService, VisitRecordMapper.class,null,ordersTotal.getUserId(), BaseEntity.NO);
             // 澶勭悊鏂规硶璋冩暣
-            TimerHandleTool.addTask(commonService, TimerHandleItem.TYPE_RECALC_ORDER_BOTH, ordersTotal.getUserId());
+            TimerHandleTool.addTask(commonService, TimerHandleItem.TYPE_RECALC_ORDER_BOTH, ordersTotal.getUserId(), null);
         }
 
         return ordersTotal;

--
Gitblit v1.8.0