#
Junjie
15 小时以前 5e644156839fbb018fe63972ee74be550540a06a
src/main/java/com/zy/asrs/utils/Utils.java
@@ -7,6 +7,7 @@
import com.core.common.Arith;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.BasCrnp;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.BasCrnpService;
@@ -32,6 +33,8 @@
    private static final String LOC_NO_FLAG = "-";
    private static final DecimalFormat fmt = new DecimalFormat("##0.00");
    private static Integer defaultDeviceLogCollectTime = 200;
    private static Long lastUpdateDeviceLogCollectTime = -1L;
    public static float scale(Float f){
        if (f == null || f == 0f || Float.isNaN(f)) {
@@ -105,29 +108,37 @@
    //获取设备日志采集时间
    public static int getDeviceLogCollectTime() {
        int defaultTime = 200;
        try {
            RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
            if (redisUtil == null) {
                return defaultTime;
            }
        if (defaultDeviceLogCollectTime == null || System.currentTimeMillis() - lastUpdateDeviceLogCollectTime > 60 * 1000) {
            int defaultTime = 200;
            lastUpdateDeviceLogCollectTime = System.currentTimeMillis();
            try {
                RedisUtil redisUtil = null;
                try {
                    redisUtil = SpringUtils.getBean(RedisUtil.class);
                } catch (CoolException coolException) {
            Object object = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
            if (object == null) {
                return defaultTime;
            }
                }
                if (redisUtil == null) {
                    return defaultTime;
                }
            HashMap<String, String> systemConfigMap = (HashMap<String, String>) object;
            String deviceLogCollectTime = systemConfigMap.get("deviceLogCollectTime");
            if(deviceLogCollectTime == null){
                return defaultTime;
            }
                Object object = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
                if (object == null) {
                    return defaultTime;
                }
            return Integer.parseInt(deviceLogCollectTime);
        }catch (Exception e){
            e.printStackTrace();
                HashMap<String, String> systemConfigMap = (HashMap<String, String>) object;
                String deviceLogCollectTime = systemConfigMap.get("deviceLogCollectTime");
                if(deviceLogCollectTime == null){
                    return defaultTime;
                }
                return Integer.parseInt(deviceLogCollectTime);
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return defaultTime;
        return defaultDeviceLogCollectTime;
    }
    //获取入库任务可用排