From 99e92a155a1b21a8386b482e7aab6fef649aeffa Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期四, 28 八月 2025 17:47:03 +0800
Subject: [PATCH] 111

---
 server/services/src/main/java/com/doumee/config/wx/SendWxMessage.java |   93 +++++++++++++++++++++++++---------------------
 1 files changed, 51 insertions(+), 42 deletions(-)

diff --git a/server/services/src/main/java/com/doumee/config/wx/SendWxMessage.java b/server/services/src/main/java/com/doumee/config/wx/SendWxMessage.java
index f612666..59ece1c 100644
--- a/server/services/src/main/java/com/doumee/config/wx/SendWxMessage.java
+++ b/server/services/src/main/java/com/doumee/config/wx/SendWxMessage.java
@@ -4,6 +4,7 @@
 import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.Constants;
 import com.doumee.core.utils.DateUtil;
+import com.doumee.core.utils.HttpsUtil;
 import com.doumee.dao.business.model.IdentityInfo;
 import com.doumee.dao.business.model.Orders;
 import com.doumee.dao.business.model.WithdrawalOrders;
@@ -69,14 +70,15 @@
             Map<String, TemplateData> m = new HashMap<>(4);
             m.put("thing2", new TemplateData(Constants.equalsInteger(identityInfo.getType(),Constants.ZERO)?"瀹炲悕璁よ瘉":Constants.equalsInteger(identityInfo.getType(),Constants.ONE)?"杩愯揣璁よ瘉":"渚涢璁よ瘉"));
             m.put("phrase6", new TemplateData(Constants.equalsInteger(identityInfo.getAuditStatus(),Constants.TWO)?"閫氳繃":"鏈�氳繃"));
-            m.put("time12", new TemplateData(DateUtil.getFomartDate(identityInfo.getAuditTime(),"yyyy-MM-dd HH:mm")));
+            m.put("time12", new TemplateData(DateUtil.formatDate(identityInfo.getAuditTime(),"yyyy-MM-dd HH:mm")));
             m.put("thing14", new TemplateData(identityInfo.getAuditRemark()));
-//            wxMsgVO.setPage(mineUrl);
+            wxMsgVO.setPage(mineUrl);
             wxMsgVO.setData(m);
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁よ瘉淇℃伅锛歿}", JSONObject.toJSONString(wxMsgVO));
-            ResponseEntity<String> responseEntity =
-                    restTemplate.postForEntity(url, wxMsgVO, String.class);
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁よ瘉淇℃伅锛歿}", JSONObject.toJSONString(responseEntity));
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁よ瘉淇℃伅锛歿}", JSONObject.toJSONString(wxMsgVO));
+            String responseEntity  = HttpsUtil.postJson(url,JSONObject.toJSONString(wxMsgVO));
+//                    ResponseEntity<String> responseEntity =
+//                            restTemplate.postForEntity(url, wxMsgVO, String.class);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁よ瘉淇℃伅锛歿}", JSONObject.toJSONString(responseEntity));
         }catch (WxErrorException wxErrorException){
 
         }
@@ -95,9 +97,10 @@
         RestTemplate restTemplate = new RestTemplate();
         try{
             String accessToken = WxMiniConfig.wxMaService.getAccessToken();
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 璁㈠崟鍙栨秷涓氬姟  -> accessToken锛歿}",accessToken);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 璁㈠崟鍙栨秷涓氬姟  -> accessToken锛歿}",accessToken);
             //杩欓噷绠�鍗曡捣瑙佹垜浠瘡娆¢兘鑾峰彇鏈�鏂扮殑access_token锛堟椂闂村紑鍙戜腑锛屽簲璇ュ湪access_token蹇繃鏈熸椂鍐嶉噸鏂拌幏鍙栵級
             String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+accessToken;
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙栨秷涓氬姟URL锛歿}", url);
             //鎷兼帴鎺ㄩ�佺殑妯$増
             WxMsgVO wxMsgVO = new WxMsgVO();
             //璁㈤槄娑堟伅妯℃澘id
@@ -110,20 +113,21 @@
             m.put("thing6", new TemplateData(Constants.equalsInteger(cancelType,Constants.ZERO)?"骞冲彴鍙栨秷":Constants.equalsInteger(cancelType,Constants.ONE)?"鍙戝崟鏂瑰彇娑�":"鎺ュ崟鏂瑰彇娑�"));
             String pageUrl = Constants.equalsInteger(orders.getType(),Constants.orderType.hyd.getKey())?orderDetailFreight:
                     Constants.equalsInteger(orders.getType(),Constants.orderType.scd.getKey())?orderDetailFood:orderDetail;
