From a24d7c5345cddb9454c351aae0637ed90333a934 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 16 七月 2024 17:57:07 +0800
Subject: [PATCH] 代码提交
---
ruoyi-admin/src/main/resources/application-druid.yml | 7 +-
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java | 102 +++++++++++++++------------------
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/RedisConfiguration.java | 19 +----
ruoyi-admin/src/main/resources/application.yml | 1
smartor/src/main/java/com/smartor/service/impl/CommonTaskServiceImpl.java | 32 +++++-----
5 files changed, 72 insertions(+), 89 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 4f60fee..1d80368 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
@@ -95,56 +95,48 @@
@Override
public void onMessage(Message message, byte[] pattern) {
log.info("鐩戝惉Redis key杩囨湡锛宬ey锛歿}锛宑hannel锛歿}", message.toString(), new String(pattern));
- synchronized (RedisMqReceiver.class) {
- String ip = localIP;
- log.error("鏈満鐨勭綉缁淚P涓�:{}", ip);
- String content = message.toString();
- //鍒ゆ柇鏄笉鏄换鍔′俊鎭紝濡傛灉涓嶆槸锛岀洿鎺ヨ繑鍥烇紝涓嶉渶瑕佹墽琛�
- if (!content.contains("taskid")) {
- log.info("涓嶆槸浠诲姟淇℃伅");
- return;
+ String ip = localIP;
+ log.error("鏈満鐨勭綉缁淚P涓�:{}", ip);
+ String content = message.toString();
+ //鍒ゆ柇鏄笉鏄换鍔′俊鎭紝濡傛灉涓嶆槸锛岀洿鎺ヨ繑鍥烇紝涓嶉渶瑕佹墽琛�
+ if (!content.contains("taskid")) {
+ log.info("涓嶆槸浠诲姟淇℃伅");
+ return;
+ }
+ CommonTaskcallMQ commonTaskcallMQ = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ if (!content.startsWith("{")) {
+ commonTaskcallMQ = mapper.readValue("{" + content + "}", CommonTaskcallMQ.class);
+ } else {
+ commonTaskcallMQ = mapper.readValue(content, CommonTaskcallMQ.class);
}
- CommonTaskcallMQ commonTaskcallMQ = null;
- try {
- ObjectMapper mapper = new ObjectMapper();
- if (!content.startsWith("{")) {
- commonTaskcallMQ = mapper.readValue("{" + content + "}", CommonTaskcallMQ.class);
- } else {
- commonTaskcallMQ = mapper.readValue(content, CommonTaskcallMQ.class);
- }
- //杩欓噷涔嬫墍浠ヨ繖鏍峰仛涓�涓嬶紝鏄悶涓嶆噦锛屼负鍟ヤ細杩涙潵涓ら亶
- Boolean aBoolean = redisCache.hasKey(commonTaskcallMQ.getTaskid().toString());
- if (aBoolean) {
- return;
- } else {
- redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), commonTaskcallMQ.getTaskid().toString(), 60, TimeUnit.SECONDS);
- }
- if (commonTaskcallMQ.getTaskType() == 1) {
- //闅忚
- sfHandle(commonTaskcallMQ, ip);
- } else if (commonTaskcallMQ.getTaskType() == 2) {
- //闂嵎
- wjHandle(commonTaskcallMQ, ip);
- } else if (commonTaskcallMQ.getTaskType() == 3) {
- //瀹f暀
- xjHandle(commonTaskcallMQ, ip);
- }
- //澶勭悊瀹屾垚锛岀Щ闄edis
- redisCache.deleteObject(message.toString());
- } catch (Exception e) {
- Integer integer = redisCache.getCacheObject(commonTaskcallMQ.getTaskid().toString());
- if (integer != null && integer == 2) {
- //灏嗘秷鎭粠闃熷垪涓垹闄�
- } else if (integer == null) {
- redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), 1, 120, TimeUnit.MINUTES);
- } else {
- redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), integer + 1, 120, TimeUnit.MINUTES);
- }
-
- log.error("============娑堣垂澶辫触,灏濊瘯娑堟伅琛ュ彂鍐嶆娑堣垂!============== {}", e.getMessage());
- redisCache.setCacheObject(message.toString(), message.toString(), 60, TimeUnit.SECONDS);
+ if (commonTaskcallMQ.getTaskType() == 1) {
+ //闅忚
+ sfHandle(commonTaskcallMQ, ip);
+ } else if (commonTaskcallMQ.getTaskType() == 2) {
+ //闂嵎
+ wjHandle(commonTaskcallMQ, ip);
+ } else if (commonTaskcallMQ.getTaskType() == 3) {
+ //瀹f暀
+ xjHandle(commonTaskcallMQ, ip);
}
+ //澶勭悊瀹屾垚锛岀Щ闄edis
+ redisCache.deleteObject(message.toString());
+
+ } catch (Exception e) {
+ Integer integer = redisCache.getCacheObject(commonTaskcallMQ.getTaskid().toString());
+ if (integer != null && integer == 2) {
+ //灏嗘秷鎭粠闃熷垪涓垹闄�
+ } else if (integer == null) {
+ redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), 1, 120, TimeUnit.MINUTES);
+ } else {
+ redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), integer + 1, 120, TimeUnit.MINUTES);
+ }
+
+ log.error("============娑堣垂澶辫触,灏濊瘯娑堟伅琛ュ彂鍐嶆娑堣垂!============== {}", e.getMessage());
+ redisCache.setCacheObject(message.toString(), message.toString(), 60, TimeUnit.SECONDS);
}
}
@@ -215,7 +207,7 @@
String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
SendMagParam sendMagParam = new SendMagParam();
sendMagParam.setType("4");
- sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid);
+ sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid + "¶m5=false");
Boolean aBoolean = sendService.sendMsg(sendMagParam);
@@ -238,8 +230,8 @@
String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
SendMagParam sendMagParam = new SendMagParam();
sendMagParam.setType("5");
- sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + ivrTask1.getTaskid().toString() + "¶m2=" + serviceSubtask.getPatid().toString() + "¶m3=" + ivrTask1.getTaskName());
- log.info("閾炬帴瀹屾暣璺緞锛歿}", req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName());
+ sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + ivrTask1.getTaskid().toString() + "¶m2=" + serviceSubtask.getPatid().toString() + "¶m3=" + ivrTask1.getTaskName() + "¶m5=false");
+ log.info("閾炬帴瀹屾暣璺緞锛歿}", ip + ":" + req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName() + "¶m5=false");
//杩欎釜妯℃澘ID鍏堝啓姝伙紝鍚庨潰鍋氭垚鍙��
sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4");
Map map = new HashMap();
@@ -331,7 +323,7 @@
String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key);
SendMagParam sendMagParam = new SendMagParam();
sendMagParam.setType("4");
- sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid);
+ sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid + "¶m5=false");
Boolean aBoolean = sendService.sendMsg(sendMagParam);
//浠诲姟鍙戦�佽褰�
@@ -352,8 +344,8 @@
String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key);
SendMagParam sendMagParam = new SendMagParam();
sendMagParam.setType("5");
- sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName());
- log.info("閾炬帴瀹屾暣璺緞锛歿}", req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName());
+ sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName() + "¶m5=false");
+ log.info("閾炬帴瀹屾暣璺緞锛歿}", req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName() + "¶m5=false");
//杩欎釜妯℃澘ID鍏堝啓姝伙紝鍚庨潰鍋氭垚鍙��
sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4");
Map map = new HashMap();
@@ -440,8 +432,8 @@
String patid = rsaPublicKeyExample.encryptedData(svyTaskSingle1.getPatid().toString(), pub_key);
SendMagParam sendMagParam = new SendMagParam();
sendMagParam.setType("5");
- sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + svyTask.getTaskName());
- log.info("閾炬帴瀹屾暣璺緞锛歿}", req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + svyTask.getTaskName());
+ sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + svyTask.getTaskName() + "¶m5=false");
+ log.info("閾炬帴瀹屾暣璺緞锛歿}", req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + svyTask.getTaskName() + "¶m5=false");
//杩欎釜妯℃澘ID鍏堝啓姝伙紝鍚庨潰鍋氭垚鍙��
sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4");
Map map = new HashMap();
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/RedisConfiguration.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/RedisConfiguration.java
index c1cb8f8..4956122 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/RedisConfiguration.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/RedisConfiguration.java
@@ -1,7 +1,5 @@
package com.ruoyi.web.core.config;
-import com.ruoyi.web.component.RedisMqReceiver;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
@@ -9,21 +7,14 @@
@Configuration
public class RedisConfiguration {
- @Autowired
- private RedisConnectionFactory redisConnectionFactory;
-// 绗竴涓狜Bean鏄垱寤轰竴涓柊鐨凴edis娑堟伅鐩戝惉瀹瑰櫒锛岀劧鍚庢寚瀹歊edis杩炴帴銆傜浜屼釜@Bean鏄粰鎴戜滑鍐欑殑鐩戝惉绫绘寚瀹氫竴涓猂edis娑堟伅鐩戝惉瀹瑰櫒锛屽嵆绗竴涓狜Bean鐨勫唴瀹�
-
+ // 鍒涘缓涓�涓柊鐨凴edis娑堟伅鐩戝惉瀹瑰櫒
@Bean
- public RedisMessageListenerContainer redisMessageListenerContainer() {
- RedisMessageListenerContainer redisMessageListenerContainer = new RedisMessageListenerContainer();
- redisMessageListenerContainer.setConnectionFactory(redisConnectionFactory);
- return redisMessageListenerContainer;
+ RedisMessageListenerContainer redisContainer(RedisConnectionFactory connectionFactory) {
+ RedisMessageListenerContainer container = new RedisMessageListenerContainer();
+ container.setConnectionFactory(connectionFactory);
+ return container;
}
- @Bean
- public RedisMqReceiver keyExpiredListener() {
- return new RedisMqReceiver(this.redisMessageListenerContainer());
- }
}
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index 4975504..a5dcce7 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -130,10 +130,9 @@
#pri_key_me: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAtDOpbUQhcEoYy77agRhIHmAzs7H+KHJhN56gTTI9fWq23j77nI055MFV3oQQziIrNUTNaPpEQhZXBpI0+f9K9QIDAQABAkB3n0fcWfrcoMN/FU3VnrnZOEF6CzFNxkgU9P8y36QECWKZ9JhYQkNpKrMC9oXlN3VSaRigV7B+L/I/a0Rs1W+tAiEA4jx7xcXJ4y4BNwAmVHt6NNiEkzIwWnwC/0qsEu8NsOsCIQDL6MMn1D2uznC6OuOWpxDCkBh1JL1NzZTZeH2G+hj7nwIgKGAC9tjFnvWm4dn0/T7MIIJDpsFeP8fCAS2iZ/6hwuECIAS/eLvWr1EAsZNEh8QcQ8GkBU3E+ztyjAK8UX/xFt/VAiBf79/1tDErX4/DChecM8w3c3DhbBcjuE3fHZn7p6/UKg==
pri_key: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEApHTIe/StslZAT5Jzv8XClbrqox32pfaTrP5IOCRJ3FaH/UZsGgA/tsNBBEXq9eagqwPbJrjYfpdEtINcChrK4wIDAQABAkEAilDujdKshGGmlUZHs/NQRT6AOdDpsYxBiC4V76IVvQpw0IW6c4HGEvH4T+xRufika7/48L0eu0f06H+YtL5lgQIhANUd0a6oSsVxWifAjtKwMZcXD3OaIxQIQSCN4NT4VFY3AiEAxYxYrIhkIyg+UVw3WOSvBpXKxM4/WL9HRzkxDLvp2rUCIQCK23P8tgCJ5xJT5l3onw6goFDcBKkoazxsBqVgfjENPwIgWbuTd+OIYPPhwsE5ntZZrosSDO2GlsBkFzUiU59z7VUCIA0LL+9IFb+FWCl3DGTwIQ9SZYbv61T83LKjebUcSOfe
-#璇锋眰IP鍜岀鍙e彿
-req_path: 8096
-
#浜岀淮鐮佽矾寰�
qrpath: D:\qrcode
-localIP: 192.168.2.8
+#澶栭摼璇锋眰IP鍜岀鍙e彿
+req_path: 8096
+localIP: 192.168.2.10
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index 7c51a51..757f8b2 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -75,7 +75,6 @@
# host: 127.0.0.1
# port: 6020
-
# 鍦板潃锛堝叕鍙革級
host: 116.62.18.175
port: 6020
diff --git a/smartor/src/main/java/com/smartor/service/impl/CommonTaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/CommonTaskServiceImpl.java
index 12442f3..0ebbae6 100644
--- a/smartor/src/main/java/com/smartor/service/impl/CommonTaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/CommonTaskServiceImpl.java
@@ -44,17 +44,19 @@
@Override
public Integer taskSend(SendTaskVO sendTaskVO) {
- if (sendTaskVO.getTaskId() == null || sendTaskVO.getTaskType() == null)
- throw new BaseException("浠诲姟ID鎴栬�呬换鍔$被鍨嬩笉鑳戒负绌猴紝璇锋鏌ュ悗锛屽啀杩涜鎵ц");
- if (sendTaskVO.getTaskType() == 1) {
- //闅忚
- return sfSend(sendTaskVO);
- } else if (sendTaskVO.getTaskType() == 2) {
- //闂嵎
- return wjSend(sendTaskVO);
- } else if (sendTaskVO.getTaskType() == 3) {
- //瀹f暀
- xjSend(sendTaskVO);
+ synchronized (CommonTaskServiceImpl.class) {
+ if (sendTaskVO.getTaskId() == null || sendTaskVO.getTaskType() == null)
+ throw new BaseException("浠诲姟ID鎴栬�呬换鍔$被鍨嬩笉鑳戒负绌猴紝璇锋鏌ュ悗锛屽啀杩涜鎵ц");
+ if (sendTaskVO.getTaskType() == 1) {
+ //闅忚
+ return sfSend(sendTaskVO);
+ } else if (sendTaskVO.getTaskType() == 2) {
+ //闂嵎
+ return wjSend(sendTaskVO);
+ } else if (sendTaskVO.getTaskType() == 3) {
+ //瀹f暀
+ xjSend(sendTaskVO);
+ }
}
return null;
}
@@ -80,11 +82,11 @@
String content = sendMQContent(sendTaskVO, ivrTask.getTemplateid().toString(), ivrTask.getPreachform(), ivrTask.getStopState(), null);
//绔嬪嵆鍙戦��
redisCache.setCacheObject(content, content, 1, TimeUnit.SECONDS);
-
//灏嗕换鍔$姸鎬佷慨鏀规垚鎵ц涓�
ServiceTask serviceTask = new ServiceTask();
serviceTask.setTaskid(ivrTask.getTaskid());
serviceTask.setSendState(2);
+ serviceTask.setStopState(ivrTask.getStopState());
ivrTaskService.updateServiceTask(serviceTask);
log.error("娑堟伅鍙戦�佹垚鍔�");
} else if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("1") || StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("3")) {
@@ -118,8 +120,7 @@
redisCache.setCacheObject(content, content, milliseconds / 1000, TimeUnit.SECONDS);
} catch (Exception e) {
e.printStackTrace();
- if (milliseconds < 0)
- throw new BaseException("璇锋鏌ヤ换鍔″紑濮嬫椂闂达紝涓嶈兘灏忎簬褰撳墠鏃堕棿");
+ if (milliseconds < 0) throw new BaseException("璇锋鏌ヤ换鍔″紑濮嬫椂闂达紝涓嶈兘灏忎簬褰撳墠鏃堕棿");
}
}
//灏嗕换鍔$姸鎬佷慨鏀规垚鎵ц涓�
@@ -128,7 +129,8 @@
serviceTask.setSendState(2);
ivrTaskService.updateServiceTask(serviceTask);
}
- } return 1;
+ }
+ return 1;
}
public int wjSend(SendTaskVO sendTaskVO) {
--
Gitblit v1.9.3