From 048db32d9a965f1ef398a8aa02a012e9b968a6b1 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 08 十一月 2024 18:39:04 +0800
Subject: [PATCH] 代码提交
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 293 ++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 190 insertions(+), 103 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index 1a0cf5b..d5c88ea 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -154,6 +154,7 @@
patTaskRelevance.setFinishtime(serviceSubtask1.getFinishtime());
patTaskRelevance.setSfzh(serviceSubtask1.getSfzh());
patTaskRelevance.setPhone(serviceSubtask1.getPhone());
+ patTaskRelevance.setTelcode(serviceSubtask1.getPhone());
patTaskRelevance.setAddr(serviceSubtask1.getAddr());
patTaskRelevance.setDiagname(serviceSubtask1.getDiagname());
patTaskRelevance.setPatid(serviceSubtask1.getPatid());
@@ -176,6 +177,7 @@
patTaskRelevance.setAge(serviceSubtask1.getAge());
patTaskRelevance.setSfzh(serviceSubtask1.getSfzh());
patTaskRelevance.setPhone(serviceSubtask1.getPhone());
+ patTaskRelevance.setTelcode(serviceSubtask1.getPhone());
patTaskRelevance.setFinishtime(serviceSubtask1.getFinishtime());
patTaskRelevance.setAddr(serviceSubtask1.getAddr());
patTaskRelevance.setDeptName(serviceSubtask1.getDeptname());
@@ -327,7 +329,7 @@
serviceSubtask.setSendname(patTaskRelevance.getName());
serviceSubtask.setAge(patTaskRelevance.getAge());
serviceSubtask.setSfzh(patTaskRelevance.getIdcardno());
- serviceSubtask.setPhone(patTaskRelevance.getPhone());
+ serviceSubtask.setPhone(patTaskRelevance.getTelcode());
serviceSubtask.setAddr(patTaskRelevance.getAddr());
serviceSubtask.setPatid(patTaskRelevance.getPatid());
serviceSubtask.setCreateTime(DateUtils.getNowDate());
@@ -368,7 +370,7 @@
serviceSubtask.setSendname(patTaskRelevance.getName());
serviceSubtask.setAge(patTaskRelevance.getAge());
serviceSubtask.setSfzh(patTaskRelevance.getSfzh());
- serviceSubtask.setPhone(patTaskRelevance.getPhone());
+ serviceSubtask.setPhone(patTaskRelevance.getTelcode());
serviceSubtask.setAddr(patTaskRelevance.getAddr());
serviceSubtask.setPatid(patTaskRelevance.getPatid());
serviceSubtask.setOpenid(patTaskRelevance.getOpenid());
@@ -609,7 +611,7 @@
Pattern pattern2 = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex2());
matcher2 = pattern2.matcher(returnQues.getContent());
}
- log.info("++++++++++++++++++++++++++閫氱敤搴撴槸鍚︿负绌猴細selfRegex : {} , selfRegex2 : {}", ivrLibaExtemplatescript.getSelfRegex(), ivrLibaExtemplatescript.getSelfRegex2());
+ log.error("++++++++++++++++++++++++++閫氱敤搴撴槸鍚︿负绌猴細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");
IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO = returnQues.getNowQuestion();
@@ -646,6 +648,27 @@
*/
@Override
public PhoneCallBackYQVO phoneCallBackYQ(PhoneCallReqYQVO phoneCallReqYQVO) {
+ //鍒ゆ柇鏄惁鎸傛満
+ String hangupState = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "- hangup");
+ if (StringUtils.isNotEmpty(hangupState) && hangup.equals("1")) {
+ return new PhoneCallBackYQVO();
+ }
+ if ("AsrCallback".equals(phoneCallReqYQVO.getOperate()) && phoneCallReqYQVO.getEnd_time() != null && phoneCallReqYQVO.getEnd_time() != -1) {
+ //澶勭悊鎸傛柇
+ if (phoneCallReqYQVO.getAsrtext().contains("鎷ㄥ彨鐨勭敤鎴锋蹇�")) {
+ ServiceSubtask serviceSubtask2 = new ServiceSubtask();
+ serviceSubtask2.setRemark("鐢佃瘽鍙戦�佹垚鍔燂紙鎮h�呮寕鏂級");
+ serviceSubtask2.setSenduuid(phoneCallReqYQVO.getUuid());
+ serviceSubtask2.setId(Long.valueOf(phoneCallReqYQVO.getTaskid()));
+ serviceSubtaskMapper.updateServiceSubtask(serviceSubtask2);
+ Map<String, String> req = new HashMap<>();
+ req.put("uuid", phoneCallReqYQVO.getUuid());
+ req.put("caller", phoneCallReqYQVO.getPhone());
+ HttpUtil.postJsonRequest(hangup, new Gson().toJson(req));
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- hangup", "1", 2, TimeUnit.MINUTES);
+ return new PhoneCallBackYQVO();
+ }
+ }
//瀹氫箟涓�涓垎鏁扮殑鍙橀噺
Boolean aBoolean1 = redisCache.hasKey(phoneCallReqYQVO.getUuid() + "SCORE");
if (!aBoolean1) redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", 0.0, 120, TimeUnit.MINUTES);
@@ -669,7 +692,8 @@
Map<String, String> req = new HashMap<>();
req.put("uuid", phoneCallReqYQVO.getUuid());
req.put("caller", phoneCallReqYQVO.getPhone());
- HttpUtils.sendPost(hangup, new Gson().toJson(req));
+// HttpUtils.sendPost(hangup, new Gson().toJson(req));
+ HttpUtil.postJsonRequest(hangup, new Gson().toJson(req));
//鍒犻櫎缁撴潫璇殑鎮e瓨
redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "- jsy");
} else {
@@ -680,9 +704,12 @@
return phoneCallBackYQVO;
}
//鑾峰彇鏀鹃煶鏄惁缁撴潫
- boolean isPlayEventOver = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
- if (!isPlayEventOver) {
- return phoneCallBackYQVO;
+ Object isPlayEventOverObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ if (ObjectUtils.isNotEmpty(isPlayEventOverObj)) {
+ Boolean isPlayEventOver = (Boolean) isPlayEventOverObj;
+ if (!isPlayEventOver) {
+ return phoneCallBackYQVO;
+ }
}
//閫氳繃瀛愪换鍔D鑾峰彇鍒版ā鏉夸俊鎭�
@@ -723,10 +750,11 @@
return phoneCallBackYQVO;
} else {
log.error("闈欓粯娆℃暟杈惧埌,鎸傛帀鐢佃瘽锛歿}", num);
+ ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
//澶т笌绛変簬鐨勮瘽,鐩存帴鎸傛柇
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- phoneCallBackYQVO.setValue(ivrTaskTemplate.getRevisitAfter());
+ phoneCallBackYQVO.setValue(serviceTask1.getJsy());
//灏嗙粨鏋滃啓鍒癲etail涓�
ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
@@ -741,34 +769,78 @@
serviceSubtask.setFinishtime(new Date());
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
Map<String, String> map = delRedisValue(null, id.toString());
- redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
+ if (ObjectUtils.isNotEmpty(map)) redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
//鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
}
return phoneCallBackYQVO;
} else if ("AsrCallback".equals(phoneCallReqYQVO.getOperate()) && phoneCallReqYQVO.getEnd_time() != null && phoneCallReqYQVO.getEnd_time() != -1) {
- //鎾姤绗竴棰�
- Integer integer = redisCache.getCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim() + "-firstSort");
-// if(integer==0){
-// //integer==0,琛ㄧず寮�鍦虹櫧鍒氭挱鎶ュ畬锛岄渶瑕佸仠椤夸竴涓嬶紝绛夋偅鑰呰璇�
-// redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim() + "-firstSort", 1, 120, TimeUnit.MINUTES);
-// return phoneCallBackYQVO;
-// }
- if (ivrTaskTemplateScriptVO.getSort() == 1 && integer == 1) {
- phoneCallBackYQVO.setType("text");
- phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- String scriptContent = ivrTaskTemplateScriptVO.getScriptContent();
- phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
- redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim() + "-firstSort", 2, 120, TimeUnit.MINUTES);
- return phoneCallBackYQVO;
+
+ // 鍏堝閫氳瘽杩涜閫氱敤搴撳尮閰嶄竴娆�
+ String extemplateID = ivrTaskTemplate.getSubmoduleID();
+ if (StringUtils.isNotEmpty(extemplateID)) {
+ String[] split = extemplateID.split(",");
+ List<String> list = Arrays.asList(split);
+ List<Long> list1 = new ArrayList<>();
+ for (String str : list) {
+ list1.add(Long.valueOf(str));
+ }
+ List<IvrLibaExtemplatescript> ivrLibaExtemplatescripts = ivrLibaExtemplatescriptMapper.queryIvrLibaExtemplatescriptList(list1);
+ IvrLibaExtemplatescript les = null;
+ for (IvrLibaExtemplatescript ivrLibaExtemplatescript : ivrLibaExtemplatescripts) {
+ Matcher matcher = null;
+ if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex())) {
+ Pattern pattern = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex());
+ matcher = pattern.matcher(phoneCallReqYQVO.getAsrtext());
+ }
+
+ Matcher matcher2 = null;
+ if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2())) {
+ Pattern pattern2 = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex2());
+ matcher2 = pattern2.matcher(phoneCallReqYQVO.getAsrtext());
+ }
+ 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()) {
+ //灏嗛�氱敤搴撳尮閰嶇殑锛屾斁鍒拌繑鍥炲�间腑
+// phoneCallBackYQVO.setValue(phoneCallBackYQVO.getValue() + ivrLibaExtemplatescript.getSwitchText());
+ phoneCallBackYQVO.setCommonValue(ivrLibaExtemplatescript.getSwitchText());
+ les = ivrLibaExtemplatescript;
+ }
+ break;
+ }
+ if (ObjectUtils.isNotEmpty(les)) {
+ //瀵瑰尮閰嶇殑缁撴灉澶勭悊涓�涓�(鐪嬬湅鏄笉鏄渶瑕佹寕鏈�)
+ if (les.getIsEnd() != null && les.getIsEnd() == 1) {
+ //鍙互鎸傛満浜�
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + les.getSwitchText());
+ //灏嗙粨鏋滃啓杩沝etail琛�
+ ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
+ List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+ ivrTaskTemplateScriptVO.setExtemplateText(les.getSwitchText());
+ serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
+ serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
+ saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+ return phoneCallBackYQVO;
+ }
+ }
}
//濡傛灉鏄枃鏈洖璋�
//鏍规嵁闂ID鑾峰彇璇ラ棶棰樼殑绫诲瀷
if (ivrTaskTemplateScriptVO.getScriptType().equals("1")) {
+ //鐢ㄦ潵鏍囪锛屾槸鍚︽湁鍖归厤涓婄殑
+ Integer flag = 0;
//鏄�夋嫨棰�
for (int j = 0; j < ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size(); j++) {
log.error("phoneCallReqYQVO.getAsrtext()鐨勫�间负锛歿}", phoneCallReqYQVO.getAsrtext());
@@ -800,6 +872,21 @@
serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+ //鍒ゆ柇涓�涓嬶紝杩欎釜閫夐」缁撴灉鏄笉鏄繕鏈夌户缁棶涓嬪幓鐨勫繀瑕侊紝渚嬪閫夐」缁撴灉鏄埆浜轰笉鎯崇户缁洖绛旈棶棰橈紝灏辫缁撴潫鎺�
+ if (ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getIsEnd() == 1) {
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
+ return phoneCallBackYQVO;
+ }
+
+ flag = 1;
//灏嗗綋鍓嶅墠鐨勬挱鎶ョ姸鎬佸垹闄わ紝缁欎笅涓�棰樿浣�
redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
// //鑾峰彇涓嬩竴棰�
@@ -818,7 +905,7 @@
Object obj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
Double score = (obj == null ? new Double(0.00) : new Double(((Double) obj).doubleValue()));
score = BigDecimal.valueOf(score).add(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getScore()).doubleValue();
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score,120,TimeUnit.MINUTES);
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
}
for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
@@ -827,61 +914,80 @@
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
String scriptContent = script.getScriptContent();
log.error("涓嬩竴棰橀棶棰橈細{}", scriptContent);
- phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
//灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
//鍒犻櫎鏃犲搷搴�
redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
}
}
- } else if (ivrTaskTemplateScriptVO.getBranchFlag().equals("0")) {
- if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
- phoneCallBackYQVO.setType("text");
- phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- //鏇存柊涓�涓嬪垎鏁�
- double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
- serviceSubtask.setScore(BigDecimal.valueOf(score));
- serviceSubtask.setFinishtime(new Date());
- serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
- //璁剧疆缁撴潫璇�
- phoneCallBackYQVO.setValue(ivrTaskTemplate.getRevisitAfter());
- Long id = serviceSubtask.getId();
- Map<String, String> map = delRedisValue(null, id.toString());
+ } else if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
+ ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+ //鏇存柊涓�涓嬪垎鏁�
+ double score = 0.0;
+ Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ if (ObjectUtils.isNotEmpty(scoreObj)) score = (double) scoreObj;
+ serviceSubtask.setScore(BigDecimal.valueOf(score));
+ serviceSubtask.setFinishtime(new Date());
+ serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ //璁剧疆缁撴潫璇�
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask1.getJsy());
+ Long id = serviceSubtask.getId();
+ Map<String, String> map = delRedisValue(null, id.toString());
+ log.error("map鐨勫�间负锛歿}", map);
+ if (ObjectUtils.isNotEmpty(map))
redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
- redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
- redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
- //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
// return phoneCallBackYQVO;
- }
+
}
} else {
- continue;
+ //flag=0,璇存槑娌� 鍖归厤涓婏紝涔熻鎶婃偅鑰呰鐨勮瘽璁板綍涓嬫潵
+ if (j == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size() - 1 && flag == 0) {
+ ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
+ List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+ serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
+ serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
+ saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+ continue;
+ }
}
}
//閮芥病鏈夊尮閰嶅埌
if (StringUtils.isEmpty(phoneCallBackYQVO.getValue())) {
- Integer count = redisCache.getCacheObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
+ Integer count = null;
+ Object countObj = redisCache.getCacheObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
+ if (ObjectUtils.isNotEmpty(countObj)) count = (Integer) countObj;
if (count != null && count >= ivrTaskTemplate.getMateNum()) {
//濡傛灉count宸茬粡澶т簬鎴栫瓑浜庢病鏈夊尮閰嶆鏁�
if (ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() == 0 || ivrTaskTemplateScriptVO.getBranchFlag().equals("1") && ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getBranchFlag().equals("1") && ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
//濡傛灉鏄渶鍚庝竴閬撻锛屾垨鑰呮病鏈変笅涓�棰樹簡锛屽氨鐩存帴鎸傛満
+ ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
if (StringUtils.isNotEmpty(phoneCallBackYQVO.getValue()))
- phoneCallBackYQVO.setValue(phoneCallBackYQVO.getValue() + ivrTaskTemplate.getRevisitAfter());
- else phoneCallBackYQVO.setValue(ivrTaskTemplate.getRevisitAfter());
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + phoneCallBackYQVO.getValue() + serviceTask1.getJsy());
+ else phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask1.getJsy());
//鏇存柊涓�涓嬪垎鏁�
- double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ Double score = null;
+ Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
serviceSubtask.setScore(BigDecimal.valueOf(score));
serviceSubtask.setFinishtime(new Date());
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
//鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
//鍘籸edis涓紝鎶婅瀛愪换鍔D鍒犻櫎
Long id = serviceSubtask.getId();
Map<String, String> map = delRedisValue(null, id.toString());
@@ -896,15 +1002,17 @@
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
String scriptContent = script.getScriptContent();
- phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
//灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
//鏇存柊涓�涓嬪垎鏁�
- double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ Double score = null;
+ Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
score = BigDecimal.valueOf(score).add(script.getScore()).doubleValue();
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score,120, TimeUnit.MINUTES);
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
}
}
}
@@ -926,7 +1034,7 @@
serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
saveQuestionAnswerPhone(serviceSubTaskDetailReq);
-// String xh = idSort.split("-")[1];
+ // String xh = idSort.split("-")[1];
//濡傛灉閫夐」鍒嗘敮涓�1鐨勮瘽锛屽垯闇�瑕佹牴鎹棶棰樹笂鐨刵extScriptno杩涜璺宠浆
//闂瓟棰樻病鏈夎烦杞�
@@ -936,26 +1044,30 @@
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
String scriptContent = ivrTaskTemplateScript1.getScriptContent();
- phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
redisCache.setCacheObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone(), ivrTaskTemplateScript1.getId().toString());
//鏇存柊涓�涓嬪垎鏁�
- double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ Double score = null;
+ Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
score = BigDecimal.valueOf(score).add(ivrTaskTemplateScriptVO.getScore()).doubleValue();
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score,120, TimeUnit.MINUTES);
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
-// return phoneCallBackYQVO;
}
}
} else if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
//娌℃湁涓嬩竴棰樹簡锛屽氨缁撴潫浜�
+ ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- phoneCallBackYQVO.setValue(ivrTaskTemplate.getRevisitAfter());
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask1.getJsy());
//鏇存柊涓�涓嬪垎鏁�
- double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ Double score = null;
+ Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
serviceSubtask.setScore(BigDecimal.valueOf(score));
serviceSubtask.setFinishtime(new Date());
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
@@ -965,42 +1077,13 @@
Map<String, String> map = delRedisValue(null, id.toString());
redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
//鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask1.getJsy(), 120, TimeUnit.MINUTES);
redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
}
-
- //閫夐」鍖归厤瀹屾垚鍚庯紝闇�瑕佸啀鍘婚�氳繃搴撳啀杩涜鍖归厤涓�娆�
- String extemplateID = ivrTaskTemplate.getSubmoduleID();
- if (StringUtils.isNotEmpty(extemplateID)) {
- String[] split = extemplateID.split(",");
- List<String> list = Arrays.asList(split);
- List<Long> list1 = new ArrayList<>();
- 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(phoneCallReqYQVO.getAsrtext());
- }
-
- Matcher matcher2 = null;
- if (StringUtils.isNotEmpty(ivrLibaExtemplatescript.getSelfRegex2())) {
- Pattern pattern2 = Pattern.compile(ivrLibaExtemplatescript.getSelfRegex2());
- matcher2 = pattern2.matcher(phoneCallReqYQVO.getAsrtext());
- }
- 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()) {
- //灏嗛�氱敤搴撳尮閰嶇殑锛屾斁鍒拌繑鍥炲�间腑
- phoneCallBackYQVO.setValue(phoneCallBackYQVO.getValue() + ivrLibaExtemplatescript.getSwitchText());
- }
- break;
- }
- }
}
}
+ log.error("phoneCallBackYQVO鐨勮繑鍥炲�兼槸锛歿}", phoneCallBackYQVO);
return phoneCallBackYQVO;
}
@@ -1012,9 +1095,9 @@
scriptContent = scriptContent.replace(key, StringUtils.isNotEmpty(map.get(key)) ? map.get(key) : "");
}
}
- scriptContent.replace("${name}", StringUtils.isNotEmpty(serviceSubtask.getName()) ? serviceSubtask.getName() : "");
- scriptContent.replace("${dzz}", StringUtils.isNotEmpty(serviceSubtask.getPlaceOfResidence()) ? serviceSubtask.getPlaceOfResidence() : "");
- scriptContent.replace("${phone}", StringUtils.isNotEmpty(serviceSubtask.getTelcode()) ? serviceSubtask.getTelcode() : "");
+ scriptContent = scriptContent.replace("${name}", StringUtils.isNotEmpty(serviceSubtask.getSendname()) ? serviceSubtask.getSendname() : "");
+ scriptContent = scriptContent.replace("${dzz}", StringUtils.isNotEmpty(serviceSubtask.getAddr()) ? serviceSubtask.getAddr() : "");
+ scriptContent = scriptContent.replace("${phone}", StringUtils.isNotEmpty(serviceSubtask.getTelcode()) ? serviceSubtask.getTelcode() : "");
return scriptContent;
}
@@ -1083,7 +1166,7 @@
// cache-0涓虹珛鍗冲彂璧风殑,鍏跺畠鐨勫厛鎺ㄨ繜
if (!StringUtils.isEmpty(value0)) {
pullTaskVOList = getPullTaskList(value0, "cache-0");
- //灏哻ache-0鐨勬暟鎹紝杞Щ涓嶅鍔瞔ache-00涓�
+ //灏哻ache-0鐨勬暟鎹紝杞Щ鍒癱ache-00涓�
redisCache.deleteObject("cache-00");
String cache00 = redisCache.getCacheObject("cache-00");
if (!StringUtils.isEmpty(cache00))
@@ -1129,7 +1212,9 @@
String subId = split[i].trim().replace(",", "");
ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(Long.valueOf(subId));
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(serviceSubtask.getTemplateid());
+ if (ObjectUtils.isEmpty(ivrTaskTemplate)) continue;
//閫氳繃浠诲姟妯℃澘涓殑"绗竴娆¢棶棰樼紪鍙�"鑾峰彇绗竴涓棶棰�;
IvrTaskTemplateScript ivrTaskTemplateScript = null;
IvrTaskTemplateScript ivrTaskTemplateScript1 = new IvrTaskTemplateScript();
@@ -1145,9 +1230,9 @@
//濡傛灉ivrTaskTemplateScript涓虹┖锛屼篃灏辨病鏈夊線涓嬫墽琛岀殑蹇呰浜�
if (ObjectUtils.isEmpty(ivrTaskTemplateScript)) return null;
//鑾峰彇閫氶厤绗﹀尮閰嶈繃鍚庣殑闂
-// String scrContent = getObject(serviceSubtask, ivrTaskTemplateScript.getScriptContent());
-// String kcb = ivrTaskTemplate.getRevisitBefore() + "," + scrContent;
- String kcb = ivrTaskTemplate.getRevisitBefore();
+ String scrContent = getObject(serviceSubtask, ivrTaskTemplateScript.getScriptContent());
+ String kcb = serviceTask.getKcb() + "," + scrContent;
+// String kcb = ivrTaskTemplate.getRevisitBefore();
//灏佽杩斿洖鏁版嵁
//taskId = 瀛愪换鍔D + 闂ID +闂搴忓彿
@@ -1156,10 +1241,11 @@
pullTaskVO.setSections(LocalTime.now().format(DateTimeFormatter.ofPattern("hh:mm")) + "-" + LocalTime.now().plusMinutes(1).format(DateTimeFormatter.ofPattern("hh:mm")));
pullTaskVO.setPhones(serviceSubtask.getPhone());
pullTaskVO.setPrologue(kcb);
- pullTaskVO.setDisplayNo("85129866");
+ if (cacheName.equals("cache-0")) pullTaskVO.setDisplayNo("2");
+ else pullTaskVO.setDisplayNo("2");
pullTaskVOList.add(pullTaskVO);
redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim(), ivrTaskTemplateScript.getId().toString());
- redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim() + "-firstSort", 1, 120, TimeUnit.MINUTES);
+// redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim() + "-firstSort", 1, 120, TimeUnit.MINUTES);
} else {
if (StringUtils.isEmpty(newValue0)) {
newValue0 = "," + split[i].trim() + ",";
@@ -1483,7 +1569,6 @@
return null;
}
-
private ServiceSubtaskDetail getServiceSubtaskDetail(PhoneCallReqYQVO phoneCallReqYQVO, IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate) {
ServiceSubtaskDetail serviceSubtaskDetail = new ServiceSubtaskDetail();
serviceSubtaskDetail.setSubId(Long.valueOf(phoneCallReqYQVO.getTaskid()));
@@ -1503,8 +1588,10 @@
serviceSubtaskDetail.setTemplateid(ivrTaskTemplate.getId().toString());
serviceSubtaskDetail.setTemplatequestionnum(ivrTaskTemplateScriptVO.getId());
serviceSubtaskDetail.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
+ serviceSubtaskDetail.setQuestionvoice(phoneCallReqYQVO.getRecordpath());
serviceSubtaskDetail.setCategoryname(ivrTaskTemplateScriptVO.getScriptType());
serviceSubtaskDetail.setTargetoptions(ivrTaskTemplateScriptVO.getTargetOptions());
+ serviceSubtaskDetail.setExtemplateText(ivrTaskTemplateScriptVO.getExtemplateText());
int i = 1;
for (IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption : ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList()) {
--
Gitblit v1.9.3