Selaa lähdekoodia

【优化】日志打印格式统一;枚举使用时加枚举名;驼峰命名优化,

就是那个锅 4 vuotta sitten
vanhempi
commit
136537d0f4

+ 3 - 3
guns-base-support/guns-core/src/main/java/cn/stylefeng/guns/core/context/constant/ConstantContextHolder.java

@ -267,7 +267,7 @@ public class ConstantContextHolder {
        String configValue = ConstantContext.me().getStr(configCode);
        if (ObjectUtil.isEmpty(configValue)) {
            // 将默认值加入到缓存常量
            log.warn("系统配置sys_config表中存在空项,configCode为:{},系统采用默认值:{}", configCode, defaultValue);
            log.warn(">>> 系统配置sys_config表中存在空项,configCode为:{},系统采用默认值:{}", configCode, defaultValue);
            ConstantContext.me().put(configCode, defaultValue);
            return defaultValue;
        } else {
@ -292,7 +292,7 @@ public class ConstantContextHolder {
        String configValue = ConstantContext.me().getStr(configCode);
        if (ObjectUtil.isEmpty(configValue)) {
            if (nullThrowExp) {
                String format = StrUtil.format("系统配置sys_config表中存在空项,configCode为:{}", configCode);
                String format = StrUtil.format(">>> 系统配置sys_config表中存在空项,configCode为:{}", configCode);
                log.error(format);
                throw new ServiceException(CONSTANT_EMPTY.getCode(), format);
            } else {
@ -303,7 +303,7 @@ public class ConstantContextHolder {
                return Convert.convert(clazz, configValue);
            } catch (Exception e) {
                if (nullThrowExp) {
                    String format = StrUtil.format("系统配置sys_config表中存在格式错误的值,configCode={},configValue={}", configCode, configValue);
                    String format = StrUtil.format(">>> 系统配置sys_config表中存在格式错误的值,configCode={},configValue={}", configCode, configValue);
                    log.error(format);
                    throw new ServiceException(CONSTANT_EMPTY.getCode(), format);
                } else {

+ 3 - 2
guns-base-support/guns-system/src/main/java/cn/stylefeng/guns/sys/core/listener/ConstantsInitListener.java

@ -32,6 +32,7 @@ import cn.hutool.db.sql.SqlExecutor;
import cn.stylefeng.guns.core.context.constant.ConstantContext;
import cn.stylefeng.guns.core.enums.CommonStatusEnum;
import cn.stylefeng.guns.core.exception.ServiceException;
import cn.stylefeng.guns.sys.modular.consts.enums.SysConfigExceptionEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationContextInitializedEvent;
import org.springframework.context.ApplicationListener;
@ -74,7 +75,7 @@ public class ConstantsInitListener implements ApplicationListener<ApplicationCon
        // 如果有为空的配置,终止执行
        if (ObjectUtil.hasEmpty(dataSourceUrl, dataSourceUsername, dataSourcePassword)) {
            throw new ServiceException(DATA_SOURCE_NOT_EXIST);
            throw new ServiceException(SysConfigExceptionEnum.DATA_SOURCE_NOT_EXIST);
        }
        Connection conn = null;
@ -92,7 +93,7 @@ public class ConstantsInitListener implements ApplicationListener<ApplicationCon
            }
        } catch (SQLException | ClassNotFoundException e) {
            log.error(">>> 读取数据库constants配置信息出错:{}", e.getMessage());
            throw new ServiceException(DATA_SOURCE_NOT_EXIST);
            throw new ServiceException(SysConfigExceptionEnum.DATA_SOURCE_NOT_EXIST);
        } finally {
            DbUtil.close(conn);
        }

+ 2 - 2
guns-base-support/guns-system/src/main/java/cn/stylefeng/guns/sys/core/scanner/ApiResourceScanner.java

@ -28,7 +28,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.guns.core.consts.SymbolConstant;
import cn.stylefeng.guns.core.context.resources.ApiResourceContext;
import cn.stylefeng.guns.core.util.AopTargetUtils;
import cn.stylefeng.guns.core.util.AopTargetUtil;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Controller;
@ -59,7 +59,7 @@ public class ApiResourceScanner implements BeanPostProcessor {
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        //如果controller是代理对象,则需要获取原始类的信息
        Object aopTarget = AopTargetUtils.getTarget(bean);
        Object aopTarget = AopTargetUtil.getTarget(bean);
        if (aopTarget == null) {
            aopTarget = bean;

+ 2 - 2
guns-base-support/guns-system/src/main/java/cn/stylefeng/guns/sys/modular/auth/service/impl/AuthServiceImpl.java

@ -89,10 +89,10 @@ public class AuthServiceImpl implements AuthService, UserDetailsService {
            throw new AuthException(AuthExceptionEnum.ACCOUNT_PWD_ERROR);
        }
        String passwordBCrypt = sysUser.getPassword();
        String passwordBcrypt = sysUser.getPassword();
        //验证账号密码是否正确
        if (ObjectUtil.isEmpty(passwordBCrypt) || !BCrypt.checkpw(password, passwordBCrypt)) {
        if (ObjectUtil.isEmpty(passwordBcrypt) || !BCrypt.checkpw(password, passwordBcrypt)) {
            LogManager.me().executeLoginLog(sysUser.getAccount(), LogSuccessStatusEnum.FAIL.getCode(), AuthExceptionEnum.ACCOUNT_PWD_ERROR.getMessage());
            throw new AuthException(AuthExceptionEnum.ACCOUNT_PWD_ERROR);
        }

+ 1 - 1
guns-base-support/guns-system/src/main/java/cn/stylefeng/guns/sys/modular/timer/service/impl/HutoolTimerExeServiceImpl.java

@ -49,7 +49,7 @@ public class HutoolTimerExeServiceImpl implements TimerExeService {
    public void startTimer(String taskId, String cron, String className) {
        if (ObjectUtil.hasEmpty(taskId, cron, className)) {
            throw new ServiceException(EXE_EMPTY_PARAM);
            throw new ServiceException(SysTimersExceptionEnum.EXE_EMPTY_PARAM);
        }
        // 预加载类看是否存在此定时任务类