#
Junjie
16 小时以前 6e02d92c3b9c240fa78a343b67ddf0db12d840e6
src/main/java/com/zy/core/News.java
@@ -1,8 +1,13 @@
package com.zy.core;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.WrkMastService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.enums.RedisKeyType;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Array;
@@ -98,16 +103,94 @@
    }
    public static void info(String format, Object... arguments) {
        if (format.contains("[RCS Debug]")) {
            ConfigService configService = SpringUtils.getBean(ConfigService.class);
            if(configService != null) {
                boolean show = true;
                Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "rcsDebugShowLog"));
                if(config != null) {
                    show = config.getValue().equals("true");
                }
                if (!show) {
                    return;
                }
            }
        }
        RedisUtil redisUtil = null;
        try {
            redisUtil = SpringUtils.getBean(RedisUtil.class);
            if(redisUtil != null) {
                Object object = redisUtil.get(RedisKeyType.LOG_LIMIT.key + format);
                if (object != null) {
                    return;
                }
                redisUtil.set(RedisKeyType.LOG_LIMIT.key + format, "lock", 3);
            }
        }catch (Exception e) {}
        log.info(format, arguments);
        offer(NewsLevel.INFO, format, arguments);
    }
    public static void warn(String format, Object... arguments) {
        if (format.contains("[RCS Debug]")) {
            ConfigService configService = SpringUtils.getBean(ConfigService.class);
            if(configService != null) {
                boolean show = true;
                Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "rcsDebugShowLog"));
                if(config != null) {
                    show = config.getValue().equals("true");
                }
                if (!show) {
                    return;
                }
            }
        }
        RedisUtil redisUtil = null;
        try {
            redisUtil = SpringUtils.getBean(RedisUtil.class);
            if(redisUtil != null) {
                Object object = redisUtil.get(RedisKeyType.LOG_LIMIT.key + format);
                if (object != null) {
                    return;
                }
                redisUtil.set(RedisKeyType.LOG_LIMIT.key + format, "lock", 3);
            }
        }catch (Exception e) {}
        log.warn(format, arguments);
        offer(NewsLevel.WARN, format, arguments);
    }
    public static void error(String format, Object... arguments) {
        if (format.contains("[RCS Debug]")) {
            ConfigService configService = SpringUtils.getBean(ConfigService.class);
            if(configService != null) {
                boolean show = true;
                Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "rcsDebugShowLog"));
                if(config != null) {
                    show = config.getValue().equals("true");
                }
                if (!show) {
                    return;
                }
            }
        }
        RedisUtil redisUtil = null;
        try {
            redisUtil = SpringUtils.getBean(RedisUtil.class);
            if(redisUtil != null) {
                Object object = redisUtil.get(RedisKeyType.LOG_LIMIT.key + format);
                if (object != null) {
                    return;
                }
                redisUtil.set(RedisKeyType.LOG_LIMIT.key + format, "lock", 3);
            }
        }catch (Exception e) {}
        log.error(format, arguments);
        offer(NewsLevel.ERROR, format, arguments);
    }
@@ -168,7 +251,7 @@
            return false;
        }
        String systemMsg = replace(msg, args);
        if (systemMsg.equals(wrkMast.getSystemMsg())) {
        if (!systemMsg.equals(wrkMast.getSystemMsg())) {
            wrkMast.setSystemMsg(systemMsg);
            wrkMast.setModiTime(new Date());
            wrkMastService.updateById(wrkMast);