| | |
| | | * 保存问卷答案 (异步处理,快速返回) |
| | | * |
| | | * @param serviceSubTaskAnswerReq 答案请求 |
| | | * @param flag 标志位 |
| | | * @param flag 标志位 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | |
| | | String threadName = Thread.currentThread().getName(); |
| | | log.info("[{}] 开始异步处理保存问卷答案", threadName); |
| | | try { |
| | | //参数解密 |
| | | Long tid = null; |
| | | Long pid = null; |
| | | Long subid = null; |
| | | if (ObjectUtils.isNotEmpty(serviceSubTaskAnswerReq)) { |
| | | RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); |
| | | //参数解密 |
| | | Long tid = null; |
| | | Long pid = null; |
| | | Long subid = null; |
| | | if (ObjectUtils.isNotEmpty(serviceSubTaskAnswerReq)) { |
| | | RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); |
| | | |
| | | if (flag == 0) { |
| | | tid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskAnswerReq.getParam1(), pri_key)); |
| | | pid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskAnswerReq.getParam2(), pri_key)); |
| | | if (StringUtils.isNotEmpty(serviceSubTaskAnswerReq.getParam6())) |
| | | subid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskAnswerReq.getParam6(), pri_key)); |
| | | } else if (flag == 1) { |
| | | tid = Long.valueOf(serviceSubTaskAnswerReq.getParam1()); |
| | | pid = Long.valueOf(serviceSubTaskAnswerReq.getParam2()); |
| | | subid = Long.valueOf(serviceSubTaskAnswerReq.getParam6()); |
| | | if (flag == 0) { |
| | | tid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskAnswerReq.getParam1(), pri_key)); |
| | | pid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskAnswerReq.getParam2(), pri_key)); |
| | | if (StringUtils.isNotEmpty(serviceSubTaskAnswerReq.getParam6())) |
| | | subid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskAnswerReq.getParam6(), pri_key)); |
| | | } else if (flag == 1) { |
| | | tid = Long.valueOf(serviceSubTaskAnswerReq.getParam1()); |
| | | pid = Long.valueOf(serviceSubTaskAnswerReq.getParam2()); |
| | | subid = Long.valueOf(serviceSubTaskAnswerReq.getParam6()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //根据 PID、TID、SUBID 构建需要处理的 cache key |
| | | String scriptCacheKeyPrefix = pid + "-" + tid + "-" + subid; |
| | | Set<String> targetKeys = new HashSet<>(); |
| | | //根据 PID、TID、SUBID 构建需要处理的 cache key |
| | | String scriptCacheKeyPrefix = pid + "-" + tid + "-" + subid; |
| | | Set<String> targetKeys = new HashSet<>(); |
| | | |
| | | if (serviceSubTaskAnswerReq != null && serviceSubTaskAnswerReq.getType() != null) { |
| | | if (serviceSubTaskAnswerReq.getType() == 2) { |
| | | targetKeys.add(scriptCacheKeyPrefix + "-WJscriptCache"); |
| | | } else if (serviceSubTaskAnswerReq.getType() == 1) { |
| | | targetKeys.add(scriptCacheKeyPrefix + "-SFscriptCache"); |
| | | if (serviceSubTaskAnswerReq != null && serviceSubTaskAnswerReq.getType() != null) { |
| | | if (serviceSubTaskAnswerReq.getType() == 2) { |
| | | targetKeys.add(scriptCacheKeyPrefix + "-WJscriptCache"); |
| | | } else if (serviceSubTaskAnswerReq.getType() == 1) { |
| | | targetKeys.add(scriptCacheKeyPrefix + "-SFscriptCache"); |
| | | } |
| | | } else { |
| | | //如果没有 type,则遍历所有 key(保留原有兼容性) |
| | | Set<String> allKeys = redisCache.getAllKeys(); |
| | | for (String key : allKeys) { |
| | | try { |
| | | if (key.contains(scriptCacheKeyPrefix) && (key.endsWith("-WJscriptCache") || key.endsWith("-SFscriptCache"))) { |
| | | targetKeys.add(key); |
| | | } |
| | | } catch (Exception e) { |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | //如果没有 type,则遍历所有 key(保留原有兼容性) |
| | | Set<String> allKeys = redisCache.getAllKeys(); |
| | | for (String key : allKeys) { |
| | | |
| | | //用于批量更新的子任务列表(避免在循环中重复查询) |
| | | Map<String, ServiceSubtask> subtaskCache = new HashMap<>(); |
| | | String subtaskCacheKey = subid != null ? subid.toString() : pid + "-" + tid; |
| | | |
| | | //先查询一次子任务信息 |
| | | ServiceSubtaskEntity ssVO = new ServiceSubtaskEntity(); |
| | | if (subid != null) { |
| | | ssVO.setSubId(subid); |
| | | } else { |
| | | ssVO.setTaskid(tid); |
| | | ssVO.setPatid(pid); |
| | | } |
| | | List<ServiceSubtask> initialSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(ssVO); |
| | | if (CollectionUtils.isNotEmpty(initialSubtaskList)) { |
| | | subtaskCache.put(subtaskCacheKey, initialSubtaskList.get(0)); |
| | | } |
| | | |
| | | String score = "0"; |
| | | Long nextScriptno = null; |
| | | aa: |
| | | for (String key : targetKeys) { |
| | | String[] split = key.split("-"); |
| | | //先判断,是不是当前提交人的,不是当前提交人的,跳过 |
| | | try { |
| | | if (key.contains(scriptCacheKeyPrefix) && (key.endsWith("-WJscriptCache") || key.endsWith("-SFscriptCache"))) { |
| | | targetKeys.add(key); |
| | | if (ObjectUtils.isNotEmpty(split[0]) && ObjectUtils.isNotEmpty(split[1]) && !Long.valueOf(split[0]).equals(pid) && !Long.valueOf(split[1]).equals(tid) && !Objects.isNull(split[2]) && !Long.valueOf(split[2]).equals(subid)) { |
| | | continue; |
| | | } |
| | | } catch (Exception e) { |
| | | //这里之所以要处理异常,是因为有的KEY就不是我们要的KEY,没有去截取;有异常不处理,直接下一个 |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | if (key.contains("-WJscriptCache")) { |
| | | List<SvyTaskTemplateScriptVO> cacheList = redisCache.getCacheList(key); |
| | | cacheList.sort(Comparator.comparingLong(SvyTaskTemplateScriptVO::getSort)); |
| | | log.info("问卷回答结果:{}", CollectionUtils.isEmpty(cacheList) ? null : cacheList.size()); |
| | | |
| | | //用于批量更新的子任务列表(避免在循环中重复查询) |
| | | Map<String, ServiceSubtask> subtaskCache = new HashMap<>(); |
| | | String subtaskCacheKey = subid != null ? subid.toString() : pid + "-" + tid; |
| | | //校验一下题的序号是否有问题 (如果根据选项无序跳转,就会导致错误) |
| | | cacheList = checkQuestionSort(cacheList); |
| | | |
| | | //先查询一次子任务信息 |
| | | ServiceSubtaskEntity ssVO = new ServiceSubtaskEntity(); |
| | | if (subid != null) { |
| | | ssVO.setSubId(subid); |
| | | } else { |
| | | ssVO.setTaskid(tid); |
| | | ssVO.setPatid(pid); |
| | | } |
| | | List<ServiceSubtask> initialSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(ssVO); |
| | | if (CollectionUtils.isNotEmpty(initialSubtaskList)) { |
| | | subtaskCache.put(subtaskCacheKey, initialSubtaskList.get(0)); |
| | | } |
| | | for (int i = 0; i < cacheList.size(); i++) { |
| | | if (i == 0) { |
| | | //这个时间要找到第一题 |
| | | for (SvyTaskTemplateScriptVO svyTaskTemplateScriptVO : cacheList) { |
| | | if (svyTaskTemplateScriptVO.getSort() == 1L) { |
| | | //说明是第一题 |
| | | List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = cacheList.get(0).getSvyTaskTemplateTargetoptions(); |
| | | svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions); |
| | | Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, tid, pid, subid); |
| | | if (map == null) continue aa; |
| | | if (!Objects.isNull(map.get("nextScriptNo"))) |
| | | nextScriptno = Long.valueOf(map.get("nextScriptNo")); |
| | | if (score == null || score.isEmpty()) { |
| | | score = map.get("score"); |
| | | } else { |
| | | score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score"))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | String score = "0"; |
| | | Long nextScriptno = null; |
| | | aa: |
| | | for (String key : targetKeys) { |
| | | String[] split = key.split("-"); |
| | | //先判断,是不是当前提交人的,不是当前提交人的,跳过 |
| | | try { |
| | | if (ObjectUtils.isNotEmpty(split[0]) && ObjectUtils.isNotEmpty(split[1]) && !Long.valueOf(split[0]).equals(pid) && !Long.valueOf(split[1]).equals(tid) && !Objects.isNull(split[2]) && !Long.valueOf(split[2]).equals(subid)) { |
| | | continue; |
| | | } |
| | | } catch (Exception e) { |
| | | //这里之所以要处理异常,是因为有的KEY就不是我们要的KEY,没有去截取;有异常不处理,直接下一个 |
| | | continue; |
| | | } |
| | | if (key.contains("-WJscriptCache")) { |
| | | List<SvyTaskTemplateScriptVO> cacheList = redisCache.getCacheList(key); |
| | | cacheList.sort(Comparator.comparingLong(SvyTaskTemplateScriptVO::getSort)); |
| | | log.info("问卷回答结果:{}", CollectionUtils.isEmpty(cacheList) ? null : cacheList.size()); |
| | | } else { |
| | | SvyTaskTemplateScriptVO svyTaskTemplateScriptVO = cacheList.get(i); |
| | | log.info("svyTaskTemplateScriptVO的信息为:{},i的值为:{}", svyTaskTemplateScriptVO.getScriptno(), i); |
| | | List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = cacheList.get(i).getSvyTaskTemplateTargetoptions(); |
| | | svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions); |
| | | |
| | | //校验一下题的序号是否有问题 (如果根据选项无序跳转,就会导致错误) |
| | | cacheList = checkQuestionSort(cacheList); |
| | | |
| | | for (int i = 0; i < cacheList.size(); i++) { |
| | | if (i == 0) { |
| | | //这个时间要找到第一题 |
| | | for (SvyTaskTemplateScriptVO svyTaskTemplateScriptVO : cacheList) { |
| | | if (svyTaskTemplateScriptVO.getSort() == 1L) { |
| | | //说明是第一题 |
| | | List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = cacheList.get(0).getSvyTaskTemplateTargetoptions(); |
| | | svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions); |
| | | Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, tid, pid, subid); |
| | | if (map == null) continue aa; |
| | | if (svyTaskTemplateScriptVO.getSort() != null && svyTaskTemplateScriptVO.getSort().equals(nextScriptno)) { |
| | | Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]), Objects.isNull(split[2]) ? null : Long.valueOf(split[2])); |
| | | log.error("nextScriptNo的信息为:{}", map.get("nextScriptNo")); |
| | | if (!Objects.isNull(map.get("nextScriptNo"))) |
| | | nextScriptno = Long.valueOf(map.get("nextScriptNo")); |
| | | if (score == null || score.isEmpty()) { |
| | | if (score == null) { |
| | | score = map.get("score"); |
| | | } else { |
| | | score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score"))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | SvyTaskTemplateScriptVO svyTaskTemplateScriptVO = cacheList.get(i); |
| | | log.info("svyTaskTemplateScriptVO的信息为:{},i的值为:{}", svyTaskTemplateScriptVO.getScriptno(), i); |
| | | List<SvyTaskTemplateTargetoption> svyTaskTemplateTargetoptions = cacheList.get(i).getSvyTaskTemplateTargetoptions(); |
| | | svyTaskTemplateScriptVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateTargetoptions); |
| | | |
| | | if (svyTaskTemplateScriptVO.getSort() != null && svyTaskTemplateScriptVO.getSort().equals(nextScriptno)) { |
| | | Map<String, String> map = setWJInfo(svyTaskTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]), Objects.isNull(split[2]) ? null : Long.valueOf(split[2])); |
| | | log.error("nextScriptNo的信息为:{}", map.get("nextScriptNo")); |
| | | if (!Objects.isNull(map.get("nextScriptNo"))) |
| | | nextScriptno = Long.valueOf(map.get("nextScriptNo")); |
| | | if (score == null) { |
| | | score = map.get("score"); |
| | | } else { |
| | | score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score"))); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else if (key.contains("-SFscriptCache")) { |
| | | List<IvrTaskTemplateScriptVO> cacheList = redisCache.getCacheList(key); |
| | | cacheList.sort(Comparator.comparingLong(IvrTaskTemplateScriptVO::getSort)); |
| | | log.error("电话随访问卷回答结果:{}", CollectionUtils.isEmpty(cacheList) ? null : cacheList.size()); |
| | | for (int i = 0; i < cacheList.size(); i++) { |
| | | if (i == 0) { |
| | | //这个时间要找到第一题 |
| | | for (IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO : cacheList) { |
| | | if (ivrTaskTemplateScriptVO.getSort() == 1L) { |
| | | //说明是第一题 |
| | | List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = cacheList.get(0).getIvrTaskScriptTargetoptionList(); |
| | | ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions); |
| | | Map<String, String> map = setSFInfo(ivrTaskTemplateScriptVO, tid, pid, subid); |
| | | } else if (key.contains("-SFscriptCache")) { |
| | | List<IvrTaskTemplateScriptVO> cacheList = redisCache.getCacheList(key); |
| | | cacheList.sort(Comparator.comparingLong(IvrTaskTemplateScriptVO::getSort)); |
| | | log.error("电话随访问卷回答结果:{}", CollectionUtils.isEmpty(cacheList) ? null : cacheList.size()); |
| | | for (int i = 0; i < cacheList.size(); i++) { |
| | | if (i == 0) { |
| | | //这个时间要找到第一题 |
| | | for (IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO : cacheList) { |
| | | if (ivrTaskTemplateScriptVO.getSort() == 1L) { |
| | | //说明是第一题 |
| | | List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = cacheList.get(0).getIvrTaskScriptTargetoptionList(); |
| | | ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions); |
| | | Map<String, String> map = setSFInfo(ivrTaskTemplateScriptVO, tid, pid, subid); |
| | | if (!Objects.isNull(map.get("nextScriptNo"))) |
| | | nextScriptno = Long.valueOf(map.get("nextScriptNo")); |
| | | if (score == null || score.isEmpty()) { |
| | | score = map.get("score"); |
| | | } else { |
| | | score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score"))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO = DtoConversionUtils.sourceToTarget(cacheList.get(i), IvrTaskTemplateScriptVO.class); |
| | | List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = DtoConversionUtils.sourceToTarget(cacheList.get(i).getIvrTaskScriptTargetoptionList(), IvrTaskTemplateTargetoption.class); |
| | | ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions); |
| | | |
| | | if (ivrTaskTemplateScriptVO.getSort() != null && Long.valueOf(ivrTaskTemplateScriptVO.getSort()).equals(nextScriptno)) { |
| | | Map<String, String> map = setSFInfo(ivrTaskTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]), Objects.isNull(split[2]) ? null : Long.valueOf(split[2])); |
| | | log.error("----nextScriptNo2的信息为:{}", map.get("nextScriptNo")); |
| | | if (!Objects.isNull(map.get("nextScriptNo"))) |
| | | nextScriptno = Long.valueOf(map.get("nextScriptNo")); |
| | | if (score == null || score.isEmpty()) { |
| | | if (score == null) { |
| | | score = map.get("score"); |
| | | } else { |
| | | score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score"))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO = DtoConversionUtils.sourceToTarget(cacheList.get(i), IvrTaskTemplateScriptVO.class); |
| | | List<IvrTaskTemplateTargetoption> ivrTaskTemplateTargetoptions = DtoConversionUtils.sourceToTarget(cacheList.get(i).getIvrTaskScriptTargetoptionList(), IvrTaskTemplateTargetoption.class); |
| | | ivrTaskTemplateScriptVO.setIvrTaskScriptTargetoptionList(ivrTaskTemplateTargetoptions); |
| | | |
| | | if (ivrTaskTemplateScriptVO.getSort() != null && Long.valueOf(ivrTaskTemplateScriptVO.getSort()).equals(nextScriptno)) { |
| | | Map<String, String> map = setSFInfo(ivrTaskTemplateScriptVO, Long.valueOf(split[1]), Long.valueOf(split[0]), Objects.isNull(split[2]) ? null : Long.valueOf(split[2])); |
| | | log.error("----nextScriptNo2的信息为:{}", map.get("nextScriptNo")); |
| | | if (!Objects.isNull(map.get("nextScriptNo"))) |
| | | nextScriptno = Long.valueOf(map.get("nextScriptNo")); |
| | | if (score == null) { |
| | | score = map.get("score"); |
| | | } else { |
| | | score = String.valueOf(Double.parseDouble(score) + Double.parseDouble(map.get("score"))); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | | //将该 key 和 value 从 redis 中,删除 |
| | | redisCache.deleteObject(key); |
| | | |
| | | //查询出该任务中正在执行的患者信息(使用缓存) |
| | | String currentSubtaskKey = subid != null ? subid.toString() : pid + "-" + tid; |
| | | ServiceSubtask serviceSubtask; |
| | | |
| | | if (!subtaskCache.containsKey(currentSubtaskKey)) { |
| | | ServiceSubtaskEntity serviceSubtaskEntity = new ServiceSubtaskEntity(); |
| | | if (subid != null) { |
| | | serviceSubtaskEntity.setSubId(subid); |
| | | } else { |
| | | serviceSubtaskEntity.setTaskid(tid); |
| | | serviceSubtaskEntity.setPatid(pid); |
| | | continue; |
| | | } |
| | | //将该 key 和 value 从 redis 中,删除 |
| | | redisCache.deleteObject(key); |
| | | |
| | | //查询出该任务中正在执行的患者信息(使用缓存) |
| | | String currentSubtaskKey = subid != null ? subid.toString() : pid + "-" + tid; |
| | | ServiceSubtask serviceSubtask; |
| | | |
| | | if (!subtaskCache.containsKey(currentSubtaskKey)) { |
| | | ServiceSubtaskEntity serviceSubtaskEntity = new ServiceSubtaskEntity(); |
| | | if (subid != null) { |
| | | serviceSubtaskEntity.setSubId(subid); |
| | | } else { |
| | | serviceSubtaskEntity.setTaskid(tid); |
| | | serviceSubtaskEntity.setPatid(pid); |
| | | } |
| | | // ssVO.setSendstate(3L); |
| | | List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskEntity); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskList)) { |
| | | serviceSubtask = serviceSubtaskList.get(0); |
| | | subtaskCache.put(currentSubtaskKey, serviceSubtask); |
| | | List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskEntity); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskList)) { |
| | | serviceSubtask = serviceSubtaskList.get(0); |
| | | subtaskCache.put(currentSubtaskKey, serviceSubtask); |
| | | } else { |
| | | continue; |
| | | } |
| | | } else { |
| | | continue; |
| | | serviceSubtask = subtaskCache.get(currentSubtaskKey); |
| | | } |
| | | } else { |
| | | serviceSubtask = subtaskCache.get(currentSubtaskKey); |
| | | } |
| | | |
| | | serviceSubtask.setIsabnormal(serviceSubTaskAnswerReq.getIsabnormal()); |
| | | serviceSubtask.setSendstate(6L); |
| | | serviceSubtask.setExcep(serviceSubTaskAnswerReq.getExcep()); |
| | | serviceSubtask.setFinishtime(new Date()); |
| | | serviceSubtask.setUpdateTime(new Date()); |
| | | log.error("将该key和value从redis中,serviceSubtask的值为--------:{}", serviceSubtask); |
| | | if (score != null && !score.isEmpty()) serviceSubtask.setScore(score); |
| | | serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask); |
| | | serviceSubtask.setIsabnormal(serviceSubTaskAnswerReq.getIsabnormal()); |
| | | serviceSubtask.setSendstate(6L); |
| | | serviceSubtask.setExcep(serviceSubTaskAnswerReq.getExcep()); |
| | | serviceSubtask.setFinishtime(new Date()); |
| | | serviceSubtask.setUpdateTime(new Date()); |
| | | log.error("将该key和value从redis中,serviceSubtask的值为--------:{}", serviceSubtask); |
| | | if (score != null && !score.isEmpty()) serviceSubtask.setScore(score); |
| | | serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask); |
| | | |
| | | //将当前发送状态改成 9 完成(缓存 preachform 查询) |
| | | String currentPreachform = serviceSubtask.getCurrentPreachform(); |
| | | if (StringUtils.isNotEmpty(currentPreachform)) { |
| | | ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform(); |
| | | serviceSubtaskPreachform.setPreachform(currentPreachform); |
| | | if (subid != null) { |
| | | serviceSubtaskPreachform.setSubid(subid); |
| | | } else { |
| | | Long id = serviceSubtask.getId(); |
| | | Long tid_ = serviceSubtask.getTaskid(); |
| | | if (id != null) { |
| | | serviceSubtaskPreachform.setSubid(id); |
| | | } else if (tid_ != null) { |
| | | serviceSubtaskPreachform.setTaskid(tid_); |
| | | //将当前发送状态改成 9 完成(缓存 preachform 查询) |
| | | String currentPreachform = serviceSubtask.getCurrentPreachform(); |
| | | if (StringUtils.isNotEmpty(currentPreachform)) { |
| | | ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform(); |
| | | serviceSubtaskPreachform.setPreachform(currentPreachform); |
| | | if (subid != null) { |
| | | serviceSubtaskPreachform.setSubid(subid); |
| | | } else { |
| | | Long id = serviceSubtask.getId(); |
| | | Long tid_ = serviceSubtask.getTaskid(); |
| | | if (id != null) { |
| | | serviceSubtaskPreachform.setSubid(id); |
| | | } else if (tid_ != null) { |
| | | serviceSubtaskPreachform.setTaskid(tid_); |
| | | } |
| | | } |
| | | List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskPreachforms)) { |
| | | ServiceSubtaskPreachform ssp = serviceSubtaskPreachforms.get(0); |
| | | ssp.setSendstate("9"); |
| | | serviceSubtaskPreachformMapper.updateServiceSubtaskPreachform(ssp); |
| | | } |
| | | } |
| | | List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskPreachforms)) { |
| | | ServiceSubtaskPreachform ssp = serviceSubtaskPreachforms.get(0); |
| | | ssp.setSendstate("9"); |
| | | serviceSubtaskPreachformMapper.updateServiceSubtaskPreachform(ssp); |
| | | } |
| | | } |
| | | |
| | | } |
| | | log.info("[{}] 完成异步处理保存问卷答案", Thread.currentThread().getName()); |
| | | return 1; |
| | | } catch (Exception e) { |
| | | log.error("[{}] 异步处理保存问卷答案发生异常 : {},请求的对象为:{}", Thread.currentThread().getName(), e.getMessage(), e, serviceSubTaskAnswerReq); |
| | | throw new RuntimeException("保存问卷答案失败", e); |
| | | } |
| | | log.info("[{}] 完成异步处理保存问卷答案", Thread.currentThread().getName()); |
| | | return 1; |
| | | } catch (Exception e) { |
| | | log.error("[{}] 异步处理保存问卷答案发生异常 : {},请求的对象为:{}", Thread.currentThread().getName(), e.getMessage(), e,serviceSubTaskAnswerReq); |
| | | throw new RuntimeException("保存问卷答案失败", e); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Integer saveQuestionDetail(ServiceSubTaskCacheReq serviceSubTaskCacheReq, Long flag) { |
| | | Long tid = Long.valueOf(serviceSubTaskCacheReq.getParam1()); |
| | |
| | | serviceSubtaskDetailVO.setQuestiontext(svyTaskTemplateScriptVO.getScriptContent()); |
| | | serviceSubtaskDetailVO.setIsMydException(svyTaskTemplateScriptVO.getIsMydException()); |
| | | serviceSubtaskDetailVO.setDimension(svyTaskTemplateScriptVO.getDimension()); |
| | | if (StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getScore())) |
| | | serviceSubtaskDetailVO.setScore(svyTaskTemplateScriptVO.getScore().replaceFirst("^0+(?!$)", "")); |
| | | serviceSubtaskDetailVO.setCategoryid(svyTaskTemplateScriptVO.getCategoryid()); |
| | | serviceSubtaskDetailVO.setTaskid(Long.valueOf(taskid)); |
| | | serviceSubtaskDetailVO.setTargetid(svyTaskTemplateScriptVO.getTargetid() != null ? svyTaskTemplateScriptVO.getTargetid().intValue() : null); |
| | |
| | | } |
| | | } |
| | | |
| | | String orgid = selectServiceSubtaskList.get(0).getOrgid(); |
| | | //景宁-随访异常提示 其他-异常满意度提示 |
| | | boolean addTrace = false; |
| | | if (StringUtils.isNotEmpty(orgid) && orgid.equals("47255004333112711A1001")) { |
| | | if (stt != null) { |
| | | addTrace = Long.valueOf(1L).equals(stt.getIsabnormal()); |
| | | } |
| | | } else { |
| | | addTrace = StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getIsMydException()); |
| | | } |
| | | //判断一下当前的问题是不是满意度问题,并且 dutyDeptCode 是否有值,并且选项是不是异常选项,如果全符合,则往满意度问题异常表新增 |
| | | if (StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getDutyDeptCode()) && stt != null && Long.valueOf(1L).equals(stt.getIsabnormal()) || StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getDutyDeptCode()) && StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getIsMydException())) { |
| | | if (StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getDutyDeptCode()) && stt != null && Long.valueOf(1L).equals(stt.getIsabnormal()) || StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getDutyDeptCode()) && addTrace) { |
| | | isabnormalFlag = 1L; |
| | | ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace(); |
| | | subtaskDetailTrace.setDetailId(serviceSubtaskDetail.getId()); |
| | |
| | | //获取所有选项 |
| | | subtaskDetailTrace.setTargetid(stt != null ? stt.getId() : null); |
| | | subtaskDetailTrace.setTargetvalue(serviceSubtaskDetailVO.getTargetvalue()); |
| | | subtaskDetailTrace.setMatchedtext(stt != null ? stt.getOptioncontent() : svyTaskTemplateScriptVO.getIsMydException()); |
| | | subtaskDetailTrace.setGuid(svyTaskTemplateScriptVO.getGuid()); |
| | | subtaskDetailTrace.setValueType(serviceSubtaskDetail.getValueType()); |
| | | subtaskDetailTrace.setIsMydException(svyTaskTemplateScriptVO.getIsMydException()); |
| | | subtaskDetailTrace.setTemplateType(2); |
| | | |
| | | SvyLibScriptCategory svyLibScriptCategory = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryById(svyTaskTemplateScriptVO.getCategoryid()); |
| | | subtaskDetailTrace.setType(svyLibScriptCategory != null ? svyLibScriptCategory.getType() : null); |
| | | |
| | | subtaskDetailTrace.setScriptid(svyTaskTemplateScriptVO.getId()); |
| | | //非满意度意见异常自动填入空 |
| | | subtaskDetailTrace.setMatchedtext(stt != null ? stt.getOptioncontent() : svyTaskTemplateScriptVO.getIsMydException()); |
| | | subtaskDetailTrace.setAsrtext(stt != null ? stt.getOptioncontent() : svyTaskTemplateScriptVO.getIsMydException()); |
| | | subtaskDetailTrace.setIsMydException(svyTaskTemplateScriptVO.getIsMydException()); |
| | | |
| | | subtaskDetailTrace.setRecordpath(null); |
| | | subtaskDetailTrace.setPatid(selectServiceSubtaskList.get(0).getPatid()); |
| | | JSONObject patdescJson1 = new JSONObject(); |
| | |
| | | |
| | | |
| | | //如何这需要服务补偿的服务ID不为空的话,则进行立即发送 |
| | | log.error("------svyTaskTemplateScriptVO.getSendTaskids()的值为:{},selectServiceSubtaskList的值为:{}", svyTaskTemplateScriptVO.getSendTaskids(), selectServiceSubtaskList.size()); |
| | | log.info("------svyTaskTemplateScriptVO.getSendTaskids()的值为:{},selectServiceSubtaskList的值为:{}", svyTaskTemplateScriptVO.getSendTaskids(), selectServiceSubtaskList.size()); |
| | | if (CollectionUtils.isNotEmpty(svyTaskTemplateScriptVO.getSendTaskids()) && CollectionUtils.isNotEmpty(selectServiceSubtaskList)) { |
| | | sendTaskIds(svyTaskTemplateScriptVO.getSendTaskids(), selectServiceSubtaskList.get(0)); |
| | | } |
| | |
| | | stt = ivrTaskTemplateTargetoption; |
| | | } |
| | | |
| | | |
| | | String orgid = selectServiceSubtaskList.get(0).getOrgid(); |
| | | //景宁-随访异常提示 其他-异常满意度提示 |
| | | boolean addTrace = false; |
| | | if (StringUtils.isNotEmpty(orgid) && orgid.equals("47255004333112711A1001")) { |
| | | if (stt != null) { |
| | | addTrace = Long.valueOf(1L).equals(stt.getIsabnormal()); |
| | | } |
| | | } else { |
| | | addTrace = StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIsMydException()); |
| | | } |
| | | //判断一下当前的问题是不是满意度问题,并且dutyDeptCode是否有值,并且选项是不是异常选项,如果全符合,则往满意度问题异常表新增 |
| | | if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == stt.getIsabnormal() || StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIsMydException())) { |
| | | if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == stt.getIsabnormal() || StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && addTrace) { |
| | | isabnormalFlag = "1"; |
| | | ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace(); |
| | | subtaskDetailTrace.setDetailId(serviceSubtaskDetail.getId()); |