车间能级提升-智能设备管理系统
baoshiwei
3 天以前 793989f6eb4e39f4b1f47931fdeefb4a12385424
refactor(eims): 优化设备数据定时任务和报告服务

- 为 DeviceDataIncrJob 类添加Slf4j注解,用于日志记录
- 替换 System.out.println 为 log.info,提高日志可管理性
- 修正 ReportServiceImpl 中的保养工单状态比较逻辑,确保正确判断工单状态
已修改2个文件
10 ■■■■ 文件已修改
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/job/DeviceDataIncrJob.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/ReportServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/job/DeviceDataIncrJob.java
@@ -1,5 +1,6 @@
package org.dromara.eims.job;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.redis.utils.RedisUtils;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -7,6 +8,7 @@
import java.util.Calendar;
@Slf4j
@Configuration
@EnableScheduling
public class DeviceDataIncrJob {
@@ -17,7 +19,6 @@
     */
    @Scheduled(cron = "0/5 * 8-17 * * ?")
    public void updateDeviceDataScheduled() {
        System.out.println("执行定时任务,更新设备数据:::");
        // 检查当前时间是否在早上8点到下午5点之间
        Calendar now = Calendar.getInstance();
        int hourOfDay = now.get(Calendar.HOUR_OF_DAY);
@@ -61,8 +62,7 @@
    // 新增一个定时器,第天零点清零
    @Scheduled(cron = "0 0 0 * * ?")
    public void resetDeviceDataScheduled() {
        System.out.println("执行定时任务,重置设备数据:::");
        log.info("执行定时任务,重置设备数据:::");
        RedisUtils.setAtomicValue(DEVICE_DATA_PREFIX + "smtTapeJamCount", 0);      // 5/5s
        RedisUtils.setAtomicValue(DEVICE_DATA_PREFIX + "smtMaterialJamCount", 0); // 5/5s
        RedisUtils.setAtomicValue(DEVICE_DATA_PREFIX + "smtPanelCount", 0); // 100/5s
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/ReportServiceImpl.java
@@ -283,11 +283,11 @@
                        if (allZero) {
                            return MAINT_0; // 待保养
                        }
                        boolean allGtOne = orders.stream().allMatch(o -> Integer.parseInt(o.getStatus()) > 1);
                        boolean allGtOne = orders.stream().allMatch(o -> Integer.parseInt(o.getStatus()) == 1);
                        if (allGtOne) {
                            return MAINT_2; // 待验证
                        }
                        boolean allGtTwo = orders.stream().allMatch(o -> Integer.parseInt(o.getStatus()) > 2);
                        boolean allGtTwo = orders.stream().allMatch(o -> Integer.parseInt(o.getStatus()) == 2);
                        if (allGtTwo) {
                            return MAINT_3; // 已完成
                        }