From 0b02577ab12ac83a0530b7e0495b513dd0cdabca Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期二, 02 七月 2024 11:25:08 +0800 Subject: [PATCH] 代码提交 --- ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java | 89 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 70 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 b9295e9..dae2a6a 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 @@ -10,11 +10,12 @@ import com.smartor.common.SendService; import com.smartor.config.RobotPhoneUtils; import com.smartor.domain.*; -import com.smartor.mapper.IvrTaskMapper; -import com.smartor.mapper.IvrTaskSingleMapper; +import com.smartor.mapper.ServiceSubtaskMapper; +import com.smartor.mapper.ServiceTaskMapper; import com.smartor.mapper.SvyTaskMapper; import com.smartor.mapper.SvyTaskSingleMapper; import com.smartor.service.IIvrTaskTemplateService; +import com.smartor.service.IServiceSubtaskRecordService; import com.smartor.service.ISvyTaskTemplateService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -24,9 +25,7 @@ import org.springframework.data.redis.listener.RedisMessageListenerContainer; import org.springframework.stereotype.Component; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -46,9 +45,9 @@ private static IIvrTaskTemplateService ivrTaskTemplateService; - private static IvrTaskSingleMapper ivrTaskcallMapper; + private static ServiceSubtaskMapper ivrTaskcallMapper; - private static IvrTaskMapper ivrTaskMapper; + private static ServiceTaskMapper ivrTaskMapper; private static SendService sendService; @@ -64,6 +63,9 @@ @Autowired private ISvyTaskTemplateService iSvyTaskTemplateService; + + @Autowired + private IServiceSubtaskRecordService serviceSubtaskRecordService; // 鍒涘缓鍥哄畾澶у皬鐨勭嚎绋嬫睜 private static final ExecutorService executorService = Executors.newFixedThreadPool(10); @@ -89,12 +91,12 @@ } @Autowired - public void setIvrTaskcallMapper(IvrTaskSingleMapper ivrTaskcallMapper) { + public void setIvrTaskcallMapper(ServiceSubtaskMapper ivrTaskcallMapper) { RedisMqReceiver.ivrTaskcallMapper = ivrTaskcallMapper; } @Autowired - public void setIvrTaskMapper(IvrTaskMapper ivrTaskMapper) { + public void setIvrTaskMapper(ServiceTaskMapper ivrTaskMapper) { RedisMqReceiver.ivrTaskMapper = ivrTaskMapper; } @@ -155,7 +157,7 @@ */ private void sfHandle(CommonTaskcallMQ commonTaskcallMQ) { //鍒ゆ柇涓�涓媍ommonTaskcallMQ涓殑stopstate鏄惁涓巌vr_task涓殑涓�鑷达紝涓嶄竴鑷达紝鍒欒鏄庢槸鏆傚仠浜� - IvrTask ivrTask1 = ivrTaskMapper.selectIvrTaskByTaskid(commonTaskcallMQ.getTaskid()); + ServiceTask ivrTask1 = ivrTaskMapper.selectServiceTaskByTaskid(commonTaskcallMQ.getTaskid()); if (ivrTask1.getStopState() != commonTaskcallMQ.getStopState()) { //灏嗘秷鎭粠闃熷垪涓墧闄� return; @@ -175,16 +177,26 @@ IvrTaskTemplateVO ivrTaskTemplateVO1 = ivrTaskTemplateService.selectInfoByCondition(ivrTaskTemplateVO); //閫氳繃浠诲姟ID鎷垮埌鎮h�呬俊鎭� - IvrTaskSingle ivrTaskcall = new IvrTaskSingle(); + ServiceSubtask ivrTaskcall = new ServiceSubtask(); ivrTaskcall.setTaskid(commonTaskcallMQ.getTaskid()); - List<IvrTaskSingle> ivrTaskcalls = ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall); + List<ServiceSubtask> ivrTaskcalls = ivrTaskcallMapper.selectServiceSubtaskList(ivrTaskcall); if (descByCode.equals("鐢佃瘽")) { - for (IvrTaskSingle ivrTaskcall1 : ivrTaskcalls) { - IvrTask ivrTask = ivrTaskMapper.selectIvrTaskByTaskid(ivrTaskcall1.getTaskid()); + for (ServiceSubtask ivrTaskcall1 : ivrTaskcalls) { + ServiceTask ivrTask = ivrTaskMapper.selectServiceTaskByTaskid(ivrTaskcall1.getTaskid()); if (ivrTask.getSendState() != null && ivrTask.getSendState() == 3 || ivrTask.getSendState() != null && ivrTask.getSendState() == 4) { //濡備綍浠诲姟琚�滄殏鍋溾�濇垨鈥滅粓姝⑩�� break; } + + //浠诲姟鍙戦�佽褰曪紙杩欎釜浠g爜搴旇鍐欏湪phoneTask涓紝鍏堝啓鍦ㄨ繖锛屽悗闈㈠啀鏀癸級 + ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); + serviceSubtaskRecord.setTaskid(ivrTaskcall1.getTaskid().toString()); + serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); + serviceSubtaskRecord.setTasktype(ivrTaskcall1.getType()); + serviceSubtaskRecord.setPreachform("3"); + serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); + serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); + //閫氳繃澶氱嚎绋嬬殑鏂瑰紡鍘绘墦鐢佃瘽 executorService.submit(new PhoneTask(ivrTaskcall1, ivrTaskTemplateVO1, redisCache, sendService, phonePath, robotPhoneUtils)); } @@ -200,18 +212,28 @@ String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key); - for (IvrTaskSingle ivrTaskSingle : ivrTaskcalls) { + for (ServiceSubtask ivrTaskSingle : ivrTaskcalls) { String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key); SendMagParam sendMagParam = new SendMagParam(); sendMagParam.setType("4"); sendMagParam.setUrl(req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid); - sendService.sendMsg(sendMagParam); + Boolean aBoolean = sendService.sendMsg(sendMagParam); + + //浠诲姟鍙戦�佽褰� + ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); + serviceSubtaskRecord.setTaskid(ivrTaskSingle.getTaskid().toString()); + serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); + serviceSubtaskRecord.setTasktype(ivrTaskSingle.getType()); + serviceSubtaskRecord.setPreachform("4"); + serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); + serviceSubtaskRecord.setResult(aBoolean == true ? "鎴愬姛" : "澶辫触"); + serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); } } else if (descByCode.equals("鍏紬鍙�")) { //鍏紬鍙� RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key); - for (IvrTaskSingle ivrTaskSingle : ivrTaskcalls) { + for (ServiceSubtask ivrTaskSingle : ivrTaskcalls) { String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key); SendMagParam sendMagParam = new SendMagParam(); sendMagParam.setType("5"); @@ -222,7 +244,17 @@ Map map = new HashMap(); map.put("first", ivrTask1.getTaskName()); sendMagParam.setContent(JSON.toJSONString(map)); - sendService.sendMsg(sendMagParam); + Boolean aBoolean = sendService.sendMsg(sendMagParam); + + //浠诲姟鍙戦�佽褰� + ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); + serviceSubtaskRecord.setTaskid(ivrTaskSingle.getTaskid().toString()); + serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); + serviceSubtaskRecord.setTasktype(ivrTaskSingle.getType()); + serviceSubtaskRecord.setPreachform("4"); + serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); + serviceSubtaskRecord.setResult(aBoolean == true ? "鎴愬姛" : "澶辫触"); + serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); } } //閫氱煡 MQ 娑堟伅宸茶鎺ユ敹,鍙互ACK(浠庨槦鍒椾腑鍒犻櫎)浜� 锛堣繖涓渶瑕佹牴鎹笟鍔″啀鍘诲鐞咥CK锛� @@ -267,6 +299,15 @@ //濡備綍浠诲姟琚�滄殏鍋溾�濇垨鈥滅粓姝⑩�� break; } + + //浠诲姟鍙戦�佽褰曪紙杩欎釜浠g爜搴旇鍐欏湪phoneTask涓紝鍏堝啓鍦ㄨ繖锛屽悗闈㈠啀鏀癸級 + ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); + serviceSubtaskRecord.setTaskid(svyTaskSingle1.getTaskid().toString()); + serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); + serviceSubtaskRecord.setTasktype(svyTaskSingle1.getType()); + serviceSubtaskRecord.setPreachform("3"); + serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); + serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); //閫氳繃澶氱嚎绋嬬殑鏂瑰紡鍘绘墦鐢佃瘽 // executorService.submit(new PhoneTask(ivrTaskcall1, ivrTaskTemplateVO1, redisCache, sendService, phonePath, robotPhoneUtils)); } @@ -291,7 +332,17 @@ Map map = new HashMap(); map.put("first", svyTask.getTaskName()); sendMagParam.setContent(JSON.toJSONString(map)); - sendService.sendMsg(sendMagParam); + Boolean aBoolean = sendService.sendMsg(sendMagParam); + + //浠诲姟鍙戦�佽褰� + ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); + serviceSubtaskRecord.setTaskid(svyTaskSingle1.getTaskid().toString()); + serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); + serviceSubtaskRecord.setTasktype(svyTaskSingle1.getType()); + serviceSubtaskRecord.setPreachform("4"); + serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); + serviceSubtaskRecord.setResult(aBoolean == true ? "鎴愬姛" : "澶辫触"); + serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); } } //閫氱煡 MQ 娑堟伅宸茶鎺ユ敹,鍙互ACK(浠庨槦鍒椾腑鍒犻櫎)浜� 锛堣繖涓渶瑕佹牴鎹笟鍔″啀鍘诲鐞咥CK锛� -- Gitblit v1.9.3