From 26d1f59f0266672398975ba0337bb3d8267c2d95 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 12 十月 2026 15:36:52 +0800
Subject: [PATCH] 满意度扫码BUG修改
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 863 +++++++++++++++++++++++++++++----------------------------
1 files changed, 439 insertions(+), 424 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 48b966c..b27d133 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -9,20 +9,24 @@
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.service.IConfigService;
-import com.ruoyi.common.dx.MessageSend;
+import com.ruoyi.satisfaction.api.SatisfactionFacade;
+import com.ruoyi.message.sms.provider.sltd.ws.MessageSend;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.message.SendResult;
+import com.ruoyi.message.sms.SmsSendRequest;
+import com.ruoyi.message.sms.SmsSenderFactory;
+import com.ruoyi.message.wechat.WechatSendRequest;
+import com.ruoyi.message.wechat.WechatSenderFactory;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.ruoyi.system.service.ISysConfigService;
import com.smartor.common.FtpService;
-import com.smartor.common.MtSubmitSmUtil;
import com.smartor.common.ScheduleSubtaskBuilder;
import com.smartor.config.PhoneUtils;
-import com.smartor.domain.DTO.QuestionCountKsOrBqDTO;
-import com.smartor.domain.DTO.ServiceSubtaskDetailDTO;
+import com.smartor.domain.DTO.*;
import com.smartor.domain.*;
import com.smartor.domain.VO.*;
import com.smartor.domain.entity.ServiceSubtaskEntity;
@@ -44,6 +48,9 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.*;
@@ -55,6 +62,8 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+import static cn.hutool.core.convert.Convert.toHex;
+
/**
* 鍗曚竴浠诲姟锛堥殢璁匡級Service涓氬姟灞傚鐞�
*
@@ -64,6 +73,16 @@
@Slf4j
@Service
public class ServiceSubtaskServiceImpl implements IServiceSubtaskService {
+
+ /**
+ * 婊℃剰搴︽ā鍧楀澶栭棬闈紙甯搁┗ Bean锛夈��
+ * <p>
+ * 闅忚缁熻閲岀殑銆屾弧鎰忓害鎸囨暟銆嶏紙{@code getSfStatisticsJoy}锛夊彧鑳介�氳繃瀹冨彇鏁帮紱
+ * 婊℃剰搴︽ā鍧楀叧闂椂闂ㄩ潰杩斿洖鍏ㄩ浂 Map锛屼笉褰卞搷闅忚缁熻鐨勫叾瀹冨瓧娈典笌鍚姩銆�
+ */
+ @Autowired
+ private SatisfactionFacade satisfactionFacade;
+
@Autowired
private ServiceSubtaskMapper serviceSubtaskMapper;
@@ -160,10 +179,16 @@
private ISysConfigService configService;
@Autowired
- private MtSubmitSmUtil mtSubmitSmUtil;
+ private SysConfigMapper sysConfigMapper;
+
+ /**
+ * 娑堟伅鍙戦�佹柟宸ュ巶锛堢煭淇�/寰俊鍏紬鍙凤級锛屾浛浠e師鏉ョ洿鎺ヨ皟鐢ㄥ悇绔欑偣鍙戦�佷唬鐮佺殑鍐欐硶
+ */
+ @Autowired
+ private SmsSenderFactory smsSenderFactory;
@Autowired
- private SysConfigMapper sysConfigMapper;
+ private WechatSenderFactory wechatSenderFactory;
@Autowired
private RedisTemplate redisTemplate;
@@ -186,9 +211,6 @@
@Value("${req_path}")
private String req_path;
- @Value("${xhsmsPath}")
- private String xhsmsPath;
-
@Value("${phoneUpEveryHour}")
private Integer phoneUpEveryHour;
@Value("${phoneEndHour}")
@@ -206,6 +228,8 @@
private ServiceOutPathMapper serviceOutPathMapper;
private static final String KEY_SEP = "\u0001";
+ @Autowired
+ private PatMedOperationItemMapper patMedOperationItemMapper;
/**
* 鏌ヨ鍗曚竴浠诲姟锛堥殢璁匡級
@@ -591,7 +615,6 @@
// return map;
// }
-
/**
* 缁熻浠诲姟鍚勭鐘舵�佺殑鏁伴噺锛堝凡浼樺寲锛�
* 浼樺寲璇存槑锛�
@@ -620,6 +643,43 @@
result.putIfAbsent("wxsf", 0);
result.putIfAbsent("xsf", 0);
result.putIfAbsent("dsf", 0);
+ result.putIfAbsent("ywc", 0);
+ result.putIfAbsent("yc", 0);
+ result.putIfAbsent("jg", 0);
+ }
+ return result;
+ }
+
+ /**
+ * 缁熻浠诲姟鍚勭鐘舵�佺殑鏁伴噺锛堝凡浼樺寲锛�
+ * 浼樺寲璇存槑锛�
+ * 1. 浣跨敤鏁版嵁搴撳眰鑱氬悎璁$畻锛屾浛浠e簲鐢ㄥ眰閬嶅巻
+ * 2. 鎬ц兘鎻愬崌 10-100 鍊嶏紙鍙栧喅浜庢暟鎹噺锛�
+ * 3. 闄嶄綆鍐呭瓨鍗犵敤鍜岀綉缁滀紶杈�
+ *
+ * @param serviceSubtaskEntity 鏌ヨ鏉′欢
+ * @return 鍚勭姸鎬佺粺璁$粨鏋�
+ */
+ @Override
+ public Map<String, Object> countByCondition(ServiceSubtaskEntity serviceSubtaskEntity) {
+ // 鐩存帴璋冪敤鏁版嵁搴撶粺璁℃柟娉曪紝鍦ㄦ暟鎹簱灞傚畬鎴愯仛鍚堣绠�
+ Map<String, Object> result = serviceSubtaskMapper.countByCondition(serviceSubtaskEntity);
+ // 澶勭悊绌哄紓甯�
+ if (MapUtils.isEmpty(result)) {
+ result = new HashMap<>();
+ // 纭繚鎵�鏈� key 閮芥湁鍊硷紝閬垮厤绌烘寚閽堝紓甯�
+ // MyBatis 鐨� SUM 鍦ㄦ病鏈夊尮閰嶈鏃朵細杩斿洖 null
+ result.putIfAbsent("wzx", 0);
+ result.putIfAbsent("ysf", 0);
+ result.putIfAbsent("fssb", 0);
+ result.putIfAbsent("yfs", 0);
+ result.putIfAbsent("blq", 0);
+ result.putIfAbsent("total", 0);
+ result.putIfAbsent("wxsf", 0);
+ result.putIfAbsent("xsf", 0);
+ result.putIfAbsent("dsf", 0);
+ result.putIfAbsent("dfs", 0);
+ result.putIfAbsent("yfs", 0);
result.putIfAbsent("ywc", 0);
result.putIfAbsent("yc", 0);
result.putIfAbsent("jg", 0);
@@ -783,6 +843,7 @@
serviceSubtask.setUpdateTime(DateUtils.getNowDate());
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 6)
serviceSubtask.setFinishtime(new Date());
+
return serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
}
@@ -800,7 +861,6 @@
svyTaskTemplateService.deleteSvyTaskTemplateBySvyid(serviceSubtask.getTemplateid());
} else if (serviceSubtask.getType().equals("1"))
ivrTaskTemplateService.deleteIvrTaskTemplateByID(serviceSubtask.getTemplateid());
-
String tempName = svyTaskTemplateService.selectSvyTaskTemplateBySvyid(Long.valueOf(taskTempid)).getSvyname();
serviceSubtask.setTemplateid(taskTempid.longValue());
@@ -1051,8 +1111,8 @@
//灏嗕换鍔′俊鎭斁鍒版湇鍔¤〃涓�
ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTaskVO, ServiceSubtask.class);
serviceSubtask.setTaskid(serviceTask.getTaskid().longValue());
- serviceSubtask.setTemplatename(tempName);
- serviceSubtask.setTemplateid(tempid);
+ serviceSubtask.setTemplatename(ObjectUtils.isNotEmpty(tempid) ? tempName : serviceTask.getTemplatename());
+ serviceSubtask.setTemplateid(ObjectUtils.isNotEmpty(tempid) ? tempid : serviceTask.getTemplateid());
serviceSubtask.setLibtemplateid(ObjectUtils.isEmpty(serviceTask.getLibtemplateid()) ? null : Long.valueOf(serviceTask.getLibtemplateid()));
serviceSubtask.setLibtemplatename(serviceTask.getLibtemplatename());
//鏂板
@@ -1163,7 +1223,7 @@
redisCache.removeElementFromList("cache-3", serviceSubtask.getId().toString());
redisCache.removeElementFromList("cache-4", serviceSubtask.getId().toString());
//灏嗗嚭鍏ラ櫌琛ㄧ殑鏁版嵁锛岃繕鍘熸垚杩樻湭澶勭悊鐨勭姸鎬�
- if (serviceSubtask.getServiceType().equals("2")) {
+ if (serviceSubtask.getServiceType().equals("2") || serviceSubtask.getServiceType().equals("13")) {
ServiceTask st = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
//濡傛灉浠诲姟鏄暱鏈熶换鍔★紝闇�瑕佸皢璇ユ偅鑰呯殑鍑哄叆闄㈡暟鎹繕鍘熸垚杩樻湭澶勭悊鐨勭姸鎬�
if (st != null && st.getLongTask() == 1) {
@@ -1184,6 +1244,16 @@
patMedOuthosp.setServerState("0");
patMedOuthospService.updatePatMedOuthosp(patMedOuthosp);
}
+ }
+ } else if (serviceSubtask.getServiceType().equals("19")) {
+ ServiceTask st = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ //濡傛灉浠诲姟鏄暱鏈熶换鍔★紝闇�瑕佸皢璇ユ偅鑰呯殑鍑洪櫌璇︽儏鐘舵�佽繕鍘熸垚杩樻湭澶勭悊鐨勭姸鎬�
+ if (st != null && st.getLongTask() == 1
+ && ObjectUtils.isNotEmpty(serviceSubtask.getOperationItemId())) {
+ PatMedOperationItem patMedOperationItem = new PatMedOperationItem();
+ patMedOperationItem.setOpercheckFlag("0");
+ patMedOperationItem.setId(serviceSubtask.getOperationItemId());
+ patMedOperationItemMapper.updatePatMedOperationItem(patMedOperationItem);
}
}
}
@@ -1417,6 +1487,8 @@
ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTaskVO, ServiceSubtask.class);
serviceSubtask.setLibtemplateid(ObjectUtils.isEmpty(serviceTaskVO.getLibtemplateid()) ? null : Long.valueOf(serviceTaskVO.getLibtemplateid()));
serviceSubtask.setLibtemplatename(serviceTaskVO.getLibtemplatename());
+ serviceSubtask.setTemplateid(serviceTask.getTemplateid());
+ serviceSubtask.setTemplatename(serviceTask.getTemplatename());
serviceSubtask.setSendname(patTaskRelevance.getName());
serviceSubtask.setAge(patTaskRelevance.getAge());
serviceSubtask.setSfzh(patTaskRelevance.getSfzh());
@@ -2408,7 +2480,6 @@
return phoneCallBackYQVO;
}
-
private String getObject(ServiceSubtask serviceSubtask, String scriptContent) {
Map<String, Map<String, String>> param = getParam(serviceSubtask.getTaskid());
for (Map<String, String> map : param.values()) {
@@ -2425,7 +2496,6 @@
return scriptContent;
}
-
/**
* 鑾峰彇浠诲姟閲岀殑閫氶厤绗�
@@ -2475,7 +2545,6 @@
}
return map;
}
-
/**
* 闆ㄧ划浠诲姟鎷夊彇
@@ -2545,7 +2614,6 @@
log.info("-----------瀹為檯鎷夊彇鐨勭數璇濇暟鎹噺锛歿}", CollectionUtils.isNotEmpty(pullTaskVOList) ? pullTaskVOList.size() : null);
return pullTaskVOList;
}
-
private List<PullTaskVO> getPullTaskList(List<String> subIds, String cacheName) {
log.error("浠诲姟鎷夊彇subIds鐨勫�兼槸澶氬皯锛歿}", subIds);
@@ -2618,7 +2686,6 @@
return pullTaskVOList;
}
-
@Override
public Integer saveQuestionAnswerPhone(ServiceSubTaskDetailReq serviceSubTaskDetailReq) {
@@ -2878,7 +2945,7 @@
* @return
*/
@Override
- @Cacheable(value = "sfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
+// @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.info("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
String drcode = "drcode";
@@ -3000,6 +3067,8 @@
ssRate.setOrgid(serviceSubtaskCountReq.getOrgid());
ssRate.setStarttime(serviceSubtaskCountReq.getStartTime());
ssRate.setEndtime(serviceSubtaskCountReq.getEndTime());
+ ssRate.setStartOutHospTime(serviceSubtaskCountReq.getHospitalStartTime());
+ ssRate.setEndOutHospTime(serviceSubtaskCountReq.getHospitalEndTime());
ssRate.setVisitCount(serviceSubtaskCountReq.getVisitCount());
ssRate.setServiceTypeList(serviceSubtaskCountReq.getServiceType());
if (serviceSubtaskCountReq.getEndTime() != null && new Date().before(serviceSubtaskCountReq.getEndTime())) {
@@ -3014,7 +3083,6 @@
}
return jsRates;
}
-
public List<ServiceSubtaskStatistic> getSfStatisticsExport(ServiceSubtaskCountReq serviceSubtaskCountReq) {
List<ServiceSubtaskStatistic> sfStatistics = getSfStatistics(serviceSubtaskCountReq);
@@ -3091,6 +3159,8 @@
if (serviceSubtaskCountReq.getEndTime() != null && new Date().before(serviceSubtaskCountReq.getEndTime())) {
ss.setEndtime(new Date());
}
+ ss.setStartOutHospTime(serviceSubtaskCountReq.getHospitalStartTime());
+ ss.setEndOutHospTime(serviceSubtaskCountReq.getHospitalEndTime());
Double jsRate = serviceSubtaskMapper.selectTimelyRate(ss);
statistic.setRate(jsRate);
if (ObjectUtils.isNotEmpty(statistic)) {
@@ -3100,13 +3170,15 @@
if (CollectionUtils.isNotEmpty(serviceSubtaskStatistics)) {
for (ServiceSubtaskStatistic serviceSubtaskStatistic : serviceSubtaskStatistics) {
//鎵�鏈夋弧鎰忓害鏁伴噺
+ //婊℃剰搴︽ā鍧楀寲鍚庯細婊℃剰搴︽寚鏁版嵁姝ゆ敼涓鸿皟鐢ㄦ弧鎰忓害妯″潡闂ㄩ潰锛�
+ //妯″潡鍏抽棴鏃堕棬闈㈣繑鍥炲叏闆� Map锛堜笌琚縼绉诲疄鐜扮殑瀹為檯杈撳嚭涓�鑷达級锛屼笉褰卞搷闅忚缁熻鍏跺畠瀛楁銆�
if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getDeptcodes())) {
- Map<String, Object> satisfactionIndex = getSatisfactionIndex("1", serviceSubtaskStatistic.getDeptcode(), orgid, serviceSubtaskCountReq.getIvrCategoryid(), serviceSubtaskCountReq.getSvyCategoryid());
+ Map<String, Object> satisfactionIndex = satisfactionFacade.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());
+ Map<String, Object> satisfactionIndex = satisfactionFacade.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"));
@@ -3116,103 +3188,6 @@
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.setScriptAssortid(ivrCategoryid);
- List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript);
- if (CollectionUtils.isNotEmpty(ivrTaskTemplateScripts)) {
- //闇�瑕佸厛璁$畻鍑哄彂閫侀噺锛屽啀涔樹互鍗曚釜闂埜婊℃剰搴﹂鐩暟閲忥紝寰楀埌婊℃剰搴﹂鐩�婚噺锛堝寘鍚簡鏈仛鐨勶級
- ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
- 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)) {
- ServiceSubtaskEntity serviceSubtaskEntity = new ServiceSubtaskEntity();
- serviceSubtaskEntity.setTaskid(serviceTask.getTaskid());
- List<Long> sendstates = new ArrayList<>(Arrays.asList(3L, 5L, 6L));
- serviceSubtaskEntity.setSendstates(sendstates);
- List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskBySendstate(serviceSubtaskEntity);
- 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, String followUpCountStyle, Integer visitCount) {
ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic();
@@ -3338,6 +3313,24 @@
serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
}
}
+
+ //棣栨闅忚浜哄伐鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualSuccess(serviceSubtaskStatistic.getManualSuccess() + 1L);
+ }
+ //棣栨闅忚璇煶鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceSuccess(serviceSubtaskStatistic.getVoiceSuccess() + 1L);
+ }
+ //棣栨闅忚鐭俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsSuccess(serviceSubtaskStatistic.getSmsSuccess() + 1L);
+ }
+ //棣栨闅忚寰俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatSuccess(serviceSubtaskStatistic.getWeChatSuccess() + 1L);
+ }
+
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp();
serviceSubtaskStatistic.setFollowUpRate(percentFormat.format(rate));
@@ -3433,6 +3426,24 @@
serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
}
}
+
+ //鍐嶆闅忚浜哄伐鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualAgainSuccess(serviceSubtaskStatistic.getManualAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚璇煶鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceAgainSuccess(serviceSubtaskStatistic.getVoiceAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚鐭俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsAgainSuccess(serviceSubtaskStatistic.getSmsAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚寰俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatAgainSuccess(serviceSubtaskStatistic.getWeChatAgainSuccess() + 1L);
+ }
+
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccessAgain() + serviceSubtaskStatistic.getFollowUpFailAgain()) / serviceSubtaskStatistic.getNeedFollowUpAgain();
serviceSubtaskStatistic.setFollowUpRateAgain(percentFormat.format(rate));
@@ -3587,6 +3598,24 @@
serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
}
}
+
+ //棣栨闅忚浜哄伐鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualSuccess(serviceSubtaskStatistic.getManualSuccess() + 1L);
+ }
+ //棣栨闅忚璇煶鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceSuccess(serviceSubtaskStatistic.getVoiceSuccess() + 1L);
+ }
+ //棣栨闅忚鐭俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsSuccess(serviceSubtaskStatistic.getSmsSuccess() + 1L);
+ }
+ //棣栨闅忚寰俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatSuccess(serviceSubtaskStatistic.getWeChatSuccess() + 1L);
+ }
+
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp();
serviceSubtaskStatistic.setFollowUpRate(percentFormat.format(rate));
@@ -3738,6 +3767,24 @@
serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
}
}
+
+ //鍐嶆闅忚浜哄伐鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualAgainSuccess(serviceSubtaskStatistic.getManualAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚璇煶鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceAgainSuccess(serviceSubtaskStatistic.getVoiceAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚鐭俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsAgainSuccess(serviceSubtaskStatistic.getSmsAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚寰俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatAgainSuccess(serviceSubtaskStatistic.getWeChatAgainSuccess() + 1L);
+ }
+
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccessAgain() + serviceSubtaskStatistic.getFollowUpFailAgain()) / serviceSubtaskStatistic.getNeedFollowUpAgain();
serviceSubtaskStatistic.setFollowUpRateAgain(percentFormat.format(rate));
@@ -3771,7 +3818,6 @@
}
return serviceSubtaskStatistic;
}
-
private ServiceSubtaskStatistic getStatisticJoy(List<ServiceSubtask> serviceSubtaskList, List<ServiceSubtaskCount> joySubCount) {
ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic();
@@ -3895,7 +3941,6 @@
if (subCounts == null) {
subCounts = new ArrayList<>();
}
-
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
List<ServiceSubtaskCount> subCountTemp = subCounts.stream().filter(r -> r.getSubTaskId().equals(serviceSubtask.getId())).collect(Collectors.toList());
@@ -4084,10 +4129,8 @@
serviceOutPath.setUpdateTime(new Date());
serviceOutPath.setUrl(url);
iServiceOutPathService.updateServiceOutPath(serviceOutPath);
- Map<String, String> map = new HashMap<>();
- map.put("phone", serviceSubtask.getPhone());
- map.put("content", sendMagParam.getContent());
- HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(map));
+ //鐭俊鍙戦�佸凡鏀跺彛鍒� ruoyi-message 妯″潡锛涗笌鍘熷疄鐜颁竴鑷达細涓嶅垽鏂彂閫佺粨鏋�
+ smsSenderFactory.send(active, SmsSendRequest.of(serviceSubtask.getPhone(), sendMagParam.getContent(), serviceSubtask.getOrgid()));
redisCache.setCacheObject(subTaskId + "recordAccept-hungup", "1", 10, TimeUnit.MINUTES);
if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
serviceSubtask.setRemark("鐢佃瘽鍙戦�佹嫆鎺�,鐭俊琛ュ伩鍙戦�佹垚鍔�");
@@ -4168,6 +4211,10 @@
* voiceInfo - visitCount = 1 && currentPreachForm = "3"
* smsInfo - visitCount = 1 && currentPreachForm = "4"
* wechatInfo - visitCount = 1 && currentPreachForm = "5"
+ * manualSuccessInfo - visitCount = 1 && currentPreachForm = "1" && sendstate = 6
+ * voiceSuccessInfo - visitCount = 1 && currentPreachForm = "3" && sendstate = 6
+ * smsSuccessInfo - visitCount = 1 && currentPreachForm = "4" && sendstate = 6
+ * wechatSuccessInfo - visitCount = 1 && currentPreachForm = "5" && sendstate = 6
* abnormalInfo - visitCount = 1 && excep = "1"
* needFollowUpAgainInfo - visitCount > 1 && sendstate != 4
* pendingFollowUpAgainInfo - visitCount > 1 && sendstate = 2
@@ -4177,6 +4224,10 @@
* voiceAgainInfo - visitCount > 1 && currentPreachForm = "3"
* smsAgainInfo - visitCount > 1 && currentPreachForm = "4"
* wechatAgainInfo - visitCount > 1 && currentPreachForm = "5"
+ * manualAgainSuccessInfo - visitCount > 1 && currentPreachForm = "1" && sendstate = 6
+ * voiceAgainSuccessInfo - visitCount > 1 && currentPreachForm = "3" && sendstate = 6
+ * smsAgainSuccessInfo - visitCount > 1 && currentPreachForm = "4" && sendstate = 6
+ * wechatAgainSuccessInfo - visitCount > 1&& currentPreachForm = "5" && sendstate = 6
* abnormalAgainInfo- visitCount = 1 && excep = "1"
* taskSituation1Info - taskSituation = 1
* taskSituation2Info - taskSituation = 2
@@ -4260,6 +4311,26 @@
serviceSubtaskCountReq.setVisitCount(1);
serviceSubtaskCountReq.setCurrentPreachform("5");
break;
+ case "manualSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("1");
+ break;
+ case "voiceSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("3");
+ break;
+ case "smsSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("4");
+ break;
+ case "wechatSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("5");
+ break;
case "abnormalInfo":
serviceSubtaskCountReq.setVisitCount(1);
serviceSubtaskCountReq.setExcep("1");
@@ -4296,6 +4367,26 @@
serviceSubtaskCountReq.setVisitCount(2);
serviceSubtaskCountReq.setCurrentPreachform("5");
break;
+ case "manualAgainSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("1");
+ break;
+ case "voiceAgainSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("3");
+ break;
+ case "smsAgainSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("4");
+ break;
+ case "wechatAgainSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("5");
+ break;
case "abnormalAgainInfo":
serviceSubtaskCountReq.setVisitCount(2);
serviceSubtaskCountReq.setExcep("1");
@@ -4326,7 +4417,6 @@
break;
}
}
-
/**
* 鑾峰彇闅忚缁熻姣斾緥
@@ -4549,7 +4639,6 @@
return result;
}
-
/**
* @param serviceSubtask
* @param preachform
@@ -4580,7 +4669,6 @@
serviceSubtaskPreachform1.setSendstate(failSendstate);
serviceSubtaskPreachform1.setRemark(remark);
serviceSubtaskPreachformMapper.updateServiceSubtaskPreachform(serviceSubtaskPreachform1);
-
//濡傛灉褰撳墠鐨刾reachform宸茬粡鏄渶鍚庝竴涓簡锛岄偅鐩存帴灏唖erviceSubtask鐨剆endstate鐘舵�佹敼鎴�5灏辫浜�(鍏ㄥけ璐ヤ簡)
if (serviceSubtaskPreachform1.getSort() == spSize.size() && failSendstate.equals("4")) {
@@ -4627,7 +4715,6 @@
}
return visitTime;
}
-
/**
* 璁$畻鎬昏琛�
@@ -4959,6 +5046,12 @@
String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
String taskId = rsaPublicKeyExample.encryptedData(serviceSubtask.getTaskid().toString(), pub_key);
+ //涓芥按涓尰闄㈠彂閫佺殑鏄井淇″叕浼楀彿
+ if (StringUtils.isNotEmpty(serviceSubtask.getOrgid()) && serviceSubtask.getOrgid().equals("47231022633110211A2101")) {
+ resultMap = wechatSubTask(subid);
+ return resultMap;
+ }
+
//鍙戦�佹暟鎹殑灏佽
ServiceOutPath serviceOutPath = new ServiceOutPath();
serviceOutPath.setParam1(taskId);
@@ -4989,9 +5082,11 @@
sendMagParam.setContent(smsContemt.replace("${wjurl}", sendMagParam.getUrl()));
}
+ //鐭俊鍙戦�侊細鍚勭珯鐐瑰鎺ユ柟寮忓樊寮傝緝澶э紝宸叉敹鍙e埌 ruoyi-message 妯″潡
if (active.equals("nhfy")) {
- Map<String, Object> smsResult = mtSubmitSmUtil.submitSm(sendMagParam.getPhone(), sendMagParam.getContent());
- if (smsResult != null && smsResult.get("result") != null && smsResult.get("result").toString().equals("0")) {
+ SendResult smsResult = smsSenderFactory.send(active,
+ SmsSendRequest.of(sendMagParam.getPhone(), sendMagParam.getContent(), serviceSubtask.getOrgid()));
+ if (smsResult.isOk()) {
resultMap.put("code", "200");
resultMap.put("msg", "鍙戦�佹垚鍔�");
serviceSubtask.setRemark(StringUtils.isNotEmpty(serviceSubtask.getRemark()) ? serviceSubtask.getRemark() + ";鐭俊鍙戦�佹垚鍔�(鎵嬪姩鎻愪氦)" : "鐭俊鍙戦�佹垚鍔�(鎵嬪姩鎻愪氦)");
@@ -5003,204 +5098,78 @@
return resultMap;
}
- @Override
- public List<ServiceSubtaskDetailRatioExport> statQuestionOption(List<Long> taskIds, Date startOutHospTime, Date endOutHospTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType) {
- //鍏堟竻鐞嗕竴涓嬮噸澶嶆暟鎹�
- List<Long> repeatIds = serviceSubtaskDetailMapper.selectRepeatDetailIds();
- if (!CollectionUtils.isEmpty(repeatIds)) {
- serviceSubtaskDetailMapper.deleteRepeatDetailByIds(repeatIds);
- }
- List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = serviceSubtaskMapper.statQuestionOption(taskIds, startOutHospTime, endOutHospTime, scoreStart, scoreEnd, scriptContent, valueType);
+ public Map<String,Object> wechatSubTask(Long subid){
+ log.info("wechatSubTask鐨勫叆鍙備负锛歿}", subid);
+ Map<String, Object> resultMap = new HashMap<>();
+ resultMap.put("code", "500");
+ resultMap.put("msg", "鍙戦�佸け璐�");
+ try{
+ //鑾峰彇闅忚鐨勫熀鏈俊鎭�
+ ServiceSubtask serviceSubtask = selectServiceSubtaskById(subid);
+ //鑾峰彇鎮h�呬俊鎭�
+ PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(serviceSubtask.getPatid());
- // 澶勭悊 targetvalue锛氭寜 & 鍒嗗壊鎴愬鏉¤褰�
- List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>();
- for (ServiceSubtaskDetailRatioExport export : serviceSubtaskDetailRatioExports) {
- if (StringUtils.isNotEmpty(export.getTargetvalue()) && export.getTargetvalue().contains("&")) {
- String[] values = export.getTargetvalue().split("&");
- // 濡傛灉鏈夊鏉$洰鏍囧�硷紝鎷嗗垎鎴愬琛�
- for (String value : values) {
- //鍏堝幓 result 涓煡涓�涓嬶紝鏈夋病鏈夎繖涓� questiontext 鍜屽搴旂殑 targetvalue
- ServiceSubtaskDetailRatioExport existingExport = result.stream().filter(e -> e.getQuestiontext().equals(export.getQuestiontext()) && value.trim().equals(e.getTargetvalue())).findFirst().orElse(null);
- if (existingExport != null && existingExport.getRatio().equals("0") && existingExport.getCount().equals("0")) {
- //濡傛灉瀛樺湪锛屽垯灏� result 閲岀殑杩欎釜闂鎵�瀵瑰簲鐨� Targetvalue=value 杩欐潯鏁版嵁鏇存柊鎴愬綋鍓嶈繖鏉℃暟鎹�
- if (value.equals(export.getOptionresult())) {
- existingExport.setRatio(export.getRatio());
- existingExport.setScore(export.getScore());
- existingExport.setCount(export.getCount());
- existingExport.setOptionresult(export.getOptionresult());
- }
- } else if (existingExport != null && !existingExport.getRatio().equals("0")) {
- continue;
- } else {
- ServiceSubtaskDetailRatioExport newExport = DtoConversionUtils.sourceToTarget(export, ServiceSubtaskDetailRatioExport.class);
- newExport.setTargetvalue(value.trim()); // targetvalue 鏄剧ず鍗曚釜閫夐」
- if (!value.equals(export.getOptionresult())) {
- newExport.setOptionresult(null);
- newExport.setCount("0");
- newExport.setRatio("0");
- }
- result.add(newExport);
- }
- }
+ RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
+ String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
+ String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
+ String taskId = rsaPublicKeyExample.encryptedData(serviceSubtask.getTaskid().toString(), pub_key);
+ String url = localIP + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3="
+ + URLEncoder.encode(serviceSubtask.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"
+ + "$param6=" + subId;
+
+ ServiceOutPath serviceOutPath = new ServiceOutPath();
+ serviceOutPath.setParam1(taskId);
+ serviceOutPath.setParam2(patid);
+ serviceOutPath.setParam3(serviceSubtask.getTaskName());
+ serviceOutPath.setParam6(subId);
+ serviceOutPath.setCreateTime(new Date());
+ serviceOutPath.setOrgid(serviceSubtask.getOrgid());
+ iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+ String format = String.format("%03X", serviceOutPath.getId());
+ serviceOutPath.setRadix(format);
+ serviceOutPath.setUpdateTime(new Date());
+ serviceOutPath.setUrl(url);
+ iServiceOutPathService.updateServiceOutPath(serviceOutPath);
+
+ //his鎮h�卛d鏍¢獙锛堜笌鍘熷疄鐜颁竴鑷达細鍏堟牎楠岃繖涓�椤癸級
+ if (StringUtils.isEmpty(serviceSubtask.getPatidHis())) {
+ resultMap.put("code", -1);
+ resultMap.put("message", "鍙戦�佸紓甯革細" + "銆愬叕浼楀彿銆戝叕浼楀彿鍙戦�佸け璐�,his绯荤粺鐨勬偅鑰卛d涓虹┖");
+ return resultMap;
+ }
+
+ //鏈烘瀯閰嶇疆鏍¢獙銆佹姤鏂囩鍚嶄笌杩斿洖鍒ゅ畾鍧囧凡鏀跺彛鍒� ruoyi-message 鐨勫彂閫佹柟瀹炵幇
+ WechatSendRequest wechatRequest = new WechatSendRequest();
+ wechatRequest.setOrgid(serviceSubtask.getOrgid());
+ wechatRequest.setIdCard(serviceSubtask.getSfzh());
+ wechatRequest.setUrl(url);
+ wechatRequest.setTitle(serviceSubtask.getTaskName());
+ wechatRequest.setContent(serviceSubtask.getTaskDesc());
+ wechatRequest.setPhone(patArchive.getTelcode());
+ wechatRequest.setPatientName(serviceSubtask.getSendname());
+ wechatRequest.setPatidHis(patArchive.getPatidHis());
+ SendResult wechatResult = wechatSenderFactory.send(active, wechatRequest);
+
+ //鍙戦�佸畬鎴愬悗锛屼慨鏀圭姸鎬�
+ serviceSubtask.setSendstate(3L);
+ if (wechatResult.isOk()) {
+ serviceSubtask.setResult("success");
+ resultMap.put("code", "200");
+ resultMap.put("msg", "鍙戦�佹垚鍔�");
} else {
- // targetvalue 涓嶅寘鍚� &锛岀洿鎺ユ坊鍔犲埌缁撴灉
- result.add(export);
+ log.error("銆恠fHandlle銆戝叕浼楀彿鍙戦�佸け璐ワ紝鎮h�呬俊鎭細{}锛岄敊璇俊鎭細{}", serviceSubtask, wechatResult.getMessage());
+ resultMap.put("code", -1);
+ resultMap.put("message", "銆愬叕浼楀彿銆戝叕浼楀彿鍙戦�佸け璐�");
+ return resultMap;
}
+ } catch (Exception e) {
+ String guid = UUID.randomUUID().toString();
+ log.error("銆恠fHandlle銆戦暱鏈熶换鍔″叕浼楀彿鍙戦�佸け璐ワ紝鍘熷洜锛歿}锛孏UID锛歿}", e.getMessage(), guid);
+ resultMap.put("code", -1);
+ resultMap.put("message", "銆愬叕浼楀彿銆戦暱鏈熶换鍔″叕浼楀彿鍙戦�佸け璐ワ紝鍘熷洜锛�" + e.getMessage());
+ return resultMap;
}
-
- return result;
- }
-
- /*
- * 鏍规嵁绉戝鎴栫梾鍖虹粺璁¢棶鍗烽�夐」(绉戝銆侀鐩煡璇㈢殑绉戝璇勫垎琛�)
- */
- @Override
- public List<QuestionCountKsOrBqDTO> statQuestionOptionByKsOrBq(QuestionCountKsOrBqVO vo) {
- List<QuestionCountKsOrBqDTO> sourceList = serviceSubtaskMapper.statQuestionOptionByKsOrBq(vo);
- if (CollectionUtils.isEmpty(sourceList)) {
- return Collections.emptyList();
- }
-
- boolean byDept = vo.getLeaveldeptcodes() != null;
- boolean byDistrict = !byDept && vo.getLeavehospitaldistrictcodes() != null;
- if (!byDept && !byDistrict) {
- return Collections.emptyList();
- }
-
- Map<String, QuestionCountKsOrBqDTO> map = new LinkedHashMap<>();
-
- for (QuestionCountKsOrBqDTO dto : sourceList) {
- if (StringUtils.isEmpty(dto.getTargetvalue())) {
- continue;
- }
-
- String groupName = byDept ? dto.getDeptname() : dto.getLeavehospitaldistrictname();
- if (StringUtils.isEmpty(groupName)) {
- continue;
- }
-
- // 鍏抽敭锛氫袱杈归兘鐢� trimAll锛屽吋瀹瑰叏瑙掔┖鏍�
- String asrtext = trimAll(dto.getAsrtext());
- String questionKey = dto.getTaskid() + "\u0001" + trimAll(dto.getQeustionText());
-
- for (String raw : dto.getTargetvalue().split("&")) {
- String option = trimAll(raw); // 鈫� 淇鐐癸細鐢� trimAll 鑰屼笉鏄� trim
- if (option.isEmpty()) {
- continue;
- }
-
- String key = buildKey(groupName, option, questionKey);
- QuestionCountKsOrBqDTO item = map.get(key);
- if (item == null) {
- item = DtoConversionUtils.sourceToTarget(dto, QuestionCountKsOrBqDTO.class);
- item.setTargetvalue(option); // 杈撳嚭鐨� targetvalue 灏辨槸褰撳墠閫夐」
- item.setAsrtext(option);
- item.setAnswerCount("0");
- map.put(key, item);
- }
-
- if (option.equals(asrtext)) {
- item.setAnswerCount(String.valueOf(parseCount(item.getAnswerCount()) + 1));
- item.setSingleScore(String.valueOf(new BigDecimal(item.getSingleScore()).add(new BigDecimal(dto.getSingleScore()))));
- }
- }
- }
- ArrayList<QuestionCountKsOrBqDTO> questionCountKsOrBqDTOS = new ArrayList<>(map.values());
- for (QuestionCountKsOrBqDTO questionCountKsOrBqDTO : questionCountKsOrBqDTOS) {
- String singleScore = questionCountKsOrBqDTO.getSingleScore();
- String answerCount = questionCountKsOrBqDTO.getAnswerCount();
-
- BigDecimal avg;
- if (StringUtils.isEmpty(answerCount)
- || BigDecimal.ZERO.compareTo(new BigDecimal(answerCount.trim())) == 0) {
- // 闄ゆ暟涓� 0锛岄伩鍏� / by zero
- avg = BigDecimal.ZERO;
- } else {
- avg = new BigDecimal(singleScore)
- .divide(new BigDecimal(answerCount.trim()), 2, RoundingMode.HALF_UP);
- }
- questionCountKsOrBqDTO.setAvgScore(avg.toPlainString());
-
- }
-
- return questionCountKsOrBqDTOS;
- }
-
-
-
- @Override
- public List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds(List<Long> subtaskIds, Date startOutHospTime, Date endOutHospTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType) {
- //鍏堟竻鐞嗕竴涓嬮噸澶嶆暟鎹�
- List<Long> repeatIds = serviceSubtaskDetailMapper.selectRepeatDetailIds();
- if (!CollectionUtils.isEmpty(repeatIds)) {
- serviceSubtaskDetailMapper.deleteRepeatDetailByIds(repeatIds);
- }
-
- List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = serviceSubtaskMapper.statQuestionOptionBySubtaskIds(subtaskIds, startOutHospTime, endOutHospTime, scoreStart, scoreEnd, scriptContent, valueType);
- // 澶勭悊 targetvalue锛氭寜 & 鍒嗗壊鎴愬鏉¤褰�
- List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>();
- for (ServiceSubtaskDetailRatioExport export : serviceSubtaskDetailRatioExports) {
- if (StringUtils.isNotEmpty(export.getTargetvalue()) && export.getTargetvalue().contains("&")) {
- String[] values = export.getTargetvalue().split("&");
- // 濡傛灉鏈夊鏉$洰鏍囧�硷紝鎷嗗垎鎴愬琛�
- for (String value : values) {
- //鍏堝幓 result 涓煡涓�涓嬶紝鏈夋病鏈夎繖涓� questiontext 鍜屽搴旂殑 targetvalue
- ServiceSubtaskDetailRatioExport existingExport = result.stream().filter(e -> {
- if (e == null || export == null) {
- return false;
- }
- String q1 = e.getQuestiontext() != null ? e.getQuestiontext() : "";
- String q2 = export.getQuestiontext() != null ? export.getQuestiontext() : "";
- String t1 = value.trim();
- String t2 = e.getTargetvalue() != null ? e.getTargetvalue() : "";
- return q1.equals(q2) && t1.equals(t2);
- }).findFirst().orElse(null);
- if (existingExport != null && "0".equals(existingExport.getRatio()) && "0".equals(existingExport.getCount())) {
- //濡傛灉瀛樺湪锛屽垯灏� result 閲岀殑杩欎釜闂鎵�瀵瑰簲鐨� Targetvalue=value 杩欐潯鏁版嵁鏇存柊鎴愬綋鍓嶈繖鏉℃暟鎹�
- if (value.equals(export.getOptionresult())) {
- existingExport.setRatio(export.getRatio());
- existingExport.setScore(export.getScore());
- existingExport.setCount(export.getCount());
- existingExport.setOptionresult(export.getOptionresult());
- }
- } else if (existingExport != null && !"0".equals(existingExport.getRatio())) {
- continue;
- } else {
- ServiceSubtaskDetailRatioExport newExport = DtoConversionUtils.sourceToTarget(export, ServiceSubtaskDetailRatioExport.class);
- newExport.setTargetvalue(value.trim()); // targetvalue 鏄剧ず鍗曚釜閫夐」
- if (!value.equals(export.getOptionresult())) {
- newExport.setOptionresult(null);
- newExport.setCount("0");
- newExport.setRatio("0");
- }
- result.add(newExport);
- }
- }
- } else {
- // targetvalue 涓嶅寘鍚� &锛岀洿鎺ユ坊鍔犲埌缁撴灉
- result.add(export);
- }
- }
-
- return result;
- }
-
- /**
- * 鏍囧噯鍖栭棶鍗风瓟妗堟枃鏈細鍘绘帀 A/B/C/D 鍗曞瓧姣嶅墠缂�鍜屽悗缁┖鏍�
- * 渚嬪 "A 鏄�" -> "鏄�"锛�"B 鍚�" -> "鍚�"
- */
- private String normalizeOptionAnswer(String answer) {
- if (StringUtils.isBlank(answer)) {
- return "";
- }
- String trimmed = answer.trim();
- if (trimmed.length() >= 3 && trimmed.charAt(1) == ' ') {
- char firstChar = trimmed.charAt(0);
- if (firstChar >= 'A' && firstChar <= 'Z') {
- return trimmed.substring(2).trim();
- }
- }
- return trimmed;
+ return resultMap;
}
private Boolean saveServiceSubtaskDetail(ServiceSubtask serviceSubtask) {
@@ -5448,7 +5417,39 @@
Date newDate = new Date();
serviceSubtask.setLongSendTime(newDate);
serviceSubtask.setVisitTime(newDate);
+ // 闄㈠尯锛�/scanGenerateSubtask 鏄尶鍚嶆帴鍙o紙SecurityConfig permitAll锛夛紝鍙栦笉鍒扮櫥褰曠敤鎴凤紱
+ // 鑰� service_task.campusid 鍦ㄦ湰搴撴槸鍗犱綅鍊� '1'锛岀洿鎺ユ部鐢ㄤ細璁╃粺璁℃帴鍙o紙@AddOrgId 鎸夐櫌鍖鸿繃婊わ級鏌ヤ笉鍒版暟鎹��
+ // 杩欓噷鐢ㄤ换鍔¢厤缃殑鐥呭尯锛堝叾娆$瀹わ級鍙嶆煡 sys_dept.campusid 钀藉簱锛屼繚璇侀棶鍗风粺璁¤兘鎸夐櫌鍖哄彇鍒般��
+ String campusIdByDept = queryCampusIdByDeptCode(serviceSubtask.getLeavehospitaldistrictcode(), serviceTask.getOrgid());
+ if (StringUtils.isEmpty(campusIdByDept)) {
+ campusIdByDept = queryCampusIdByDeptCode(serviceSubtask.getDeptcode(), serviceTask.getOrgid());
+ }
+ if (StringUtils.isNotEmpty(campusIdByDept)) {
+ serviceSubtask.setCampusid(campusIdByDept);
+ }
+ // 鍙厤浜嗙瀹わ紙娌℃湁鐥呭尯锛夌殑婊℃剰搴︿换鍔★細杩欓亾绛斿嵎鍦ㄦ寜鐥呭尯绛涢�夌殑鎶ヨ〃閲岀粺璁′笉鍒帮紝鐣欐棩蹇椾究浜庤繍缁村彂鐜�
+ if (StringUtils.isEmpty(serviceSubtask.getLeavehospitaldistrictcode())
+ && ("6".equals(serviceSubtask.getServiceType()) || "14".equals(serviceSubtask.getServiceType()))) {
+ log.warn("銆愭壂鐮佺敓鎴愪换鍔°�戞弧鎰忓害瀛愪换鍔℃病鏈夌梾鍖猴紝鎸夌梾鍖虹瓫閫夌殑鎶ヨ〃灏嗙粺璁′笉鍒拌绛斿嵎锛歵askid={}, deptcode={}, campusid={}",
+ serviceSubtask.getTaskid(), serviceSubtask.getDeptcode(), serviceSubtask.getCampusid());
+ }
return serviceSubtask;
+ }
+
+ /**
+ * 鎸夌瀹�/鐥呭尯缂栫爜鍙嶆煡鎵�灞為櫌鍖猴紙鏌ヤ笉鍒拌繑鍥� null锛�
+ */
+ private String queryCampusIdByDeptCode(String deptCode, String orgid) {
+ if (StringUtils.isEmpty(deptCode)) {
+ return null;
+ }
+ try {
+ SysDept sysDept = sysDept2Mapper.selectDeptByCode(deptCode, orgid);
+ return sysDept == null ? null : sysDept.getCampusid();
+ } catch (Exception e) {
+ log.warn("鎸夌紪鐮佸弽鏌ラ櫌鍖哄け璐ワ細deptCode={}, orgid={}, err={}", deptCode, orgid, e.getMessage());
+ return null;
+ }
}
/**
@@ -5487,7 +5488,6 @@
}
}
-
public PhoneCallBackSHVO getFirstQues(PhoneCallReqYQVO phoneCallReqYQVO) {
//鐢ㄤ簬杩斿洖
PhoneCallBackSHVO phoneCallBackSHVO = new PhoneCallBackSHVO();
@@ -5525,7 +5525,6 @@
}
return phoneCallBackSHVO;
}
-
/**
* 涓夋眹ASR缁撴灉澶勭悊
@@ -5599,7 +5598,6 @@
Object cacheObject = redisCache.getCacheObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId());
if (cacheObject == null || (Integer) cacheObject < ivrTaskTemplate.getMateNum()) {
-
// 鑾峰彇閫夐」闆嗗悎涓殑 optiondesc 鐢ㄤ簬寮曞鎮h��
List<IvrTaskTemplateTargetoption> optionList = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
String optionDescStr = "";
@@ -5643,13 +5641,14 @@
return phoneCallBackSHVO;
}
-
public PhoneCallBackYQVO AiMatch(String url, PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO, IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate, List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag, String uuid) {
PhoneCallBackYQVO back = null;
List<IvrTaskTemplateTargetoption> options = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
String voiceText = phoneCallReqYQVO.getAsrtext();
String questionText = StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrtext()) ? ivrTaskTemplateScriptVO.getIvrtext() : ivrTaskTemplateScriptVO.getScriptContent();
Integer matched = -1;
+ log.info("AI鍖归厤:url = {},questionText = {},voiceText = {},options = {},uuid ={}",
+ url,questionText,voiceText,options,uuid);
matched = matchOptionIndex(url, questionText, voiceText, options, uuid);
//璇存槑鍖归厤姝g‘浜�
if (matched != null && matched >= 0) {
@@ -5743,7 +5742,8 @@
phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
//璁板綍鐘舵��
setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
- return phoneCallBackYQVO;
+ back = phoneCallBackYQVO;
+ return back;
}
flag = 1;
@@ -5751,9 +5751,10 @@
redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
// //鑾峰彇涓嬩竴棰�
log.error("鑾峰彇涓嬩竴棰樼殑淇℃伅锛歿}", ivrTaskTemplateScriptVO);
- if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1") || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
+ //branchFlag涓簄ull鏃舵寜鍒嗘敮0澶勭悊锛岄伩鍏峃PE
+ if ("1".equals(ivrTaskTemplateScriptVO.getBranchFlag()) || "0".equals(ivrTaskTemplateScriptVO.getBranchFlag()) && ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
Long nextQuestion = null;
- if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1")) {
+ if ("1".equals(ivrTaskTemplateScriptVO.getBranchFlag())) {
nextQuestion = chosenOption.getNextQuestion();
//鏇存柊鍒嗘暟
double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
@@ -5786,15 +5787,9 @@
redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
phoneCallBackYQVO.setType("text");
phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
- //灏嗙粨鏋滃啓杩沝etail琛�
- ServiceSubTaskDetailReq ssdReq = new ServiceSubTaskDetailReq();
- List<ServiceSubtaskDetail> serviceSubtaskDetailList2 = new ArrayList<>();
- serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
- serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList2);
- ssdReq.setGuid(phoneCallReqYQVO.getGuid());
- ssdReq.setOrgid(phoneCallReqYQVO.getOrgid());
- saveQuestionAnswerPhone(ssdReq);
- return phoneCallBackYQVO;
+ //鏄庣粏鍦ㄦ湰棰樺尮閰嶆垚鍔熸椂宸茶惤搴擄紙瑙佷笂鏂� saveQuestionAnswerPhone锛夛紝杩欓噷涓嶅啀閲嶅淇濆瓨
+ back = phoneCallBackYQVO;
+ return back;
}
for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
@@ -5811,6 +5806,15 @@
redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
}
}
+ //涓嬩竴棰樿剼鏈病鎵惧埌鏃讹紝鍏滃簳閲嶉棶褰撳墠棰橈紝閬垮厤璋冪敤鏂硅鍒や负鏈鐞嗚�岄��鍥炴鍒欒瘑鍒�
+ if (StringUtils.isEmpty(phoneCallBackYQVO.getValue())) {
+ log.error("涓嬩竴棰樿剼鏈湭鎵惧埌锛岄噸闂綋鍓嶉锛宯extQuestion锛歿}", nextQuestion);
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, questionText));
+ }
+ back = phoneCallBackYQVO;
+ return back;
} else if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
phoneCallBackYQVO.setType("text");
@@ -5839,57 +5843,103 @@
//鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
-// return phoneCallBackYQVO;
+ //缁撴潫璇凡鎷艰繘杩斿洖鍊硷紝鎸傛満鐢卞钩鍙版寜杩斿洖鍊兼墽琛�
+ back = phoneCallBackYQVO;
+ return back;
}
} else {
- log.info("娌℃湁鍖归厤涓�----------------------------");
- //flag=0,璇存槑娌� 鍖归厤涓婏紝涔熻鎶婃偅鑰呰鐨勮瘽璁板綍涓嬫潵
- if (matched == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size() - 1 && flag == 0) {
- ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
- List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
- ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
- //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
- if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
- String questionvoice = serviceSubtaskDetail.getQuestionvoice();
- String[] split = questionvoice.split("\\\\");
- if (split.length > 0) {
- String lastPart = split[split.length - 1];
- serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
+ //AI娌℃湁鍖归厤涓婏細鐢盇I鍒嗘敮鑷繁鎸�"娌¢棶娓呭氨閲嶉棶"鐨勬鏁板鐞嗭紝涓嶅啀閫�鍥炴鍒欒瘑鍒�
+ log.info("ai娌℃湁鍖归厤涓�----------------------------");
+ //娌″尮閰嶄笂涔熻鎶婃偅鑰呰鐨勮瘽璁板綍涓嬫潵锛坢atchedtext缃┖锛屼笌姝e垯璺緞鍙e緞涓�鑷达級
+ ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
+ List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+ ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
+ //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
+ if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
+ String questionvoice = serviceSubtaskDetail.getQuestionvoice();
+ String[] split = questionvoice.split("\\\\");
+ if (split.length > 0) {
+ String lastPart = split[split.length - 1];
+ serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
+ }
+ }
+ serviceSubtaskDetailList.add(serviceSubtaskDetail);
+ //濡傛灉娌℃湁 鍖归厤涓婏紝杩欎釜蹇呴』涓簄ull
+ serviceSubtaskDetailList.get(0).setMatchedtext("");
+ serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
+ serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
+ serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
+ saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+
+ String mateKey = phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid();
+ Integer count = null;
+ Object countObj = redisCache.getCacheObject(mateKey);
+ if (ObjectUtils.isNotEmpty(countObj)) count = (Integer) countObj;
+ if (count != null && count >= ivrTaskTemplate.getMateNum()) {
+ //娌″尮閰嶆鏁板凡缁忕敤婊★紝涓嶈兘鍐嶉噸闂簡
+ boolean noNextQuestion = ("0".equals(ivrTaskTemplateScriptVO.getBranchFlag()) || "1".equals(ivrTaskTemplateScriptVO.getBranchFlag()))
+ && (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0);
+ if (noNextQuestion) {
+ //宸茬粡鏄渶鍚庝竴棰橈紝鐩存帴鎸傛満
+ ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask1.getJsy());
+ //鏇存柊涓�涓嬪垎鏁�
+ Double score = null;
+ Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
+ serviceSubtask.setScore(String.valueOf(score));
+ serviceSubtask.setFinishtime(new Date());
+ serviceSubtask.setSendstate(6L);
+ serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
+ serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ //璁板綍鐘舵��
+ setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+ //鍘籸edis涓紝鎶婅瀛愪换鍔D鍒犻櫎
+ Long id = serviceSubtask.getId();
+ Map<String, String> map = delRedisValue(null, id.toString());
+ if (ObjectUtils.isNotEmpty(map)) {
+ redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ }
+ } else {
+ //杩樻湁涓嬩竴棰橈紝鎸塶extScriptno缁х画鎻愰棶
+ for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
+ if (script.getSort() == ivrTaskTemplateScriptVO.getNextScriptno().intValue()) {
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+ String scriptContent = StringUtils.isNotEmpty(script.getIvrtext()) ? script.getIvrtext() : script.getScriptContent();
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
+ //灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
+ redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
+ //鏇存柊涓�涓嬪垎鏁�
+ Double score = null;
+ Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
+ score = BigDecimal.valueOf(score).add(new BigDecimal(script.getScore())).doubleValue();
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
+ //鎹㈤鎴愬姛锛屾病鍖归厤娆℃暟娓呴浂
+ redisCache.deleteObject(mateKey);
+ }
}
}
- serviceSubtaskDetailList.add(serviceSubtaskDetail);
- //濡傛灉娌℃湁 鍖归厤涓婏紝杩欎釜蹇呴』涓簄ull
- serviceSubtaskDetailList.get(0).setMatchedtext("");
- serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
- serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
- serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
- saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+ } else {
+ //杩樻病闂弧娆℃暟锛岀敤noMatchText寮曞鎮h�呴噸绛�
+ redisCache.setCacheObject(mateKey, count == null ? 1 : count + 1, 120, TimeUnit.MINUTES);
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+ phoneCallBackYQVO.setValue(ivrTaskTemplateScriptVO.getNoMatchText() + getObject(serviceSubtask, StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrtext()) ? ivrTaskTemplateScriptVO.getIvrtext() : ivrTaskTemplateScriptVO.getScriptContent()));
}
+ back = phoneCallBackYQVO;
+ return back;
}
return back;
- }
-
-
- /**
- * 闂缁撴灉鍗犳瘮
- *
- * @param questionResultVO
- * @param serviceSubtaskRes
- * @return
- */
- public List<ServiceSubtaskDetailRatioExport> getDetailRatio(QuestionResultVO questionResultVO, List<ServiceSubtaskRes> serviceSubtaskRes) {
- List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = null;
- if (StringUtils.isNotEmpty(questionResultVO.getServiceType()) && questionResultVO.getServiceType().equals("2")) {
- //鑾峰彇serviceSubtaskList涓殑鎵�鏈塼askid
- List<Long> taskIds = serviceSubtaskRes.stream().map(ServiceSubtaskRes::getTaskid).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList());
- serviceSubtaskDetailRatioExports = statQuestionOption(taskIds, questionResultVO.getStartOutHospTime(), questionResultVO.getEndOutHospTime(), questionResultVO.getQuestionContent(), questionResultVO.getStartScore(), questionResultVO.getEndScore(), questionResultVO.getValueType());
- } else if (StringUtils.isNotEmpty(questionResultVO.getServiceType()) && questionResultVO.getServiceType().equals("6")) {
- //婊℃剰搴︾粺璁� 锛堥�氳繃 subtask 鐨� id 鍘荤粺璁★級
- List<Long> subtaskIds = serviceSubtaskRes.stream().map(ServiceSubtaskRes::getId).collect(Collectors.toList());
- serviceSubtaskDetailRatioExports = statQuestionOptionBySubtaskIds(subtaskIds, questionResultVO.getStartOutHospTime(), questionResultVO.getEndOutHospTime(), questionResultVO.getQuestionContent(), questionResultVO.getStartScore(), questionResultVO.getEndScore(), questionResultVO.getValueType());
- }
- return serviceSubtaskDetailRatioExports;
}
//鑾峰彇浠诲姟缁勪俊鎭�
@@ -5932,43 +5982,8 @@
log.info("ai鍖归厤鎴愬姛锛屽尮閰嶇粨鏋滄槸:" + matchedText);
}
- private static String trimAll(String s) {
- if (s == null) {
- return "";
- }
- int start = 0;
- int end = s.length();
- while (start < end && isBlankChar(s.charAt(start))) {
- start++;
- }
- while (end > start && isBlankChar(s.charAt(end - 1))) {
- end--;
- }
- return s.substring(start, end);
- }
-
- private static Boolean isBlankChar(char c) {
- return c == '\u3000' // 鍏ㄨ绌烘牸
- || c == ' ' // 鍗婅绌烘牸
- || c == '\t'
- || c == '\n'
- || c == '\r'
- || c == '\f'
- || Character.isWhitespace(c);
- }
-
- private String buildKey(String groupName, String option, String questionKey) {
- return questionKey + KEY_SEP + groupName + KEY_SEP + option;
- }
-
- private static int parseCount(String s) {
- if (StringUtils.isEmpty(s)) {
- return 0;
- }
- try {
- return Integer.parseInt(s.trim());
- } catch (NumberFormatException e) {
- return 0;
- }
- }
+ // ---------------------------------------------------------------------
+ // 璇存槑锛氬師绉佹湁 getWXCode / encode 宸查殢鍙戦�佹柟涓�璧锋敹鍙e埌 ruoyi-message 妯″潡
+ // 锛圶inHuaMpApi锛夛紝姝ゅ宸插垹闄わ紝閬垮厤涓変唤鎷疯礉鍚勫啓涓�濂楃鍚嶉�昏緫銆�
+ // ---------------------------------------------------------------------
}
--
Gitblit v1.9.3