From 6659135780e718758417efde4c8c351c69e3755b Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 11 十二月 2025 15:52:19 +0800
Subject: [PATCH] 代码提交
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 333 +++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 294 insertions(+), 39 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index f7f9db7..3c14caa 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -1,7 +1,6 @@
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.ObjectMapper;
import com.google.gson.Gson;
@@ -14,20 +13,26 @@
import com.smartor.domain.*;
import com.smartor.mapper.*;
import com.smartor.service.*;
+import com.sun.org.apache.bcel.internal.generic.NEW;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
-import java.time.*;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
@@ -76,6 +81,9 @@
@Autowired
private IvrLibaExtemplatescriptMapper ivrLibaExtemplatescriptMapper;
+
+ @Autowired
+ private ISvyTaskTemplateScriptService svyTaskTemplateScriptService;
@Autowired
private IIvrTaskTemplateService ivrTaskTemplateService;
@@ -145,6 +153,11 @@
@Override
public ServiceSubtask selectServiceSubtaskById(Long id) {
return serviceSubtaskMapper.selectServiceSubtaskById(id);
+ }
+
+ @Override
+ public List<ServiceSubtask> selectServiceSubtaskByDiagname(ServiceSubtask serviceSubtask) {
+ return serviceSubtaskMapper.selectServiceSubtaskByDiagname(serviceSubtask);
}
/**
@@ -369,15 +382,18 @@
if (patMedInhospList.size() > 0) {
serviceSubtask1.setIsVisitAgain(2);
+ serviceSubtask1.setRemark(serviceSubtask1.getRemark()+";鎮h�呭啀鍏ラ櫌浜�");
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
return "鏃犻渶鍐嶆闅忚锛屾偅鑰呭啀鍏ラ櫌浜�";
} else if (serviceSubtask1.getSendstate() == 4L) {
serviceSubtask1.setIsVisitAgain(2);
+ serviceSubtask1.setRemark(serviceSubtask1.getRemark()+";鏃犻渶鍐嶆闅忚锛屼换鍔¤鏍囪涓嶅湪鎵ц");
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
return "鏃犻渶鍐嶆闅忚锛屼换鍔¤鏍囪涓嶅湪鎵ц";
} else if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1")) {
serviceSubtask1.setIsVisitAgain(2);
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
+ serviceSubtask1.setRemark(serviceSubtask1.getRemark()+";鏃犻渶鍐嶆闅忚锛屾偅鑰呰鏍囪涓嶉渶瑕佽鏈嶅姟");
return "鏃犻渶鍐嶆闅忚锛屾偅鑰呰鏍囪涓嶉渶瑕佽鏈嶅姟";
} else if (ObjectUtils.isNotEmpty(serviceSubtask1.getIsVisitAgain()) && serviceSubtask1.getIsVisitAgain() == 2) {
return "鏃犻渶鍐嶆闅忚锛岃浠诲姟宸茬粡鍐嶆闅忚杩囦簡";
@@ -586,6 +602,7 @@
serviceSubtask.setAddr(patTaskRelevance.getAddr());
serviceSubtask.setPatid(patTaskRelevance.getPatid());
serviceSubtask.setCreateTime(DateUtils.getNowDate());
+ serviceSubtask.setInhospid(patTaskRelevance.getHospid());
serviceSubtask.setSendstate(1L);
if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1)
serviceSubtask.setSendstate(2L);
@@ -654,7 +671,7 @@
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
log.error("sfSend闇�瑕佺Щ闄ょ殑subId涓猴細{}", serviceSubtask.getId().toString());
serviceSubtaskMapper.deleteServiceSubtaskById(serviceSubtask.getId());
- redisCache.removeElementFromList("cache-exist", serviceSubtask.getId().toString());
+// redisCache.removeElementFromList("cache-exist", serviceSubtask.getId().toString());
redisCache.removeElementFromList("cache-0", serviceSubtask.getId().toString());
redisCache.removeElementFromList("cache-1", serviceSubtask.getId().toString());
redisCache.removeElementFromList("cache-2", serviceSubtask.getId().toString());
@@ -1134,7 +1151,7 @@
@Override
public PhoneCallBackYQVO phoneCallBackYQ(PhoneCallReqYQVO phoneCallReqYQVO) {
//鍏堟妸璇ubId浠巆ache_exist涓墧闄わ紝鍙鏈夊洖璋冨氨鍓旈櫎锛堢洰鐨勬槸锛屽敖蹇cache-exist涓虹┖锛屽幓缂撳瓨涓嬩竴鎵硅鎵撶殑鐢佃瘽;杩欓噷鍓旈櫎涓嶅奖鍝嶇數璇濈殑姝e父涓氬姟锛�
- redisCache.removeElementFromList("cache-exist", phoneCallReqYQVO.getTaskid());
+// redisCache.removeElementFromList("cache-exist", phoneCallReqYQVO.getTaskid());
//鍒ゆ柇鏄惁鎸傛満
String hangupState = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "- hangup");
@@ -1793,8 +1810,8 @@
List<String> cacheList = new ArrayList<>();
ListOperations<String, String> listOps = redisTemplate.opsForList();
//蹇呴』绛塧che-exist鍏ㄩ儴鎵撳畬鎵嶈兘鎷夊彇涓嬩竴鎵癸紙涓昏鏄�曟墍鏈夌殑鏁版嵁閮藉爢鍦ㄧ數璇濈殑缂撳瓨閲岋紝鍦ㄨ瀹氱殑鏃堕棿鎵撲笉瀹岋級
- long existSize = listOps.size("cache-exist");
- if (existSize > 0) return pullTaskVOList;
+// long existSize = listOps.size("cache-exist");
+// if (existSize > 0) return pullTaskVOList;
int count = 0;
long size = listOps.size("cache-0");
log.error("---------鎵撶數璇濅箣鍓嶇紦瀛樹腑鐨勬暟鎹噺锛歿}", size);
@@ -1804,17 +1821,18 @@
count = Math.min(phoneCount(), (int) size);
if (count != 0) {
cacheList = listOps.range("cache-0", 0, count - 1);
+ } else {
+ return null;
}
}
-
- log.error("浠诲姟鎷夊彇cache-0鐨勫�兼槸澶氬皯锛歿}", cacheList);
+ log.info("浠诲姟鎷夊彇cache-0鐨勫�兼槸澶氬皯锛歿}", cacheList);
// cache-0涓虹珛鍗冲彂璧风殑,鍏跺畠鐨勫厛鎺ㄨ繜
if (!CollectionUtils.isEmpty(cacheList)) {
pullTaskVOList = getPullTaskList(cacheList, "cache-0");
// 鍒犻櫎宸插鐞嗙殑鏁版嵁
listOps.trim("cache-0", count, -1);
- log.error("鎵撶數璇濅箣鍚庣紦瀛樹腑鐨勬暟鎹噺---------锛歿}", listOps.size("cache-0"));
+ log.info("鎵撶數璇濅箣鍚庣紦瀛樹腑鐨勬暟鎹噺---------锛歿}", listOps.size("cache-0"));
} else {
for (int i = 1; i < 6; i++) {
//鍙栧嚭浠巆ache-1 鍒� cache-5鐨勭涓�涓瓙浠诲姟淇℃伅
@@ -1836,15 +1854,15 @@
}
}
//existList鐢ㄦ潵璁板綍鎺ヤ笅鏉ラ渶瑕佹墽琛岀殑瀛愪换鍔D
- List<String> existList = new ArrayList<>();
+// List<String> existList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(pullTaskVOList)) {
//缁欏洖璋冨弬鏁拌祴鍊�
for (PullTaskVO pullTaskVO : pullTaskVOList) {
- existList.add(pullTaskVO.getTaskid());
+// existList.add(pullTaskVO.getTaskid());
pullTaskVO.setAsrcallback(ASRCallBackPath);
}
}
- if (existList.size() != 0) redisCache.setCacheListRight("cache-exist", existList);
+// if (existList.size() != 0) redisCache.setCacheListRight("cache-exist", existList);
log.error("-----------瀹為檯鎷夊彇鐨勭數璇濇暟鎹噺锛歿}", CollectionUtils.isNotEmpty(pullTaskVOList) ? pullTaskVOList.size() : null);
return pullTaskVOList;
}
@@ -1938,6 +1956,13 @@
}
//闅忚
for (ServiceSubtaskDetail serviceSubtaskDetail : serviceSubTaskDetailReq.getServiceSubtaskDetailList()) {
+ if (serviceSubtaskDetail.getScriptid() != null) {
+ //璁剧疆涓�涓嬮棶棰樺垎绫�
+ IvrTaskTemplateScript ivrTaskTemplateScript = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptByID(serviceSubtaskDetail.getScriptid());
+ if (ivrTaskTemplateScript != null)
+ serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScript.getAssortid());
+ }
+
serviceSubtaskDetail.setSubId(selectServiceSubtaskList.get(0).getId());
// serviceSubtaskDetail.setId(UUID.randomUUID().toString());
serviceSubtaskDetail.setCreateTime(new Date());
@@ -1949,6 +1974,12 @@
} else {
if (serviceSubTaskDetailReq != null && CollectionUtils.isNotEmpty(serviceSubTaskDetailReq.getServiceSubtaskDetailList())) {
for (ServiceSubtaskDetail serviceSubtaskDetail : serviceSubTaskDetailReq.getServiceSubtaskDetailList()) {
+ if (serviceSubtaskDetail.getScriptid() != null) {
+ //璁剧疆涓�涓嬮棶棰樺垎绫�
+ IvrTaskTemplateScript ivrTaskTemplateScript = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptByID(serviceSubtaskDetail.getScriptid());
+ if (ivrTaskTemplateScript != null)
+ serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScript.getAssortid());
+ }
serviceSubtaskDetail.setCreateTime(new Date());
serviceSubtaskDetail.setGuid(serviceSubTaskDetailReq.getGuid());
serviceSubtaskDetail.setOrgid(serviceSubTaskDetailReq.getOrgid());
@@ -1991,7 +2022,7 @@
//杩涜鐭俊琛ュ伩
// getSmsCompensate(Long.valueOf(phoneCallRecordVO.getTaskid()));
redisCache.deleteObject(phoneCallRecordVO.getTaskid() + "recordAccept-hungup");
- redisCache.removeElementFromList("cache-exist", phoneCallRecordVO.getTaskid());
+// redisCache.removeElementFromList("cache-exist", phoneCallRecordVO.getTaskid());
} else if (ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("2")) {
// if (phoneCallRecordVO.getAnswered() != null && phoneCallRecordVO.getAnswered() == true) {
log.error("鏈変汉鎺ョ數璇濅簡锛屽苟涓斿畬浜�");
@@ -2014,7 +2045,7 @@
} else {
//鎮h�呮嫆缁濋殢璁�
//鍏堟妸璇ubId浠巆ache_exist涓墧闄わ紝鍙鏈夊洖璋冨氨鍓旈櫎锛堢洰鐨勬槸锛屽敖蹇cache-exist涓虹┖锛屽幓缂撳瓨涓嬩竴鎵硅鎵撶殑鐢佃瘽;杩欓噷鍓旈櫎涓嶅奖鍝嶇數璇濈殑姝e父涓氬姟锛�
- redisCache.removeElementFromList("cache-exist", phoneCallRecordVO.getTaskid());
+// redisCache.removeElementFromList("cache-exist", phoneCallRecordVO.getTaskid());
ServiceSubtask serviceSubtask = new ServiceSubtask();
serviceSubtask.setRemark("鐢佃瘽鎺ラ�氭垚鍔燂紝鎮h�呮嫆缁濋殢璁�");
serviceSubtask.setId(Long.valueOf(phoneCallRecordVO.getTaskid()));
@@ -2118,7 +2149,7 @@
stringBuilder.append(timestamp + "涔嬪墠鎼哄甫鍖讳繚鍗℃垨鐢靛瓙鍖讳繚鍗¤韩浠借瘉鍑鏉$煭淇″埌1鍙锋ゼ3妤煎崡鍏ラ櫌鍑嗗涓績鍏ラ櫌鐧昏绐楀彛锛屽姙鐞嗘寮忎綇闄㈡墜缁紝瀹屾垚鍚勯」妫�鏌ュ悗鍐嶅埌鐩稿簲鐥呭尯鎶ゅ+绔欐姤鍒般��");
stringBuilder.append("鍏ラ櫌鍑嗗涓績鐢佃瘽锛�89975977銆傚叆闄㈠姙鐞嗛』鐭�:https://mp.weixin.qq.com/s/OCkotuRyQ8Ld2owFF0YErw");
- String data = MessageSend.sendMsg(stringBuilder.toString(), "2", patArchiveSrmVO.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
+ String data = MessageSend.sendMsg(stringBuilder.toString(), "6", patArchiveSrmVO.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
if (StringUtils.isNotEmpty(data) && data.contains("result=0")) {
sendError.add(patArchiveSrmVO);
}
@@ -2134,8 +2165,9 @@
* @return
*/
@Override
+ @Cacheable(value = "sfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
- log.error("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
+ log.info("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
// List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
@@ -2192,6 +2224,20 @@
return serviceSubtaskStatistics;
}
+ @Override
+ public List<ServiceSubtaskStatistic> getSfStatisticsExport(ServiceSubtaskCountReq serviceSubtaskCountReq) {
+ List<ServiceSubtaskStatistic> sfStatistics = getSfStatistics(serviceSubtaskCountReq);
+ // 娣诲姞鎬昏琛�
+ if (CollectionUtils.isNotEmpty(sfStatistics)) {
+ ServiceSubtaskStatistic totalRow = calculateTotalRow(sfStatistics);
+ totalRow.setLeavehospitaldistrictname("鎬昏");
+ totalRow.setDeptname("鎬昏");
+ sfStatistics.add(totalRow);
+ }
+
+ return sfStatistics;
+ }
+
/**
* 鑾峰彇闅忚缁熻姣斾緥
*
@@ -2199,12 +2245,14 @@
* @return
*/
@Override
+ @Cacheable(value = "sfStatisticsJoy", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
public List<ServiceSubtaskStatistic> getSfStatisticsJoy(ServiceSubtaskCountReq serviceSubtaskCountReq) {
log.error("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
// 鏍规嵁鏉′欢杩涜鍒嗙粍
Map<String, List<ServiceSubtask>> collect = new HashMap<>();
+ String orgid = null;
if (serviceSubtaskCountReq.getLeavehospitaldistrictcodes() != null && serviceSubtaskCountReq.getLeavehospitaldistrictcodes().size() > 0) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
@@ -2226,13 +2274,10 @@
continue;
}
ServiceSubtaskStatistic statistic = getStatisticJoy(serviceSubtaskList, joySubCount);
- if (statistic.getJoyCount() != 0 && statistic.getJoyAllCount() != 0) {
- Double joyTotal = Double.parseDouble(statistic.getJoyCount() + "") / Double.parseDouble(statistic.getJoyAllCount() + "") * 100;
- statistic.setJoyTotal(String.format("%.2f", joyTotal) + "%");
- }
//鍙婃椂鐜�
ServiceSubtask ss = new ServiceSubtask();
- ss.setOrgid(serviceSubtaskList.get(0).getOrgid());
+ orgid = serviceSubtaskList.get(0).getOrgid();
+ ss.setOrgid(orgid);
// 濡傛灉鏈夊尰鐢熺紪鐮侊紝璁剧疆鍖荤敓缂栫爜鐢ㄤ簬鍙婃椂鐜囨煡璇�
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
@@ -2252,13 +2297,125 @@
}
Double jsRate = serviceSubtaskMapper.selectTimelyRate(ss);
statistic.setRate(jsRate);
-
if (ObjectUtils.isNotEmpty(statistic)) {
serviceSubtaskStatistics.add(statistic);
}
}
+ if (CollectionUtils.isNotEmpty(serviceSubtaskStatistics)) {
+ for (ServiceSubtaskStatistic serviceSubtaskStatistic : serviceSubtaskStatistics) {
+ //鎵�鏈夋弧鎰忓害鏁伴噺
+ if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getDeptcodes())) {
+ Map<String, Object> satisfactionIndex = getSatisfactionIndex("1", serviceSubtaskStatistic.getDeptcode(), orgid, serviceSubtaskCountReq.getIvrCategoryid(), serviceSubtaskCountReq.getSvyCategoryid());
+ serviceSubtaskStatistic.setJoyAllCount(satisfactionIndex.get("mydtmzl") != null ? (Integer) satisfactionIndex.get("mydtmzl") : 0);
+ serviceSubtaskStatistic.setJoyCount(satisfactionIndex.get("mydtbl") != null ? (Integer) satisfactionIndex.get("mydtbl") : 0);
+ serviceSubtaskStatistic.setJoyTotal((Double) satisfactionIndex.get("wcbl"));
+ } else if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) {
+ Map<String, Object> satisfactionIndex = getSatisfactionIndex("2", serviceSubtaskStatistic.getLeavehospitaldistrictcode(), orgid, serviceSubtaskCountReq.getIvrCategoryid(), serviceSubtaskCountReq.getSvyCategoryid());
+ serviceSubtaskStatistic.setJoyAllCount(satisfactionIndex.get("mydtmzl") != null ? (Integer) satisfactionIndex.get("mydtmzl") : 0);
+ serviceSubtaskStatistic.setJoyCount(satisfactionIndex.get("mydtbl") != null ? (Integer) satisfactionIndex.get("mydtbl") : 0);
+ serviceSubtaskStatistic.setJoyTotal((Double) satisfactionIndex.get("wcbl"));
+ }
+ }
+ }
+
return serviceSubtaskStatistics;
}
+
+ /**
+ * 鑾峰彇婊℃剰搴﹂鐩�婚噺
+ * type : 1-绉戝 2鐥呭尯
+ * code: 绉戝鎴栫梾鍖篶ode
+ *
+ * @return
+ */
+ private Map<String, Object> getSatisfactionIndex(String type, String code, String orgid, Long ivrCategoryid, Long svyCategoryid) {
+ Map<String, Object> map = new HashMap<>();
+ List<ServiceTask> serviceTasks = null;
+ if (type.equals("1")) {
+ ServiceTask serviceTask = new ServiceTask();
+ serviceTask.setDeptcode(code);
+ serviceTask.setOrgid(orgid);
+ serviceTasks = serviceTaskService.selectServiceTaskList(serviceTask);
+ } else if (type.equals("2")) {
+ ServiceTask serviceTask = new ServiceTask();
+ serviceTask.setLeavehospitaldistrictcode(code);
+ serviceTask.setOrgid(orgid);
+ serviceTasks = serviceTaskService.selectServiceTaskList(serviceTask);
+ }
+
+ //鑾峰彇婊℃剰搴﹂鐩�婚噺
+ BigDecimal mydtmzlsum = new BigDecimal(0);
+ //鑾峰彇婊℃剰搴﹂鐩~鎶ラ噺
+ BigDecimal mydtblsum = new BigDecimal(0);
+ if (CollectionUtils.isNotEmpty(serviceTasks)) {
+ //鑾峰彇婊℃剰搴﹂鐩�婚噺
+ for (ServiceTask serviceTask : serviceTasks) {
+ if (serviceTask.getType().equals("1")) {
+ //璇煶
+ Long templateid = serviceTask.getTemplateid();
+ IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript();
+ ivrTaskTemplateScript.setTemplateID(templateid);
+ ivrTaskTemplateScript.setOrgid(serviceTask.getOrgid());
+ //鍏堥粯璁や负1鍚э紝assortid=1 浠h〃鏄弧鎰忓害
+ ivrTaskTemplateScript.setAssortid(ivrCategoryid);
+ List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript);
+ if (CollectionUtils.isNotEmpty(ivrTaskTemplateScripts)) {
+ //闇�瑕佸厛璁$畻鍑哄彂閫侀噺锛屽啀涔樹互鍗曚釜闂埜婊℃剰搴﹂鐩暟閲忥紝寰楀埌婊℃剰搴﹂鐩�婚噺锛堝寘鍚簡鏈仛鐨勶級
+ ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
+ serviceSubtaskVO.setTaskid(serviceTask.getTaskid());
+ List<Long> sendstates = new ArrayList<>(Arrays.asList(3L, 5L, 6L));
+ serviceSubtaskVO.setSendstates(sendstates);
+ List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskVO);
+ if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
+ int mydtmzlCount = ivrTaskTemplateScripts.size() * serviceSubtaskList.size();
+ mydtmzlsum.add(new BigDecimal(mydtmzlCount));
+ }
+
+ }
+ } else if (serviceTask.getType().equals("2")) {
+ //闂嵎
+ SvyTaskTemplateScript svyTaskTemplateScript = new SvyTaskTemplateScript();
+ svyTaskTemplateScript.setTemplateID(serviceTask.getTemplateid());
+ svyTaskTemplateScript.setOrgid(serviceTask.getOrgid());
+ svyTaskTemplateScript.setCategoryid(svyCategoryid);
+ List<SvyTaskTemplateScript> svyTaskTemplateScriptList = svyTaskTemplateScriptService.selectSvyTaskTemplateScriptList(svyTaskTemplateScript);
+ if (CollectionUtils.isNotEmpty(svyTaskTemplateScriptList)) {
+ ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
+ serviceSubtaskVO.setTaskid(serviceTask.getTaskid());
+ List<Long> sendstates = new ArrayList<>(Arrays.asList(3L, 5L, 6L));
+ serviceSubtaskVO.setSendstates(sendstates);
+ List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskVO);
+ if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
+ int mydtmzlCount = svyTaskTemplateScriptList.size() * serviceSubtaskList.size();
+ mydtmzlsum.add(new BigDecimal(mydtmzlCount));
+ }
+ }
+ }
+
+ //鑾峰彇婊℃剰搴﹂鐩~鎶ラ噺
+ ServiceSubtaskDetail serviceSubtaskDetail = new ServiceSubtaskDetail();
+ serviceSubtaskDetail.setTaskid(serviceTask.getTaskid());
+ if (serviceTask.getType().equals("1")) serviceSubtaskDetail.setCategoryid(ivrCategoryid);
+ if (serviceTask.getType().equals("2")) serviceSubtaskDetail.setCategoryid(svyCategoryid);
+ serviceSubtaskDetail.setOrgid(serviceTask.getOrgid());
+ List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(serviceSubtaskDetail);
+ if (CollectionUtils.isNotEmpty(serviceSubtaskDetails))
+ mydtblsum.add(new BigDecimal(serviceSubtaskDetails.size()));
+ }
+
+
+ }
+ //婊℃剰搴﹂鐩�婚噺
+ map.put("mydtmzl", mydtmzlsum.intValue());
+ map.put("mydtbl", mydtblsum.intValue());
+ map.put("wcbl", 0.0);
+ if (mydtmzlsum.intValue() != 0) {
+ map.put("wcbl", mydtblsum.divide(mydtmzlsum, 2, RoundingMode.HALF_UP).doubleValue());
+ }
+
+ return map;
+ }
+
private ServiceSubtaskStatistic getStatistic(List<ServiceSubtask> serviceSubtaskList) {
ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic();
@@ -2272,10 +2429,16 @@
serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
//鍑洪櫌浜烘
serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
+ //璁板綍杩囨护鎮h�呰鎯�
+ List<ServiceSubtask> filterServiceSubtasks = new ArrayList<>();
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
//鏃犻渶闅忚浜烘
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
+ if (serviceSubtask.getTaskSituation() !=null && serviceSubtask.getTaskSituation() == 6) {
+ serviceSubtaskStatistic.setFilterCount(serviceSubtaskStatistic.getFilterCount() + 1L);
+ filterServiceSubtasks.add(serviceSubtask);
+ }
}
//搴旈殢璁夸汉娆�
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
@@ -2363,11 +2526,11 @@
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 5) {
serviceSubtaskStatistic.setTaskSituation5(serviceSubtaskStatistic.getTaskSituation5() + 1);
}
- if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) {
+ if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 7) {
serviceSubtaskStatistic.setTaskSituation6(serviceSubtaskStatistic.getTaskSituation6() + 1);
}
}
-
+ serviceSubtaskStatistic.setFilterCountList(filterServiceSubtasks);
return serviceSubtaskStatistic;
}
@@ -2470,9 +2633,7 @@
}
}
-
}
-
return serviceSubtaskStatistic;
}
@@ -2506,6 +2667,7 @@
serviceSubtaskDetail.setAssigntime(System.currentTimeMillis());
serviceSubtaskDetail.setStarttime(System.currentTimeMillis());
serviceSubtaskDetail.setAnswertime(System.currentTimeMillis());
+ serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScriptVO.getAssortid());
serviceSubtaskDetail.setAsrtext("鏃犲簲绛�");
if (StringUtils.isNotEmpty(phoneCallReqYQVO.getAsrtext()))
serviceSubtaskDetail.setAsrtext(phoneCallReqYQVO.getAsrtext());
@@ -2608,19 +2770,24 @@
LocalTime currentTime = LocalTime.now();
// 鐩爣鏃堕棿锛堟櫄涓� 8 鐐癸級
LocalTime targetTime = LocalTime.of(phoneEndHour, 0);
- // 璁$畻褰撳墠鏃堕棿鍒扮洰鏍囨椂闂寸殑鏃堕暱
- Duration duration = Duration.between(currentTime, targetTime);
- // 鑾峰彇鍓╀綑鏃堕棿鐨勫皬鏃舵暟
- long remainingHours = 0;
- long remainingMinutes = duration.toMinutes();
- //濡傛灉瓒呰繃8鐐�,灏辫缃负0
- //璺濈缁撴潫鏃堕棿灏忎簬20鍒嗛挓锛屽氨涓嶆媺鍙栦簡
- if (remainingMinutes < 20) remainingHours = 0;
- else if (remainingMinutes < 60 && remainingMinutes > 20) remainingHours = 1;
- else if (remainingMinutes > 60) remainingHours = remainingMinutes / 60;
- // 璁$畻鍓╀綑鍙互鎵撶殑鐢佃瘽鏁�
- int remainingCalls = (int) (remainingHours * phoneUpEveryHour);
- return remainingCalls;
+// // 璁$畻褰撳墠鏃堕棿鍒扮洰鏍囨椂闂寸殑鏃堕暱
+// Duration duration = Duration.between(currentTime, targetTime);
+// // 鑾峰彇鍓╀綑鏃堕棿鐨勫皬鏃舵暟
+// long remainingHours = 0;
+// long remainingMinutes = duration.toMinutes();
+// //濡傛灉瓒呰繃8鐐�,灏辫缃负0
+// //璺濈缁撴潫鏃堕棿灏忎簬20鍒嗛挓锛屽氨涓嶆媺鍙栦簡
+// if (remainingMinutes < 20) remainingHours = 0;
+// else if (remainingMinutes < 60 && remainingMinutes > 20) remainingHours = 1;
+// else if (remainingMinutes > 60) remainingHours = remainingMinutes / 60;
+// // 璁$畻鍓╀綑鍙互鎵撶殑鐢佃瘽鏁�
+// int remainingCalls = (int) (remainingHours * phoneUpEveryHour);
+// return remainingCalls;
+ if (currentTime.isBefore(targetTime)) {
+ //濡傛灉褰撳墠鏃堕棿杩樺湪鎴鏃堕棿鍐咃紝鍒欑户缁彂
+ return phoneUpEveryHour;
+ }
+ return 0;
}
public List<ServiceSubtaskCount> getSfStatisticsJoydetails(ServiceSubtaskCountReq serviceSubtaskCountReq) {
@@ -2692,4 +2859,92 @@
}
return visitTime;
}
+
+
+ /**
+ * 璁$畻鎬昏琛�
+ * @param statistics 缁熻鏁版嵁鍒楄〃
+ * @return 鎬昏琛屾暟鎹�
+ */
+ private ServiceSubtaskStatistic calculateTotalRow(List<ServiceSubtaskStatistic> statistics) {
+ ServiceSubtaskStatistic total = new ServiceSubtaskStatistic();
+
+ // 鍒濆鍖栨暟鍊煎瓧娈�
+ total.setDischargeCount(0);
+ total.setNonFollowUp(0L);
+ total.setFilterCount(0L);
+ total.setFollowUpNeeded(0L);
+ total.setNeedFollowUp(0L);
+ total.setPendingFollowUp(0L);
+ total.setFollowUpSuccess(0L);
+ total.setFollowUpFail(0L);
+ total.setManual(0L);
+ total.setSms(0L);
+ total.setWeChat(0L);
+ total.setAbnormal(0L);
+ total.setNeedFollowUpAgain(0L);
+ total.setPendingFollowUpAgain(0L);
+ total.setFollowUpSuccessAgain(0L);
+ total.setFollowUpFailAgain(0L);
+ total.setManualAgain(0L);
+ total.setSmsAgain(0L);
+ total.setWeChatAgain(0L);
+ total.setAbnormalAgain(0L);
+ total.setTaskSituation1(0);
+ total.setTaskSituation2(0);
+ total.setTaskSituation3(0);
+ total.setTaskSituation4(0);
+ total.setTaskSituation5(0);
+ total.setTaskSituation6(0);
+
+ // 绱姞鍚勪釜瀛楁鐨勫��
+ for (ServiceSubtaskStatistic stat : statistics) {
+ if (stat.getDischargeCount() != null) {
+ total.setDischargeCount(total.getDischargeCount() + stat.getDischargeCount());
+ }
+ total.setNonFollowUp(total.getNonFollowUp() + (stat.getNonFollowUp() != null ? stat.getNonFollowUp() : 0L));
+ total.setFilterCount(total.getFilterCount() + (stat.getFilterCount() != null ? stat.getFilterCount() : 0L));
+ total.setFollowUpNeeded(total.getFollowUpNeeded() + (stat.getFollowUpNeeded() != null ? stat.getFollowUpNeeded() : 0L));
+ total.setNeedFollowUp(total.getNeedFollowUp() + (stat.getNeedFollowUp() != null ? stat.getNeedFollowUp() : 0L));
+ total.setPendingFollowUp(total.getPendingFollowUp() + (stat.getPendingFollowUp() != null ? stat.getPendingFollowUp() : 0L));
+ total.setFollowUpSuccess(total.getFollowUpSuccess() + (stat.getFollowUpSuccess() != null ? stat.getFollowUpSuccess() : 0L));
+ total.setFollowUpFail(total.getFollowUpFail() + (stat.getFollowUpFail() != null ? stat.getFollowUpFail() : 0L));
+ total.setManual(total.getManual() + (stat.getManual() != null ? stat.getManual() : 0L));
+ total.setSms(total.getSms() + (stat.getSms() != null ? stat.getSms() : 0L));
+ total.setWeChat(total.getWeChat() + (stat.getWeChat() != null ? stat.getWeChat() : 0L));
+ total.setAbnormal(total.getAbnormal() + (stat.getAbnormal() != null ? stat.getAbnormal() : 0L));
+ total.setNeedFollowUpAgain(total.getNeedFollowUpAgain() + (stat.getNeedFollowUpAgain() != null ? stat.getNeedFollowUpAgain() : 0L));
+ total.setPendingFollowUpAgain(total.getPendingFollowUpAgain() + (stat.getPendingFollowUpAgain() != null ? stat.getPendingFollowUpAgain() : 0L));
+ total.setFollowUpSuccessAgain(total.getFollowUpSuccessAgain() + (stat.getFollowUpSuccessAgain() != null ? stat.getFollowUpSuccessAgain() : 0L));
+ total.setFollowUpFailAgain(total.getFollowUpFailAgain() + (stat.getFollowUpFailAgain() != null ? stat.getFollowUpFailAgain() : 0L));
+ total.setManualAgain(total.getManualAgain() + (stat.getManualAgain() != null ? stat.getManualAgain() : 0L));
+ total.setSmsAgain(total.getSmsAgain() + (stat.getSmsAgain() != null ? stat.getSmsAgain() : 0L));
+ total.setWeChatAgain(total.getWeChatAgain() + (stat.getWeChatAgain() != null ? stat.getWeChatAgain() : 0L));
+ total.setAbnormalAgain(total.getAbnormalAgain() + (stat.getAbnormalAgain() != null ? stat.getAbnormalAgain() : 0L));
+ total.setTaskSituation1(total.getTaskSituation1() + (stat.getTaskSituation1() != null ? stat.getTaskSituation1() : 0));
+ total.setTaskSituation2(total.getTaskSituation2() + (stat.getTaskSituation2() != null ? stat.getTaskSituation2() : 0));
+ total.setTaskSituation3(total.getTaskSituation3() + (stat.getTaskSituation3() != null ? stat.getTaskSituation3() : 0));
+ total.setTaskSituation4(total.getTaskSituation4() + (stat.getTaskSituation4() != null ? stat.getTaskSituation4() : 0));
+ total.setTaskSituation5(total.getTaskSituation5() + (stat.getTaskSituation5() != null ? stat.getTaskSituation5() : 0));
+ total.setTaskSituation6(total.getTaskSituation6() + (stat.getTaskSituation6() != null ? stat.getTaskSituation6() : 0));
+ }
+
+ // 璁$畻鎬昏琛岀殑姣旂巼瀛楁
+ DecimalFormat percentFormat = new DecimalFormat("##.##%");
+ if (total.getNeedFollowUp() > 0) {
+ double rate = (double) (total.getFollowUpSuccess() + total.getFollowUpFail()) / total.getNeedFollowUp();
+ total.setFollowUpRate(percentFormat.format(rate));
+ } else {
+ total.setFollowUpRate("0.00%");
+ }
+
+ if (total.getNeedFollowUpAgain() > 0) {
+ double rateAgain = (double) (total.getFollowUpSuccessAgain() + total.getFollowUpFailAgain()) / total.getNeedFollowUpAgain();
+ total.setFollowUpRateAgain(percentFormat.format(rateAgain));
+ } else {
+ total.setFollowUpRateAgain("0.00%");
+ }
+
+ return total;
+ }
}
--
Gitblit v1.9.3