| | |
| | | <artifactId>nls-sdk-common</artifactId> |
| | | <version>2.1.6</version> |
| | | </dependency> |
| | | |
| | | <!-- rabbitmq ä¾èµ--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-amqp</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | " | | \\ `' /| `-' / \n" + |
| | | " | | \\ / \\ / \n" + |
| | | " ''-' `'-' `-..-' "); |
| | | //å¼å¯SOCKET |
| | | new SocketCommunication().socketCommunication(); |
| | | // //å¼å¯SOCKET |
| | | // new SocketCommunication().socketCommunication(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @startuml |
| | | start |
| | | :å
¥åï¼userid,socketMessage; |
| | | note right |
| | | //åéå
空çç±»åï¼text,imageï¼ |
| | | private String type; |
| | | //å
容ï¼è¿ä¸ªæ¯å¨å¼åæµè¯çæ¶åç¨ï¼ |
| | | private String content; |
| | | //模æ¿ID |
| | | private Long templateId; |
| | | //é®é¢ä¿¡æ¯ |
| | | private QuestionMessage questionMessage; |
| | | //ç¨æ·IDï¼æ¥æ¶æ¾ï¼ |
| | | private String userId; |
| | | //å¾ç |
| | | private String image; |
| | | //å¾çï¼é³ãè§é¢çåèå¤§å° |
| | | private Integer fileSize; |
| | | end note |
| | | if (å¦ææ¨¡æ¿idä¸ä¸ºç©ºï¼socketMessage.getTemplateId() != null) then(ä¸ä¸ºç©º) |
| | | partition "éè¿æ¨¡æ¿IDè·å模æ¿é®é¢" { |
| | | :éè¿æ¨¡æ¿IDè·å模æ¿ä¿¡æ¯ï¼å¹¶å°ä¿¡æ¯æ¾å°redisä¸ï¼ |
| | | key为userId + "ivrLibaTemplateVO1"ï¼è¿ææ¶é´2å°æ¶; |
| | | note left |
| | | ç´æ¥è°ç¨ivrLibaTemplateService.selectInfoByCondition |
| | | è·åå°â模æ¿ä¿¡æ¯âãâé®é¢è¯æ¯âãâè¯æ¯é项â |
| | | end note |
| | | :ä»è¿åçæ¨¡æ¿ä¿¡æ¯ä¸è·åé®é¢è¯æ¯éå |
| | | å¹¶å°éåæ¾å°redisä¸ï¼key为userId + "ivrLibaTemplateScriptVOList"; |
| | | note left |
| | | List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList |
| | | æ ¹æ®IvrLibaTemplateScriptVOä¸çTargetidï¼ææ¶å½ä¸ä¸ªé®é¢çåºå·ï¼ |
| | | æåºä¸ä¸ |
| | | end note |
| | | :å®ä¹ä¸äºredis,è¿é乿以大éç¨redis,æ¯ç¨æ¥è¿è¡å¤è¿ç¨é离; |
| | | note left |
| | | userId + "backQuset" ç¨æ¥è¿åè°æ¥çæ»ç»æ |
| | | userId + "noVoice" ç¨æ¥è®°å½æ 声ååºæ¬¡æ° |
| | | userId + "mateNum" ç¨æ¥è®°å½æ å¹é
æ¬¡æ° |
| | | userId + "isOver" ç¨æ¥è®°å½æ´ä¸ªé®å·æ¯å¦ç»æ 0 ï¼æªç»æ 1ï¼ç»æ |
| | | end note |
| | | :ä»ivrLibaTemplateScriptVOListä¸è·åå°targetid为1çé¢ |
| | | æ¾å°QuestionMessageä¸; |
| | | note left |
| | | QuestionMessageçåæ®µä¸º |
| | | String content è¿åçå
容 |
| | | String kcb å¼åºç½ |
| | | String jsy ç»æè¯ |
| | | IvrLibaTemplateScriptVO nowQuestion å½åé®é¢ |
| | | end note |
| | | :å®ä¹âå¼åºç½âï¼ |
| | | å userId + "returnQues" çredis; |
| | | } |
| | | |
| | | |
| | | else (为空) |
| | | :è·åå端è¿åçquestionMessageâé®é¢ä¿¡æ¯â; |
| | | :å»redisä¸è·åå°âè¯æ¯é®é¢éåâ |
| | | List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList; |
| | | :è·åå°å½åçè¦é®é¢çé®é¢ä»questionMessageä¸ï¼ |
| | | IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO; |
| | | :å»redisä¸è·å模æ¿ä¿¡æ¯,IvrLibaTemplateVO ivrLibaTemplateVO1; |
| | | if(questionMessageçcontent为空ï¼è¯´æå¯¹æ¹æ²¡æåç) then(true) |
| | | partition "éé»è¯æ¯" { |
| | | :å
å»redisä¸ï¼è·åå½åç¨æ·ç对该é¢çå®é
é黿¬¡æ° Integer noVoice; |
| | | if(å®é
é黿¬¡æ°æ¯å¦çäºæ¨¡æ¿ä¸é
ç½®çæ¬¡æ°,noVoice == ivrLibaTemplateVO1.getNoVoiceNum().intValue()) then(true) |
| | | :该é¢è®°å½å°è°æ¥çæ»ç»æä¸ï¼å³backQusetä¸,æ´æ°redisä¸çuserId + "backQuset"; |
| | | if(æ¬é¢çtargetid çäº é¢ç®æ°éçæå¤§å¼ï¼å³ivrLibaTemplateScriptVO.getTargetid() == ivrLibaTemplateScriptVOList.size()) then(true) |
| | | :说æè¿å°±æ¯æåä¸éé¢äºï¼å°è°æ¥çç»æï¼åç»æè¯æ¾å°å¯¹è±¡ä¸ï¼è¿è¡è¿åç»ç¨æ·; |
| | | note right |
| | | List<IvrLibaTemplateScriptVO> backQusetRedis = redisCache.getCacheObject(userId + "backQuset"); |
| | | returnQues.setContent(JSON.toJSONString(backQusetRedis)); |
| | | returnQues.setJsy("æè°¢æ¨çèå¿åçï¼åè§"); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(userId + "isOver", 1, 120, TimeUnit.MINUTES); |
| | | end note |
| | | else(ä¸çäº) |
| | | :åè¿æä¸ä¸é¢,å°±æ ¹æ®å½åteagetID+1 è·åä¸ä¸é¢ |
| | | å¹¶å°ä¸ä¸é¢çä¿¡æ¯æ¾å°reidsä¸ï¼key为userId + "returnQues", returnQues |
| | | å°userId + "noVoice"æ¸
é¶; |
| | | endif |
| | | else(å®é
é黿¬¡æ°æ¯å¦ ä¸çäº æ¨¡æ¿ä¸é
ç½®çæ¬¡æ°) then(false) |
| | | :è¿è¡åå°è¯¢é®; |
| | | :å»redisä¸è·åuserId + "noVoice"ï¼å®é
çé黿¬¡æ°ï¼,å¾å°Integer noVoice2 |
| | | 对å®é
é黿¬¡æ°å 1,åæ¾åreidsä¸; |
| | | endif |
| | | } |
| | | else (å¯¹æ¹æåç) then(false) |
| | | partition "å¾ªç¯æ¬é¢çé项ï¼ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList()" { |
| | | :è·å循ç¯ï¼è·åå°éé¡¹çæ£åå¹é
, |
| | | åè·åå°ç¨æ·çåçä¿¡æ¯ï¼è¿è¡æ£åå¹é
; |
| | | note right |
| | | Pattern pattern = Pattern.compile(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()); |
| | | Matcher matcher = pattern.matcher(questionMessage.getContent()); |
| | | end note |
| | | if(å¹é
å°äº) then(matcher.matches()为true) |
| | | :åå°è¯¥é项ä¸çIsUserOperation,设置ætrueï¼åç«¯ä¼æ ¹æ®è¿ä¸ªæ¿å¼ï¼; |
| | | :å»redisä¸è·åuserId + "backQuset",å¾å° List<IvrLibaTemplateScriptVO> backQuset; |
| | | :å°è¯¥é¢çä¿¡æ¯æ¾å°backQusetä¸; |
| | | :æ´æ°redisä¸çuserId + "backQuset",å¹¶å°userId + "noVoice"置为0; |
| | | :ç»æå½å循ç¯; |
| | | :éè¿å½åæ£ç¡®é项çnextQeestionï¼è·åä¸ä¸é¢çtargetID,åå»ivrLibaTemplateScriptVOListï¼ |
| | | è¿è¡å¹é
ï¼è·åIvrLibaTemplateScriptVOï¼ä¸ä¸é¢çä¿¡æ¯ï¼; |
| | | :å°è·åå°çé¢ä¿¡æ¯æ¾å°redisä¸ï¼key为userId + "returnQues"; |
| | | else(没å¹é
å°) |
| | | :å»redisä¸è·åuserId + "mateNum",å¾å°Integer mateNum(æ å¹é
次æ°); |
| | | :æ å¹é
次æ°å»å¤ææ¯å¦å°æå¤§è¯¢é®æ¬¡æ°ï¼å¹¶ä¸æ¯å¦ææçé项é½å¹é
å®äº; |
| | | if(æ å¹é
次æ°âçäºâæå¤§è¯¢é®æ¬¡æ°ï¼å¹¶ä¸ææçé项é½å¹é
å®äº) then(true) |
| | | :å»redisä¸è·åuserId + "backQuset",å¾å° List<IvrLibaTemplateScriptVO> backQuset; |
| | | :å°è¯¥é¢çä¿¡æ¯æ¾å°backQusetä¸,æ´æ°redisä¸çuserId + "backQuset"; |
| | | :夿æ¯å¦è¿æä¸ä¸é¢; |
| | | if(æ¬é¢çtargetid < æ»é¢æ°) then(æä¸ä¸é¢) |
| | | :åè¿æä¸ä¸é¢,å°±æ ¹æ®å½åteagetID+1 è·åä¸ä¸é¢ |
| | | å¹¶å°ä¸ä¸é¢çä¿¡æ¯æ¾å°reidsä¸ï¼key为userId + "returnQues", |
| | | å°userId + "mateNum"æ¸
é¶; |
| | | else(没æé¢äº) |
| | | :å®ä¹ä¸ä¸ªç©ºçQuestionMessage returnQues2(ç¨äºè¿å); |
| | | :å»reidsä¸è·åuserId + "backQuset"ï¼æ¾å°returnQues2çcontentä¸; |
| | | :ç»returnQues2è®¾ç½®ç»æè¯; |
| | | :æ´æ°redisä¸çuserId + "returnQues"; |
| | | :å°redisä¸çuserId + "isOver"å¼ï¼è®¾ç½®ä¸º1ï¼è¡¨ç¤ºæ´ä¸ªæµç¨ç»æï¼; |
| | | endif |
| | | |
| | | else(æ å¹é
次æ°âå°äºâæå¤§è¯¢é®æ¬¡æ°ï¼å¹¶ä¸ææçé项é½å¹é
å®äº) |
| | | :æ å¹é
次æ°+1,æ´æ°redisä¸çuserId + "mateNum"; |
| | | endif |
| | | endif |
| | | } |
| | | :é项å¹é
宿å,éè¦åå»éè¿åºåè¿è¡å¹é
䏿¬¡; |
| | | :廿¨¡æ¿ä¿¡æ¯ä¸è·åéè¿åºæ¨¡æ¿IDéå; |
| | | note right |
| | | String extemplateID = ivrLibaTemplateVO1.getSubmoduleID(); |
| | | end note |
| | | if(éç¨åºæ¨¡æ¿IDéåä¸ä¸ºç©º) then(true) |
| | | :éè¿éç¨åºæ¨¡æ¿IDè·åéè¿è¯æ¯ä¿¡æ¯éå; |
| | | note right |
| | | List<IvrLibaExtemplatescript> ivrLibaExtemplatescripts = ivrLibaExtemplatescriptMapper.queryIvrLibaExtemplatescriptList(list1); |
| | | end note |
| | | partition "循ç¯éç¨è¯æ¯éåList<IvrLibaExtemplatescript> ivrLibaExtemplatescripts" { |
| | | :éè¿æ£åå°åç«¯ä¼ åçç»æï¼åéååºæ¥çè¯æ¯æ£åè¿è¡å¹é
; |
| | | :å¹é
å°åï¼å»redisä¸è·åuserId + "returnQues",å°çæ¡æ¾å°é®é¢å¯¹è±¡ä¸çsubmoduleTextä¸; |
| | | note right |
| | | QuestionMessage returnQues = redisCache.getCacheObject(userId + "returnQues"); |
| | | IvrLibaTemplateScriptVO nowQuestion = returnQues.getNowQuestion(); |
| | | nowQuestion.setSubmoduleText(ivrLibaExtemplatescript.getSwitchText()); |
| | | nowQuestion.setSubmoduleVoice(ivrLibaExtemplatescript.getSwitchWav()); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | end note |
| | | } |
| | | :ç»æå¾ªç¯; |
| | | endif |
| | | endif |
| | | endif |
| | | :å»redisä¸è·åuserId + "returnQues",å°ç»æè¿åç»å端; |
| | | :æ¸
空redisææçåé; |
| | | |
| | | note left |
| | | //æ´ä¸ªæµç¨æ¯å¦ç»æï¼å°redisä¸ç该userIdä¸çæ°æ®å é¤; |
| | | Integer isOver = redisCache.getCacheObject(userId + "isOver"); |
| | | if (isOver == 1) { |
| | | redisCache.deleteObject(userId + "ivrLibaTemplateScriptVOList"); |
| | | redisCache.deleteObject(userId + "backQuset"); |
| | | redisCache.deleteObject(userId + "noVoice"); |
| | | redisCache.deleteObject(userId + "returnQues"); |
| | | redisCache.deleteObject(userId + "isOver"); |
| | | redisCache.deleteObject(userId + "ivrLibaTemplateVO1"); |
| | | } |
| | | end note |
| | | stop |
| | | @enduml |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.component; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.web.task.PhoneTask; |
| | | import com.smartor.config.RabbitMqConfig; |
| | | import com.smartor.domain.IvrLibaTemplateVO; |
| | | import com.smartor.domain.IvrTaskcall; |
| | | import com.smartor.domain.IvrTaskcallMQ; |
| | | import com.smartor.mapper.IvrTaskcallMapper; |
| | | import com.smartor.service.IIvrLibaTemplateService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.amqp.core.Message; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitHandler; |
| | | import org.springframework.amqp.rabbit.annotation.RabbitListener; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import com.rabbitmq.client.Channel; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | |
| | | @Slf4j |
| | | @Component//ç嬿¤éå |
| | | public class RabbitMqReceiver { |
| | | |
| | | private static IIvrLibaTemplateService ivrLibaTemplateService; |
| | | |
| | | private static IvrTaskcallMapper ivrTaskcallMapper; |
| | | |
| | | private static RedisCache redisCache; |
| | | |
| | | // å建åºå®å¤§å°ççº¿ç¨æ± |
| | | private static final ExecutorService executorService = Executors.newFixedThreadPool(10); |
| | | |
| | | |
| | | @Autowired |
| | | public void setIIvrLibaTemplateService(IIvrLibaTemplateService ivrLibaTemplateService) { |
| | | RabbitMqReceiver.ivrLibaTemplateService = ivrLibaTemplateService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setIvrTaskcallMapper(IvrTaskcallMapper ivrTaskcallMapper) { |
| | | RabbitMqReceiver.ivrTaskcallMapper = ivrTaskcallMapper; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setRedisCache(RedisCache redisCache) { |
| | | RabbitMqReceiver.redisCache = redisCache; |
| | | } |
| | | |
| | | // @RabbitListener(queues = RabbitMqConfig.delay_queue) |
| | | // public void consultReceiveDealy(String content, Message message, Channel channel) throws IOException { |
| | | // log.info("----------------æ¥æ¶å»¶è¿éåæ¶æ¯--------------------"); |
| | | // //éç¥ MQ æ¶æ¯å·²è¢«æ¥æ¶,å¯ä»¥ACK(ä»éåä¸å é¤)äº |
| | | // channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); |
| | | // try { |
| | | // log.info("=============Do Something=============="); |
| | | // } catch (Exception e) { |
| | | // log.error("============æ¶è´¹å¤±è´¥,å°è¯æ¶æ¯è¡¥å忬¡æ¶è´¹!=============="); |
| | | // log.error(e.getMessage()); |
| | | // /** |
| | | // * basicRecoveræ¹æ³æ¯è¿è¡è¡¥åæä½ï¼ |
| | | // * å
¶ä¸çåæ°å¦æä¸ºtrueæ¯ææ¶æ¯éåå°queue使¯æå¯è½è¢«å
¶å®çconsumer(é群)æ¥æ¶å°ï¼ |
| | | // * 设置为falseæ¯åªè¡¥åç»å½åçconsumer |
| | | // */ |
| | | // channel.basicRecover(false); |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * çµè¯é访 |
| | | * concurrency = "50" å¹¶åæ°ä¸º50 |
| | | */ |
| | | @RabbitListener(queues = RabbitMqConfig.phone_queue, concurrency = "50") |
| | | public void phoneVisit(String content, Message message, Channel channel) throws IOException { |
| | | // System.out.println(content); |
| | | // IvrTaskcallMQ ivrTaskcallMQ = null; |
| | | // ObjectMapper mapper = new ObjectMapper(); |
| | | // try { |
| | | // ivrTaskcallMQ = mapper.readValue(content, IvrTaskcallMQ.class); |
| | | // } catch (JsonProcessingException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // //éè¿æ¨¡æ¿IDè·å模æ¿é®é¢ |
| | | // IvrLibaTemplateVO ivrLibaTemplateVO = new IvrLibaTemplateVO(); |
| | | // ivrLibaTemplateVO.setID(Long.valueOf(ivrTaskcallMQ.getTemplateid())); |
| | | // IvrLibaTemplateVO ivrLibaTemplateVO1 = ivrLibaTemplateService.selectInfoByCondition(ivrLibaTemplateVO); |
| | | // |
| | | // //éè¿ä»»å¡IDæ¿å°æ£è
ä¿¡æ¯ |
| | | // IvrTaskcall ivrTaskcall = new IvrTaskcall(); |
| | | // ivrTaskcall.setTaskid(ivrTaskcallMQ.getTaskid()); |
| | | // List<IvrTaskcall> ivrTaskcalls = ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall); |
| | | // |
| | | // for (IvrTaskcall ivrTaskcall1 : ivrTaskcalls) { |
| | | // //éè¿å¤çº¿ç¨çæ¹å¼å»æçµè¯ |
| | | // executorService.submit(new PhoneTask(ivrTaskcall1, ivrLibaTemplateVO1, redisCache)); |
| | | // } |
| | | //éç¥ MQ æ¶æ¯å·²è¢«æ¥æ¶,å¯ä»¥ACK(ä»éåä¸å é¤)äº ï¼è¿ä¸ªéè¦æ ¹æ®ä¸å¡åå»å¤çACKï¼ |
| | | channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); |
| | | try { |
| | | log.info("=============Do Something=============="); |
| | | } catch (Exception e) { |
| | | log.error("============æ¶è´¹å¤±è´¥,å°è¯æ¶æ¯è¡¥å忬¡æ¶è´¹!=============="); |
| | | log.error(e.getMessage()); |
| | | /** |
| | | * basicRecoveræ¹æ³æ¯è¿è¡è¡¥åæä½ï¼ |
| | | * å
¶ä¸çåæ°å¦æä¸ºtrueæ¯ææ¶æ¯éåå°queue使¯æå¯è½è¢«å
¶å®çconsumer(é群)æ¥æ¶å°ï¼ |
| | | * 设置为falseæ¯åªè¡¥åç»å½åçconsumer |
| | | */ |
| | | channel.basicRecover(false); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.web.controller.hanler; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.smartor.domain.SocketMessage; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.IvrLibaExtemplatescriptMapper; |
| | | import com.smartor.service.IIvrLibaTemplateService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.socket.BinaryMessage; |
| | | import org.springframework.web.socket.CloseStatus; |
| | |
| | | import org.springframework.web.socket.handler.AbstractWebSocketHandler; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Map; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class ChatWebSocketHandler extends AbstractWebSocketHandler { |
| | | |
| | | private static RedisCache redisCache; |
| | | |
| | | private static IIvrLibaTemplateService ivrLibaTemplateService; |
| | | |
| | | private static IvrLibaExtemplatescriptMapper ivrLibaExtemplatescriptMapper; |
| | | |
| | | // ç¨äºåå¨ç¨æ·IDåWebSocketSessionçæ å°å
³ç³» |
| | | private static Map<String, WebSocketSession> sessions = new ConcurrentHashMap<>(); |
| | | |
| | | @Autowired |
| | | public void setIEMapper(IvrLibaExtemplatescriptMapper ivrLibaExtemplatescriptMapper) { |
| | | ChatWebSocketHandler.ivrLibaExtemplatescriptMapper = ivrLibaExtemplatescriptMapper; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setTodayReaderService(IIvrLibaTemplateService ivrLibaTemplateService) { |
| | | ChatWebSocketHandler.ivrLibaTemplateService = ivrLibaTemplateService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setRedisCache(RedisCache redisCache) { |
| | | ChatWebSocketHandler.redisCache = redisCache; |
| | | } |
| | | |
| | | @Override |
| | | public void afterConnectionEstablished(WebSocketSession session) throws Exception { |
| | |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | SocketMessage parsedMessage = mapper.readValue(payload, SocketMessage.class); |
| | | if (parsedMessage != null) { |
| | | sendMessageToUser(parsedMessage.getUserId(), parsedMessage.getContent()); |
| | | sendMessageToUser(parsedMessage.getUserId(), parsedMessage); |
| | | } |
| | | |
| | | } |
| | |
| | | return userId; |
| | | } |
| | | |
| | | private void sendMessageToUser(String userId, String message) throws IOException { |
| | | private void sendMessageToUser(String userId, SocketMessage socketMessage) throws IOException { |
| | | WebSocketSession session = sessions.get(userId); |
| | | if (session != null && session.isOpen()) { |
| | | session.sendMessage(new TextMessage(message)); |
| | | if (socketMessage.getTemplateId() != null) { |
| | | //éè¿æ¨¡æ¿IDè·å模æ¿é®é¢ |
| | | IvrLibaTemplateVO ivrLibaTemplateVO = new IvrLibaTemplateVO(); |
| | | ivrLibaTemplateVO.setID(socketMessage.getTemplateId()); |
| | | IvrLibaTemplateVO ivrLibaTemplateVO1 = ivrLibaTemplateService.selectInfoByCondition(ivrLibaTemplateVO); |
| | | redisCache.setCacheObject(userId + "ivrLibaTemplateVO1", ivrLibaTemplateVO1, 120, TimeUnit.MINUTES); |
| | | //å°æ¥åºæ¥çé®é¢,æ¾å°å
¨å±åéä¸å» |
| | | List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList = ivrLibaTemplateVO1.getIvrLibaTemplateScriptVOList(); |
| | | //æ ¹æ®åºå·è¿è¡æåº |
| | | Collections.sort(ivrLibaTemplateScriptVOList, Comparator.comparing(IvrLibaTemplateScriptVO::getTargetid)); |
| | | |
| | | //å°æ¥åºæ¥çæ°æ®æ¾å°redisä¸ |
| | | redisCache.setCacheObject(userId + "ivrLibaTemplateScriptVOList", ivrLibaTemplateScriptVOList, 120, TimeUnit.MINUTES); |
| | | //ç¨æ¥è¿åè°æ¥çæ»ç»æ |
| | | redisCache.setCacheObject(userId + "backQuset", new ArrayList<>(), 120, TimeUnit.MINUTES); |
| | | //ç¨æ¥è®°å½æ 声ååºæ¬¡æ° |
| | | redisCache.setCacheObject(userId + "noVoice", 0, 120, TimeUnit.MINUTES); |
| | | //ç¨æ¥è®°å½æ å¹é
æ¬¡æ° |
| | | redisCache.setCacheObject(userId + "mateNum", 0, 120, TimeUnit.MINUTES); |
| | | //ç¨æ¥è®°å½æ´ä¸ªé®å·æ¯å¦ç»æ 0 ï¼æªç»æ 1ï¼ç»æ |
| | | redisCache.setCacheObject(userId + "isOver", 0, 120, TimeUnit.MINUTES); |
| | | |
| | | //ç¨æ¥è¿åå½åéè¦é®çé®é¢ä¿¡æ¯ |
| | | QuestionMessage returnQues = new QuestionMessage(); |
| | | |
| | | for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVOList) { |
| | | if (ivrLibaTemplateScriptVO.getTargetid() == ivrLibaTemplateVO1.getFirstQuestionNum().intValue()) |
| | | //è·å第ä¸é¢çé®é¢ |
| | | returnQues.setNowQuestion(ivrLibaTemplateScriptVO); |
| | | // returnQues.setCode(ivrLibaTemplateScriptVO.getTargetid() + 1); |
| | | } |
| | | // returnQues.setKcb("ä½ å¥½,大å»ç,æä»¬æ¯æææå»é¢,ç°å¨éè¦å䏿¬¡é访;"); |
| | | returnQues.setKcb(ivrLibaTemplateVO1.getRevisitBefore()); |
| | | |
| | | //è®°å½ååº |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | } else { |
| | | //è·åsocketMessageéçQuestionMessage,å¯¹çæ¡è¿è¡å¤çç¶å,åé®ä¸ä¸é |
| | | Gson gson = new Gson(); |
| | | if (!StringUtils.isEmpty(socketMessage.getContent())) { |
| | | socketMessage.setQuestionMessage(gson.fromJson(socketMessage.getContent(), QuestionMessage.class)); |
| | | } |
| | | |
| | | QuestionMessage questionMessage = socketMessage.getQuestionMessage(); |
| | | List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList = redisCache.getCacheObject(userId + "ivrLibaTemplateScriptVOList"); |
| | | //æ ¹æ®åç«¯ä¼ åçæ¡ä»¶ï¼è·åå½åé¢ç® |
| | | IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO = questionMessage.getNowQuestion(); |
| | | if (ivrLibaTemplateScriptVO.getID() == null) { |
| | | QuestionMessage returnQues = redisCache.getCacheObject(userId + "returnQues"); |
| | | ivrLibaTemplateScriptVO = returnQues.getNowQuestion(); |
| | | } |
| | | //è·å模æ¿ä¿¡æ¯ |
| | | IvrLibaTemplateVO ivrLibaTemplateVO1 = redisCache.getCacheObject(userId + "ivrLibaTemplateVO1"); |
| | | |
| | | if (StringUtils.isEmpty(questionMessage.getContent())) { |
| | | //è°ç¨ivrLibaTemplateScriptVOä¸çslienceText(éé»è¯æ¯) |
| | | Integer noVoice = redisCache.getCacheObject(userId + "noVoice"); |
| | | //å®é
é黿¬¡æ°æ¯å¦ çäº æ¨¡æ¿ä¸é
ç½®çæ¬¡æ° |
| | | if (noVoice == ivrLibaTemplateVO1.getNoVoiceNum().intValue()) { |
| | | //ç¨æ¥è¿åè°æ¥çæ»ç»æ |
| | | List<IvrLibaTemplateScriptVO> backQuset = new ArrayList<>(); |
| | | backQuset.add(ivrLibaTemplateScriptVO); |
| | | redisCache.setCacheObject(userId + "backQuset", backQuset, 120, TimeUnit.MINUTES); |
| | | |
| | | //å¦æå æ¬¡é½æ²¡ååºï¼å°±ä¸ä¸é¢ï¼éè¦å
夿æ¯å¦æä¸ä¸é¢ï¼ |
| | | if (ivrLibaTemplateScriptVO.getTargetid() == ivrLibaTemplateScriptVOList.size()) { |
| | | //妿ä¸ä¸é¢æ²¡æäºï¼å°±ç»æäº |
| | | QuestionMessage returnQues = new QuestionMessage(); |
| | | // returnQues.setCode(null); |
| | | List<IvrLibaTemplateScriptVO> backQusetRedis = redisCache.getCacheObject(userId + "backQuset"); |
| | | returnQues.setContent(JSON.toJSONString(backQusetRedis)); |
| | | returnQues.setJsy("æè°¢æ¨çèå¿åçï¼åè§"); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(userId + "isOver", 1, 120, TimeUnit.MINUTES); |
| | | |
| | | } else { |
| | | //妿æä¸ä¸é¢ï¼å°±æ ¹æ®å½åteagetID+1 è·åä¸ä¸é¢ |
| | | QuestionMessage returnQues = getNextQuestion(ivrLibaTemplateScriptVOList, ivrLibaTemplateScriptVO); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(userId + "noVoice", 0, 120, TimeUnit.MINUTES); |
| | | } |
| | | } else { |
| | | //å®é
é黿¬¡æ°æ¯å¦ ä¸çäº æ¨¡æ¿ä¸é
ç½®çæ¬¡æ° |
| | | // QuestionMessage returnQues = redisCache.getCacheObject(userId + "returnQues"); |
| | | // returnQues.setContent(null); |
| | | // redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | |
| | | Integer noVoice2 = redisCache.getCacheObject(userId + "noVoice"); |
| | | noVoice2 = noVoice2 + 1; |
| | | redisCache.setCacheObject(userId + "noVoice", noVoice2, 120, TimeUnit.MINUTES); |
| | | } |
| | | } else { |
| | | //对åççé®é¢,è¿è¡æ£åå¹é
ï¼è¿éåªé坹鿩é¢ï¼å
¶å®é¢åä¸è¡ï¼ |
| | | for (int j = 0; j < ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().size(); j++) { |
| | | //å
å« |
| | | Matcher matcher = null; |
| | | if (StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex())) { |
| | | Pattern pattern = Pattern.compile(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()); |
| | | matcher = pattern.matcher(questionMessage.getContent()); |
| | | } |
| | | //ä¸å
å« |
| | | Matcher matcher2 = null; |
| | | if (StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2())) { |
| | | Pattern pattern2 = Pattern.compile(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()); |
| | | matcher2 = pattern2.matcher(questionMessage.getContent()); |
| | | } |
| | | log.info("==============================Targetregexçå¼ä¸ºï¼{}, Targetregex2çå¼ä¸ºï¼{}", ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex(), ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()); |
| | | |
| | | if (StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() && StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) { |
| | | //说æå¹é
æ£ç¡®äº |
| | | ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).setIsUserOperation(true); |
| | | List<IvrLibaTemplateScriptVO> backQuset = redisCache.getCacheObject(userId + "backQuset"); |
| | | //å¹é
宿å,å°ç»æä¿åå°æ°çæ°ç» |
| | | backQuset.add(ivrLibaTemplateScriptVO); |
| | | redisCache.setCacheObject(userId + "backQuset", backQuset, 120, TimeUnit.MINUTES); |
| | | //å°éé»ç½®ä¸º0 |
| | | redisCache.setCacheObject(userId + "noVoice", 0, 120, TimeUnit.MINUTES); |
| | | //è·åä¸ä¸é¢ |
| | | Integer nextQuestion = ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getNextQuestion(); |
| | | for (IvrLibaTemplateScriptVO script : ivrLibaTemplateScriptVOList) { |
| | | if (script.getTargetid() == nextQuestion) { |
| | | QuestionMessage returnQues = new QuestionMessage(); |
| | | returnQues.setNowQuestion(script); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | } else { |
| | | //没æå¹é
å° |
| | | Integer mateNum = redisCache.getCacheObject(userId + "mateNum"); |
| | | |
| | | //æ å¹é
次æ°å»å¤ææ¯å¦å°æå¤§è¯¢é®æ¬¡æ°ï¼å¹¶ä¸ææçé项é½å¹é
å®äº |
| | | if (mateNum == ivrLibaTemplateVO1.getMateNum().intValue() && j == ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().size() - 1) { |
| | | //é®äºæå¤§è¯¢é®æ¬¡æ°åï¼è¿æ¯æ²¡æå¹é
ä¸,å°ç»æä¿åå°æ°çæ°ç» |
| | | List<IvrLibaTemplateScriptVO> backQuset = redisCache.getCacheObject(userId + "backQuset"); |
| | | backQuset.add(ivrLibaTemplateScriptVO); |
| | | redisCache.setCacheObject(userId + "backQuset", backQuset, 120, TimeUnit.MINUTES); |
| | | |
| | | //妿ä¸ä¸é¢ä¸ºç©º.åæ°çæ°æ®è¿å,å¹¶å ä¸æè°¢è¯ |
| | | if (ivrLibaTemplateScriptVO.getTargetid() < ivrLibaTemplateScriptVOList.size()) { |
| | | QuestionMessage returnQues = getNextQuestion(ivrLibaTemplateScriptVOList, ivrLibaTemplateScriptVO); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(userId + "mateNum", 0, 120, TimeUnit.MINUTES); |
| | | } else { |
| | | QuestionMessage returnQues2 = new QuestionMessage(); |
| | | // returnQues2.setCode(null); |
| | | List<IvrLibaTemplateScriptVO> backQusetRedis = redisCache.getCacheObject(userId + "backQuset"); |
| | | returnQues2.setQuestionList(backQusetRedis); |
| | | returnQues2.setJsy("æè°¢æ¨çèå¿åçï¼åè§"); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues2, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(userId + "isOver", 1, 120, TimeUnit.MINUTES); |
| | | break; |
| | | } |
| | | } else if (mateNum < ivrLibaTemplateVO1.getMateNum().intValue() && j == ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().size() - 1) { |
| | | //没æé®å°è§å®æ¬¡æ° |
| | | mateNum = mateNum + 1; |
| | | redisCache.setCacheObject(userId + "mateNum", mateNum, 120, TimeUnit.MINUTES); |
| | | } |
| | | } |
| | | } |
| | | //é项å¹é
宿åï¼éè¦åå»éè¿åºåè¿è¡å¹é
䏿¬¡ |
| | | String extemplateID = ivrLibaTemplateVO1.getSubmoduleID(); |
| | | String[] split = extemplateID.split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | List<Long> list1 = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(extemplateID)) { |
| | | for (String str : list) { |
| | | list1.add(Long.valueOf(str)); |
| | | } |
| | | List<IvrLibaExtemplatescript> ivrLibaExtemplatescripts = ivrLibaExtemplatescriptMapper.queryIvrLibaExtemplatescriptList(list1); |
| | | for (IvrLibaExtemplatescript ivrLibaExtemplatescript : ivrLibaExtemplatescripts) { |
| | | Matcher matcher = null; |
| | | if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex())) { |
| | | Pattern pattern = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex()); |
| | | matcher = pattern.matcher(questionMessage.getContent()); |
| | | } |
| | | |
| | | Matcher matcher2 = null; |
| | | if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2())) { |
| | | Pattern pattern2 = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex2()); |
| | | matcher2 = pattern2.matcher(questionMessage.getContent()); |
| | | } |
| | | log.info("++++++++++++++++++++++++++éç¨åºæ¯å¦ä¸ºç©ºï¼selfRegex : {} , selfRegex2 : {}", ivrLibaExtemplatescript.getSelfRegex(), ivrLibaExtemplatescript.getSelfRegex2()); |
| | | |
| | | if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex()) && matcher.matches() && StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2()) && matcher2.matches() || StringUtils.isEmpty(ivrLibaExtemplatescript.getSelfRegex()) && StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2()) && matcher2.matches() || StringUtils.isEmpty(ivrLibaExtemplatescript.getSelfRegex2()) && StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex()) && matcher.matches()) { |
| | | QuestionMessage returnQues = redisCache.getCacheObject(userId + "returnQues"); |
| | | IvrLibaTemplateScriptVO nowQuestion = returnQues.getNowQuestion(); |
| | | nowQuestion.setSubmoduleText(ivrLibaExtemplatescript.getSwitchText()); |
| | | nowQuestion.setSubmoduleVoice(ivrLibaExtemplatescript.getSwitchWav()); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | if (ivrLibaExtemplatescript.getIsEnd() == 1) { |
| | | //å°é®é¢ç½®ç©º |
| | | IvrLibaTemplateScriptVO nowQuestion1 = returnQues.getNowQuestion(); |
| | | nowQuestion1.setQuestionText(null); |
| | | nowQuestion1.setQuestionVoice(null); |
| | | returnQues.setNowQuestion(nowQuestion1); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | |
| | | redisCache.setCacheObject(userId + "isOver", 1, 120, TimeUnit.MINUTES); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | QuestionMessage returnQues = redisCache.getCacheObject(userId + "returnQues"); |
| | | List<IvrLibaTemplateScriptVO> backQusetRedis = redisCache.getCacheObject(userId + "backQuset"); |
| | | returnQues.setQuestionList(backQusetRedis); |
| | | session.sendMessage(new TextMessage(JSON.toJSONString(returnQues).getBytes(StandardCharsets.UTF_8))); |
| | | |
| | | //æ´ä¸ªæµç¨æ¯å¦ç»æï¼å°redisä¸ç该userIdä¸çæ°æ®å é¤; |
| | | Integer isOver = redisCache.getCacheObject(userId + "isOver"); |
| | | if (isOver == 1) { |
| | | redisCache.deleteObject(userId + "ivrLibaTemplateScriptVOList"); |
| | | redisCache.deleteObject(userId + "backQuset"); |
| | | redisCache.deleteObject(userId + "noVoice"); |
| | | redisCache.deleteObject(userId + "returnQues"); |
| | | redisCache.deleteObject(userId + "isOver"); |
| | | redisCache.deleteObject(userId + "ivrLibaTemplateVO1"); |
| | | try { |
| | | //æå¼é¾æ¥ |
| | | afterConnectionClosed(session, null); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //è·åä¸ä¸é¢ï¼è¿ä¸ªæ¹æ³ä¸éåé项ä¸çnextQuestionï¼ |
| | | private QuestionMessage getNextQuestion(List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList, IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO) { |
| | | QuestionMessage returnQues = new QuestionMessage(); |
| | | for (int j = 0; j < ivrLibaTemplateScriptVOList.size(); j++) { |
| | | if (ivrLibaTemplateScriptVOList.get(j).getTargetid() == ivrLibaTemplateScriptVO.getTargetid() + 1) { |
| | | // 对该æ¡templateScriptVOè¿è¡å¤ç |
| | | returnQues.setNowQuestion(ivrLibaTemplateScriptVOList.get(j)); |
| | | } |
| | | } |
| | | return returnQues; |
| | | } |
| | | |
| | | } |
| | |
| | | @Log(title = "éè¿æ¨¡æ¿", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody IvrLibaExtemplate ivrLibaExtemplate) { |
| | | return toAjax(ivrLibaExtemplateService.insertIvrLibaExtemplate(ivrLibaExtemplate)); |
| | | return AjaxResult.success(ivrLibaExtemplateService.insertIvrLibaExtemplate(ivrLibaExtemplate)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PreAuthorize("@ss.hasPermi('smartor:extemplate:remove')") |
| | | @Log(title = "éè¿æ¨¡æ¿", businessType = BusinessType.DELETE) |
| | | @GetMapping("/remove/{IDs}") |
| | | public AjaxResult remove(@PathVariable String[] IDs) { |
| | | public AjaxResult remove(@PathVariable Long[] IDs) { |
| | | return toAjax(ivrLibaExtemplateService.deleteIvrLibaExtemplateByIDs(IDs)); |
| | | } |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('smartor:extemplatescript:remove')") |
| | | @Log(title = "éç¨æ¨¡æ¿è¯æ¯", businessType = BusinessType.DELETE) |
| | | @GetMapping("/remove/{IDs}") |
| | | public AjaxResult remove(@PathVariable String[] IDs) { |
| | | public AjaxResult remove(@PathVariable Long[] IDs) { |
| | | return toAjax(ivrLibaExtemplatescriptService.deleteIvrLibaExtemplatescriptByIDs(IDs)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.smartor.config.RabbitMqConfig; |
| | | import com.smartor.domain.IvrLibaTemplate; |
| | | import com.smartor.domain.IvrLibaTemplateVO; |
| | | import com.smartor.service.IIvrLibaTemplateService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.amqp.AmqpException; |
| | | import org.springframework.amqp.core.Message; |
| | | import org.springframework.amqp.core.MessagePostProcessor; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | * @author ruoyi |
| | | * @date 2023-12-23 |
| | | */ |
| | | @Slf4j |
| | | @Api(description = "é访模æ¿åº") |
| | | @RestController |
| | | @RequestMapping("/smartor/template") |
| | | public class IvrLibaTemplateController extends BaseController { |
| | | @Autowired |
| | | private IIvrLibaTemplateService ivrLibaTemplateService; |
| | | |
| | | @Autowired |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¨¡æ¿åºå表 |
| | |
| | | * æ°å¢æä¿®æ¹é访模æ¿åºè¯¦æ
|
| | | */ |
| | | @ApiOperation("æ°å¢æä¿®æ¹é访模æ¿åºè¯¦æ
") |
| | | @PreAuthorize("@ss.hasPermi('smartor:script:list')") |
| | | @PostMapping("/saveOrUpdateScript") |
| | | public AjaxResult saveOrUpdateScript(@RequestBody IvrLibaTemplateVO ivrLibaTemplateVO) { |
| | | if (ObjectUtils.isEmpty(ivrLibaTemplateVO)) { |
| | |
| | | } |
| | | return success(ivrLibaTemplateService.selectInfoByCondition(ivrLibaTemplateVO)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¼å§æ§è¡(æµè¯ç¨) |
| | | */ |
| | | @GetMapping("/queryRabbitmq") |
| | | public AjaxResult queryRabbitmq(@RequestParam("routintKey") String routintKey, @RequestParam("content") String content, @RequestParam("times") Long times) { |
| | | |
| | | // rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, "phone.001", "æµè¯æ°æ®001"); |
| | | // rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, "phone.002", "æµè¯æ°æ®002"); |
| | | // rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, "phone.003", "æµè¯æ°æ®003"); |
| | | // rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, routintKey, message, new MessagePostProcessor() { |
| | | // @Override |
| | | // public Message postProcessMessage(Message message) throws AmqpException { |
| | | //// message.getMessageProperties().setDelay(times); |
| | | // message.getMessageProperties().getHeaders().put("x-delay", times); |
| | | ////message.getMessageProperties().setExpiration(); |
| | | // return message; |
| | | // } |
| | | // }); |
| | | |
| | | log.info("-------------å¯å¨å¨è¯¢åºçè¶
æ¶æéå»¶è¿éå-------------"); |
| | | this.rabbitTemplate.convertAndSend(RabbitMqConfig.phone_exchange, RabbitMqConfig.routing_key, content, message -> { |
| | | //注æè¿éæ¶é´å¯ä»¥ä½¿longï¼è䏿¯è®¾ç½®header |
| | | message.getMessageProperties().setHeader("x-delay", times); |
| | | return message; |
| | | }); |
| | | log.info("-------------å»¶è¿éå{}msåæ§è¡.-------------", times); |
| | | return success(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.web.controller.smartor; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | 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.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.smartor.domain.HeTaskVO; |
| | | import com.smartor.domain.IvrTaskcall; |
| | | import com.smartor.domain.IvrTaskcallVO; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.service.IIvrTaskcallService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åä¸ä»»å¡ï¼é访ï¼Controller |
| | |
| | | * @author ruoyi |
| | | * @date 2024-02-02 |
| | | */ |
| | | @Api(description = "åä¸ä»»å¡ï¼é访ï¼") |
| | | @Api(description = "åä¸ä»»å¡ï¼é访宣æï¼") |
| | | @RestController |
| | | @RequestMapping("/smartor/taskcall") |
| | | public class IvrTaskcallController extends BaseController { |
| | |
| | | /** |
| | | * æ¥è¯¢åä¸ä»»å¡ï¼é访ï¼å表 |
| | | */ |
| | | @ApiOperation("æ¥è¯¢åä¸ä»»å¡ï¼é访ï¼å表") |
| | | @ApiOperation("æ¥è¯¢åä¸ä»»å¡ï¼é访宣æï¼å表") |
| | | @PreAuthorize("@ss.hasPermi('system:taskcall:list')") |
| | | @PostMapping("/list") |
| | | public TableDataInfo list(@RequestBody IvrTaskcall ivrTaskcall) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 导åºåä¸ä»»å¡ï¼é访ï¼å表 |
| | | * 导åºåä¸ä»»å¡ï¼é访宣æï¼å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:taskcall:export')") |
| | | @Log(title = "åä¸ä»»å¡ï¼é访ï¼", businessType = BusinessType.EXPORT) |
| | | @Log(title = "åä¸ä»»å¡ï¼é访宣æï¼", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, IvrTaskcall ivrTaskcall) { |
| | | List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶æ¥è¯¢ä»»å¡ä¿¡æ¯ |
| | | */ |
| | | @ApiOperation("æ ¹æ®æ¡ä»¶æ¥è¯¢ä»»å¡ä¿¡æ¯") |
| | | @PostMapping("/queryTaskByCondition") |
| | | public AjaxResult queryTaskByCondition(@RequestBody IvrTaskcallVO ivrTaskcallVO) { |
| | | //æ ¹æ®å
¥åæ¥è¯¢ä¿¡æ¯ |
| | | IvrTaskcall ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskcall.class); |
| | | List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall); |
| | | |
| | | //å®ä¹æ£è
ä¸åä¸ä»»å¡å
³è表éå |
| | | List<PatTaskRelevance> patTaskRelevances = new ArrayList<>(); |
| | | |
| | | //å°æ¥åºæ¥çæ°æ®åå
¥IvrTaskcallVOä¸ |
| | | IvrTaskcallVO ivrTaskcallVO2 = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskcallVO.class); |
| | | String sendTimeSlot = list.get(0).getSendTimeSlot(); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | //è·åå°åéæ¶é´çéå |
| | | if (StringUtils.isNotEmpty(sendTimeSlot)) { |
| | | List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot, List.class); |
| | | ivrTaskcallVO2.setSendTimeslot(taskSendTimeVOList); |
| | | } |
| | | //ææ¬åéåæ° |
| | | if (StringUtils.isNotEmpty(list.get(0).getTextParam())) { |
| | | Map<String, Map<String, String>> textParam = objectMapper.readValue(list.get(0).getTextParam(), Map.class); |
| | | ivrTaskcallVO2.setTextParam(textParam); |
| | | } |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | for (IvrTaskcall ivrTaskcall1 : list) { |
| | | PatTaskRelevance patTaskRelevance = new PatTaskRelevance(); |
| | | //è·åå°æ£è
ä¿¡æ¯ï¼å¹¶æ¾å
¥å°éåä¸ |
| | | patTaskRelevance.setName(ivrTaskcall1.getSendname()); |
| | | patTaskRelevance.setAge(ivrTaskcall1.getAge()); |
| | | patTaskRelevance.setSfzh(ivrTaskcall1.getSfzh()); |
| | | patTaskRelevance.setPhone(ivrTaskcall1.getPhone()); |
| | | patTaskRelevance.setAddr(ivrTaskcall1.getAddr()); |
| | | patTaskRelevances.add(patTaskRelevance); |
| | | } |
| | | |
| | | ivrTaskcallVO2.setPatTaskRelevances(patTaskRelevances); |
| | | return success(ivrTaskcallVO2); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä»»å¡åéæ§è¡ |
| | | */ |
| | | @ApiOperation("ä»»å¡åéæ§è¡") |
| | | @PostMapping("/heTaskSend") |
| | | public AjaxResult heTaskSend(@RequestBody IvrTaskcallVO ivrTaskcallVO) { |
| | | return toAjax(ivrTaskcallService.heTaskSend(ivrTaskcallVO)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * çµè¯åè°ä»»å¡ |
| | | */ |
| | | @ApiOperation("çµè¯åè°ä»»å¡") |
| | | @PostMapping("/phoneCallBack") |
| | | public AjaxResult phoneCallBack(@RequestBody PhoneCallBackVO phoneCallBackVO) { |
| | | //妿uuidå¨redis䏿¾ä¸å°ï¼é£å°±ç´æ¥æ¥å¼å¸¸ |
| | | return success(ivrTaskcallService.phoneCallBack(phoneCallBackVO)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.web.controller.smartor.tools; |
| | | |
| | | import afu.org.checkerframework.checker.oigj.qual.O; |
| | | import com.alibaba.nls.client.AccessToken; |
| | | import com.alibaba.nls.client.protocol.NlsClient; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.annotation.RepeatSubmit; |
| | | 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.poi.ExcelUtil; |
| | | import com.smartor.domain.BaseSmsRequest; |
| | | import com.smartor.domain.BaseSmsaccount; |
| | | import com.smartor.domain.BatchBaseSmsRequest; |
| | | import com.smartor.domain.TemplateSmsRequest; |
| | | import com.smartor.service.DingTalkService; |
| | | import com.smartor.service.IBaseSmsaccountService; |
| | | import com.smartor.service.PersonVoiceService; |
| | | import com.taobao.api.ApiException; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.jsoup.select.Elements; |
| | | 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.*; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.file.Files; |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | * @author ls |
| | | * @date 2023-11-17 |
| | | */ |
| | | @Api(description = "人工è¯é³") |
| | | @Api(description = "è¯é³åæè½¬æ¢") |
| | | @RestController |
| | | @RequestMapping("/smartor/voice") |
| | | public class PersonVoiceController extends BaseController { |
| | |
| | | |
| | | @ApiOperation("æå转è¯é³") |
| | | @GetMapping("/texttospeech") |
| | | public Map<String, Object> texttospeech(@RequestParam("textspeech") String textspeech) { |
| | | String recognizerListener = personVoiceService.texttospeech(textspeech); |
| | | public Map<String, Object> texttospeech(@RequestParam("textspeech") String textspeech, @RequestParam("filePath") String filePath) { |
| | | String recognizerListener = personVoiceService.texttospeech(textspeech, filePath); |
| | | return success(recognizerListener); |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.task; |
| | | |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.smartor.config.PhoneUtils; |
| | | import com.smartor.domain.IvrLibaTemplateScriptVO; |
| | | import com.smartor.domain.IvrLibaTemplateVO; |
| | | import com.smartor.domain.IvrTaskcall; |
| | | import com.smartor.domain.QuestionMessage; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | public class PhoneTask implements Runnable { |
| | | private IvrTaskcall ivrTaskcall; |
| | | private List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVO; |
| | | private RedisCache redisCache; |
| | | private IvrLibaTemplateVO ivrLibaTemplateVO; |
| | | |
| | | public PhoneTask(IvrTaskcall ivrTaskcall, IvrLibaTemplateVO ivrLibaTemplateVO, RedisCache redisCache) { |
| | | this.ivrTaskcall = ivrTaskcall; |
| | | this.ivrLibaTemplateScriptVO = ivrLibaTemplateVO.getIvrLibaTemplateScriptVOList(); |
| | | this.ivrLibaTemplateVO = ivrLibaTemplateVO; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | //è·åçµè¯ç»ï¼æ¥çåªäºçµè¯å¯ä»¥ä½¿ç¨ |
| | | PhoneUtils phoneUtils = new PhoneUtils(); |
| | | String uuid = IdUtils.randomUUID(); |
| | | Map<String, Object> objectMap = new HashMap<>(); |
| | | objectMap.put("ivrTaskcall", ivrTaskcall); |
| | | objectMap.put("ivrLibaTemplateScriptVO", ivrLibaTemplateScriptVO); |
| | | //å°æ°æ®æ¾å°redisä¸ï¼æ¹ä¾¿å¨åè°æ¹æ³éè·å |
| | | redisCache.setCacheObject(uuid, objectMap, 120, TimeUnit.MINUTES); |
| | | |
| | | //è®°å½é¦æ¬¡é®é¢ |
| | | QuestionMessage returnQues = new QuestionMessage(); |
| | | returnQues.setKcb(ivrLibaTemplateVO.getRevisitBefore()); |
| | | for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVO) { |
| | | if (ivrLibaTemplateScriptVO.getTargetid() == ivrLibaTemplateVO.getFirstQuestionNum().intValue()) { |
| | | returnQues.setNowQuestion(ivrLibaTemplateScriptVO); |
| | | } |
| | | } |
| | | returnQues.setQuestionList(ivrLibaTemplateScriptVO); |
| | | //å°é®é¢ï¼å模æ¿ä¿¡æ¯æ¾å°redisä¸ |
| | | redisCache.setCacheObject(uuid + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(uuid + "ivrLibaTemplateVO", ivrLibaTemplateVO, 120, TimeUnit.MINUTES); |
| | | |
| | | //è°ç¨æºå¨äººçµè¯ï¼å¼å§çµè¯ï¼éè¦å°åè°æ¹æ³ä¼ å
¥ï¼è¿ä¸ªçâçµè¯æ¹âåè¯æä¹ä¼ ï¼ç°å¨å
空ç,è¿æç¬¬ä¸å¥é®é¢è¯æ¯ï¼ |
| | | phoneUtils.ob(uuid, null, ivrTaskcall.getPhone(), null, null, null, null, null, null, null, null); |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.web.test; |
| | | |
| | | import com.smartor.config.RabbitMqConfig; |
| | | import org.junit.Test; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | //@SpringBootTest |
| | | //@RunWith(SpringRunner.class) |
| | | public class MQTest { |
| | | @Autowired |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | @Test |
| | | public void testSend() { |
| | | // rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, "phone.001", "æµè¯æ°æ®001"); |
| | | // rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, "phone.002", "æµè¯æ°æ®002"); |
| | | // rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, "phone.003", "æµè¯æ°æ®003"); |
| | | } |
| | | } |
| | |
| | | # æ°æ®æºé
ç½® |
| | | spring: |
| | | rabbitmq: |
| | | host: 116.62.18.175 |
| | | password: guest |
| | | port: 5672 |
| | | username: guest |
| | | virtual-host: / |
| | | # å¼å¯æ¶æ¯åé确认 |
| | | publisher-confirms: true |
| | | publisher-returns: true |
| | | listener: |
| | | simple: |
| | | acknowledge-mode: manual |
| | | |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | # driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | # ä¹ä¹äºé¢ |
| | | # url: jdbc:mysql://127.0.0.1:3306/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | # username: root |
| | | # password: 123456 |
| | | |
| | | # å
¬å¸ |
| | | url: jdbc:mysql://116.62.18.175:6002/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: hxsoft |
| | | password: Hxerp2000 |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é(å
¬å¸) |
| | | enabled: true |
| | | url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor |
| | | username: sa |
| | | password: Hxerp2000 |
| | | driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é(ä¹ä¹äºé¢) |
| | | # enabled: true |
| | | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=IntelligentVoice;encrypt=false;SelectMethod=cursor |
| | | # username: sa |
| | | # password: sfxt#2023 |
| | | # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | # åå§è¿æ¥æ° |
| | | initialSize: 5 |
| | | # æå°è¿æ¥æ± æ°é |
| | |
| | | accessKeyId: LTAI4G5zjJRkun2eRdzU8GhR |
| | | accessKeySecret: 6EIRr9uZeRobvHBRqskyGwjTLKpHYv |
| | | signName: æå·å©æ¹ç§æ |
| | | |
| | | #æºè½å¼å« |
| | | phoneIP: http://124.220.50.51:8001 |
| | |
| | | enabled: true |
| | | # redis é
ç½® |
| | | redis: |
| | | # å°å |
| | | # # å°åï¼ä¹ä¹äºé¢ï¼ |
| | | # host: 127.0.0.1 |
| | | # 端å£ï¼é»è®¤ä¸º6379 |
| | | # port: 6379 |
| | | # # å°å |
| | | # port: 6020 |
| | | |
| | | |
| | | # å°åï¼å
¬å¸ï¼ |
| | | host: 116.62.18.175 |
| | | # # 端å£ï¼é»è®¤ä¸º6379 |
| | | port: 6020 |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 0 |
| | |
| | | <!-- æ¥å¿æå¤§çåå² 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | | <encoder>l |
| | | <pattern>${og.pattern}</pattern> |
| | | </encoder> |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <!-- è¿æ»¤ççº§å« --> |
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-websocket</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-httpclient</groupId> |
| | | <artifactId>commons-httpclient</artifactId> |
| | | <version>3.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>1.2.41</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.exception; |
| | | |
| | | public class HttpRequestException extends RuntimeException { |
| | | private static final long serialVersionUID = 1158312384059617619L; |
| | | |
| | | private int code; |
| | | |
| | | public HttpRequestException() { |
| | | super(); |
| | | } |
| | | |
| | | public HttpRequestException(int code, Throwable cause) { |
| | | super(cause); |
| | | this.code = code; |
| | | } |
| | | |
| | | public HttpRequestException(int code, String message) { |
| | | super(message); |
| | | this.code = code; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return super.getMessage(); |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return "Error code is " + code + ", msg is " + super.getMessage(); |
| | | } |
| | | } |
| | |
| | | import java.lang.management.ManagementFactory; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.ZonedDateTime; |
| | | import java.time.*; |
| | | import java.util.Date; |
| | | |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class DateUtils extends org.apache.commons.lang3.time.DateUtils |
| | | { |
| | | public class DateUtils extends org.apache.commons.lang3.time.DateUtils { |
| | | public static String YYYY = "yyyy"; |
| | | |
| | | public static String YYYY_MM = "yyyy-MM"; |
| | |
| | | |
| | | public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | private static String[] parsePatterns = { |
| | | "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", |
| | | "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", |
| | | "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; |
| | | private static String[] parsePatterns = {"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; |
| | | |
| | | /** |
| | | * è·åå½åDate忥æ |
| | | * |
| | | * @return Date() å½åæ¥æ |
| | | */ |
| | | public static Date getNowDate() |
| | | { |
| | | public static Date getNowDate() { |
| | | return new Date(); |
| | | } |
| | | |
| | |
| | | * |
| | | * @return String |
| | | */ |
| | | public static String getDate() |
| | | { |
| | | public static String getDate() { |
| | | return dateTimeNow(YYYY_MM_DD); |
| | | } |
| | | |
| | | public static final String getTime() |
| | | { |
| | | public static final String getTime() { |
| | | return dateTimeNow(YYYY_MM_DD_HH_MM_SS); |
| | | } |
| | | |
| | | public static final String dateTimeNow() |
| | | { |
| | | public static final String dateTimeNow() { |
| | | return dateTimeNow(YYYYMMDDHHMMSS); |
| | | } |
| | | |
| | | public static final String dateTimeNow(final String format) |
| | | { |
| | | public static final String dateTimeNow(final String format) { |
| | | return parseDateToStr(format, new Date()); |
| | | } |
| | | |
| | | public static final String dateTime(final Date date) |
| | | { |
| | | public static final String dateTime(final Date date) { |
| | | return parseDateToStr(YYYY_MM_DD, date); |
| | | } |
| | | |
| | | public static final String parseDateToStr(final String format, final Date date) |
| | | { |
| | | public static final String parseDateToStr(final String format, final Date date) { |
| | | return new SimpleDateFormat(format).format(date); |
| | | } |
| | | |
| | | public static final Date dateTime(final String format, final String ts) |
| | | { |
| | | try |
| | | { |
| | | public static final Date dateTime(final String format, final String ts) { |
| | | try { |
| | | return new SimpleDateFormat(format).parse(ts); |
| | | } |
| | | catch (ParseException e) |
| | | { |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * æ¥æè·¯å¾ å³å¹´/æ/æ¥ å¦2018/08/08 |
| | | */ |
| | | public static final String datePath() |
| | | { |
| | | public static final String datePath() { |
| | | Date now = new Date(); |
| | | return DateFormatUtils.format(now, "yyyy/MM/dd"); |
| | | } |
| | |
| | | /** |
| | | * æ¥æè·¯å¾ å³å¹´/æ/æ¥ å¦20180808 |
| | | */ |
| | | public static final String dateTime() |
| | | { |
| | | public static final String dateTime() { |
| | | Date now = new Date(); |
| | | return DateFormatUtils.format(now, "yyyyMMdd"); |
| | | } |
| | |
| | | /** |
| | | * æ¥æåå符串转åä¸ºæ¥æ æ ¼å¼ |
| | | */ |
| | | public static Date parseDate(Object str) |
| | | { |
| | | if (str == null) |
| | | { |
| | | public static Date parseDate(Object str) { |
| | | if (str == null) { |
| | | return null; |
| | | } |
| | | try |
| | | { |
| | | try { |
| | | return parseDate(str.toString(), parsePatterns); |
| | | } |
| | | catch (ParseException e) |
| | | { |
| | | } catch (ParseException e) { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * è·åæå¡å¨å¯å¨æ¶é´ |
| | | */ |
| | | public static Date getServerStartDate() |
| | | { |
| | | public static Date getServerStartDate() { |
| | | long time = ManagementFactory.getRuntimeMXBean().getStartTime(); |
| | | return new Date(time); |
| | | } |
| | |
| | | /** |
| | | * 计ç®ç¸å·®å¤©æ° |
| | | */ |
| | | public static int differentDaysByMillisecond(Date date1, Date date2) |
| | | { |
| | | public static int differentDaysByMillisecond(Date date1, Date date2) { |
| | | return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); |
| | | } |
| | | |
| | | /** |
| | | * 计ç®ä¸¤ä¸ªæ¶é´å·® |
| | | */ |
| | | public static String getDatePoor(Date endDate, Date nowDate) |
| | | { |
| | | public static String getDatePoor(Date endDate, Date nowDate) { |
| | | long nd = 1000 * 24 * 60 * 60; |
| | | long nh = 1000 * 60 * 60; |
| | | long nm = 1000 * 60; |
| | |
| | | /** |
| | | * å¢å LocalDateTime ==> Date |
| | | */ |
| | | public static Date toDate(LocalDateTime temporalAccessor) |
| | | { |
| | | public static Date toDate(LocalDateTime temporalAccessor) { |
| | | ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); |
| | | return Date.from(zdt.toInstant()); |
| | | } |
| | |
| | | /** |
| | | * å¢å LocalDate ==> Date |
| | | */ |
| | | public static Date toDate(LocalDate temporalAccessor) |
| | | { |
| | | public static Date toDate(LocalDate temporalAccessor) { |
| | | LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); |
| | | ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); |
| | | return Date.from(zdt.toInstant()); |
| | | } |
| | | |
| | | /** |
| | | * å¾åæ¨å¤å°åéï¼è·åå¾åæ¨çæ¶é´ç¹ |
| | | * |
| | | * @param minute åé |
| | | * @param timeFormat æ¶é´æ ¼å¼ |
| | | * @return |
| | | */ |
| | | public static String beforeTime(Long minute, String timeFormat) { |
| | | if (StringUtils.isEmpty(timeFormat)) { |
| | | timeFormat = YYYY_MM_DD_HH_MM_SS; |
| | | } |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | Duration tenMinutes = Duration.ofMinutes(minute); |
| | | LocalDateTime tenMinutesAgo = now.minus(tenMinutes); |
| | | Date date = Date.from(tenMinutesAgo.atZone(ZoneOffset.ofHours(8)).toInstant()); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat(timeFormat);//å¯ä»¥æ¹ä¾¿å°ä¿®æ¹æ¥ææ ¼å¼ |
| | | String nowTime_10 = dateFormat.format(date); |
| | | return nowTime_10; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.github.pagehelper.util.StringUtil; |
| | | import com.ruoyi.common.exception.HttpRequestException; |
| | | import com.ruoyi.common.utils.http.HttpEntity; |
| | | import com.ruoyi.common.utils.json.JsonRequestBody; |
| | | import com.ruoyi.common.utils.json.JsonResponseBody; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.Charsets; |
| | | import org.apache.commons.httpclient.*; |
| | | import org.apache.commons.httpclient.methods.*; |
| | | import org.apache.commons.httpclient.params.HttpClientParams; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.util.Assert; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import java.io.*; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class HttpUtil { |
| | | |
| | | protected static final int DEFAULT_STATUS_ERROR_CODE = 100001;//é»è®¤httpå¼å¸¸ç¶æç |
| | | |
| | | protected static final String CONTENT_TYPE = "Content-Type"; |
| | | |
| | | protected static final String APPLICATION_JSON = "application/json"; |
| | | protected static final String APPLICATION_JSON_UTF8 = "application/json; charset=utf-8"; |
| | | |
| | | protected static final String TEXT_XML = "text/xml"; |
| | | protected static final String TEXT_XML_UTF8 = "text/xml; charset=utf-8"; |
| | | |
| | | protected static final int OK = 200; |
| | | |
| | | |
| | | /** |
| | | * ç©ºçæ¥æå¤´ |
| | | */ |
| | | protected static final Map<String, String> EMPTY_HEADERS = new HashMap<String, String>(0); |
| | | /** |
| | | * ç¼ç é误 |
| | | */ |
| | | protected static final int ENCODING_ERROR_CODE = 999997; |
| | | /** |
| | | * HTTP é误: æ»éãæä»¶è¿å¤§çæä»¶ |
| | | */ |
| | | protected static final int HTTP_ERROR_CODE = 999996; |
| | | /** |
| | | * IO é误 |
| | | */ |
| | | protected static final int IO_ERROR_CODE = 999995; |
| | | /** |
| | | * ååºä¸ºnull |
| | | */ |
| | | protected static final int RESPONSE_NULL_ERROR_CODE = 999994; |
| | | |
| | | protected static final String USER_IP_KEY = "x-remoteip"; |
| | | |
| | | protected static final String TEXT_NORMAL = "application/x-www-form-urlencoded; charset=utf-8"; |
| | | protected static final HttpClient httpClient = getHttpClient(); |
| | | |
| | | private static final SimpleDateFormat formatHttpData = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US); |
| | | |
| | | |
| | | private static HttpClient getHttpClient() { |
| | | // æ¤å¤è¿ç¨è¿æ¥æ± ææ¯ã |
| | | MultiThreadedHttpConnectionManager manager = new MultiThreadedHttpConnectionManager(); |
| | | |
| | | // 设å®åæ°ï¼ä¸æ¯ä¸ªä¸»æºçæå¤§è¿æ¥æ° |
| | | manager.getParams().setDefaultMaxConnectionsPerHost(100); |
| | | // 设å®åæ°ï¼å®¢æ·ç«¯çæ»è¿æ¥æ° |
| | | manager.getParams().setMaxTotalConnections(400); |
| | | // è®¾ç½®è¿æ¥è¶
æ¶æ¶é´,åä½ï¼æ¯«ç§ |
| | | manager.getParams().setConnectionTimeout(8000); |
| | | // 设置请æ±è¯»åè¶
æ¶æ¶é´ï¼åä½ï¼æ¯«ç§ |
| | | manager.getParams().setSoTimeout(8000); |
| | | // 设置ä»è¿æ¥æ± ä¸è·å龿¥æ¶é´ï¼ åä½ï¼æ¯«ç§ |
| | | manager.getParams().setParameter(HttpClientParams.CONNECTION_MANAGER_TIMEOUT, 8000); |
| | | // 使ç¨è¿æ¥æ± ææ¯å建HttpClient对象 |
| | | HttpClient httpClient = new HttpClient(manager); |
| | | return httpClient; |
| | | } |
| | | |
| | | public static String postJsonRequest(String url, String request) throws HttpRequestException { |
| | | Assert.hasLength(url, "请æ±urlä¸è½ä¸ºç©ºå符串ã"); |
| | | EntityEnclosingMethod httpMethod = new PostMethod(url); |
| | | |
| | | httpMethod.addRequestHeader("Content-Type", "application/json; charset=UTF-8"); |
| | | setHeaderRequestId(httpMethod); |
| | | try { |
| | | RequestEntity entity = new StringRequestEntity(request, "application/json", "utf-8"); |
| | | httpMethod.setRequestEntity(entity); |
| | | |
| | | int resultCode = httpClient.executeMethod(httpMethod); |
| | | InputStream inputStream = httpMethod.getResponseBodyAsStream(); |
| | | if (inputStream == null) { |
| | | throw new HttpRequestException(RESPONSE_NULL_ERROR_CODE, "ååºä¸ºnull"); |
| | | } |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | String str = ""; |
| | | while ((str = reader.readLine()) != null) { |
| | | stringBuffer.append(str); |
| | | } |
| | | reader.close(); |
| | | String respJson = stringBuffer.toString(); |
| | | // String respJson = httpMethod.getResponseBodyAsString(); |
| | | if (resultCode == OK) { |
| | | return respJson; |
| | | } else { |
| | | throw new HttpRequestException(resultCode, respJson); |
| | | } |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new HttpRequestException(ENCODING_ERROR_CODE, e); |
| | | } catch (HttpException e) { |
| | | throw new HttpRequestException(HTTP_ERROR_CODE, e); |
| | | } catch (IOException e) { |
| | | throw new HttpRequestException(IO_ERROR_CODE, e); |
| | | } finally { |
| | | if (httpMethod != null) { |
| | | httpMethod.releaseConnection(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * jsonçpostè¯·æ± |
| | | * |
| | | * @param url 请æ±url |
| | | * @param reqEntity 请æ±å¤´ä¸è¯·æ±ä½çå°è£
|
| | | * @param respBodyClass ååºä½ç±»å |
| | | * @return è¿åçååºç»æ |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <RESPBODY> HttpEntity<RESPBODY> postJsonRequestV2(String url, HttpEntity<?> reqEntity, Class<RESPBODY> respBodyClass) { |
| | | Assert.hasLength(url, "请æ±urlä¸è½ä¸ºç©ºå符串ã"); |
| | | Assert.notNull(reqEntity, "请æ±requestä¸è½ä¸ºnullã"); |
| | | Assert.notNull(reqEntity.getBody(), "Post请æ±bodyä¸è½ä¸ºnullã"); |
| | | |
| | | EntityEnclosingMethod httpMethod = new PostMethod(url); |
| | | //设置headerä¿¡æ¯ |
| | | Map<String, String> headers = reqEntity.getHeaders(); |
| | | //è¥ä¼ å
¥æ¥æå¤´ï¼åè®¾ç½®å¼ |
| | | if (headers != HttpEntity.EMPTY_HEADERS) { |
| | | setReqHeaders(headers, httpMethod); |
| | | } |
| | | |
| | | //设置bodyä¿¡æ¯ |
| | | String reqJson = JSON.toJSONString(reqEntity.getBody()); |
| | | |
| | | String charset = com.google.common.base.Charsets.UTF_8.name(); |
| | | // åéå«xmlæ¶æ¯ä½ç对象 |
| | | try { |
| | | RequestEntity entity = new StringRequestEntity(reqJson, APPLICATION_JSON, charset); |
| | | httpMethod.setRequestEntity(entity); |
| | | |
| | | // æ§è¡è¯·æ±å¹¶æ¥æ¶ååºç |
| | | int resultCode = httpClient.executeMethod(httpMethod); |
| | | InputStream inputStream = httpMethod.getResponseBodyAsStream(); |
| | | if (inputStream == null) { |
| | | throw new HttpRequestException(RESPONSE_NULL_ERROR_CODE, "ååºä¸ºnull"); |
| | | } |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | String str = ""; |
| | | while ((str = reader.readLine()) != null) { |
| | | stringBuffer.append(str); |
| | | } |
| | | reader.close(); |
| | | String respStr = stringBuffer.toString(); |
| | | //String respStr = httpMethod.getResponseBodyAsString(); |
| | | if (resultCode == OK) { |
| | | //ååºå¤´ |
| | | Map<String, String> respHeaders = getRespHeaders(httpMethod); |
| | | //ååºä½ |
| | | HttpEntity<RESPBODY> rep = null; |
| | | if (isNullOrEmpty(respStr) || null == respBodyClass) { |
| | | rep = new HttpEntity<RESPBODY>(respHeaders, null); |
| | | ;// æ ååº |
| | | } else { |
| | | if (respBodyClass != String.class) { |
| | | RESPBODY respBody = JSON.parseObject(respStr, respBodyClass); |
| | | rep = new HttpEntity<RESPBODY>(respHeaders, respBody); |
| | | } else { |
| | | rep = new HttpEntity<RESPBODY>(respHeaders, (RESPBODY) respStr); |
| | | } |
| | | } |
| | | return rep; |
| | | } else if (resultCode == DEFAULT_STATUS_ERROR_CODE) { |
| | | JSONObject model = JSON.parseObject(respStr); |
| | | throw new HttpRequestException(model.getIntValue("code"), model.getString("msg")); |
| | | } else { |
| | | throw new HttpRequestException(resultCode, respStr); |
| | | } |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new HttpRequestException(ENCODING_ERROR_CODE, e); |
| | | } catch (HttpException e) { |
| | | throw new HttpRequestException(HTTP_ERROR_CODE, e); |
| | | } catch (IOException e) { |
| | | throw new HttpRequestException(IO_ERROR_CODE, e); |
| | | } finally { |
| | | if (httpMethod != null) { |
| | | httpMethod.releaseConnection(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static <RESPBODY extends JsonResponseBody> HttpEntity<RESPBODY> postJsonRequest(String url, HttpEntity<? extends JsonRequestBody> reqEntity, Class<RESPBODY> respBodyClass) { |
| | | Assert.hasLength(url, "请æ±urlä¸è½ä¸ºç©ºå符串ã"); |
| | | Assert.notNull(reqEntity, "请æ±requestä¸è½ä¸ºnullã"); |
| | | Assert.notNull(reqEntity.getBody(), "Post请æ±bodyä¸è½ä¸ºnullã"); |
| | | |
| | | EntityEnclosingMethod httpMethod = new PostMethod(url); |
| | | //设置headerä¿¡æ¯ |
| | | Map<String, String> headers = reqEntity.getHeaders(); |
| | | //è¥ä¼ å
¥æ¥æå¤´ï¼åè®¾ç½®å¼ |
| | | if (headers != HttpEntity.EMPTY_HEADERS) { |
| | | setReqHeaders(headers, httpMethod); |
| | | } |
| | | |
| | | //设置bodyä¿¡æ¯ |
| | | String reqJson = JSON.toJSONString(reqEntity.getBody()); |
| | | |
| | | String charset = Charsets.UTF_8.name(); |
| | | // åéå«xmlæ¶æ¯ä½ç对象 |
| | | try { |
| | | RequestEntity entity = new StringRequestEntity(reqJson, APPLICATION_JSON, charset); |
| | | httpMethod.setRequestEntity(entity); |
| | | |
| | | // æ§è¡è¯·æ±å¹¶æ¥æ¶ååºç |
| | | int resultCode = httpClient.executeMethod(httpMethod); |
| | | InputStream inputStream = httpMethod.getResponseBodyAsStream(); |
| | | if (inputStream == null) { |
| | | throw new HttpRequestException(RESPONSE_NULL_ERROR_CODE, "ååºä¸ºnull"); |
| | | } |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | String str = ""; |
| | | while ((str = reader.readLine()) != null) { |
| | | stringBuffer.append(str); |
| | | } |
| | | reader.close(); |
| | | String respStr = stringBuffer.toString(); |
| | | if (resultCode == OK) { |
| | | //ååºå¤´ |
| | | Map<String, String> respHeaders = getRespHeaders(httpMethod); |
| | | //ååºä½ |
| | | HttpEntity<RESPBODY> rep = null; |
| | | if (isNullOrEmpty(respStr) || null == respBodyClass) { |
| | | rep = new HttpEntity<RESPBODY>(respHeaders, null); |
| | | ;// æ ååº |
| | | } else { |
| | | RESPBODY respBody = JSON.parseObject(respStr, respBodyClass); |
| | | rep = new HttpEntity<RESPBODY>(respHeaders, respBody); |
| | | } |
| | | return rep; |
| | | } else if (resultCode == DEFAULT_STATUS_ERROR_CODE) { |
| | | JSONObject model = JSON.parseObject(respStr); |
| | | throw new HttpRequestException(model.getIntValue("code"), model.getString("msg")); |
| | | } else { |
| | | throw new HttpRequestException(resultCode, respStr); |
| | | } |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new HttpRequestException(ENCODING_ERROR_CODE, e); |
| | | } catch (HttpException e) { |
| | | throw new HttpRequestException(HTTP_ERROR_CODE, e); |
| | | } catch (IOException e) { |
| | | throw new HttpRequestException(IO_ERROR_CODE, e); |
| | | } finally { |
| | | if (httpMethod != null) { |
| | | httpMethod.releaseConnection(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static String postFormRequest(String url, Map<String, String> params) throws HttpRequestException { |
| | | Assert.hasLength(url, "请æ±urlä¸è½ä¸ºç©ºå符串ã"); |
| | | Assert.notNull(params, "请æ±paramsä¸è½ä¸ºç©ºã"); |
| | | |
| | | PostMethod httpMethod = new PostMethod(url); |
| | | |
| | | httpMethod.addRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); |
| | | |
| | | try { |
| | | // åé请æ±åæ° |
| | | StringBuilder param = new StringBuilder(); |
| | | for (Map.Entry<String, String> entry : params.entrySet()) { |
| | | if (param.length() > 0) { |
| | | param.append("&"); |
| | | } |
| | | param.append(entry.getKey()); |
| | | param.append("="); |
| | | param.append(entry.getValue()); |
| | | } |
| | | |
| | | RequestEntity entity = new StringRequestEntity(param.toString(), "application/json", "utf-8"); |
| | | httpMethod.setRequestEntity(entity); |
| | | // æ§è¡è¯·æ±å¹¶æ¥æ¶ååºç |
| | | int resultCode = httpClient.executeMethod(httpMethod); |
| | | |
| | | String respJson = httpMethod.getResponseBodyAsString(); |
| | | if (resultCode == OK) { |
| | | return respJson; |
| | | } else { |
| | | throw new HttpRequestException(resultCode, respJson); |
| | | } |
| | | } catch (UnsupportedEncodingException e) { |
| | | throw new HttpRequestException(ENCODING_ERROR_CODE, e); |
| | | } catch (HttpException e) { |
| | | throw new HttpRequestException(HTTP_ERROR_CODE, e); |
| | | } catch (IOException e) { |
| | | throw new HttpRequestException(IO_ERROR_CODE, e); |
| | | } finally { |
| | | if (httpMethod != null) { |
| | | httpMethod.releaseConnection(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private static Map<String, String> getRespHeaders(HttpMethodBase httpMethod) { |
| | | //å¾å°ååºå¤´ |
| | | Header[] respHeaders = httpMethod.getResponseHeaders(); |
| | | Map<String, String> headers = new HashMap<String, String>(respHeaders.length); |
| | | for (Header header : respHeaders) |
| | | headers.put(header.getName(), header.getValue()); |
| | | return headers; |
| | | } |
| | | |
| | | protected static void setReqHeaders(Map<String, String> headers, HttpMethodBase httpMethod) { |
| | | //设置请æ±å¤´ |
| | | for (Map.Entry<String, String> header : headers.entrySet()) { |
| | | httpMethod.addRequestHeader(header.getKey(), header.getValue()); |
| | | } |
| | | } |
| | | |
| | | protected static void setHeaderRequestId(HttpMethodBase httpMethod) { |
| | | //设置请æ±å¤´ |
| | | ServletRequestAttributes req = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
| | | if (null != req) { |
| | | String requestId = req.getRequest().getHeader("x-request-id"); |
| | | if (StringUtil.isNotEmpty(requestId)) { |
| | | httpMethod.addRequestHeader("x-request-id", requestId); |
| | | log.info("headerä¸x-request-idå¼ä¸º:{}", requestId); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private static boolean isNullOrEmpty(String obj) { |
| | | if (obj == null || obj.isEmpty()) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | |
| | | import java.nio.charset.StandardCharsets; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileUtils |
| | | { |
| | | public class FileUtils { |
| | | public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; |
| | | |
| | | /** |
| | |
| | | * @param os è¾åºæµ |
| | | * @return |
| | | */ |
| | | public static void writeBytes(String filePath, OutputStream os) throws IOException |
| | | { |
| | | public static void writeBytes(String filePath, OutputStream os) throws IOException { |
| | | FileInputStream fis = null; |
| | | try |
| | | { |
| | | try { |
| | | File file = new File(filePath); |
| | | if (!file.exists()) |
| | | { |
| | | if (!file.exists()) { |
| | | throw new FileNotFoundException(filePath); |
| | | } |
| | | fis = new FileInputStream(file); |
| | | byte[] b = new byte[1024]; |
| | | int length; |
| | | while ((length = fis.read(b)) > 0) |
| | | { |
| | | while ((length = fis.read(b)) > 0) { |
| | | os.write(b, 0, length); |
| | | } |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | } catch (IOException e) { |
| | | throw e; |
| | | } |
| | | finally |
| | | { |
| | | } finally { |
| | | IOUtils.close(os); |
| | | IOUtils.close(fis); |
| | | } |
| | |
| | | * @return ç®æ æä»¶ |
| | | * @throws IOException IOå¼å¸¸ |
| | | */ |
| | | public static String writeImportBytes(byte[] data) throws IOException |
| | | { |
| | | public static String writeImportBytes(byte[] data) throws IOException { |
| | | return writeBytes(data, RuoYiConfig.getImportPath()); |
| | | } |
| | | |
| | |
| | | * @return ç®æ æä»¶ |
| | | * @throws IOException IOå¼å¸¸ |
| | | */ |
| | | public static String writeBytes(byte[] data, String uploadDir) throws IOException |
| | | { |
| | | public static String writeBytes(byte[] data, String uploadDir) throws IOException { |
| | | FileOutputStream fos = null; |
| | | String pathName = ""; |
| | | try |
| | | { |
| | | try { |
| | | String extension = getFileExtendName(data); |
| | | pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension; |
| | | File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName); |
| | | fos = new FileOutputStream(file); |
| | | fos.write(data); |
| | | } |
| | | finally |
| | | { |
| | | } finally { |
| | | IOUtils.close(fos); |
| | | } |
| | | return FileUploadUtils.getPathFileName(uploadDir, pathName); |
| | |
| | | * @param filePath æä»¶ |
| | | * @return |
| | | */ |
| | | public static boolean deleteFile(String filePath) |
| | | { |
| | | public static boolean deleteFile(String filePath) { |
| | | boolean flag = false; |
| | | File file = new File(filePath); |
| | | // è·¯å¾ä¸ºæä»¶ä¸ä¸ä¸ºç©ºåè¿è¡å é¤ |
| | | if (file.isFile() && file.exists()) |
| | | { |
| | | if (file.isFile() && file.exists()) { |
| | | flag = file.delete(); |
| | | } |
| | | return flag; |
| | |
| | | * @param filename æä»¶åç§° |
| | | * @return true æ£å¸¸ false éæ³ |
| | | */ |
| | | public static boolean isValidFilename(String filename) |
| | | { |
| | | public static boolean isValidFilename(String filename) { |
| | | return filename.matches(FILENAME_PATTERN); |
| | | } |
| | | |
| | |
| | | * @param resource éè¦ä¸è½½çæä»¶ |
| | | * @return true æ£å¸¸ false éæ³ |
| | | */ |
| | | public static boolean checkAllowDownload(String resource) |
| | | { |
| | | public static boolean checkAllowDownload(String resource) { |
| | | // ç¦æ¢ç®å½ä¸è·³çº§å« |
| | | if (StringUtils.contains(resource, "..")) |
| | | { |
| | | if (StringUtils.contains(resource, "..")) { |
| | | return false; |
| | | } |
| | | |
| | | // æ£æ¥å
许ä¸è½½çæä»¶è§å |
| | | if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource))) |
| | | { |
| | | if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource))) { |
| | | return true; |
| | | } |
| | | |
| | |
| | | * @param fileName æä»¶å |
| | | * @return ç¼ç åçæä»¶å |
| | | */ |
| | | public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException |
| | | { |
| | | public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException { |
| | | final String agent = request.getHeader("USER-AGENT"); |
| | | String filename = fileName; |
| | | if (agent.contains("MSIE")) |
| | | { |
| | | if (agent.contains("MSIE")) { |
| | | // IEæµè§å¨ |
| | | filename = URLEncoder.encode(filename, "utf-8"); |
| | | filename = filename.replace("+", " "); |
| | | } |
| | | else if (agent.contains("Firefox")) |
| | | { |
| | | } else if (agent.contains("Firefox")) { |
| | | // ç«çæµè§å¨ |
| | | filename = new String(fileName.getBytes(), "ISO8859-1"); |
| | | } |
| | | else if (agent.contains("Chrome")) |
| | | { |
| | | } else if (agent.contains("Chrome")) { |
| | | // googleæµè§å¨ |
| | | filename = URLEncoder.encode(filename, "utf-8"); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | // å
¶å®æµè§å¨ |
| | | filename = URLEncoder.encode(filename, "utf-8"); |
| | | } |
| | |
| | | * @param response ååºå¯¹è±¡ |
| | | * @param realFileName ç宿件å |
| | | */ |
| | | public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException |
| | | { |
| | | public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException { |
| | | String percentEncodedFileName = percentEncode(realFileName); |
| | | |
| | | StringBuilder contentDispositionValue = new StringBuilder(); |
| | | contentDispositionValue.append("attachment; filename=") |
| | | .append(percentEncodedFileName) |
| | | .append(";") |
| | | .append("filename*=") |
| | | .append("utf-8''") |
| | | .append(percentEncodedFileName); |
| | | contentDispositionValue.append("attachment; filename=").append(percentEncodedFileName).append(";").append("filename*=").append("utf-8''").append(percentEncodedFileName); |
| | | |
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename"); |
| | | response.setHeader("Content-disposition", contentDispositionValue.toString()); |
| | |
| | | * @param s éè¦ç¾åå·ç¼ç çå符串 |
| | | * @return ç¾åå·ç¼ç åçå符串 |
| | | */ |
| | | public static String percentEncode(String s) throws UnsupportedEncodingException |
| | | { |
| | | public static String percentEncode(String s) throws UnsupportedEncodingException { |
| | | String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); |
| | | return encode.replaceAll("\\+", "%20"); |
| | | } |
| | |
| | | * @param photoByte å¾åæ°æ® |
| | | * @return åç¼å |
| | | */ |
| | | public static String getFileExtendName(byte[] photoByte) |
| | | { |
| | | public static String getFileExtendName(byte[] photoByte) { |
| | | String strFileExtendName = "jpg"; |
| | | if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) |
| | | && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) |
| | | { |
| | | if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) { |
| | | strFileExtendName = "gif"; |
| | | } |
| | | else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) |
| | | { |
| | | } else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) { |
| | | strFileExtendName = "jpg"; |
| | | } |
| | | else if ((photoByte[0] == 66) && (photoByte[1] == 77)) |
| | | { |
| | | } else if ((photoByte[0] == 66) && (photoByte[1] == 77)) { |
| | | strFileExtendName = "bmp"; |
| | | } |
| | | else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) |
| | | { |
| | | } else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) { |
| | | strFileExtendName = "png"; |
| | | } |
| | | return strFileExtendName; |
| | |
| | | * @param fileName è·¯å¾åç§° |
| | | * @return 没ææä»¶è·¯å¾çåç§° |
| | | */ |
| | | public static String getName(String fileName) |
| | | { |
| | | if (fileName == null) |
| | | { |
| | | public static String getName(String fileName) { |
| | | if (fileName == null) { |
| | | return null; |
| | | } |
| | | int lastUnixPos = fileName.lastIndexOf('/'); |
| | |
| | | * @param fileName è·¯å¾åç§° |
| | | * @return 没ææä»¶è·¯å¾ååç¼çåç§° |
| | | */ |
| | | public static String getNameNotSuffix(String fileName) |
| | | { |
| | | if (fileName == null) |
| | | { |
| | | public static String getNameNotSuffix(String fileName) { |
| | | if (fileName == null) { |
| | | return null; |
| | | } |
| | | String baseName = FilenameUtils.getBaseName(fileName); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.http; |
| | | |
| | | |
| | | public interface HttpBody { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.http; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class HttpEntity<T> { |
| | | |
| | | /** |
| | | * ç©ºçæ¥æå¤´ |
| | | */ |
| | | public static final Map<String, String> EMPTY_HEADERS = new HashMap<String, String>(0); |
| | | |
| | | /** |
| | | * æ¥æå¤´ |
| | | */ |
| | | private final Map<String, String> headers; |
| | | |
| | | /** |
| | | * æ¥æä½ |
| | | */ |
| | | private final T body; |
| | | |
| | | public HttpEntity(Map<String, String> headers, T body) { |
| | | this.headers = headers; |
| | | this.body = body; |
| | | } |
| | | |
| | | public HttpEntity(T body) { |
| | | this.headers = EMPTY_HEADERS; |
| | | this.body = body; |
| | | } |
| | | |
| | | public Map<String, String> getHeaders() { |
| | | return headers; |
| | | } |
| | | |
| | | public T getBody() { |
| | | return body; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.json; |
| | | |
| | | |
| | | import com.ruoyi.common.utils.http.HttpBody; |
| | | |
| | | /** |
| | | * Jsonæ ¼å¼çhttp请æ±body |
| | | */ |
| | | public interface JsonRequestBody extends HttpBody { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.json; |
| | | |
| | | |
| | | import com.ruoyi.common.utils.http.HttpBody; |
| | | |
| | | /** |
| | | * Jsonæ ¼å¼çhttpååºbody |
| | | */ |
| | | public interface JsonResponseBody extends HttpBody { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.xml; |
| | | |
| | | import com.ruoyi.common.utils.http.HttpBody; |
| | | |
| | | /** |
| | | * xmlæ ¼å¼çhttp请æ±ä½ |
| | | */ |
| | | public interface XmlRequestBody extends HttpBody { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils.xml; |
| | | |
| | | import com.ruoyi.common.utils.http.HttpBody; |
| | | |
| | | /** |
| | | * xmlæ ¼å¼çhttpååºä½ |
| | | */ |
| | | public interface XmlResponseBody extends HttpBody { |
| | | |
| | | } |
| | |
| | | // è¿æ»¤è¯·æ± |
| | | .authorizeRequests() |
| | | // 对äºç»å½login 注åregister éªè¯ç captchaImage å
许å¿åè®¿é® |
| | | .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/**").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/taskcall/phoneCallBack").permitAll() |
| | | // éæèµæºï¼å¯å¿åè®¿é® |
| | | .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() |
| | | // é¤ä¸é¢å¤çææè¯·æ±å
¨é¨éè¦é´æè®¤è¯ |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | @PostMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException { |
| | | SysJob newJob = jobService.selectJobById(job.getJobId()); |
| | | newJob.setStatus(job.getStatus()); |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/run") |
| | | @PostMapping("/run") |
| | | public AjaxResult run(@RequestBody SysJob job) throws SchedulerException { |
| | | boolean result = jobService.run(job); |
| | | return result ? success() : error("ä»»å¡ä¸åå¨æå·²è¿æï¼"); |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "宿¶ä»»å¡", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{jobIds}") |
| | | @GetMapping("/remove/{jobIds}") |
| | | public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException { |
| | | jobService.deleteJobByIds(jobIds); |
| | | return success(); |
| | |
| | | <artifactId>json-simple</artifactId> |
| | | <version>1.1.1</version> |
| | | </dependency> |
| | | |
| | | <!-- rabbitmq ä¾èµ--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-amqp</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.config; |
| | | |
| | | import com.ruoyi.common.utils.HttpUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.http.HttpEntity; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.mail.Multipart; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | public class PhoneUtils { |
| | | |
| | | @Value("${phoneIP}") |
| | | private String phoneIP; |
| | | |
| | | /** |
| | | * æ·»å åæºadd_user |
| | | */ |
| | | public String addUser(String user, String pwd) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("user", user); |
| | | map.put("password", pwd); |
| | | return sendReq(map, "/tel/ai_api/add_user"); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åæºdelete_user |
| | | * |
| | | * @return |
| | | */ |
| | | public String delUser(String user) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("user", user); |
| | | return sendReq(map, "/tel/ai_api/delete_user"); |
| | | } |
| | | |
| | | /** |
| | | * 3ãæ£æ¥åæºæ¯å¦åå¨check_user |
| | | * |
| | | * @return |
| | | */ |
| | | public String checkUser(String user) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("user", user); |
| | | return sendReq(map, "/tel/ai_api/check_user"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ååºå
¨é¨å叿è
æå®åå¸ list_agent |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public String listAgent(String name) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | return sendReq(map, "/tel/ai_api/list_agent"); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å åå¸add_agent |
| | | * åç³»ç»ä¸æ·»å ä¸ä¸ªåå¸ï¼åç»éè¦set_agent_state,set_agent_status,set_agent_contact, tier_add 设置åå¸ç¶ä½,sip_uriåæåå¸å å
¥/ç»å®ä¸ä¸ªå¼å«éå |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public String addAgent(String name, String type) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | if (StringUtils.isEmpty(type)) map.put("type", "callback"); |
| | | |
| | | return sendReq(map, "/tel/ai_api/add_agent"); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åå¸del_agent |
| | | * ä»å¼å«éåå é¤åå¸ |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public String delAgent(String name) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | return sendReq(map, "/tel/ai_api/del_agent"); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå¸å½åæå¨éè¯çuuid |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public String getAgentUUID(String name) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | return sendReq(map, "/tel/ai_api/get_agent_uuid"); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å åå¸å(add_agent)ï¼éè¦è®¾ç½®åå¸å°å(sip uri)ï¼å叿å¯ä»¥è¢«è®¿é®å° |
| | | * |
| | | * @param name |
| | | * @param contact |
| | | * @return |
| | | */ |
| | | public String setAgentUUID(String name, String contact) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | map.put("contact", contact); |
| | | return sendReq(map, "/tel/ai_api/set_agent_contact"); |
| | | } |
| | | |
| | | /** |
| | | * 设置åå¸çstatusï¼æåºå®å ä¸ªç¶æ |
| | | * |
| | | * @param name |
| | | * @param status |
| | | * @return |
| | | */ |
| | | public String setAgentStatus(String name, String status) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | map.put("status", status); |
| | | return sendReq(map, "/tel/ai_api/set_agent_status"); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå¸ç¶æ |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public String getAgentStatus(String name) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | return sendReq(map, "/tel/ai_api/get_agent_status"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设设置åå¸ |
| | | * |
| | | * @param name |
| | | * @param state |
| | | * @return |
| | | */ |
| | | public String setAgentState(String name, String state) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | map.put("state", state); |
| | | return sendReq(map, "/tel/ai_api/set_agent_state"); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå¸ç¶æ |
| | | * |
| | | * @param name |
| | | * @return |
| | | */ |
| | | public String getAgentState(String name) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", name); |
| | | return sendReq(map, "/tel/ai_api/set_agent_state"); |
| | | } |
| | | |
| | | /** |
| | | * æå¨å¤å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public String manualOutbound(String kg_uuid, String kg_file, String data, String app_id, String ani, String special_ch, String sign, String extension, String dnis, Boolean force_call) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("kg_uuid", kg_uuid); |
| | | map.put("kg_file", kg_file); |
| | | map.put("data", data); |
| | | map.put("app_id", app_id); |
| | | map.put("ani", ani); |
| | | map.put("special_ch", special_ch); |
| | | map.put("sign", sign); |
| | | map.put("extension", extension); |
| | | map.put("dnis", dnis); |
| | | map.put("force_call", force_call); |
| | | if (force_call == null) map.put("force_call", true); |
| | | return sendReq(map, "/tel/ai_api/set_agent_state"); |
| | | } |
| | | |
| | | /** |
| | | * ttsåæåææ¾ |
| | | * |
| | | * @param fileText |
| | | * @param uuid |
| | | * @return |
| | | */ |
| | | public String ttsPlayback(String fileText, String uuid) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("text", fileText); |
| | | map.put("uuid", uuid); |
| | | |
| | | return sendReq(map, "/tel/ai_api/set_agent_state"); |
| | | } |
| | | |
| | | /** |
| | | * wavæä»¶ææ¾æ¥å£ |
| | | * |
| | | * @param wav_file |
| | | * @param uuid |
| | | * @return |
| | | */ |
| | | public String manualOutbound(Multipart wav_file, String uuid) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("wav_file", wav_file); |
| | | map.put("uuid", uuid); |
| | | |
| | | return sendReq(map, "/tel/ai_api/set_agent_state"); |
| | | } |
| | | |
| | | /** |
| | | * æºå¨äººå¤å¼ ob |
| | | * |
| | | * @return |
| | | */ |
| | | public String ob(String kg_uuid, String kg_file, String data, String app_id, String ani, String special_ch, String sign, String extension, String dnis, Boolean call_uuid, Boolean force_call) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("kg_uuid", kg_uuid); |
| | | map.put("kg_file", kg_file); |
| | | map.put("data", data); |
| | | map.put("app_id", app_id); |
| | | map.put("ani", ani); |
| | | map.put("special_ch", special_ch); |
| | | map.put("sign", sign); |
| | | map.put("extension", extension); |
| | | map.put("dnis", dnis); |
| | | map.put("call_uuid", call_uuid); |
| | | map.put("force_call", force_call); |
| | | if (force_call == null) map.put("force_call", true); |
| | | return sendReq(map, "/tel/ai_api/set_agent_state"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ææéè¯ |
| | | * |
| | | * @return |
| | | */ |
| | | public String hangup(String kg_uuid, String dnis, String data, String app_id, String ani, String special_ch, String sign, Boolean call_uuid) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("kg_uuid", kg_uuid); |
| | | map.put("data", data); |
| | | map.put("app_id", app_id); |
| | | map.put("ani", ani); |
| | | map.put("special_ch", special_ch); |
| | | map.put("sign", sign); |
| | | map.put("dnis", dnis); |
| | | map.put("call_uuid", call_uuid); |
| | | return sendReq(map, "/tel/ai_api/set_agent_state"); |
| | | } |
| | | |
| | | private String sendReq(Map<String, Object> map, String path) { |
| | | HttpEntity<Map<String, Object>> req = new HttpEntity<>(getHead(), map); |
| | | HttpEntity<String> stringHttpEntity = HttpUtil.postJsonRequestV2(phoneIP + path, req, String.class); |
| | | return stringHttpEntity.getBody(); |
| | | } |
| | | |
| | | private Map<String, String> getHead() { |
| | | HashMap<String, String> header = new HashMap<>(); |
| | | header.put("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"); |
| | | header.put("Content-Type", "application/json"); |
| | | return header; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.config; |
| | | |
| | | import org.springframework.amqp.core.*; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Configuration |
| | | public class RabbitMqConfig { |
| | | // public static final String EXCHANGE_NAME = "phone_topic_exchange2"; |
| | | // public static final String QUEUE_NAME = "phone_queue"; |
| | | // |
| | | // /** |
| | | // * topicäº¤æ¢æº,å¹¶æä¹
å |
| | | // */ |
| | | // @Bean(EXCHANGE_NAME) |
| | | // public Exchange phoneExchange() { |
| | | // Map<String, Object> arguments = new HashMap<>(); |
| | | // //æå®éä¿¡æ¹å¼ä¸ºtopic |
| | | // arguments.put("x-delayed-type", "topic"); |
| | | // //使ç¨CustomExchangeç±»å建ï¼ç±»åè¦æå®ä¸ºâx-delayed-messageâç±»å |
| | | // Exchange exchange = new CustomExchange(EXCHANGE_NAME, "x-delayed-message", true, false, arguments); |
| | | // return exchange; |
| | | // |
| | | //// |
| | | //// return ExchangeBuilder.topicExchange(EXCHANGE_NAME).durable(true).build(); |
| | | // } |
| | | // |
| | | // |
| | | // /** |
| | | // * éå |
| | | // */ |
| | | // @Bean(QUEUE_NAME) |
| | | // public Queue phoneQueue() { |
| | | // return QueueBuilder.durable(QUEUE_NAME).build(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * äº¤æ¢æºä¸éåçç»å® |
| | | // */ |
| | | // @Bean |
| | | // public Binding bindQueueExchange(@Qualifier(QUEUE_NAME) Queue phoneQueue, @Qualifier(EXCHANGE_NAME) Exchange phoneExchange) { |
| | | // return BindingBuilder.bind(phoneQueue).to(phoneExchange).with(" phone.#").noargs(); |
| | | // } |
| | | //å®ä¹å»¶è¿éå |
| | | public static final String phone_queue = "phone_queue"; |
| | | //å®ä¹å»¶è¿äº¤æ¢æº |
| | | public static final String phone_exchange = "phone_exchange"; |
| | | //å®ä¹è·¯ç±é® |
| | | public static final String routing_key = "phone.123"; |
| | | |
| | | |
| | | /** |
| | | * å®ä¹å»¶è¿éå |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public Queue delayQueue() { |
| | | return new Queue(phone_queue, true); |
| | | } |
| | | |
| | | /** |
| | | * å»¶æ¶éåäº¤æ¢æº |
| | | * äº¤æ¢æºç±»åï¼CustomExchange |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public CustomExchange delayExchange() { |
| | | Map<String, Object> args = new HashMap<>(); |
| | | args.put("x-delayed-type", "topic"); |
| | | return new CustomExchange(phone_exchange, "x-delayed-message", true, false, args); |
| | | } |
| | | |
| | | /** |
| | | * 为延è¿éåç»å®äº¤æ¢æº |
| | | * |
| | | * @param queue |
| | | * @param exchange |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public Binding delayBinding(Queue queue, CustomExchange exchange) { |
| | | return BindingBuilder.bind(queue).to(exchange).with(routing_key).noargs(); |
| | | } |
| | | |
| | | } |
| | |
| | | * 主é®id |
| | | */ |
| | | @ApiModelProperty("主é®id") |
| | | private String ID; |
| | | private Long ID; |
| | | |
| | | /** |
| | | * 模çåå |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | * 主é®id |
| | | */ |
| | | @ApiModelProperty("主é®id") |
| | | private String ID; |
| | | private Long ID; |
| | | |
| | | /** |
| | | * 模çåºid |
| | | */ |
| | | @Excel(name = "模çåºid") |
| | | @ApiModelProperty("模çåºid") |
| | | private String extID; |
| | | private Long extID; |
| | | |
| | | /** |
| | | * åºå·id |
| | |
| | | private String switchWav; |
| | | |
| | | /** |
| | | * å¹é
è§å |
| | | * å¹é
è§å(å
å«å
³ç³») |
| | | */ |
| | | @Excel(name = "å¹é
è§å") |
| | | @ApiModelProperty("å¹é
è§å") |
| | | @Excel(name = "å¹é
è§å(å
å«å
³ç³»)") |
| | | @ApiModelProperty("å¹é
è§å(å
å«å
³ç³»)") |
| | | private String selfRegex; |
| | | |
| | | /** |
| | | * å¹é
è§å(ä¸å
å«å
³ç³») |
| | | */ |
| | | @Excel(name = "å¹é
è§å(ä¸å
å«å
³ç³»)") |
| | | @ApiModelProperty("å¹é
è§å(ä¸å
å«å
³ç³»)") |
| | | private String selfRegex2; |
| | | |
| | | |
| | | |
| | | @Excel(name = "æ£åå
³é®åéå(å«)") |
| | | private String nodynamiccruxsJson; |
| | | |
| | | @Excel(name = "æ£åå
³é®åéå(ä¸å«)") |
| | | private String dynamiccruxsJson; |
| | | |
| | | @ApiModelProperty(value = "æ£åå
³é®å(å«)") |
| | | @Excel(name = "æ£åå
³é®å(å«)") |
| | | private List<String> nodynamiccruxs = new ArrayList<>(); |
| | | |
| | | @ApiModelProperty(value = "æ£åå
³é®å(ä¸å«)") |
| | | @Excel(name = "æ£åå
³é®å(ä¸å«)") |
| | | private List<String> dynamiccruxs = new ArrayList<>(); |
| | | /** |
| | | * å¯ç¨ |
| | | */ |
| | |
| | | private Long pid; |
| | | |
| | | /** |
| | | * æ¯å¦ç»æ 0ï¼ä¸ç»æ 1ï¼ç»æ |
| | | */ |
| | | @Excel(name = "æ¯å¦ç»æ 0ï¼ä¸ç»æ 1ï¼ç»æ") |
| | | @ApiModelProperty("æ¯å¦ç»æ 0ï¼ä¸ç»æ 1ï¼ç»æ") |
| | | private Long isEnd; |
| | | |
| | | /** |
| | | * GUID |
| | | */ |
| | | @Excel(name = "GUID") |
| | |
| | | } |
| | | |
| | | public void setNodynamiccruxsJson(String nodynamiccruxsJson) { |
| | | if (this.nodynamiccruxs != null) { |
| | | this.nodynamiccruxsJson = new Gson().toJson(this.nodynamiccruxs); |
| | | } else { |
| | | this.nodynamiccruxsJson = nodynamiccruxsJson; |
| | | } |
| | | } |
| | | |
| | | public String getDynamiccruxsJson() { |
| | |
| | | } |
| | | |
| | | public void setDynamiccruxsJson(String dynamiccruxsJson) { |
| | | if (this.dynamiccruxs != null) { |
| | | this.dynamiccruxsJson = new Gson().toJson(this.dynamiccruxs); |
| | | } else { |
| | | this.dynamiccruxsJson = dynamiccruxsJson; |
| | | } |
| | | } |
| | | |
| | | public List<String> getNodynamiccruxs() { |
| | |
| | | } |
| | | |
| | | public void setNodynamiccruxsJson(String nodynamiccruxsJson) { |
| | | if (this.nodynamiccruxs != null) { |
| | | this.nodynamiccruxsJson = new Gson().toJson(this.nodynamiccruxs); |
| | | } else { |
| | | this.nodynamiccruxsJson = nodynamiccruxsJson; |
| | | } |
| | | } |
| | | |
| | | public String getDynamiccruxsJson() { |
| | |
| | | } |
| | | |
| | | public void setDynamiccruxsJson(String dynamiccruxsJson) { |
| | | if (this.dynamiccruxs != null) { |
| | | this.dynamiccruxsJson = new Gson().toJson(this.dynamiccruxs); |
| | | } else { |
| | | this.dynamiccruxsJson = dynamiccruxsJson; |
| | | } |
| | | } |
| | | |
| | | public List<String> getNodynamiccruxs() { |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | /** |
| | | * éç¨å¹é
è¯æ¯id |
| | | */ |
| | | @Excel(name = "éç¨å¹é
è¯æ¯id") |
| | | @ApiModelProperty(value = "éç¨å¹é
è¯æ¯id") |
| | | @Excel(name = "éç¨å¹é
è¯æ¯idï¼éç¨æ¨¡æ¿IDï¼") |
| | | @ApiModelProperty(value = "éç¨å¹é
è¯æ¯idï¼éç¨æ¨¡æ¿IDï¼") |
| | | private String submoduleID; |
| | | |
| | | /** |
| | |
| | | private Long mateNum; |
| | | |
| | | /** |
| | | * é黿¬¡æ° |
| | | */ |
| | | @Excel(name = "é黿¬¡æ°") |
| | | @ApiModelProperty(value = "é黿¬¡æ°") |
| | | private Long noVoiceNum = 0L; |
| | | |
| | | /** |
| | | * GUID |
| | | */ |
| | | @Excel(name = "GUID") |
| | |
| | | private String otherdata; |
| | | |
| | | /** |
| | | * é访å |
| | | * é访åè¯æ¯ï¼å¼åºç½ï¼ |
| | | */ |
| | | @Excel(name = "é访å") |
| | | @ApiModelProperty(value = "é访å") |
| | | @Excel(name = "é访åè¯æ¯ï¼å¼åºç½ï¼") |
| | | @ApiModelProperty(value = "é访åè¯æ¯ï¼å¼åºç½ï¼") |
| | | private String revisitBefore; |
| | | |
| | | /** |
| | | * é访å |
| | | */ |
| | | @Excel(name = "é访å") |
| | | @ApiModelProperty(value = "é访å") |
| | | @Excel(name = "é访åè¯æ¯ï¼ç»æè¯ï¼") |
| | | @ApiModelProperty(value = "é访åè¯æ¯ï¼ç»æè¯ï¼") |
| | | private String revisitAfter; |
| | | |
| | | |
| | | } |
| | |
| | | private Integer targettype; |
| | | |
| | | /** |
| | | * ä¸ä¸é¢ |
| | | */ |
| | | @ApiModelProperty(value = "ä¸ä¸é¢") |
| | | private Integer nextQuestion; |
| | | |
| | | /** |
| | | * æ¯å¦å卿ä½ï¼1 æ°å¢ 2ä¿®æ¹ 3å é¤ |
| | | */ |
| | | @ApiModelProperty(value = "ææ ID") |
| | | private Long targetid; |
| | | private Integer targetid; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiModelProperty(value = "ææ å¼") |
| | | private Integer targetvalue; |
| | | |
| | | /** |
| | | * æ ç¾ |
| | | */ |
| | | @Excel(name = "å
¶å®æ°æ®ï¼åå¨åéï¼") |
| | | @ApiModelProperty(value = "å
¶å®æ°æ®ï¼åå¨åéï¼") |
| | | private String otherdata; |
| | | } |
| | |
| | | /** |
| | | * åºç¡ææ id |
| | | */ |
| | | @ApiModelProperty(value = "åºç¡ææ id") |
| | | @ApiModelProperty(value = "åºç¡ææ id(ææ¶å½æ¬é¢åºå·)") |
| | | private Integer targetid; |
| | | |
| | | |
| | |
| | | private String questiontitle; |
| | | |
| | | /** |
| | | * ä¸ä¸é¢ |
| | | */ |
| | | @ApiModelProperty(value = "ä¸ä¸é¢") |
| | | private Integer nextQuestion; |
| | | |
| | | /** |
| | | * æ ç¾ |
| | | */ |
| | | @Excel(name = "å
¶å®æ°æ®ï¼åå¨åéï¼") |
| | | @ApiModelProperty(value = "å
¶å®æ°æ®ï¼åå¨åéï¼") |
| | | private String otherdata; |
| | | |
| | | /** |
| | | * è¯æ¯é项 |
| | | */ |
| | | @ApiModelProperty(value = "è¯æ¯é项") |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.google.gson.Gson; |
| | | 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 org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ¨¡æ¿ææ é项åºå¯¹è±¡ ivr_liba_template_targetoption |
| | |
| | | * @author ruoyi |
| | | * @date 2023-12-23 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "IvrLibaTemplateTargetoption", description = "æ¨¡æ¿ææ é项åºå¯¹è±¡") |
| | | public class IvrLibaTemplateTargetoption extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | @ApiModelProperty(value = "æ¯å¦å卿ä½ï¼1 æ°å¢ 2ä¿®æ¹ 3å é¤") |
| | | private Integer isoperation; |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | /** |
| | | * æ¯å¦æ¯ç¨æ·éæ©çé项 |
| | | */ |
| | | @ApiModelProperty(value = "æ¯å¦æ¯ç¨æ·éæ©çé项") |
| | | private Boolean isUserOperation = false; |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getTargetid() { |
| | | return targetid; |
| | | } |
| | | /** |
| | | * ä¸ä¸é¢ |
| | | */ |
| | | @ApiModelProperty(value = "ä¸ä¸é¢") |
| | | private Integer nextQuestion; |
| | | |
| | | public void setTargetid(Long targetid) { |
| | | this.targetid = targetid; |
| | | } |
| | | |
| | | public String getTargetname() { |
| | | return targetname; |
| | | } |
| | | |
| | | public void setTargetname(String targetname) { |
| | | this.targetname = targetname; |
| | | } |
| | | |
| | | public Long getTemplateID() { |
| | | return templateID; |
| | | } |
| | | |
| | | public void setTemplateID(Long templateID) { |
| | | this.templateID = templateID; |
| | | } |
| | | |
| | | public Long getScriptid() { |
| | | return scriptid; |
| | | } |
| | | |
| | | public void setScriptid(Long scriptid) { |
| | | this.scriptid = scriptid; |
| | | } |
| | | |
| | | public String getTargettype() { |
| | | return targettype; |
| | | } |
| | | |
| | | public void setTargettype(String targettype) { |
| | | this.targettype = targettype; |
| | | } |
| | | |
| | | public String getCategoryName() { |
| | | return categoryName; |
| | | } |
| | | |
| | | public void setCategoryName(String categoryName) { |
| | | this.categoryName = categoryName; |
| | | } |
| | | |
| | | public String getTargetvalue() { |
| | | return targetvalue; |
| | | } |
| | | |
| | | public void setTargetvalue(String targetvalue) { |
| | | this.targetvalue = targetvalue; |
| | | } |
| | | |
| | | public String getTargetregex() { |
| | | return targetregex; |
| | | } |
| | | |
| | | public void setTargetregex(String targetregex) { |
| | | this.targetregex = targetregex; |
| | | } |
| | | |
| | | public String getTargetregex2() { |
| | | return targetregex2; |
| | | } |
| | | |
| | | public void setTargetregex2(String targetregex2) { |
| | | this.targetregex2 = targetregex2; |
| | | } |
| | | |
| | | public String getNodynamiccruxsJson() { |
| | | return nodynamiccruxsJson; |
| | | } |
| | | |
| | | public void setNodynamiccruxsJson(String nodynamiccruxsJson) { |
| | | if (this.nodynamiccruxs != null) { |
| | | this.nodynamiccruxsJson = new Gson().toJson(this.nodynamiccruxs); |
| | | } else { |
| | | this.nodynamiccruxsJson = nodynamiccruxsJson; |
| | | } |
| | | } |
| | | |
| | | public String getDynamiccruxsJson() { |
| | | return dynamiccruxsJson; |
| | | } |
| | | |
| | | public void setDynamiccruxsJson(String dynamiccruxsJson) { |
| | | if (this.dynamiccruxs != null) { |
| | | this.dynamiccruxsJson = new Gson().toJson(this.dynamiccruxs); |
| | | } else { |
| | | this.dynamiccruxsJson = dynamiccruxsJson; |
| | | } |
| | | } |
| | | |
| | | public List<String> getNodynamiccruxs() { |
| | | return nodynamiccruxs; |
| | | } |
| | | |
| | | public void setNodynamiccruxs(List<String> nodynamiccruxs) { |
| | | this.nodynamiccruxs = nodynamiccruxs; |
| | | } |
| | | |
| | | public List<String> getDynamiccruxs() { |
| | | return dynamiccruxs; |
| | | } |
| | | |
| | | public void setDynamiccruxs(List<String> dynamiccruxs) { |
| | | this.dynamiccruxs = dynamiccruxs; |
| | | } |
| | | |
| | | public String getOptiondesc() { |
| | | return optiondesc; |
| | | } |
| | | |
| | | public void setOptiondesc(String optiondesc) { |
| | | this.optiondesc = optiondesc; |
| | | } |
| | | |
| | | public String getLanguage() { |
| | | return language; |
| | | } |
| | | |
| | | public void setLanguage(String language) { |
| | | this.language = language; |
| | | } |
| | | |
| | | public String getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(String version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | public String getGroupid() { |
| | | return groupid; |
| | | } |
| | | |
| | | public void setGroupid(String groupid) { |
| | | this.groupid = groupid; |
| | | } |
| | | |
| | | public Long getIsabnormal() { |
| | | return isabnormal; |
| | | } |
| | | |
| | | public void setIsabnormal(Long isabnormal) { |
| | | this.isabnormal = isabnormal; |
| | | } |
| | | |
| | | public Long getWarnup() { |
| | | return warnup; |
| | | } |
| | | |
| | | public void setWarnup(Long warnup) { |
| | | this.warnup = warnup; |
| | | } |
| | | |
| | | public Long getWarndown() { |
| | | return warndown; |
| | | } |
| | | |
| | | public void setWarndown(Long warndown) { |
| | | this.warndown = warndown; |
| | | } |
| | | |
| | | public String getDelFlag() { |
| | | return delFlag; |
| | | } |
| | | |
| | | public void setDelFlag(String delFlag) { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public Long getIsupload() { |
| | | return isupload; |
| | | } |
| | | |
| | | public void setIsupload(Long isupload) { |
| | | this.isupload = isupload; |
| | | } |
| | | |
| | | public Date getUploadTime() { |
| | | return uploadTime; |
| | | } |
| | | |
| | | public void setUploadTime(Date uploadTime) { |
| | | this.uploadTime = uploadTime; |
| | | } |
| | | |
| | | public String getOrgid() { |
| | | return orgid; |
| | | } |
| | | |
| | | public void setOrgid(String orgid) { |
| | | this.orgid = orgid; |
| | | } |
| | | |
| | | public Long getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(Long pid) { |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getGuid() { |
| | | return guid; |
| | | } |
| | | |
| | | public void setGuid(String guid) { |
| | | this.guid = guid; |
| | | } |
| | | |
| | | public Integer getIsoperation() { |
| | | return isoperation; |
| | | } |
| | | |
| | | public void setIsoperation(Integer isoperation) { |
| | | this.isoperation = isoperation; |
| | | } |
| | | } |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | |
| | | /** |
| | | * éç¨å¹é
è¯æ¯id |
| | | */ |
| | | @Excel(name = "éç¨å¹é
è¯æ¯id") |
| | | @ApiModelProperty(value = "éç¨å¹é
è¯æ¯id") |
| | | @Excel(name = "éç¨å¹é
è¯æ¯idï¼éç¨æ¨¡æ¿IDï¼") |
| | | @ApiModelProperty(value = "éç¨å¹é
è¯æ¯idï¼éç¨æ¨¡æ¿IDï¼") |
| | | private String submoduleID; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Excel(name = "æ å¹é
次æ°") |
| | | @ApiModelProperty(value = "æ å¹é
次æ°") |
| | | private Long mateNum; |
| | | private Long mateNum = 0L; |
| | | |
| | | /** |
| | | * GUID |
| | |
| | | private String suitway; |
| | | |
| | | /** |
| | | * é黿¬¡æ° |
| | | */ |
| | | @Excel(name = "é黿¬¡æ°") |
| | | @ApiModelProperty(value = "é黿¬¡æ°") |
| | | private Long noVoiceNum = 0L; |
| | | |
| | | /** |
| | | * æ ç¾ |
| | | */ |
| | | @Excel(name = "å
¶å®æ°æ®ï¼åå¨åéï¼") |
| | | @ApiModelProperty(value = "å
¶å®æ°æ®ï¼åå¨åéï¼") |
| | | private String otherdata; |
| | | |
| | | /** |
| | | * æ¯å¦å卿ä½ï¼1 æ°å¢ 2ä¿®æ¹ 3å é¤ |
| | | */ |
| | | @ApiModelProperty(value = "æ¯å¦å卿ä½ï¼1 æ°å¢ 2ä¿®æ¹ 3å é¤") |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | */ |
| | | @ApiModelProperty(value = "主é®") |
| | | private Long id; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @ApiModelProperty(value = "ä»»å¡ID") |
| | | private Long taskid; |
| | | |
| | | /** |
| | | * åé人 |
| | |
| | | private String textParam; |
| | | |
| | | /** |
| | | * 宣æå½¢å¼ :ææ¬ãå¾çãè¯é³ãè§é¢ãæ··å |
| | | * 宣æå½¢å¼ : 1,çä¿¡ã2,线ä¸ã3,è¯é³ã4,è§é¢ã5,纸质 6.龿¥ 7.éé 8.微信 |
| | | */ |
| | | @Excel(name = " 宣æå½¢å¼ :ææ¬ãå¾çãè¯é³ãè§é¢ãæ··å") |
| | | @ApiModelProperty("宣æå½¢å¼ : 1,ææ¬ã2,å¾çã3,è¯é³ã4,è§é¢ã5,æ··å") |
| | | @Excel(name = " 宣æå½¢å¼ : 1,çä¿¡ã2,线ä¸ã3,è¯é³ã4,è§é¢ã5,纸质 6.äºç»´ç 7.éé 8.微信") |
| | | @ApiModelProperty("宣æå½¢å¼ : 1,çä¿¡ã2,线ä¸ã3,è¯é³ã4,è§é¢ã5,纸质 6.龿¥ 7.éé 8.微信") |
| | | private String serviceform; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "pageSize") |
| | | private Integer pageSize; |
| | | |
| | | |
| | | /** |
| | | * åéç±»å: 1 æ¶é´æ®µ 2 æ¶é´ç¹ 3 å³å»åé |
| | | */ |
| | | @ApiModelProperty(value = "åéç±»å: 1 æ¶é´æ®µ 2 æ¶é´ç¹ 3 å³å»åé") |
| | | private String sendType; |
| | | |
| | | |
| | | |
| | | /** |
| | | * åéæ¶é´æ®µ |
| | | */ |
| | | @Excel(name = "åéæ¶é´æ®µ") |
| | | @ApiModelProperty(value = "åéæ¶é´æ®µ") |
| | | private String sendTimeSlot; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * MQä»»å¡ |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-02-02 |
| | | */ |
| | | @Data |
| | | public class IvrTaskcallMQ extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä»»å¡ID |
| | | */ |
| | | @Excel(name = " ä»»å¡ID ") |
| | | @ApiModelProperty(value = "ä»»å¡ID") |
| | | private Long taskid; |
| | | |
| | | /** |
| | | * 模æ¿ID |
| | | */ |
| | | @Excel(name = " 模æ¿ID") |
| | | @ApiModelProperty(value = "模æ¿ID") |
| | | private String templateid; |
| | | |
| | | /** |
| | | * 模æ¿ç±»å |
| | | */ |
| | | @Excel(name = " 模æ¿ç±»å") |
| | | @ApiModelProperty(value = "模æ¿ç±»å") |
| | | private String templateType; |
| | | |
| | | |
| | | /** |
| | | * åéç±»å: 1 æ¶é´æ®µ 2 æ¶é´ç¹ 3 å³å»åé |
| | | */ |
| | | @ApiModelProperty(value = "åéç±»å: 1 æ¶é´æ®µ 2 å³å»åé") |
| | | private String sendType; |
| | | |
| | | |
| | | /** |
| | | * åéæ¶é´æ®µ |
| | | */ |
| | | @ApiModelProperty(value = "åéæ¶é´æ®µ ") |
| | | private List<TaskSendTimeVO> sendTimeslot; |
| | | |
| | | } |
| | |
| | | private String templatename; |
| | | |
| | | /** |
| | | * åéç±»å: 1 æ¶é´æ®µ 2 æ¶é´ç¹ 3 å³å»åé |
| | | */ |
| | | @ApiModelProperty(value = "åéç±»å: 1 æ¶é´æ®µ 2 å³å»åé") |
| | | private String sendType; |
| | | |
| | | /** |
| | | * å鿥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | |
| | | * åéç¶æ |
| | | */ |
| | | @Excel(name = " åéç¶æ ") |
| | | @ApiModelProperty(value = "åéç¶æ") |
| | | @ApiModelProperty(value = "åéç¶æ ï¼1 å¼å§ 2 䏿¢ 3 ç»æ") |
| | | private Long sendstate; |
| | | |
| | | /** |
| | |
| | | private String preachcontent; |
| | | |
| | | |
| | | /** |
| | | * åéæ¶é´æ®µ |
| | | */ |
| | | @ApiModelProperty(value = "åéæ¶é´æ®µ ") |
| | | private List<TaskSendTimeVO> sendTimeslot; |
| | | |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId()).append("sendname", getSendname()).append("phone", getPhone()).append("sex", getSex()).append("age", getAge()).append("sfzh", getSfzh()).append("addr", getAddr()).append("senderdetail", getSenderdetail()).append("type", getType()).append("taskid", getTaskid()).append("templateid", getTemplateid()).append("templatename", getTemplatename()).append("senddate", getSenddate()).append("sendlimitabegin", getSendlimitabegin()).append("sendlimitaend", getSendlimitaend()).append("sendlimitpbegin", getSendlimitpbegin()).append("sendlimitpend", getSendlimitpend()).append("sendlimitnbegin", getSendlimitnbegin()).append("sendlimitnend", getSendlimitnend()).append("sendstate", getSendstate()).append("senduuid", getSenduuid()).append("result", getResult()).append("finishtime", getFinishtime()).append("userid", getUserid()).append("username", getUsername()).append("outbounduuid", getOutbounduuid()).append("recordid", getRecordid()).append("recallcount", getRecallcount()).append("exrecallcount", getExrecallcount()).append("pulltime", getPulltime()).append("bqsms", getBqsms()).append("bhsms", getBhsms()).append("deptcode", getDeptcode()).append("labelstatus", getLabelstatus()).append("delFlag", getDelFlag()).append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("createBy", getCreateBy()).append("createTime", getCreateTime()).append("isupload", getIsupload()).append("uploadTime", getUploadTime()).append("orgid", getOrgid()).append("pid", getPid()).append("guid", getGuid()).append("textParam", getTextParam()).toString(); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.smartor.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class QuestionMessage { |
| | | // //é¢å·targetId |
| | | // private Integer code; |
| | | //è¿åçå
容 |
| | | private String content; |
| | | |
| | | //å¼åºç½ |
| | | private String kcb = null; |
| | | |
| | | //ç»æè¯ |
| | | private String jsy = null; |
| | | |
| | | //å½åé®é¢ |
| | | private IvrLibaTemplateScriptVO nowQuestion = new IvrLibaTemplateScriptVO(); |
| | | |
| | | //é®é¢æ¸
å |
| | | private List<IvrLibaTemplateScriptVO> questionList = new ArrayList(); |
| | | |
| | | |
| | | } |
| | |
| | | private String type; |
| | | //å
容ï¼åéçææ¬å
å®¹ï¼ |
| | | private String content; |
| | | //模æ¿ID |
| | | private Long templateId; |
| | | //é®é¢ä¿¡æ¯ |
| | | private QuestionMessage questionMessage; |
| | | |
| | | //ç¨æ·IDï¼æ¥æ¶æ¾ï¼ |
| | | private String userId; |
| | | //å¾ç |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * åä¸ä»»å¡åéæ¶é´ |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-02-02 |
| | | */ |
| | | @Data |
| | | public class TaskSendTimeVO { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å¼å§æ¶é´") |
| | | private String begantime; |
| | | |
| | | /** |
| | | * 宣æå
容 |
| | | */ |
| | | @ApiModelProperty(value = "ç»ææ¶é´") |
| | | private String endtime; |
| | | |
| | | /** |
| | | * åºå· |
| | | */ |
| | | @ApiModelProperty(value = "åºå·") |
| | | private Integer xh; |
| | | |
| | | |
| | | } |
| | |
| | | * @param ivrLibaExtemplate éè¿æ¨¡æ¿ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate); |
| | | public Boolean insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate); |
| | | |
| | | /** |
| | | * ä¿®æ¹éè¿æ¨¡æ¿ |
| | |
| | | * @param ID éè¿æ¨¡æ¿ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteIvrLibaExtemplateByID(String ID); |
| | | public int deleteIvrLibaExtemplateByID(Long ID); |
| | | |
| | | /** |
| | | * æ¹éå é¤éè¿æ¨¡æ¿ |
| | |
| | | * @param IDs éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteIvrLibaExtemplateByIDs(String[] IDs); |
| | | public int deleteIvrLibaExtemplateByIDs(Long[] IDs); |
| | | } |
| | |
| | | |
| | | import com.smartor.domain.IvrLibaExtemplatescript; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @date 2023-12-27 |
| | | */ |
| | | @Mapper |
| | | public interface IvrLibaExtemplatescriptMapper |
| | | { |
| | | public interface IvrLibaExtemplatescriptMapper { |
| | | /** |
| | | * æ¥è¯¢éç¨æ¨¡æ¿è¯æ¯ |
| | | * |
| | |
| | | * @return éç¨æ¨¡æ¿è¯æ¯éå |
| | | */ |
| | | public List<IvrLibaExtemplatescript> selectIvrLibaExtemplatescriptList(IvrLibaExtemplatescript ivrLibaExtemplatescript); |
| | | |
| | | /** |
| | | * æ¥è¯¢éç¨æ¨¡æ¿è¯æ¯å表 |
| | | * |
| | | * @param IDs éç¨æ¨¡æ¿è¯æ¯éè¿ids |
| | | * @return éç¨æ¨¡æ¿è¯æ¯éå |
| | | */ |
| | | public List<IvrLibaExtemplatescript> queryIvrLibaExtemplatescriptList(@Param("IDs")List<Long> IDs); |
| | | |
| | | /** |
| | | * æ°å¢éç¨æ¨¡æ¿è¯æ¯ |
| | |
| | | * @param ID éç¨æ¨¡æ¿è¯æ¯ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteIvrLibaExtemplatescriptByID(String ID); |
| | | public int deleteIvrLibaExtemplatescriptByID(Long ID); |
| | | |
| | | /** |
| | | * æ¹éå é¤éç¨æ¨¡æ¿è¯æ¯ |
| | |
| | | * @param IDs éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteIvrLibaExtemplatescriptByIDs(String[] IDs); |
| | | public int deleteIvrLibaExtemplatescriptByIDs(Long[] IDs); |
| | | } |
| | |
| | | package com.smartor.mapper; |
| | | |
| | | import com.smartor.domain.IvrTaskcall; |
| | | import com.smartor.domain.IvrTaskcallVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public List<IvrTaskcall> selectIvrTaskcallList(IvrTaskcall ivrTaskcall); |
| | | |
| | | public IvrTaskcallVO queryTaskByCondition(IvrTaskcallVO ivrTaskcallVO); |
| | | |
| | | /** |
| | | * æ°å¢åä¸ä»»å¡ï¼éè®¿ï¼ |
| | | * |
| | |
| | | /** |
| | | * ä¿®æ¹åä¸ä»»å¡ï¼éè®¿ï¼ |
| | | * |
| | | * @param ivrTaskcall åä¸ä»»å¡ï¼éè®¿ï¼ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateIvrTaskcall(IvrTaskcall ivrTaskcall); |
| | |
| | | */ |
| | | public int deleteIvrTaskcallById(Long id); |
| | | |
| | | /** |
| | | * å é¤åä¸ä»»å¡ï¼éè®¿ï¼ |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public List<IvrTaskcall> getDataByTime(@Param("beganTime") String beganTime, @Param("endTime") String endTime); |
| | | |
| | | } |
| | |
| | | * @param ivrLibaExtemplate éè¿æ¨¡æ¿ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate); |
| | | public IvrLibaExtemplate insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate); |
| | | |
| | | /** |
| | | * ä¿®æ¹éè¿æ¨¡æ¿ |
| | |
| | | * @param IDs éè¦å é¤çéè¿æ¨¡æ¿ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteIvrLibaExtemplateByIDs(String[] IDs); |
| | | public int deleteIvrLibaExtemplateByIDs(Long[] IDs); |
| | | |
| | | /** |
| | | * å é¤éè¿æ¨¡æ¿ä¿¡æ¯ |
| | |
| | | * @param ID éè¿æ¨¡æ¿ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteIvrLibaExtemplateByID(String ID); |
| | | public int deleteIvrLibaExtemplateByID(Long ID); |
| | | } |
| | |
| | | * @param IDs éè¦å é¤çéç¨æ¨¡æ¿è¯æ¯ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteIvrLibaExtemplatescriptByIDs(String[] IDs); |
| | | public int deleteIvrLibaExtemplatescriptByIDs(Long[] IDs); |
| | | |
| | | /** |
| | | * å é¤éç¨æ¨¡æ¿è¯æ¯ä¿¡æ¯ |
| | |
| | | * @param ID éç¨æ¨¡æ¿è¯æ¯ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteIvrLibaExtemplatescriptByID(String ID); |
| | | public int deleteIvrLibaExtemplatescriptByID(Long ID); |
| | | } |
| | |
| | | import com.smartor.domain.HeTaskVO; |
| | | import com.smartor.domain.IvrTaskcall; |
| | | import com.smartor.domain.IvrTaskcallVO; |
| | | import com.smartor.domain.PhoneCallBackVO; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public int insertOrUpdateTask(IvrTaskcallVO ivrTaskcallVO); |
| | | |
| | | /** |
| | | * ä»»å¡åéæ§è¡ |
| | | * |
| | | * @param ivrTaskcallVO |
| | | * @return ç»æ |
| | | */ |
| | | public int heTaskSend(IvrTaskcallVO ivrTaskcallVO); |
| | | |
| | | /** |
| | | * ä»»å¡åéæ§è¡ |
| | | * |
| | | * @param phoneCallBackVO |
| | | * @return ç»æ |
| | | */ |
| | | public PhoneCallBackVO phoneCallBack(PhoneCallBackVO phoneCallBackVO); |
| | | |
| | | } |
| | |
| | | /** |
| | | * ä¸å¥è¯è¯å« |
| | | */ |
| | | public String texttospeech(String textspeech); |
| | | public String texttospeech(String textspeech, String filePath); |
| | | |
| | | public Boolean explainHTML(); |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * éè¿æ¨¡æ¿Serviceä¸å¡å±å¤ç |
| | |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate) { |
| | | public IvrLibaExtemplate insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate) { |
| | | ivrLibaExtemplate.setCreateTime(DateUtils.getNowDate()); |
| | | return ivrLibaExtemplateMapper.insertIvrLibaExtemplate(ivrLibaExtemplate); |
| | | Boolean i = ivrLibaExtemplateMapper.insertIvrLibaExtemplate(ivrLibaExtemplate); |
| | | if (i) { |
| | | return ivrLibaExtemplate; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteIvrLibaExtemplateByIDs(String[] IDs) { |
| | | public int deleteIvrLibaExtemplateByIDs(Long[] IDs) { |
| | | return ivrLibaExtemplateMapper.deleteIvrLibaExtemplateByIDs(IDs); |
| | | } |
| | | |
| | |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteIvrLibaExtemplateByID(String ID) { |
| | | public int deleteIvrLibaExtemplateByID(Long ID) { |
| | | return ivrLibaExtemplateMapper.deleteIvrLibaExtemplateByID(ID); |
| | | } |
| | | } |
| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.IvrLibaExtemplatescript; |
| | | import com.smartor.mapper.IvrLibaExtemplatescriptMapper; |
| | | import com.smartor.service.IIvrLibaExtemplatescriptService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public List<IvrLibaExtemplatescript> selectIvrLibaExtemplatescriptList(IvrLibaExtemplatescript ivrLibaExtemplatescript) { |
| | | return ivrLibaExtemplatescriptMapper.selectIvrLibaExtemplatescriptList(ivrLibaExtemplatescript); |
| | | List<IvrLibaExtemplatescript> ivrLibaExtemplatescripts = ivrLibaExtemplatescriptMapper.selectIvrLibaExtemplatescriptList(ivrLibaExtemplatescript); |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | for (IvrLibaExtemplatescript ivrLibaExtemplatescript1 : ivrLibaExtemplatescripts) { |
| | | if (!StringUtils.isEmpty(ivrLibaExtemplatescript1.getDynamiccruxsJson())) { |
| | | try { |
| | | ivrLibaExtemplatescript1.setDynamiccruxs(mapper.readValue(ivrLibaExtemplatescript1.getDynamiccruxsJson(), List.class)); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | if (!StringUtils.isEmpty(ivrLibaExtemplatescript1.getNodynamiccruxsJson())) { |
| | | try { |
| | | ivrLibaExtemplatescript1.setNodynamiccruxs(mapper.readValue(ivrLibaExtemplatescript1.getNodynamiccruxsJson(), List.class)); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return ivrLibaExtemplatescripts; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public int insertIvrLibaExtemplatescript(IvrLibaExtemplatescript ivrLibaExtemplatescript) { |
| | | if (CollectionUtils.isNotEmpty(ivrLibaExtemplatescript.getDynamiccruxs())) |
| | | ivrLibaExtemplatescript.setDynamiccruxsJson(JSON.toJSONString(ivrLibaExtemplatescript.getDynamiccruxs())); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaExtemplatescript.getNodynamiccruxs())) |
| | | ivrLibaExtemplatescript.setNodynamiccruxsJson(JSON.toJSONString(ivrLibaExtemplatescript.getNodynamiccruxs())); |
| | | ivrLibaExtemplatescript.setCreateTime(DateUtils.getNowDate()); |
| | | return ivrLibaExtemplatescriptMapper.insertIvrLibaExtemplatescript(ivrLibaExtemplatescript); |
| | | } |
| | |
| | | @Override |
| | | public int updateIvrLibaExtemplatescript(IvrLibaExtemplatescript ivrLibaExtemplatescript) { |
| | | ivrLibaExtemplatescript.setUpdateTime(DateUtils.getNowDate()); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaExtemplatescript.getDynamiccruxs())) |
| | | ivrLibaExtemplatescript.setDynamiccruxsJson(JSON.toJSONString(ivrLibaExtemplatescript.getDynamiccruxs())); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaExtemplatescript.getNodynamiccruxs())) |
| | | ivrLibaExtemplatescript.setNodynamiccruxsJson(JSON.toJSONString(ivrLibaExtemplatescript.getNodynamiccruxs())); |
| | | return ivrLibaExtemplatescriptMapper.updateIvrLibaExtemplatescript(ivrLibaExtemplatescript); |
| | | } |
| | | |
| | |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteIvrLibaExtemplatescriptByIDs(String[] IDs) { |
| | | public int deleteIvrLibaExtemplatescriptByIDs(Long[] IDs) { |
| | | return ivrLibaExtemplatescriptMapper.deleteIvrLibaExtemplatescriptByIDs(IDs); |
| | | } |
| | | |
| | |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteIvrLibaExtemplatescriptByID(String ID) { |
| | | public int deleteIvrLibaExtemplatescriptByID(Long ID) { |
| | | return ivrLibaExtemplatescriptMapper.deleteIvrLibaExtemplatescriptByID(ID); |
| | | } |
| | | } |
| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.IvrLibaScriptMapper; |
| | | import com.smartor.mapper.IvrLibaScriptTagMapper; |
| | |
| | | IvrLibaScriptTargetoption ivrLibaScriptTargetoption = new IvrLibaScriptTargetoption(); |
| | | ivrLibaScriptTargetoption.setScriptid(ivrLibaScripts.get(0).getId()); |
| | | List<IvrLibaScriptTargetoption> ivrLibaScriptTargetoptions = ivrLibaScriptTargetoptionMapper.selectIvrLibaScriptTargetoptionList(ivrLibaScriptTargetoption); |
| | | for (IvrLibaScriptTargetoption ivrLibaScriptTargetoption1 : ivrLibaScriptTargetoptions) { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | if (StringUtils.isNotEmpty(ivrLibaScriptTargetoption1.getDynamiccruxsJson())) |
| | | ivrLibaScriptTargetoption1.setDynamiccruxs(objectMapper.readValue(ivrLibaScriptTargetoption1.getDynamiccruxsJson(), List.class)); |
| | | if (StringUtils.isNotEmpty(ivrLibaScriptTargetoption1.getNodynamiccruxsJson())) |
| | | ivrLibaScriptTargetoption1.setNodynamiccruxs(objectMapper.readValue(ivrLibaScriptTargetoption1.getNodynamiccruxsJson(), List.class)); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | scriptVO.setIvrLibaScriptTargetoptionList(ivrLibaScriptTargetoptions); |
| | | |
| | | // //æ¥è¯¢é®é¢ææ æ¥å£ |
| | |
| | | if (ivrLibaScript.getId() == null) { |
| | | throw new BaseException("è¯æ¯ID为空,è¯·æ£æ¥è¯æ¯å
¥åä¿¡æ¯æ¯å¦å®æ´"); |
| | | } |
| | | // //对é®é¢ææ è¿è¡å¤ç |
| | | // if (CollectionUtils.isNotEmpty(ivrLibaScriptVO.getIvrLibaScriptTargetList())) { |
| | | // for (IvrLibaScriptTarget ivrLibaScriptTarget : ivrLibaScriptVO.getIvrLibaScriptTargetList()) { |
| | | // if (ivrLibaScriptTarget.getIsoperation() != null && ivrLibaScriptTarget.getIsoperation() == 1) { |
| | | // //æ°å¢ |
| | | // ivrLibaScriptTarget.setScriptid(ivrLibaScript.getId()); |
| | | // ivrLibaScriptTargetMapper.insertIvrLibaScriptTarget(ivrLibaScriptTarget); |
| | | // } else if (ivrLibaScriptTarget.getIsoperation() != null && ivrLibaScriptTarget.getIsoperation() == 2) { |
| | | // //ä¿®æ¹ |
| | | // ivrLibaScriptTarget.setScriptid(ivrLibaScript.getId()); |
| | | // ivrLibaScriptTargetMapper.updateIvrLibaScriptTarget(ivrLibaScriptTarget); |
| | | // } else if (ivrLibaScriptTarget.getIsoperation() != null && ivrLibaScriptTarget.getIsoperation() == 3) { |
| | | // //å é¤ |
| | | // if (ivrLibaScriptTarget.getId() == null) { |
| | | // log.info("å é¤å¤±è´¥,é®é¢ææ id为空"); |
| | | // } else { |
| | | // ivrLibaScriptTargetMapper.deleteIvrLibaScriptTargetByQuestionTargetID(ivrLibaScriptTarget.getId()); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | //对é®é¢ææ é项è¿è¡å¤ç |
| | | if (CollectionUtils.isNotEmpty(ivrLibaScriptVO.getIvrLibaScriptTargetoptionList())) { |
| | | for (IvrLibaScriptTargetoption ivrLibaScriptTargetoption : ivrLibaScriptVO.getIvrLibaScriptTargetoptionList()) { |
| | | if (CollectionUtils.isNotEmpty(ivrLibaScriptTargetoption.getNodynamiccruxs())) { |
| | | ivrLibaScriptTargetoption.setNodynamiccruxsJson(new Gson().toJson(ivrLibaScriptTargetoption.getNodynamiccruxs())); |
| | | } |
| | | if (CollectionUtils.isNotEmpty(ivrLibaScriptTargetoption.getDynamiccruxs())) { |
| | | ivrLibaScriptTargetoption.setDynamiccruxsJson(new Gson().toJson(ivrLibaScriptTargetoption.getDynamiccruxs())); |
| | | } |
| | | |
| | | if (ivrLibaScriptTargetoption.getIsoperation() != null && ivrLibaScriptTargetoption.getIsoperation() == 1) { |
| | | //æ°å¢ |
| | | ivrLibaScriptTargetoption.setScriptid(ivrLibaScript.getId()); |
| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.IvrLibaTargetMapper; |
| | | import com.smartor.mapper.IvrLibaTargetTagMapper; |
| | |
| | | //è·åè¯¥ææ çé项 |
| | | List<IvrLibaTargetoption> ivrLibaTargetoptions = ivrLibaTargetoptionMapper.selectIvrLibaTargetoptionList(ivrLibaTargetoption); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTargetoptions)) { |
| | | for (IvrLibaTargetoption ivrLibaTargetoption1 : ivrLibaTargetoptions) { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | if (StringUtils.isNotEmpty(ivrLibaTargetoption1.getDynamiccruxsJson())) |
| | | ivrLibaTargetoption1.setDynamiccruxs(objectMapper.readValue(ivrLibaTargetoption1.getDynamiccruxsJson(), List.class)); |
| | | if (StringUtils.isNotEmpty(ivrLibaTargetoption1.getNodynamiccruxsJson())) |
| | | ivrLibaTargetoption1.setNodynamiccruxs(objectMapper.readValue(ivrLibaTargetoption1.getNodynamiccruxsJson(), List.class)); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | ivrLibaTarget1.setTargetoptionList(ivrLibaTargetoptions); |
| | | } |
| | | //è·åè¯¥ææ çæ ç¾ |
| | |
| | | } |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTargetVO.getTargetoptionList())) { |
| | | for (IvrLibaTargetoption ivrLibaTargetoption : ivrLibaTargetVO.getTargetoptionList()) { |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTargetoption.getNodynamiccruxs())) { |
| | | ivrLibaTargetoption.setNodynamiccruxsJson(new Gson().toJson(ivrLibaTargetoption.getNodynamiccruxs())); |
| | | } |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTargetoption.getDynamiccruxs())) { |
| | | ivrLibaTargetoption.setDynamiccruxsJson(new Gson().toJson(ivrLibaTargetoption.getDynamiccruxs())); |
| | | } |
| | | |
| | | if (ivrLibaTargetoption.getIsoperation() != null && ivrLibaTargetoption.getIsoperation() == 1) { |
| | | //æ°å¢ |
| | | ivrLibaTargetoption.setTargetid(ivrLibaTarget.getId()); |
| | |
| | | /** |
| | | * æ¹éå 餿æ éé¡¹åº |
| | | * |
| | | * @param targetIDs éè¦å é¤çææ é项åºä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | |
| | | /** |
| | | * å 餿æ é项åºä¿¡æ¯ |
| | | * |
| | | * @param targetID ææ é项åºä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | 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.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.IIvrLibaTemplateService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 模æ¿åºServiceä¸å¡å±å¤ç |
| | |
| | | //æ°å¢ |
| | | ivrLibaTemplateTargetoption.setTemplateID(tmpID); |
| | | ivrLibaTemplateTargetoption.setScriptid(ivrLibaTemplateScript.getID()); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTemplateTargetoption.getDynamiccruxs())) |
| | | ivrLibaTemplateTargetoption.setDynamiccruxsJson(JSON.toJSONString(ivrLibaTemplateTargetoption.getDynamiccruxs())); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTemplateTargetoption.getNodynamiccruxs())) |
| | | ivrLibaTemplateTargetoption.setNodynamiccruxsJson(JSON.toJSONString(ivrLibaTemplateTargetoption.getNodynamiccruxs())); |
| | | ivrLibaTemplateTargetOptionMapper.insertIvrLibaTemplateTargetoption(ivrLibaTemplateTargetoption); |
| | | } else if (ivrLibaTemplateTargetoption.getIsoperation() != null && ivrLibaTemplateTargetoption.getIsoperation() == 2) { |
| | | //ä¿®æ¹ |
| | | ivrLibaTemplateTargetoption.setTemplateID(tmpID); |
| | | ivrLibaTemplateTargetoption.setScriptid(ivrLibaTemplateScript.getID()); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTemplateTargetoption.getDynamiccruxs())) |
| | | ivrLibaTemplateTargetoption.setDynamiccruxsJson(JSON.toJSONString(ivrLibaTemplateTargetoption.getDynamiccruxs())); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTemplateTargetoption.getNodynamiccruxs())) |
| | | ivrLibaTemplateTargetoption.setNodynamiccruxsJson(JSON.toJSONString(ivrLibaTemplateTargetoption.getNodynamiccruxs())); |
| | | ivrLibaTemplateTargetOptionMapper.updateIvrLibaTemplateTargetoption(ivrLibaTemplateTargetoption); |
| | | } else if (ivrLibaTemplateTargetoption.getIsoperation() != null && ivrLibaTemplateTargetoption.getIsoperation() == 3) { |
| | | //å é¤ |
| | |
| | | IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption = new IvrLibaTemplateTargetoption(); |
| | | ivrLibaTemplateTargetoption.setScriptid(ivrLibaTemplateScriptVO.getID()); |
| | | List<IvrLibaTemplateTargetoption> ivrLibaTemplateTargetoptions = ivrLibaTemplateTargetOptionMapper.selectIvrLibaTemplateTargetoptionList(ivrLibaTemplateTargetoption); |
| | | ivrLibaTemplateScriptVO.setIvrLibaScriptTargetoptionList(ivrLibaTemplateTargetoptions); |
| | | for (IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption1 : ivrLibaTemplateTargetoptions) { |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | if (!StringUtils.isEmpty(ivrLibaTemplateTargetoption1.getDynamiccruxsJson())) { |
| | | try { |
| | | ivrLibaTemplateTargetoption1.setDynamiccruxs(mapper.readValue(ivrLibaTemplateTargetoption1.getDynamiccruxsJson(), List.class)); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | if (!StringUtils.isEmpty(ivrLibaTemplateTargetoption1.getNodynamiccruxsJson())) { |
| | | try { |
| | | ivrLibaTemplateTargetoption1.setNodynamiccruxs(mapper.readValue(ivrLibaTemplateTargetoption1.getNodynamiccruxsJson(), List.class)); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | ivrLibaTemplateScriptVO.setIvrLibaScriptTargetoptionList(ivrLibaTemplateTargetoptions); |
| | | } |
| | | Collections.sort(ivrLibaTemplateScriptVOS, Comparator.comparing(IvrLibaTemplateScriptVO::getTargetid)); |
| | | //æ°æ®ç»è£
|
| | | templateVO.setIvrLibaTemplateTagList(ivrLibaTemplateTags); |
| | | templateVO.setIvrLibaTemplateScriptVOList(ivrLibaTemplateScriptVOS); |
| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | //import com.smartor.config.PhoneUtils; |
| | | import com.smartor.config.PhoneUtils; |
| | | import com.smartor.config.RabbitMqConfig; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.IvrLibaExtemplatescriptMapper; |
| | | import com.smartor.mapper.IvrLibaTemplateTargetoptionMapper; |
| | | import com.smartor.mapper.IvrTaskcallMapper; |
| | | import com.smartor.mapper.PatTaskRelevanceMapper; |
| | | import com.smartor.service.IIvrTaskcallService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.amqp.AmqpException; |
| | | import org.springframework.amqp.core.Message; |
| | | import org.springframework.amqp.core.MessagePostProcessor; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * åä¸ä»»å¡ï¼é访ï¼Serviceä¸å¡å±å¤ç |
| | |
| | | private IvrTaskcallMapper ivrTaskcallMapper; |
| | | |
| | | @Autowired |
| | | private PatTaskRelevanceMapper patTaskRelevanceMapper; |
| | | private IvrLibaTemplateTargetoptionMapper ivrLibaScriptTargetoptionMapper; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | private IvrLibaExtemplatescriptMapper ivrLibaExtemplatescriptMapper; |
| | | |
| | | @Autowired |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢åä¸ä»»å¡ï¼éè®¿ï¼ |
| | |
| | | @Override |
| | | public int insertOrUpdateTask(IvrTaskcallVO ivrTaskcallVO) { |
| | | if (ObjectUtils.isEmpty(ivrTaskcallVO)) { |
| | | log.info("宣æä»»å¡å
¥å为空ï¼è¯·æ£æ¥å
¥å"); |
| | | throw new BaseException("宣æä»»å¡å
¥å为空ï¼è¯·æ£æ¥å
¥å"); |
| | | log.info("ä»»å¡å
¥å为空ï¼è¯·æ£æ¥å
¥å"); |
| | | throw new BaseException("ä»»å¡å
¥å为空ï¼è¯·æ£æ¥å
¥å"); |
| | | } |
| | | Integer integer = 0; |
| | | if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 1) { |
| | |
| | | ivrTaskcall.setAddr(patTaskRelevance.getAddr()); |
| | | ivrTaskcall.setCreateTime(DateUtils.getNowDate()); |
| | | ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskcallVO.getTextParam())); |
| | | if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) { |
| | | ivrTaskcall.setSendTimeSlot(ivrTaskcallVO.getSendTimeslot().toString()); |
| | | } |
| | | ivrTaskcallMapper.insertIvrTaskcall(ivrTaskcall); |
| | | integer = ivrTaskcall.getId().intValue(); |
| | | } |
| | |
| | | ivrTaskcall.setPhone(patTaskRelevance.getPhone()); |
| | | ivrTaskcall.setAddr(patTaskRelevance.getAddr()); |
| | | ivrTaskcall.setCreateTime(DateUtils.getNowDate()); |
| | | if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) { |
| | | ivrTaskcall.setSendTimeSlot(ivrTaskcallVO.getSendTimeslot().toString()); |
| | | } |
| | | ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskcallVO.getTextParam())); |
| | | |
| | | ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall); |
| | | integer = ivrTaskcall.getId().intValue(); |
| | | } |
| | |
| | | return integer; |
| | | } |
| | | |
| | | /** |
| | | * ä»»å¡åé |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int heTaskSend(IvrTaskcallVO ivrTaskcallVO) { |
| | | //夿任塿¯å¦æ¯ç«å³åé |
| | | if (ivrTaskcallVO.getSendType().equals("2") && ivrTaskcallVO.getSendstate() == 1) { |
| | | IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ(); |
| | | ivrTaskcallMQ.setTaskid(ivrTaskcallVO.getTaskid()); |
| | | ivrTaskcallMQ.setSendType("1"); |
| | | ivrTaskcallMQ.setTemplateid(ivrTaskcallVO.getTemplateid()); |
| | | |
| | | //ç«å³åé |
| | | rabbitTemplate.convertAndSend(RabbitMqConfig.phone_exchange, RabbitMqConfig.routing_key, new Gson().toJson(ivrTaskcallMQ), message -> { |
| | | //注æè¿éæ¶é´å¯ä»¥ä½¿longï¼è䏿¯è®¾ç½®header |
| | | message.getMessageProperties().setHeader("x-delay", 0); |
| | | return message; |
| | | }); |
| | | } else if (ivrTaskcallVO.getSendType().equals("2") && ivrTaskcallVO.getSendstate() == 1) { |
| | | //æ¶é´æ®µåé |
| | | if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) { |
| | | for (TaskSendTimeVO taskSendTimeVO : ivrTaskcallVO.getSendTimeslot()) { |
| | | List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | list.add(taskSendTimeVO); |
| | | |
| | | //è·åå¼å§åéæ¶é´ |
| | | String begantime = taskSendTimeVO.getBegantime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | //è®°å½ç®åå°åéæ¶é´ç毫ç§å¼ ï¼åéæ¶é´ç毫ç§å¼ - å½åæ¶é´ç毫ç§å¼ï¼ |
| | | Long milliseconds = 1000L; |
| | | try { |
| | | Date date = sdf.parse(begantime); |
| | | milliseconds = date.getTime() - System.currentTimeMillis(); |
| | | System.out.println("æ¥ææ¯«ç§æ°ï¼" + milliseconds); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ(); |
| | | ivrTaskcallMQ.setTaskid(ivrTaskcallVO.getTaskid()); |
| | | ivrTaskcallMQ.setSendType("2"); |
| | | ivrTaskcallMQ.setTemplateid(ivrTaskcallVO.getTemplateid()); |
| | | ivrTaskcallMQ.setSendTimeslot(list); |
| | | |
| | | Long finalMilliseconds = milliseconds; |
| | | rabbitTemplate.convertAndSend(RabbitMqConfig.phone_exchange, RabbitMqConfig.routing_key, new Gson().toJson(ivrTaskcallMQ), message -> { |
| | | //注æè¿éæ¶é´å¯ä»¥ä½¿longï¼è䏿¯è®¾ç½®header |
| | | message.getMessageProperties().setHeader("x-delay", finalMilliseconds); |
| | | return message; |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public PhoneCallBackVO phoneCallBack(PhoneCallBackVO phoneCallBackVO) { |
| | | log.info("phoneCallBackVOçå
¥åï¼{},{},{},{},{},{},{}", phoneCallBackVO.getResultType(), phoneCallBackVO.getUuid(), phoneCallBackVO.getErrResult(), phoneCallBackVO.getTextResult(), phoneCallBackVO.getHangUpResult(), phoneCallBackVO.getEnumState(), phoneCallBackVO.getUint8()); |
| | | //è·åæ°æ® |
| | | Boolean aBoolean = redisCache.hasKey(phoneCallBackVO.getUuid()); |
| | | if (!aBoolean) { |
| | | new BaseException("该uuidä¸åå¨"); |
| | | } |
| | | Integer hangupValue = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "hangup"); |
| | | if (hangupValue != null && hangupValue == 1) { |
| | | //hangupValue == 1 éè®¿ç»æï¼ç´æ¥å¯ä»¥æçµè¯ |
| | | PhoneUtils phoneUtils = new PhoneUtils(); |
| | | phoneUtils.hangup(phoneCallBackVO.getUuid(), null, null, null, null, null, null, null); |
| | | |
| | | } |
| | | |
| | | String cacheObject = redisCache.getCacheObject(phoneCallBackVO.getUuid()); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | Map<String, Object> map = null; |
| | | try { |
| | | map = objectMapper.readValue(cacheObject, Map.class); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | IvrTaskcall ivrTaskcall = (IvrTaskcall) map.get("ivrTaskcall"); |
| | | List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOs = (List<IvrLibaTemplateScriptVO>) map.get("ivrLibaTemplateScriptVO"); |
| | | //å°uuidæ´æ°å°æ°æ®åºä¸ |
| | | ivrTaskcall.setSenduuid(phoneCallBackVO.getUuid()); |
| | | ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall); |
| | | |
| | | //è·å模æ¿ä¿¡æ¯ |
| | | IvrLibaTemplateVO ivrLibaTemplateVO = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "ivrLibaTemplateVO"); |
| | | |
| | | |
| | | //é¦å
夿resultType |
| | | if (phoneCallBackVO.getResultType() == 1) { |
| | | //å¼å«ç»ææ¥å£: 1 |
| | | if (phoneCallBackVO.getUint8() == 1) { |
| | | //å¼å«å¤±è´¥ï¼å»redisä¸è®°å½ä¸ä¸å¤±è´¥æ¬¡æ°ï¼è¿è¡å次å¼å« |
| | | Integer integer = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "uint8"); |
| | | if (integer != null) { |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "uint8", integer + 1, 120, TimeUnit.MINUTES); |
| | | } else { |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "uint8", 1, 120, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | if (integer != null && integer == ivrTaskcall.getRecallcount().intValue()) { |
| | | log.info("æ 人æ¥å¬ï¼{}, {}", phoneCallBackVO.getErrResult(), phoneCallBackVO.getUuid()); |
| | | //è¿ç»æè§å®æ¬¡ï¼å¦æè¦æ²¡äººæ¥ï¼é£å°±ç»æ |
| | | ivrTaskcall.setResult(phoneCallBackVO.getErrResult()); |
| | | ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall); |
| | | redisCache.deleteObject(phoneCallBackVO.getUuid() + "uint8"); |
| | | } else if (integer != null && integer < ivrTaskcall.getRecallcount().intValue()) { |
| | | //è¿è¡éæ¨ |
| | | PhoneUtils phoneUtils = new PhoneUtils(); |
| | | phoneUtils.ob(phoneCallBackVO.getUuid(), null, ivrTaskcall.getPhone(), null, null, null, null, null, null, null, null); |
| | | } |
| | | } |
| | | |
| | | } else if (phoneCallBackVO.getResultType() == 2) { |
| | | //éè¯ç¶ææ´æ°æ¥å£: 2 |
| | | if (phoneCallBackVO.getEnumState() == 0) { |
| | | // 0-æ¯é |
| | | Integer integer = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "enumState"); |
| | | |
| | | if (integer != null && integer < ivrTaskcall.getRecallcount().intValue()) { |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "enumState", integer + 1, 120, TimeUnit.MINUTES); |
| | | } else if (integer == null) { |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "enumState", 1, 120, TimeUnit.MINUTES); |
| | | } else if (integer != null && integer == ivrTaskcall.getRecallcount().intValue()) { |
| | | ivrTaskcall.setResult("æ 人æ¥å¬"); |
| | | ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall); |
| | | redisCache.deleteObject(phoneCallBackVO.getUuid() + "enumState"); |
| | | } |
| | | } else if (phoneCallBackVO.getEnumState() == 2) { |
| | | //æ£è
ææçµè¯ |
| | | log.info("æ£è
ææçµè¯ï¼{}", phoneCallBackVO.getUuid()); |
| | | ivrTaskcall.setResult(phoneCallBackVO.getHangUpResult()); |
| | | ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall); |
| | | redisCache.deleteObject(phoneCallBackVO.getUuid() + "enumState"); |
| | | } |
| | | |
| | | |
| | | } else if (phoneCallBackVO.getResultType() == 3) { |
| | | //è¯é³è¯å«ç»æä¸æ¥æ¥å£: 3 |
| | | Integer noVoice = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "noVoice"); |
| | | QuestionMessage returnQues = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "returnQues"); |
| | | IvrLibaTemplateScriptVO nowQuestion = returnQues.getNowQuestion(); |
| | | PhoneUtils phoneUtils = new PhoneUtils(); |
| | | |
| | | if (StringUtils.isEmpty(phoneCallBackVO.getTextResult())) { |
| | | //æ åè¯ |
| | | //夿noVoiceæ¯å¦å·²ç»å°äºæå¤§å¼ |
| | | if (noVoice == ivrLibaTemplateVO.getNoVoiceNum().intValue()) { |
| | | //å·²ç»é®äºå¯¹åºçéæ°ï¼å°±å¤ææ¯å¦è¿æä¸ä¸é¢ |
| | | if (nowQuestion.getTargetid() == ivrLibaTemplateScriptVOs.size()) { |
| | | //没æä¸ä¸é¢äºï¼å°±ææçµè¯ï¼ææ¾ç»æè¯ |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES); |
| | | phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid()); |
| | | } else { |
| | | //æä¸ä¸é¢ |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES); |
| | | IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion); |
| | | // é®é¢ï¼ å»è°ç¨âttsåæåææ¾âæ¥å£ |
| | | phoneUtils.ttsPlayback(nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); |
| | | } |
| | | } else { |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", noVoice + 1, 120, TimeUnit.MINUTES); |
| | | //è°ç¨ivrLibaTemplateScriptVOä¸çslienceText(éé»è¯æ¯) |
| | | String slienceText = nowQuestion.getSlienceText(); |
| | | //éé»è¯æ¯ + é®é¢ï¼ å»è°ç¨âttsåæåææ¾âæ¥å£ |
| | | phoneUtils.ttsPlayback(slienceText + nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); |
| | | return new PhoneCallBackVO(); |
| | | } |
| | | |
| | | } else { |
| | | //æåè¯ï¼å¯¹åççé®é¢,è¿è¡æ£åå¹é
ï¼è¿éåªé坹鿩é¢ï¼å
¶å®é¢åä¸è¡ï¼ |
| | | for (int j = 0; j < nowQuestion.getIvrLibaScriptTargetoptionList().size(); j++) { |
| | | //å
å« |
| | | Matcher matcher = null; |
| | | if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex())) { |
| | | Pattern pattern = Pattern.compile(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()); |
| | | matcher = pattern.matcher(phoneCallBackVO.getTextResult()); |
| | | } |
| | | //ä¸å
å« |
| | | Matcher matcher2 = null; |
| | | if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2())) { |
| | | Pattern pattern2 = Pattern.compile(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()); |
| | | matcher2 = pattern2.matcher(phoneCallBackVO.getTextResult()); |
| | | } |
| | | log.info("phoneCallBack--Targetregexçå¼ä¸ºï¼{}, phoneCallBack--Targetregex2çå¼ä¸ºï¼{}", nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex(), nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()); |
| | | if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) { |
| | | //说æå¹é
æ£ç¡®äº |
| | | //è¿éåºè¯¥å
å¤æç±»åï¼å»åä¿®æ¹ï¼è®¾ç½®IsUserOperationæ¯åéé¢çæ¹æ³ |
| | | nowQuestion.getIvrLibaScriptTargetoptionList().get(j).setIsUserOperation(true); |
| | | ivrLibaScriptTargetoptionMapper.updateIvrLibaTemplateTargetoption(nowQuestion.getIvrLibaScriptTargetoptionList().get(j)); |
| | | |
| | | |
| | | //å°éé»ç½®ä¸º0 |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES); |
| | | //è·åä¸ä¸é¢ |
| | | Integer nextQuestion = nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getNextQuestion(); |
| | | for (IvrLibaTemplateScriptVO script : ivrLibaTemplateScriptVOs) { |
| | | if (script.getTargetid() == nextQuestion) { |
| | | QuestionMessage questionMessage = new QuestionMessage(); |
| | | questionMessage.setNowQuestion(script); |
| | | questionMessage.setQuestionList(ivrLibaTemplateScriptVOs); |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | } else { |
| | | //没æå¹é
å° |
| | | Integer mateNum = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "mateNum"); |
| | | //æ å¹é
次æ°å»å¤ææ¯å¦å°æå¤§è¯¢é®æ¬¡æ°ï¼å¹¶ä¸ææçé项é½å¹é
å®äº |
| | | if (mateNum == ivrLibaTemplateVO.getMateNum().intValue() && j == nowQuestion.getIvrLibaScriptTargetoptionList().size() - 1) { |
| | | //妿ä¸ä¸é¢ä¸ºç©º.åæ°çæ°æ®è¿å,å¹¶å ä¸æè°¢è¯ |
| | | if (nowQuestion.getTargetid() < ivrLibaTemplateScriptVOs.size()) { |
| | | QuestionMessage questionMessage = new QuestionMessage(); |
| | | IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion); |
| | | questionMessage.setQuestionList(ivrLibaTemplateScriptVOs); |
| | | questionMessage.setNowQuestion(nextQuestion); |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES); |
| | | } else { |
| | | //å°±å¯ä»¥ææçµè¯äº |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES); |
| | | phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid()); |
| | | break; |
| | | } |
| | | } else if (mateNum < ivrLibaTemplateVO.getMateNum().intValue() && j == nowQuestion.getIvrLibaScriptTargetoptionList().size() - 1) { |
| | | //没æé®å°è§å®æ¬¡æ° |
| | | mateNum = mateNum + 1; |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", mateNum, 120, TimeUnit.MINUTES); |
| | | } |
| | | } |
| | | |
| | | } |
| | | //é项å¹é
宿åï¼éè¦åå»éè¿åºåè¿è¡å¹é
䏿¬¡ |
| | | String extemplateID = ivrLibaTemplateVO.getSubmoduleID(); |
| | | String[] split = extemplateID.split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | List<Long> list1 = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(extemplateID)) { |
| | | for (String str : list) { |
| | | list1.add(Long.valueOf(str)); |
| | | } |
| | | List<IvrLibaExtemplatescript> ivrLibaExtemplatescripts = ivrLibaExtemplatescriptMapper.queryIvrLibaExtemplatescriptList(list1); |
| | | for (IvrLibaExtemplatescript ivrLibaExtemplatescript : ivrLibaExtemplatescripts) { |
| | | Matcher matcher = null; |
| | | if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex())) { |
| | | Pattern pattern = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex()); |
| | | matcher = pattern.matcher(returnQues.getContent()); |
| | | } |
| | | |
| | | Matcher matcher2 = null; |
| | | if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2())) { |
| | | Pattern pattern2 = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex2()); |
| | | matcher2 = pattern2.matcher(returnQues.getContent()); |
| | | } |
| | | log.info("++++++++++++++++++++++++++éç¨åºæ¯å¦ä¸ºç©ºï¼selfRegex : {} , selfRegex2 : {}", ivrLibaExtemplatescript.getSelfRegex(), ivrLibaExtemplatescript.getSelfRegex2()); |
| | | if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex()) && matcher.matches() && StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2()) && matcher2.matches() || StringUtils.isEmpty(ivrLibaExtemplatescript.getSelfRegex()) && StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2()) && matcher2.matches() || StringUtils.isEmpty(ivrLibaExtemplatescript.getSelfRegex2()) && StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex()) && matcher.matches()) { |
| | | QuestionMessage questionMessage = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "returnQues"); |
| | | IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO = returnQues.getNowQuestion(); |
| | | ivrLibaTemplateScriptVO.setSubmoduleText(ivrLibaExtemplatescript.getSwitchText()); |
| | | ivrLibaTemplateScriptVO.setSubmoduleVoice(ivrLibaExtemplatescript.getSwitchWav()); |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); |
| | | if (ivrLibaExtemplatescript.getIsEnd() == 1) { |
| | | //å°é®é¢ç½®ç©º |
| | | IvrLibaTemplateScriptVO nowQuestion1 = questionMessage.getNowQuestion(); |
| | | nowQuestion1.setQuestionText(null); |
| | | nowQuestion1.setQuestionVoice(null); |
| | | questionMessage.setNowQuestion(nowQuestion1); |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); |
| | | |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "isOver", 1, 120, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | //è°ç¨â15ãttsåæåææ¾ï¼ tts_playbackâå°ç»æä¼ å |
| | | |
| | | |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return phoneCallBackVO; |
| | | } |
| | | |
| | | private IvrLibaTemplateScriptVO getNextQuestion(List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList, IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO) { |
| | | |
| | | for (int j = 0; j < ivrLibaTemplateScriptVOList.size(); j++) { |
| | | if (ivrLibaTemplateScriptVOList.get(j).getTargetid() == ivrLibaTemplateScriptVO.getTargetid() + 1) { |
| | | // 对该æ¡templateScriptVOè¿è¡å¤ç |
| | | return ivrLibaTemplateScriptVOList.get(j); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.aliyun.teautil.Common; |
| | | import com.aliyun.teautil.models.RuntimeOptions; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.*; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String texttospeech(String textspeech) { |
| | | public String texttospeech(String textspeech, String filePath) { |
| | | this.accessToken(); |
| | | this.process2(textspeech); |
| | | this.process2(textspeech, filePath); |
| | | client.shutdown(); |
| | | return returnResult; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | private SpeechSynthesizerListener getSynthesizerListener() { |
| | | private SpeechSynthesizerListener getSynthesizerListener(String filePath) { |
| | | SpeechSynthesizerListener listener = null; |
| | | try { |
| | | if (StringUtils.isEmpty(filePath)) { |
| | | filePath = "tts_test.wav"; |
| | | } |
| | | String finalFilePath = filePath; |
| | | listener = new SpeechSynthesizerListener() { |
| | | File f = new File("tts_test.wav"); |
| | | File f = new File(finalFilePath); |
| | | FileOutputStream fout = new FileOutputStream(f); |
| | | private boolean firstRecvBinary = true; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public void process2(String text) { |
| | | public void process2(String text, String filePath) { |
| | | SpeechSynthesizer synthesizer = null; |
| | | try { |
| | | //å建å®ä¾ï¼å»ºç«è¿æ¥ã |
| | | synthesizer = new SpeechSynthesizer(client, getSynthesizerListener()); |
| | | synthesizer = new SpeechSynthesizer(client, getSynthesizerListener(filePath)); |
| | | synthesizer.setAppKey(appKey); |
| | | //设置è¿åé³é¢çç¼ç æ ¼å¼ |
| | | synthesizer.setFormat(OutputFormatEnum.WAV); |
| | |
| | | keyProperty="ID"> |
| | | insert into ivr_liba_extemplate |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="ID != null">ID,</if> |
| | | <if test="extName != null and extName != ''">extName,</if> |
| | | <if test="language != null and language != ''">language,</if> |
| | | <if test="note != null">note,</if> |
| | |
| | | <if test="guid != null">guid,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="ID != null">#{ID},</if> |
| | | <if test="extName != null and extName != ''">#{extName},</if> |
| | | <if test="language != null and language != ''">#{language},</if> |
| | | <if test="note != null">#{note},</if> |
| | |
| | | where ID = #{ID} |
| | | </update> |
| | | |
| | | <delete id="deleteIvrLibaExtemplateByID" parameterType="String"> |
| | | <delete id="deleteIvrLibaExtemplateByID" parameterType="Long"> |
| | | delete |
| | | from ivr_liba_extemplate |
| | | where ID = #{ID} |
| | | </delete> |
| | | |
| | | <delete id="deleteIvrLibaExtemplateByIDs" parameterType="String"> |
| | | <delete id="deleteIvrLibaExtemplateByIDs" parameterType="Long"> |
| | | delete from ivr_liba_extemplate where ID in |
| | | <foreach item="ID" collection="array" open="(" separator="," close=")"> |
| | | #{ID} |
| | |
| | | <result property="switchText" column="switchText"/> |
| | | <result property="switchWav" column="switchWav"/> |
| | | <result property="selfRegex" column="selfRegex"/> |
| | | <result property="selfRegex2" column="selfRegex2"/> |
| | | <result property="isEnable" column="isEnable"/> |
| | | <result property="delFlag" column="del_flag"/> |
| | | <result property="updateBy" column="update_by"/> |
| | |
| | | <result property="uploadTime" column="upload_time"/> |
| | | <result property="orgid" column="orgid"/> |
| | | <result property="pid" column="pid"/> |
| | | <result property="isEnd" column="is_end"/> |
| | | <result property="guid" column="guid"/> |
| | | <result property="dynamiccruxsJson" column="dynamiccruxs"/> |
| | | <result property="nodynamiccruxsJson" column="nodynamiccruxs"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectIvrLibaExtemplatescriptVo"> |
| | |
| | | switchText, |
| | | switchWav, |
| | | selfRegex, |
| | | selfRegex2, |
| | | isEnable, |
| | | del_flag, |
| | | update_by, |
| | |
| | | upload_time, |
| | | orgid, |
| | | pid, |
| | | is_end, |
| | | nodynamiccruxs, |
| | | dynamiccruxs, |
| | | guid |
| | | from ivr_liba_extemplatescript |
| | | </sql> |
| | |
| | | resultMap="IvrLibaExtemplatescriptResult"> |
| | | <include refid="selectIvrLibaExtemplatescriptVo"/> |
| | | <where> |
| | | <if test="extID != null and extID != ''">and extID = #{extID}</if> |
| | | <if test="extID != null">and extID = #{extID}</if> |
| | | <if test="switchID != null ">and switchID = #{switchID}</if> |
| | | <if test="switchText != null and switchText != ''">and switchText = #{switchText}</if> |
| | | <if test="switchWav != null and switchWav != ''">and switchWav = #{switchWav}</if> |
| | | <if test="selfRegex != null and selfRegex != ''">and selfRegex = #{selfRegex}</if> |
| | | <if test="selfRegex2 != null and selfRegex2 != ''">and selfRegex2 = #{selfRegex2}</if> |
| | | <if test="isEnable != null ">and isEnable = #{isEnable}</if> |
| | | <if test="isupload != null ">and isupload = #{isupload}</if> |
| | | <if test="uploadTime != null ">and upload_time = #{uploadTime}</if> |
| | | <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> |
| | | <if test="pid != null ">and pid = #{pid}</if> |
| | | <if test="guid != null and guid != ''">and guid = #{guid}</if> |
| | | <if test="isEnd != null">and is_end = #{isEnd}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="queryIvrLibaExtemplatescriptList" parameterType="com.smartor.domain.IvrLibaExtemplatescript" |
| | | resultMap="IvrLibaExtemplatescriptResult"> |
| | | <include refid="selectIvrLibaExtemplatescriptVo"/> |
| | | <where> |
| | | del_flag = 0 |
| | | <if test="IDs != null"> |
| | | and extID in |
| | | <foreach collection="IDs" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | where ID = #{ID} |
| | | </select> |
| | | |
| | | <insert id="insertIvrLibaExtemplatescript" parameterType="com.smartor.domain.IvrLibaExtemplatescript" useGeneratedKeys="true" |
| | | <insert id="insertIvrLibaExtemplatescript" parameterType="com.smartor.domain.IvrLibaExtemplatescript" |
| | | useGeneratedKeys="true" |
| | | keyProperty="ID"> |
| | | insert into ivr_liba_extemplatescript |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="ID != null">ID,</if> |
| | | <if test="extID != null and extID != ''">extID,</if> |
| | | <if test="extID != null">extID,</if> |
| | | <if test="switchID != null">switchID,</if> |
| | | <if test="switchText != null">switchText,</if> |
| | | <if test="switchWav != null">switchWav,</if> |
| | | <if test="selfRegex != null">selfRegex,</if> |
| | | <if test="selfRegex2 != null">selfRegex2,</if> |
| | | <if test="isEnable != null">isEnable,</if> |
| | | <if test="delFlag != null and delFlag != ''">del_flag,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | |
| | | <if test="orgid != null">orgid,</if> |
| | | <if test="pid != null">pid,</if> |
| | | <if test="guid != null">guid,</if> |
| | | <if test="isEnd != null">is_end,</if> |
| | | <if test="dynamiccruxsJson != null">dynamiccruxs,</if> |
| | | <if test="nodynamiccruxsJson != null">nodynamiccruxs,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="ID != null">#{ID},</if> |
| | | <if test="extID != null and extID != ''">#{extID},</if> |
| | | <if test="extID != null ">#{extID},</if> |
| | | <if test="switchID != null">#{switchID},</if> |
| | | <if test="switchText != null">#{switchText},</if> |
| | | <if test="switchWav != null">#{switchWav},</if> |
| | | <if test="selfRegex != null">#{selfRegex},</if> |
| | | <if test="selfRegex2 != null">#{selfRegex2},</if> |
| | | <if test="isEnable != null">#{isEnable},</if> |
| | | <if test="delFlag != null and delFlag != ''">#{delFlag},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | |
| | | <if test="orgid != null">#{orgid},</if> |
| | | <if test="pid != null">#{pid},</if> |
| | | <if test="guid != null">#{guid},</if> |
| | | <if test="isEnd != null">#{isEnd},</if> |
| | | <if test="dynamiccruxsJson != null">#{dynamiccruxsJson},</if> |
| | | <if test="nodynamiccruxsJson != null">#{nodynamiccruxsJson},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateIvrLibaExtemplatescript" parameterType="com.smartor.domain.IvrLibaExtemplatescript"> |
| | | update ivr_liba_extemplatescript |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="extID != null and extID != ''">extID = #{extID},</if> |
| | | <if test="extID != null ">extID = #{extID},</if> |
| | | <if test="switchID != null">switchID = #{switchID},</if> |
| | | <if test="switchText != null">switchText = #{switchText},</if> |
| | | <if test="switchWav != null">switchWav = #{switchWav},</if> |
| | | <if test="selfRegex != null">selfRegex = #{selfRegex},</if> |
| | | <if test="selfRegex2 != null">selfRegex2 = #{selfRegex2},</if> |
| | | <if test="isEnable != null">isEnable = #{isEnable},</if> |
| | | <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | |
| | | <if test="orgid != null">orgid = #{orgid},</if> |
| | | <if test="pid != null">pid = #{pid},</if> |
| | | <if test="guid != null">guid = #{guid},</if> |
| | | <if test="isEnd != null">is_end = #{isEnd},</if> |
| | | <if test="dynamiccruxsJson != null">dynamiccruxs = #{dynamiccruxsJson},</if> |
| | | <if test="nodynamiccruxsJson != null">nodynamiccruxs = #{nodynamiccruxsJson},</if> |
| | | </trim> |
| | | where ID = #{ID} |
| | | </update> |
| | | |
| | | <delete id="deleteIvrLibaExtemplatescriptByID" parameterType="String"> |
| | | <delete id="deleteIvrLibaExtemplatescriptByID" parameterType="Long"> |
| | | delete |
| | | from ivr_liba_extemplatescript |
| | | where ID = #{ID} |
| | |
| | | <result property="mateNum" column="mate_num"/> |
| | | <result property="revisitBefore" column="revisit_before"/> |
| | | <result property="revisitAfter" column="revisit_after"/> |
| | | <result property="noVoiceNum" column="no_voice_num"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectIvrLibaTemplateVo"> |
| | |
| | | otherdata, |
| | | suitway, |
| | | mate_num, |
| | | no_voice_num, |
| | | submodule, language, note, isEnable, addUserID, addTime, modifyUserID, modifyTime, groupID, label_info, submoduleID, playType, icd10code, icd10codename, atuoTaskDayOffset, deptIds, dept_names, F_KSDM, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid, assortid, parameter |
| | | from ivr_liba_template |
| | | </sql> |
| | |
| | | '%') |
| | | </if> |
| | | <if test="targetid != null ">and targetid = #{targetid}</if> |
| | | <if test="ID != null ">and id = #{ID}</if> |
| | | <if test="revisitAfter != null ">and revisit_after = #{revisitAfter}</if> |
| | | <if test="revisitBefore != null ">and revisit_before = #{revisitBefore}</if> |
| | | <if test="mateNum != null ">and mate_num = #{mateNum}</if> |
| | | <if test="mateNum != null and mateNum > 0">and mate_num = #{mateNum}</if> |
| | | <if test="suitway != null ">and suitway = #{suitway}</if> |
| | | <if test="targetname != null and targetname !='' ">and targetname = #{targetname}</if> |
| | | <if test="version != null and version !='' ">and version = #{version}</if> |
| | |
| | | <if test="assortid != null ">and assortid = #{assortid}</if> |
| | | <if test="parameter != null and parameter != ''">and parameter = #{parameter}</if> |
| | | <if test="tag != null and tag != ''">and tag = #{tag}</if> |
| | | <if test="noVoiceNum != null and noVoiceNum > 0">and no_voice_num = #{noVoiceNum}</if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <if test="mateNum != null ">mate_num</if> |
| | | <if test="revisitAfter != null ">revisit_after</if> |
| | | <if test="revisitBefore != null ">revisit_before</if> |
| | | <if test="noVoiceNum != null and noVoiceNum > 0 ">no_voice_num</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="templateName != null and templateName != ''">#{templateName},</if> |
| | |
| | | <if test="mateNum != null ">#{mateNum}</if> |
| | | <if test="revisitAfter != null ">#{revisitAfter}</if> |
| | | <if test="revisitBefore != null ">#{revisitBefore}</if> |
| | | <if test="noVoiceNum != null and noVoiceNum > 0">#{noVoiceNum}</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="tag != null">tag = #{tag},</if> |
| | | <if test="suitway != null">suitway = #{suitway},</if> |
| | | <if test="otherdata != null">otherdata = #{otherdata},</if> |
| | | <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="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> |
| | | </trim> |
| | | where ID = #{ID} |
| | | </update> |
| | |
| | | <result property="targettype" column="targettype"/> |
| | | <result property="targetvalue" column="targettalue"/> |
| | | <result property="questiontitle" column="questiontitle"/> |
| | | <result property="nextQuestion" column="next_question"/> |
| | | <result property="otherdata" column="otherdata"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectIvrLibaTemplateScriptVo"> |
| | |
| | | targettype, |
| | | targetvalue, |
| | | questiontitle, |
| | | next_question, |
| | | otherdata, |
| | | targetOptions, language, playWavOnly, isEnable, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid |
| | | from ivr_liba_template_script |
| | | </sql> |
| | |
| | | <if test="noClearlyText != null and noClearlyText != ''">and noClearlyText = #{noClearlyText}</if> |
| | | <if test="noClearlyVoice != null and noClearlyVoice != ''">and noClearlyVoice = #{noClearlyVoice}</if> |
| | | <if test="questiontitle != null and questiontitle != ''">and questiontitle = #{questiontitle}</if> |
| | | <if test="nextQuestion != null and nextQuestion != ''">and next_question = #{nextQuestion}</if> |
| | | <if test="categoryName != null and categoryName != ''">and categoryName like concat('%', #{categoryName}, |
| | | '%') |
| | | </if> |
| | |
| | | <if test="targettype != null">targettype,</if> |
| | | <if test="targetid != null">targetid,</if> |
| | | <if test="questiontitle != null">questiontitle,</if> |
| | | <if test="nextQuestion != null">next_question,</if> |
| | | <if test="otherdata != null">otherdata,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="templateQuestionNum != null">#{templateQuestionNum},</if> |
| | |
| | | <if test="targettype != null">#{targettype},</if> |
| | | <if test="targetid != null">#{targetid},</if> |
| | | <if test="questiontitle != null">#{questiontitle},</if> |
| | | <if test="nextQuestion != null">#{nextQuestion},</if> |
| | | <if test="otherdata != null">#{otherdata},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="targettype != null">targettype = #{targettype},</if> |
| | | <if test="targetid != null">targetid = #{targetid},</if> |
| | | <if test="questiontitle != null">questiontitle = #{questiontitle},</if> |
| | | <if test="nextQuestion != null">next_question = #{nextQuestion},</if> |
| | | <if test="otherdata != null">otherdata = #{otherdata},</if> |
| | | </trim> |
| | | where ID = #{ID} |
| | | </update> |
| | |
| | | <result property="pid" column="pid"/> |
| | | <result property="guid" column="guid"/> |
| | | <result property="scriptid" column="scriptid"/> |
| | | <result property="nextQuestion" column="next_question"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectIvrLibaTemplateTargetoptionVo"> |
| | |
| | | targetregex2, |
| | | nodynamiccruxs, |
| | | dynamiccruxs, |
| | | targetid, |
| | | next_question, |
| | | optiondesc, language, version, groupid, isabnormal, warnup, warndown, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid |
| | | from ivr_liba_template_targetoption |
| | | </sql> |
| | |
| | | <if test="orgid != null">orgid,</if> |
| | | <if test="pid != null">pid,</if> |
| | | <if test="guid != null">guid,</if> |
| | | <if test="nextQuestion != null">next_question,</if> |
| | | <if test="nodynamiccruxsJson != null ">nodynamiccruxs,</if> |
| | | <if test="dynamiccruxsJson != null ">dynamiccruxs,</if> |
| | | </trim> |
| | |
| | | <if test="orgid != null">#{orgid},</if> |
| | | <if test="pid != null">#{pid},</if> |
| | | <if test="guid != null">#{guid},</if> |
| | | <if test="nextQuestion != null">#{nextQuestion},</if> |
| | | <if test="nodynamiccruxsJson != null ">#{nodynamiccruxsJson},</if> |
| | | <if test="dynamiccruxsJson != null ">#{dynamiccruxsJson},</if> |
| | | </trim> |
| | |
| | | <if test="targetid != null">targetid = #{targetid},</if> |
| | | <if test="scriptid != null">scriptid = #{scriptid},</if> |
| | | <if test="targetname != null">targetname = #{targetname},</if> |
| | | <if test="templateid != null">templateID = #{templateid},</if> |
| | | <if test="templateID != null">templateID = #{templateID},</if> |
| | | <if test="targettype != null and targettype != ''">targettype = #{targettype},</if> |
| | | <if test="categoryName != null and categoryName != ''">categoryName = #{categoryName},</if> |
| | | <if test="targetvalue != null">targetvalue = #{targetvalue},</if> |
| | |
| | | <if test="orgid != null">orgid = #{orgid},</if> |
| | | <if test="pid != null">pid = #{pid},</if> |
| | | <if test="guid != null">guid = #{guid},</if> |
| | | <if test="nextQuestion != null">next_question = #{nextQuestion},</if> |
| | | <if test="nodynamiccruxsJson != null ">nodynamiccruxs = #{nodynamiccruxsJson},</if> |
| | | <if test="dynamiccruxsJson != null ">dynamiccruxs = #{dynamiccruxsJson},</if> |
| | | </trim> |
| | |
| | | <result property="icdName" column="icd_name"/> |
| | | <result property="medicalRecordNo" column="medical_record_no"/> |
| | | <result property="preachcontent" column="preachcontent"/> |
| | | <result property="sendType" column="send_type"/> |
| | | <result property="sendTimeSlot" column="send_time_slot"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectIvrTaskcallVo"> |
| | |
| | | guid, |
| | | text_param, |
| | | serviceform, |
| | | badNo, |
| | | icdName, |
| | | medicalRecordNo, |
| | | bad_no, |
| | | icd_name, |
| | | send_type, |
| | | medical_record_no, |
| | | send_time_slot, |
| | | preachcontent |
| | | from ivr_taskcall |
| | | </sql> |
| | |
| | | <if test="uploadTime != null ">and upload_time = #{uploadTime}</if> |
| | | <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> |
| | | <if test="pid != null ">and pid = #{pid}</if> |
| | | <if test="piserviceformd != null ">and serviceform = #{serviceform}</if> |
| | | <if test="serviceform != null ">and serviceform = #{serviceform}</if> |
| | | <if test="guid != null and guid != ''">and guid = #{guid}</if> |
| | | <if test="textParam != null and textParam != ''">and text_param = #{textParam}</if> |
| | | <if test="badNo != null">and bad_no = #{badNo}</if> |
| | | <if test="icdName != null and icdName != ''">and icd_name = #{icdName}</if> |
| | | <if test="medicalRecordNo != null and medicalRecordNo != ''">and medical_record_no = #{medicalRecordNo}</if> |
| | | <if test="medicalRecordNo != null and medicalRecordNo != ''">and medical_record_no = #{medicalRecordNo} |
| | | </if> |
| | | <if test="preachcontent != null and preachcontent != ''">and preachcontent = #{preachcontent}</if> |
| | | <if test="sendType != null and sendType != ''">and send_type = #{sendType}</if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertIvrTaskcall" parameterType="com.smartor.domain.IvrTaskcall"> |
| | | <insert id="insertIvrTaskcall" parameterType="com.smartor.domain.IvrTaskcall" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into ivr_taskcall |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="sendname != null">sendname,</if> |
| | | <if test="phone != null">phone,</if> |
| | | <if test="sex != null">sex,</if> |
| | |
| | | <if test="icdName != null and icdName != ''">icd_name,</if> |
| | | <if test="medicalRecordNo != null and medicalRecordNo != ''">medical_record_no,</if> |
| | | <if test="preachcontent != null and preachcontent != ''">preachcontent,</if> |
| | | <if test="sendType != null and sendType != ''">send_type,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="sendname != null">#{sendname},</if> |
| | | <if test="phone != null">#{phone},</if> |
| | | <if test="sex != null">#{sex},</if> |
| | |
| | | <if test="icdName != null and icdName != ''">#{icdName},</if> |
| | | <if test="medicalRecordNo != null and medicalRecordNo != ''">#{medicalRecordNo},</if> |
| | | <if test="preachcontent != null and preachcontent != ''">#{preachcontent},</if> |
| | | <if test="sendType != null and sendType != ''">#{sendType},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="icdName != null and icdName != ''">icd_name = #{icdName},</if> |
| | | <if test="medicalRecordNo != null and medicalRecordNo != ''">medical_record_no = #{medicalRecordNo},</if> |
| | | <if test="preachcontent != null and preachcontent != ''">preachcontent = #{preachcontent},</if> |
| | | <if test="sendType != null and sendType != ''">send_type = #{sendType},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <select id="getDataByTime" resultMap="IvrTaskcallResult"> |
| | | |
| | | select id, |
| | | sendname, |
| | | phone, |
| | | sex, |
| | | age, |
| | | sfzh, |
| | | addr, |
| | | senderdetail, |
| | | type, |
| | | taskid, |
| | | templateid, |
| | | templatename, |
| | | senddate, |
| | | sendlimitabegin, |
| | | sendlimitaend, |
| | | sendlimitpbegin, |
| | | sendlimitpend, |
| | | sendlimitnbegin, |
| | | sendlimitnend, |
| | | sendstate, |
| | | senduuid, |
| | | result, |
| | | finishtime, |
| | | userid, |
| | | username, |
| | | outbounduuid, |
| | | recordid, |
| | | recallcount, |
| | | exrecallcount, |
| | | pulltime, |
| | | bqsms, |
| | | bhsms, |
| | | deptcode, |
| | | labelstatus, |
| | | del_flag, |
| | | update_by, |
| | | update_time, |
| | | create_by, |
| | | create_time, |
| | | isupload, |
| | | upload_time, |
| | | orgid, |
| | | pid, |
| | | guid, |
| | | text_param, |
| | | serviceform, |
| | | bad_no, |
| | | icd_name, |
| | | send_type, |
| | | medical_record_no, |
| | | preachcontent, |
| | | send_time_slot |
| | | FROM ivr_taskcall, |
| | | JSON_TABLE(send_time_slot, '$[*]' COLUMNS ( |
| | | begantime DATETIME PATH '$.begantime', |
| | | endtime DATETIME PATH '$.endtime' |
| | | )) AS jt |
| | | WHERE jt.begantime > #{beganTime} |
| | | AND jt.begantime <= #{endTime} |
| | | AND sendstate IS NULL |
| | | </select> |
| | | |
| | | |
| | | </mapper> |