From 88d4cd31fa5b197a91ed081ba1df292420af2d05 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 22 十月 2026 16:48:52 +0800
Subject: [PATCH] 【丽水】随访统计增加一列,及时随访,统计未超时且已完成的随访人次
---
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java | 286 +++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 208 insertions(+), 78 deletions(-)
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
index 2f047a7..cfe92f6 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -8,20 +8,23 @@
import com.google.gson.Gson;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.core.service.IDingTalkService;
import com.ruoyi.common.dx.MessageSend;
import com.ruoyi.common.enums.MsgLSEnum;
import com.ruoyi.common.enums.ServiceFromEnum;
import com.ruoyi.common.enums.WxGZHEnum;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.http.HttpUtils;
-import com.ruoyi.common.utils.sms.smsUtils;
+import com.ruoyi.common.utils.sms.SmsUtils;
import com.ruoyi.quartz.service.ICollectHISService;
import com.ruoyi.quartz.util.CreateDataTable;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysDeptService;
+import com.ruoyi.system.service.ISysUserService;
import com.smartor.common.LSHospTokenUtil;
import com.smartor.common.MtSubmitSmUtil;
import com.smartor.common.QwenLLMUtil;
@@ -104,6 +107,12 @@
@Autowired
private ISysConfigService configService;
+
+ @Autowired
+ private IDingTalkService dingTalkService;
+
+ @Autowired
+ private ISysUserService userService;
@Value("${localIP}")
@@ -266,6 +275,80 @@
for (String dutyDeptPersonCode : dutyDeptPersonCodeList) {
log.info("銆恠endSLTDMYDExceptInfo銆戝彂閫佷汉宸ュ彿锛歿}", dutyDeptPersonCode);
String data = MessageSend.sendMsg(exceptContent, "7", dutyDeptPersonCode, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
+ }
+ }
+ }
+
+ /**
+ * 瀹氭椂鍙戦�佸紓甯镐俊鎭�-鏅畞
+ */
+ public void sendExceptInfo() throws Exception {
+ //1.鑾峰彇鍙戦�佷汉宸ュ彿
+ ServiceSubtaskDetailTraceVO subtaskDetailTraceVO = new ServiceSubtaskDetailTraceVO();
+ subtaskDetailTraceVO.setHandleFlag("0");
+ List<ServiceSubtaskDetailTrace> serviceSubtaskDetailTraces =
+ serviceSubtaskDetailTraceService.selectServiceSubtaskDetailTtraceList(subtaskDetailTraceVO);
+ // 鑾峰彇鈥滃紓甯稿唴瀹规彁閱�"
+ SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("send.except.content");
+ String exceptContent = sysConfig.getConfigValue();
+
+ // 鑾峰彇鈥滃唴瀹规彁閱掓祴璇曚汉宸ュ彿鈥�
+ SysConfig testPersonConfig = sysConfigMapper.checkConfigKeyUnique("send.test.person");
+ String testPerson = ObjectUtils.isNotEmpty(testPersonConfig) ? testPersonConfig.getConfigValue() : "";
+ if(CollectionUtils.isNotEmpty(serviceSubtaskDetailTraces)){
+ for (ServiceSubtaskDetailTrace serviceSubtaskDetailTrace : serviceSubtaskDetailTraces) {
+ List<String> dutyDeptPersonCodeList = new ArrayList<>();
+ // 鎶� dutyDeptPersonCode 鏁寸悊鍒� list 涓紙濡傛灉澶氫釜浜虹敤閫楀彿鍒嗗壊锛屽垯灞曞紑骞跺幓閲嶏級
+ String dutyDeptPersonCodeStr = serviceSubtaskDetailTrace.getDutyDeptPersonCode();
+ if(StringUtils.isNotEmpty(dutyDeptPersonCodeStr)){
+ String[] dutyDeptPersonCodeSplit = dutyDeptPersonCodeStr.split(",");
+ if (CollectionUtils.isEmpty(dutyDeptPersonCodeList)) {
+ dutyDeptPersonCodeList = new ArrayList<>(Arrays.asList(dutyDeptPersonCodeSplit));
+ } else {
+ dutyDeptPersonCodeList.addAll(Arrays.asList(dutyDeptPersonCodeSplit));
+ }
+
+ }
+
+ if (StringUtils.isNotBlank(testPerson)) {
+ String[] split = testPerson.split(",");
+ if (CollectionUtils.isEmpty(dutyDeptPersonCodeList)) {
+ dutyDeptPersonCodeList = new ArrayList<>(Arrays.asList(split));
+ } else {
+ dutyDeptPersonCodeList.addAll(Arrays.asList(split));
+ }
+ }
+
+ if (CollectionUtils.isNotEmpty(dutyDeptPersonCodeList)) {
+ for (String dutyDeptPersonCode : dutyDeptPersonCodeList) {
+ log.info("銆恠endExceptInfo銆戝彂閫佷汉宸ュ彿锛歿}", dutyDeptPersonCode);
+ SysUser sysUser = new SysUser();
+ SysUser sysUserVo = new SysUser();
+ sysUserVo.setUserName(dutyDeptPersonCode);
+ sysUserVo.setOrgid(serviceSubtaskDetailTrace.getOrgid());
+ List<SysUser> users = userService.getUserList(sysUserVo);
+ String phoneNumber = "";
+ if(ObjectUtils.isNotEmpty(users)){
+ sysUser = users.get(0);
+ phoneNumber = sysUser.getPhonenumber();
+ }else {
+ continue;
+ }
+
+ if(StringUtils.isEmpty(phoneNumber)){
+ continue;
+ }
+ String dutyDeptPerson = dingTalkService.getDingTalkUserByMobile(phoneNumber);
+ if(StringUtils.isNotBlank(dutyDeptPerson)){
+ String context = TemplateUtils.render(exceptContent, serviceSubtaskDetailTrace);
+ dingTalkService.sendDingTalkText(context, dutyDeptPerson);
+ //鏇存柊鐘舵��
+ serviceSubtaskDetailTrace.setHandleFlag("1");
+ serviceSubtaskDetailTrace.setUpdateTime(new Date());
+ serviceSubtaskDetailTraceService.updateServiceSubtaskDetailTtrace(serviceSubtaskDetailTrace);
+ }
+ }
+ }
}
}
}
@@ -840,6 +923,13 @@
serviceSubtaskList.addAll(compensateServiceSubtaskList);
}
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
+ //currentPreachform涓虹┖锛岃鏄庤瀛愪换鍔¤繕娌℃湁鎵ц杩囦换浣曚竴绉嶅彂閫佹柟寮�(sendstate=1锛屽睘浜庨娆¤ˉ鍋�)锛�
+ //杩欓噷鐩存帴浜ょ粰sfHandlle澶勭悊锛屽畠浼氭寜sort=1鐨勭涓�绉嶅彂閫佹柟寮忓彂閫侊紝涓巊etSendPreachform涓殑澶勭悊淇濇寔涓�鑷�
+ if (StringUtils.isEmpty(serviceSubtask.getCurrentPreachform())) {
+ log.warn("銆恈ompensateTask銆憇ubid锛歿}锛宑urrentPreachform涓虹┖锛屾寜绗竴绉嶅彂閫佹柟寮忚ˉ鍋垮鐞�", serviceSubtask.getId());
+ sfHandlle(serviceSubtask);
+ continue;
+ }
//鏍规嵁褰撳墠鐨勬墽琛屾柟寮忥紝鑾峰彇涓嬩竴绉嶆墽琛屾柟寮�
ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform();
serviceSubtaskPreachform.setTaskid(serviceSubtask.getTaskid());
@@ -910,6 +1000,24 @@
LocalDate today = LocalDate.now();
// 濡傛灉鏃ユ湡鏃╀簬鎴栫瓑浜庝粖澶╋紝杩斿洖 true
return !localDate.isAfter(today);
+ }
+
+ /**
+ * 鎸夋満鏋勬煡璇㈤厤缃�硷紙鍚屼竴 key 鍦ㄤ笉鍚屾満鏋勪笅鍙厤缃笉鍚屽�硷級
+ *
+ * @param configKey 閰嶇疆key
+ * @param orgid 鏈烘瀯ID
+ * @return 閰嶇疆鍊硷紝鏈厤缃繑鍥� null
+ */
+ private String getConfigValue(String configKey, String orgid) {
+ SysConfig query = new SysConfig();
+ query.setConfigKey(configKey);
+ query.setOrgid(orgid);
+ List<SysConfig> sysConfigs = configService.selectConfigList(query);
+ if (CollectionUtils.isNotEmpty(sysConfigs)) {
+ return sysConfigs.get(0).getConfigValue();
+ }
+ return null;
}
/**
@@ -1027,18 +1135,17 @@
serviceOutPath.setCreateTime(new Date());
serviceOutPath.setOrgid(serviceSubtask.getOrgid());
iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+ String url = "";
String format = String.format("%03X", serviceOutPath.getId());
- serviceOutPath.setRadix(format);
- serviceOutPath.setUpdateTime(new Date());
- iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//鍏堝垽鏂竴涓嬪彂鐨勬槸涓嶆槸瀹f暀
if (!"3".equals(serviceSubtask.getType())) {
sendMagParam.setPhone(serviceSubtask.getPhone());
-
- sendMagParam.setUrl(StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/wt?p=" + format : localIP + "/wt?p=" + format);
+ url = StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/wt?p=" + format : localIP + "/wt?p=" + format;
+ sendMagParam.setUrl(url);
//濡傛灉type鏄闊抽殢璁跨殑璇濓紙璇存槑琛ュ伩鍙戦�佹柟寮忎腑鏈夌數璇濋殢璁跨殑鏂瑰紡锛岃繖閲岀殑澶栭摼灏卞湴鍧�鍙兘鐢�/sf锛�
if (serviceSubtask.getType().equals("1"))
- sendMagParam.setUrl(StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/sf?p=" + format : localIP + "/sf?p=" + format);
+ url = StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/sf?p=" + format : localIP + "/sf?p=" + format;
+ sendMagParam.setUrl(url);
// SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("wj.sms.template");
SysConfig sysConfig = new SysConfig();
@@ -1049,7 +1156,7 @@
} else {
sysConfig = sysConfigMapper.checkConfigKeyUnique("wj.sms.template");
}
- if (!Objects.isNull(sysConfig)) {
+ if (!Objects.isNull(sysConfig) && StringUtils.isNotEmpty(sysConfig.getConfigValue())) {
String smsContemt = sysConfig.getConfigValue();
// sendMagParam.setContent("鎮ㄥソ锛岄個璇锋偍濉啓鍑洪櫌璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "濉啓銆傛劅璋㈡偍閰嶅悎锛�");
sendMagParam.setContent(smsContemt.replace("${wjurl}", sendMagParam.getUrl()));
@@ -1058,10 +1165,12 @@
HeLibrary heLibrary = heLibraryMapper.selectHeLibraryById(serviceSubtask.getLibtemplateid());
if (heLibrary.getHetype().equals("1")) {
sendMagParam.setPhone(serviceSubtask.getPhone());
- sendMagParam.setUrl(StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/xj?p=" + format : localIP + "/xj?p=" + format);
+ url = StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/xj?p=" + format : localIP + "/xj?p=" + format;
+
+ sendMagParam.setUrl(url);
SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("xj.sms.template");
- if (!Objects.isNull(sysConfig)) {
+ if (!Objects.isNull(sysConfig) && StringUtils.isNotEmpty(sysConfig.getConfigValue())) {
String smsContemt = sysConfig.getConfigValue();
// sendMagParam.setContent("鎮ㄥソ锛岄個璇锋偍濉啓鍑洪櫌瀹f暀璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "鏌ョ湅銆傛劅璋㈡偍閰嶅悎锛�");
sendMagParam.setContent(smsContemt.replace("${xjurl}", sendMagParam.getUrl()));
@@ -1076,6 +1185,18 @@
}
}
+
+ //鍐呭涓虹┖璇存槑鐭俊妯℃澘鏈厤缃垨瀹f暀/閫氱煡鍐呭涓虹┖锛岀洿鎺ユ寜鍙戦�佸け璐ュ鐞嗭紝閬垮厤鍚庣画鍙戦�佹椂鍑虹幇绌烘寚閽�
+ if (StringUtils.isEmpty(sendMagParam.getContent())) {
+ log.error("銆恠fHandlle銆戦暱鏈熶换鍔$煭淇″唴瀹逛负绌猴紝鏃犳硶鍙戦�侊紝subid锛歿}锛宼askid锛歿}锛宼ype锛歿}锛屾満鏋処D锛歿}", serviceSubtask.getId(), serviceSubtask.getTaskid(), serviceSubtask.getType(), serviceSubtask.getOrgid());
+ setSuccessPreachForm(serviceSubtask, sendPreachform, "闀挎湡浠诲姟鐭俊鍙戦�佸け璐�:鐭俊鍐呭涓虹┖(鐭俊妯℃澘鏈厤缃垨鍐呭涓虹┖), 鏃堕棿: " + now, "5");
+ return;
+ }
+
+ serviceOutPath.setRadix(format);
+ serviceOutPath.setUpdateTime(new Date());
+ serviceOutPath.setUrl(url);
+ iServiceOutPathService.updateServiceOutPath(serviceOutPath);
String isSuccess = null;
log.info("active鐨勫�间负锛歿}", active);
if (active.equals("xh")) {
@@ -1107,33 +1228,48 @@
// String url = configService.selectConfigByKey("token.360", serviceSubtask.getOrgid());
// //涓芥按鐨勭煭淇″彂閫佹柟寮�
// Map<String, String> map = MsgLSEnum.getAddressByCode(serviceSubtask.getOrgid());
- SysConfig config = new SysConfig();
- config.setConfigKey("ls.msg.info");
- config.setOrgid(serviceSubtask.getOrgid());
- List<SysConfig> sysConfigs = configService.selectConfigList(config);
- Map<String, String> msgInfo = new HashMap<>();
- if (CollectionUtils.isNotEmpty(sysConfigs)) {
- String configValue = sysConfigs.get(0).getConfigValue();
+ if ("47226079133110211G1001".equals(serviceSubtask.getOrgid())) {
+ // 濡囧辜涓浗绉诲姩浜慚AS锛屼笉渚濊禆 ls.msg.info 涓� token
+ SmsUtils.YunMasConfig yunMasConfig = SmsUtils.YunMasConfig.of(getConfigValue("ls.msg.yunmas", serviceSubtask.getOrgid()));
+ SmsUtils.SmsResult smsResult = SmsUtils.sendYunMasSms(yunMasConfig, sendMagParam.getPhone(), sendMagParam.getContent());
+ log.info("銆恠fHandlle銆戜簯MAS鐭俊鍙戦�佺粨鏋滐細ok={}锛宺spcod={}锛宮sgGroup={}锛宮essage={}",
+ smsResult.isOk(), smsResult.getRspcod(), smsResult.getMsgGroup(), smsResult.getMessage());
+ if (smsResult.isOk()) {
+ isSuccess = "true";
+ } else {
+ log.error("銆恠fHandlle銆戜簯MAS鐭俊鍙戦�佸け璐ワ紝subid锛歿}锛屾墜鏈哄彿锛歿}锛屽師鍥狅細{}",
+ serviceSubtask.getId(), sendMagParam.getPhone(), smsResult.getMessage());
+ }
+ } else {
+ SysConfig config = new SysConfig();
+ config.setConfigKey("ls.msg.info");
+ config.setOrgid(serviceSubtask.getOrgid());
+ List<SysConfig> sysConfigs = configService.selectConfigList(config);
+ Map<String, String> msgInfo = new HashMap<>();
+ if (CollectionUtils.isNotEmpty(sysConfigs)) {
+ String configValue = sysConfigs.get(0).getConfigValue();
+ ObjectMapper objectMapper = new ObjectMapper();
+ if (StringUtils.isNotEmpty(configValue)) {
+ msgInfo = objectMapper.readValue(configValue, Map.class);
+ }
+ }
+ log.info("-----------map鐨勫�间负锛歿}", msgInfo);
+ if (ObjectUtils.isEmpty(msgInfo) || StringUtils.isEmpty(msgInfo.get("address"))) {
+ setSuccessPreachForm(serviceSubtask, sendPreachform, "鐭俊鍙戦�佸け璐�,璇ユ満鏋勬病鏈夐厤缃煭淇″湴鍧�, 鏃堕棿:" + now, "5");
+ return;
+ }
+ String token = LSHospTokenUtil.getToken(serviceSubtask.getOrgid(), msgInfo.get("tokenUrl"));
+ log.info("銆恠fHandlle銆戜附姘寸煭淇″彂閫侊紝鍦板潃锛歿}锛屽弬鏁帮細{}锛屾満鏋処D锛歿}", msgInfo.get("address"), sendMagParam, serviceSubtask.getOrgid());
+ String dxCode = getDXCode(msgInfo.get("address"), sendMagParam.getPhone(), sendMagParam.getContent(), msgInfo.get("sendPersonId"), msgInfo.get("sendPersonName"), MsgLSEnum.getHeaderByCode(msgInfo), token);
+ log.info("銆恠fHandlle銆戜附姘寸煭淇″彂閫佺粨鏋滐細{}", dxCode);
ObjectMapper objectMapper = new ObjectMapper();
- if (StringUtils.isNotEmpty(configValue)) {
- msgInfo = objectMapper.readValue(configValue, Map.class);
+ Map<String, Object> textParam = objectMapper.readValue(dxCode, Map.class);
+ String code = textParam.get("Code").toString();
+ if (code.equals("0")) {
+ isSuccess = "true";
}
}
- log.info("-----------map鐨勫�间负锛歿}", msgInfo);
- String token = LSHospTokenUtil.getToken(serviceSubtask.getOrgid(), msgInfo.get("tokenUrl"));
- if (ObjectUtils.isNotEmpty(msgInfo) && StringUtils.isEmpty(msgInfo.get("address"))) {
- setSuccessPreachForm(serviceSubtask, sendPreachform, "鐭俊鍙戦�佸け璐�,璇ユ満鏋勬病鏈夐厤缃煭淇″湴鍧�, 鏃堕棿:" + now, "5");
- return;
- }
- log.info("銆恠fHandlle銆戜附姘寸煭淇″彂閫侊紝鍦板潃锛歿}锛屽弬鏁帮細{}锛屾満鏋処D锛歿}", msgInfo.get("address"), sendMagParam, serviceSubtask.getOrgid());
- String dxCode = getDXCode(msgInfo.get("address"), sendMagParam.getPhone(), sendMagParam.getContent(), msgInfo.get("sendPersonId"), msgInfo.get("sendPersonName"), MsgLSEnum.getHeaderByCode(msgInfo), token);
- log.info("銆恠fHandlle銆戜附姘寸煭淇″彂閫佺粨鏋滐細{}", dxCode);
- ObjectMapper objectMapper = new ObjectMapper();
- Map<String, Object> textParam = objectMapper.readValue(dxCode, Map.class);
- String code = textParam.get("Code").toString();
- if (code.equals("0")) {
- isSuccess = "true";
- }
+
} else if (active.equals("sltd") || active.equals("nhfy")) {
log.info("sltd杩涙潵浜嗗悧锛焮} ,---sendMagParam.getContent()鐨勫弬鏁颁负锛歿}", active, sendMagParam.getContent());
if (active.equals("sltd")) {
@@ -1181,13 +1317,13 @@
String campusid = ObjectUtils.isNotEmpty(sysDept) ? sysDept.getCampusid() : "2";
//婀栨花鍗曠嫭鍙戦�佹柟寮�
if ("1".equals(campusid)) {
- String result = smsUtils.sendSms1(xhsmsPath, xhsmsAccount, xhsmsPwd, sendMagParam.getPhone(), content);
+ String result = SmsUtils.sendSms1(xhsmsPath, xhsmsAccount, xhsmsPwd, sendMagParam.getPhone(), content);
//杩欓噷闇�瑕佹牴鎹畆esult杩斿洖鐨勫�煎幓鍒ゆ柇锛屾槸鍚︽垚鍔燂紝鐒跺悗灏嗗�艰祴鍊肩粰isSuccess
if (StringUtils.isNotEmpty(result) && result.contains("澶勭悊鎴愬姛")) {
isSuccess = "true";
}
} else {
- String result = smsUtils.sendSms(xhsmsPath, xhsmsAccount, xhsmsPwd, sendMagParam.getPhone(), content);
+ String result = SmsUtils.sendSms(xhsmsPath, xhsmsAccount, xhsmsPwd, sendMagParam.getPhone(), content);
//杩欓噷闇�瑕佹牴鎹畆esult杩斿洖鐨勫�煎幓鍒ゆ柇锛屾槸鍚︽垚鍔燂紝鐒跺悗灏嗗�艰祴鍊肩粰isSuccess
if (StringUtils.isNotEmpty(result) && result.contains("澶勭悊鎴愬姛")) {
isSuccess = "true";
@@ -1249,6 +1385,7 @@
String format = String.format("%03X", serviceOutPath.getId());
serviceOutPath.setRadix(format);
serviceOutPath.setUpdateTime(new Date());
+ serviceOutPath.setUrl(url);
iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//鑾峰彇寰俊鍏紬鍙疯姹備俊鎭牴鎹満鏋処D
@@ -1268,7 +1405,7 @@
//甯備竴鍖婚櫌
if (active.equals("hzszlyy")) {
//澶勭悊涓枃涔辩爜闂
- wxCode = smsUtils.sendChat(url, patArchive.getTelcode(), serviceSubtask.getSfzh());
+ wxCode = SmsUtils.sendChat(url, patArchive.getTelcode(), serviceSubtask.getSfzh());
} else {
wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), patArchive.getTelcode(), serviceSubtask.getSendname(), patArchive.getPatidHis(), wxqqxx);
}
@@ -1658,14 +1795,15 @@
* @return
*/
private String getObject(ServiceSubtask serviceSubtask, String scriptContent) {
+ //鍐呭涓虹┖鏃剁洿鎺ヨ繑鍥烇紝閬垮厤涓嬮潰鐨剅eplace鍑虹幇绌烘寚閽�
+ if (StringUtils.isEmpty(scriptContent)) {
+ return scriptContent;
+ }
Map<String, Map<String, String>> param = getParam(serviceSubtask.getTaskid());
for (Map<String, String> map : param.values()) {
for (String key : map.keySet()) {
scriptContent = scriptContent.replace(key, StringUtils.isNotEmpty(map.get(key)) ? map.get(key) : "");
}
- }
- if (StringUtils.isEmpty(scriptContent)) {
- return scriptContent;
}
scriptContent = scriptContent.replace("${name}", StringUtils.isNotEmpty(serviceSubtask.getSendname()) ? serviceSubtask.getSendname() : "");
scriptContent = scriptContent.replace("${dzz}", StringUtils.isNotEmpty(serviceSubtask.getAddr()) ? serviceSubtask.getAddr() : "");
@@ -1769,7 +1907,16 @@
/**
* 澶勭悊瓒呮椂闅忚浠诲姟
- * @return
+ * <p>
+ * 鎵弿銆屽嚭闄㈡弧 deadlineDay 澶╀粛鏈畬鎴愩�嶇殑棣栨闅忚浠诲姟锛坰endstate=7 + visit_count=1锛夛紝
+ * 鎸夊綋鍓嶄换鍔$殑 nexttaskid 鐢熸垚鍐嶆闅忚浠诲姟骞惰浆鍒伴殢璁夸腑蹇冦��
+ * <p>
+ * 娉ㄦ剰锛氭埅姝㈡椂闂村繀椤诲湪寰幆澶栬绠椾竴娆°�傚巻鍙插疄鐜版妸 {@code deadlineDay = -deadlineDay}
+ * 鍐欏湪寰幆浣撳唴锛屾瘡杞彇鍙嶄竴娆★紝瀵艰嚧鍋舵暟杞敤銆屼粖澶� + deadlineDay銆嶅仛鎴鏃堕棿锛�
+ * 鎶婂嚭闄笉婊� 28 澶╃殑瓒呮椂浠诲姟涔熸壂浜嗚繘鏉ャ��
+ *
+ * @param orgid 鏈烘瀯ID
+ * @param deadlineDay 鍑洪櫌婊″灏戝ぉ绠楄秴鏃讹紙姝f暟锛屽 28锛�
*/
public void dealSubtaskDeadline(String orgid, Integer deadlineDay){
//鑾峰彇浠诲姟淇℃伅
@@ -1779,9 +1926,17 @@
st.setNexttaskflag("1");
st.setOrgid(orgid);
List<ServiceTask> serviceTasks = serviceTaskMapper.selectServiceTaskList(st);
+
+ // 鎴鏃堕棿鍙畻涓�娆★細鍑洪櫌鏃堕棿 <= 浠婂ぉ - deadlineDay
+ int days = Math.abs(ObjectUtils.isEmpty(deadlineDay) ? 28 : deadlineDay);
+ Date deadline = DateUtils.addDays(new Date(), -days);
+ log.info("銆恉ealSubtaskDeadline銆戝紑濮嬫壂鎻�, orgid={}, day={}, deadline={}, 浠诲姟鏁�={}",
+ orgid, days, deadline, serviceTasks.size());
+
for (ServiceTask serviceTask : serviceTasks) {
- deadlineDay = -deadlineDay;
- Date deadline = DateUtils.addDays(new Date(), deadlineDay);
+ if (ObjectUtils.isEmpty(serviceTask.getNexttaskid())) {
+ continue;
+ }
//閫氳繃浠诲姟ID鎷垮埌鎮h�呬俊鎭�,骞朵笖闅忚鏃堕棿寰楁槸浠婂ぉ涔嬪墠鐨�
ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
serviceSubtaskVO.setOrgid(orgid);
@@ -1790,45 +1945,20 @@
serviceSubtaskVO.setVisitCount(1);
serviceSubtaskVO.setTaskid(serviceTask.getTaskid());
serviceSubtaskVO.setEndOutHospTime(deadline);
+
List<ServiceSubtask> serviceSubtaskList
= serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
log.info("銆恉ealSubtaskDeadline銆戣幏鍙栧埌{}涓秴鏃朵换鍔�, taskid={}", serviceSubtaskList.size(), serviceTask.getTaskid());
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
- PatMedInhosp patMedInhospVo = new PatMedInhosp();
- patMedInhospVo.setOrgid(serviceSubtask.getOrgid());
- patMedInhospVo.setInhospid(serviceSubtask.getInhospid());
- List<PatMedInhosp> patMedInhospList = iPatMedInhospService.selectPatMedInhospList(patMedInhospVo);
- PatMedInhosp patMedInhosp = new PatMedInhosp();
- if (!patMedInhospList.isEmpty()) {
- patMedInhosp = patMedInhospList.get(0);
- }else {
- continue;
- }
- if(ObjectUtils.isEmpty(serviceTask.getNexttaskid())){
- continue;
- }
- ServiceTask nextServiceTask = serviceTaskMapper.selectServiceTaskByTaskid(serviceTask.getNexttaskid());
- PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(serviceSubtask.getPatid());
- String config = configService.selectConfigByKey("visit.early.day");
- Integer type = 1;
-
- //鏂板鍐嶆闅忚浠诲姟
- ServiceSubtask serviceSubtaskAgain = iPatMedInhospService.boxedServiceSubtask(nextServiceTask,
- patMedInhosp, patArchive, config, type);
- serviceSubtaskAgain.setId(null);
- serviceSubtaskAgain.setUpid(serviceSubtask.getId().intValue());
- serviceSubtaskAgain.setVisitCount(serviceSubtask.getVisitCount() + 1);
- serviceSubtaskAgain.setSendstate(2L);
- serviceSubtaskAgain.setCreateTime(new Date());
- serviceSubtaskAgain.setUpdateTime(new Date());
- serviceSubtaskAgain.setVisitType(serviceSubtask.getVisitType());
- serviceSubtaskAgain.setVisitDeptCode(serviceSubtask.getVisitDeptCode());
- serviceSubtaskAgain.setVisitDeptName(serviceSubtask.getVisitDeptName());
- int i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtaskAgain);
- if (i == 1) {
- //鍐嶆闅忚浠诲姟鍒涘缓鎴愬姛鍚庯紝鍘熶换鍔℃敼涓哄け璐ョ姸鎬�
- serviceSubtask.setSendstate(5L);
- serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ try {
+ // 鐢熸垚閫昏緫缁熶竴鏀跺彛鍒� service锛氶攣 + 骞傜瓑 + 浜嬪姟 + 鍙戦�佹柟寮忔槑缁嗗垵濮嬪寲
+ String result = iServiceSubtaskService.addSubTaskAgainByDeadline(serviceSubtask);
+ log.info("銆恉ealSubtaskDeadline銆戠敓鎴愬啀娆¢殢璁�, subId={}, taskid={}, 缁撴灉={}",
+ serviceSubtask.getId(), serviceTask.getTaskid(), result);
+ } catch (Exception e) {
+ // 鍗曟潯澶辫触涓嶅奖鍝嶅叾浠栨偅鑰�
+ log.error("銆恉ealSubtaskDeadline銆戠敓鎴愬啀娆¢殢璁垮け璐�, subId=" + serviceSubtask.getId()
+ + ", taskid=" + serviceTask.getTaskid(), e);
}
}
}
--
Gitblit v1.9.3