| | |
| | | if (CollectionUtils.isEmpty(serviceSubtaskList)) { |
| | | continue; |
| | | } |
| | | ServiceSubtaskStatistic statistic = getStatistic(serviceSubtaskList); |
| | | ServiceSubtaskStatistic statistic = getStatistic(serviceSubtaskList, serviceSubtaskCountReq.getFollowUpCountStyle()); |
| | | if(ObjectUtils.isNotEmpty(jsRates)){ |
| | | Map<String, Object> jsRateMap = jsRates.get(collectKey); |
| | | BigDecimal jsRate = new BigDecimal("0"); |
| | |
| | | } |
| | | |
| | | |
| | | private ServiceSubtaskStatistic getStatistic(List<ServiceSubtask> serviceSubtaskList) { |
| | | private ServiceSubtaskStatistic getStatistic(List<ServiceSubtask> serviceSubtaskList, String followUpCountStyle) { |
| | | ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic(); |
| | | //格式化为两位小数的百分比 |
| | | DecimalFormat percentFormat = new DecimalFormat("##.##%"); |
| | |
| | | serviceSubtaskStatistic.setPendingFollowUp(serviceSubtaskStatistic.getPendingFollowUp() + 1L); |
| | | pendingFollowUpInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访成功 |
| | | if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 6)) { |
| | | serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L); |
| | | followUpSuccessInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访失败 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) { |
| | | serviceSubtaskStatistic.setFollowUpFail(serviceSubtaskStatistic.getFollowUpFail() + 1L); |
| | | followUpFailInfo.add(serviceSubtask); |
| | | } |
| | | /** |
| | | * 不同统计方式下不同的随访成功数 参数 followUpCountStyle 控制 |
| | | */ |
| | | if(StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("1")){ |
| | | //首次随访成功 |
| | | if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 6L)) { |
| | | serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L); |
| | | followUpSuccessInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访人工 (不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("1")) { |
| | | serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L); |
| | | manualInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访短信(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("4")) { |
| | | serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L); |
| | | smsInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访微信(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L); |
| | | wechatInfo.add(serviceSubtask); |
| | | } |
| | | }else { |
| | | //首次随访成功 - 统计时候加上不执行的,已发送的 |
| | | if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(6L) |
| | | || serviceSubtask.getSendstate().equals(3L) || serviceSubtask.getSendstate().equals(4L))) { |
| | | serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L); |
| | | followUpSuccessInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访人工 (统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && serviceSubtask.getPreachform().equals("1")) { |
| | | serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L); |
| | | manualInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访短信(统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && serviceSubtask.getPreachform().equals("4")) { |
| | | serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L); |
| | | smsInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访微信(统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && serviceSubtask.getPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L); |
| | | wechatInfo.add(serviceSubtask); |
| | | } |
| | | } |
| | | if (serviceSubtaskStatistic.getNeedFollowUp() > 0) { |
| | | double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp(); |
| | | serviceSubtaskStatistic.setFollowUpRate(percentFormat.format(rate)); |
| | | } else { |
| | | serviceSubtaskStatistic.setFollowUpRate("0.00%"); |
| | | } |
| | | //首次随访人工 (不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("1")) { |
| | | serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L); |
| | | manualInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访短信(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("4")) { |
| | | serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L); |
| | | smsInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访微信(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L); |
| | | wechatInfo.add(serviceSubtask); |
| | | } |
| | | //结果异常 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) { |
| | |
| | | serviceSubtaskStatistic.setPendingFollowUpAgain(serviceSubtaskStatistic.getPendingFollowUpAgain() + 1L); |
| | | pendingFollowUpAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访成功 |
| | | if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)) { |
| | | serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L); |
| | | followUpSuccessAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访失败 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) { |
| | | serviceSubtaskStatistic.setFollowUpFailAgain(serviceSubtaskStatistic.getFollowUpFailAgain() + 1L); |
| | | followUpFailAgainInfo.add(serviceSubtask); |
| | | } |
| | | /** |
| | | * 不同统计方式下不同的随访成功数 参数 followUpCountStyle 控制 |
| | | */ |
| | | if(StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("1")){ |
| | | //再次随访成功 |
| | | if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)) { |
| | | serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L); |
| | | followUpSuccessAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访人工(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("1")) { |
| | | serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L); |
| | | manualAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访短信(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("4")) { |
| | | serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L); |
| | | smsAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访微信(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L); |
| | | wechatAgainInfo.add(serviceSubtask); |
| | | } |
| | | }else { |
| | | //再次随访成功 |
| | | if (serviceSubtask.getSendstate() != null && |
| | | (serviceSubtask.getSendstate().equals(1L) || serviceSubtask.getSendstate().equals(6L) || |
| | | serviceSubtask.getSendstate().equals(3L) || serviceSubtask.getSendstate().equals(4L))) { |
| | | serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L); |
| | | followUpSuccessAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访人工(统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && serviceSubtask.getPreachform().equals("1")) { |
| | | serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L); |
| | | manualAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访短信(统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && serviceSubtask.getPreachform().equals("4")) { |
| | | serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L); |
| | | smsAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访微信(统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && serviceSubtask.getPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L); |
| | | wechatAgainInfo.add(serviceSubtask); |
| | | } |
| | | } |
| | | if (serviceSubtaskStatistic.getNeedFollowUp() > 0) { |
| | | double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccessAgain() + serviceSubtaskStatistic.getFollowUpFailAgain()) / serviceSubtaskStatistic.getNeedFollowUpAgain(); |
| | | serviceSubtaskStatistic.setFollowUpRateAgain(percentFormat.format(rate)); |
| | | } else { |
| | | serviceSubtaskStatistic.setFollowUpRateAgain("0.00%"); |
| | | } |
| | | //再次随访人工(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("1")) { |
| | | serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L); |
| | | manualAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访短信(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("4")) { |
| | | serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L); |
| | | smsAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访微信(不统计不执行) |
| | | if (serviceSubtask.getSendstate() != null |
| | | && !serviceSubtask.getSendstate().equals(4L) |
| | | && serviceSubtask.getPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L); |
| | | wechatAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次异常 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) { |