From 01bbc8f0563b33dd5ce6d59f76c3bae9931615dd Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 05 六月 2024 17:32:07 +0800
Subject: [PATCH] 代码提交
---
smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java | 249 ++++++++++++++++++++-----------------------------
1 files changed, 103 insertions(+), 146 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java
index 1520c85..5718bd1 100644
--- a/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java
@@ -9,7 +9,6 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.smartor.config.PhoneUtils;
-import com.smartor.config.RabbitMqCallPhoneConfig;
import com.smartor.domain.*;
import com.smartor.mapper.*;
import com.smartor.service.IIvrTaskService;
@@ -44,10 +43,10 @@
private IIvrTaskService ivrTaskService;
@Autowired
- private IvrLibaTemplateTargetoptionMapper ivrLibaScriptTargetoptionMapper;
+ private IvrTaskTemplateTargetoptionMapper ivrTaskScriptTargetoptionMapper;
@Autowired
- private IvrLibaTemplateScriptMapper ivrLibaTemplateScriptMapper;
+ private IvrLibaTemplateScriptMapper ivrTaskTemplateScriptMapper;
@Autowired
private IvrTaskVisitResultMapper ivrTaskVisitResultMapper;
@@ -58,8 +57,7 @@
@Autowired
private IvrLibaExtemplatescriptMapper ivrLibaExtemplatescriptMapper;
- @Autowired
- private RabbitMqCallPhoneConfig rabbitMqCallPhoneConfig;
+
/**
@@ -85,27 +83,33 @@
}
@Override
- public IvrTaskSingleVO queryTaskByCondition(IvrTaskSingle ivrTaskcall) {
+ public IvrTaskVO queryTaskByCondition(IvrTaskSingle ivrTaskcall) {
//瀹氫箟鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚�
List<PatTaskRelevance> patTaskRelevances = new ArrayList<>();
List<IvrTaskSingle> list = selectIvrTaskcallList(ivrTaskcall);
- if (CollectionUtils.isEmpty(list)) {
- new BaseException("璇ヤ换鍔′笉瀛樺湪");
+ if (CollectionUtils.isEmpty(list) || list.size() == 0) {
+ return new IvrTaskVO();
}
- //灏嗘煡鍑烘潵鐨勬暟鎹�掑叆IvrTaskcallVO涓�
- IvrTaskSingleVO ivrTaskcallVO2 = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskSingleVO.class);
- String sendTimeSlot = list.get(0).getSendTimeSlot();
+ IvrTask ivrTask = ivrTaskService.selectIvrTaskByTaskid(ivrTaskcall.getTaskid());
+ //灏嗘煡鍑烘潵鐨勬暟鎹�掑叆ivrTasksingleVO涓�
+ IvrTaskVO ivrTaskVO = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskVO.class);
+ ivrTaskVO.setShowDate(ivrTask.getShowDate());
+ ivrTaskVO.setShowTimeMorn(ivrTask.getShowTimeMorn());
+ ivrTaskVO.setShowTimeNoon(ivrTask.getShowTimeNoon());
+ ivrTaskVO.setShowTimeNight(ivrTask.getShowTimeNight());
+ String sendTimeSlot = ivrTask.getSendTimeSlot();
ObjectMapper objectMapper = new ObjectMapper();
try {
//鑾峰彇鍒板彂閫佹椂闂寸殑闆嗗悎
if (com.ruoyi.common.utils.StringUtils.isNotEmpty(sendTimeSlot)) {
List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot, List.class);
- ivrTaskcallVO2.setSendTimeslot(taskSendTimeVOList);
+ ivrTaskVO.setSendTimeslot(taskSendTimeVOList);
+ ivrTaskVO.setSendType(ivrTask.getSendType());
}
//鏂囨湰鍙橀噺鍙傛暟
- if (com.ruoyi.common.utils.StringUtils.isNotEmpty(list.get(0).getTextParam())) {
- Map<String, Map<String, String>> textParam = objectMapper.readValue(list.get(0).getTextParam(), Map.class);
- ivrTaskcallVO2.setTextParam(textParam);
+ if (com.ruoyi.common.utils.StringUtils.isNotEmpty(ivrTask.getTextParam())) {
+ Map<String, Map<String, String>> textParam = objectMapper.readValue(ivrTask.getTextParam(), Map.class);
+ ivrTaskVO.setTextParam(textParam);
}
} catch (JsonProcessingException e) {
e.printStackTrace();
@@ -122,6 +126,7 @@
patTaskRelevance.setPhone(ivrTaskcall1.getPhone());
patTaskRelevance.setAddr(ivrTaskcall1.getAddr());
patTaskRelevance.setDiagname(ivrTaskcall1.getDiagname());
+ patTaskRelevance.setPatid(ivrTaskcall1.getPatid());
patTaskRelevances.add(patTaskRelevance);
}
if (ivrTaskcall1.getHospType().equals("2")) {
@@ -134,12 +139,13 @@
patTaskRelevance.setDeptName(ivrTaskcall1.getDeptname());
patTaskRelevance.setBedNo(ivrTaskcall1.getBedNo());
patTaskRelevance.setDiagname(ivrTaskcall1.getDiagname());
+ patTaskRelevance.setPatid(ivrTaskcall1.getPatid());
patTaskRelevances.add(patTaskRelevance);
}
}
- ivrTaskcallVO2.setPatTaskRelevances(patTaskRelevances);
- return ivrTaskcallVO2;
+ ivrTaskVO.setPatTaskRelevances(patTaskRelevances);
+ return ivrTaskVO;
}
@Override
@@ -194,131 +200,82 @@
*/
@Transactional(rollbackFor = Exception.class)
@Override
- public int insertOrUpdateTask(IvrTaskSingleVO ivrTaskcallVO) {
- if (ObjectUtils.isEmpty(ivrTaskcallVO)) {
+ public int insertOrUpdateTask(IvrTaskVO ivrTaskVO) {
+ if (ObjectUtils.isEmpty(ivrTaskVO)) {
log.info("浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�");
throw new BaseException("浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�");
}
- Integer integer = 0;
- if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 1) {
+ Integer integer = 1;
+ IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTaskVO, IvrTask.class);
+ ivrTask.setTextParam(JSON.toJSONString(ivrTaskVO.getTextParam()));
+ if (ivrTaskVO.getIsoperation() != null && ivrTaskVO.getIsoperation() == 1) {
//寰�浠诲姟琛ㄤ腑锛屾柊澧炰换鍔�
- IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTask.class);
+ if (ObjectUtils.isNotEmpty(ivrTaskVO.getSendTimeslot()))
+ ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTaskVO.getSendTimeslot()));
+ if (ivrTask.getSendState() == null) ivrTask.setSendState(1);
+ ivrTask.setTemplateid(ivrTaskVO.getLibtemplateid());
ivrTaskService.insertIvrTask(ivrTask);
- ivrTaskcallVO.setTaskid(ivrTask.getTaskid().longValue());
+ //灏嗕换鍔′俊鎭斁鍒版湇鍔¤〃涓�
+ IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskVO, IvrTaskSingle.class);
+ ivrTaskcall.setTaskid(ivrTask.getTaskid().longValue());
//鏂板
- if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getPatTaskRelevances())) {
- for (PatTaskRelevance patTaskRelevance : ivrTaskcallVO.getPatTaskRelevances()) {
- //灏嗕换鍔′俊鎭柊澧炲埌瀹f暀浠诲姟琛ㄤ腑
- IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskSingle.class);
+ if (CollectionUtils.isNotEmpty(ivrTaskVO.getPatTaskRelevances())) {
+ for (PatTaskRelevance patTaskRelevance : ivrTaskVO.getPatTaskRelevances()) {
+ //灏嗕换鍔′俊鎭柊澧炲埌闅忚鏈嶅姟琛ㄤ腑
ivrTaskcall.setSendname(patTaskRelevance.getName());
ivrTaskcall.setAge(patTaskRelevance.getAge());
ivrTaskcall.setSfzh(patTaskRelevance.getSfzh());
ivrTaskcall.setPhone(patTaskRelevance.getPhone());
ivrTaskcall.setAddr(patTaskRelevance.getAddr());
+ ivrTaskcall.setPatid(patTaskRelevance.getPatid());
ivrTaskcall.setCreateTime(DateUtils.getNowDate());
- ivrTaskcall.setTextParam(new Gson().toJson(patTaskRelevance.getTextParam()));
- if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) {
- ivrTaskcall.setSendTimeSlot(ivrTaskcallVO.getSendTimeslot().toString());
- }
+ ivrTaskcall.setCreateTime(DateUtils.getNowDate());
+ ivrTaskcall.setType(ivrTaskVO.getHospType());
ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall);
integer = ivrTaskcall.getId().intValue();
}
}
- } else if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 2) {
+ } else if (ivrTaskVO.getIsoperation() != null && ivrTaskVO.getIsoperation() == 2) {
//浠诲姟淇敼
- IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTask.class);
+ if (ObjectUtils.isNotEmpty(ivrTaskVO.getSendTimeslot()))
+ ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTaskVO.getSendTimeslot()));
+ IvrTask ivrTask1 = ivrTaskService.selectIvrTaskByTaskid(ivrTask.getTaskid());
+ ivrTask.setTemplateid(ivrTaskVO.getLibtemplateid());
ivrTaskService.updateIvrTask(ivrTask);
- if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getPatTaskRelevances())) {
- for (PatTaskRelevance patTaskRelevance : ivrTaskcallVO.getPatTaskRelevances()) {
+ if (CollectionUtils.isNotEmpty(ivrTaskVO.getPatTaskRelevances())) {
+ for (PatTaskRelevance patTaskRelevance : ivrTaskVO.getPatTaskRelevances()) {
- IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskSingle.class);
+ IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskVO, IvrTaskSingle.class);
ivrTaskcall.setSendname(patTaskRelevance.getName());
ivrTaskcall.setAge(patTaskRelevance.getAge());
ivrTaskcall.setSfzh(patTaskRelevance.getSfzh());
ivrTaskcall.setPhone(patTaskRelevance.getPhone());
ivrTaskcall.setAddr(patTaskRelevance.getAddr());
+ ivrTaskcall.setPatid(patTaskRelevance.getPatid());
+ ivrTaskcall.setType(ivrTaskVO.getHospType());
ivrTaskcall.setCreateTime(DateUtils.getNowDate());
- if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) {
- ivrTaskcall.setSendTimeSlot(ivrTaskcallVO.getSendTimeslot().toString());
+ ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskVO.getTextParam()));
+ if (patTaskRelevance.getIsoperation() != null) {
+ if (patTaskRelevance.getIsoperation() == 2)
+ ivrTaskSingleMapper.updateIvrTaskcallByCondition(ivrTaskcall);
+ if (patTaskRelevance.getIsoperation() == 1) ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall);
+ if (patTaskRelevance.getIsoperation() == 3)
+ // 閫氳繃taskid鍜宲atid鍘诲垹闄よ鏉℃暟鎹�
+ ivrTaskSingleMapper.deleteIvrTaskcallByCondition(ivrTaskVO.getTaskid(), patTaskRelevance.getPatid());
}
- ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskcallVO.getTextParam()));
- if (patTaskRelevance.getIsoperation() == 2) ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall);
- if (patTaskRelevance.getIsoperation() == 1) ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall);
- integer = ivrTaskcall.getId().intValue();
+ integer = ivrTaskcall.getTaskid().intValue();
}
}
-
- } else if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 3) {
- ivrTaskSingleMapper.deleteIvrTaskcallById(ivrTaskcallVO.getId());
-
- integer = ivrTaskcallVO.getId().intValue();
}
+
+
return integer;
}
- /**
- * 浠诲姟鍙戦��
- *
- * @return
- */
- @Override
- public int heTaskSend(IvrTaskSingleVO ivrTaskcallVO) {
- //鍒ゆ柇浠诲姟鏄惁鏄珛鍗冲彂閫�
- if (ivrTaskcallVO.getSendType().equals("2")) {
- IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ();
- ivrTaskcallMQ.setTaskid(ivrTaskcallVO.getTaskid());
- ivrTaskcallMQ.setSendType("1");
- ivrTaskcallMQ.setTemplateid(ivrTaskcallVO.getTemplateid());
- String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ);
- ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1);
- //绔嬪嵆鍙戦��
- rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, 0L);
-
- } else if (ivrTaskcallVO.getSendType().equals("1")) {
- //鏃堕棿娈靛彂閫�
- if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) {
- for (TaskSendTimeVO taskSendTimeVO : ivrTaskcallVO.getSendTimeslot()) {
- //鍘籗endTimeslot涓紝鑾峰彇鎵�鏈夌殑鏃堕棿娈�
- 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("1");
- ivrTaskcallMQ.setTemplateid(ivrTaskcallVO.getTemplateid());
- ivrTaskcallMQ.setSendTimeslot(list);
-
- Long finalMilliseconds = milliseconds;
- String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ);
- ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1);
- rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, 0L);
- }
- //灏嗕换鍔$姸鎬佷慨鏀规垚鎵ц涓�
- IvrTask ivrTask = new IvrTask();
- ivrTask.setTaskid(ivrTaskcallVO.getTaskid());
- ivrTask.setSendState("2");
- ivrTaskService.updateIvrTask(ivrTask);
- }
- }
-
- return 0;
- }
@Override
public void phoneCallBack(PhoneCallBackVO phoneCallBackVO) {
@@ -343,13 +300,13 @@
Map<String, Object> map = redisCache.getCacheObject(phoneCallBackVO.getUuid());
IvrTaskSingle ivrTaskcall = (IvrTaskSingle) map.get("ivrTaskSingle");
- List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOs = (List<IvrLibaTemplateScriptVO>) map.get("ivrLibaTemplateScriptVO");
+ List<IvrTaskTemplateScriptVO> ivrTaskTemplateScriptVOs = (List<IvrTaskTemplateScriptVO>) map.get("ivrTaskTemplateScriptVO");
//灏唘uid鏇存柊鍒版暟鎹簱涓�
ivrTaskcall.setSenduuid(phoneCallBackVO.getUuid());
ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall);
//鑾峰彇妯℃澘淇℃伅
- IvrLibaTemplateVO ivrLibaTemplateVO = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "ivrLibaTemplateVO");
+ IvrTaskTemplateVO ivrTaskTemplateVO = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "ivrTaskTemplateVO");
//璇煶璇嗗埆缁撴灉涓婃姤鎺ュ彛: 3
Integer noVoice = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "noVoice");
@@ -357,22 +314,22 @@
//灏嗕紶鍥炵殑缁撴灉鏀惧埌鍥炲瀵硅薄涓�
returnQues.setContent(phoneCallBackVO.getTextResult());
- IvrLibaTemplateScriptVO nowQuestion = returnQues.getNowQuestion();
+ IvrTaskTemplateScriptVO nowQuestion = returnQues.getNowQuestion();
if (StringUtils.isEmpty(returnQues.getContent())) {
//鏃犲洖璇�
//鍒ゆ柇noVoice鏄惁宸茬粡鍒颁簡鏈�澶у��
- if (noVoice == ivrLibaTemplateVO.getNoVoiceNum().intValue()) {
+ if (noVoice == ivrTaskTemplateVO.getNoVoiceNum().intValue()) {
//宸茬粡闂簡瀵瑰簲鐨勯亶鏁帮紝灏卞垽鏂槸鍚﹁繕鏈変笅涓�棰�
- if (nowQuestion.getTargetid() == ivrLibaTemplateScriptVOs.size()) {
+ if (nowQuestion.getTargetid() == ivrTaskTemplateScriptVOs.size()) {
//娌℃湁涓嬩竴棰樹簡锛屽氨鎸傛柇鐢佃瘽锛屾挱鏀剧粨鏉熻
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES);
- phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(ivrTaskTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid());
return;
} else {
//鏈変笅涓�棰�
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES);
- IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion);
+ IvrTaskTemplateScriptVO nextQuestion = getNextQuestion(ivrTaskTemplateScriptVOs, nowQuestion);
// 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
String date = simpleDateFormat1.format(new Date());
log.info("鍘昏皟鐢╰ts鍚堟垚鍜屾挱鏀炬帴鍙�: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
@@ -393,25 +350,25 @@
//isppd鐢ㄦ潵璁板綍鏄惁鍖归厤鍒�
Boolean isppd = false;
//鏈夊洖璇濓紝瀵瑰洖绛旂殑闂,杩涜姝e垯鍖归厤锛堣繖閲屽彧閽堝閫夋嫨棰橈紝鍏跺畠棰樺瀷涓嶈锛�
- for (int j = 0; j < nowQuestion.getIvrLibaScriptTargetoptionList().size(); j++) {
+ for (int j = 0; j < nowQuestion.getIvrTaskScriptTargetoptionList().size(); j++) {
//鍖呭惈
Matcher matcher = null;
- if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex())) {
- Pattern pattern = Pattern.compile(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex());
+ if (StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) {
+ Pattern pattern = Pattern.compile(nowQuestion.getIvrTaskScriptTargetoptionList().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());
+ if (StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2())) {
+ Pattern pattern2 = Pattern.compile(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2());
matcher2 = pattern2.matcher(phoneCallBackVO.getTextResult());
}
log.error("PCB--getQuestionText闂涓猴細{},UUID锛歿}", nowQuestion.getQuestionText(), phoneCallBackVO.getUuid());
- if (StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetregex()) && matcher.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()) {
+ 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鏄崟閫夐鐨勬敼娉�
- nowQuestion.getIvrLibaScriptTargetoptionList().get(j).setIsUserOperation(true);
- ivrLibaScriptTargetoptionMapper.updateIvrLibaTemplateTargetoption(nowQuestion.getIvrLibaScriptTargetoptionList().get(j));
+ nowQuestion.getIvrTaskScriptTargetoptionList().get(j).setIsUserOperation(true);
+ ivrTaskScriptTargetoptionMapper.updateIvrTaskTemplateTargetoption(nowQuestion.getIvrTaskScriptTargetoptionList().get(j));
//灏嗛潤榛樼疆涓�0
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES);
@@ -423,34 +380,34 @@
ivrTaskVisitResult.setQuestion(nowQuestion.getQuestionText());
ivrTaskVisitResult.setPatientAnswer(phoneCallBackVO.getTextResult());
ivrTaskVisitResult.setCreateTime(new Date());
- ivrTaskVisitResult.setOptionResult(nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getTargetvalue());
+ ivrTaskVisitResult.setOptionResult(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetvalue());
ivrTaskVisitResultMapper.insertIvrTaskVisitResult(ivrTaskVisitResult);
//灏嗗尮閰嶅埌鐨勬爣璇嗘敼鎴恡rue
isppd = true;
//鑾峰彇涓嬩竴棰�
- Integer nextQuestion = nowQuestion.getIvrLibaScriptTargetoptionList().get(j).getNextQuestion();
- for (IvrLibaTemplateScriptVO script : ivrLibaTemplateScriptVOs) {
+ Long nextQuestion = nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getNextQuestion();
+ for (IvrTaskTemplateScriptVO script : ivrTaskTemplateScriptVOs) {
if (script.getTargetid() == nextQuestion) {
QuestionMessage questionMessage = new QuestionMessage();
questionMessage.setNowQuestion(script);
- questionMessage.setQuestionList(ivrLibaTemplateScriptVOs);
+ questionMessage.setQuestionList(ivrTaskTemplateScriptVOs);
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES);
phoneUtils.ttsPlayback(script.getQuestionText(), phoneCallBackVO.getUuid());
return;
- } else if (nextQuestion > ivrLibaTemplateScriptVOs.size()) {
+ } else if (nextQuestion > ivrTaskTemplateScriptVOs.size()) {
//娌℃湁涓嬩竴棰樹簡锛屽氨缁撴潫浜�
String date = simpleDateFormat1.format(new Date());
log.error("娌℃湁涓嬩竴棰樹簡锛屽氨缁撴潫浜�: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES);
- phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(ivrTaskTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid());
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
- phoneUtils.hangup("", "", ivrLibaTemplateVO.getRevisitAfter(), "", "", "", "", phoneCallBackVO.getUuid());
+ phoneUtils.hangup("", "", ivrTaskTemplateVO.getRevisitAfter(), "", "", "", "", phoneCallBackVO.getUuid());
return;
}
}
@@ -467,12 +424,12 @@
Integer mateNum = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "mateNum");
if (mateNum == null) mateNum = 0;
//鏃犲尮閰嶆鏁板幓鍒ゆ柇鏄惁鍒版渶澶ц闂鏁帮紝骞朵笖鎵�鏈夌殑閫夐」閮藉尮閰嶅畬浜�
- if (mateNum == ivrLibaTemplateVO.getMateNum().intValue()) {
+ if (mateNum == ivrTaskTemplateVO.getMateNum().intValue()) {
//濡傛灉涓嬩竴棰樹负绌�.鍒欐柊鐨勬暟鎹繑鍥�,骞跺姞涓婃劅璋㈣
- if (nowQuestion.getTargetid() < ivrLibaTemplateScriptVOs.size()) {
+ if (nowQuestion.getTargetid() < ivrTaskTemplateScriptVOs.size()) {
QuestionMessage questionMessage = new QuestionMessage();
- IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion);
- questionMessage.setQuestionList(ivrLibaTemplateScriptVOs);
+ IvrTaskTemplateScriptVO nextQuestion = getNextQuestion(ivrTaskTemplateScriptVOs, nowQuestion);
+ questionMessage.setQuestionList(ivrTaskTemplateScriptVOs);
questionMessage.setNowQuestion(nextQuestion);
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES);
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES);
@@ -485,23 +442,23 @@
String date = simpleDateFormat1.format(new Date());
log.info("灏卞彲浠ユ寕鏂數璇濅簡------: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "hangup", 1, 120, TimeUnit.MINUTES);
- phoneUtils.ttsPlayback(ivrLibaTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(ivrTaskTemplateVO.getRevisitAfter(), phoneCallBackVO.getUuid());
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
- phoneUtils.hangup("", "", ivrLibaTemplateVO.getRevisitAfter(), "", "", "", "", phoneCallBackVO.getUuid());
+ phoneUtils.hangup("", "", ivrTaskTemplateVO.getRevisitAfter(), "", "", "", "", phoneCallBackVO.getUuid());
return;
}
- } else if (mateNum < ivrLibaTemplateVO.getMateNum().intValue()) {
+ } else if (mateNum < ivrTaskTemplateVO.getMateNum().intValue()) {
//娌℃湁闂埌瑙勫畾娆℃暟
mateNum = mateNum + 1;
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", mateNum, 120, TimeUnit.MINUTES);
}
}
//閫夐」鍖归厤瀹屾垚鍚庯紝闇�瑕佸啀鍘婚�氳繃搴撳啀杩涜鍖归厤涓�娆�
- String extemplateID = ivrLibaTemplateVO.getSubmoduleID();
+ String extemplateID = ivrTaskTemplateVO.getSubmoduleID();
String[] split = extemplateID.split(",");
List<String> list = Arrays.asList(split);
List<Long> list1 = new ArrayList<>();
@@ -525,13 +482,13 @@
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());
+ IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO = returnQues.getNowQuestion();
+ ivrTaskTemplateScriptVO.setSubmoduleText(ivrLibaExtemplatescript.getSwitchText());
+ ivrTaskTemplateScriptVO.setSubmoduleVoice(ivrLibaExtemplatescript.getSwitchWav());
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES);
if (ivrLibaExtemplatescript.getIsEnd() == 1) {
//灏嗛棶棰樼疆绌�
- IvrLibaTemplateScriptVO nowQuestion1 = questionMessage.getNowQuestion();
+ IvrTaskTemplateScriptVO nowQuestion1 = questionMessage.getNowQuestion();
nowQuestion1.setQuestionText(null);
nowQuestion1.setQuestionVoice(null);
questionMessage.setNowQuestion(nowQuestion1);
@@ -542,7 +499,7 @@
//璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀撅紝 tts_playback鈥濆皢缁撴灉浼犲洖
String date = simpleDateFormat1.format(new Date());
log.info("璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀�------: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
- phoneUtils.ttsPlayback(nowQuestion.getQuestionText() + ivrLibaTemplateScriptVO.getSubmoduleText(), phoneCallBackVO.getUuid());
+ phoneUtils.ttsPlayback(nowQuestion.getQuestionText() + ivrTaskTemplateScriptVO.getSubmoduleText(), phoneCallBackVO.getUuid());
}
break;
}
@@ -552,7 +509,6 @@
}
}
}
-
//涓嬮潰鐨勪唬鐮佷笉鑳藉垹闄わ紝涓婇潰鐨勬柟娉曞彧鏄厤鍚堢數璇濈鑱旇皟鐢ㄧ殑锛�
// @Override
@@ -789,12 +745,13 @@
// 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) {
+ private IvrTaskTemplateScriptVO getNextQuestion(List<IvrTaskTemplateScriptVO> ivrTaskTemplateScriptVOList, IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO) {
+
+ for (int j = 0; j < ivrTaskTemplateScriptVOList.size(); j++) {
+ if (ivrTaskTemplateScriptVOList.get(j).getTargetid() == ivrTaskTemplateScriptVO.getTargetid() + 1) {
// 瀵硅鏉emplateScriptVO杩涜澶勭悊
- return ivrLibaTemplateScriptVOList.get(j);
+ return ivrTaskTemplateScriptVOList.get(j);
}
}
return null;
--
Gitblit v1.9.3