| | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.ServiceFromEnum; |
| | | import com.ruoyi.common.utils.IPUtils; |
| | | import com.ruoyi.common.utils.RSAPublicKeyExample; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.web.task.PhoneTask; |
| | |
| | | @Override |
| | | public void onMessage(Message message, byte[] pattern) { |
| | | log.info("监听Redis key过期,key:{},channel:{}", message.toString(), new String(pattern)); |
| | | String ip = "116.62.18.175"; |
| | | log.error("本机的网络IP为:{}", ip); |
| | | String content = message.toString(); |
| | | //判断是不是任务信息,如果不是,直接返回,不需要执行 |
| | | if (!content.contains("taskid")) { |
| | |
| | | |
| | | if (commonTaskcallMQ.getTaskType() == 1) { |
| | | //随访 |
| | | sfHandle((commonTaskcallMQ)); |
| | | sfHandle(commonTaskcallMQ, ip); |
| | | } else if (commonTaskcallMQ.getTaskType() == 2) { |
| | | //问卷 |
| | | wjHandle(commonTaskcallMQ); |
| | | wjHandle(commonTaskcallMQ, ip); |
| | | } else if (commonTaskcallMQ.getTaskType() == 3) { |
| | | //宣教 |
| | | xjHandle(commonTaskcallMQ, ip); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * @param commonTaskcallMQ |
| | | */ |
| | | private void sfHandle(CommonTaskcallMQ commonTaskcallMQ) { |
| | | private void sfHandle(CommonTaskcallMQ commonTaskcallMQ, String ip) { |
| | | //判断一下commonTaskcallMQ中的stopstate是否与ivr_task中的一致,不一致,则说明是暂停了 |
| | | ServiceTask ivrTask1 = ivrTaskMapper.selectServiceTaskByTaskid(commonTaskcallMQ.getTaskid()); |
| | | if (ivrTask1.getStopState() != commonTaskcallMQ.getStopState()) { |
| | |
| | | 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); |
| | | sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid); |
| | | Boolean aBoolean = sendService.sendMsg(sendMagParam); |
| | | |
| | | |
| | |
| | | serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); |
| | | } |
| | | } else if (descByCode.equals("公众号")) { |
| | | |
| | | //公众号 |
| | | RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); |
| | | String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key); |
| | |
| | | String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key); |
| | | SendMagParam sendMagParam = new SendMagParam(); |
| | | sendMagParam.setType("5"); |
| | | sendMagParam.setUrl(req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName()); |
| | | sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + ivrTask1.getTaskid().toString() + "¶m2=" + ivrTaskSingle.getPatid().toString() + "¶m3=" + ivrTask1.getTaskName()); |
| | | log.info("链接完整路径:{}", req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName()); |
| | | //这个模板ID先写死,后面做成可选 |
| | | sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4"); |
| | |
| | | * |
| | | * @param commonTaskcallMQ |
| | | */ |
| | | private void xjHandle(CommonTaskcallMQ commonTaskcallMQ) { |
| | | private void xjHandle(CommonTaskcallMQ commonTaskcallMQ, String ip) { |
| | | //判断一下commonTaskcallMQ中的stopstate是否与ivr_task中的一致,不一致,则说明是暂停了 |
| | | ServiceTask ivrTask1 = ivrTaskMapper.selectServiceTaskByTaskid(commonTaskcallMQ.getTaskid()); |
| | | if (ivrTask1.getStopState() != commonTaskcallMQ.getStopState()) { |
| | |
| | | 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); |
| | | sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid); |
| | | Boolean aBoolean = sendService.sendMsg(sendMagParam); |
| | | |
| | | //任务发送记录 |
| | |
| | | String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key); |
| | | SendMagParam sendMagParam = new SendMagParam(); |
| | | sendMagParam.setType("5"); |
| | | sendMagParam.setUrl(req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName()); |
| | | 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()); |
| | | //这个模板ID先写死,后面做成可选 |
| | | sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4"); |
| | |
| | | * |
| | | * @param commonTaskcallMQ |
| | | */ |
| | | private void wjHandle(CommonTaskcallMQ commonTaskcallMQ) { |
| | | private void wjHandle(CommonTaskcallMQ commonTaskcallMQ, String ip) { |
| | | //判断一下commonTaskcallMQ中的stopstate是否与ivr_task中的一致,不一致,则说明是暂停了 |
| | | SvyTask svyTask = svyTaskMapper.selectSvyTaskByTaskid(commonTaskcallMQ.getTaskid()); |
| | | if (svyTask.getStopState() != commonTaskcallMQ.getStopState()) { |
| | |
| | | String patid = rsaPublicKeyExample.encryptedData(svyTaskSingle1.getPatid().toString(), pub_key); |
| | | SendMagParam sendMagParam = new SendMagParam(); |
| | | sendMagParam.setType("5"); |
| | | sendMagParam.setUrl(req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + svyTask.getTaskName()); |
| | | 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()); |
| | | //这个模板ID先写死,后面做成可选 |
| | | sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4"); |