-            pageUrl.replace("{id}",orders.getId().toString());
+            pageUrl = pageUrl.replace("{id}",orders.getId().toString());
             wxMsgVO.setPage(pageUrl);
             wxMsgVO.setData(m);
             if(CollectionUtils.isNotEmpty(openidList)){
                 for (String openid:openidList) {
                     //鐢ㄦ埛鐨刼penid锛堣鍙戦�佺粰閭d釜鐢ㄦ埛锛�
                     wxMsgVO.setTouser(openid);
-                    log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙栨秷涓氬姟锛歿}", JSONObject.toJSONString(wxMsgVO));
-                    ResponseEntity<String> responseEntity =
-                            restTemplate.postForEntity(url, wxMsgVO, String.class);
-                    log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙栨秷涓氬姟锛歿}", JSONObject.toJSONString(responseEntity));
+                    log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙栨秷涓氬姟锛歿}", JSONObject.toJSONString(wxMsgVO));
+                    String responseEntity  = HttpsUtil.postJson(url,JSONObject.toJSONString(wxMsgVO));
+//                    ResponseEntity<String> responseEntity =
+//                            restTemplate.postForEntity(url, wxMsgVO, String.class);
+                    log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙栨秷涓氬姟锛歿}", JSONObject.toJSONString(responseEntity));
                 }
             }else{
-                log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙栨秷涓氬姟锛歿}", "鏃犱汉鍛樹俊鎭�");
+                log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙栨秷涓氬姟锛歿}", "鏃犱汉鍛樹俊鎭�");
             }
         }catch (WxErrorException wxErrorException){
 
@@ -144,7 +148,7 @@
         RestTemplate restTemplate = new RestTemplate();
         try{
             String accessToken = WxMiniConfig.wxMaService.getAccessToken();
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 鎺ュ崟涓氬姟  -> accessToken锛歿}",accessToken);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 鎺ュ崟涓氬姟  -> accessToken锛歿}",accessToken);
             //杩欓噷绠�鍗曡捣瑙佹垜浠瘡娆¢兘鑾峰彇鏈�鏂扮殑access_token锛堟椂闂村紑鍙戜腑锛屽簲璇ュ湪access_token蹇繃鏈熸椂鍐嶉噸鏂拌幏鍙栵級
             String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+accessToken;
             //鎷兼帴鎺ㄩ�佺殑妯$増
@@ -159,14 +163,15 @@
             m.put("phone_number8", new TemplateData(memberPhone));
             String pageUrl = Constants.equalsInteger(orders.getType(),Constants.orderType.hyd.getKey())?orderDetailFreight:
                     Constants.equalsInteger(orders.getType(),Constants.orderType.scd.getKey())?orderDetailFood:orderDetail;
-            pageUrl.replace("{id}",orders.getId().toString());
+            pageUrl = pageUrl.replace("{id}",orders.getId().toString());
             wxMsgVO.setPage(pageUrl);
             wxMsgVO.setData(m);
             //鐢ㄦ埛鐨刼penid锛堣鍙戦�佺粰閭d釜鐢ㄦ埛锛�
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鎺ュ崟閫氱煡锛歿}", JSONObject.toJSONString(wxMsgVO));
-            ResponseEntity<String> responseEntity =
-                    restTemplate.postForEntity(url, wxMsgVO, String.class);
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鎺ュ崟閫氱煡锛歿}", JSONObject.toJSONString(responseEntity));
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鎺ュ崟閫氱煡锛歿}", JSONObject.toJSONString(wxMsgVO));
+            String responseEntity  = HttpsUtil.postJson(url,JSONObject.toJSONString(wxMsgVO));
+//                    ResponseEntity<String> responseEntity =
+//                            restTemplate.postForEntity(url, wxMsgVO, String.class);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鎺ュ崟閫氱煡锛歿}", JSONObject.toJSONString(responseEntity));
         }catch (WxErrorException wxErrorException){
 
         }
@@ -178,7 +183,7 @@
         RestTemplate restTemplate = new RestTemplate();
         try{
             String accessToken = WxMiniConfig.wxMaService.getAccessToken();
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 璁㈠崟鍙樻洿閫氱煡  -> accessToken锛歿}",accessToken);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 璁㈠崟鍙樻洿閫氱煡  -> accessToken锛歿}",accessToken);
             //杩欓噷绠�鍗曡捣瑙佹垜浠瘡娆¢兘鑾峰彇鏈�鏂扮殑access_token锛堟椂闂村紑鍙戜腑锛屽簲璇ュ湪access_token蹇繃鏈熸椂鍐嶉噸鏂拌幏鍙栵級
             String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+accessToken;
             //鎷兼帴鎺ㄩ�佺殑妯$増
