【7.6.0】更新常量引用方式

pull/55/head
fengshuonan 2023-05-06 23:58:36 +08:00
parent 9a0bad60d8
commit 15960e93d9
3 changed files with 17 additions and 18 deletions

View File

@ -32,6 +32,7 @@ import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.log.api.LogManagerApi;
import cn.stylefeng.roses.kernel.log.api.exception.LogException;
import cn.stylefeng.roses.kernel.log.api.exception.enums.LogExceptionEnum;
import cn.stylefeng.roses.kernel.log.api.pojo.manage.LogManagerRequest;
import cn.stylefeng.roses.kernel.log.api.pojo.record.LogRecordDTO;
import com.alibaba.fastjson.JSON;
@ -49,7 +50,6 @@ import static cn.stylefeng.roses.kernel.log.api.constants.LogConstants.DEFAULT_B
import static cn.stylefeng.roses.kernel.log.api.constants.LogConstants.DEFAULT_PAGE_SIZE;
import static cn.stylefeng.roses.kernel.log.api.constants.LogFileConstants.FILE_CONTRACT_SYMBOL;
import static cn.stylefeng.roses.kernel.log.api.constants.LogFileConstants.FILE_SUFFIX;
import static cn.stylefeng.roses.kernel.log.api.exception.enums.LogExceptionEnum.*;
/**
*
@ -84,12 +84,12 @@ public class FileLogManagerServiceImpl implements LogManagerApi {
// 文件日志必须有AppName,否则文件太多太大
if (ObjectUtil.isEmpty(logManagerParam.getAppName())) {
throw new LogException(APP_NAME_NOT_EXIST);
throw new LogException(LogExceptionEnum.APP_NAME_NOT_EXIST);
}
// 文件日志,必须有开始时间,否则文件太多太大
if (ObjectUtil.isEmpty(logManagerParam.getBeginDate())) {
throw new LogException(BEGIN_DATETIME_NOT_EXIST);
throw new LogException(LogExceptionEnum.BEGIN_DATETIME_NOT_EXIST);
}
// 获取文件路径
@ -127,17 +127,17 @@ public class FileLogManagerServiceImpl implements LogManagerApi {
// 删除操作,必须有appName
if (ObjectUtil.isEmpty(logManagerParam.getAppName())) {
throw new LogException(APP_NAME_NOT_EXIST);
throw new LogException(LogExceptionEnum.APP_NAME_NOT_EXIST);
}
// 删除操作,必须有appName
if (ObjectUtil.isEmpty(logManagerParam.getBeginDate())) {
throw new LogException(BEGIN_DATETIME_NOT_EXIST);
throw new LogException(LogExceptionEnum.BEGIN_DATETIME_NOT_EXIST);
}
// 文件日志,必须有结束时间,否则文件太多太大
if (ObjectUtil.isEmpty(logManagerParam.getEndDate())) {
throw new LogException(END_DATETIME_NOT_EXIST);
throw new LogException(LogExceptionEnum.END_DATETIME_NOT_EXIST);
}
// 计算开始和结束两个时间之间的所有日期
@ -161,12 +161,12 @@ public class FileLogManagerServiceImpl implements LogManagerApi {
// 文件日志必须有AppName,否则文件太多太大
if (ObjectUtil.isEmpty(logManagerRequest.getAppName())) {
throw new LogException(APP_NAME_NOT_EXIST);
throw new LogException(LogExceptionEnum.APP_NAME_NOT_EXIST);
}
// 文件日志,必须有开始时间,否则文件太多太大
if (ObjectUtil.isEmpty(logManagerRequest.getBeginDate())) {
throw new LogException(BEGIN_DATETIME_NOT_EXIST);
throw new LogException(LogExceptionEnum.BEGIN_DATETIME_NOT_EXIST);
}
// 获取文件路径

View File

@ -10,6 +10,7 @@ import cn.stylefeng.roses.kernel.jwt.JwtTokenOperator;
import cn.stylefeng.roses.kernel.jwt.api.pojo.config.JwtConfig;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.scanner.api.DevOpsReportApi;
import cn.stylefeng.roses.kernel.scanner.api.constants.ScannerConstants;
import cn.stylefeng.roses.kernel.scanner.api.exception.ScannerException;
import cn.stylefeng.roses.kernel.scanner.api.exception.enums.DevOpsExceptionEnum;
import cn.stylefeng.roses.kernel.scanner.api.pojo.devops.DevOpsReportProperties;
@ -20,7 +21,6 @@ import com.alibaba.fastjson.JSON;
import java.util.HashMap;
import java.util.List;
import static cn.stylefeng.roses.kernel.scanner.api.constants.ScannerConstants.*;
/**
*
@ -40,14 +40,14 @@ public class DefaultDevOpsReportImpl implements DevOpsReportApi {
}
// 组装请求DevOps平台的地址
String devopsReportUrl = serverHost + DEVOPS_REQUEST_PATH;
String devopsReportUrl = serverHost + ScannerConstants.DEVOPS_REQUEST_PATH;
// jwt token生成
String projectInteractionSecretKey = devOpsReportProperties.getProjectInteractionSecretKey();
Long tokenValidityPeriodSeconds = devOpsReportProperties.getTokenValidityPeriodSeconds();
JwtConfig jwtConfig = new JwtConfig();
jwtConfig.setJwtSecret(projectInteractionSecretKey);
jwtConfig.setExpiredSeconds(ObjectUtil.isNotEmpty(tokenValidityPeriodSeconds) ? tokenValidityPeriodSeconds : DEVOPS_REPORT_TIMEOUT_SECONDS);
jwtConfig.setExpiredSeconds(ObjectUtil.isNotEmpty(tokenValidityPeriodSeconds) ? tokenValidityPeriodSeconds : ScannerConstants.DEVOPS_REPORT_TIMEOUT_SECONDS);
JwtTokenOperator jwtTokenOperator = new JwtTokenOperator(jwtConfig);
String jwtToken = jwtTokenOperator.generateToken(new HashMap<>());
@ -58,7 +58,7 @@ public class DefaultDevOpsReportImpl implements DevOpsReportApi {
// 进行post请求汇报资源
HttpRequest httpRequest = HttpUtil.createPost(devopsReportUrl);
httpRequest.body(JSON.toJSONString(devOpsReportResourceParam));
httpRequest.setConnectionTimeout(Convert.toInt(DEVOPS_REPORT_CONNECTION_TIMEOUT_SECONDS * 1000));
httpRequest.setConnectionTimeout(Convert.toInt(ScannerConstants.DEVOPS_REPORT_CONNECTION_TIMEOUT_SECONDS * 1000));
ResponseData<?> responseData = null;
HttpResponse execute = httpRequest.execute();
String body = execute.body();

View File

@ -24,7 +24,6 @@
*/
package cn.stylefeng.roses.kernel.sms.modular.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
@ -35,6 +34,7 @@ import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.security.api.ImageCaptchaApi;
import cn.stylefeng.roses.kernel.sms.api.SmsSenderApi;
import cn.stylefeng.roses.kernel.sms.api.exception.SmsException;
import cn.stylefeng.roses.kernel.sms.api.exception.enums.SmsExceptionEnum;
import cn.stylefeng.roses.kernel.sms.api.expander.SmsConfigExpander;
import cn.stylefeng.roses.kernel.sms.modular.entity.SysSms;
import cn.stylefeng.roses.kernel.sms.modular.enums.SmsSendStatusEnum;
@ -60,7 +60,6 @@ import java.util.List;
import java.util.Map;
import static cn.stylefeng.roses.kernel.sms.api.constants.SmsConstants.SMS_CODE_PARAM_NAME;
import static cn.stylefeng.roses.kernel.sms.api.exception.enums.SmsExceptionEnum.*;
/**
*
@ -177,7 +176,7 @@ public class SysSmsInfoServiceImpl extends ServiceImpl<SysSmsMapper, SysSms> imp
// 如果找不到记录,提示验证失败
if (ObjectUtil.isEmpty(sysSmsList)) {
throw new SmsException(SMS_VALIDATE_ERROR_NOT_EXISTED_RECORD);
throw new SmsException(SmsExceptionEnum.SMS_VALIDATE_ERROR_NOT_EXISTED_RECORD);
}
// 获取最近发送的第一条
@ -185,18 +184,18 @@ public class SysSmsInfoServiceImpl extends ServiceImpl<SysSmsMapper, SysSms> imp
// 先判断状态是不是失效的状态
if (SmsSendStatusEnum.INVALID.getCode().equals(sysSms.getStatusFlag())) {
throw new SmsException(SMS_VALIDATE_ERROR_INVALIDATE_STATUS);
throw new SmsException(SmsExceptionEnum.SMS_VALIDATE_ERROR_INVALIDATE_STATUS);
}
// 如果验证码和传过来的不一致
if (!sysSmsVerifyParam.getCode().equals(sysSms.getValidateCode())) {
throw new SmsException(SMS_VALIDATE_ERROR_INVALIDATE_CODE);
throw new SmsException(SmsExceptionEnum.SMS_VALIDATE_ERROR_INVALIDATE_CODE);
}
// 判断是否超时
Date invalidTime = sysSms.getInvalidTime();
if (ObjectUtil.isEmpty(invalidTime) || new Date().after(invalidTime)) {
throw new SmsException(SMS_VALIDATE_ERROR_INVALIDATE_TIME);
throw new SmsException(SmsExceptionEnum.SMS_VALIDATE_ERROR_INVALIDATE_TIME);
}
// 验证成功把短信设置成失效