From 717abbe819892d3cded73b12772b216b48d7e357 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 29 七月 2026 14:55:14 +0800
Subject: [PATCH] 【丽水】宣教超链接跳转调整
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 104 ++++++++++++++++++++++++++++++++++------------------
1 files changed, 68 insertions(+), 36 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 1201841..dffe37f 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -13,9 +13,11 @@
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.core.service.IConfigService;
+import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.system.service.ISysConfigService;
import com.smartor.common.DeepSeekApi;
import com.smartor.common.FtpService;
import com.smartor.common.MtSubmitSmUtil;
@@ -146,6 +148,9 @@
@Value("${ASRCallBackPath}")
private String ASRCallBackPath;
+
+ @Autowired
+ private ISysConfigService configService;
@Autowired
private MtSubmitSmUtil mtSubmitSmUtil;
@@ -1734,21 +1739,21 @@
if (ivrTaskTemplateScriptVO.getScriptType().equals("1")) {
//鐢ㄦ潵鏍囪锛屾槸鍚︽湁鍖归厤涓婄殑
Integer flag = 0;
-// //2-AI璇嗗埆
-// SysConfig configVoiceMatchType = new SysConfig();
-// configVoiceMatchType.setOrgid(phoneCallReqYQVO.getOrgid());
-// configVoiceMatchType.setConfigKey("sys.voice.match.type");
-// SysConfig matchType = sysConfigMapper.selectConfig(configVoiceMatchType);
-//
-// if (ObjectUtils.isNotEmpty(matchType) && StringUtils.isNotEmpty(matchType.getConfigValue())
-// && matchType.getConfigValue().equals("2")) {
-// PhoneCallBackYQVO aiMatchResult = AiMatch(phoneCallReqYQVO, phoneCallBackYQVO,
-// ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate,
-// ivrTaskTemplateScripts, scriptId, flag);
-// if(aiMatchResult != null){
-// return aiMatchResult;
-// }
-// } else {
+ //1-AI璇嗗埆
+ SysConfig configVoiceMatchAi = new SysConfig();
+ configVoiceMatchAi.setOrgid(phoneCallReqYQVO.getOrgid());
+ configVoiceMatchAi.setConfigKey("sys.voice.match.ai");
+ SysConfig matchAi = sysConfigMapper.selectConfig(configVoiceMatchAi);
+
+ if (ObjectUtils.isNotEmpty(matchAi) && StringUtils.isNotEmpty(matchAi.getConfigValue())
+ && matchAi.getConfigValue().equals("1")) {
+ PhoneCallBackYQVO aiMatchResult = AiMatch(phoneCallReqYQVO, phoneCallBackYQVO,
+ ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate,
+ ivrTaskTemplateScripts, scriptId, flag, phoneCallReqYQVO.getUuid());
+ if(aiMatchResult != null){
+ return aiMatchResult;
+ }
+ } else {
//鏄�夋嫨棰�
for (int j = 0; j < ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size(); j++) {
log.error("phoneCallReqYQVO.getAsrtext()鐨勫�间负锛歿}", phoneCallReqYQVO.getAsrtext());
@@ -1990,7 +1995,7 @@
continue;
}
}
-// }
+ }
//閮芥病鏈夊尮閰嶅埌
if (StringUtils.isEmpty(phoneCallBackYQVO.getValue())) {
log.info("閮芥病鏈夊尮閰嶅埌-------------------------");
@@ -2612,16 +2617,21 @@
@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 groupKey = "drcode";
+ String drcode = "drcode";
+ //缂欎簯浜烘皯 鏍规嵁缁忕鍖荤敓鍒嗙粍
+ if(serviceSubtaskCountReq.getOrgid().equals("47246116333112211A1001")){
+ drcode = "management_doctor_code";
+ }
+ String groupKey = drcode;
if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 1) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKey = "drcode";
+ groupKey = drcode;
} else {
groupKey = "leavehospitaldistrictcode";
}
} else if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 2) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKey = "drcode";
+ groupKey = drcode;
} else {
groupKey = "deptcode";
}
@@ -2634,11 +2644,14 @@
serviceSubtaskCountReq.setGroupKeyList(groupKeyList);
List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
switch (groupKey) {
- case "deptcode":
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
- break;
case "drcode":
collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ break;
+ case "management_doctor_code":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getManagementDoctorCode()).orElse("Unknown")));
+ break;
+ case "deptcode":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
break;
case "leavehospitaldistrictcode":
collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictcode()).orElse("Unknown")));
@@ -4976,34 +4989,46 @@
* @param options
* @return
*/
- public String matchOptionIndex(String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options) {
+ public Integer matchOptionIndex(String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options, String uuid){
JSONObject jsonObject = new JSONObject();
jsonObject.put("userQuestion",questionText);
jsonObject.put("userAnswer",voiceText);
jsonObject.put("options", options);
+ jsonObject.put("uuid", uuid);
String jsonString = jsonObject.toJSONString();
String result = null;
- try {
- result = OkHttpExample.post("http://localhost:8099/matchOptionIndex", jsonString);
- } catch (IOException e) {
- throw new RuntimeException(e);
+
+ String url = "http://localhost:8099/matchOptionIndex";
+// String url = configService.selectConfigByKey("sys.voice.match.ai.url");
+ if(StringUtils.isNotEmpty(url)){
+ try {
+ Map<String, String> headers = new HashMap<>();
+ headers.put("Content-Type", "application/json");
+
+ result = HttpUtils.sendPostByHeader(url, jsonString, headers);
+ } catch (Exception e) {
+ log.error("AI璇嗗埆澶辫触", e);
+ }
}
- return result;
+ if(StringUtils.isNotEmpty(result) && result.matches("^-?\\d+$")){
+ return Integer.parseInt(result);
+ }else {
+ return -1;
+ }
}
public PhoneCallBackYQVO AiMatch(PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO,
IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate,
- List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag){
+ List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag, String uuid){
PhoneCallBackYQVO back = null;
- String result = "0";
List<IvrTaskTemplateTargetoption> options = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
String voiceText = phoneCallReqYQVO.getAsrtext();
String questionText = StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrtext()) ? ivrTaskTemplateScriptVO.getIvrtext() : ivrTaskTemplateScriptVO.getScriptContent();
- result = matchOptionIndex(questionText, voiceText, options);
- Integer matched = Integer.valueOf(result);
- IvrTaskTemplateTargetoption chosenOption = options.get(matched);
+ Integer matched = -1;
+ matched = matchOptionIndex(questionText, voiceText, options, uuid);
//璇存槑鍖归厤姝g‘浜�
- if(matched != null && matched != 0){
+ if(matched != null && matched >= 0){
+ IvrTaskTemplateTargetoption chosenOption = options.get(matched);
//杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
log.info("鍖归厤姝g‘浜嗗悧--------------");
chosenOption.setIsUserOperation(1);
@@ -5225,7 +5250,7 @@
public void TestMatch(){
String questionText = "鎮ㄥソ,璇烽棶鎮ㄦ槸鎮h�呮湰浜鸿繕鏄灞烇紵\n";
String voiceText = "鎴戣嚜宸�";
- Long scriptid = 31231L;
+ String matchedText = "";
List<IvrTaskTemplateTargetoption> options = new ArrayList<>();
IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption1 = new IvrTaskTemplateTargetoption();
ivrTaskTemplateTargetoption1.setTargetvalue("鏈汉");
@@ -5236,6 +5261,13 @@
IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption3 = new IvrTaskTemplateTargetoption();
ivrTaskTemplateTargetoption3.setTargetvalue("鍏朵粬");
options.add(ivrTaskTemplateTargetoption3);
- matchOptionIndex(questionText,voiceText,options);
+
+ Integer matched = matchOptionIndex(questionText,voiceText,options,"1");
+ if(ObjectUtils.isNotEmpty(matched)){
+ if(matched >= 0){
+ matchedText = options.get(matched).getTargetvalue();
+ }
+ }
+ log.info("ai鍖归厤鎴愬姛锛屽尮閰嶇粨鏋滄槸:" + matchedText);
}
}
--
Gitblit v1.9.3