@@ -190,17 +195,18 @@
             m.put("character_string1", new TemplateData(orders.getCode()));
             m.put("thing3", new TemplateData("鍙樻洿璁㈠崟鏃ユ湡"));
             //鍙樻洿鍚庢棩鏈燂細07-23鑷�07-25
-            m.put("thing5", new TemplateData("鍙樻洿鍚庢棩鏈�:" +DateUtil.getFomartDate(orders.getStartDate(),"MM-dd") + "鑷�" +DateUtil.getFomartDate(orders.getEndDate(),"MM-dd")));
+            m.put("thing5", new TemplateData("鍙樻洿鍚庢棩鏈燂細" +DateUtil.getFomartDate(orders.getStartDate(),"MM-dd") + "鑷�" +DateUtil.getFomartDate(orders.getEndDate(),"MM-dd")));
             String pageUrl = Constants.equalsInteger(orders.getType(),Constants.orderType.hyd.getKey())?orderDetailFreight:
                     Constants.equalsInteger(orders.getType(),Constants.orderType.scd.getKey())?orderDetailFood:orderDetail;
-            pageUrl.replace("{id}",orders.getId().toString());
+            pageUrl = pageUrl.replace("{id}",orders.getId().toString());
             wxMsgVO.setPage(pageUrl);
             wxMsgVO.setData(m);
             //鐢ㄦ埛鐨刼penid锛堣鍙戦�佺粰閭d釜鐢ㄦ埛锛�
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙樻洿閫氱煡锛歿}", JSONObject.toJSONString(wxMsgVO));
-            ResponseEntity<String> responseEntity =
-                    restTemplate.postForEntity(url, wxMsgVO, String.class);
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙樻洿閫氱煡锛歿}", JSONObject.toJSONString(responseEntity));
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙樻洿閫氱煡锛歿}", JSONObject.toJSONString(wxMsgVO));
+            String responseEntity  = HttpsUtil.postJson(url,JSONObject.toJSONString(wxMsgVO));
+//                    ResponseEntity<String> responseEntity =
+//                            restTemplate.postForEntity(url, wxMsgVO, String.class);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鍙樻洿閫氱煡锛歿}", JSONObject.toJSONString(responseEntity));
         }catch (WxErrorException wxErrorException){
 
         }
@@ -214,7 +220,7 @@
         try{
             RestTemplate restTemplate = new RestTemplate();
             String accessToken = WxMiniConfig.wxMaService.getAccessToken();
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 鎻愮幇鎴愬姛閫氱煡  -> accessToken锛歿}",accessToken);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 鎻愮幇鎴愬姛閫氱煡  -> accessToken锛歿}",accessToken);
             //杩欓噷绠�鍗曡捣瑙佹垜浠瘡娆¢兘鑾峰彇鏈�鏂扮殑access_token锛堟椂闂村紑鍙戜腑锛屽簲璇ュ湪access_token蹇繃鏈熸椂鍐嶉噸鏂拌幏鍙栵級
             String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+accessToken;
             //鎷兼帴鎺ㄩ�佺殑妯$増
@@ -230,10 +236,11 @@
             wxMsgVO.setPage(balanceUrl);
             wxMsgVO.setData(m);
             //鐢ㄦ埛鐨刼penid锛堣鍙戦�佺粰閭d釜鐢ㄦ埛锛�
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鎻愮幇鎴愬姛閫氱煡锛歿}", JSONObject.toJSONString(wxMsgVO));
-            ResponseEntity<String> responseEntity =
-                    restTemplate.postForEntity(url, wxMsgVO, String.class);
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鎻愮幇鎴愬姛閫氱煡锛歿}", JSONObject.toJSONString(responseEntity));
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鎻愮幇鎴愬姛閫氱煡锛歿}", JSONObject.toJSONString(wxMsgVO));
+            String responseEntity  = HttpsUtil.postJson(url,JSONObject.toJSONString(wxMsgVO));
+//                    ResponseEntity<String> responseEntity =
+//                            restTemplate.postForEntity(url, wxMsgVO, String.class);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鎻愮幇鎴愬姛閫氱煡锛歿}", JSONObject.toJSONString(responseEntity));
         }catch (WxErrorException wxErrorException){
 
         }
