| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | |
| | | // 处理空异常 |
| | | if (MapUtils.isEmpty(result)) { |
| | | result = new HashMap<>(); |
| | | // 确保所有 key 都有值,避免空指针异常 |
| | | // MyBatis 的 SUM 在没有匹配行时会返回 null |
| | | result.putIfAbsent("wzx", 0); |
| | | result.putIfAbsent("ysf", 0); |
| | | result.putIfAbsent("yc", 0); |
| | | result.putIfAbsent("jg", 0); |
| | | result.putIfAbsent("fssb", 0); |
| | | result.putIfAbsent("yfs", 0); |
| | | result.putIfAbsent("blq", 0); |
| | | result.putIfAbsent("dsf", 0); |
| | | result.putIfAbsent("total", 0); |
| | | } |
| | | // 确保所有 key 都有值,避免空指针异常 |
| | | // MyBatis 的 SUM 在没有匹配行时会返回 null |
| | | result.putIfAbsent("wzx", 0); |
| | | result.putIfAbsent("ysf", 0); |
| | | result.putIfAbsent("yc", 0); |
| | | result.putIfAbsent("jg", 0); |
| | | result.putIfAbsent("fssb", 0); |
| | | result.putIfAbsent("yfs", 0); |
| | | result.putIfAbsent("blq", 0); |
| | | result.putIfAbsent("dsf", 0); |
| | | |
| | | return result; |
| | | } |
| | | |
| | |
| | | if (StringUtils.isNotEmpty(serviceTaskVO.getLibtemplateid())) { |
| | | serviceTask.setLibtemplateid(serviceTaskVO.getLibtemplateid()); |
| | | serviceTask.setLibtemplatename(serviceTaskVO.getLibtemplatename()); |
| | | }else { |
| | | } else { |
| | | if (ObjectUtils.isNotEmpty(serviceTaskVO.getSvyTaskTemplateVO())) { |
| | | serviceTask.setLibtemplateid(""+serviceTaskVO.getSvyTaskTemplateVO().getTemplateid()); |
| | | serviceTask.setLibtemplatename(""+serviceTaskVO.getLibtemplatename()); |
| | | serviceTask.setLibtemplateid("" + serviceTaskVO.getSvyTaskTemplateVO().getTemplateid()); |
| | | serviceTask.setLibtemplatename("" + serviceTaskVO.getLibtemplatename()); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(serviceTaskVO.getIvrTaskTemplateVO())) { |
| | | serviceTask.setLibtemplateid(""+serviceTaskVO.getIvrTaskTemplateVO().getLibtemplateid()); |
| | | serviceTask.setLibtemplatename(""+serviceTaskVO.getIvrTaskTemplateVO().getLibtemplatename()); |
| | | serviceTask.setLibtemplateid("" + serviceTaskVO.getIvrTaskTemplateVO().getLibtemplateid()); |
| | | serviceTask.setLibtemplatename("" + serviceTaskVO.getIvrTaskTemplateVO().getLibtemplatename()); |
| | | } |
| | | } |
| | | if (serviceTaskVO.getTemplateid() != null) { |
| | |
| | | subtaskDetailTrace.setAsrtext(phoneCallReqYQVO.getAsrtext()); |
| | | subtaskDetailTrace.setRecordpath(phoneCallReqYQVO.getRecordpath()); |
| | | subtaskDetailTrace.setPatid(serviceSubtask.getPatid()); |
| | | subtaskDetailTrace.setPatdesc(serviceSubtask.getSendname() + "," + serviceSubtask.getPhone() + "," + serviceSubtask.getDeptname()); |
| | | JSONObject patdescJson = new JSONObject(); |
| | | patdescJson.put("sendname", serviceSubtask.getSendname()); |
| | | patdescJson.put("phone", serviceSubtask.getPhone()); |
| | | patdescJson.put("age", serviceSubtask.getAge()); |
| | | patdescJson.put("sex", serviceSubtask.getSex() != null ? serviceSubtask.getSex() == 1 ? "男" : "女" : null); |
| | | subtaskDetailTrace.setPatdesc(patdescJson.toJSONString()); |
| | | subtaskDetailTrace.setTodeptcode(ivrTaskTemplateScriptVO.getDutyDeptCode()); |
| | | subtaskDetailTrace.setTodeptname(ivrTaskTemplateScriptVO.getDutyDeptName()); |
| | | subtaskDetailTrace.setOrgid(serviceSubtask.getOrgid()); |
| | |
| | | |
| | | if (visitCount != null && visitCount > 1) { |
| | | serviceSubtaskStatistic = getStatisticAgain(serviceSubtaskList, followUpCountStyle); |
| | | }else if(visitCount != null && visitCount == 1){ |
| | | } else if (visitCount != null && visitCount == 1) { |
| | | serviceSubtaskStatistic = getStatisticFirst(serviceSubtaskList, followUpCountStyle); |
| | | }else { |
| | | } else { |
| | | //格式化为两位小数的百分比 |
| | | DecimalFormat percentFormat = new DecimalFormat("##.##%"); |
| | | serviceSubtaskStatistic.setDeptname(serviceSubtaskList.get(0).getDeptname()); |
| | |
| | | |
| | | /** |
| | | * 首次随访统计 |
| | | * |
| | | * @param serviceSubtaskList |
| | | * @param followUpCountStyle |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * 再次随访统计 |
| | | * |
| | | * @param serviceSubtaskList |
| | | * @param followUpCountStyle |
| | | * @return |
| | |
| | | if (serviceSubtaskPreachform1.getSort() == spSize.size() && failSendstate.equals("4")) { |
| | | serviceSubtask.setCurrentPreachform(preachform); |
| | | serviceSubtask.setSendstate(5L); |
| | | serviceSubtask.setRemark("setFailPreachForm方法 当前的preachform已经是最后一个了,全失败了"); |
| | | // serviceSubtask.setRemark("setFailPreachForm方法 当前的preachform已经是最后一个了,全失败了"); |
| | | serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | return true; |
| | | } |