From 1ccb709f723a759597dcdc7239d8885cef84d3ce Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 04 十二月 2024 17:56:19 +0800
Subject: [PATCH] 代码提交
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 80 ++++++++++++++++++++++++++--------------
1 files changed, 52 insertions(+), 28 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 9294e4f..e6c1691 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -369,13 +369,15 @@
//灏嗕换鍔′俊鎭柊澧炲埌闅忚鏈嶅姟琛ㄤ腑
serviceSubtask.setSendname(patTaskRelevance.getName());
serviceSubtask.setAge(patTaskRelevance.getAge());
+ serviceSubtask.setLibtemplateid(Long.valueOf(serviceTask.getLibtemplateid()));
serviceSubtask.setSfzh(patTaskRelevance.getIdcardno());
serviceSubtask.setPhone(patTaskRelevance.getTelcode());
serviceSubtask.setAddr(patTaskRelevance.getAddr());
serviceSubtask.setPatid(patTaskRelevance.getPatid());
serviceSubtask.setCreateTime(DateUtils.getNowDate());
serviceSubtask.setSendstate(1L);
- if (serviceTaskVO.getLongTask() == 1) serviceSubtask.setSendstate(2L);
+ if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1)
+ serviceSubtask.setSendstate(2L);
serviceSubtask.setDeptcode(patTaskRelevance.getDeptCode());
serviceSubtask.setDeptname(patTaskRelevance.getDeptName());
serviceSubtask.setLeavehospitaldistrictcode(patTaskRelevance.getLeavehospitaldistrictcode());
@@ -389,7 +391,7 @@
serviceSubtask.setEndtime(patTaskRelevance.getEndtime());
serviceSubtask.setNurseId(patTaskRelevance.getNurseId());
serviceSubtask.setNurseName(patTaskRelevance.getNurseName());
- if (serviceTaskVO.getLongTask() == 1)
+ if (serviceTaskVO.getLongTask() != null &&serviceTaskVO.getLongTask() == 1)
serviceSubtask.setLongSendTime(patTaskRelevance.getLongSendTime());
serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
integer = serviceSubtask.getId().intValue();
@@ -533,7 +535,7 @@
// 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
String date = simpleDateFormat1.format(new Date());
log.info("鍘昏皟鐢╰ts鍚堟垚鍜屾挱鏀炬帴鍙�: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
- phoneUtils.ttsPlayback(nowQuestion.getScriptContent(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(nowQuestion.getIvrtext(), phoneCallBackVO.getUuid());
}
} else {
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", noVoice + 1, 120, TimeUnit.MINUTES);
@@ -542,7 +544,7 @@
//闈欓粯璇濇湳 + 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
String date = simpleDateFormat1.format(new Date());
log.info("闈欓粯璇濇湳 + 闂,鍘昏皟鐢╰ts鍚堟垚鍜屾挱鏀炬帴鍙�: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
- phoneUtils.ttsPlayback(slienceText + nowQuestion.getScriptContent(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(slienceText + nowQuestion.getIvrtext(), phoneCallBackVO.getUuid());
return;
}
@@ -563,7 +565,7 @@
Pattern pattern2 = Pattern.compile(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2());
matcher2 = pattern2.matcher(phoneCallBackVO.getTextResult());
}
- log.error("PCB--getQuestionText闂涓猴細{},UUID锛歿}", nowQuestion.getScriptContent(), phoneCallBackVO.getUuid());
+ log.error("PCB--getQuestionText闂涓猴細{},UUID锛歿}", nowQuestion.getIvrtext(), phoneCallBackVO.getUuid());
if (StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() || StringUtils.isEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) {
//璇存槑鍖归厤姝g‘浜�
//杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
@@ -577,7 +579,7 @@
//灏嗘偅鑰呯殑鍥炵鍐欒繘琛ㄩ噷
IvrTaskVisitResult serviceTaskVisitResult = DtoConversionUtils.sourceToTarget(serviceSubtask, IvrTaskVisitResult.class);
serviceTaskVisitResult.setId(null);
- serviceTaskVisitResult.setQuestion(nowQuestion.getScriptContent());
+ serviceTaskVisitResult.setQuestion(nowQuestion.getIvrtext());
serviceTaskVisitResult.setPatientAnswer(phoneCallBackVO.getTextResult());
serviceTaskVisitResult.setCreateTime(new Date());
serviceTaskVisitResult.setOptionResult(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetvalue());
@@ -594,7 +596,7 @@
questionMessage.setNowQuestion(script);
questionMessage.setQuestionList(IvrTaskTemplateScriptVOs);
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES);
- phoneUtils.ttsPlayback(script.getScriptContent(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(script.getIvrtext(), phoneCallBackVO.getUuid());
return;
} else if (nextQuestion > IvrTaskTemplateScriptVOs.size()) {
//娌℃湁涓嬩竴棰樹簡锛屽氨缁撴潫浜�
@@ -639,7 +641,7 @@
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES);
String date = simpleDateFormat1.format(new Date());
log.info("濡傛灉涓嬩竴棰樹负绌�.鍒欐柊鐨勬暟鎹繑鍥�,骞跺姞涓婃劅璋㈣: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
- phoneUtils.ttsPlayback(nextQuestion.getScriptContent(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(nextQuestion.getIvrtext(), phoneCallBackVO.getUuid());
return;
} else {
//灏卞彲浠ユ寕鏂數璇濅簡
@@ -707,13 +709,13 @@
//璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀撅紝 tts_playback鈥濆皢缁撴灉浼犲洖
String date = simpleDateFormat1.format(new Date());
log.info("璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀�------: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
- phoneUtils.ttsPlayback(nowQuestion.getScriptContent() + ivrTaskTemplateScriptVO.getSubmoduleText(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(nowQuestion.getIvrtext() + ivrTaskTemplateScriptVO.getSubmoduleText(), phoneCallBackVO.getUuid());
}
break;
}
String date = simpleDateFormat1.format(new Date());
log.info("鏈�鍚庣殑淇℃伅鍥炲-: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
- phoneUtils.ttsPlayback(nowQuestion.getScriptContent(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(nowQuestion.getIvrtext(), phoneCallBackVO.getUuid());
}
}
}
@@ -749,6 +751,9 @@
req.put("caller", phoneCallReqYQVO.getPhone());
HttpUtil.postJsonRequest(hangup, new Gson().toJson(req));
redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- hangup", "1", 2, TimeUnit.MINUTES);
+ //鍏堟妸榛樿鐨剅ecordAccept-hungup鍒犻櫎锛屽啀鏇存柊
+ redisCache.deleteObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup");
+ redisCache.setCacheObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup", "1", 10, TimeUnit.MINUTES);
//杩欎釜鏃跺�欏氨闇�瑕佽蛋琛ュ伩鏈哄埗浜嗭紝鍏堟殏瀹氳蛋鐭俊
getSmsCompensate(Long.valueOf(phoneCallReqYQVO.getTaskid()));
return new PhoneCallBackYQVO();
@@ -781,7 +786,6 @@
HttpUtil.postJsonRequest(hangup, new Gson().toJson(req));
//鍒犻櫎缁撴潫璇殑鎮e瓨
redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "- jsy");
- redisCache.setCacheObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup", "2", 10, TimeUnit.MINUTES);
} else {
redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop", true, 120, TimeUnit.MINUTES);
log.error("-------PlayEventCallbackPlaystop鐨勫�间负锛歿}", true);
@@ -827,7 +831,7 @@
//灏忎笌鐨勮瘽,灏辩户缁棶鎮h��
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- String scriptContent = ivrTaskTemplateScriptVO.getScriptContent();
+ String scriptContent = ivrTaskTemplateScriptVO.getIvrtext();
log.error("SilentCallback鐨勯棶棰樺唴瀹箂criptContent锛歿}", scriptContent);
phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
//灏嗛潤榛樻鏁板姞1
@@ -870,7 +874,9 @@
}
return phoneCallBackYQVO;
} else if ("AsrCallback".equals(phoneCallReqYQVO.getOperate()) && phoneCallReqYQVO.getEnd_time() != null && phoneCallReqYQVO.getEnd_time() != -1) {
-
+ //鍋氫竴涓爣璇嗭紝鐢ㄦ潵鍦ㄩ�氳瘽璇︽儏鎺ュ彛閲岋紝鍒ゆ柇鏄惁鏈変汉鎺ョ數璇濓紙value=2,琛ㄧず鏈変汉鎺ワ級
+ redisCache.deleteObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup");
+ redisCache.setCacheObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup", "2", 10, TimeUnit.MINUTES);
// 鍏堝閫氳瘽杩涜閫氱敤搴撳尮閰嶄竴娆�
String extemplateID = ivrTaskTemplate.getSubmoduleID();
if (StringUtils.isNotEmpty(extemplateID)) {
@@ -1042,7 +1048,7 @@
if (script.getSort() == nextQuestion.intValue()) {
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- String scriptContent = script.getScriptContent();
+ String scriptContent = script.getIvrtext();
log.error("涓嬩竴棰橀棶棰橈細{}", scriptContent);
phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
//灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
@@ -1147,7 +1153,7 @@
if (script.getSort() == ivrTaskTemplateScriptVO.getNextScriptno().intValue()) {
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- String scriptContent = script.getScriptContent();
+ String scriptContent = script.getIvrtext();
phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
//灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
@@ -1169,7 +1175,7 @@
redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid(), count + 1, 120, TimeUnit.MINUTES);
phoneCallBackYQVO.setType("text");
- phoneCallBackYQVO.setValue(ivrTaskTemplateScriptVO.getNoMatchText() + getObject(serviceSubtask, ivrTaskTemplateScriptVO.getScriptContent()));
+ phoneCallBackYQVO.setValue(ivrTaskTemplateScriptVO.getNoMatchText() + getObject(serviceSubtask, ivrTaskTemplateScriptVO.getIvrtext()));
}
}
@@ -1199,7 +1205,7 @@
if (ivrTaskTemplateScriptVO.getNextScriptno().intValue() == ivrTaskTemplateScript1.getSort()) {
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- String scriptContent = ivrTaskTemplateScript1.getScriptContent();
+ String scriptContent = ivrTaskTemplateScript1.getIvrtext();
phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
redisCache.setCacheObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone(), ivrTaskTemplateScript1.getId().toString());
@@ -1367,7 +1373,7 @@
//鏍规嵁,鑾峰彇瀛愪换鍔$殑ID
String[] split = subIds.split(",,");
for (int i = 0; i < split.length; i++) {
- if (cacheName.equals("cache-0") && i < 5 || !cacheName.equals("cache-0") && i < 1) {
+ if (cacheName.equals("cache-0") && i < split.length || !cacheName.equals("cache-0") && i < 1) {
PullTaskVO pullTaskVO = new PullTaskVO();
String subId = split[i].trim().replace(",", "");
ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(Long.valueOf(subId));
@@ -1389,7 +1395,7 @@
//濡傛灉ivrTaskTemplateScript涓虹┖锛屼篃灏辨病鏈夊線涓嬫墽琛岀殑蹇呰浜�
if (ObjectUtils.isEmpty(ivrTaskTemplateScript)) return null;
//鑾峰彇閫氶厤绗﹀尮閰嶈繃鍚庣殑闂
- String scrContent = getObject(serviceSubtask, ivrTaskTemplateScript.getScriptContent());
+ String scrContent = getObject(serviceSubtask, ivrTaskTemplateScript.getIvrtext());
String kcb = serviceTask.getKcb() + "," + scrContent;
// String kcb = ivrTaskTemplate.getRevisitBefore();
@@ -1700,21 +1706,40 @@
@Override
public Integer recordAccept(PhoneCallRecordVO phoneCallRecordVO) {
- Object cacheObject = redisCache.getCacheObject("recordAccept-hungup");
- if (ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("2")) {
+ Object cacheObject = redisCache.getCacheObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
+ if (phoneCallRecordVO.getHangup_cause().equals("NO_USER_RESPONSE") || ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("1")) {
+ //鏃犱汉鎺ュ惉
+ getSmsCompensate(Long.valueOf(phoneCallRecordVO.getTaskid()));
+ redisCache.deleteObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
+ } else if (ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("2")) {
// if (phoneCallRecordVO.getAnswered() != null && phoneCallRecordVO.getAnswered() == true) {
log.error("鏈変汉鎺ョ數璇濅簡锛屽苟涓斿畬浜�");
//璇存槑鏈変汉鎺ヤ簡
int startIndex = phoneCallRecordVO.getRecord_path().indexOf("voice") + "voice".length() + 1; // 鍔�1鏄烦杩�/绗﹀彿
int endIndex = phoneCallRecordVO.getRecord_path().lastIndexOf("/");
String result = phoneCallRecordVO.getRecord_path().substring(startIndex, endIndex);
+ ServiceSubtask serviceSubtask = new ServiceSubtask();
+ serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
+ serviceSubtask.setSendstate(6L);
+ serviceSubtask.setId(Long.valueOf(phoneCallRecordVO.getTaskid()));
+ serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
//涓嬭浇鏂囦欢
ftpService.downloadFolder("/" + LocalDate.now().toString(), profile + "/upload/vadio/voice/" + LocalDate.now().toString());
- } else if (phoneCallRecordVO.getHangup_cause().equals("NO_USER_RESPONSE") || ObjectUtils.isNotEmpty(cacheObject) && !String.valueOf(cacheObject).equals("2")) {
- //鏃犱汉鎺ュ惉
- getSmsCompensate(Long.valueOf(phoneCallRecordVO.getTaskid()));
+ redisCache.deleteObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
+ } else {
+ //鎮h�呮嫆缁濋殢璁�
+ ServiceSubtask serviceSubtask = new ServiceSubtask();
+ serviceSubtask.setRemark("鐢佃瘽鎺ラ�氭垚鍔燂紝鎮h�呮嫆缁濋殢璁�");
+ serviceSubtask.setId(Long.valueOf(phoneCallRecordVO.getTaskid()));
+ serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ int startIndex = phoneCallRecordVO.getRecord_path().indexOf("voice") + "voice".length() + 1; // 鍔�1鏄烦杩�/绗﹀彿
+ int endIndex = phoneCallRecordVO.getRecord_path().lastIndexOf("/");
+ String result = phoneCallRecordVO.getRecord_path().substring(startIndex, endIndex);
+ //涓嬭浇鏂囦欢
+ ftpService.downloadFolder("/" + LocalDate.now().toString(), profile + "/upload/vadio/voice/" + LocalDate.now().toString());
+ redisCache.deleteObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
}
- redisCache.deleteObject("recordAccept-hungup");
+
return 1;
}
@@ -1784,7 +1809,7 @@
serviceSubtaskDetail.setSentEnd(1L);
serviceSubtaskDetail.setTemplateid(ivrTaskTemplate.getId().toString());
serviceSubtaskDetail.setTemplatequestionnum(ivrTaskTemplateScriptVO.getId());
- serviceSubtaskDetail.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
+ serviceSubtaskDetail.setQuestiontext(ivrTaskTemplateScriptVO.getIvrtext());
serviceSubtaskDetail.setQuestionvoice(phoneCallReqYQVO.getRecordpath());
serviceSubtaskDetail.setCategoryname(ivrTaskTemplateScriptVO.getScriptType());
serviceSubtaskDetail.setTargetoptions(ivrTaskTemplateScriptVO.getTargetOptions());
@@ -1829,8 +1854,7 @@
map.put("content", sendMagParam.getContent());
String result = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(map));
redisCache.setCacheObject(subTaskId + "recordAccept-hungup", "1", 10, TimeUnit.MINUTES);
- if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
- serviceSubtask.setRemark("鐢佃瘽鍙戦�佹嫆鎺�,鐭俊琛ュ伩鍙戦�佹垚鍔�");
+ if (StringUtils.isNotEmpty(serviceSubtask.getRemark())) serviceSubtask.setRemark("鐢佃瘽鍙戦�佹嫆鎺�,鐭俊琛ュ伩鍙戦�佹垚鍔�");
else serviceSubtask.setRemark("鐭俊琛ュ伩鍙戦�佹垚鍔�");
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
}
--
Gitblit v1.9.3