@@ -244,7 +251,7 @@
         try{
             RestTemplate restTemplate = new RestTemplate();
             String accessToken = WxMiniConfig.wxMaService.getAccessToken();
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 璁㈠崟鏀剁泭閫氱煡  -> accessToken锛歿}",accessToken);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 璁㈠崟鏀剁泭閫氱煡  -> accessToken锛歿}",accessToken);
             //杩欓噷绠�鍗曡捣瑙佹垜浠瘡娆¢兘鑾峰彇鏈�鏂扮殑access_token锛堟椂闂村紑鍙戜腑锛屽簲璇ュ湪access_token蹇繃鏈熸椂鍐嶉噸鏂拌幏鍙栵級
             String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+accessToken;
             //鎷兼帴鎺ㄩ�佺殑妯$増
@@ -260,11 +267,12 @@
             m.put("date7", new TemplateData(DateUtil.getFomartDate(new Date(),"yyyy-MM-dd HH:mm:ss")));
             wxMsgVO.setPage(balanceUrl);
             wxMsgVO.setData(m);
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鏀剁泭閫氱煡锛歿}", JSONObject.toJSONString(wxMsgVO));
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鏀剁泭閫氱煡锛歿}", JSONObject.toJSONString(wxMsgVO));
             //鐢ㄦ埛鐨刼penid锛堣鍙戦�佺粰閭d釜鐢ㄦ埛锛�
-            ResponseEntity<String> responseEntity =
-                    restTemplate.postForEntity(url, wxMsgVO, String.class);
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鏀剁泭閫氱煡锛歿}", JSONObject.toJSONString(responseEntity));
+            String responseEntity  = HttpsUtil.postJson(url,JSONObject.toJSONString(wxMsgVO));
+//                    ResponseEntity<String> responseEntity =
+//                            restTemplate.postForEntity(url, wxMsgVO, String.class);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 璁㈠崟鏀剁泭閫氱煡锛歿}", JSONObject.toJSONString(responseEntity));
         }catch (WxErrorException wxErrorException){
 
         }
@@ -275,7 +283,7 @@
         try{
             RestTemplate restTemplate = new RestTemplate();
             String accessToken = WxMiniConfig.wxMaService.getAccessToken();
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 鏈嶅姟娲惧崟  -> accessToken锛歿}",accessToken);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 - 鏈嶅姟娲惧崟  -> accessToken锛歿}",accessToken);
             //杩欓噷绠�鍗曡捣瑙佹垜浠瘡娆¢兘鑾峰彇鏈�鏂扮殑access_token锛堟椂闂村紑鍙戜腑锛屽簲璇ュ湪access_token蹇繃鏈熸椂鍐嶉噸鏂拌幏鍙栵級
             String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="+accessToken;
             //鎷兼帴鎺ㄩ�佺殑妯$増
@@ -291,14 +299,15 @@
             m.put("thing12", new TemplateData("宸ュ崟灏嗕簬"+DateUtil.getFomartDate(orders.getStartDate(),"MM-dd")+"寮�濮�"));
             String pageUrl = Constants.equalsInteger(orders.getType(),Constants.orderType.hyd.getKey())?orderDetailFreight:
                     Constants.equalsInteger(orders.getType(),Constants.orderType.scd.getKey())?orderDetailFood:orderDetail;
-            pageUrl.replace("{id}",orders.getId().toString());
+            pageUrl = pageUrl.replace("{id}",orders.getId().toString());
             wxMsgVO.setPage(pageUrl);
             wxMsgVO.setData(m);
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鏈嶅姟娲惧崟锛歿}", JSONObject.toJSONString(wxMsgVO));
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鏈嶅姟娲惧崟锛歿}", JSONObject.toJSONString(wxMsgVO));
             //鐢ㄦ埛鐨刼penid锛堣鍙戦�佺粰閭d釜鐢ㄦ埛锛�
-            ResponseEntity<String> responseEntity =
-                    restTemplate.postForEntity(url, wxMsgVO, String.class);
-            log.info("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鏈嶅姟娲惧崟锛歿}", JSONObject.toJSONString(responseEntity));
+            String responseEntity  = HttpsUtil.postJson(url,JSONObject.toJSONString(wxMsgVO));
+//                    ResponseEntity<String> responseEntity =
+//                            restTemplate.postForEntity(url, wxMsgVO, String.class);
+            log.error("寰俊灏忕▼搴�->寰俊娑堟伅閫氱煡 鏈嶅姟娲惧崟锛歿}", JSONObject.toJSONString(responseEntity));
         }catch (WxErrorException wxErrorException){
 
         }

--
Gitblit v1.9.3