From 56e6e579618a13221e56cd49e72c9ac0904da95c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 06 十一月 2025 14:01:56 +0800
Subject: [PATCH] 代码提交
---
smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java | 90 +++++++++++++++++++++++---------------------
1 files changed, 47 insertions(+), 43 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
index 838b0c0..4d71e2e 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
@@ -52,7 +52,7 @@
private IvrLibaTemplateScriptMapper ivrLibaTemplateScriptMapper;
@Autowired
- private SvyTaskTemplateScriptMapper svyTaskTemplateScriptMapper;
+ private SvyLibTemplateScriptMapper svyLibTemplateScriptMapper;
@Autowired
private PatArchiveMapper patArchiveMapper;
@@ -65,7 +65,7 @@
private PatReservationRecordMapper patReservationRecordMapper;
@Autowired
- private SvyTaskTemplateTargetoptionMapper svyTaskTemplateTargetoptionMapper;
+ private SvyLibTemplateTargetoptionMapper svyLibTemplateTargetoptionMapper;
@Autowired
private RedisCache redisCache;
@@ -177,7 +177,7 @@
serviceSubtask.setDelFlag("1");
Boolean aBoolean = serviceSubtaskMapper.updateServiceSubtaskByPatId(serviceSubtask);
-
+ log.error("sfSend闇�瑕佺Щ闄ょ殑缁撴灉涓猴細{}", aBoolean);
//鍏宠仈琛ㄥ垹闄�
ServiceTaskdept serviceTaskdept = new ServiceTaskdept();
serviceTaskdept.setTaskId(taskid);
@@ -211,7 +211,7 @@
info = wjInfo(serviceTask, patid, isFinish);
} else {
//瀹f暀
- info = xjInfo(Long.valueOf(serviceTask.getLibtemplateid()), taskid, patid, isFinish);
+ info = xjInfo(Long.valueOf(serviceTask.getTemplateid()), taskid, patid, isFinish);
}
SvyTaskTemplate svyTaskTemplate = svyTaskTemplateMapper.selectSvyTaskTemplateBySvyid(serviceTask.getTemplateid());
@@ -309,55 +309,57 @@
}
}
- // 閫氳繃妯℃澘ID鑾峰彇闂淇℃伅
- SvyTaskTemplateScript svyTaskTemplateScript = new SvyTaskTemplateScript();
- svyTaskTemplateScript.setTemplateID(Long.valueOf(serviceTask.getTemplateid()));
- svyTaskTemplateScript.setDelFlag("0");
- List<SvyTaskTemplateScript> svyTaskTemplateScripts = svyTaskTemplateScriptMapper.selectSvyTaskTemplateScriptList(svyTaskTemplateScript);
- if (CollectionUtils.isEmpty(svyTaskTemplateScripts)) {
- log.warn("svyTaskTemplateScripts涓虹┖锛岃灏藉揩鑱旂郴绠$悊鍛樺鐞�");
- return Collections.emptyList();
+ //閫氳繃妯℃澘ID鑾峰彇闂淇℃伅
+ SvyLibTemplateScript svyLibTemplateScript = new SvyLibTemplateScript();
+ svyLibTemplateScript.setSvyid(Long.valueOf(serviceTask.getLibtemplateid()));
+ svyLibTemplateScript.setDelFlag("0");
+ List<SvyLibTemplateScript> svyLibTemplateScripts = svyLibTemplateScriptMapper.selectSvyLibTemplateScriptList(svyLibTemplateScript);
+ if (CollectionUtils.isEmpty(svyLibTemplateScripts) || svyLibTemplateScripts.size() == 0) {
+ log.info("ivrLibaTemplateScripts涓虹┖浜嗭紝璇峰敖蹇仈绯荤鐞嗗憳澶勭悊");
+ return new ArrayList<>();
}
- List<SvyTaskTemplateScriptVO> svyTaskTemplateScriptVOS = DtoConversionUtils.sourceToTarget(svyTaskTemplateScripts, SvyTaskTemplateScriptVO.class);
+ List<SvyLibTemplateScriptVO> svyLibTemplateScriptVOS = DtoConversionUtils.sourceToTarget(svyLibTemplateScripts, SvyLibTemplateScriptVO.class);
- // 鑾峰彇鎮h�呬俊鎭�
+ //鑾峰彇鎮h�呬俊鎭�
PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patid);
- // 瑙f瀽textParam
- Map<String, Map<String, String>> ivrTaskMap = Collections.emptyMap();
+ //閫氳繃鎮h�呬俊鎭拰浠诲姟淇℃伅涓殑textParam瀵归棶棰樹腑鐨勫彉閲忚繘琛屽~鍏�
+ ObjectMapper objectMapper = new ObjectMapper();
+ Map<String, Map<String, String>> ivrTaskMap = null;
try {
- ObjectMapper objectMapper = new ObjectMapper();
ivrTaskMap = objectMapper.readValue(serviceTask.getTextParam(), Map.class);
- } catch (Exception e) {
- log.error("瑙f瀽textParam澶辫触", e);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
}
- List<Map<String, String>> mapList = new ArrayList<>(ivrTaskMap.values());
+ List<Map<String, String>> mapList = new ArrayList<>();
- // 鏇挎崲妯℃澘闂璇濇湳閲岀殑閫氶厤绗�
- for (SvyTaskTemplateScriptVO scriptVO : svyTaskTemplateScriptVOS) {
- String content = scriptVO.getScriptContent();
- if (StringUtils.isNotEmpty(content)) {
- // 鏇挎崲鍙橀噺
+ for (Map<String, String> map : ivrTaskMap.values()) {
+ mapList.add(map);
+ }
+
+ //灏嗘ā鏉块棶棰樿瘽鏈噷鐨勯�氶厤绗︽浛鎹�
+ for (SvyLibTemplateScriptVO svyLibTemplateScriptVO : svyLibTemplateScriptVOS) {
+ if (StringUtils.isNotEmpty(svyLibTemplateScriptVO.getScriptContent())) {
for (Map<String, String> map : mapList) {
- for (Map.Entry<String, String> entry : map.entrySet()) {
- String key = entry.getKey();
- String value = StringUtils.defaultString(entry.getValue());
- content = content.replace(key, value);
+ for (String key : map.keySet()) {
+
+ svyLibTemplateScriptVO.setScriptContent(svyLibTemplateScriptVO.getScriptContent().replace(key, StringUtils.isNotEmpty(map.get(key)) ? map.get(key) : ""));
}
}
- // 鏇挎崲鎮h�呬釜浜轰俊鎭�
- content = content.replace("${name}", StringUtils.defaultString(patArchive.getName()))
- .replace("${dzz}", StringUtils.defaultString(patArchive.getPlaceOfResidence()))
- .replace("${dhh}", StringUtils.defaultString(patArchive.getTelcode()));
- scriptVO.setScriptContent(content);
-
- // 鑾峰彇闂閫夐」
- SvyTaskTemplateTargetoption optionQuery = new SvyTaskTemplateTargetoption();
- optionQuery.setScriptid(scriptVO.getId());
- List<SvyTaskTemplateTargetoption> options = svyTaskTemplateTargetoptionMapper.selectSvyTaskTemplateTargetoptionList(optionQuery);
+ //鏇挎崲鎮h�呬釜浜轰俊鎭暟鎹�
+ log.error("闂id锛歿}, 闂鍐呭锛歿}", svyLibTemplateScriptVO.getId(), svyLibTemplateScriptVO.getScriptContent());
+ if (StringUtils.isNotEmpty(svyLibTemplateScriptVO.getScriptContent())) {
+ svyLibTemplateScriptVO.setScriptContent(svyLibTemplateScriptVO.getScriptContent().replace("${name}", StringUtils.isNotEmpty(patArchive.getName()) ? patArchive.getName() : ""));
+ svyLibTemplateScriptVO.setScriptContent(svyLibTemplateScriptVO.getScriptContent().replace("${dzz}", StringUtils.isNotEmpty(patArchive.getPlaceOfResidence()) ? patArchive.getPlaceOfResidence() : ""));
+ svyLibTemplateScriptVO.setScriptContent(svyLibTemplateScriptVO.getScriptContent().replace("${dhh}", StringUtils.isNotEmpty(patArchive.getTelcode()) ? patArchive.getTelcode() : ""));
+ }
+ //鑾峰彇闂閫夐」
+ SvyLibTemplateTargetoption svyLibTemplateTargetoption = new SvyLibTemplateTargetoption();
+ svyLibTemplateTargetoption.setScriptid(svyLibTemplateScriptVO.getId());
+ List<SvyLibTemplateTargetoption> svyLibTemplateTargetoptions = svyLibTemplateTargetoptionMapper.selectSvyLibTemplateTargetoptionList(svyLibTemplateTargetoption);
// 鍒ゆ柇棰勭害浜烘暟
- for (SvyTaskTemplateTargetoption stt : options) {
+ for (SvyLibTemplateTargetoption stt : svyLibTemplateTargetoptions) {
Boolean full = patReservationRecordMapper.existsEqualNum(stt.getId());
if (Boolean.TRUE.equals(full)) {
stt.setPerson(-1L);
@@ -368,11 +370,13 @@
stt.setJmid(id);
stt.setId(null);
}
- scriptVO.setSvyTaskTemplateTargetoptions(options);
+ svyLibTemplateScriptVO.setSvyLibTemplateTargetoptions(svyLibTemplateTargetoptions);
}
+ //杩欎笢瑗垮湪鏃犻敗 锛屼細浣胯姹備笉鍒板悗绔�
+ svyLibTemplateScriptVO.setOtherdata(null);
}
- svyTaskTemplateScriptVOS.sort(Comparator.comparingLong(SvyTaskTemplateScriptVO::getSort));
- return svyTaskTemplateScriptVOS;
+ svyLibTemplateScriptVOS.sort(Comparator.comparingLong(SvyLibTemplateScriptVO::getSort));
+ return svyLibTemplateScriptVOS;
}
private List xjInfo(Long templateId, Long taskid, Long patid, Boolean isFinish) {
--
Gitblit v1.9.3