From fdf1b9c1e4489a0c2615fa596268b2f71fad7b4c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 15 四月 2024 09:08:10 +0800
Subject: [PATCH] 代码提交
---
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml | 15
ruoyi-admin/src/main/java/com/ruoyi/web/aa.puml | 170 ++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/hanler/ChatWebSocketHandler.java | 281 ++++
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpEntity.java | 40
smartor/src/main/java/com/smartor/config/RabbitMqConfig.java | 91 +
smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java | 60 +
ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java | 358 ++++++
smartor/src/main/java/com/smartor/domain/SocketMessage.java | 5
smartor/src/main/java/com/smartor/service/impl/IvrTaskcallServiceImpl.java | 346 +++++
smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplateMapper.java | 6
smartor/pom.xml | 6
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java | 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java | 41
smartor/src/main/resources/mapper/smartor/IvrLibaExtemplateMapper.xml | 6
ruoyi-admin/src/main/java/com/ruoyi/web/task/PhoneTask.java | 58 +
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml | 11
ruoyi-common/src/main/java/com/ruoyi/common/utils/xml/XmlRequestBody.java | 10
smartor/src/main/java/com/smartor/config/PhoneUtils.java | 275 ++++
smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplatescriptMapper.java | 30
smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplateServiceImpl.java | 13
smartor/src/main/java/com/smartor/service/IIvrLibaExtemplatescriptService.java | 4
smartor/src/main/java/com/smartor/mapper/IvrTaskcallMapper.java | 12
smartor/src/main/java/com/smartor/domain/IvrTaskcallVO.java | 15
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplateController.java | 4
smartor/src/main/java/com/smartor/domain/IvrTaskcall.java | 29
ruoyi-common/src/main/java/com/ruoyi/common/utils/xml/XmlResponseBody.java | 10
ruoyi-common/src/main/java/com/ruoyi/common/exception/HttpRequestException.java | 34
ruoyi-admin/src/main/resources/application.yml | 12
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplatescriptController.java | 2
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java | 15
smartor/src/main/java/com/smartor/domain/QuestionMessage.java | 28
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml | 8
smartor/src/main/java/com/smartor/domain/IvrLibaExtemplatescript.java | 41
smartor/src/main/java/com/smartor/service/IIvrTaskcallService.java | 17
ruoyi-admin/src/main/resources/logback.xml | 18
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java | 20
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java | 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java | 87 +
ruoyi-common/src/main/java/com/ruoyi/common/utils/json/JsonRequestBody.java | 11
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateVO.java | 21
smartor/src/main/java/com/smartor/domain/TaskSendTimeVO.java | 44
smartor/src/main/resources/mapper/smartor/IvrLibaExtemplatescriptMapper.xml | 51
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java | 254 ----
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java | 143 -
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpBody.java | 6
smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java | 24
smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptServiceImpl.java | 45
smartor/src/main/java/com/smartor/service/impl/PersonVoiceServiceImpl.java | 17
smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java | 24
smartor/src/main/java/com/smartor/domain/IvrLibaExtemplate.java | 2
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java | 15
smartor/src/main/resources/mapper/smartor/IvrTaskcallMapper.xml | 88 +
smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplatescriptServiceImpl.java | 38
smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java | 12
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java | 106 -
ruoyi-admin/pom.xml | 8
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java | 6
smartor/src/main/java/com/smartor/service/IIvrLibaExtemplateService.java | 6
smartor/src/main/java/com/smartor/service/PersonVoiceService.java | 2
ruoyi-common/pom.xml | 11
smartor/src/main/java/com/smartor/service/impl/IvrLibaTemplateServiceImpl.java | 37
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/PersonVoiceController.java | 45
smartor/src/main/java/com/smartor/domain/IvrLibaTargetoption.java | 16
ruoyi-admin/src/main/resources/application-druid.yml | 30
ruoyi-common/src/main/java/com/ruoyi/common/utils/json/JsonResponseBody.java | 11
ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java | 118 ++
66 files changed, 2,770 insertions(+), 605 deletions(-)
diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index 7340354..95b56e5 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -130,7 +130,11 @@
<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>
@@ -163,4 +167,4 @@
<finalName>${project.artifactId}</finalName>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
index 6e1d70b..3ede9ae 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
@@ -29,7 +29,7 @@
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
- //寮�鍚疭OCKET
- new SocketCommunication().socketCommunication();
+// //寮�鍚疭OCKET
+// new SocketCommunication().socketCommunication();
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/aa.puml b/ruoyi-admin/src/main/java/com/ruoyi/web/aa.puml
new file mode 100644
index 0000000..526f836
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/aa.puml
@@ -0,0 +1,170 @@
+@startuml
+start
+:鍏ュ弬锛寀serid,socketMessage;
+ note right
+ //鍙戦�佸唴绌虹殑绫诲瀷锛坱ext,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鑾峰彇妯℃澘淇℃伅锛屽苟灏嗕俊鎭斁鍒皉edis涓紝
+ key涓簎serId + "ivrLibaTemplateVO1"锛岃繃鏈熸椂闂�2灏忔椂;
+ note left
+ 鐩存帴璋冪敤ivrLibaTemplateService.selectInfoByCondition
+ 鑾峰彇鍒扳�滄ā鏉夸俊鎭�濄�佲�滈棶棰樿瘽鏈�濄�佲�滆瘽鏈�夐」鈥�
+ end note
+ :浠庤繑鍥炵殑妯℃澘淇℃伅涓幏鍙栭棶棰樿瘽鏈泦鍚�
+ 骞跺皢闆嗗悎鏀惧埌redis涓紝key涓簎serId + "ivrLibaTemplateScriptVOList";
+ note left
+ List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList
+ 鏍规嵁IvrLibaTemplateScriptVO涓殑Targetid锛堟殏鏃跺綋涓�涓棶棰樼殑搴忓彿锛�
+ 鎺掑簭涓�涓�
+ end note
+ :瀹氫箟涓�浜況edis,杩欓噷涔嬫墍浠ュぇ閲忕敤redis,鏄敤鏉ヨ繘琛屽杩涚▼闅旂;
+ note left
+ userId + "backQuset" 鐢ㄦ潵杩斿洖璋冩煡鐨勬�荤粨鏋�
+ userId + "noVoice" 鐢ㄦ潵璁板綍鏃犲0鍝嶅簲娆℃暟
+ userId + "mateNum" 鐢ㄦ潵璁板綍鏃犲尮閰嶆鏁�
+ userId + "isOver" 鐢ㄦ潵璁板綍鏁翠釜闂嵎鏄惁缁撴潫 0 锛氭湭缁撴潫 1锛氱粨鏉�
+ end note
+ :浠巌vrLibaTemplateScriptVOList涓幏鍙栧埌targetid涓�1鐨勯
+ 鏀惧埌QuestionMessage涓�;
+ note left
+ QuestionMessage鐨勫瓧娈典负
+ String content 杩斿洖鐨勫唴瀹�
+ String kcb 寮�鍦虹櫧
+ String jsy 缁撴潫璇�
+ IvrLibaTemplateScriptVO nowQuestion 褰撳墠闂
+ end note
+ :瀹氫箟鈥滃紑鍦虹櫧鈥濓紝
+ 鍜� userId + "returnQues" 鐨剅edis;
+ }
+
+
+else (涓虹┖)
+ :鑾峰彇鍓嶇杩斿洖鐨剄uestionMessage鈥滈棶棰樹俊鎭��;
+ :鍘籸edis涓幏鍙栧埌鈥滆瘽鏈棶棰橀泦鍚堚��
+ List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOList;
+ :鑾峰彇鍒板綋鍓嶇殑瑕侀棶棰樼殑闂浠巕uestionMessage涓紝
+ IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO;
+ :鍘籸edis涓幏鍙栨ā鏉夸俊鎭�,IvrLibaTemplateVO ivrLibaTemplateVO1;
+ if(questionMessage鐨刢ontent涓虹┖锛岃鏄庡鏂规病鏈夊洖绛�) then(true)
+ partition "闈欓粯璇濇湳" {
+ :鍏堝幓redis涓紝鑾峰彇褰撳墠鐢ㄦ埛鐨勫璇ラ鐨勫疄闄呴潤榛樻鏁� Integer noVoice;
+ if(瀹為檯闈欓粯娆℃暟鏄惁绛変簬妯℃澘涓厤缃殑娆℃暟,noVoice == ivrLibaTemplateVO1.getNoVoiceNum().intValue()) then(true)
+ :璇ラ璁板綍鍒拌皟鏌ョ殑鎬荤粨鏋滀腑锛屽嵆backQuset涓�,鏇存柊redis涓殑userId + "backQuset";
+ if(鏈鐨則argetid 绛変簬 棰樼洰鏁伴噺鐨勬渶澶у�硷紝鍗砳vrLibaTemplateScriptVO.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(涓嶇瓑浜�)
+ :鍒欒繕鏈変笅涓�棰�,灏辨牴鎹綋鍓峵eagetID+1 鑾峰彇涓嬩竴棰�
+ 骞跺皢涓嬩竴棰樼殑淇℃伅鏀惧埌reids涓紝key涓簎serId + "returnQues", returnQues
+ 灏唘serId + "noVoice"娓呴浂;
+ endif
+ else(瀹為檯闈欓粯娆℃暟鏄惁 涓嶇瓑浜� 妯℃澘涓厤缃殑娆℃暟) then(false)
+ :杩涜鍐嶅皢璇㈤棶;
+ :鍘籸edis涓幏鍙杣serId + "noVoice"锛堝疄闄呯殑闈欓粯娆℃暟锛�,寰楀埌Integer noVoice2
+ 瀵瑰疄闄呴潤榛樻鏁板姞1,鍐嶆斁鍥瀝eids涓�;
+ endif
+ }
+ else (瀵规柟鏈夊洖绛�) then(false)
+ partition "寰幆鏈鐨勯�夐」锛宨vrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList()" {
+ :鑾峰彇寰幆锛岃幏鍙栧埌閫夐」鐨勬鍒欏尮閰�,
+ 鍐嶈幏鍙栧埌鐢ㄦ埛鐨勫洖绛斾俊鎭紝杩涜姝e垯鍖归厤;
+ note right
+ Pattern pattern = Pattern.compile(ivrLibaTemplateScriptVO.getIvrLibaScriptTargetoptionList().get(j).getTargetregex());
+ Matcher matcher = pattern.matcher(questionMessage.getContent());
+ end note
+ if(鍖归厤鍒颁簡) then(matcher.matches()涓簍rue)
+ :鍒欏皢璇ラ�夐」涓殑IsUserOperation,璁剧疆鎴恡rue锛堝墠绔細鏍规嵁杩欎釜鎷垮�硷級;
+ :鍘籸edis涓幏鍙杣serId + "backQuset",寰楀埌 List<IvrLibaTemplateScriptVO> backQuset;
+ :灏嗚棰樼殑淇℃伅鏀惧埌backQuset涓�;
+ :鏇存柊redis涓殑userId + "backQuset",骞跺皢userId + "noVoice"缃负0;
+ :缁撴潫褰撳墠寰幆;
+ :閫氳繃褰撳墠姝g‘閫夐」鐨刵extQeestion锛岃幏鍙栦笅涓�棰樼殑targetID,鍐嶅幓ivrLibaTemplateScriptVOList锛�
+ 杩涜鍖归厤锛岃幏鍙朓vrLibaTemplateScriptVO锛堜笅涓�棰樼殑淇℃伅锛�;
+ :灏嗚幏鍙栧埌鐨勯淇℃伅鏀惧埌redis涓紝key涓簎serId + "returnQues";
+ else(娌″尮閰嶅埌)
+ :鍘籸edis涓幏鍙杣serId + "mateNum",寰楀埌Integer mateNum(鏃犲尮閰嶆鏁�);
+ :鏃犲尮閰嶆鏁板幓鍒ゆ柇鏄惁鍒版渶澶ц闂鏁帮紝骞朵笖鏄惁鎵�鏈夌殑閫夐」閮藉尮閰嶅畬浜�;
+ if(鏃犲尮閰嶆鏁扳�滅瓑浜庘�濇渶澶ц闂鏁帮紝骞朵笖鎵�鏈夌殑閫夐」閮藉尮閰嶅畬浜�) then(true)
+ :鍘籸edis涓幏鍙杣serId + "backQuset",寰楀埌 List<IvrLibaTemplateScriptVO> backQuset;
+ :灏嗚棰樼殑淇℃伅鏀惧埌backQuset涓�,鏇存柊redis涓殑userId + "backQuset";
+ :鍒ゆ柇鏄惁杩樻湁涓嬩竴棰�;
+ if(鏈鐨則argetid < 鎬婚鏁�) then(鏈変笅涓�棰�)
+ :鍒欒繕鏈変笅涓�棰�,灏辨牴鎹綋鍓峵eagetID+1 鑾峰彇涓嬩竴棰�
+ 骞跺皢涓嬩竴棰樼殑淇℃伅鏀惧埌reids涓紝key涓簎serId + "returnQues",
+ 灏唘serId + "mateNum"娓呴浂;
+ else(娌℃湁棰樹簡)
+ :瀹氫箟涓�涓┖鐨凲uestionMessage returnQues2(鐢ㄤ簬杩斿弬);
+ :鍘籸eids涓幏鍙杣serId + "backQuset"锛屾斁鍒皉eturnQues2鐨刢ontent涓�;
+ :缁檙eturnQues2璁剧疆缁撴潫璇�;
+ :鏇存柊redis涓殑userId + "returnQues";
+ :灏唕edis涓殑userId + "isOver"鍊硷紝璁剧疆涓�1锛堣〃绀烘暣涓祦绋嬬粨鏉燂級;
+ endif
+
+ else(鏃犲尮閰嶆鏁扳�滃皬浜庘�濇渶澶ц闂鏁帮紝骞朵笖鎵�鏈夌殑閫夐」閮藉尮閰嶅畬浜�)
+ :鏃犲尮閰嶆鏁�+1,鏇存柊redis涓殑userId + "mateNum";
+ endif
+ endif
+ }
+ :閫夐」鍖归厤瀹屾垚鍚�,闇�瑕佸啀鍘婚�氳繃搴撳啀杩涜鍖归厤涓�娆�;
+ :鍘绘ā鏉夸俊鎭腑鑾峰彇閫氳繃搴撴ā鏉縄D闆嗗悎;
+ note right
+ String extemplateID = ivrLibaTemplateVO1.getSubmoduleID();
+ end note
+ if(閫氱敤搴撴ā鏉縄D闆嗗悎涓嶄负绌�) then(true)
+ :閫氳繃閫氱敤搴撴ā鏉縄D鑾峰彇閫氳繃璇濇湳淇℃伅闆嗗悎;
+ note right
+ List<IvrLibaExtemplatescript> ivrLibaExtemplatescripts = ivrLibaExtemplatescriptMapper.queryIvrLibaExtemplatescriptList(list1);
+ end note
+ partition "寰幆閫氱敤璇濇湳闆嗗悎List<IvrLibaExtemplatescript> ivrLibaExtemplatescripts" {
+ :閫氳繃姝e垯灏嗗墠绔紶鍥炵殑缁撴灉锛屽拰閬嶅巻鍑烘潵鐨勮瘽鏈鍒欒繘琛屽尮閰�;
+ :鍖归厤鍒板悗锛屽幓redis涓幏鍙杣serId + "returnQues",灏嗙瓟妗堟斁鍒伴棶棰樺璞′腑鐨剆ubmoduleText涓�;
+ 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
+:鍘籸edis涓幏鍙杣serId + "returnQues",灏嗙粨鏋滆繑鍥炵粰鍓嶇;
+:娓呯┖redis鎵�鏈夌殑鍙橀噺;
+
+note left
+ //鏁翠釜娴佺▼鏄惁缁撴潫锛屽皢redis涓殑璇serId涓嬬殑鏁版嵁鍒犻櫎;
+ 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
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java
new file mode 100644
index 0000000..4208bc2
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java
@@ -0,0 +1,118 @@
+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浣嗘槸鏈夊彲鑳借鍏跺畠鐨刢onsumer(闆嗙兢)鎺ユ敹鍒帮紝
+// * 璁剧疆涓篺alse鏄彧琛ュ彂缁欏綋鍓嶇殑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鎷垮埌鎮h�呬俊鎭�
+// 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(浠庨槦鍒椾腑鍒犻櫎)浜� 锛堣繖涓渶瑕佹牴鎹笟鍔″啀鍘诲鐞咥CK锛�
+ channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+ try {
+ log.info("=============Do Something==============");
+ } catch (Exception e) {
+ log.error("============娑堣垂澶辫触,灏濊瘯娑堟伅琛ュ彂鍐嶆娑堣垂!==============");
+ log.error(e.getMessage());
+ /**
+ * basicRecover鏂规硶鏄繘琛岃ˉ鍙戞搷浣滐紝
+ * 鍏朵腑鐨勫弬鏁板鏋滀负true鏄妸娑堟伅閫�鍥炲埌queue浣嗘槸鏈夊彲鑳借鍏跺畠鐨刢onsumer(闆嗙兢)鎺ユ敹鍒帮紝
+ * 璁剧疆涓篺alse鏄彧琛ュ彂缁欏綋鍓嶇殑consumer
+ */
+ channel.basicRecover(false);
+ }
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/hanler/ChatWebSocketHandler.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/hanler/ChatWebSocketHandler.java
index 678eec7..1540222 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/hanler/ChatWebSocketHandler.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/hanler/ChatWebSocketHandler.java
@@ -1,8 +1,15 @@
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;
@@ -11,16 +18,40 @@
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鍜學ebSocketSession鐨勬槧灏勫叧绯�
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 {
@@ -42,7 +73,7 @@
ObjectMapper mapper = new ObjectMapper();
SocketMessage parsedMessage = mapper.readValue(payload, SocketMessage.class);
if (parsedMessage != null) {
- sendMessageToUser(parsedMessage.getUserId(), parsedMessage.getContent());
+ sendMessageToUser(parsedMessage.getUserId(), parsedMessage);
}
}
@@ -79,12 +110,250 @@
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));
+
+ //灏嗘煡鍑烘潵鐨勬暟鎹斁鍒皉edis涓�
+ redisCache.setCacheObject(userId + "ivrLibaTemplateScriptVOList", ivrLibaTemplateScriptVOList, 120, TimeUnit.MINUTES);
+ //鐢ㄦ潵杩斿洖璋冩煡鐨勬�荤粨鏋�
+ redisCache.setCacheObject(userId + "backQuset", new ArrayList<>(), 120, TimeUnit.MINUTES);
+ //鐢ㄦ潵璁板綍鏃犲0鍝嶅簲娆℃暟
+ 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 {
+ //濡傛灉鏈変笅涓�棰橈紝灏辨牴鎹綋鍓峵eagetID+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 {
+ //瀵瑰洖绛旂殑闂,杩涜姝e垯鍖归厤锛堣繖閲屽彧閽堝閫夋嫨棰橈紝鍏跺畠棰樺瀷涓嶈锛�
+ 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()) {
+ //璇存槑鍖归厤姝g‘浜�
+ 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涓殑璇serId涓嬬殑鏁版嵁鍒犻櫎;
+ 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) {
+ // 瀵硅鏉emplateScriptVO杩涜澶勭悊
+ returnQues.setNowQuestion(ivrLibaTemplateScriptVOList.get(j));
+ }
+ }
+ return returnQues;
+ }
-}
\ No newline at end of file
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplateController.java
index 1936d31..a76c116 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplateController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplateController.java
@@ -73,7 +73,7 @@
@Log(title = "閫氳繃妯℃澘", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody IvrLibaExtemplate ivrLibaExtemplate) {
- return toAjax(ivrLibaExtemplateService.insertIvrLibaExtemplate(ivrLibaExtemplate));
+ return AjaxResult.success(ivrLibaExtemplateService.insertIvrLibaExtemplate(ivrLibaExtemplate));
}
/**
@@ -94,7 +94,7 @@
@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));
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplatescriptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplatescriptController.java
index ce6297b..a0f6abd 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplatescriptController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaExtemplatescriptController.java
@@ -94,7 +94,7 @@
@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));
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java
index 425ca41..250db7d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java
@@ -7,12 +7,18 @@
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.*;
@@ -26,12 +32,16 @@
* @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;
/**
* 鏌ヨ妯℃澘搴撳垪琛�
@@ -105,7 +115,6 @@
* 鏂板鎴栦慨鏀归殢璁挎ā鏉垮簱璇︽儏
*/
@ApiOperation("鏂板鎴栦慨鏀归殢璁挎ā鏉垮簱璇︽儏")
- @PreAuthorize("@ss.hasPermi('smartor:script:list')")
@PostMapping("/saveOrUpdateScript")
public AjaxResult saveOrUpdateScript(@RequestBody IvrLibaTemplateVO ivrLibaTemplateVO) {
if (ObjectUtils.isEmpty(ivrLibaTemplateVO)) {
@@ -125,4 +134,34 @@
}
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 -> {
+ //娉ㄦ剰杩欓噷鏃堕棿鍙互浣縧ong锛岃�屼笖鏄缃甴eader
+ message.getMessageProperties().setHeader("x-delay", times);
+ return message;
+ });
+ log.info("-------------寤惰繜闃熷垪{}ms鍚庢墽琛�.-------------", times);
+ return success();
+ }
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java
index 417ca8b..e4a0f9f 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java
@@ -1,15 +1,19 @@
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;
@@ -18,7 +22,9 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
/**
* 鍗曚竴浠诲姟锛堥殢璁匡級Controller
@@ -26,7 +32,7 @@
* @author ruoyi
* @date 2024-02-02
*/
-@Api(description = "鍗曚竴浠诲姟锛堥殢璁匡級")
+@Api(description = "鍗曚竴浠诲姟锛堥殢璁垮鏁欙級")
@RestController
@RequestMapping("/smartor/taskcall")
public class IvrTaskcallController extends BaseController {
@@ -36,7 +42,7 @@
/**
* 鏌ヨ鍗曚竴浠诲姟锛堥殢璁匡級鍒楄〃
*/
- @ApiOperation("鏌ヨ鍗曚竴浠诲姟锛堥殢璁匡級鍒楄〃")
+ @ApiOperation("鏌ヨ鍗曚竴浠诲姟锛堥殢璁垮鏁欙級鍒楄〃")
@PreAuthorize("@ss.hasPermi('system:taskcall:list')")
@PostMapping("/list")
public TableDataInfo list(@RequestBody IvrTaskcall ivrTaskcall) {
@@ -46,10 +52,10 @@
}
/**
- * 瀵煎嚭鍗曚竴浠诲姟锛堥殢璁匡級鍒楄〃
+ * 瀵煎嚭鍗曚竴浠诲姟锛堥殢璁垮鏁欙級鍒楄〃
*/
@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);
@@ -78,5 +84,72 @@
}
+ /**
+ * 鏍规嵁鏉′欢鏌ヨ浠诲姟淇℃伅
+ */
+ @ApiOperation("鏍规嵁鏉′欢鏌ヨ浠诲姟淇℃伅")
+ @PostMapping("/queryTaskByCondition")
+ public AjaxResult queryTaskByCondition(@RequestBody IvrTaskcallVO ivrTaskcallVO) {
+ //鏍规嵁鍏ュ弬鏌ヨ淇℃伅
+ IvrTaskcall ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskcall.class);
+ List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
+
+ //瀹氫箟鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚�
+ 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鍦╮edis涓壘涓嶅埌锛岄偅灏辩洿鎺ユ姤寮傚父
+ return success(ivrTaskcallService.phoneCallBack(phoneCallBackVO));
+ }
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/PersonVoiceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/PersonVoiceController.java
index b1b312f..84838b2 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/PersonVoiceController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/PersonVoiceController.java
@@ -1,46 +1,15 @@
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;
/**
@@ -49,7 +18,7 @@
* @author ls
* @date 2023-11-17
*/
-@Api(description = "浜哄伐璇煶")
+@Api(description = "璇煶鍚堟垚杞崲")
@RestController
@RequestMapping("/smartor/voice")
public class PersonVoiceController extends BaseController {
@@ -66,8 +35,8 @@
@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);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/task/PhoneTask.java b/ruoyi-admin/src/main/java/com/ruoyi/web/task/PhoneTask.java
new file mode 100644
index 0000000..2d8ef9f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/task/PhoneTask.java
@@ -0,0 +1,58 @@
+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);
+ //灏嗘暟鎹斁鍒皉edis涓紝鏂逛究鍦ㄥ洖璋冩柟娉曢噷鑾峰彇
+ 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);
+ //灏嗛棶棰橈紝鍜屾ā鏉夸俊鎭斁鍒皉edis涓�
+ 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);
+
+
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java b/ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java
new file mode 100644
index 0000000..9374f8f
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java
@@ -0,0 +1,20 @@
+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");
+ }
+}
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index c96831d..5484465 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -1,26 +1,49 @@
# 鏁版嵁婧愰厤缃�
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
# 鏈�灏忚繛鎺ユ睜鏁伴噺
@@ -93,4 +116,7 @@
accessKeyId: LTAI4G5zjJRkun2eRdzU8GhR
accessKeySecret: 6EIRr9uZeRobvHBRqskyGwjTLKpHYv
-signName: 鏉窞鍒╂箹绉戞妧
\ No newline at end of file
+signName: 鏉窞鍒╂箹绉戞妧
+
+#鏅鸿兘鍛煎彨
+phoneIP: http://124.220.50.51:8001
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index f18d0ec..60eb4ad 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -71,13 +71,13 @@
enabled: true
# redis 閰嶇疆
redis:
- # 鍦板潃
-# host: 127.0.0.1
- # 绔彛锛岄粯璁や负6379
-# port: 6379
-# # 鍦板潃
+ # # 鍦板潃锛堜箟涔屼簩闄級
+ # host: 127.0.0.1
+ # port: 6020
+
+
+ # 鍦板潃锛堝叕鍙革級
host: 116.62.18.175
-# # 绔彛锛岄粯璁や负6379
port: 6020
# 鏁版嵁搴撶储寮�
database: 0
diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml
index 5207784..ec516c9 100644
--- a/ruoyi-admin/src/main/resources/logback.xml
+++ b/ruoyi-admin/src/main/resources/logback.xml
@@ -11,7 +11,7 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
-
+
<!-- 绯荤粺鏃ュ織杈撳嚭 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
@@ -22,8 +22,8 @@
<!-- 鏃ュ織鏈�澶х殑鍘嗗彶 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">
<!-- 杩囨护鐨勭骇鍒� -->
@@ -34,7 +34,7 @@
<onMismatch>DENY</onMismatch>
</filter>
</appender>
-
+
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� -->
@@ -56,7 +56,7 @@
<onMismatch>DENY</onMismatch>
</filter>
</appender>
-
+
<!-- 鐢ㄦ埛璁块棶鏃ュ織杈撳嚭 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
@@ -70,7 +70,7 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
-
+
<!-- 绯荤粺妯″潡鏃ュ織绾у埆鎺у埗 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring鏃ュ織绾у埆鎺у埗 -->
@@ -79,15 +79,15 @@
<root level="info">
<appender-ref ref="console" />
</root>
-
+
<!--绯荤粺鎿嶄綔鏃ュ織-->
<root level="debug">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
-
+
<!--绯荤粺鐢ㄦ埛鎿嶄綔鏃ュ織-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml
index 9319230..9299be2 100644
--- a/ruoyi-common/pom.xml
+++ b/ruoyi-common/pom.xml
@@ -186,6 +186,17 @@
<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>
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/HttpRequestException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/HttpRequestException.java
new file mode 100644
index 0000000..59f86de
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/HttpRequestException.java
@@ -0,0 +1,34 @@
+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();
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
index d0f8c69..53136cd 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
@@ -3,21 +3,17 @@
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";
@@ -28,64 +24,50 @@
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();
}
/**
* 鑾峰彇褰撳墠鏃ユ湡, 榛樿鏍煎紡涓簓yyy-MM-dd
- *
+ *
* @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);
}
}
@@ -93,8 +75,7 @@
/**
* 鏃ユ湡璺緞 鍗冲勾/鏈�/鏃� 濡�2018/08/08
*/
- public static final String datePath()
- {
+ public static final String datePath() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd");
}
@@ -102,8 +83,7 @@
/**
* 鏃ユ湡璺緞 鍗冲勾/鏈�/鏃� 濡�20180808
*/
- public static final String dateTime()
- {
+ public static final String dateTime() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd");
}
@@ -111,18 +91,13 @@
/**
* 鏃ユ湡鍨嬪瓧绗︿覆杞寲涓烘棩鏈� 鏍煎紡
*/
- 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;
}
}
@@ -130,8 +105,7 @@
/**
* 鑾峰彇鏈嶅姟鍣ㄥ惎鍔ㄦ椂闂�
*/
- public static Date getServerStartDate()
- {
+ public static Date getServerStartDate() {
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time);
}
@@ -139,16 +113,14 @@
/**
* 璁$畻鐩稿樊澶╂暟
*/
- 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;
@@ -169,8 +141,7 @@
/**
* 澧炲姞 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());
}
@@ -178,10 +149,29 @@
/**
* 澧炲姞 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;
+ }
}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
new file mode 100644
index 0000000..dfed36d
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
@@ -0,0 +1,358 @@
+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;
+ /**
+ * 鍝嶅簲涓簄ull
+ */
+ 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);
+ // 浣跨敤杩炴帴姹犳妧鏈垱寤篐ttpClient瀵硅薄
+ 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, "鍝嶅簲涓簄ull");
+ }
+ 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鐨刾ost璇锋眰
+ *
+ * @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涓嶈兘涓簄ull銆�");
+ Assert.notNull(reqEntity.getBody(), "Post璇锋眰body涓嶈兘涓簄ull銆�");
+
+ 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, "鍝嶅簲涓簄ull");
+ }
+ 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涓嶈兘涓簄ull銆�");
+ Assert.notNull(reqEntity.getBody(), "Post璇锋眰body涓嶈兘涓簄ull銆�");
+
+ 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, "鍝嶅簲涓簄ull");
+ }
+ 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涓瓁-request-id鍊间负:{}", requestId);
+ }
+ }
+ }
+
+ private static boolean isNullOrEmpty(String obj) {
+ if (obj == null || obj.isEmpty()) {
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
index ed4cbc9..12f2798 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
@@ -11,6 +11,7 @@
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;
@@ -21,44 +22,35 @@
/**
* 鏂囦欢澶勭悊宸ュ叿绫�
- *
+ *
* @author ruoyi
*/
-public class FileUtils
-{
+public class FileUtils {
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
/**
* 杈撳嚭鎸囧畾鏂囦欢鐨刡yte鏁扮粍
- *
+ *
* @param filePath 鏂囦欢璺緞
- * @param os 杈撳嚭娴�
+ * @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);
}
@@ -71,33 +63,28 @@
* @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());
}
/**
* 鍐欐暟鎹埌鏂囦欢涓�
*
- * @param data 鏁版嵁
+ * @param data 鏁版嵁
* @param uploadDir 鐩爣鏂囦欢
* @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);
@@ -105,17 +92,15 @@
/**
* 鍒犻櫎鏂囦欢
- *
+ *
* @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;
@@ -123,32 +108,28 @@
/**
* 鏂囦欢鍚嶇О楠岃瘉
- *
+ *
* @param filename 鏂囦欢鍚嶇О
* @return true 姝e父 false 闈炴硶
*/
- public static boolean isValidFilename(String filename)
- {
+ public static boolean isValidFilename(String filename) {
return filename.matches(FILENAME_PATTERN);
}
/**
* 妫�鏌ユ枃浠舵槸鍚﹀彲涓嬭浇
- *
+ *
* @param resource 闇�瑕佷笅杞界殑鏂囦欢
* @return true 姝e父 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;
}
@@ -158,33 +139,25 @@
/**
* 涓嬭浇鏂囦欢鍚嶉噸鏂扮紪鐮�
- *
- * @param request 璇锋眰瀵硅薄
+ *
+ * @param request 璇锋眰瀵硅薄
* @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");
}
@@ -194,20 +167,14 @@
/**
* 涓嬭浇鏂囦欢鍚嶉噸鏂扮紪鐮�
*
- * @param response 鍝嶅簲瀵硅薄
+ * @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());
@@ -220,36 +187,26 @@
* @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;
@@ -257,14 +214,12 @@
/**
* 鑾峰彇鏂囦欢鍚嶇О /profile/upload/2022/04/16/ruoyi.png -- ruoyi.png
- *
+ *
* @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('/');
@@ -275,14 +230,12 @@
/**
* 鑾峰彇涓嶅甫鍚庣紑鏂囦欢鍚嶇О /profile/upload/2022/04/16/ruoyi.png -- ruoyi
- *
+ *
* @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);
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpBody.java
new file mode 100644
index 0000000..192036d
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpBody.java
@@ -0,0 +1,6 @@
+package com.ruoyi.common.utils.http;
+
+
+public interface HttpBody {
+
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpEntity.java
new file mode 100644
index 0000000..3465070
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpEntity.java
@@ -0,0 +1,40 @@
+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;
+ }
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/json/JsonRequestBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/json/JsonRequestBody.java
new file mode 100644
index 0000000..5d4181f
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/json/JsonRequestBody.java
@@ -0,0 +1,11 @@
+package com.ruoyi.common.utils.json;
+
+
+import com.ruoyi.common.utils.http.HttpBody;
+
+/**
+ * Json鏍煎紡鐨刪ttp璇锋眰body
+*/
+public interface JsonRequestBody extends HttpBody {
+
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/json/JsonResponseBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/json/JsonResponseBody.java
new file mode 100644
index 0000000..c6e0e9f
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/json/JsonResponseBody.java
@@ -0,0 +1,11 @@
+package com.ruoyi.common.utils.json;
+
+
+import com.ruoyi.common.utils.http.HttpBody;
+
+/**
+ * Json鏍煎紡鐨刪ttp鍝嶅簲body
+*/
+public interface JsonResponseBody extends HttpBody {
+
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/xml/XmlRequestBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/xml/XmlRequestBody.java
new file mode 100644
index 0000000..3a54d40
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/xml/XmlRequestBody.java
@@ -0,0 +1,10 @@
+package com.ruoyi.common.utils.xml;
+
+import com.ruoyi.common.utils.http.HttpBody;
+
+/**
+ * xml鏍煎紡鐨刪ttp璇锋眰浣�
+*/
+public interface XmlRequestBody extends HttpBody {
+
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/xml/XmlResponseBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/xml/XmlResponseBody.java
new file mode 100644
index 0000000..6bd1a49
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/xml/XmlResponseBody.java
@@ -0,0 +1,10 @@
+package com.ruoyi.common.utils.xml;
+
+import com.ruoyi.common.utils.http.HttpBody;
+
+/**
+ * xml鏍煎紡鐨刪ttp鍝嶅簲浣�
+*/
+public interface XmlResponseBody extends HttpBody {
+
+}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
index 6a0d547..c3883d0 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -108,7 +108,7 @@
// 杩囨护璇锋眰
.authorizeRequests()
// 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶
- .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo","/socket","/API_ESB_Service","/API_ESB_Service/Run","/magic/web/**").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()
// 闄や笂闈㈠鐨勬墍鏈夎姹傚叏閮ㄩ渶瑕侀壌鏉冭璇�
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
index 3c95c18..a4c600b 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
@@ -124,7 +124,7 @@
*/
@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());
@@ -136,7 +136,7 @@
*/
@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("浠诲姟涓嶅瓨鍦ㄦ垨宸茶繃鏈燂紒");
@@ -147,7 +147,7 @@
*/
@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();
diff --git a/smartor/pom.xml b/smartor/pom.xml
index abede7c..cb88cb8 100644
--- a/smartor/pom.xml
+++ b/smartor/pom.xml
@@ -114,6 +114,12 @@
<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>
diff --git a/smartor/src/main/java/com/smartor/config/PhoneUtils.java b/smartor/src/main/java/com/smartor/config/PhoneUtils.java
new file mode 100644
index 0000000..a1ca8d3
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/config/PhoneUtils.java
@@ -0,0 +1,275 @@
+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銆佹鏌ュ垎鏈烘槸鍚﹀瓨鍦╟heck_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
+ * 鍚戠郴缁熶腑娣诲姞涓�涓潗甯紝鍚庣画闇�瑕乻et_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");
+ }
+
+ /**
+ * 鑾峰彇鍧愬腑褰撳墠鎵�鍦ㄩ�氳瘽鐨剈uid
+ *
+ * @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");
+ }
+
+ /**
+ * 璁剧疆鍧愬腑鐨剆tatus锛屾湁鍥哄畾鍑犱釜鐘舵��
+ *
+ * @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;
+ }
+}
diff --git a/smartor/src/main/java/com/smartor/config/RabbitMqConfig.java b/smartor/src/main/java/com/smartor/config/RabbitMqConfig.java
new file mode 100644
index 0000000..aab306a
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/config/RabbitMqConfig.java
@@ -0,0 +1,91 @@
+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<>();
+// //鎸囧畾閫氫俊鏂瑰紡涓簍opic
+// arguments.put("x-delayed-type", "topic");
+// //浣跨敤CustomExchange绫诲垱寤猴紝绫诲瀷瑕佹寚瀹氫负鈥渪-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();
+ }
+
+}
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaExtemplate.java b/smartor/src/main/java/com/smartor/domain/IvrLibaExtemplate.java
index 6f05635..e3561a6 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaExtemplate.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaExtemplate.java
@@ -27,7 +27,7 @@
* 涓婚敭id
*/
@ApiModelProperty("涓婚敭id")
- private String ID;
+ private Long ID;
/**
* 妯$増鍚嶅瓧
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaExtemplatescript.java b/smartor/src/main/java/com/smartor/domain/IvrLibaExtemplatescript.java
index 0bbc10d..728c4fc 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaExtemplatescript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaExtemplatescript.java
@@ -1,6 +1,8 @@
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;
@@ -26,14 +28,14 @@
* 涓婚敭id
*/
@ApiModelProperty("涓婚敭id")
- private String ID;
+ private Long ID;
/**
* 妯$増搴搃d
*/
@Excel(name = "妯$増搴搃d")
@ApiModelProperty("妯$増搴搃d")
- private String extID;
+ private Long extID;
/**
* 搴忓彿id
@@ -57,12 +59,34 @@
private String switchWav;
/**
- * 鍖归厤瑙勫垯
+ * 鍖归厤瑙勫垯(鍖呭惈鍏崇郴)
*/
- @Excel(name = "鍖归厤瑙勫垯")
- @ApiModelProperty("鍖归厤瑙勫垯")
+ @Excel(name = "鍖归厤瑙勫垯(鍖呭惈鍏崇郴)")
+ @ApiModelProperty("鍖归厤瑙勫垯(鍖呭惈鍏崇郴)")
private String selfRegex;
+ /**
+ * 鍖归厤瑙勫垯(涓嶅寘鍚叧绯�)
+ */
+ @Excel(name = "鍖归厤瑙勫垯(涓嶅寘鍚叧绯�)")
+ @ApiModelProperty("鍖归厤瑙勫垯(涓嶅寘鍚叧绯�)")
+ private String selfRegex2;
+
+
+
+ @Excel(name = "姝e垯鍏抽敭瀛楅泦鍚�(鍚�)")
+ private String nodynamiccruxsJson;
+
+ @Excel(name = "姝e垯鍏抽敭瀛楅泦鍚�(涓嶅惈)")
+ private String dynamiccruxsJson;
+
+ @ApiModelProperty(value = "姝e垯鍏抽敭瀛�(鍚�)")
+ @Excel(name = "姝e垯鍏抽敭瀛�(鍚�)")
+ private List<String> nodynamiccruxs = new ArrayList<>();
+
+ @ApiModelProperty(value = "姝e垯鍏抽敭瀛�(涓嶅惈)")
+ @Excel(name = "姝e垯鍏抽敭瀛�(涓嶅惈)")
+ private List<String> dynamiccruxs = new ArrayList<>();
/**
* 鍚敤
*/
@@ -106,6 +130,13 @@
private Long pid;
/**
+ * 鏄惁缁撴潫 0锛氫笉缁撴潫 1锛氱粨鏉�
+ */
+ @Excel(name = "鏄惁缁撴潫 0锛氫笉缁撴潫 1锛氱粨鏉�")
+ @ApiModelProperty("鏄惁缁撴潫 0锛氫笉缁撴潫 1锛氱粨鏉�")
+ private Long isEnd;
+
+ /**
* GUID
*/
@Excel(name = "GUID")
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java b/smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java
index 3641da1..b122d5a 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaScriptTargetoption.java
@@ -277,11 +277,7 @@
}
public void setNodynamiccruxsJson(String nodynamiccruxsJson) {
- if (this.nodynamiccruxs != null) {
- this.nodynamiccruxsJson = new Gson().toJson(this.nodynamiccruxs);
- } else {
- this.nodynamiccruxsJson = nodynamiccruxsJson;
- }
+ this.nodynamiccruxsJson = nodynamiccruxsJson;
}
public String getDynamiccruxsJson() {
@@ -289,11 +285,7 @@
}
public void setDynamiccruxsJson(String dynamiccruxsJson) {
- if (this.dynamiccruxs != null) {
- this.dynamiccruxsJson = new Gson().toJson(this.dynamiccruxs);
- } else {
- this.dynamiccruxsJson = dynamiccruxsJson;
- }
+ this.dynamiccruxsJson = dynamiccruxsJson;
}
public List<String> getNodynamiccruxs() {
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTargetoption.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTargetoption.java
index efa9a8b..d73bac6 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTargetoption.java
@@ -69,12 +69,12 @@
@ApiModelProperty(value = "姝e垯鍏抽敭瀛�(鍚�)")
@Excel(name = "姝e垯鍏抽敭瀛�(鍚�)")
@JsonFormat
- private List<String> nodynamiccruxs=new ArrayList<>();
+ private List<String> nodynamiccruxs = new ArrayList<>();
@ApiModelProperty(value = "姝e垯鍏抽敭瀛�(涓嶅惈)")
@Excel(name = "姝e垯鍏抽敭瀛�(涓嶅惈)")
@JsonFormat
- private List<String> dynamiccruxs=new ArrayList<>();
+ private List<String> dynamiccruxs = new ArrayList<>();
@ApiModelProperty(value = "閫夐」鎻忚堪")
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
@@ -235,11 +235,7 @@
}
public void setNodynamiccruxsJson(String nodynamiccruxsJson) {
- if (this.nodynamiccruxs != null) {
- this.nodynamiccruxsJson = new Gson().toJson(this.nodynamiccruxs);
- } else {
- this.nodynamiccruxsJson = nodynamiccruxsJson;
- }
+ this.nodynamiccruxsJson = nodynamiccruxsJson;
}
public String getDynamiccruxsJson() {
@@ -247,11 +243,7 @@
}
public void setDynamiccruxsJson(String dynamiccruxsJson) {
- if (this.dynamiccruxs != null) {
- this.dynamiccruxsJson = new Gson().toJson(this.dynamiccruxs);
- } else {
- this.dynamiccruxsJson = dynamiccruxsJson;
- }
+ this.dynamiccruxsJson = dynamiccruxsJson;
}
public List<String> getNodynamiccruxs() {
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java
index 0659c20..bf0404d 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java
@@ -1,6 +1,8 @@
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;
@@ -152,8 +154,8 @@
/**
* 閫氱敤鍖归厤璇濇湳id
*/
- @Excel(name = "閫氱敤鍖归厤璇濇湳id")
- @ApiModelProperty(value = "閫氱敤鍖归厤璇濇湳id")
+ @Excel(name = "閫氱敤鍖归厤璇濇湳id锛堥�氱敤妯℃澘ID锛�")
+ @ApiModelProperty(value = "閫氱敤鍖归厤璇濇湳id锛堥�氱敤妯℃澘ID锛�")
private String submoduleID;
/**
@@ -248,6 +250,13 @@
private Long mateNum;
/**
+ * 闈欓粯娆℃暟
+ */
+ @Excel(name = "闈欓粯娆℃暟")
+ @ApiModelProperty(value = "闈欓粯娆℃暟")
+ private Long noVoiceNum = 0L;
+
+ /**
* GUID
*/
@Excel(name = "GUID")
@@ -313,17 +322,18 @@
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;
+
}
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
index eaa6c19..c083778 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScript.java
@@ -222,10 +222,16 @@
private Integer targettype;
/**
+ * 涓嬩竴棰�
+ */
+ @ApiModelProperty(value = "涓嬩竴棰�")
+ private Integer nextQuestion;
+
+ /**
* 鏄惁瀛樺湪鎿嶄綔锛�1 鏂板 2淇敼 3鍒犻櫎
*/
@ApiModelProperty(value = "鎸囨爣ID")
- private Long targetid;
+ private Integer targetid;
/**
@@ -233,4 +239,11 @@
*/
@ApiModelProperty(value = "鎸囨爣鍊�")
private Integer targetvalue;
+
+ /**
+ * 鏍囩
+ */
+ @Excel(name = "鍏跺畠鏁版嵁锛堝瓨鍌ㄥ彉閲忥級")
+ @ApiModelProperty(value = "鍏跺畠鏁版嵁锛堝瓨鍌ㄥ彉閲忥級")
+ private String otherdata;
}
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
index 1c2d09a..abcc5cf 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateScriptVO.java
@@ -217,7 +217,7 @@
/**
* 鍩虹鎸囨爣id
*/
- @ApiModelProperty(value = "鍩虹鎸囨爣id")
+ @ApiModelProperty(value = "鍩虹鎸囨爣id(鏆傛椂褰撴湰棰樺簭鍙�)")
private Integer targetid;
@@ -235,6 +235,19 @@
private String questiontitle;
/**
+ * 涓嬩竴棰�
+ */
+ @ApiModelProperty(value = "涓嬩竴棰�")
+ private Integer nextQuestion;
+
+ /**
+ * 鏍囩
+ */
+ @Excel(name = "鍏跺畠鏁版嵁锛堝瓨鍌ㄥ彉閲忥級")
+ @ApiModelProperty(value = "鍏跺畠鏁版嵁锛堝瓨鍌ㄥ彉閲忥級")
+ private String otherdata;
+
+ /**
* 璇濇湳閫夐」
*/
@ApiModelProperty(value = "璇濇湳閫夐」")
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
index ec922fa..c07d1f1 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
@@ -1,18 +1,15 @@
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
@@ -20,6 +17,7 @@
* @author ruoyi
* @date 2023-12-23
*/
+@Data
@ApiModel(value = "IvrLibaTemplateTargetoption", description = "妯℃澘鎸囨爣閫夐」搴撳璞�")
public class IvrLibaTemplateTargetoption extends BaseEntity {
private static final long serialVersionUID = 1L;
@@ -204,235 +202,17 @@
@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;
- }
}
diff --git a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateVO.java b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateVO.java
index 40b3849..f72fa81 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrLibaTemplateVO.java
@@ -1,5 +1,6 @@
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;
@@ -152,8 +153,8 @@
/**
* 閫氱敤鍖归厤璇濇湳id
*/
- @Excel(name = "閫氱敤鍖归厤璇濇湳id")
- @ApiModelProperty(value = "閫氱敤鍖归厤璇濇湳id")
+ @Excel(name = "閫氱敤鍖归厤璇濇湳id锛堥�氱敤妯℃澘ID锛�")
+ @ApiModelProperty(value = "閫氱敤鍖归厤璇濇湳id锛堥�氱敤妯℃澘ID锛�")
private String submoduleID;
/**
@@ -245,7 +246,7 @@
*/
@Excel(name = "鏃犲尮閰嶆鏁�")
@ApiModelProperty(value = "鏃犲尮閰嶆鏁�")
- private Long mateNum;
+ private Long mateNum = 0L;
/**
* GUID
@@ -318,6 +319,20 @@
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鍒犻櫎")
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskcall.java b/smartor/src/main/java/com/smartor/domain/IvrTaskcall.java
index 031237d..18a690a 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskcall.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskcall.java
@@ -1,6 +1,7 @@
package com.smartor.domain;
import java.util.Date;
+import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
@@ -26,6 +27,12 @@
*/
@ApiModelProperty(value = "涓婚敭")
private Long id;
+
+ /**
+ *
+ */
+ @ApiModelProperty(value = "浠诲姟ID")
+ private Long taskid;
/**
* 鍙戦�佷汉
@@ -305,10 +312,10 @@
private String textParam;
/**
- * 瀹f暀褰㈠紡 :鏂囨湰銆佸浘鐗囥�佽闊炽�佽棰戙�佹贩鍚�
+ * 瀹f暀褰㈠紡 : 1,鐭俊銆�2,绾夸笅銆�3,璇煶銆�4,瑙嗛銆�5,绾歌川 6.閾炬帴 7.閽夐拤 8.寰俊
*/
- @Excel(name = " 瀹f暀褰㈠紡 :鏂囨湰銆佸浘鐗囥�佽闊炽�佽棰戙�佹贩鍚�")
- @ApiModelProperty("瀹f暀褰㈠紡 : 1,鏂囨湰銆�2,鍥剧墖銆�3,璇煶銆�4,瑙嗛銆�5,娣峰悎")
+ @Excel(name = " 瀹f暀褰㈠紡 : 1,鐭俊銆�2,绾夸笅銆�3,璇煶銆�4,瑙嗛銆�5,绾歌川 6.浜岀淮鐮� 7.閽夐拤 8.寰俊")
+ @ApiModelProperty("瀹f暀褰㈠紡 : 1,鐭俊銆�2,绾夸笅銆�3,璇煶銆�4,瑙嗛銆�5,绾歌川 6.閾炬帴 7.閽夐拤 8.寰俊")
private String serviceform;
/**
@@ -353,4 +360,20 @@
@ApiModelProperty(value = "pageSize")
private Integer pageSize;
+
+ /**
+ * 鍙戦�佺被鍨�: 1 鏃堕棿娈� 2 鏃堕棿鐐� 3 鍗冲埢鍙戦��
+ */
+ @ApiModelProperty(value = "鍙戦�佺被鍨�: 1 鏃堕棿娈� 2 鏃堕棿鐐� 3 鍗冲埢鍙戦��")
+ private String sendType;
+
+
+
+ /**
+ * 鍙戦�佹椂闂存
+ */
+ @Excel(name = "鍙戦�佹椂闂存")
+ @ApiModelProperty(value = "鍙戦�佹椂闂存")
+ private String sendTimeSlot;
+
}
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java b/smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java
new file mode 100644
index 0000000..a638b83
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java
@@ -0,0 +1,60 @@
+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;
+
+}
diff --git a/smartor/src/main/java/com/smartor/domain/IvrTaskcallVO.java b/smartor/src/main/java/com/smartor/domain/IvrTaskcallVO.java
index 08ffa1e..b24d03f 100644
--- a/smartor/src/main/java/com/smartor/domain/IvrTaskcallVO.java
+++ b/smartor/src/main/java/com/smartor/domain/IvrTaskcallVO.java
@@ -106,6 +106,12 @@
private String templatename;
/**
+ * 鍙戦�佺被鍨�: 1 鏃堕棿娈� 2 鏃堕棿鐐� 3 鍗冲埢鍙戦��
+ */
+ @ApiModelProperty(value = "鍙戦�佺被鍨�: 1 鏃堕棿娈� 2 鍗冲埢鍙戦��")
+ private String sendType;
+
+ /**
* 鍙戦�佹棩鏈�
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@@ -159,7 +165,7 @@
* 鍙戦�佺姸鎬�
*/
@Excel(name = " 鍙戦�佺姸鎬� ")
- @ApiModelProperty(value = "鍙戦�佺姸鎬�")
+ @ApiModelProperty(value = "鍙戦�佺姸鎬� 锛�1 寮�濮� 2 涓 3 缁撴潫")
private Long sendstate;
/**
@@ -361,6 +367,13 @@
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();
diff --git a/smartor/src/main/java/com/smartor/domain/QuestionMessage.java b/smartor/src/main/java/com/smartor/domain/QuestionMessage.java
new file mode 100644
index 0000000..108c686
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/QuestionMessage.java
@@ -0,0 +1,28 @@
+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();
+
+
+}
diff --git a/smartor/src/main/java/com/smartor/domain/SocketMessage.java b/smartor/src/main/java/com/smartor/domain/SocketMessage.java
index c502cb1..1a0435d 100644
--- a/smartor/src/main/java/com/smartor/domain/SocketMessage.java
+++ b/smartor/src/main/java/com/smartor/domain/SocketMessage.java
@@ -8,6 +8,11 @@
private String type;
//鍐呭锛堝彂閫佺殑鏂囨湰鍐呭锛�
private String content;
+ //妯℃澘ID
+ private Long templateId;
+ //闂淇℃伅
+ private QuestionMessage questionMessage;
+
//鐢ㄦ埛ID锛堟帴鏀舵斁锛�
private String userId;
//鍥剧墖
diff --git a/smartor/src/main/java/com/smartor/domain/TaskSendTimeVO.java b/smartor/src/main/java/com/smartor/domain/TaskSendTimeVO.java
new file mode 100644
index 0000000..5665bfb
--- /dev/null
+++ b/smartor/src/main/java/com/smartor/domain/TaskSendTimeVO.java
@@ -0,0 +1,44 @@
+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;
+
+ /**
+ * 瀹f暀鍐呭
+ */
+ @ApiModelProperty(value = "缁撴潫鏃堕棿")
+ private String endtime;
+
+ /**
+ * 搴忓彿
+ */
+ @ApiModelProperty(value = "搴忓彿")
+ private Integer xh;
+
+
+}
diff --git a/smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplateMapper.java b/smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplateMapper.java
index e9fc21a..f94cce9 100644
--- a/smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplateMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplateMapper.java
@@ -36,7 +36,7 @@
* @param ivrLibaExtemplate 閫氳繃妯℃澘
* @return 缁撴灉
*/
- public int insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate);
+ public Boolean insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate);
/**
* 淇敼閫氳繃妯℃澘
@@ -52,7 +52,7 @@
* @param ID 閫氳繃妯℃澘涓婚敭
* @return 缁撴灉
*/
- public int deleteIvrLibaExtemplateByID(String ID);
+ public int deleteIvrLibaExtemplateByID(Long ID);
/**
* 鎵归噺鍒犻櫎閫氳繃妯℃澘
@@ -60,5 +60,5 @@
* @param IDs 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
* @return 缁撴灉
*/
- public int deleteIvrLibaExtemplateByIDs(String[] IDs);
+ public int deleteIvrLibaExtemplateByIDs(Long[] IDs);
}
diff --git a/smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplatescriptMapper.java b/smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplatescriptMapper.java
index a2478e1..61b512a 100644
--- a/smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplatescriptMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/IvrLibaExtemplatescriptMapper.java
@@ -2,21 +2,21 @@
import com.smartor.domain.IvrLibaExtemplatescript;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 閫氱敤妯℃澘璇濇湳Mapper鎺ュ彛
- *
+ *
* @author ruoyi
* @date 2023-12-27
*/
@Mapper
-public interface IvrLibaExtemplatescriptMapper
-{
+public interface IvrLibaExtemplatescriptMapper {
/**
* 鏌ヨ閫氱敤妯℃澘璇濇湳
- *
+ *
* @param ID 閫氱敤妯℃澘璇濇湳涓婚敭
* @return 閫氱敤妯℃澘璇濇湳
*/
@@ -24,15 +24,23 @@
/**
* 鏌ヨ閫氱敤妯℃澘璇濇湳鍒楄〃
- *
+ *
* @param ivrLibaExtemplatescript 閫氱敤妯℃澘璇濇湳
* @return 閫氱敤妯℃澘璇濇湳闆嗗悎
*/
public List<IvrLibaExtemplatescript> selectIvrLibaExtemplatescriptList(IvrLibaExtemplatescript ivrLibaExtemplatescript);
/**
+ * 鏌ヨ閫氱敤妯℃澘璇濇湳鍒楄〃
+ *
+ * @param IDs 閫氱敤妯℃澘璇濇湳閫氳繃ids
+ * @return 閫氱敤妯℃澘璇濇湳闆嗗悎
+ */
+ public List<IvrLibaExtemplatescript> queryIvrLibaExtemplatescriptList(@Param("IDs")List<Long> IDs);
+
+ /**
* 鏂板閫氱敤妯℃澘璇濇湳
- *
+ *
* @param ivrLibaExtemplatescript 閫氱敤妯℃澘璇濇湳
* @return 缁撴灉
*/
@@ -40,7 +48,7 @@
/**
* 淇敼閫氱敤妯℃澘璇濇湳
- *
+ *
* @param ivrLibaExtemplatescript 閫氱敤妯℃澘璇濇湳
* @return 缁撴灉
*/
@@ -48,17 +56,17 @@
/**
* 鍒犻櫎閫氱敤妯℃澘璇濇湳
- *
+ *
* @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);
}
diff --git a/smartor/src/main/java/com/smartor/mapper/IvrTaskcallMapper.java b/smartor/src/main/java/com/smartor/mapper/IvrTaskcallMapper.java
index f9aa728..abd9ebe 100644
--- a/smartor/src/main/java/com/smartor/mapper/IvrTaskcallMapper.java
+++ b/smartor/src/main/java/com/smartor/mapper/IvrTaskcallMapper.java
@@ -1,7 +1,9 @@
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;
@@ -29,6 +31,8 @@
*/
public List<IvrTaskcall> selectIvrTaskcallList(IvrTaskcall ivrTaskcall);
+ public IvrTaskcallVO queryTaskByCondition(IvrTaskcallVO ivrTaskcallVO);
+
/**
* 鏂板鍗曚竴浠诲姟锛堥殢璁匡級
*
@@ -40,7 +44,6 @@
/**
* 淇敼鍗曚竴浠诲姟锛堥殢璁匡級
*
- * @param ivrTaskcall 鍗曚竴浠诲姟锛堥殢璁匡級
* @return 缁撴灉
*/
public int updateIvrTaskcall(IvrTaskcall ivrTaskcall);
@@ -53,4 +56,11 @@
*/
public int deleteIvrTaskcallById(Long id);
+ /**
+ * 鍒犻櫎鍗曚竴浠诲姟锛堥殢璁匡級
+ *
+ * @return 缁撴灉
+ */
+ public List<IvrTaskcall> getDataByTime(@Param("beganTime") String beganTime, @Param("endTime") String endTime);
+
}
diff --git a/smartor/src/main/java/com/smartor/service/IIvrLibaExtemplateService.java b/smartor/src/main/java/com/smartor/service/IIvrLibaExtemplateService.java
index 34b2627..bcf32b3 100644
--- a/smartor/src/main/java/com/smartor/service/IIvrLibaExtemplateService.java
+++ b/smartor/src/main/java/com/smartor/service/IIvrLibaExtemplateService.java
@@ -34,7 +34,7 @@
* @param ivrLibaExtemplate 閫氳繃妯℃澘
* @return 缁撴灉
*/
- public int insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate);
+ public IvrLibaExtemplate insertIvrLibaExtemplate(IvrLibaExtemplate ivrLibaExtemplate);
/**
* 淇敼閫氳繃妯℃澘
@@ -50,7 +50,7 @@
* @param IDs 闇�瑕佸垹闄ょ殑閫氳繃妯℃澘涓婚敭闆嗗悎
* @return 缁撴灉
*/
- public int deleteIvrLibaExtemplateByIDs(String[] IDs);
+ public int deleteIvrLibaExtemplateByIDs(Long[] IDs);
/**
* 鍒犻櫎閫氳繃妯℃澘淇℃伅
@@ -58,5 +58,5 @@
* @param ID 閫氳繃妯℃澘涓婚敭
* @return 缁撴灉
*/
- public int deleteIvrLibaExtemplateByID(String ID);
+ public int deleteIvrLibaExtemplateByID(Long ID);
}
diff --git a/smartor/src/main/java/com/smartor/service/IIvrLibaExtemplatescriptService.java b/smartor/src/main/java/com/smartor/service/IIvrLibaExtemplatescriptService.java
index d5794a8..05c4020 100644
--- a/smartor/src/main/java/com/smartor/service/IIvrLibaExtemplatescriptService.java
+++ b/smartor/src/main/java/com/smartor/service/IIvrLibaExtemplatescriptService.java
@@ -50,7 +50,7 @@
* @param IDs 闇�瑕佸垹闄ょ殑閫氱敤妯℃澘璇濇湳涓婚敭闆嗗悎
* @return 缁撴灉
*/
- public int deleteIvrLibaExtemplatescriptByIDs(String[] IDs);
+ public int deleteIvrLibaExtemplatescriptByIDs(Long[] IDs);
/**
* 鍒犻櫎閫氱敤妯℃澘璇濇湳淇℃伅
@@ -58,5 +58,5 @@
* @param ID 閫氱敤妯℃澘璇濇湳涓婚敭
* @return 缁撴灉
*/
- public int deleteIvrLibaExtemplatescriptByID(String ID);
+ public int deleteIvrLibaExtemplatescriptByID(Long ID);
}
diff --git a/smartor/src/main/java/com/smartor/service/IIvrTaskcallService.java b/smartor/src/main/java/com/smartor/service/IIvrTaskcallService.java
index 27ecaf6..d95f55a 100644
--- a/smartor/src/main/java/com/smartor/service/IIvrTaskcallService.java
+++ b/smartor/src/main/java/com/smartor/service/IIvrTaskcallService.java
@@ -3,6 +3,7 @@
import com.smartor.domain.HeTaskVO;
import com.smartor.domain.IvrTaskcall;
import com.smartor.domain.IvrTaskcallVO;
+import com.smartor.domain.PhoneCallBackVO;
import java.util.List;
@@ -61,4 +62,20 @@
*/
public int insertOrUpdateTask(IvrTaskcallVO ivrTaskcallVO);
+ /**
+ * 浠诲姟鍙戦�佹墽琛�
+ *
+ * @param ivrTaskcallVO
+ * @return 缁撴灉
+ */
+ public int heTaskSend(IvrTaskcallVO ivrTaskcallVO);
+
+ /**
+ * 浠诲姟鍙戦�佹墽琛�
+ *
+ * @param phoneCallBackVO
+ * @return 缁撴灉
+ */
+ public PhoneCallBackVO phoneCallBack(PhoneCallBackVO phoneCallBackVO);
+
}
diff --git a/smartor/src/main/java/com/smartor/service/PersonVoiceService.java b/smartor/src/main/java/com/smartor/service/PersonVoiceService.java
index 59b7785..d431fa1 100644
--- a/smartor/src/main/java/com/smartor/service/PersonVoiceService.java
+++ b/smartor/src/main/java/com/smartor/service/PersonVoiceService.java
@@ -18,7 +18,7 @@
/**
* 涓�鍙ヨ瘽璇嗗埆
*/
- public String texttospeech(String textspeech);
+ public String texttospeech(String textspeech, String filePath);
public Boolean explainHTML();
}
diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplateServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplateServiceImpl.java
index a880710..99edbf1 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplateServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplateServiceImpl.java
@@ -8,6 +8,7 @@
import org.springframework.stereotype.Service;
import java.util.List;
+import java.util.UUID;
/**
* 閫氳繃妯℃澘Service涓氬姟灞傚鐞�
@@ -49,9 +50,13 @@
* @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;
}
/**
@@ -73,7 +78,7 @@
* @return 缁撴灉
*/
@Override
- public int deleteIvrLibaExtemplateByIDs(String[] IDs) {
+ public int deleteIvrLibaExtemplateByIDs(Long[] IDs) {
return ivrLibaExtemplateMapper.deleteIvrLibaExtemplateByIDs(IDs);
}
@@ -84,7 +89,7 @@
* @return 缁撴灉
*/
@Override
- public int deleteIvrLibaExtemplateByID(String ID) {
+ public int deleteIvrLibaExtemplateByID(Long ID) {
return ivrLibaExtemplateMapper.deleteIvrLibaExtemplateByID(ID);
}
}
diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplatescriptServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplatescriptServiceImpl.java
index 70f4adb..8875b1f 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplatescriptServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrLibaExtemplatescriptServiceImpl.java
@@ -1,9 +1,14 @@
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;
@@ -39,7 +44,26 @@
*/
@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;
}
/**
@@ -50,6 +74,10 @@
*/
@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);
}
@@ -63,6 +91,10 @@
@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);
}
@@ -73,7 +105,7 @@
* @return 缁撴灉
*/
@Override
- public int deleteIvrLibaExtemplatescriptByIDs(String[] IDs) {
+ public int deleteIvrLibaExtemplatescriptByIDs(Long[] IDs) {
return ivrLibaExtemplatescriptMapper.deleteIvrLibaExtemplatescriptByIDs(IDs);
}
@@ -84,7 +116,7 @@
* @return 缁撴灉
*/
@Override
- public int deleteIvrLibaExtemplatescriptByID(String ID) {
+ public int deleteIvrLibaExtemplatescriptByID(Long ID) {
return ivrLibaExtemplatescriptMapper.deleteIvrLibaExtemplatescriptByID(ID);
}
}
diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptServiceImpl.java
index 81ab2cc..b3c4db6 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrLibaScriptServiceImpl.java
@@ -1,8 +1,12 @@
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;
@@ -87,6 +91,19 @@
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);
// //鏌ヨ闂鎸囨爣鎺ュ彛
@@ -119,31 +136,17 @@
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());
diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java
index a5d2db3..50b52cf 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java
@@ -1,7 +1,11 @@
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;
@@ -66,6 +70,17 @@
//鑾峰彇璇ユ寚鏍囩殑閫夐」
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);
}
//鑾峰彇璇ユ寚鏍囩殑鏍囩
@@ -152,6 +167,13 @@
}
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());
@@ -174,7 +196,6 @@
/**
* 鎵归噺鍒犻櫎鎸囨爣閫夐」搴�
*
- * @param targetIDs 闇�瑕佸垹闄ょ殑鎸囨爣閫夐」搴撲富閿�
* @return 缁撴灉
*/
@Override
@@ -185,7 +206,6 @@
/**
* 鍒犻櫎鎸囨爣閫夐」搴撲俊鎭�
*
- * @param targetID 鎸囨爣閫夐」搴撲富閿�
* @return 缁撴灉
*/
@Override
diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrLibaTemplateServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrLibaTemplateServiceImpl.java
index 5cd0bb4..e3957bc 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrLibaTemplateServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrLibaTemplateServiceImpl.java
@@ -1,8 +1,13 @@
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;
@@ -11,8 +16,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
/**
* 妯℃澘搴揝ervice涓氬姟灞傚鐞�
@@ -227,11 +231,19 @@
//鏂板
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) {
//鍒犻櫎
@@ -280,9 +292,28 @@
IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption = new IvrLibaTemplateTargetoption();
ivrLibaTemplateTargetoption.setScriptid(ivrLibaTemplateScriptVO.getID());
List<IvrLibaTemplateTargetoption> ivrLibaTemplateTargetoptions = ivrLibaTemplateTargetOptionMapper.selectIvrLibaTemplateTargetoptionList(ivrLibaTemplateTargetoption);
+ 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);
diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrTaskcallServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrTaskcallServiceImpl.java
index 86c1ae2..6d4f7bf 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrTaskcallServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrTaskcallServiceImpl.java
@@ -1,21 +1,37 @@
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涓氬姟灞傚鐞�
@@ -30,7 +46,17 @@
private IvrTaskcallMapper ivrTaskcallMapper;
@Autowired
- private PatTaskRelevanceMapper patTaskRelevanceMapper;
+ private IvrLibaTemplateTargetoptionMapper ivrLibaScriptTargetoptionMapper;
+
+ @Autowired
+ private RedisCache redisCache;
+
+ @Autowired
+ private IvrLibaExtemplatescriptMapper ivrLibaExtemplatescriptMapper;
+
+ @Autowired
+ private RabbitTemplate rabbitTemplate;
+
/**
* 鏌ヨ鍗曚竴浠诲姟锛堥殢璁匡級
@@ -103,8 +129,8 @@
@Override
public int insertOrUpdateTask(IvrTaskcallVO ivrTaskcallVO) {
if (ObjectUtils.isEmpty(ivrTaskcallVO)) {
- log.info("瀹f暀浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�");
- throw new BaseException("瀹f暀浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�");
+ log.info("浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�");
+ throw new BaseException("浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�");
}
Integer integer = 0;
if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 1) {
@@ -120,6 +146,9 @@
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();
}
@@ -135,8 +164,10 @@
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();
}
@@ -150,4 +181,307 @@
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 -> {
+ //娉ㄦ剰杩欓噷鏃堕棿鍙互浣縧ong锛岃�屼笖鏄缃甴eader
+ 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 -> {
+ //娉ㄦ剰杩欓噷鏃堕棿鍙互浣縧ong锛岃�屼笖鏄缃甴eader
+ 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("璇uid涓嶅瓨鍦�");
+ }
+ 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");
+ //灏唘uid鏇存柊鍒版暟鎹簱涓�
+ 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());
+ //杩炵画鎵撹瀹氭锛屽鏋滆娌′汉鎺ワ紝閭e氨缁撴潫
+ 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) {
+ //鎮h�呮寕鏂數璇�
+ log.info("鎮h�呮寕鏂數璇濓細{}", 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);
+ // 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
+ phoneUtils.ttsPlayback(nowQuestion.getQuestionText(), phoneCallBackVO.getUuid());
+ }
+ } else {
+ redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", noVoice + 1, 120, TimeUnit.MINUTES);
+ //璋冪敤ivrLibaTemplateScriptVO涓殑slienceText(闈欓粯璇濇湳)
+ String slienceText = nowQuestion.getSlienceText();
+ //闈欓粯璇濇湳 + 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
+ phoneUtils.ttsPlayback(slienceText + nowQuestion.getQuestionText(), phoneCallBackVO.getUuid());
+ return new PhoneCallBackVO();
+ }
+
+ } else {
+ //鏈夊洖璇濓紝瀵瑰洖绛旂殑闂,杩涜姝e垯鍖归厤锛堣繖閲屽彧閽堝閫夋嫨棰橈紝鍏跺畠棰樺瀷涓嶈锛�
+ 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()) {
+ //璇存槑鍖归厤姝g‘浜�
+ //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
+ 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銆乼ts鍚堟垚鍜屾挱鏀撅紝 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) {
+ // 瀵硅鏉emplateScriptVO杩涜澶勭悊
+ return ivrLibaTemplateScriptVOList.get(j);
+ }
+ }
+ return null;
+ }
+
}
diff --git a/smartor/src/main/java/com/smartor/service/impl/PersonVoiceServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PersonVoiceServiceImpl.java
index 9f71763..bb250b5 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PersonVoiceServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PersonVoiceServiceImpl.java
@@ -18,6 +18,7 @@
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.*;
@@ -90,9 +91,9 @@
}
@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;
}
@@ -399,11 +400,15 @@
}
- 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;
@@ -449,11 +454,11 @@
}
- 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);
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaExtemplateMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaExtemplateMapper.xml
index d485c90..7e4e9e1 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaExtemplateMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaExtemplateMapper.xml
@@ -57,7 +57,6 @@
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>
@@ -76,7 +75,6 @@
<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>
@@ -119,13 +117,13 @@
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}
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaExtemplatescriptMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaExtemplatescriptMapper.xml
index 009e649..ad8ca58 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaExtemplatescriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaExtemplatescriptMapper.xml
@@ -11,6 +11,7 @@
<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"/>
@@ -21,7 +22,10 @@
<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">
@@ -31,6 +35,7 @@
switchText,
switchWav,
selfRegex,
+ selfRegex2,
isEnable,
del_flag,
update_by,
@@ -41,6 +46,9 @@
upload_time,
orgid,
pid,
+ is_end,
+ nodynamiccruxs,
+ dynamiccruxs,
guid
from ivr_liba_extemplatescript
</sql>
@@ -49,17 +57,33 @@
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>
@@ -68,16 +92,17 @@
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>
@@ -89,14 +114,17 @@
<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>
@@ -108,17 +136,21 @@
<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>
@@ -130,11 +162,14 @@
<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}
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml
index e354686..1aea316 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml
@@ -52,6 +52,7 @@
<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">
@@ -72,6 +73,7 @@
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>
@@ -85,9 +87,10 @@
'%')
</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>
@@ -127,6 +130,7 @@
<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>
@@ -185,6 +189,7 @@
<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>
@@ -233,6 +238,7 @@
<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>
@@ -282,9 +288,10 @@
<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>
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
index 0f8b3ca..e8f426b 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateScriptMapper.xml
@@ -39,6 +39,8 @@
<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">
@@ -62,6 +64,8 @@
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>
@@ -85,6 +89,7 @@
<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>
@@ -146,6 +151,8 @@
<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>
@@ -181,6 +188,8 @@
<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>
@@ -220,6 +229,8 @@
<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>
diff --git a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
index c571d49..1a9ba0b 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
@@ -34,6 +34,7 @@
<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">
@@ -49,6 +50,8 @@
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>
@@ -122,6 +125,7 @@
<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>
@@ -152,6 +156,7 @@
<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>
@@ -163,7 +168,7 @@
<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>
@@ -186,6 +191,7 @@
<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>
diff --git a/smartor/src/main/resources/mapper/smartor/IvrTaskcallMapper.xml b/smartor/src/main/resources/mapper/smartor/IvrTaskcallMapper.xml
index 2fb37cd..c3222e9 100644
--- a/smartor/src/main/resources/mapper/smartor/IvrTaskcallMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/IvrTaskcallMapper.xml
@@ -55,6 +55,8 @@
<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">
@@ -104,9 +106,11 @@
guid,
text_param,
serviceform,
- badNo,
- icdName,
- medicalRecordNo,
+ bad_no,
+ icd_name,
+ send_type,
+ medical_record_no,
+ send_time_slot,
preachcontent
from ivr_taskcall
</sql>
@@ -153,13 +157,15 @@
<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>
@@ -168,10 +174,9 @@
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>
@@ -221,9 +226,9 @@
<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>
@@ -273,6 +278,7 @@
<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>
@@ -328,6 +334,7 @@
<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>
@@ -340,4 +347,69 @@
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>
\ No newline at end of file
--
Gitblit v1.9.3