From e4a06e0730dc0aa6ced97cbb3362d6b8ef473d39 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 27 三月 2025 15:56:34 +0800
Subject: [PATCH] 最新版本541200007
---
server/visits/dmvisit_service/src/main/java/com/doumee/core/wx/wxPlat/WxPlatNotice.java | 198 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 157 insertions(+), 41 deletions(-)
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/core/wx/wxPlat/WxPlatNotice.java b/server/visits/dmvisit_service/src/main/java/com/doumee/core/wx/wxPlat/WxPlatNotice.java
index ddccf93..408a033 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/core/wx/wxPlat/WxPlatNotice.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/core/wx/wxPlat/WxPlatNotice.java
@@ -1,25 +1,16 @@
package com.doumee.core.wx.wxPlat;
-import cn.emay.sdk.util.json.gson.JsonObject;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
-import com.doumee.core.utils.Http;
import com.doumee.core.utils.HttpsUtil;
-import com.doumee.dao.business.VisitsMapper;
import com.doumee.dao.business.WxNoticeConfigMapper;
import com.doumee.dao.business.model.*;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.mp.api.WxMpService;
-import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
-import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.time.DateFormatUtils;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
@@ -95,16 +86,16 @@
}
Constants.WxUrlParams wxUrlParams = Constants.WxUrlParams.VISIT_REPORT_RECORD_USER;
if(!Constants.equalsInteger(visits.getType(),Constants.TWO)){
- if(objCode.equals(WxPlatConstants.visitContent.visitUpload)){
+ if(!objCode.equals(WxPlatConstants.visitContent.visitWaitAudit)){
wxUrlParams = Constants.WxUrlParams.VISIT_RECORD_VISIT;
}else{
wxUrlParams = Constants.WxUrlParams.VISIT_RECORD_USER;
}
}
- String url = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
+ String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
wxUrlParams
,visits.getId().toString());
- String jumpUrl = systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE_PREFIX).getCode().replace( "${param}", url);
+
String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
//鏁翠綋鍙傛暟map
@@ -134,6 +125,7 @@
paramMap.put("touser", openId);
paramMap.put("data", dataMap);
String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap));
+ log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭烦杞湴鍧�锛歿}路--++==路", jumpUrl);
if(StringUtils.isBlank(response)){
log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", "澶辫触");
}else{
@@ -166,9 +158,9 @@
if(Objects.isNull(wxNoticeConfig)){
return;
}
- String url = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
+ String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
Constants.WxUrlParams.HIDDEN_DANGER,hiddenDanger.getId().toString());
- String jumpUrl = systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE_PREFIX).getCode().replace( "${param}", url);
+
String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
//鏁翠綋鍙傛暟map
@@ -233,9 +225,9 @@
if(Objects.isNull(wxNoticeConfig)){
return;
}
- String url = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
+ String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
Constants.WxUrlParams.HIDDEN_DANGER,hiddenDanger.getId().toString());
- String jumpUrl = systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE_PREFIX).getCode().replace( "${param}", url);
+
String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
//鏁翠綋鍙傛暟map
@@ -253,7 +245,7 @@
thing13.put("value",Constants.equalsInteger(hiddenDanger.getStatus(),Constants.ONE)?"闅愭偅宸叉暣鏀�":"闅愭偅宸查��鍥�");
//鎻愪氦浜�
Map<String, Object> thing10 = new HashMap<String,Object>();
- thing10.put("value",hiddenDanger.getCheckorName());
+ thing10.put("value",hiddenDanger.getMemberName());
//閫氱煡鏃堕棿
Map<String, Object> time16 = new HashMap<String,Object>();
time16.put("value", DateUtil.getFomartDate(hiddenDanger.getDealTime(),"yyyy骞碝M鏈坉d鏃� HH:mm:ss") );
@@ -304,9 +296,8 @@
if(Objects.isNull(wxNoticeConfig)){
return;
}
- String url = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
+ String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
Constants.WxUrlParams.CAR_USE,carUseBook.getId().toString());
- String jumpUrl = systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE_PREFIX).getCode().replace( "${param}", url);
String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
//鏁翠綋鍙傛暟map
@@ -353,6 +344,7 @@
paramMap.put("touser", openId);
paramMap.put("data", dataMap);
String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap));
+ log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}", jumpUrl);
if(StringUtils.isBlank(response)){
log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", "澶辫触");
}else{
@@ -376,8 +368,8 @@
* @param openIds
* @param sendType 0=鐢宠浜猴紱1=瀹℃壒浜�
*/
- public void sendPlatformBookTemplateNotice(SystemDictDataBiz systemDictDataBiz,WxNoticeConfigMapper wxNoticeConfigMapper, PlatformBooks platformBooks, String objCode,String token,
- List<String> openIds,Integer sendType){
+ public void sendPlatformBookTemplateNotice(SystemDictDataBiz systemDictDataBiz, WxNoticeConfigMapper wxNoticeConfigMapper, PlatformBooks platformBooks, String objCode, String token,
+ List<String> openIds, Integer sendType){
try{
if(CollectionUtils.isNotEmpty(openIds)){
WxNoticeConfig wxNoticeConfig = wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.platformBook)
@@ -392,10 +384,8 @@
if(!objCode.equals(WxPlatConstants.platformBookContent.platformBookUpload)){
wxUrlParams = Constants.WxUrlParams.PLATFORM_BOOK;
}
- String url = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
+ String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
wxUrlParams,platformBooks.getId().toString());
- String jumpUrl = systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE_PREFIX).getCode().replace( "${param}", url);
-
String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
//鏁翠綋鍙傛暟map
Map<String, Object> paramMap = new HashMap<String, Object>();
@@ -411,7 +401,7 @@
}else if(Constants.equalsInteger(platformBooks.getStatus(),Constants.TWO)){
const9.put("value","鐢宠宸插鏍搁�氳繃");
}else{
- const9.put("value","鐢宠鏈�氳繃");
+ const9.put("value","鐢宠宸插鏍搁┏鍥�");
}
}
//杞︾墝鍙�
@@ -438,6 +428,7 @@
paramMap.put("touser", openId);
paramMap.put("data", dataMap);
String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap));
+ log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}", JSONObject.toJSONString(paramMap));
if(StringUtils.isBlank(response)){
log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", "澶辫触");
}else{
@@ -473,9 +464,8 @@
return;
}
- String url = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
+ String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
Constants.WxUrlParams.PLATFORM_JOB_DRIVER,platformJob.getId().toString());
- String jumpUrl = systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE_PREFIX).getCode().replace( "${param}", url);
String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
//鏁翠綋鍙傛暟map
@@ -527,7 +517,7 @@
List<String> openIds){
try{
if(CollectionUtils.isNotEmpty(openIds)){
- WxNoticeConfig wxNoticeConfig = wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.visit)
+ WxNoticeConfig wxNoticeConfig = wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.platformJob)
.eq(WxNoticeConfig::getObjCode,objCode)
.eq(WxNoticeConfig::getStatus, Constants.ZERO)
.last(" limit 1")
@@ -536,9 +526,8 @@
return;
}
- String url = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
+ String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
Constants.WxUrlParams.PLATFORM_JOB_DRIVER,platformJob.getId().toString());
- String jumpUrl = systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE_PREFIX).getCode().replace( "${param}", url);
String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
//鏁翠綋鍙傛暟map
@@ -597,9 +586,8 @@
return;
}
- String url = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
+ String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
Constants.WxUrlParams.PLATFORM_JOB_DRIVER,platformJob.getId().toString());
- String jumpUrl = systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE_PREFIX).getCode().replace( "${param}", url);
String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
//鏁翠綋鍙傛暟map
@@ -610,17 +598,17 @@
Map<String, Object> const6 = new HashMap<String,Object>();
const6.put("value",wxNoticeConfig.getTitile());
//杞︾墝鍙�
- Map<String, Object> character_string1 = new HashMap<String,Object>();
- character_string1.put("value",platformJob.getCarCodeFront());
+ Map<String, Object> car_number3 = new HashMap<String,Object>();
+ car_number3.put("value",platformJob.getCarCodeFront());
//鏈堝彴鍙�
- Map<String, Object> thing3 = new HashMap<String,Object>();
- thing3.put("value", platformJob.getPlatformName());
+ Map<String, Object> thing9 = new HashMap<String,Object>();
+ thing9.put("value", platformJob.getPlatformName());
//鏃堕棿
Map<String, Object> time4 = new HashMap<String,Object>();
time4.put("value", DateUtil.getFomartDate(new Date(),"yyyy骞碝M鏈坉d鏃� HH:mm:ss") );
dataMap.put("const6",const6);
- dataMap.put("character_string1",character_string1);
- dataMap.put("thing3",thing3);
+ dataMap.put("car_number3",car_number3);
+ dataMap.put("thing9",thing9);
dataMap.put("time4",time4);
for (String openId:openIds) {
paramMap.clear();
@@ -629,22 +617,150 @@
paramMap.put("touser", openId);
paramMap.put("data", dataMap);
String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap));
+ log.error("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭唴瀹癸細{}", JSONObject.toJSONString(paramMap));
if(StringUtils.isBlank(response)){
- log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", "澶辫触");
+ log.error("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", "澶辫触");
}else{
JSONObject json = JSONObject.parseObject(response);
- log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"鎴愬姛":"澶辫触"+json.getString("errmsg"));
+ log.error("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"鎴愬姛":"澶辫触"+json.getString("errmsg"));
}
}
}
}catch (Exception e){
}
-
}
+ /**
+ * 鏈堝彴绛惧埌閫氱煡
+ * @param wxNoticeConfigMapper
+ * @param platformJob
+ * @param objCode
+ * @param token
+ * @param openIds
+ */
+ public void sendPlatformJobSignNotice(WxNoticeConfigMapper wxNoticeConfigMapper, PlatformJob platformJob, String objCode,String token,
+ List<String> openIds){
+ try{
+ if(CollectionUtils.isNotEmpty(openIds)){
+ WxNoticeConfig wxNoticeConfig = wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.platformJob)
+ .eq(WxNoticeConfig::getObjCode,objCode)
+ .eq(WxNoticeConfig::getStatus, Constants.ZERO)
+ .last(" limit 1")
+ );
+ if(Objects.isNull(wxNoticeConfig)){
+ return;
+ }
+ String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
+ //鏁翠綋鍙傛暟map
+ Map<String, Object> paramMap = new HashMap<String, Object>();
+ //娑堟伅涓婚鏄剧ず鐩稿叧map
+ Map<String, Object> dataMap = new HashMap<String, Object>();
+ //杞︾墝鍙�
+ Map<String, Object> car_number1 = new HashMap<String,Object>();
+ car_number1.put("value",platformJob.getCarCodeFront());
+ //鍙告満濮撳悕
+ Map<String, Object> thing2 = new HashMap<String,Object>();
+ thing2.put("value",platformJob.getDriverName());
+ //绛惧埌鏃堕棿
+ Map<String, Object> time5 = new HashMap<String,Object>();
+ time5.put("value", DateUtil.getFomartDate(platformJob.getSignDate(),"yyyy骞碝M鏈坉d鏃� HH:mm:ss"));
+ dataMap.put("car_number1",car_number1);
+ dataMap.put("thing2",thing2);
+ dataMap.put("time5",time5);
+ for (String openId:openIds) {
+ paramMap.clear();
+ paramMap.put("template_id", wxNoticeConfig.getTempId());
+ paramMap.put("touser", openId);
+ paramMap.put("data", dataMap);
+ String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap));
+ log.error("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭唴瀹癸細{}", JSONObject.toJSONString(paramMap));
+ if(StringUtils.isBlank(response)){
+ log.error("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", "澶辫触");
+ }else{
+ JSONObject json = JSONObject.parseObject(response);
+ log.error("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"鎴愬姛":"澶辫触"+json.getString("errmsg"));
+ }
+ }
+ }
+ }catch (Exception e){
+
+ }
+ }
+
+ public void sendUnFinishNotice(WxNoticeConfigMapper wxNoticeConfigMapper,Integer unFinishNum,String objCode,String token,
+ List<String> openIds){
+ try{
+ if(CollectionUtils.isNotEmpty(openIds)){
+ WxNoticeConfig wxNoticeConfig = wxNoticeConfigMapper.selectOne(new QueryWrapper<WxNoticeConfig>().lambda().eq(WxNoticeConfig::getObjType,WxPlatConstants.platformJob)
+ .eq(WxNoticeConfig::getObjCode,objCode)
+ .eq(WxNoticeConfig::getStatus, Constants.ZERO)
+ .last(" limit 1")
+ );
+ if(Objects.isNull(wxNoticeConfig)){
+ return;
+ }
+ String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
+ //鏁翠綋鍙傛暟map
+ Map<String, Object> paramMap = new HashMap<String, Object>();
+ //娑堟伅涓婚鏄剧ず鐩稿叧map
+ Map<String, Object> dataMap = new HashMap<String, Object>();
+ //杞︾墝鍙�
+ Map<String, Object> const1 = new HashMap<String,Object>();
+ const1.put("value","浣滀笟浠诲姟鏈畬鎴�");
+ //鍙告満濮撳悕
+ Map<String, Object> thing2 = new HashMap<String,Object>();
+ thing2.put("value",unFinishNum+"涓�");
+ //绛惧埌鏃堕棿
+ Map<String, Object> time3 = new HashMap<String,Object>();
+ time3.put("value", DateUtil.getFomartDate(new Date(),"yyyy骞碝M鏈坉d鏃� HH:mm:ss"));
+
+ dataMap.put("const1",const1);
+ dataMap.put("thing2",thing2);
+ dataMap.put("time3",time3);
+ for (String openId:openIds) {
+ paramMap.clear();
+ paramMap.put("template_id", wxNoticeConfig.getTempId());
+ paramMap.put("touser", openId);
+ paramMap.put("data", dataMap);
+ String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(paramMap));
+ log.error("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭唴瀹癸細{}", JSONObject.toJSONString(paramMap));
+ if(StringUtils.isBlank(response)){
+ log.error("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", "澶辫触");
+ }else{
+ JSONObject json = JSONObject.parseObject(response);
+ log.error("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"鎴愬姛":"澶辫触"+json.getString("errmsg"));
+ }
+ }
+ }
+ }catch (Exception e){
+
+ }
+ }
+
+
+ public void sendMeetTemplateNotice(SystemDictDataBiz systemDictDataBiz,SmsEmail smsEmail,String token){
+ try{
+ String jumpUrl = Constants.getWxUrl(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.WX_REDIRECT_URL).getCode(),
+ Constants.WxUrlParams.MEETING,smsEmail.getObjId().toString());
+ String postUrL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+token;
+ JSONObject jsonObject = JSONObject.parseObject(smsEmail.getContent());
+ jsonObject.put("url",jumpUrl);
+ String response = HttpsUtil.postJson(postUrL, JSONObject.toJSONString(jsonObject));
+ log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭唴瀹癸細{}", JSONObject.toJSONString(jsonObject));
+ if(StringUtils.isBlank(response)){
+ log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", "澶辫触");
+ }else{
+ JSONObject json = JSONObject.parseObject(response);
+ log.warn("路==++--路鎺ㄩ�佸井淇℃ā鏉夸俊鎭細{}路--++==路", Constants.equalsInteger(json.getInteger("errcode"),Constants.ZERO)?"鎴愬姛":"澶辫触"+json.getString("errmsg"));
+ }
+ }catch (Exception e){
+
+ }
+
+ }
}
--
Gitblit v1.9.3