车间能级提升-智能设备管理系统
baoshiwei
4 天以前 793989f6eb4e39f4b1f47931fdeefb4a12385424
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