From fce86b41a1d3f6e6ffa9a696b32a350f53e640fd Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 25 三月 2023 16:44:46 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/service/sys/AttachService.java | 7 +++++++ src/main/java/com/lf/server/config/ScheduleConfig.java | 31 +++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/lf/server/config/ScheduleConfig.java b/src/main/java/com/lf/server/config/ScheduleConfig.java index 3251821..b1d6801 100644 --- a/src/main/java/com/lf/server/config/ScheduleConfig.java +++ b/src/main/java/com/lf/server/config/ScheduleConfig.java @@ -2,14 +2,18 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; +import com.lf.server.entity.data.FmeLogEntity; import com.lf.server.service.all.ScheduleService; import com.lf.server.service.all.WebSocketService; +import com.lf.server.service.sys.AttachService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; + +import java.util.List; /** * 鏃ョ▼閰嶇疆绫� @@ -19,7 +23,10 @@ @EnableScheduling public class ScheduleConfig { @Autowired - private ScheduleService scheduleService; + AttachService attachService; + + @Autowired + ScheduleService scheduleService; private static final Log log = LogFactory.getLog(ScheduleConfig.class); @@ -69,7 +76,7 @@ jsonObject.put("resUseCount", scheduleService.countResStatus()); // 鐢ㄦ埛鐧诲綍鐘舵�� sys_login - jsonObject.put("userLoginCount", scheduleService.userLoginCount()); + jsonObject.put("userLoginCount", scheduleService.userLoginCount()); // 璧勬簮鎿嶄綔鐘舵�� sys_operate jsonObject.put("operateCount", scheduleService.operateCount()); @@ -83,4 +90,24 @@ log.error(ex.getMessage(), ex); } } + + /** + * 鍚屾闄勪欢 + */ + @Scheduled(fixedRate = 30 * 1000) + public void syncAttaches() { + try { + List<FmeLogEntity> list = attachService.selectFmeLogs(); + if (null == list || list.isEmpty()) { + return; + } + + for (FmeLogEntity entity : list) { + attachService.syncAttaches(entity); + attachService.updateFmeLog(entity.getId()); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + } } diff --git a/src/main/java/com/lf/server/service/sys/AttachService.java b/src/main/java/com/lf/server/service/sys/AttachService.java index 205fd6f..fe7c253 100644 --- a/src/main/java/com/lf/server/service/sys/AttachService.java +++ b/src/main/java/com/lf/server/service/sys/AttachService.java @@ -106,4 +106,11 @@ public Integer updateFmeLog(Integer id) { return attachMapper.updateFmeLog(id); } + + /** + * 鍚屾闄勪欢 + */ + public void syncAttaches(FmeLogEntity entity) { + // + } } -- Gitblit v1.9.3