From 68ff33beff11310e830b0615b5a81f83fad0f683 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期日, 08 十一月 2026 23:33:14 +0800
Subject: [PATCH] ai优化
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigServiceImpl.java | 76 +++++++++++++++++++++++++++++---------
1 files changed, 58 insertions(+), 18 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigServiceImpl.java
index a6d505b..03935f2 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigServiceImpl.java
@@ -2,6 +2,7 @@
import cn.lihu.jh.module.ecg.Utils;
import cn.lihu.jh.module.ecg.config.DynamicSchedulingConfig;
+import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO;
import cn.lihu.jh.module.ecg.dal.mysql.queuesequence.QueueSequenceMapper;
import cn.lihu.jh.module.ecg.service.queue.QueueService;
import cn.lihu.jh.module.ecg.service.queuesequence.QueueSequenceService;
@@ -18,11 +19,7 @@
import javax.annotation.Resource;
import java.time.LocalTime;
import java.util.List;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
-import static cn.lihu.jh.module.ecg.Constants.ECG_OPENING_TIME_KEY;
-import static cn.lihu.jh.module.ecg.Constants.ECG_ROOM_RESET_TIME_KEY;
+import static cn.lihu.jh.module.ecg.Constants.*;
@Service
@Validated
@@ -40,6 +37,9 @@
@Resource
private QueueSequenceService queueSequenceService;
+
+ List<LocalTime> timeslotList = null;
+ Integer timeslotLength = 0;
ScheduledTask startBizTask = null;
ScheduledTask closeBizTask = null;
@@ -62,25 +62,65 @@
String strRoomResetTime = configApi.getConfigValueByKey(ECG_ROOM_RESET_TIME_KEY);
LocalTime roomResetTime = Utils.parseTime(strRoomResetTime);
+ // 銆愭湰闇�姹偮峰厹搴曞姞鍥恒�戦厤缃」 ecg.room.reset.time 缂哄け/鏍煎紡闈炴硶鏃� parseTime 杩斿洖 null锛�
+ // 鍘熷疄鐜扮洿鎺� roomResetTime.getMinute() 浼氭姏 NPE锛岃�� resetScheduler() 鍦ㄥ惎鍔ㄧ洃鍚噷
+ // **娌℃湁 try/catch** 鈬� 寮�璇�/闂瘖/閲嶇疆涓変釜瀹氭椂浠诲姟鍏ㄩ儴娉ㄥ唽澶辫触锛堢瓑浜�"姣忔棩閲嶇疆"浠庢湭鐢熸晥锛夈��
+ // 杩欓噷缁欓粯璁� 23:00锛屽苟淇濊瘉姣忎釜浠诲姟娉ㄥ唽澶辫触鍙 ERROR銆佷笉褰卞搷鍚姩銆�
+ if (null == roomResetTime) {
+ roomResetTime = LocalTime.of(23, 0);
+ log.warn("[resetScheduler] 閰嶇疆椤� {} 缂哄け鎴栨牸寮忛潪娉曪紙鍘熷��=[{}]锛夛紝姣忔棩宸ヤ綅閲嶇疆鏃堕棿鍥為��涓洪粯璁� 23:00",
+ ECG_ROOM_RESET_TIME_KEY, strRoomResetTime);
+ }
String roomResetCronExpression = String.format("0 %d %d * * ?", roomResetTime.getMinute(), roomResetTime.getHour());
- startBizTask = taskRegistrar.scheduleCronTask(new CronTask(() -> {
- System.out.println("Opening Task executed at: " + System.currentTimeMillis());
- queueService.startBiz();
- }, openCronExpression));
+ try {
+ startBizTask = taskRegistrar.scheduleCronTask(new CronTask(() -> {
+ System.out.println("Opening Task executed at: " + System.currentTimeMillis());
+ queueService.startBiz();
+ }, openCronExpression));
+ } catch (Exception e) {
+ log.error("[resetScheduler] 娉ㄥ唽銆屽紑璇娿�嶅畾鏃朵换鍔″け璐ワ紙涓嶅奖鍝嶅叾瀹冧换鍔★級. cron={}", openCronExpression, e);
+ }
- closeBizTask = taskRegistrar.scheduleCronTask(new CronTask(() -> {
- System.out.println("Close Task executed at: " + System.currentTimeMillis());
- queueService.closeBiz();
- }, closeCronExpression));
+ try {
+ closeBizTask = taskRegistrar.scheduleCronTask(new CronTask(() -> {
+ System.out.println("Close Task executed at: " + System.currentTimeMillis());
+ queueService.closeBiz();
+ }, closeCronExpression));
+ } catch (Exception e) {
+ log.error("[resetScheduler] 娉ㄥ唽銆岄棴璇娿�嶅畾鏃朵换鍔″け璐ワ紙涓嶅奖鍝嶅叾瀹冧换鍔★級. cron={}", closeCronExpression, e);
+ }
- resetRoomTask = taskRegistrar.scheduleCronTask(new CronTask(() -> {
- System.out.println("Room Reset Task executed at: " + System.currentTimeMillis());
- roomService.resetRoom(false);
- queueSequenceService.resetQueueSequence();
- }, roomResetCronExpression));
+ try {
+ resetRoomTask = taskRegistrar.scheduleCronTask(new CronTask(() -> {
+ System.out.println("Room Reset Task executed at: " + System.currentTimeMillis());
+ roomService.resetRoom(false);
+ //queueSequenceService.resetQueueSequence();
+ queueSequenceService.initNumber();
+ }, roomResetCronExpression));
+ } catch (Exception e) {
+ log.error("[resetScheduler] 娉ㄥ唽銆屾瘡鏃ュ伐浣嶉噸缃�嶅畾鏃朵换鍔″け璐�. cron={}", roomResetCronExpression, e);
+ }
taskRegistrar.afterPropertiesSet();
}
+ @Override
+ public void readTimeSlotConfig() {
+ String strBookTimeslotLength = configApi.getConfigValueByKey(BOOK_TIMESLOT_LENGTH);
+ timeslotLength = Integer.valueOf(strBookTimeslotLength);
+ //String strBookTimeslotList = configApi.getConfigValueByKey(BOOK_TIMESLOT_LIST);
+ //timeslotList = Utils.parseTimeSlotList(strBookTimeslotList, Integer.valueOf(strBookTimeslotLength));
+ }
+
+ @Override
+ public List<LocalTime> listTimeslot() {
+ return timeslotList;
+ }
+
+ @Override
+ public Integer getTimeslotLength() {
+ return timeslotLength;
+ }
+
}
--
Gitblit v1.9.3