| ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-admin/src/main/resources/application-ls.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-common/src/main/java/com/ruoyi/common/utils/TemplateUtils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -960,6 +960,13 @@ ryTask.dealSubtaskDeadline(orgid, day); return AjaxResult.success("ãdealSubtaskDeadlineã忥任å¡å·²å¯å¨ï¼å¤©æ°ä¸º" + day + "天ï¼è¯·ç¨åæ¥çç»æ"); } @PostMapping("/sendExceptInfo") public AjaxResult sendExceptInfo() throws Exception { ryTask.sendExceptInfo(); return AjaxResult.success("sendExceptInfo"); } /** * 带Redisç¼åçç»è®¡æ¥è¯¢ï¼ä¾patItemåpatItemCountå ±ç¨ï¼æ¡ä»¶ä¸åæ¶ç´æ¥å½ä¸ç¼å */ ruoyi-admin/src/main/resources/application-ls.yml
@@ -257,7 +257,9 @@ isEncryp: 0 #æä»¶ä¸ä¼ å°å fileUpload: https://9.208.2.190:8092 #fileUpload: https://9.208.2.190:8092 #profile: /profile-api fileUpload: https://221.12.19.26:8093 profile: /profile-api # 项ç®ç¸å ³é ç½® 丽水 ruoyi-common/src/main/java/com/ruoyi/common/utils/TemplateUtils.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,104 @@ package com.ruoyi.common.utils; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.regex.Matcher; import java.util.regex.Pattern; public class TemplateUtils { private static final Pattern PATTERN = Pattern.compile("\\$\\{([^}]+)\\}"); private static final ObjectMapper OM = new ObjectMapper(); public static String render(String template, Object bean) { if (template == null || bean == null) { return template; } Matcher matcher = PATTERN.matcher(template); StringBuffer sb = new StringBuffer(); while (matcher.find()) { String exp = matcher.group(1); Object val = getValueByExp(bean, exp); String strVal = val == null ? "" : val.toString(); matcher.appendReplacement(sb, Matcher.quoteReplacement(strVal)); } matcher.appendTail(sb); return sb.toString(); } private static Object getValueByExp(Object root, String exp) { try { Object curr = root; if (exp.contains("#json.")) { String[] parts = exp.split("#json\\.", 2); String beanField = parts[0]; String jsonPath = parts[1]; Object jsonStrObj = getBeanField(curr, beanField); // ========== Java8 å ¼å®¹ä¿®æ¹ç¹ ========== if (!(jsonStrObj instanceof String)) { return null; } String jsonStr = (String) jsonStrObj; if (jsonStr.trim().isEmpty()) { return null; } JsonNode node = OM.readTree(jsonStr); return getJsonNode(node, jsonPath); } String[] props = exp.split("\\."); for (String p : props) { curr = getBeanField(curr, p); if (curr == null) { break; } } return curr; } catch (Exception e) { return null; } } private static Object getBeanField(Object bean, String fieldName) throws IntrospectionException, InvocationTargetException, IllegalAccessException { if (bean == null) { return null; } PropertyDescriptor pd = new PropertyDescriptor(fieldName, bean.getClass()); Method getter = pd.getReadMethod(); return getter.invoke(bean); } private static Object getJsonNode(JsonNode node, String path) { String[] arr = path.split("\\."); JsonNode curr = node; for (String k : arr) { curr = curr.get(k); if (curr == null) { return null; } } return curr.isValueNode() ? curr.asText() : curr.toString(); } // æµè¯ public static void main(String[] args) { class User { private String name = "å¼ ä¸"; private Integer age = 25; private String ext = "{\"phone\":\"13800138000\",\"addr\":{\"city\":\"æå·\"}}"; public String getName() { return name; } public Integer getAge() { return age; } public String getExt() { return ext; } } User u = new User(); String tpl = "å§å:${name},å¹´é¾:${age},ææºå·:${ext#json.phone},åå¸:${ext#json.addr.city}"; System.out.println(render(tpl, u)); } } ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -8,6 +8,7 @@ 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; @@ -23,6 +24,7 @@ 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; @@ -108,6 +110,9 @@ @Autowired private IDingTalkService dingTalkService; @Autowired private ISysUserService userService; @Value("${localIP}") @@ -283,31 +288,67 @@ subtaskDetailTraceVO.setHandleFlag("0"); List<ServiceSubtaskDetailTrace> serviceSubtaskDetailTraces = serviceSubtaskDetailTraceService.selectServiceSubtaskDetailTtraceList(subtaskDetailTraceVO); // æ dutyDeptPersonCode æ´çå° list ä¸ï¼å¦æå¤ä¸ªäººç¨éå·åå²ï¼åå±å¼å¹¶å»éï¼ List<String> dutyDeptPersonCodeList = serviceSubtaskDetailTraces.stream() .map(ServiceSubtaskDetailTrace::getDutyDeptPersonCode) .filter(StringUtils::isNotBlank) .flatMap(code -> Arrays.stream(code.split(","))) .map(String::trim) .filter(StringUtils::isNotBlank).distinct() // å»é .collect(Collectors.toList()); // è·åâå¼å¸¸å 容æé" SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("send.except.content"); String exceptContent = sysConfig.getConfigValue(); // è·åâå 容æéæµè¯äººå·¥å·â String testPerson = sysConfigMapper.checkConfigKeyUnique("send.test.person").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 = Arrays.asList(split); else dutyDeptPersonCodeList.addAll(Arrays.asList(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("ãsendExceptInfoãåé人工å·ï¼{}", dutyDeptPersonCode); String dutyDeptPerson = dingTalkService.getDingTalkUserByMobile(dutyDeptPersonCode); dingTalkService.sendDingTalkText(exceptContent, dutyDeptPerson); SysUser sysUser = new SysUser(); SysUser sysUserVo = new SysUser(); sysUserVo.setUserCode(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); } } } } } } smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -260,6 +260,7 @@ pmks.setDeptcheckFlag("0"); pmks.setInhospstate("1"); pmks.setFuflag("1"); pmks.setPatid(16685L); List<PatMedInhosp> patMedInhosps = patMedInhospMapper.selectPatMedInhospList(pmks); //1.å ¥é¢å®£æ