傅行帆 5 vuotta sitten
vanhempi
commit
f0e58a752e

+ 43
- 0
src/main/java/com/huiju/estateagents/service/impl/MiniAppServiceImpl.java Näytä tiedosto

@@ -548,4 +548,47 @@ public class MiniAppServiceImpl implements IMiniAppService {
548 548
 
549 549
         return taMiniappMapper.selectOne(queryWrapper);
550 550
     }
551
+
552
+    public void sendContractMessage(TaPerson toUser, String link, String name, String result, String programName,
553
+                                    String failReason, String remark, LocalDateTime dt, Boolean isSuccess) {
554
+
555
+        TaMiniapp miniapp = taMiniappMapper.selectById(toUser.getMiniappId());
556
+        if (null == miniapp) {
557
+            log.error("小程序 {} 不存在", toUser.getMiniappId());
558
+            return;
559
+        }
560
+
561
+        // 消息内容类型
562
+        String contentType = CommConstant.MESSAGE_CONTENT_OF_HOUSE;
563
+        TaMiniappTemplate tpl = getTplByType(contentType, toUser.getMiniappId());
564
+        boolean isSubscribe = null != tpl && (null == tpl.getIsSubscribe() ? false : tpl.getIsSubscribe());
565
+        // 消息发送类型
566
+        String messageType = null == tpl ? CommConstant.MESSAGE_TYPE_OF_SMS :
567
+                isSubscribe ? CommConstant.MESSAGE_TYPE_OF_MINIAPP_SUBSCRIBE : CommConstant.MESSAGE_TYPE_OF_MINIAPP_TEMPLATE;
568
+
569
+        String[] smsParams = {programName, "电子合同待签署"};
570
+
571
+        if (null == tpl) {
572
+            if (isSuccess) {
573
+                log.error("小程序 {} 无通知消息模板 {}", toUser.getMiniappId(), contentType);
574
+                // 短信发送
575
+                sendSmsMessage(StringUtils.ifNull(toUser.getTel(), toUser.getPhone()), "contract", smsParams);
576
+            }
577
+        } else {
578
+            if (isSubscribe) {
579
+                String[] data = new String[]{name, result, programName, remark, failReason, DateUtils.cutSecond(dt)};
580
+                ResponseBean res = sendSubscribeMessage(tpl, toUser, link, data);
581
+                if (res.getCode() != ResponseBean.CODE_SUCCESS) {
582
+                    // 使用短信发送
583
+                    sendSmsMessage(StringUtils.ifNull(toUser.getTel(), toUser.getPhone()), "contract", smsParams);
584
+                    messageType = CommConstant.MESSAGE_TYPE_OF_SMS;
585
+                }
586
+            } else {
587
+                log.info("发送模板消息");
588
+            }
589
+        }
590
+        // TODO 写消息发送日志
591
+        // 更新消息发送时间
592
+        iTaPersonMessageRuleService.saveOrUpdateByPersonAndMessage(toUser.getPersonId(), messageType, "contract", toUser.getOrgId());
593
+    }
551 594
 }

+ 3
- 0
src/main/java/com/huiju/estateagents/service/impl/TaRaiseRecordServiceImpl.java Näytä tiedosto

@@ -335,6 +335,9 @@ public class TaRaiseRecordServiceImpl extends ServiceImpl<TaRaiseRecordMapper, T
335 335
             String link = String.format(CommConstant.RAISE_DETAIL_PATH, raiseRecordId);
336 336
 
337 337
             miniAppService.sendCheckMessage(toUser, link, title, result, taBuilding.getBuildingName(), reason, remark, LocalDateTime.now(), isSuccess);
338
+            if(title.equals("电子合同")){
339
+                miniAppService.sendContractMessage(toUser, link, title, result, taBuilding.getBuildingName(), reason, remark, LocalDateTime.now(), isSuccess);
340
+            }
338 341
             logger.info("sendSubscribeMsg 结束");
339 342
         });
340 343
     }

+ 9
- 9
src/main/resources/application-prod-blue.yml Näytä tiedosto

@@ -85,13 +85,13 @@ pay-refund: https://lt.pawoma.cn/api/refund/
85 85
 
86 86
 #法大大服务器地址
87 87
 fadada:
88
-  appId: "403057"
89
-  appSecret: "xcIaK36Vc09yXXRdinXYcXhW"
88
+  appId: "500261"
89
+  appSecret: "go9yihmg7abS2lIBZpZ2yLSW"
90 90
   version: "2.0"
91
-  authServeHost: "http://test.api.fabigbig.com:8888/api/"
92
-  serveHost: "https://testapi08.fadada.com/api/"
93
-  companyNotify: "https://dev.pawoma.cn/api/fadd/company"
94
-  authReturnUrl: "http://localhost:8000/#/eContract/seal/detail?id="
95
-  authNotifyUrl: "https://dev.pawoma.cn/api/fadd/autoAuthCompanySeal"
96
-  signNotify: "https://dev.pawoma.cn/api/fadd/sign"
97
-  redirectUrl: "https://dev.pawoma.cn/other/redirect.html"
91
+  authServeHost: "https://textapi.fadada.com/api2/"
92
+  serveHost: "https://textapi.fadada.com/api2/"
93
+  companyNotify: "https://wx.fangdeal.cn/api/fadd/company"
94
+  authReturnUrl: "http://wx.fangdeal.cn/#/eContract/seal/detail?id="
95
+  authNotifyUrl: "https://wx.fangdeal.cn/api/fadd/autoAuthCompanySeal"
96
+  signNotify: "https://wx.fangdeal.cn/api/fadd/sign"
97
+  redirectUrl: "https://wx.fangdeal.cn/other/redirect.html"

+ 9
- 9
src/main/resources/application-prod-green.yml Näytä tiedosto

@@ -85,13 +85,13 @@ pay-refund: https://lt.pawoma.cn/api/refund/
85 85
 
86 86
 #法大大服务器地址
87 87
 fadada:
88
-  appId: "403057"
89
-  appSecret: "xcIaK36Vc09yXXRdinXYcXhW"
88
+  appId: "500261"
89
+  appSecret: "go9yihmg7abS2lIBZpZ2yLSW"
90 90
   version: "2.0"
91
-  authServeHost: "http://test.api.fabigbig.com:8888/api/"
92
-  serveHost: "https://testapi08.fadada.com/api/"
93
-  companyNotify: "https://dev.pawoma.cn/api/fadd/company"
94
-  authReturnUrl: "http://localhost:8000/#/eContract/seal/detail?id="
95
-  authNotifyUrl: "https://dev.pawoma.cn/api/fadd/autoAuthCompanySeal"
96
-  signNotify: "https://dev.pawoma.cn/api/fadd/sign"
97
-  redirectUrl: "https://dev.pawoma.cn/other/redirect.html"
91
+  authServeHost: "https://textapi.fadada.com/api2/"
92
+  serveHost: "https://textapi.fadada.com/api2/"
93
+  companyNotify: "https://wx.fangdeal.cn/api/fadd/company"
94
+  authReturnUrl: "http://wx.fangdeal.cn/#/eContract/seal/detail?id="
95
+  authNotifyUrl: "https://wx.fangdeal.cn/api/fadd/autoAuthCompanySeal"
96
+  signNotify: "https://wx.fangdeal.cn/api/fadd/sign"
97
+  redirectUrl: "https://wx.fangdeal.cn/other/redirect.html"