From 2cba0d00dc45998105129a0c26cb546282cd39a8 Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期三, 05 六月 2024 13:44:23 +0800 Subject: [PATCH] 随访功能测试:模板、任务、定时发送、公众号发送,流程走通 --- smartor/src/main/java/com/smartor/config/RabbitMQAckConfig.java | 48 ++ smartor/src/main/java/com/smartor/domain/PatArchiveReq.java | 7 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/WeChatController.java | 27 smartor/src/main/java/com/smartor/domain/TestVo.java | 4 smartor/src/main/java/com/smartor/mapper/IvrTaskSingleMapper.java | 4 smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml | 2 ruoyi-common/src/main/java/com/ruoyi/common/utils/RSAPublicKeyExample.java | 82 +++ smartor/src/main/java/com/smartor/domain/IvrTaskSingle.java | 10 smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java | 6 smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java | 14 smartor/src/main/java/com/smartor/service/WeChatService.java | 8 smartor/src/main/java/com/smartor/service/IIvrTaskService.java | 5 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java | 4 smartor/src/main/java/com/smartor/service/impl/HeTaskSingleServiceImpl.java | 3 smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java | 84 +++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java | 53 + smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java | 120 +++-- smartor/src/main/java/com/smartor/domain/IvrTask.java | 36 + smartor/src/main/resources/mapper/smartor/IvrTaskSingleMapper.xml | 114 +++- smartor/src/main/java/com/smartor/common/SendService.java | 42 + smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml | 30 + smartor/src/main/java/com/smartor/domain/SendMagParam.java | 2 ruoyi-common/src/main/java/com/ruoyi/common/enums/ServiceFromEnum.java | 2 ruoyi-admin/src/main/resources/application.yml | 2 smartor/src/main/java/com/smartor/domain/IvrTaskScriptQues.java | 35 + smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java | 107 ++-- smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml | 41 - ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskSingleController.java | 17 smartor/src/main/java/com/smartor/config/RabbitMqCallPhoneConfig.java | 7 smartor/src/main/java/com/smartor/service/IIvrTaskSingleService.java | 13 ruoyi-admin/src/main/resources/application-druid.yml | 11 ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java | 86 +-- ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java | 69 +++ smartor/src/main/java/com/smartor/domain/IvrTaskVO.java | 51 ++ ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java | 75 ++ ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java | 2 smartor/src/main/java/com/smartor/domain/SendTaskVO.java | 4 smartor/src/main/java/com/smartor/service/impl/WeChatServiceImpl.java | 48 ++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HeTaskController.java | 16 39 files changed, 945 insertions(+), 346 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java index 61396f7..8f5dcf8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java @@ -1,10 +1,12 @@ package com.ruoyi.web.component; +import com.alibaba.fastjson2.JSON; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.rabbitmq.client.Channel; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.ServiceFromEnum; +import com.ruoyi.common.utils.RSAPublicKeyExample; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.web.task.PhoneTask; import com.smartor.common.SendService; @@ -27,7 +29,9 @@ import org.springframework.stereotype.Component; import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -37,6 +41,12 @@ @Value("${phonePath}") private String phonePath; + + @Value("${pub_key}") + private String pub_key; + + @Value("${req_path}") + private String req_path; private static IIvrTaskTemplateService ivrTaskTemplateService; @@ -51,6 +61,7 @@ private static RabbitMqCallPhoneConfig rabbitMqCallPhoneConfig; private static RobotPhoneUtils robotPhoneUtils; + // 鍒涘缓鍥哄畾澶у皬鐨勭嚎绋嬫睜 private static final ExecutorService executorService = Executors.newFixedThreadPool(10); @@ -96,7 +107,7 @@ */ @RabbitListener(queues = "task_queue", concurrency = "50") public void phoneVisit(String content, Message message, Channel channel) throws IOException { - + log.error("娑堟伅杩涙潵浜�--------------"); try { IvrTaskcallMQ ivrTaskcallMQ = null; @@ -118,34 +129,68 @@ return; } - if (StringUtils.isNotEmpty(ivrTaskcallMQ.getServicefrom())) { + if (StringUtils.isNotEmpty(ivrTaskcallMQ.getPreachform())) { //濡備綍浠诲姟鍙戦�佹柟寮忎笉涓虹┖ - String[] split = ivrTaskcallMQ.getServicefrom().split(","); + String[] split = ivrTaskcallMQ.getPreachform().split(","); for (String serviceFrom : split) { String descByCode = ServiceFromEnum.getDescByCode(Integer.valueOf(serviceFrom)); //杩欓噷鍙互鑰冭檻鐢ㄧ瓥鐣ユā寮忎紭鍖栦竴涓嬶紝涓嶇劧澶毦鐪嬩簡 + + //閫氳繃妯℃澘ID鑾峰彇妯℃澘闂 + IvrTaskTemplateVO ivrTaskTemplateVO = new IvrTaskTemplateVO(); + ivrTaskTemplateVO.setID(Long.valueOf(ivrTaskcallMQ.getTemplateid())); + IvrTaskTemplateVO ivrTaskTemplateVO1 = ivrTaskTemplateService.selectInfoByCondition(ivrTaskTemplateVO); + + //閫氳繃浠诲姟ID鎷垮埌鎮h�呬俊鎭� + IvrTaskSingle ivrTaskcall = new IvrTaskSingle(); + ivrTaskcall.setTaskid(ivrTaskcallMQ.getTaskid()); + List<IvrTaskSingle> ivrTaskcalls = ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall); if (descByCode.equals("鐢佃瘽")) { - //閫氳繃妯℃澘ID鑾峰彇妯℃澘闂 - IvrTaskTemplateVO ivrTaskTemplateVO = new IvrTaskTemplateVO(); - ivrTaskTemplateVO.setID(Long.valueOf(ivrTaskcallMQ.getTemplateid())); - IvrTaskTemplateVO ivrTaskTemplateVO1 = ivrTaskTemplateService.selectInfoByCondition(ivrTaskTemplateVO); - - //閫氳繃浠诲姟ID鎷垮埌鎮h�呬俊鎭� - IvrTaskSingle ivrTaskcall = new IvrTaskSingle(); - ivrTaskcall.setTaskid(ivrTaskcallMQ.getTaskid()); - List<IvrTaskSingle> ivrTaskcalls = ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall); - for (IvrTaskSingle ivrTaskcall1 : ivrTaskcalls) { IvrTask ivrTask = ivrTaskMapper.selectIvrTaskByTaskid(ivrTaskcall1.getTaskid()); - if (StringUtils.isNotEmpty(ivrTask.getSendState()) && ivrTask.getSendState().equals(3) || StringUtils.isNotEmpty(ivrTask.getSendState()) && ivrTask.getSendState().equals(4)) { + if (ivrTask.getSendState() != null && ivrTask.getSendState() == 3 || ivrTask.getSendState() != null && ivrTask.getSendState() == 4) { //濡備綍浠诲姟琚�滄殏鍋溾�濇垨鈥滅粓姝⑩�� break; } //閫氳繃澶氱嚎绋嬬殑鏂瑰紡鍘绘墦鐢佃瘽 executorService.submit(new PhoneTask(ivrTaskcall1, ivrTaskTemplateVO1, redisCache, rabbitMqCallPhoneConfig, message, sendService, phonePath, robotPhoneUtils)); } - } else if (descByCode.equals("鍏紬鍙�")) { + } else if (descByCode.equals("澶氬獟浣�")) { + //澶氬獟浣� + } else if (descByCode.equals("绾歌川")) { + //绾歌川 + } 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); + + for (IvrTaskSingle ivrTaskSingle : ivrTaskcalls) { + String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key); + SendMagParam sendMagParam = new SendMagParam(); + sendMagParam.setType("4"); + sendMagParam.setUrl("192.168.2.10:8099/followvisit/particty?param1=" + taskId + "¶m2=" + patid); + sendService.sendMsg(sendMagParam); + } + } else if (descByCode.equals("鍏紬鍙�")) { + //鍏紬鍙� + RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); + String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key); + for (IvrTaskSingle ivrTaskSingle : ivrTaskcalls) { + 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()); + log.info("閾炬帴瀹屾暣璺緞锛歿}", req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName()); + //杩欎釜妯℃澘ID鍏堝啓姝伙紝鍚庨潰鍋氭垚鍙�� + sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4"); + Map map = new HashMap(); + map.put("first", ivrTask1.getTaskName()); + sendMagParam.setContent(JSON.toJSONString(map)); + sendService.sendMsg(sendMagParam); + } } //閫氱煡 MQ 娑堟伅宸茶鎺ユ敹,鍙互ACK(浠庨槦鍒椾腑鍒犻櫎)浜� 锛堣繖涓渶瑕佹牴鎹笟鍔″啀鍘诲鐞咥CK锛� channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HeTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HeTaskController.java index 71e9064..743d69a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HeTaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HeTaskController.java @@ -1,15 +1,13 @@ package com.ruoyi.web.controller.smartor; +import com.github.pagehelper.ISelect; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.PageUtils; -import com.smartor.domain.HeTask; -import com.smartor.domain.HeTaskVO; -import com.smartor.domain.PatArchiveReq; -import com.smartor.domain.PatTaskRelevanceVO; +import com.smartor.domain.*; import com.smartor.service.IHeTaskService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -106,8 +104,14 @@ @PostMapping("/getPatientInfo") public TableDataInfo getPatientInfo(@RequestBody PatArchiveReq patArchiveReq) { PageUtils.startPageByPost(patArchiveReq.getPageNum(), patArchiveReq.getPageSize()); - return getDataTable(heTaskService.getPatientInfo(patArchiveReq)); + List<PatTaskRelevance> patientInfo = heTaskService.getPatientInfo(patArchiveReq); + long count = PageUtils.count(new ISelect() { + @Override + public void doSelect() { + heTaskService.getPatientInfo(patArchiveReq); + } + }); + return getDataTable2(count, patientInfo); } - } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java index a972bca..2506350 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java @@ -8,6 +8,7 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.base.BaseException; +import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.smartor.config.PhoneUtils; import com.smartor.config.RabbitMqCallPhoneConfig; @@ -56,7 +57,8 @@ @PreAuthorize("@ss.hasPermi('smartor:template:list')") @PostMapping("/list") public TableDataInfo list(@RequestBody IvrLibaTemplate ivrLibaTemplate) { - startPage(); + //鍒嗛〉 + PageUtils.startPageByPost(ivrLibaTemplate.getPageNum(), ivrLibaTemplate.getPageSize()); List<IvrLibaTemplate> list = ivrLibaTemplateService.selectIvrLibaTemplateList(ivrLibaTemplate); return getDataTable(list); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java index d38093c..738811e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.smartor; +import com.github.pagehelper.ISelect; import com.github.pagehelper.PageInfo; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.constant.HttpStatus; @@ -9,16 +10,20 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.DtoConversionUtils; import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.RSAPublicKeyExample; import com.ruoyi.common.utils.poi.ExcelUtil; import com.smartor.domain.IvrTask; +import com.smartor.domain.IvrTaskScriptQues; import com.smartor.domain.IvrTaskVO; import com.smartor.domain.IvrTaskSingle; import com.smartor.service.IIvrTaskService; import com.smartor.service.IIvrTaskSingleService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -32,6 +37,7 @@ * @author smartor * @date 2023-03-24 */ +@Slf4j @Api(description = "闅忚浠诲姟") @RestController @RequestMapping("/smartor/ivrtask") @@ -41,6 +47,12 @@ @Autowired private IIvrTaskSingleService iIvrTaskCallService; + + @Value("${pub_key}") + private String pub_key; + + @Value("${pri_key}") + private String pri_key; /** * 鏌ヨ璇煶浠诲姟鍒楄〃 @@ -52,13 +64,6 @@ PageUtils.startPageByPost(ivrTask.getPageNum(), ivrTask.getPageSize()); List<IvrTask> list = ivrTaskService.selectIvrTaskList(ivrTask); List<IvrTaskVO> ivrTaskVOS = DtoConversionUtils.sourceToTarget(list, IvrTaskVO.class); - - //璁剧疆鍒嗛〉 - TableDataInfo rspData = new TableDataInfo(); - rspData.setCode(HttpStatus.SUCCESS); - rspData.setMsg("鏌ヨ鎴愬姛"); - rspData.setRows(null); - rspData.setTotal(0); if (CollectionUtils.isNotEmpty(ivrTaskVOS)) { for (IvrTaskVO ivrTaskVO : ivrTaskVOS) { @@ -74,18 +79,20 @@ ivrTaskVO.setWfs(wfs); } } + //鑾峰彇total + long total = PageUtils.count(new ISelect() { + @Override + public void doSelect() { + ivrTask.setPageNum(null); + ivrTask.setPageSize(null); + ivrTaskService.selectIvrTaskList(ivrTask); + } + }); - //鐢ㄤ簬鍒嗛〉 - ivrTask.setPageNum(null); - ivrTask.setPageSize(null); - List<IvrTask> ivrTasks = ivrTaskService.selectIvrTaskList(ivrTask); - rspData.setCode(HttpStatus.SUCCESS); - rspData.setMsg("鏌ヨ鎴愬姛"); - rspData.setRows(ivrTaskVOS); - rspData.setTotal(new PageInfo(ivrTasks).getTotal()); + return getDataTable2(total, ivrTaskVOS); } - return rspData; + return getDataTable2(0, ivrTaskVOS); } /** @@ -156,5 +163,19 @@ return toAjax(ivrTaskService.deleteIvrTaskByTaskid(taskId)); } + /** + * 閫氳繃浠诲姟ID鍜屾偅鑰匢D鑾峰彇鍗曚釜浜虹殑棰樼洰淇℃伅 + * + * @return + */ + @ApiOperation("閫氳繃浠诲姟ID鍜屾偅鑰匢D鑾峰彇鍗曚釜浜虹殑棰樼洰淇℃伅") + @PostMapping("/getScriptInfoByCondition") + public TableDataInfo getScriptInfoByCondition(@RequestBody IvrTaskScriptQues ivrTaskScriptQues) { + RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); + Long tid = Long.valueOf(rsaPublicKeyExample.decryptedData(ivrTaskScriptQues.getParam1(), pri_key)); + Long pid = Long.valueOf(rsaPublicKeyExample.decryptedData(ivrTaskScriptQues.getParam2(), pri_key)); + log.info("tid鍜宲id鐨勫�间负锛歿},{}", tid, pid); + return getDataTable(ivrTaskService.getScriptInfoByCondition(tid, pid)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskSingleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskSingleController.java index 8143475..17554c5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskSingleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskSingleController.java @@ -10,10 +10,7 @@ import com.ruoyi.common.utils.DtoConversionUtils; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.smartor.domain.IvrTaskSingle; -import com.smartor.domain.IvrTaskSingleVO; -import com.smartor.domain.PhoneCallBackVO; -import com.smartor.domain.SendTaskVO; +import com.smartor.domain.*; import com.smartor.domain.robot.back.RobotAIDialogBack; import com.smartor.domain.robot.back.RobotCallBack; import com.smartor.service.IIvrTaskSingleService; @@ -80,12 +77,12 @@ @PreAuthorize("@ss.hasPermi('system:task:add')") @Log(title = "鍗曚竴浠诲姟锛堥殢璁匡級", businessType = BusinessType.INSERT) @PostMapping("/insertOrUpdateTask") - public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskSingleVO ivrTaskcallVO) { + public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskVO ivrTaskVO) { LoginUser loginUser = getLoginUser(); SysUser user = loginUser.getUser(); - ivrTaskcallVO.setCreateBy(user.getNickName()); - return toAjax(ivrTaskcallService.insertOrUpdateTask(ivrTaskcallVO)); + ivrTaskVO.setCreateBy(user.getNickName()); + return toAjax(ivrTaskcallService.insertOrUpdateTask(ivrTaskVO)); } /** @@ -96,8 +93,8 @@ public AjaxResult queryTaskByCondition(@RequestBody IvrTaskSingleVO ivrTaskcallVO) { //鏍规嵁鍏ュ弬鏌ヨ淇℃伅 IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskSingle.class); - IvrTaskSingleVO ivrTaskSingleVO = ivrTaskcallService.queryTaskByCondition(ivrTaskcall); - return success(ivrTaskSingleVO); + IvrTaskVO ivrTaskVO = ivrTaskcallService.queryTaskByCondition(ivrTaskcall); + return success(ivrTaskVO); } /** @@ -105,7 +102,7 @@ */ @ApiOperation("浠诲姟鐨勫彂閫佹墽琛屻�佹殏鍋溿�佺粓姝�") @PostMapping("/taskSend") - public AjaxResult heTaskSend(@RequestBody SendTaskVO sendTaskVO) { + public AjaxResult taskSend(@RequestBody SendTaskVO sendTaskVO) { return toAjax(ivrTaskcallService.heTaskSend(sendTaskVO)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/WeChatController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/WeChatController.java index ecbc125..d476d32 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/WeChatController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/WeChatController.java @@ -3,7 +3,9 @@ import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.smartor.domain.WeChatSendVo; +import com.smartor.service.WeChatService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import me.chanjar.weixin.common.exception.WxErrorException; @@ -42,6 +44,9 @@ @Value("${appSecret}") private String appSecret; + @Autowired + private WeChatService weChatService; + /** * 鑾峰彇妯℃澘淇℃伅 @@ -73,26 +78,8 @@ */ @ApiOperation("寰俊鍏紬鍙蜂俊鎭彂閫�") @PostMapping("/sendMessageToFollowers") - public Boolean sendMessageToFollowers(@RequestBody WeChatSendVo weChatSendVo) { - WxMpService wxMpService; - wxMpService = new WxMpServiceImpl(); - wxMpService.setWxMpConfigStorage(new WxMpInMemoryConfigStorage()); - WxMpInMemoryConfigStorage wxMpConfigStorage = (WxMpInMemoryConfigStorage) wxMpService.getWxMpConfigStorage(); - wxMpConfigStorage.setAppId(appid); - wxMpConfigStorage.setSecret(appSecret); - try { - List<String> openIdList = wxMpService.getUserService().userList(null).getOpenids(); - for (String openId : openIdList) { - WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder().toUser(openId).templateId(weChatSendVo.getTemplateId()).url(weChatSendVo.getUrl()).build(); - for (String key : weChatSendVo.getContent().keySet()) { - templateMessage.addData(new WxMpTemplateData(key, weChatSendVo.getContent().get(key).toString())); - } - wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage); - } - } catch (WxErrorException e) { - e.printStackTrace(); - } - return true; + public AjaxResult sendMessageToFollowers(@RequestBody WeChatSendVo weChatSendVo) { + return toAjax(weChatService.sendMessageToFollowers(weChatSendVo)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java b/ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java index 0bc2d96..c216a11 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java @@ -5,6 +5,13 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.security.*; +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.Base64; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -16,9 +23,45 @@ @Test public void testSend() { - String str = "absdf"; - String c = Character.toUpperCase(str.charAt(0)) + str.substring(1); - System.out.println(c); + try { + + // 鐢熸垚RSA瀵嗛挜瀵� + KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); + keyPairGenerator.initialize(2048); + KeyPair keyPair = keyPairGenerator.generateKeyPair(); + + // 鑾峰彇鍏挜鍜岀閽� + PublicKey publicKey = keyPair.getPublic(); + PrivateKey privateKey = keyPair.getPrivate(); + String publicKeyString = Base64.getEncoder().encodeToString(privateKey.getEncoded()); + System.out.println(publicKeyString); + // 鏄庢枃 + String plainText = "Hello, World!"; + + // 鍔犲瘑 + Cipher encryptCipher = Cipher.getInstance("RSA"); + encryptCipher.init(Cipher.ENCRYPT_MODE, publicKey); + byte[] encryptedBytes = encryptCipher.doFinal(plainText.getBytes()); + + // 灏嗗姞瀵嗗悗鐨勬暟鎹浆鎹负Base64缂栫爜鐨勫瓧绗︿覆 + String encryptedText = Base64.getEncoder().encodeToString(encryptedBytes); + System.out.println("鍔犲瘑鍚庣殑鏁版嵁锛�" + encryptedText); + + // 瑙e瘑 + Cipher decryptCipher = Cipher.getInstance("RSA"); + decryptCipher.init(Cipher.DECRYPT_MODE, privateKey); + byte[] decryptedBytes = decryptCipher.doFinal(Base64.getDecoder().decode(encryptedBytes)); + + // 鏄庢枃 + String decryptedText = new String(decryptedBytes); + System.out.println("瑙e瘑鍚庣殑鏁版嵁锛�" + decryptedText); + } catch (Exception e) { + + } + +// String str = "absdf"; +// String c = Character.toUpperCase(str.charAt(0)) + str.substring(1); +// System.out.println(c); "鎮ㄥソ锛屾垜鏄禉浜屽尰闄㈠紶鍖荤敓锛屾偍鏄�${name}鍚楋紵杩樻槸瀹跺睘?".replaceAll("$$*variable", "AA"); // Pattern pattern = Pattern.compile("^(?!.*(濂絴澶ソ)).*$"); // Matcher matcher = pattern.matcher("鐫$湢涓嶅ソ"); @@ -28,4 +71,24 @@ // // executorService.submit(new PhoneTask()); } + + @Test + public void testSend22() { + try { + byte[] privateKeyBytes = Base64.getDecoder().decode(""); + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privateKey = keyFactory.generatePrivate(keySpec); + + // 浣跨敤绉侀挜瑙e瘑鏁版嵁 + Cipher decryptCipher = Cipher.getInstance("RSA"); + decryptCipher.init(Cipher.DECRYPT_MODE, privateKey); + byte[] decryptedBytes = decryptCipher.doFinal(Base64.getDecoder().decode("")); + + // 瑙e瘑鍚庣殑鏁版嵁 + String decryptedData = new String(decryptedBytes); + System.out.println("瑙e瘑鍚庣殑鏁版嵁锛�" + decryptedData); + } catch (Exception e) { + } + } } diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index d56ac53..c0a2118 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -2,7 +2,7 @@ spring: rabbitmq: host: 116.62.18.175 - # host: 127.0.0.1 + # host: 192.168.2.8 password: guest port: 5672 username: guest @@ -137,3 +137,12 @@ app_id: hz_ali #鎺堟潈 key(宸插姞瀵嗚繃鐨� key)(鏉窞) app_key: a2f3b5799d635216aa280362fafd8c35 + + +pub_key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALQzqW1EIXBKGMu+2oEYSB5gM7Ox/ihyYTeeoE0yPX1qtt4++5yNOeTBVd6EEM4iKzVEzWj6REIWVwaSNPn/SvUCAwEAAQ== +#杩欎釜鏄悗绔殑绉侀挜锛岀敤涓嶅埌 +#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: 192.168.2.10:8099 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 60eb4ad..58c43e9 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -122,6 +122,8 @@ mapperLocations: classpath*:mapper/**/*Mapper.xml # 鍔犺浇鍏ㄥ眬鐨勯厤缃枃浠� configLocation: classpath:mybatis/mybatis-config.xml + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # PageHelper鍒嗛〉鎻掍欢 pagehelper: diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index 25efcaf..a8753e2 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -3,6 +3,7 @@ import java.beans.PropertyEditorSupport; import java.util.Date; import java.util.List; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.WebDataBinder; @@ -23,25 +24,21 @@ /** * web灞傞�氱敤鏁版嵁澶勭悊 - * + * * @author ruoyi */ -public class BaseController -{ +public class BaseController { protected final Logger logger = LoggerFactory.getLogger(this.getClass()); /** * 灏嗗墠鍙颁紶閫掕繃鏉ョ殑鏃ユ湡鏍煎紡鐨勫瓧绗︿覆锛岃嚜鍔ㄨ浆鍖栦负Date绫诲瀷 */ @InitBinder - public void initBinder(WebDataBinder binder) - { + public void initBinder(WebDataBinder binder) { // Date 绫诲瀷杞崲 - binder.registerCustomEditor(Date.class, new PropertyEditorSupport() - { + binder.registerCustomEditor(Date.class, new PropertyEditorSupport() { @Override - public void setAsText(String text) - { + public void setAsText(String text) { setValue(DateUtils.parseDate(text)); } }); @@ -50,19 +47,16 @@ /** * 璁剧疆璇锋眰鍒嗛〉鏁版嵁 */ - protected void startPage() - { + protected void startPage() { PageUtils.startPage(); } /** * 璁剧疆璇锋眰鎺掑簭鏁版嵁 */ - protected void startOrderBy() - { + protected void startOrderBy() { PageDomain pageDomain = TableSupport.buildPageRequest(); - if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) - { + if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) { String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); PageHelper.orderBy(orderBy); } @@ -71,17 +65,15 @@ /** * 娓呯悊鍒嗛〉鐨勭嚎绋嬪彉閲� */ - protected void clearPage() - { + protected void clearPage() { PageUtils.clearPage(); } /** * 鍝嶅簲璇锋眰鍒嗛〉鏁版嵁 */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected TableDataInfo getDataTable(List<?> list) - { + @SuppressWarnings({"rawtypes", "unchecked"}) + protected TableDataInfo getDataTable(List<?> list) { TableDataInfo rspData = new TableDataInfo(); rspData.setCode(HttpStatus.SUCCESS); rspData.setMsg("鏌ヨ鎴愬姛"); @@ -93,124 +85,110 @@ /** * 鍝嶅簲璇锋眰鍒嗛〉鏁版嵁 */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected TableDataInfo getDataTable2(List<?> list,List<?> list2) - { + @SuppressWarnings({"rawtypes", "unchecked"}) + protected TableDataInfo getDataTable2(long total, List<?> list) { TableDataInfo rspData = new TableDataInfo(); rspData.setCode(HttpStatus.SUCCESS); rspData.setMsg("鏌ヨ鎴愬姛"); - rspData.setRows(list2); - rspData.setTotal(new PageInfo(list).getTotal()); + rspData.setRows(list); + rspData.setTotal(total); return rspData; } /** * 杩斿洖鎴愬姛 */ - public AjaxResult success() - { + public AjaxResult success() { return AjaxResult.success(); } /** * 杩斿洖澶辫触娑堟伅 */ - public AjaxResult error() - { + public AjaxResult error() { return AjaxResult.error(); } /** * 杩斿洖鎴愬姛娑堟伅 */ - public AjaxResult success(String message) - { + public AjaxResult success(String message) { return AjaxResult.success(message); } - + /** * 杩斿洖鎴愬姛娑堟伅 */ - public AjaxResult success(Object data) - { + public AjaxResult success(Object data) { return AjaxResult.success(data); } /** * 杩斿洖澶辫触娑堟伅 */ - public AjaxResult error(String message) - { + public AjaxResult error(String message) { return AjaxResult.error(message); } /** * 杩斿洖璀﹀憡娑堟伅 */ - public AjaxResult warn(String message) - { + public AjaxResult warn(String message) { return AjaxResult.warn(message); } /** * 鍝嶅簲杩斿洖缁撴灉 - * + * * @param rows 褰卞搷琛屾暟 * @return 鎿嶄綔缁撴灉 */ - protected AjaxResult toAjax(int rows) - { + protected AjaxResult toAjax(int rows) { return rows > 0 ? AjaxResult.success() : AjaxResult.error(); } /** * 鍝嶅簲杩斿洖缁撴灉 - * + * * @param result 缁撴灉 * @return 鎿嶄綔缁撴灉 */ - protected AjaxResult toAjax(boolean result) - { + protected AjaxResult toAjax(boolean result) { return result ? success() : error(); } /** * 椤甸潰璺宠浆 */ - public String redirect(String url) - { + public String redirect(String url) { return StringUtils.format("redirect:{}", url); } /** * 鑾峰彇鐢ㄦ埛缂撳瓨淇℃伅 */ - public LoginUser getLoginUser() - { + public LoginUser getLoginUser() { return SecurityUtils.getLoginUser(); } /** * 鑾峰彇鐧诲綍鐢ㄦ埛id */ - public Long getUserId() - { + public Long getUserId() { return getLoginUser().getUserId(); } /** * 鑾峰彇鐧诲綍閮ㄩ棬id */ - public Long getDeptId() - { + public Long getDeptId() { return getLoginUser().getDeptId(); } /** * 鑾峰彇鐧诲綍鐢ㄦ埛鍚� */ - public String getUsername() - { + public String getUsername() { return getLoginUser().getUsername(); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/ServiceFromEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/ServiceFromEnum.java index 951f4fc..dd8af6b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/ServiceFromEnum.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/ServiceFromEnum.java @@ -8,7 +8,7 @@ ZZ(2, "绾歌川"), DH(3, "鐢佃瘽"), DX(4, "鐭俊"), - GZH(5, "寰俊鍏紬鍙�"), + GZH(5, "鍏紬鍙�"), WXXCH(6, "寰俊灏忕▼搴�"), ZFB(7, "鏀粯瀹�"), ZNXCH(8, "鏅鸿兘灏忕▼搴�"), diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RSAPublicKeyExample.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RSAPublicKeyExample.java new file mode 100644 index 0000000..fe651c0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RSAPublicKeyExample.java @@ -0,0 +1,82 @@ +package com.ruoyi.common.utils; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.crypto.Cipher; +import java.security.KeyFactory; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.Base64; + +@Slf4j +@Component +public class RSAPublicKeyExample { + + + /** + * 鏁版嵁瑙e瘑 + * + * @param encryptedData + * @return + */ + public String decryptedData(String encryptedData, String pri_key) { + String privateKeyString = "绉侀挜鐨凚ase64缂栫爜瀛楃涓�"; // 鍚庣绉侀挜鐨凚ase64缂栫爜瀛楃涓� + + try { + // 灏嗙閽ase64缂栫爜瀛楃涓茶浆鎹负PrivateKey瀵硅薄 + byte[] privateKeyBytes = Base64.getDecoder().decode(pri_key); + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privateKey = keyFactory.generatePrivate(keySpec); + + // 浣跨敤绉侀挜瑙e瘑鏁版嵁 + Cipher decryptCipher = Cipher.getInstance("RSA"); + decryptCipher.init(Cipher.DECRYPT_MODE, privateKey); + byte[] decryptedBytes = decryptCipher.doFinal(Base64.getDecoder().decode(encryptedData)); + + // 瑙e瘑鍚庣殑鏁版嵁 + String decryptedData = new String(decryptedBytes); + System.out.println("瑙e瘑鍚庣殑鏁版嵁锛�" + decryptedData); + return decryptedData; + } catch (Exception e) { + log.error("瑙e瘑鎶ラ敊浜�:{}", e.getMessage()); + } + return null; + } + + /** + * 瑕佸姞瀵嗙殑鏄庢枃鏁版嵁 + * + * @param plainText + * @return + */ + public String encryptedData(String plainText, String pub_key) { + String publicKeyString = "鍏挜鐨凚ase64缂栫爜瀛楃涓�"; // 鍓嶇浼犻�掔殑鍏挜瀛楃涓� + // 灏嗗叕閽ase64缂栫爜瀛楃涓茶浆鎹负PublicKey瀵硅薄 + try { + + byte[] publicKeyBytes = Base64.getDecoder().decode(pub_key); + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKeyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PublicKey publicKey = keyFactory.generatePublic(keySpec); + + // 浣跨敤鍏挜鍔犲瘑鏁版嵁 + Cipher encryptCipher = Cipher.getInstance("RSA"); + encryptCipher.init(Cipher.ENCRYPT_MODE, publicKey); + byte[] encryptedBytes = encryptCipher.doFinal(plainText.getBytes()); + + // 灏嗗姞瀵嗗悗鐨勬暟鎹浆鎹负Base64缂栫爜鐨勫瓧绗︿覆 + String encryptedText = Base64.getEncoder().encodeToString(encryptedBytes); + System.out.println("鍔犲瘑鍚庣殑鏁版嵁锛�" + encryptedText); + return encryptedText; + } catch (Exception e) { + log.error("鍔犲瘑澶辫触浜�:{}", e.getMessage()); + } + return null; + } + + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 79645b1..4e92713 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -108,7 +108,7 @@ // 杩囨护璇锋眰 .authorizeRequests() // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶 - .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo","/socket","/API_ESB_Service","/API_ESB_Service/Run","/magic/web/**","/smartor/tasksingle/phoneCallBack","/smartor/robot/callstatus","/smartor/robot/aidialog","/smartor/robot/cdrinfo","/getToken").permitAll() + .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo","/socket","/API_ESB_Service","/API_ESB_Service/Run","/magic/web/**","/smartor/tasksingle/phoneCallBack","/smartor/robot/callstatus","/smartor/robot/aidialog","/smartor/robot/cdrinfo","/getToken","/smartor/ivrtask/getScriptInfoByCondition").permitAll() // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂� .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() // 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇� diff --git a/smartor/src/main/java/com/smartor/common/SendService.java b/smartor/src/main/java/com/smartor/common/SendService.java index ebd853b..23ca618 100644 --- a/smartor/src/main/java/com/smartor/common/SendService.java +++ b/smartor/src/main/java/com/smartor/common/SendService.java @@ -1,15 +1,20 @@ package com.smartor.common; import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.smartor.domain.*; import com.smartor.mapper.PatWildcardMapper; import com.smartor.service.DingTalkService; +import com.smartor.service.WeChatService; import com.smartor.service.impl.BaseSmsaccountServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.lang.reflect.Field; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 鍙戦�佹湇鍔″伐鍏风被 @@ -25,33 +30,48 @@ @Autowired private PatWildcardMapper patWildcardMapper; + @Autowired + private WeChatService weChatService; + public Boolean sendMsg(SendMagParam sendMagParam) { + // 1,澶氬獟浣� 2,绾歌川 3,鐢佃瘽 4,鐭俊 5.寰俊鍏紬鍙� 6.寰俊灏忕▼搴� 7.鏀粯瀹� 8.鏅鸿兘灏忕▼搴� 9.閽夐拤 switch (sendMagParam.getType()) { - case ("澶氬獟浣�"): + case ("1"): - case ("绾歌川"): + case ("2"): - case ("鐢佃瘽"): + case ("3"): - case ("鐭俊"): + case ("4"): BaseSmsRequest baseSmsRequest = new BaseSmsRequest(); baseSmsRequest.setPhoneNumber(sendMagParam.getPhone()); baseSmsRequest.setTemplateCode("SMS_461860582"); - SendSmsResponseBody sendSmsResponseBody = baseSmsaccountService.sendMsg(baseSmsRequest); if (sendSmsResponseBody.getCode().equals("OK")) { return true; } return false; - case ("寰俊鍏紬鍙�"): + case ("5"): + WeChatSendVo weChatSendVo = new WeChatSendVo(); + weChatSendVo.setUrl(sendMagParam.getUrl()); + weChatSendVo.setTemplateId(sendMagParam.getTmpCode()); + ObjectMapper objectMapper=new ObjectMapper(); + Map map = null; + try { + map = objectMapper.readValue(sendMagParam.getContent(), Map.class); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + weChatSendVo.setContent(map); + Boolean aBoolean1 = weChatService.sendMessageToFollowers(weChatSendVo); + return aBoolean1; + case ("6"): - case ("寰俊灏忕▼搴�"): + case ("7"): - case ("鏀粯瀹�"): + case ("8"): - case ("鏅鸿兘灏忕▼搴�"): - - case ("閽夐拤"): + case ("9"): DingTalkReqVo dingTalkReqVo = new DingTalkReqVo(); Boolean aBoolean = dingTalkService.sendNotification(dingTalkReqVo); if (aBoolean) { diff --git a/smartor/src/main/java/com/smartor/config/RabbitMQAckConfig.java b/smartor/src/main/java/com/smartor/config/RabbitMQAckConfig.java new file mode 100644 index 0000000..0aac228 --- /dev/null +++ b/smartor/src/main/java/com/smartor/config/RabbitMQAckConfig.java @@ -0,0 +1,48 @@ +//package com.smartor.config; +// +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.amqp.core.Message; +//import org.springframework.amqp.rabbit.connection.CorrelationData; +//import org.springframework.amqp.rabbit.core.RabbitTemplate; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Component; +// +//import javax.annotation.PostConstruct; +// +//@Slf4j +//@Component +//public class RabbitMQAckConfig implements RabbitTemplate.ConfirmCallback,RabbitTemplate.ReturnCallback { +// +// +// @Autowired +// private RabbitTemplate rabbitTemplate; +// +// @PostConstruct +// public void init(){ +// rabbitTemplate.setConfirmCallback(this); +// rabbitTemplate.setReturnCallback(this); +// } +// +// +// //鍒ゆ柇鏄惁鍒拌揪浜ゆ崲鏈� +// @Override +// public void confirm(CorrelationData correlationData, boolean ack, String cause) { +// if (ack){ +// log.info("娑堟伅鍒颁簡浜ゆ崲鏈�"); +// System.out.println("娑堟伅鍒颁簡浜ゆ崲鏈� -------------"); +// }else { +// log.info("娑堟伅娌℃湁鍒拌揪浜ゆ崲鏈�"); +// System.out.println("娑堟伅娌℃湁鍒颁氦鎹㈡満----------------- "); +// } +// } +// +// //鍒ゆ柇鏄惁鍒拌揪闃熷垪 +// @Override +// public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) { +// System.out.println("message娑堟伅 = " + new String(message.getBody())); +// System.out.println("replyCode搴旂瓟鐮� = " + replyCode); +// System.out.println("replyText鎻忚堪 = " + replyText); +// System.out.println("exchange浜ゆ崲鏈� = " + exchange); +// System.out.println("routingKey璺敱key = " + routingKey); +// } +//} diff --git a/smartor/src/main/java/com/smartor/config/RabbitMqCallPhoneConfig.java b/smartor/src/main/java/com/smartor/config/RabbitMqCallPhoneConfig.java index e36bcd1..7174106 100644 --- a/smartor/src/main/java/com/smartor/config/RabbitMqCallPhoneConfig.java +++ b/smartor/src/main/java/com/smartor/config/RabbitMqCallPhoneConfig.java @@ -1,12 +1,16 @@ package com.smartor.config; +import org.springframework.amqp.AmqpException; import org.springframework.amqp.core.*; +import org.springframework.amqp.rabbit.connection.CorrelationData; +import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; import java.util.HashMap; import java.util.Map; +import java.util.UUID; @Component public class RabbitMqCallPhoneConfig { @@ -15,7 +19,7 @@ private AmqpAdmin amqpAdmin; @Autowired - private AmqpTemplate rabbitTemplate; + private RabbitTemplate rabbitTemplate; /** * 鍒涘缓浜ゆ崲鏈� @@ -59,7 +63,6 @@ * @param data 娑堟伅 */ public void sendMessage(String changeName, String routingKey, String data, Long times) { - this.rabbitTemplate.convertAndSend(changeName, routingKey, data, message -> { //娉ㄦ剰杩欓噷鏃堕棿鍙互浣縧ong锛岃�屼笖鏄缃甴eader message.getMessageProperties().setHeader("x-delay", times); diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java index 1d64e4a..d8c9dcd 100644 --- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java +++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java @@ -341,5 +341,19 @@ @ApiModelProperty(value = "闅忚鍚庤瘽鏈紙缁撴潫璇級") private String revisitAfter; + /** + * pageNum + */ + @ApiModelProperty(value = "pageNum") + @Excel(name = "pageNum") + private Integer pageNum; + + /** + * pageSize + */ + @ApiModelProperty(value = "pageSize") + @Excel(name = "pageSize") + private Integer pageSize; + } diff --git a/smartor/src/main/java/com/smartor/domain/IvrTask.java b/smartor/src/main/java/com/smartor/domain/IvrTask.java index 20048e8..5a8795d 100644 --- a/smartor/src/main/java/com/smartor/domain/IvrTask.java +++ b/smartor/src/main/java/com/smartor/domain/IvrTask.java @@ -245,18 +245,18 @@ private String preachform; /** - * 鏄惁鍙戦�� 锛� 0 鏆傚仠鍙戦�� 1 瀹氭椂鍙戦�� 2 绔嬪嵆鍙戦�� + * 鍙戦�佺被鍨�: 1鎸囧畾鏃堕棿鍙戦�� 2鍗冲埢鍙戦�� */ - @Excel(name = " 鏄惁鍙戦�� 锛� 0 鏆傚仠鍙戦�� 1 瀹氭椂鍙戦�� 2 绔嬪嵆鍙戦�� ") - @ApiModelProperty(value = "鏄惁鍙戦�� 锛� 0 鏆傚仠鍙戦�� 1 瀹氭椂鍙戦�� 2 绔嬪嵆鍙戦�� ") - private Integer sendType; + @Excel(name = " 鍙戦�佺被鍨�: 1鎸囧畾鏃堕棿鍙戦�� 2鍗冲埢鍙戦�� ") + @ApiModelProperty(value = "鍙戦�佺被鍨�: 1鎸囧畾鏃堕棿鍙戦�� 2鍗冲埢鍙戦�� ") + private Long sendType; /** * 鍙戦�佺姸鎬侊細 0 澶辫触 1鎴愬姛 */ @Excel(name = " 鍙戦�佺姸鎬侊細 1鍒涘缓 2鎵ц涓� 3 鏆傚仠 4缁堟 5瀹屾垚 ") @ApiModelProperty(value = "鍙戦�佺姸鎬侊細 1鍒涘缓 2鎵ц涓� 3 鏆傚仠 4缁堟 5瀹屾垚 ") - private String sendState; + private Integer sendState; // /** // * 鏂囨湰鍙橀噺鍙傛暟 @@ -284,13 +284,6 @@ @ApiModelProperty(value = "灏辫瘖绫诲瀷锛�1闂ㄨ瘖 2鍑洪櫌 3.涓撶梾锛�") private String hospType; -// /** -// * 灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛� -// */ -// @Excel(name = " 灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛� ") -// @ApiModelProperty(value = "灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛�") -// private String hospno; - /** * 浠诲姟鎻忚堪 */ @@ -304,4 +297,23 @@ @Excel(name = "鏆傚仠鐘舵�� 锛� 鐘舵�佸鏋滃彂鐢熶慨鏀癸紝鍊煎氨鍔�1") @ApiModelProperty(value = "鏆傚仠鐘舵�� 锛� 鐘舵�佸鏋滃彂鐢熶慨鏀癸紝鍊煎氨鍔�1") private Long stopState = 0L; + + /** + * 鏂囨湰鍙橀噺鍙傛暟 + */ + @Excel(name = "鏂囨湰鍙橀噺鍙傛暟") + @ApiModelProperty(value = "鏂囨湰鍙橀噺鍙傛暟") + private String textParam; + + @ApiModelProperty(value = "涓婂崍鏃堕棿") + private String showTimeMorn; + + @ApiModelProperty(value = "涓崍鏃堕棿") + private String showTimeNoon; + + @ApiModelProperty(value = "鏅氬崍鏃堕棿") + private String showTimeNight; + + @ApiModelProperty(value = "灞曠ず鏃ユ湡") + private String showDate; } diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskScriptQues.java b/smartor/src/main/java/com/smartor/domain/IvrTaskScriptQues.java new file mode 100644 index 0000000..410966e --- /dev/null +++ b/smartor/src/main/java/com/smartor/domain/IvrTaskScriptQues.java @@ -0,0 +1,35 @@ +package com.smartor.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 璇煶浠诲姟瀵硅薄 ivr_task + * + * @author smartor + * @date 2023-03-24 + */ +@ApiModel(value = "IvrTaskScriptQues", description = "浠诲姟瀵硅薄") +@Data +public class IvrTaskScriptQues { + + /** + * taskid + */ + @ApiModelProperty(value = "taskid") + private String param1; + + /** + * patid + */ + @Excel(name = "patid ") + @ApiModelProperty(value = "patid") + private String param2; + +} diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskSingle.java b/smartor/src/main/java/com/smartor/domain/IvrTaskSingle.java index b867392..ae8e550 100644 --- a/smartor/src/main/java/com/smartor/domain/IvrTaskSingle.java +++ b/smartor/src/main/java/com/smartor/domain/IvrTaskSingle.java @@ -51,7 +51,7 @@ */ @Excel(name = " 鎬у埆") @ApiModelProperty(value = "鎬у埆") - private String sex; + private Long sex; /** * 骞撮緞 @@ -87,7 +87,6 @@ @Excel(name = "浠诲姟绫诲瀷(0閫氱煡銆�1瀹f暀銆�2闂ㄨ瘖銆�3鍑洪櫌銆�4澶嶈瘖銆�5浣撴銆�6闂嵎銆�7鍖绘妧鈥︹��)") @ApiModelProperty(value = "浠诲姟绫诲瀷(0閫氱煡銆�1瀹f暀銆�2闂ㄨ瘖銆�3鍑洪櫌銆�4澶嶈瘖銆�5浣撴銆�6闂嵎銆�7鍖绘妧鈥︹��)") private String type; - /** * 妯℃澘ID @@ -361,6 +360,13 @@ private String diagname; /** + * 鎮h�匢D + */ + @Excel(name = " 鎮h�匢D") + @ApiModelProperty(value = "鎮h�匢D") + private Long patid; + + /** * 绉戝鍚嶇О */ @Excel(name = "绉戝鍚嶇О") diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java b/smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java index d57a4de..4bca535 100644 --- a/smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java +++ b/smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java @@ -327,19 +327,20 @@ @ApiModelProperty(value = "瀹f暀褰㈠紡 : 1,鏂囨湰銆�2,鍥剧墖銆�3,璇煶銆�4,瑙嗛銆�5,娣峰悎") private String serviceform; - /** - * 鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚� - */ - @Excel(name = " 瀹f偅鑰呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚�") - @ApiModelProperty(value = "鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚�") - private List<PatTaskRelevance> patTaskRelevances; -// /** -// * 搴婂彿 -// */ -// @Excel(name = "搴婂彿") -// @ApiModelProperty(value = "搴婂彿") -// private Long bedNo; + /** + * 搴婂彿 + */ + @Excel(name = "搴婂彿") + @ApiModelProperty(value = "搴婂彿") + private Long bedNo; + + /** + * 鎮h�匢D + */ + @Excel(name = " 鎮h�匢D") + @ApiModelProperty(value = "鎮h�匢D") + private Long patid; // // /** // * 鐤剧梾鍚嶇О @@ -383,35 +384,35 @@ @ApiModelProperty(value = "浠诲姟鎻忚堪") private String taskDesc; -// -// /** -// * 闅忚浜� -// */ -// @Excel(name = " 闅忚浜� ") -// @ApiModelProperty(value = "闅忚浜�") -// private String operator; -// -// /** -// * 闅忚浜� -// */ -// @Excel(name = " 闅忚浜虹紪鍙� ") -// @ApiModelProperty(value = "闅忚浜虹紪鍙�") -// private String operatorNo; -// -// -// /** -// * 灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛� -// */ -// @Excel(name = " 灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛� ") -// @ApiModelProperty(value = "灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛�") -// private String hospno; -// -// /** -// * 灏辫瘖绫诲瀷锛�1闂ㄨ瘖 2鍑洪櫌锛� -// */ -// @Excel(name = " 灏辫瘖绫诲瀷锛�1闂ㄨ瘖 2鍑洪櫌 3.涓撶梾锛�") -// @ApiModelProperty(value = "灏辫瘖绫诲瀷锛�1闂ㄨ瘖 2鍑洪櫌 3.涓撶梾锛�") -// private String hospType; + + /** + * 闅忚浜� + */ + @Excel(name = " 闅忚浜� ") + @ApiModelProperty(value = "闅忚浜�") + private String operator; + + /** + * 闅忚浜� + */ + @Excel(name = " 闅忚浜虹紪鍙� ") + @ApiModelProperty(value = "闅忚浜虹紪鍙�") + private String operatorNo; + + + /** + * 灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛� + */ + @Excel(name = " 灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛� ") + @ApiModelProperty(value = "灏辫瘖缂栧彿锛堝搴旂殑outhospno銆乮nhospno锛�") + private String hospno; + + /** + * 灏辫瘖绫诲瀷锛�1闂ㄨ瘖 2鍑洪櫌锛� + */ + @Excel(name = " 灏辫瘖绫诲瀷锛�1闂ㄨ瘖 2鍑洪櫌 3.涓撶梾锛�") + @ApiModelProperty(value = "灏辫瘖绫诲瀷锛�1闂ㄨ瘖 2鍑洪櫌 3.涓撶梾锛�") + private String hospType; // // /** // * 寰俊 @@ -421,12 +422,12 @@ // private String wechat; // // -// /** -// * 璇婃柇鍚嶇О -// */ -// @Excel(name = " 璇婃柇鍚嶇О") -// @ApiModelProperty(value = "璇婃柇鍚嶇О") -// private String diagname; + /** + * 璇婃柇鍚嶇О + */ + @Excel(name = " 璇婃柇鍚嶇О") + @ApiModelProperty(value = "璇婃柇鍚嶇О") + private String diagname; // // /** // * 绉戝鍚嶇О @@ -442,10 +443,10 @@ // @ApiModelProperty(value = "灏辫瘖鏃ユ湡") // private Date admindate; // -// /** -// * 鐥呮埧鍙� -// */ -// @Excel(name = " 鐥呮埧鍙�") -// @ApiModelProperty(value = "鐥呮埧鍙�") -// private String roomno; + /** + * 鐥呮埧鍙� + */ + @Excel(name = " 鐥呮埧鍙�") + @ApiModelProperty(value = "鐥呮埧鍙�") + private String roomno; } diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskVO.java b/smartor/src/main/java/com/smartor/domain/IvrTaskVO.java index aa62d2e..1a4310a 100644 --- a/smartor/src/main/java/com/smartor/domain/IvrTaskVO.java +++ b/smartor/src/main/java/com/smartor/domain/IvrTaskVO.java @@ -10,6 +10,7 @@ import java.util.Date; import java.util.List; +import java.util.Map; /** * 璇煶浠诲姟瀵硅薄 ivr_task @@ -96,6 +97,14 @@ */ @Excel(name = " ") private Long fail; + + /** + * 浠诲姟褰㈠紡 1,澶氬獟浣� 2,绾歌川 3,鐢佃瘽 4,鐭俊 5.寰俊鍏紬鍙� 6.寰俊灏忕▼搴� 7.鏀粯瀹� 8.鏅鸿兘灏忕▼搴� 9.閽夐拤 + */ + @Excel(name = " 浠诲姟褰㈠紡 1,澶氬獟浣� 2,绾歌川 3,鐢佃瘽 4,鐭俊 5.寰俊鍏紬鍙� 6.寰俊灏忕▼搴� 7.鏀粯瀹� 8.鏅鸿兘灏忕▼搴� 9.閽夐拤 ") + @ApiModelProperty(value = " 浠诲姟褰㈠紡 1,澶氬獟浣� 2,绾歌川 3,鐢佃瘽 4,鐭俊 5.寰俊鍏紬鍙� 6.寰俊灏忕▼搴� 7.鏀粯瀹� 8.鏅鸿兘灏忕▼搴� 9.閽夐拤 ") + private String preachform; + /** * @@ -232,7 +241,47 @@ */ @Excel(name = " 鍙戦�佺姸鎬侊細 1鍒涘缓 2鎵ц涓� 3 鏆傚仠 4缁堟 5瀹屾垚 ") @ApiModelProperty(value = "鍙戦�佺姸鎬侊細 1鍒涘缓 2鎵ц涓� 3 鏆傚仠 4缁堟 5瀹屾垚 ") - private String sendState; + private Integer sendState; + + + /** + * 鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚� + */ + @Excel(name = " 瀹f偅鑰呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚�") + @ApiModelProperty(value = "鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚�") + private List<PatTaskRelevance> patTaskRelevances; + + /** + * 鏄惁瀛樺湪鎿嶄綔锛�1 鏂板 2淇敼 3鍒犻櫎 + */ + @ApiModelProperty(value = "鏄惁瀛樺湪鎿嶄綔锛�1 鏂板 2淇敼 3鍒犻櫎") + private Integer isoperation; + + /** + * 鏂囨湰鍙橀噺鍙傛暟 + */ + @Excel(name = "鏂囨湰鍙橀噺鍙傛暟") + @ApiModelProperty(value = "鏂囨湰鍙橀噺鍙傛暟") + private Map<String, Map<String, String>> textParam; + + + /** + * 鍙戦�佺被鍨�: 1 鏃堕棿娈� 2 鏃堕棿鐐� 3 鍗冲埢鍙戦�� + */ + @ApiModelProperty(value = "鍙戦�佺被鍨�: 1 鏃堕棿娈� 2 鍗冲埢鍙戦��") + private Long sendType; + + @ApiModelProperty(value = "涓婂崍鏃堕棿") + private String showTimeMorn; + + @ApiModelProperty(value = "涓崍鏃堕棿") + private String showTimeNoon; + + @ApiModelProperty(value = "鏅氬崍鏃堕棿") + private String showTimeNight; + + @ApiModelProperty(value = "灞曠ず鏃ユ湡") + private String showDate; } diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java b/smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java index 34ffec6..30e0e8a 100644 --- a/smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java +++ b/smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java @@ -21,7 +21,7 @@ */ @ApiModel(value = "IvrTaskcallMQ", description = "MQ浠诲姟") @Data -public class IvrTaskcallMQ extends BaseEntity { +public class IvrTaskcallMQ { private static final long serialVersionUID = 1L; /** @@ -42,8 +42,8 @@ * 浠诲姟鍙戦�佹柟寮忥細鈥滅數璇濓紝鐭俊锛屽叕浼楀彿锛岄摼鎺�...鈥濅互閫楀彿鍒嗛殧 */ @Excel(name = "浠诲姟鍙戦�佹柟寮忥細鐢佃瘽锛岀煭淇★紝鍏紬鍙凤紝閾炬帴...") - @ApiModelProperty(value = "鍔″彂閫佹柟寮忥細鐢佃瘽锛岀煭淇★紝鍏紬鍙凤紝閾炬帴... 浠ラ�楀彿鍒嗛殧") - private String servicefrom; + @ApiModelProperty(value = "鍔″彂閫佹柟寮忥細鐢佃瘽锛岀煭淇★紝鍏紬鍙�... 浠ラ�楀彿鍒嗛殧") + private String preachform; /** diff --git a/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java b/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java index b2d1cbb..5399440 100644 --- a/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java +++ b/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java @@ -31,6 +31,13 @@ /** * 濮撳悕 */ + @ApiModelProperty("鎮h�卛d闆嗗悎") + @Excel(name = " 鎮h�卛d闆嗗悎锛堝湪閫夋嫨鐥呬汉鏃讹紝杩囨护宸茬粡閫夋嫨鐨刾ids锛� ") + private List<Integer> pids; + + /** + * 濮撳悕 + */ @ApiModelProperty("濮撳悕") @Excel(name = " 濮撳悕 ") private String name; diff --git a/smartor/src/main/java/com/smartor/domain/SendMagParam.java b/smartor/src/main/java/com/smartor/domain/SendMagParam.java index cb7d986..fd6fe37 100644 --- a/smartor/src/main/java/com/smartor/domain/SendMagParam.java +++ b/smartor/src/main/java/com/smartor/domain/SendMagParam.java @@ -15,4 +15,6 @@ //妯℃澘code 渚嬪 锛� SMS_461860582 private String tmpCode; + + private String url; } diff --git a/smartor/src/main/java/com/smartor/domain/SendTaskVO.java b/smartor/src/main/java/com/smartor/domain/SendTaskVO.java index c1f3fc3..56b67a8 100644 --- a/smartor/src/main/java/com/smartor/domain/SendTaskVO.java +++ b/smartor/src/main/java/com/smartor/domain/SendTaskVO.java @@ -24,9 +24,7 @@ */ @Excel(name = " 鍙戦�佺姸鎬侊細 1鍒涘缓 2鎵ц涓� 3 鏆傚仠 4缁堟 5瀹屾垚 ") @ApiModelProperty(value = "鍙戦�佺姸鎬侊細 1鍒涘缓 2鎵ц涓� 3 鏆傚仠 4缁堟 5瀹屾垚 ") - private String sendState; - - + private Integer sendState; } diff --git a/smartor/src/main/java/com/smartor/domain/TestVo.java b/smartor/src/main/java/com/smartor/domain/TestVo.java index 25ef06d..3c739d0 100644 --- a/smartor/src/main/java/com/smartor/domain/TestVo.java +++ b/smartor/src/main/java/com/smartor/domain/TestVo.java @@ -30,5 +30,9 @@ private String type; + private Long stopState; + + private Long servicefrom; + } diff --git a/smartor/src/main/java/com/smartor/mapper/IvrTaskSingleMapper.java b/smartor/src/main/java/com/smartor/mapper/IvrTaskSingleMapper.java index e542fe5..fc13c8b 100644 --- a/smartor/src/main/java/com/smartor/mapper/IvrTaskSingleMapper.java +++ b/smartor/src/main/java/com/smartor/mapper/IvrTaskSingleMapper.java @@ -45,6 +45,8 @@ */ public Boolean updateIvrTaskcall(IvrTaskSingle ivrTaskSingle); + public Boolean updateIvrTaskcallByCondition(IvrTaskSingle ivrTaskSingle); + /** * 鍒犻櫎鍗曚竴浠诲姟锛堥殢璁匡級 * @@ -53,6 +55,8 @@ */ public int deleteIvrTaskcallById(Long id); + public int deleteIvrTaskcallByCondition(@Param("taskid") Long id, @Param("patid") Long patid); + /** * 鍒犻櫎鍗曚竴浠诲姟锛堥殢璁匡級 * diff --git a/smartor/src/main/java/com/smartor/service/IIvrTaskService.java b/smartor/src/main/java/com/smartor/service/IIvrTaskService.java index 5f4a77b..5b5de3d 100644 --- a/smartor/src/main/java/com/smartor/service/IIvrTaskService.java +++ b/smartor/src/main/java/com/smartor/service/IIvrTaskService.java @@ -2,7 +2,10 @@ import java.util.List; +import com.smartor.domain.IvrLibaTemplateScript; +import com.smartor.domain.IvrLibaTemplateScriptVO; import com.smartor.domain.IvrTask; +import org.springframework.web.bind.annotation.PathVariable; /** * 璇煶浠诲姟Service鎺ュ彛 @@ -58,4 +61,6 @@ * @return 缁撴灉 */ public Boolean deleteIvrTaskByTaskid(Long taskid); + + public List<IvrLibaTemplateScriptVO> getScriptInfoByCondition(Long taskid, Long patid); } diff --git a/smartor/src/main/java/com/smartor/service/IIvrTaskSingleService.java b/smartor/src/main/java/com/smartor/service/IIvrTaskSingleService.java index e37c1f0..2614a26 100644 --- a/smartor/src/main/java/com/smartor/service/IIvrTaskSingleService.java +++ b/smartor/src/main/java/com/smartor/service/IIvrTaskSingleService.java @@ -1,8 +1,9 @@ package com.smartor.service; -import com.smartor.domain.*; -import com.smartor.domain.robot.back.RobotAIDialogBack; -import com.smartor.domain.robot.back.RobotCallBack; +import com.smartor.domain.IvrTaskSingle; +import com.smartor.domain.IvrTaskVO; +import com.smartor.domain.PhoneCallBackVO; +import com.smartor.domain.SendTaskVO; import java.util.List; @@ -35,7 +36,7 @@ * @param ivrTaskcall * @return */ - public IvrTaskSingleVO queryTaskByCondition(IvrTaskSingle ivrTaskcall); + public IvrTaskVO queryTaskByCondition(IvrTaskSingle ivrTaskcall); /** * 鏌ヨ鎮h�呴殢璁夸俊鎭� @@ -69,10 +70,10 @@ /** * 鏂板瀹f暀浠诲姟 * - * @param ivrTaskcallVO 鍗曚竴浠诲姟 + * @param ivrTaskVO 鍗曚竴浠诲姟 * @return 缁撴灉 */ - public int insertOrUpdateTask(IvrTaskSingleVO ivrTaskcallVO); + public int insertOrUpdateTask(IvrTaskVO ivrTaskVO); /** * 浠诲姟鍙戦�佹墽琛� diff --git a/smartor/src/main/java/com/smartor/service/WeChatService.java b/smartor/src/main/java/com/smartor/service/WeChatService.java new file mode 100644 index 0000000..612dec7 --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/WeChatService.java @@ -0,0 +1,8 @@ +package com.smartor.service; + +import com.smartor.domain.WeChatSendVo; +import org.springframework.web.bind.annotation.RequestBody; + +public interface WeChatService { + public Boolean sendMessageToFollowers(@RequestBody WeChatSendVo weChatSendVo); +} diff --git a/smartor/src/main/java/com/smartor/service/impl/HeTaskSingleServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/HeTaskSingleServiceImpl.java index 6efe5a2..b50cf76 100644 --- a/smartor/src/main/java/com/smartor/service/impl/HeTaskSingleServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/HeTaskSingleServiceImpl.java @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.fasterxml.jackson.core.type.TypeReference; import java.util.ArrayList; import java.util.List; @@ -168,7 +169,7 @@ try { //鑾峰彇鍒板彂閫佹椂闂寸殑闆嗗悎 if (StringUtils.isNotEmpty(sendTimeSlot)) { - List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot, List.class); + List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot, new TypeReference<List<TaskSendTimeVO>>() {}); heTaskSingleVO.setSendTimeslot(taskSendTimeVOList); } //鏂囨湰鍙橀噺鍙傛暟 diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java index df92b6b..b7c9096 100644 --- a/smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java @@ -1,15 +1,22 @@ package com.smartor.service.impl; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Objects; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.utils.DateUtils; -import com.smartor.domain.IvrTaskSingle; -import com.smartor.mapper.IvrTaskSingleMapper; +import com.ruoyi.common.utils.DtoConversionUtils; +import com.ruoyi.common.utils.StringUtils; +import com.smartor.domain.*; +import com.smartor.mapper.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.smartor.mapper.IvrTaskMapper; -import com.smartor.domain.IvrTask; import com.smartor.service.IIvrTaskService; import org.springframework.transaction.annotation.Transactional; @@ -19,6 +26,7 @@ * @author smartor * @date 2023-03-24 */ +@Slf4j @Service public class IvrTaskServiceImpl implements IIvrTaskService { @Autowired @@ -26,6 +34,15 @@ @Autowired private IvrTaskSingleMapper ivrTaskcallMapper; + + @Autowired + private IvrLibaTemplateScriptMapper ivrLibaTemplateScriptMapper; + + @Autowired + private PatArchiveMapper patArchiveMapper; + + @Autowired + private IvrLibaTemplateTargetoptionMapper ivrLibaTemplateTargetOptionMapper; /** * 鏌ヨ璇煶浠诲姟 @@ -104,4 +121,63 @@ isSuccess = ivrTaskMapper.deleteIvrTaskByTaskid(taskid); return isSuccess; } + + @Override + public List<IvrLibaTemplateScriptVO> getScriptInfoByCondition(Long taskid, Long patid) { + //閫氳繃浠诲姟ID鑾峰彇妯℃澘ID + IvrTask ivrTask = selectIvrTaskByTaskid(taskid); + + //閫氳繃妯℃澘ID鑾峰彇闂淇℃伅 + IvrLibaTemplateScript ivrLibaTemplateScript = new IvrLibaTemplateScript(); + ivrLibaTemplateScript.setTemplateID(ivrTask.getTemplateid()); + ivrLibaTemplateScript.setDelFlag("0"); + List<IvrLibaTemplateScript> ivrLibaTemplateScripts = ivrLibaTemplateScriptMapper.selectIvrLibaTemplateScriptList(ivrLibaTemplateScript); + if (CollectionUtils.isEmpty(ivrLibaTemplateScripts) || ivrLibaTemplateScripts.size() == 0) { + log.info("ivrLibaTemplateScripts涓虹┖浜嗭紝璇峰敖蹇仈绯荤鐞嗗憳澶勭悊"); + return new ArrayList<>(); + } + List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOS = DtoConversionUtils.sourceToTarget(ivrLibaTemplateScripts, IvrLibaTemplateScriptVO.class); + + //鑾峰彇鎮h�呬俊鎭� + PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patid); + + //閫氳繃鎮h�呬俊鎭拰浠诲姟淇℃伅涓殑textParam瀵归棶棰樹腑鐨勫彉閲忚繘琛屽~鍏� + ObjectMapper objectMapper = new ObjectMapper(); + Map<String, Map<String, String>> ivrTaskMap = null; + try { + ivrTaskMap = objectMapper.readValue(ivrTask.getTextParam(), Map.class); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + List<Map<String, String>> mapList = new ArrayList<>(); + + for (Map<String, String> map : ivrTaskMap.values()) { + mapList.add(map); + } + + //灏嗘ā鏉块棶棰樿瘽鏈噷鐨勯�氶厤绗︽浛鎹� + for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVOS) { + if (StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getQuestionText())) { + for (Map<String, String> map : mapList) { + for (String key : map.keySet()) { + + ivrLibaTemplateScriptVO.setQuestionText(ivrLibaTemplateScriptVO.getQuestionText().replace(key, StringUtils.isNotEmpty(map.get(key)) ? map.get(key) : "")); + } + } + //鏇挎崲鎮h�呬釜浜轰俊鎭暟鎹� + ivrLibaTemplateScriptVO.setQuestionText(ivrLibaTemplateScriptVO.getQuestionText().replace("${name}", StringUtils.isNotEmpty(patArchive.getName()) ? patArchive.getName() : "")); + ivrLibaTemplateScriptVO.setQuestionText(ivrLibaTemplateScriptVO.getQuestionText().replace("${dzz}", StringUtils.isNotEmpty(patArchive.getPlaceOfResidence()) ? patArchive.getPlaceOfResidence() : "")); + ivrLibaTemplateScriptVO.setQuestionText(ivrLibaTemplateScriptVO.getQuestionText().replace("${dhh}", StringUtils.isNotEmpty(patArchive.getTelcode()) ? patArchive.getTelcode() : "")); + + //鑾峰彇闂閫夐」 + IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption = new IvrLibaTemplateTargetoption(); + ivrLibaTemplateTargetoption.setScriptid(ivrLibaTemplateScriptVO.getID()); + List<IvrLibaTemplateTargetoption> ivrLibaTemplateTargetoptions = ivrLibaTemplateTargetOptionMapper.selectIvrLibaTemplateTargetoptionList(ivrLibaTemplateTargetoption); + ivrLibaTemplateScriptVO.setIvrLibaScriptTargetoptionList(ivrLibaTemplateTargetoptions); + } + } + + + return ivrLibaTemplateScriptVOS; + } } diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java index 983c0a0..ca7713b 100644 --- a/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java +++ b/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.fasterxml.jackson.core.type.TypeReference; import java.text.SimpleDateFormat; import java.util.*; @@ -85,28 +86,33 @@ } @Override - public IvrTaskSingleVO queryTaskByCondition(IvrTaskSingle ivrTaskcall) { + public IvrTaskVO queryTaskByCondition(IvrTaskSingle ivrTaskcall) { //瀹氫箟鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚� List<PatTaskRelevance> patTaskRelevances = new ArrayList<>(); List<IvrTaskSingle> list = selectIvrTaskcallList(ivrTaskcall); - if (CollectionUtils.isEmpty(list)) { - new BaseException("璇ヤ换鍔′笉瀛樺湪"); + if (CollectionUtils.isEmpty(list) || list.size() == 0) { + return new IvrTaskVO(); } IvrTask ivrTask = ivrTaskService.selectIvrTaskByTaskid(ivrTaskcall.getTaskid()); //灏嗘煡鍑烘潵鐨勬暟鎹�掑叆ivrTasksingleVO涓� - IvrTaskSingleVO ivrTasksingleVO2 = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskSingleVO.class); + IvrTaskVO ivrTaskVO = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskVO.class); + ivrTaskVO.setShowDate(ivrTask.getShowDate()); + ivrTaskVO.setShowTimeMorn(ivrTask.getShowTimeMorn()); + ivrTaskVO.setShowTimeNoon(ivrTask.getShowTimeNoon()); + ivrTaskVO.setShowTimeNight(ivrTask.getShowTimeNight()); String sendTimeSlot = ivrTask.getSendTimeSlot(); ObjectMapper objectMapper = new ObjectMapper(); try { //鑾峰彇鍒板彂閫佹椂闂寸殑闆嗗悎 if (com.ruoyi.common.utils.StringUtils.isNotEmpty(sendTimeSlot)) { List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot, List.class); - ivrTasksingleVO2.setSendTimeslot(taskSendTimeVOList); + ivrTaskVO.setSendTimeslot(taskSendTimeVOList); + ivrTaskVO.setSendType(ivrTask.getSendType()); } //鏂囨湰鍙橀噺鍙傛暟 - if (com.ruoyi.common.utils.StringUtils.isNotEmpty(list.get(0).getTextParam())) { - Map<String, Map<String, String>> textParam = objectMapper.readValue(list.get(0).getTextParam(), Map.class); - ivrTasksingleVO2.setTextParam(textParam); + if (com.ruoyi.common.utils.StringUtils.isNotEmpty(ivrTask.getTextParam())) { + Map<String, Map<String, String>> textParam = objectMapper.readValue(ivrTask.getTextParam(), Map.class); + ivrTaskVO.setTextParam(textParam); } } catch (JsonProcessingException e) { e.printStackTrace(); @@ -123,6 +129,7 @@ patTaskRelevance.setPhone(ivrTaskcall1.getPhone()); patTaskRelevance.setAddr(ivrTaskcall1.getAddr()); patTaskRelevance.setDiagname(ivrTaskcall1.getDiagname()); + patTaskRelevance.setPatid(ivrTaskcall1.getPatid()); patTaskRelevances.add(patTaskRelevance); } if (ivrTaskcall1.getHospType().equals("2")) { @@ -135,12 +142,13 @@ patTaskRelevance.setDeptName(ivrTaskcall1.getDeptname()); patTaskRelevance.setBedNo(ivrTaskcall1.getBedNo()); patTaskRelevance.setDiagname(ivrTaskcall1.getDiagname()); + patTaskRelevance.setPatid(ivrTaskcall1.getPatid()); patTaskRelevances.add(patTaskRelevance); } } - ivrTasksingleVO2.setPatTaskRelevances(patTaskRelevances); - return ivrTasksingleVO2; + ivrTaskVO.setPatTaskRelevances(patTaskRelevances); + return ivrTaskVO; } @Override @@ -195,68 +203,78 @@ */ @Transactional(rollbackFor = Exception.class) @Override - public int insertOrUpdateTask(IvrTaskSingleVO ivrTasksingleVO) { - if (ObjectUtils.isEmpty(ivrTasksingleVO)) { + public int insertOrUpdateTask(IvrTaskVO ivrTaskVO) { + if (ObjectUtils.isEmpty(ivrTaskVO)) { log.info("浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�"); throw new BaseException("浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�"); } - Integer integer = 0; - if (ivrTasksingleVO.getIsoperation() != null && ivrTasksingleVO.getIsoperation() == 1) { + Integer integer = 1; + IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTaskVO, IvrTask.class); + ivrTask.setTextParam(JSON.toJSONString(ivrTaskVO.getTextParam())); + if (ivrTaskVO.getIsoperation() != null && ivrTaskVO.getIsoperation() == 1) { //寰�浠诲姟琛ㄤ腑锛屾柊澧炰换鍔� - IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTasksingleVO, IvrTask.class); - if (ObjectUtils.isNotEmpty(ivrTasksingleVO.getSendTimeslot())) - ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTasksingleVO.getSendTimeslot())); + if (ObjectUtils.isNotEmpty(ivrTaskVO.getSendTimeslot())) + ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTaskVO.getSendTimeslot())); + if (ivrTask.getSendState() == null) ivrTask.setSendState(1); + ivrTask.setTemplateid(ivrTaskVO.getLibtemplateid()); ivrTaskService.insertIvrTask(ivrTask); - ivrTasksingleVO.setTaskid(ivrTask.getTaskid().longValue()); + + //灏嗕换鍔′俊鎭斁鍒版湇鍔¤〃涓� + IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskVO, IvrTaskSingle.class); + ivrTaskcall.setTaskid(ivrTask.getTaskid().longValue()); //鏂板 - if (CollectionUtils.isNotEmpty(ivrTasksingleVO.getPatTaskRelevances())) { - for (PatTaskRelevance patTaskRelevance : ivrTasksingleVO.getPatTaskRelevances()) { + if (CollectionUtils.isNotEmpty(ivrTaskVO.getPatTaskRelevances())) { + for (PatTaskRelevance patTaskRelevance : ivrTaskVO.getPatTaskRelevances()) { //灏嗕换鍔′俊鎭柊澧炲埌闅忚鏈嶅姟琛ㄤ腑 - IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTasksingleVO, IvrTaskSingle.class); ivrTaskcall.setSendname(patTaskRelevance.getName()); ivrTaskcall.setAge(patTaskRelevance.getAge()); ivrTaskcall.setSfzh(patTaskRelevance.getSfzh()); ivrTaskcall.setPhone(patTaskRelevance.getPhone()); ivrTaskcall.setAddr(patTaskRelevance.getAddr()); + ivrTaskcall.setPatid(patTaskRelevance.getPatid()); ivrTaskcall.setCreateTime(DateUtils.getNowDate()); - ivrTaskcall.setTextParam(new Gson().toJson(patTaskRelevance.getTextParam())); + ivrTaskcall.setCreateTime(DateUtils.getNowDate()); + ivrTaskcall.setType(ivrTaskVO.getHospType()); ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall); integer = ivrTaskcall.getId().intValue(); } } - } else if (ivrTasksingleVO.getIsoperation() != null && ivrTasksingleVO.getIsoperation() == 2) { + } else if (ivrTaskVO.getIsoperation() != null && ivrTaskVO.getIsoperation() == 2) { //浠诲姟淇敼 - IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTasksingleVO, IvrTask.class); - if (ObjectUtils.isNotEmpty(ivrTasksingleVO.getSendTimeslot())) - ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTasksingleVO.getSendTimeslot())); - //鑾峰彇琛ㄩ噷鐨剆topState鏁板�� + 1 + if (ObjectUtils.isNotEmpty(ivrTaskVO.getSendTimeslot())) + ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTaskVO.getSendTimeslot())); IvrTask ivrTask1 = ivrTaskService.selectIvrTaskByTaskid(ivrTask.getTaskid()); - ivrTask.setStopState(ivrTask1.getStopState() + 1); + ivrTask.setTemplateid(ivrTaskVO.getLibtemplateid()); ivrTaskService.updateIvrTask(ivrTask); - if (CollectionUtils.isNotEmpty(ivrTasksingleVO.getPatTaskRelevances())) { - for (PatTaskRelevance patTaskRelevance : ivrTasksingleVO.getPatTaskRelevances()) { + if (CollectionUtils.isNotEmpty(ivrTaskVO.getPatTaskRelevances())) { + for (PatTaskRelevance patTaskRelevance : ivrTaskVO.getPatTaskRelevances()) { - IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTasksingleVO, IvrTaskSingle.class); + IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskVO, IvrTaskSingle.class); ivrTaskcall.setSendname(patTaskRelevance.getName()); ivrTaskcall.setAge(patTaskRelevance.getAge()); ivrTaskcall.setSfzh(patTaskRelevance.getSfzh()); ivrTaskcall.setPhone(patTaskRelevance.getPhone()); ivrTaskcall.setAddr(patTaskRelevance.getAddr()); + ivrTaskcall.setPatid(patTaskRelevance.getPatid()); + ivrTaskcall.setType(ivrTaskVO.getHospType()); ivrTaskcall.setCreateTime(DateUtils.getNowDate()); - ivrTaskcall.setTextParam(new Gson().toJson(ivrTasksingleVO.getTextParam())); - if (patTaskRelevance.getIsoperation() == 2) ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall); - if (patTaskRelevance.getIsoperation() == 1) ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall); - integer = ivrTaskcall.getId().intValue(); + ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskVO.getTextParam())); + if (patTaskRelevance.getIsoperation() != null) { + if (patTaskRelevance.getIsoperation() == 2) + ivrTaskSingleMapper.updateIvrTaskcallByCondition(ivrTaskcall); + if (patTaskRelevance.getIsoperation() == 1) ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall); + if (patTaskRelevance.getIsoperation() == 3) + // 閫氳繃taskid鍜宲atid鍘诲垹闄よ鏉℃暟鎹� + ivrTaskSingleMapper.deleteIvrTaskcallByCondition(ivrTaskVO.getTaskid(), patTaskRelevance.getPatid()); + } + integer = ivrTaskcall.getTaskid().intValue(); } } - - } else if (ivrTasksingleVO.getIsoperation() != null && ivrTasksingleVO.getIsoperation() == 3) { - ivrTaskSingleMapper.deleteIvrTaskcallById(ivrTasksingleVO.getId()); - - integer = ivrTasksingleVO.getId().intValue(); } + + return integer; } @@ -269,7 +287,7 @@ public int heTaskSend(SendTaskVO sendTaskVO) { if (sendTaskVO.getTaskId() == null) throw new BaseException("浠诲姟ID涓嶈兘涓虹┖锛岃妫�鏌ュ悗锛屽啀杩涜鎵ц"); IvrTask ivrTask = ivrTaskService.selectIvrTaskByTaskid(sendTaskVO.getTaskId()); - if (StringUtils.isNotEmpty(sendTaskVO.getSendState()) && sendTaskVO.getSendState().equals("3") || StringUtils.isNotEmpty(sendTaskVO.getSendState()) && sendTaskVO.getSendState().equals("4")) { + if (sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 3 || sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 4) { //浠诲姟鏆傚仠鎴栫粓姝� IvrTask ivrTask3 = new IvrTask(); ivrTask3.setTaskid(sendTaskVO.getTaskId()); @@ -283,14 +301,15 @@ if (StringUtils.isEmpty(sendTaskVO.getSendType())) { sendTaskVO.setSendType(ivrTask.getSendType().toString()); } - + Long ss = ivrTask.getStopState() + 1; //鍒ゆ柇浠诲姟鏄惁鏄珛鍗冲彂閫� if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("2")) { IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ(); ivrTaskcallMQ.setTaskid(sendTaskVO.getTaskId()); ivrTaskcallMQ.setSendType(sendTaskVO.getSendType()); ivrTaskcallMQ.setTemplateid(ivrTask.getTemplateid().toString()); - ivrTaskcallMQ.setStopState(ivrTask.getStopState()); + ivrTaskcallMQ.setStopState(ss); + ivrTaskcallMQ.setPreachform(ivrTask.getPreachform()); String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ); ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1); @@ -300,8 +319,8 @@ //灏嗕换鍔$姸鎬佷慨鏀规垚鎵ц涓� IvrTask ivrTask2 = new IvrTask(); ivrTask2.setTaskid(ivrTask.getTaskid()); - ivrTask2.setSendState("2"); - ivrTask2.setStopState(ivrTask.getStopState() + 1); + ivrTask2.setSendState(2); + ivrTask2.setStopState(ss); ivrTaskService.updateIvrTask(ivrTask2); } else if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("1")) { //鏃堕棿娈靛彂閫� @@ -309,7 +328,8 @@ if (StringUtils.isNotEmpty(ivrTask.getSendTimeSlot())) { List<TaskSendTimeVO> taskSendTimeVOList = null; try { - taskSendTimeVOList = objectMapper.readValue(ivrTask.getSendTimeSlot(), List.class); + taskSendTimeVOList = objectMapper.readValue(ivrTask.getSendTimeSlot(), new TypeReference<List<TaskSendTimeVO>>() { + }); } catch (JsonProcessingException e) { log.error("JsonProcessingException鎶ラ敊浜嗭細{}", e.getMessage()); } @@ -340,17 +360,17 @@ Long finalMilliseconds = milliseconds; String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ); ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1); - rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, 0L); + rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, milliseconds); } //灏嗕换鍔$姸鎬佷慨鏀规垚鎵ц涓� IvrTask ivrTask2 = new IvrTask(); ivrTask2.setTaskid(ivrTask.getTaskid()); - ivrTask2.setSendState("2"); - ivrTask2.setStopState(ivrTask.getStopState() + 1); + ivrTask2.setSendState(2); + ivrTask2.setStopState(ss); ivrTaskService.updateIvrTask(ivrTask2); } } - return 0; + return 1; } @Override diff --git a/smartor/src/main/java/com/smartor/service/impl/WeChatServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/WeChatServiceImpl.java new file mode 100644 index 0000000..e1ba366 --- /dev/null +++ b/smartor/src/main/java/com/smartor/service/impl/WeChatServiceImpl.java @@ -0,0 +1,48 @@ +package com.smartor.service.impl; + +import com.smartor.domain.WeChatSendVo; +import com.smartor.service.WeChatService; +import me.chanjar.weixin.common.exception.WxErrorException; +import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; +import me.chanjar.weixin.mp.bean.template.WxMpTemplateData; +import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class WeChatServiceImpl implements WeChatService { + @Value("${appid}") + private String appid; + + @Value("${appSecret}") + private String appSecret; + + @Override + public Boolean sendMessageToFollowers(WeChatSendVo weChatSendVo) { + WxMpService wxMpService; + wxMpService = new WxMpServiceImpl(); + wxMpService.setWxMpConfigStorage(new WxMpInMemoryConfigStorage()); + WxMpInMemoryConfigStorage wxMpConfigStorage = (WxMpInMemoryConfigStorage) wxMpService.getWxMpConfigStorage(); + wxMpConfigStorage.setAppId(appid); + wxMpConfigStorage.setSecret(appSecret); + try { + List<String> openIdList = wxMpService.getUserService().userList(null).getOpenids(); + for (String openId : openIdList) { + WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder().toUser(openId).templateId(weChatSendVo.getTemplateId()).url(weChatSendVo.getUrl()).build(); + for (String key : weChatSendVo.getContent().keySet()) { + templateMessage.addData(new WxMpTemplateData(key, weChatSendVo.getContent().get(key).toString())); + } + wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage); + } + } catch (WxErrorException e) { + e.printStackTrace(); + } + return true; + + } +} diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml index 43608c9..498847c 100644 --- a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml +++ b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml @@ -228,7 +228,7 @@ <if test="mateNum != null ">mate_num = #{mateNum},</if> <if test="revisitAfter != null ">revisit_after = #{revisitAfter},</if> <if test="revisitBefore != null ">revisit_before = #{revisitBefore},</if> - <if test="noVoiceNum != null and noVoiceNum > 0 ">no_voice_num = #{noVoiceNum}</if> + <if test="noVoiceNum != null and noVoiceNum > 0 ">no_voice_num = #{noVoiceNum},</if> <if test="silencetime != null">silencetime = #{silencetime}</if> </trim> where ID = #{ID} diff --git a/smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml index 1dde1df..be61105 100644 --- a/smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml +++ b/smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml @@ -41,14 +41,24 @@ <result property="libtemplatename" column="libtemplatename"/> <result property="libtemplatename" column="libtemplatename"/> <result property="stopState" column="stop_state"/> + <result property="showDate" column="show_date"/> + <result property="showTimeMorn" column="show_time_morn"/> + <result property="showTimeNoon" column="show_time_noon"/> + <result property="showTimeNight" column="show_time_night"/> + <result property="textParam" column="text_param"/> </resultMap> <sql id="selectIvrTaskVo"> select taskid, task_name, + show_date, + show_time_morn, + show_time_noon, + show_time_night, libtemplateid, libtemplatename, stop_state, + text_param, templateid, templatename, labelinfo, @@ -85,7 +95,7 @@ <include refid="selectIvrTaskVo"/> <where> <if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if> - <if test="sendTimeSlot != null and sendTimeSlot != ''">and sendTimeSlot like concat('%', #{sendTimeSlot}, + <if test="sendTimeSlot != null and sendTimeSlot != ''">and send_time_slot like concat('%', #{sendTimeSlot}, '%') </if> <if test="templateid != null and templateid != ''">and templateid = #{templateid}</if> @@ -111,7 +121,6 @@ <if test="hospType != null and hospType != ''">and hosp_type = #{hospType}</if> <if test="libtemplateid != null ">and libtemplateid = #{libtemplateid}</if> <if test="libtemplatename != null and libtemplatename != ''">and libtemplatename = #{libtemplatename}</if> - <if test="stopState != null ">and stop_state = #{stopState}</if> </where> order by update_time desc,taskid desc </select> @@ -157,8 +166,13 @@ <if test="taskDesc != null and taskDesc != ''">task_desc,</if> <if test="libtemplateid != null ">libtemplateid,</if> <if test="libtemplatename != null and libtemplatename != ''">libtemplatename,</if> - <if test="sendTimeSlot != null and sendTimeSlot != ''">sendTimeSlot,</if> + <if test="sendTimeSlot != null and sendTimeSlot != ''">send_time_slot,</if> <if test="stopState != null">stop_state,</if> + <if test="showDate != null and showDate != ''">show_date,</if> + <if test="showTimeNight != null and showTimeNight != ''">show_time_night,</if> + <if test="showTimeNoon != null and showTimeNoon != ''">show_time_noon,</if> + <if test="showTimeMorn != null and showTimeMorn != ''">show_time_morn,</if> + <if test="textParam != null and textParam != ''">text_param,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="taskName != null">#{taskName},</if> @@ -194,6 +208,11 @@ <if test="libtemplatename != null and libtemplatename != ''">#{libtemplatename},</if> <if test="sendTimeSlot != null and sendTimeSlot != ''">#{sendTimeSlot},</if> <if test="stopState != null">#{stopState},</if> + <if test="showDate != null and showDate != ''">#{showDate},</if> + <if test="showTimeNight != null and showTimeNight != ''">#{showTimeNight},</if> + <if test="showTimeNoon != null and showTimeNoon != ''">#{showTimeNoon},</if> + <if test="showTimeMorn != null and showTimeMorn != ''">#{showTimeMorn},</if> + <if test="textParam != null and textParam != ''">#{textParam},</if> </trim> </insert> @@ -233,6 +252,11 @@ <if test="libtemplatename != null and libtemplatename != ''">libtemplatename = #{libtemplatename},</if> <if test="sendTimeSlot != null and sendTimeSlot != ''">send_time_slot=#{sendTimeSlot},</if> <if test="stopState != null ">stop_state=#{stopState},</if> + <if test="showDate != null and showDate != ''">show_date=#{showDate},</if> + <if test="showTimeNight != null and showTimeNight != ''">show_time_night=#{showTimeNight},</if> + <if test="showTimeNoon != null and showTimeNoon != ''">show_time_noon=#{showTimeNoon},</if> + <if test="showTimeMorn != null and showTimeMorn != ''">show_time_morn=#{showTimeMorn},</if> + <if test="textParam != null and textParam != ''">text_param=#{textParam},</if> </trim> where taskid = #{taskid} </update> diff --git a/smartor/src/main/resources/mapper/smartor/IvrTaskSingleMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrTaskSingleMapper.xml index 73272b7..69ddcbb 100644 --- a/smartor/src/main/resources/mapper/smartor/IvrTaskSingleMapper.xml +++ b/smartor/src/main/resources/mapper/smartor/IvrTaskSingleMapper.xml @@ -18,12 +18,6 @@ <result property="templateid" column="templateid"/> <result property="templatename" column="templatename"/> <result property="senddate" column="senddate"/> - <result property="sendlimitabegin" column="sendlimitabegin"/> - <result property="sendlimitaend" column="sendlimitaend"/> - <result property="sendlimitpbegin" column="sendlimitpbegin"/> - <result property="sendlimitpend" column="sendlimitpend"/> - <result property="sendlimitnbegin" column="sendlimitnbegin"/> - <result property="sendlimitnend" column="sendlimitnend"/> <result property="senduuid" column="senduuid"/> <result property="result" column="result"/> <result property="finishtime" column="finishtime"/> @@ -57,6 +51,7 @@ <result property="deptname" column="deptname"/> <result property="admindate" column="admindate"/> <result property="roomno" column="roomno"/> + <result property="patid" column="patid"/> <result property="libtemplatename" column="libtemplatename"/> <result property="libtemplateid" column="libtemplateid"/> </resultMap> @@ -70,6 +65,7 @@ phone, sex, age, + patid, sfzh, addr, senderdetail, @@ -78,12 +74,6 @@ templateid, templatename, senddate, - sendlimitabegin, - sendlimitaend, - sendlimitpbegin, - sendlimitpend, - sendlimitnbegin, - sendlimitnend, senduuid, result, finishtime, @@ -115,6 +105,7 @@ roomno, admindate, deptname, + stop_state, diagname from ivr_task_single </sql> @@ -127,6 +118,7 @@ <if test="phone != null and phone != ''">and phone = #{phone}</if> <if test="sex != null and sex != ''">and sex = #{sex}</if> <if test="age != null ">and age = #{age}</if> + <if test="patid != null ">and patid = #{patid}</if> <if test="sfzh != null and sfzh != ''">and sfzh = #{sfzh}</if> <if test="addr != null and addr != ''">and addr = #{addr}</if> <if test="senderdetail != null and senderdetail != ''">and senderdetail = #{senderdetail}</if> @@ -137,12 +129,6 @@ '%') </if> <if test="senddate != null ">and senddate = #{senddate}</if> - <if test="sendlimitabegin != null and sendlimitabegin != ''">and sendlimitabegin = #{sendlimitabegin}</if> - <if test="sendlimitaend != null and sendlimitaend != ''">and sendlimitaend = #{sendlimitaend}</if> - <if test="sendlimitpbegin != null and sendlimitpbegin != ''">and sendlimitpbegin = #{sendlimitpbegin}</if> - <if test="sendlimitpend != null and sendlimitpend != ''">and sendlimitpend = #{sendlimitpend}</if> - <if test="sendlimitnbegin != null and sendlimitnbegin != ''">and sendlimitnbegin = #{sendlimitnbegin}</if> - <if test="sendlimitnend != null and sendlimitnend != ''">and sendlimitnend = #{sendlimitnend}</if> <if test="senduuid != null and senduuid != ''">and senduuid = #{senduuid}</if> <if test="result != null and result != ''">and result = #{result}</if> <if test="finishtime != null ">and finishtime = #{finishtime}</if> @@ -191,12 +177,6 @@ <if test="templateid != null">templateid,</if> <if test="templatename != null">templatename,</if> <if test="senddate != null">senddate,</if> - <if test="sendlimitabegin != null">sendlimitabegin,</if> - <if test="sendlimitaend != null">sendlimitaend,</if> - <if test="sendlimitpbegin != null">sendlimitpbegin,</if> - <if test="sendlimitpend != null">sendlimitpend,</if> - <if test="sendlimitnbegin != null">sendlimitnbegin,</if> - <if test="sendlimitnend != null">sendlimitnend,</if> <if test="senduuid != null">senduuid,</if> <if test="result != null">result,</if> <if test="finishtime != null">finishtime,</if> @@ -232,6 +212,7 @@ <if test="diagname != null and diagname != ''">diagname,</if> <if test="libtemplateid != null ">libtemplateid,</if> <if test="libtemplatename != null ">libtemplatename,</if> + <if test="patid != null ">patid,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="sendname != null">#{sendname},</if> @@ -246,12 +227,6 @@ <if test="templateid != null">#{templateid},</if> <if test="templatename != null">#{templatename},</if> <if test="senddate != null">#{senddate},</if> - <if test="sendlimitabegin != null">#{sendlimitabegin},</if> - <if test="sendlimitaend != null">#{sendlimitaend},</if> - <if test="sendlimitpbegin != null">#{sendlimitpbegin},</if> - <if test="sendlimitpend != null">#{sendlimitpend},</if> - <if test="sendlimitnbegin != null">#{sendlimitnbegin},</if> - <if test="sendlimitnend != null">#{sendlimitnend},</if> <if test="senduuid != null">#{senduuid},</if> <if test="result != null">#{result},</if> <if test="finishtime != null">#{finishtime},</if> @@ -287,7 +262,7 @@ <if test="diagname != null and diagname != ''">#{diagname},</if> <if test="libtemplateid != null ">#{libtemplateid},</if> <if test="libtemplatename != null ">#{libtemplatename},</if> - <if test="stopState != null ">#{stopState},</if> + <if test="patid != null ">#{patid},</if> </trim> </insert> @@ -306,12 +281,6 @@ <if test="templateid != null">templateid = #{templateid},</if> <if test="templatename != null">templatename = #{templatename},</if> <if test="senddate != null">senddate = #{senddate},</if> - <if test="sendlimitabegin != null">sendlimitabegin = #{sendlimitabegin},</if> - <if test="sendlimitaend != null">sendlimitaend = #{sendlimitaend},</if> - <if test="sendlimitpbegin != null">sendlimitpbegin = #{sendlimitpbegin},</if> - <if test="sendlimitpend != null">sendlimitpend = #{sendlimitpend},</if> - <if test="sendlimitnbegin != null">sendlimitnbegin = #{sendlimitnbegin},</if> - <if test="sendlimitnend != null">sendlimitnend = #{sendlimitnend},</if> <if test="senduuid != null">senduuid = #{senduuid},</if> <if test="result != null">result = #{result},</if> <if test="finishtime != null">finishtime = #{finishtime},</if> @@ -347,8 +316,64 @@ <if test="diagname != null and diagname != ''">diagname = #{diagname},</if> <if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if> <if test="libtemplatename != null ">libtemplatename = #{libtemplatename},</if> + <if test="patid != null ">patid = #{patid},</if> </trim> where id = #{id} + </update> + + <update id="updateIvrTaskcallByCondition" parameterType="com.smartor.domain.IvrTaskSingle"> + update ivr_task_single + <trim prefix="SET" suffixOverrides=","> + <if test="sendname != null">sendname = #{sendname},</if> + <if test="phone != null">phone = #{phone},</if> + <if test="sex != null">sex = #{sex},</if> + <if test="age != null">age = #{age},</if> + <if test="sfzh != null">sfzh = #{sfzh},</if> + <if test="addr != null">addr = #{addr},</if> + <if test="senderdetail != null">senderdetail = #{senderdetail},</if> + <if test="type != null">type = #{type},</if> + <if test="taskid != null">taskid = #{taskid},</if> + <if test="templateid != null">templateid = #{templateid},</if> + <if test="templatename != null">templatename = #{templatename},</if> + <if test="senddate != null">senddate = #{senddate},</if> + <if test="senduuid != null">senduuid = #{senduuid},</if> + <if test="result != null">result = #{result},</if> + <if test="finishtime != null">finishtime = #{finishtime},</if> + <if test="recordid != null">recordid = #{recordid},</if> + <if test="exrecallcount != null">exrecallcount = #{exrecallcount},</if> + <if test="pulltime != null">pulltime = #{pulltime},</if> + <if test="deptcode != null">deptcode = #{deptcode},</if> + <if test="labelstatus != null">labelstatus = #{labelstatus},</if> + <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> + <if test="updateBy != null">update_by = #{updateBy},</if> + <if test="updateTime != null">update_time = #{updateTime},</if> + <if test="createBy != null">create_by = #{createBy},</if> + <if test="createTime != null">create_time = #{createTime},</if> + <if test="isupload != null">isupload = #{isupload},</if> + <if test="uploadTime != null">upload_time = #{uploadTime},</if> + <if test="orgid != null">orgid = #{orgid},</if> + <if test="pid != null">pid = #{pid},</if> + <if test="guid != null">guid = #{guid},</if> + <if test="textParam != null">text_param = #{textParam},</if> + <if test="serviceform != null">serviceform = #{serviceform},</if> + <if test="bedNo != null">bed_no = #{bedNo},</if> + <if test="sendType != null and sendType != ''">send_type = #{sendType},</if> + <if test="taskName != null and taskName != ''">task_name = #{taskName},</if> + <if test="taskDesc != null and taskDesc != ''">task_desc = #{taskDesc},</if> + <if test="operatorNo != null and operatorNo != ''">operator_no = #{operatorNo},</if> + <if test="operator != null and operator != ''">operator = #{operator},</if> + <if test="hospType != null and hospType != ''">hosp_type = #{hospType},</if> + <if test="hospno != null and hospno != ''">hospno = #{hospno},</if> + <if test="wechat != null and wechat != ''">wechat = #{wechat},</if> + <if test="roomno != null and roomno != ''">roomno = #{roomno},</if> + <if test="admindate != null and admindate != ''">admindate = #{admindate},</if> + <if test="deptname != null and deptname != ''">deptname = #{deptname},</if> + <if test="diagname != null and diagname != ''">diagname = #{diagname},</if> + <if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if> + <if test="libtemplatename != null ">libtemplatename = #{libtemplatename},</if> + <if test="patid != null ">patid = #{patid},</if> + </trim> + where patid = #{patid} and taskid = #{taskid} </update> <update id="deleteIvrTaskcallById" parameterType="Long"> @@ -357,6 +382,14 @@ del_flag =1 </trim> where id = #{id} + </update> + + <update id="deleteIvrTaskcallByCondition" > + update ivr_task_single + <trim prefix="SET" suffixOverrides=","> + del_flag =1 + </trim> + where patid = #{patid} and taskid = #{taskid} </update> <select id="getDataByTime" resultMap="IvrTaskcallResult"> @@ -374,12 +407,6 @@ templateid, templatename, senddate, - sendlimitabegin, - sendlimitaend, - sendlimitpbegin, - sendlimitpend, - sendlimitnbegin, - sendlimitnend, senduuid, result, finishtime, @@ -411,6 +438,7 @@ wechat, roomno, admindate, + patid, deptname, diagname FROM ivr_task_single, diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml index de5e23a..451a7e6 100644 --- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml +++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml @@ -341,7 +341,12 @@ <if test="deptname != null and deptname != ''"> AND d.deptname LIKE concat('%',#{deptname}, '%') </if> - + <if test="pids != null"> + AND a.patid NOT IN + <foreach collection="pids" item="pid" open="(" separator="," close=")"> + #{pid} + </foreach> + </if> AND d.del_flag != 1 AND a.del_flag != 1 </where> @@ -351,8 +356,6 @@ resultMap="PatArchiveResult"> select - -- c.tagname as tag, - -- b.tagid as tagid, a.patid, d.deptname, a.name, @@ -381,7 +384,6 @@ a.isupload, a.upload_time, a.pattype - -- from pat_archive a,pat_archivetag b ,base_tag c, pat_med_outhosp d from pat_archive a, pat_med_outhosp d <where> a.patid = d.patid @@ -389,11 +391,6 @@ <if test="name != null and name != ''">and a.name like concat('%', #{name}, '%')</if> <if test="idcardno != null and idcardno != ''">and a.idcardno = #{idcardno}</if> <if test="telcode != null and telcode != ''">and a.telcode = #{telcode}</if> - <!-- <if test="tagIds != null and tagIds != ''">and c.tagid in--> - <!-- <foreach collection="tagIds" item="tagId" open="(" separator="," close=")">--> - <!-- #{tagId}--> - <!-- </foreach>--> - <!-- </if>--> <if test="hospitaldistrictname != null and hospitaldistrictname != ''"> AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%') </if> @@ -412,10 +409,13 @@ <if test="drname != null and drname != ''"> AND d.drname LIKE concat('%',#{drname}, '%') </if> - + <if test="pids != null"> + AND a.patid NOT IN + <foreach collection="pids" item="pid" open="(" separator="," close=")"> + #{pid} + </foreach> + </if> AND d.del_flag != 1 - -- AND b.del_flag != 1 - -- AND c.del_flag != 1 AND a.del_flag != 1 </where> </select> @@ -424,8 +424,6 @@ resultMap="PatArchiveResult"> select - -- c.tagname as tag, - -- b.tagid as tagid, a.patid as id, a.name, a.sex, @@ -454,7 +452,6 @@ a.isupload, a.upload_time, a.pattype - -- from pat_archive a,pat_archivetag b ,base_tag c, pat_med_physical d from pat_archive a, pat_med_physical d <where> a.patid = d.patid @@ -462,11 +459,6 @@ <if test="name != null and name != ''">and a.name like concat('%', #{name}, '%')</if> <if test="idcardno != null and idcardno != ''">and a.idcardno = #{idcardno}</if> <if test="telcode != null and telcode != ''">and a.telcode = #{telcode}</if> -<!-- <if test="tagIds != null and tagIds != ''">and c.tagid in--> -<!-- <foreach collection="tagIds" item="tagId" open="(" separator="," close=")">--> -<!-- #{tagId}--> -<!-- </foreach>--> -<!-- </if>--> <if test="hospitaldistrictname != null and hospitaldistrictname != ''"> AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%') </if> @@ -486,10 +478,13 @@ <if test="drname != null and drname != ''"> AND d.drname LIKE concat('%',#{drname}, '%') </if> - + <if test="pids != null"> + AND a.patid NOT IN + <foreach collection="pids" item="pid" open="(" separator="," close=")"> + #{pid} + </foreach> + </if> AND d.del_flag != 1 --- AND b.del_flag != 1 --- AND c.del_flag != 1 AND a.del_flag != 1 </where> -- Gitblit v1.9.3