From 37b79cfd8e5ecdc6f9f09750583f998183c338fb Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期四, 07 十一月 2024 10:55:27 +0800 Subject: [PATCH] 代码提交 --- ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java | 125 +++++++++++++++++++++++++++++++++++------ 1 files changed, 106 insertions(+), 19 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java index 3b101e7..f5cbbb7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java @@ -5,6 +5,7 @@ import com.google.gson.Gson; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.ServiceFromEnum; +import com.ruoyi.common.utils.HttpUtil; import com.ruoyi.common.utils.RSAPublicKeyExample; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.http.HttpUtils; @@ -13,10 +14,7 @@ import com.smartor.domain.*; import com.smartor.mapper.ServiceSubtaskMapper; import com.smartor.mapper.ServiceTaskMapper; -import com.smartor.service.IBaseSmsaccountService; -import com.smartor.service.IIvrTaskTemplateService; -import com.smartor.service.IServiceSubtaskRecordService; -import com.smartor.service.ISvyTaskTemplateService; +import com.smartor.service.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -26,6 +24,7 @@ import org.springframework.data.redis.listener.RedisMessageListenerContainer; import org.springframework.stereotype.Component; +import java.math.BigInteger; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; @@ -55,9 +54,7 @@ private String thirdWXUrl; @Autowired - private IIvrTaskTemplateService ivrTaskTemplateService; - @Autowired - private ISvyTaskTemplateService svyTaskTemplateService; + private IServiceOutPathService iServiceOutPathService; @Autowired private ServiceSubtaskMapper ivrTaskcallMapper; @@ -88,6 +85,9 @@ @Autowired IBaseSmsaccountService baseSmsaccountService; + + @Value("${xhsmsPath}") + private String xhsmsPath; // 鍒涘缓鍥哄畾澶у皬鐨勭嚎绋嬫睜 private static final ExecutorService executorService = Executors.newFixedThreadPool(10); @@ -280,7 +280,6 @@ continue; } else if (descByCode.equals("鐭俊")) { //鐭俊 -// http://localhost:8099/followvisit/particty?param1=3¶m2=348 //瀵箄rl涓袱涓弬鏁板姞瀵� RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key); @@ -298,17 +297,62 @@ SendMagParam sendMagParam = new SendMagParam(); sendMagParam.setType("4"); if (type == 1) { - sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid + "¶m5=false"); - } else if (type == 1) { - sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"); + //闅忚 + ServiceOutPath serviceOutPath = new ServiceOutPath(); + serviceOutPath.setParam1(taskId); + serviceOutPath.setParam2(patid); + serviceOutPath.setCreateTime(new Date()); + iServiceOutPathService.insertServiceOutPath(serviceOutPath); +// sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid + "¶m5=false"); + //杞垚16杩涘埗 + String format = String.format("%03X", serviceOutPath.getId()); + serviceOutPath.setRadix(format); + serviceOutPath.setUpdateTime(new Date()); + iServiceOutPathService.updateServiceOutPath(serviceOutPath); + sendMagParam.setPhone(serviceSubtask.getPhone()); + sendMagParam.setUrl(ip + ":" + req_path + "/sf?p=" + format); + sendMagParam.setContent("銆愭柊鍗庡尰闄€�戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌闅忚璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "濉啓銆傛劅璋㈡偍閰嶅悎锛�"); + } else if (type == 2) { + //闂埜锛堥棶棰橈級 + ServiceOutPath serviceOutPath = new ServiceOutPath(); + serviceOutPath.setParam1(taskId); + serviceOutPath.setParam2(patid); +// serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString())); + serviceOutPath.setParam3(ivrTask1.getTaskName()); + serviceOutPath.setCreateTime(new Date()); + iServiceOutPathService.insertServiceOutPath(serviceOutPath); + String format = String.format("%03X", serviceOutPath.getId()); + serviceOutPath.setRadix(format); + serviceOutPath.setUpdateTime(new Date()); + iServiceOutPathService.updateServiceOutPath(serviceOutPath); +// sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"); + sendMagParam.setPhone(serviceSubtask.getPhone()); + sendMagParam.setUrl(ip + ":" + req_path + "/wt?p=" + format); + sendMagParam.setContent("銆愭柊鍗庡尰闄€�戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "濉啓銆傛劅璋㈡偍閰嶅悎锛�"); } else if (type == 3) { - sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"); + //瀹f暀 + ServiceOutPath serviceOutPath = new ServiceOutPath(); + serviceOutPath.setParam1(taskId); + serviceOutPath.setParam2(patid); +// serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString())); + serviceOutPath.setParam3(ivrTask1.getTaskName()); + serviceOutPath.setCreateTime(new Date()); + iServiceOutPathService.insertServiceOutPath(serviceOutPath); + String format = String.format("%03X", serviceOutPath.getId()); + serviceOutPath.setRadix(format); + serviceOutPath.setUpdateTime(new Date()); + iServiceOutPathService.updateServiceOutPath(serviceOutPath); +// sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"); + sendMagParam.setPhone(serviceSubtask.getPhone()); + sendMagParam.setUrl(ip + ":" + req_path + "/xj?p=" + format); + sendMagParam.setContent("銆愭柊鍗庡尰闄€�戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌瀹f暀璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "鏌ョ湅銆傛劅璋㈡偍閰嶅悎锛�"); } //鐭俊杩橀渶瑕佹ā鏉� - sendMagParam.setContent("銆愭柊鍗庡尰闄€��+<a href="+sendMagParam.getUrl()+"閾炬帴娴嬭瘯</a>"); - Boolean aBoolean = sendService.sendMsg(sendMagParam); - - if (!aBoolean) { + Map<String, String> req = new HashMap<>(); + req.put("phone", sendMagParam.getPhone()); + req.put("content", sendMagParam.getContent()); + String s = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(req)); + if (s.equals("true")) { ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); serviceSubtaskRecord.setSubtaskId(serviceSubtask.getId()); @@ -387,12 +431,55 @@ // Boolean aBoolean = sendService.sendMsg(sendMagParam); String url = null; try { +// if (type == 1) { +// url = ip + ":" + req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"; +// } else if (type == 2) { +// url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"; +// } else if (type == 3) { +// url = ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"; +// } if (type == 1) { - url = ip + ":" + req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"; + //闅忚 + ServiceOutPath serviceOutPath = new ServiceOutPath(); + serviceOutPath.setParam1(taskId); + serviceOutPath.setParam2(patid); + serviceOutPath.setCreateTime(new Date()); + iServiceOutPathService.insertServiceOutPath(serviceOutPath); + String format = String.format("%03X", serviceOutPath.getId()); + serviceOutPath.setRadix(format); + serviceOutPath.setUpdateTime(new Date()); + iServiceOutPathService.updateServiceOutPath(serviceOutPath); +// sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid + "¶m5=false"); + url = ip + ":" + req_path + "/sf?p=" + format; } else if (type == 2) { - url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"; + //闂埜 + ServiceOutPath serviceOutPath = new ServiceOutPath(); + serviceOutPath.setParam1(taskId); + serviceOutPath.setParam2(patid); +// serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString())); + serviceOutPath.setParam3(ivrTask1.getTaskName()); + serviceOutPath.setCreateTime(new Date()); + iServiceOutPathService.insertServiceOutPath(serviceOutPath); + String format = String.format("%03X", serviceOutPath.getId()); + serviceOutPath.setRadix(format); + serviceOutPath.setUpdateTime(new Date()); + iServiceOutPathService.updateServiceOutPath(serviceOutPath); +// sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"); + url = ip + ":" + req_path + "/wt?p=" + format; } else if (type == 3) { - url = ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"; + //瀹f暀 + ServiceOutPath serviceOutPath = new ServiceOutPath(); + serviceOutPath.setParam1(taskId); + serviceOutPath.setParam2(patid); +// serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString())); + serviceOutPath.setParam3(ivrTask1.getTaskName()); + serviceOutPath.setCreateTime(new Date()); + iServiceOutPathService.insertServiceOutPath(serviceOutPath); + String format = String.format("%03X", serviceOutPath.getId()); + serviceOutPath.setRadix(format); + serviceOutPath.setUpdateTime(new Date()); + iServiceOutPathService.updateServiceOutPath(serviceOutPath); + url = ip + ":" + req_path + "/xj?p=" + format; } String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), "鏃�"); -- Gitblit v1.9.3