| | |
| | | import com.smartor.domain.VO.ServiceSubtaskDetailTraceVO; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.IServiceSubtaskAnswerService; |
| | | import com.smartor.service.IServiceSubtaskDetailTraceService; |
| | | import com.smartor.service.IServiceTaskService; |
| | | import com.smartor.service.*; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | |
| | | |
| | | @Autowired |
| | | private IServiceSubtaskDetailTraceService traceService; |
| | | |
| | | @Autowired |
| | | private ISvyTaskTemplateService svyTaskTemplateService; |
| | | |
| | | @Autowired |
| | | private ISvyLibTemplateScriptService svyLibTemplateScriptService; |
| | | |
| | | @Autowired |
| | | private IIvrTaskTemplateService ivrTaskTemplateService; |
| | | |
| | | @Autowired |
| | | private IIvrLibaTemplateScriptService ivrLibaTemplateScriptService; |
| | | |
| | | @Value("${pri_key}") |
| | | private String pri_key; |
| | |
| | | } |
| | | } else if (serviceSubTaskCacheReq.getType() == 1) { |
| | | List<IvrTaskTemplateScriptVO> cacheList = serviceSubTaskCacheReq.getIvrTaskTemplateScriptVOList(); |
| | | cacheList.sort(Comparator.comparingLong( |
| | | vo -> Optional.ofNullable(vo.getSort()).orElse(0) |
| | | )); |
| | | cacheList.sort(Comparator.comparingLong(vo -> Optional.ofNullable(vo.getSort()).orElse(0))); |
| | | log.error("电话随访问卷回答结果:{}", cacheList.size()); |
| | | for (int i = 0; i < cacheList.size(); i++) { |
| | | if (i == 0) { |
| | |
| | | |
| | | } |
| | | nextScriptNo = svyTaskTemplateScriptVO.getNextScriptno(); |
| | | if (StringUtils.isEmpty(nextScriptNo)) { |
| | | nextScriptNo = getNextScriptNo(svyTaskTemplateScriptVO.getTemplateID(), svyTaskTemplateScriptVO.getScriptContent()); |
| | | } |
| | | if (svyTaskTemplateScriptVO.getScore() != null) { |
| | | score = String.valueOf(svyTaskTemplateScriptVO.getScore()); |
| | | } |
| | |
| | | score = String.valueOf(svyTaskTemplateScriptVO.getScore()); |
| | | } |
| | | } |
| | | nextScriptNo = svyTaskTemplateScriptVO.getNextScriptno().toString(); |
| | | nextScriptNo = svyTaskTemplateScriptVO.getNextScriptno(); |
| | | if (StringUtils.isEmpty(nextScriptNo)) { |
| | | nextScriptNo = getNextScriptNo(svyTaskTemplateScriptVO.getTemplateID(), svyTaskTemplateScriptVO.getScriptContent()); |
| | | } |
| | | } |
| | | ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(taskid); |
| | | serviceSubtaskDetailVO.setQuestiontext(svyTaskTemplateScriptVO.getScriptContent()); |
| | |
| | | serviceSubtaskDetailVO.setCreateTime(new Date()); |
| | | serviceSubtaskDetailVO.setUpdateTime(new Date()); |
| | | serviceSubtaskDetailVO.setTemplateType(2); |
| | | serviceSubtaskDetailVO.setLibTemplateid(CollectionUtils.isNotEmpty(selectServiceSubtaskList) ? |
| | | (ObjectUtils.isNotEmpty(selectServiceSubtaskList.get(0).getLibtemplateid()) ? |
| | | selectServiceSubtaskList.get(0).getLibtemplateid().intValue() : null): null); |
| | | serviceSubtaskDetailVO.setLibTemplateid(CollectionUtils.isNotEmpty(selectServiceSubtaskList) ? (ObjectUtils.isNotEmpty(selectServiceSubtaskList.get(0).getLibtemplateid()) ? selectServiceSubtaskList.get(0).getLibtemplateid().intValue() : null) : null); |
| | | if (ObjectUtils.isNotEmpty(serviceTask)) { |
| | | serviceSubtaskDetailVO.setGuid(serviceTask.getGuid()); |
| | | serviceSubtaskDetailVO.setOrgid(serviceTask.getOrgid()); |
| | |
| | | map.put("isabnormal", isabnormalFlag.toString()); |
| | | return map; |
| | | } |
| | | |
| | | private String getNextScriptNo(Long taskTemplateID, String scriptContent) { |
| | | SvyTaskTemplate svyTaskTemplate = svyTaskTemplateService.selectSvyTaskTemplateBySvyid(taskTemplateID); |
| | | SvyLibTemplateScript svyLibTemplateScript = new SvyLibTemplateScript(); |
| | | svyLibTemplateScript.setSvyid(svyTaskTemplate.getTemplateid()); |
| | | svyLibTemplateScript.setScriptContent(scriptContent); |
| | | List<SvyLibTemplateScript> svyLibTemplateScriptList = svyLibTemplateScriptService.selectSvyLibTemplateScriptList(svyLibTemplateScript); |
| | | if (CollectionUtils.isNotEmpty(svyLibTemplateScriptList)) { |
| | | return svyLibTemplateScriptList.get(0).getNextScriptno(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private Long getVoiceNextScriptNo(Long taskTemplateID, String scriptContent) { |
| | | IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(taskTemplateID); |
| | | IvrLibaTemplateScript ivrLibaTemplateScript = new IvrLibaTemplateScript(); |
| | | if (StringUtils.isEmpty(ivrTaskTemplate.getLibtemplateid())) return null; |
| | | ivrLibaTemplateScript.setTemplateid(Long.valueOf(ivrTaskTemplate.getLibtemplateid())); |
| | | ivrLibaTemplateScript.setScriptContent(scriptContent); |
| | | List<IvrLibaTemplateScript> ivrLibaTemplateScriptList = ivrLibaTemplateScriptService.selectIvrLibaTemplateScriptList(ivrLibaTemplateScript); |
| | | |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTemplateScriptList)) { |
| | | return ivrLibaTemplateScriptList.get(0).getNextScriptno(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | private Boolean sendTaskIds(List<Integer> sendTaskids, ServiceSubtask serviceSubtask) { |
| | | for (Integer taskId : sendTaskids) { |
| | |
| | | |
| | | } |
| | | nextScriptNo = ivrTaskTemplateScriptVO.getNextScriptno() == null ? null : ivrTaskTemplateScriptVO.getNextScriptno().toString(); |
| | | if (StringUtils.isEmpty(nextScriptNo)) { |
| | | nextScriptNo = "" + getVoiceNextScriptNo(ivrTaskTemplateScriptVO.getTemplateID(), ivrTaskTemplateScriptVO.getScriptContent()); |
| | | } |
| | | |
| | | if (ivrTaskTemplateScriptVO.getScore() != null) { |
| | | score = String.valueOf(ivrTaskTemplateScriptVO.getScore()); |
| | | } |
| | |
| | | serviceSubtaskDetailVO.setMatchedtext(ivrTaskTemplateScriptVO.getQuestionResult() != null ? ivrTaskTemplateScriptVO.getQuestionResult().replaceAll("^\"|\"$", "") : ivrTaskTemplateScriptVO.getIvrtext()); |
| | | serviceSubtaskDetailVO.setScore(ivrTaskTemplateScriptVO.getScore() != null ? ivrTaskTemplateScriptVO.getScore().toString() : "0"); |
| | | nextScriptNo = ivrTaskTemplateScriptVO.getNextScriptno() == null ? null : ivrTaskTemplateScriptVO.getNextScriptno().toString(); |
| | | if (StringUtils.isEmpty(nextScriptNo)) { |
| | | nextScriptNo = "" + getVoiceNextScriptNo(ivrTaskTemplateScriptVO.getTemplateID(), ivrTaskTemplateScriptVO.getScriptContent()); |
| | | } |
| | | if (ivrTaskTemplateScriptVO.getScore() != null) { |
| | | score = String.valueOf(ivrTaskTemplateScriptVO.getScore()); |
| | | } |