fix
This commit is contained in:
parent
20469e5e53
commit
7452400add
@ -56,7 +56,7 @@ public enum KeyUsage {
|
||||
|
||||
|
||||
public static boolean hasUsage(int nowUsage, KeyUsage usage) {
|
||||
return (nowUsage & usage.value) == 1;
|
||||
return (nowUsage & usage.value) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.sunyard.chsm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sunyard.chsm.dto.CryptoServiceDTO;
|
||||
import com.sunyard.chsm.enums.ApiFunEnum;
|
||||
@ -105,6 +106,7 @@ public class CryptoServiceServiceImpl implements CryptoServiceService {
|
||||
checkName(save.getName());
|
||||
|
||||
CryptoService service = new CryptoService();
|
||||
service.setId(IdWorker.getId());
|
||||
service.setName(save.getName());
|
||||
|
||||
DeviceGroup deviceGroup = spDeviceGroupMapper.selectById(save.getDeviceGroupId());
|
||||
@ -180,6 +182,7 @@ public class CryptoServiceServiceImpl implements CryptoServiceService {
|
||||
.filter(it -> apiList.contains(it.getCode()))
|
||||
.map(it -> {
|
||||
CryptoServiceApi serviceApi = new CryptoServiceApi();
|
||||
serviceApi.setId(IdWorker.getId());
|
||||
serviceApi.setCryptoServiceId(serviceId);
|
||||
serviceApi.setApiGroup(it.getGroup().getCode());
|
||||
serviceApi.setApiCode(it.getCode());
|
||||
|
@ -2,6 +2,7 @@ package com.sunyard.chsm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sunyard.chsm.dto.DeviceGroupDTO;
|
||||
import com.sunyard.chsm.mapper.SpDeviceGroupMapper;
|
||||
@ -84,6 +85,7 @@ public class DeviceGroupServiceImpl implements DeviceGroupService {
|
||||
checkName(save.getName());
|
||||
|
||||
DeviceGroup add = new DeviceGroup();
|
||||
add.setId(IdWorker.getId());
|
||||
add.setName(save.getName());
|
||||
add.setRemark(save.getRemark());
|
||||
add.setCreateTime(LocalDateTime.now());
|
||||
|
@ -2,6 +2,7 @@ package com.sunyard.chsm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sunyard.chsm.dto.DeviceDTO;
|
||||
import com.sunyard.chsm.enums.ManufacturerEnum;
|
||||
@ -123,7 +124,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
|
||||
Device device = new Device();
|
||||
BeanUtils.copyProperties(save, device);
|
||||
device.setId(null);
|
||||
device.setId(IdWorker.getId());
|
||||
device.setGroupId(0L);
|
||||
device.setGroupName("");
|
||||
device.setWeight(1);
|
||||
|
@ -2,6 +2,7 @@ package com.sunyard.chsm.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sunyard.chsm.dto.KeyTemplateDTO;
|
||||
import com.sunyard.chsm.enums.KeyAlg;
|
||||
@ -78,6 +79,7 @@ public class KeyTemplateServiceImpl implements KeyTemplateService {
|
||||
checkCode(save.getCode());
|
||||
|
||||
KeyTemplate add = mapToEntity(save);
|
||||
add.setId(IdWorker.getId());
|
||||
add.setCreateTime(LocalDateTime.now());
|
||||
|
||||
keyTemplateMapper.insert(add);
|
||||
|
@ -1,10 +1,7 @@
|
||||
package com.sunyard.ssp.common.exception;
|
||||
|
||||
import com.sunyard.chsm.model.R;
|
||||
import com.sunyard.ssp.common.Result;
|
||||
import com.sunyard.ssp.utils.ResultUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.MyBatisSystemException;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
@ -31,38 +28,15 @@ import java.util.Optional;
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionResolver {
|
||||
|
||||
/**
|
||||
* 处理所有不可知异常
|
||||
*
|
||||
* @param e 异常
|
||||
* @return json结果
|
||||
*/
|
||||
// @ExceptionHandler(Exception.class)
|
||||
// @ResponseBody
|
||||
// public Result<Object> handleException(Exception e) {
|
||||
// // 打印异常堆栈信息
|
||||
// return new ResultUtil().setErrorMsg(e.getMessage());
|
||||
// }
|
||||
|
||||
/**
|
||||
* 数据持久层
|
||||
*/
|
||||
@ExceptionHandler(MyBatisSystemException.class)
|
||||
@ResponseBody
|
||||
public Result<Object> handleMyBatisSystemException(MyBatisSystemException e) {
|
||||
log.info("数据持久层");
|
||||
return new ResultUtil().setErrorMsg(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验器
|
||||
*/
|
||||
@ExceptionHandler(BindException.class)
|
||||
@ResponseBody
|
||||
public Result<Object> handleBindException(BindException e) {
|
||||
log.info("校验器");
|
||||
public R<?> handleBindException(BindException e) {
|
||||
log.info("校验器异常", e);
|
||||
FieldError fieldError = e.getBindingResult().getFieldError();
|
||||
return new ResultUtil().setErrorMsg(fieldError.getDefaultMessage());
|
||||
return R.error(400, fieldError.getDefaultMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
|
@ -17,7 +17,7 @@ import java.util.zip.ZipOutputStream;
|
||||
@Service
|
||||
public class LogDownloadServiceImpl implements LogDownloadService {
|
||||
|
||||
private static final String LOG_BASE_PATH = "/app/log/";
|
||||
private static final String LOG_BASE_PATH = "./log/";
|
||||
private static final DateTimeFormatter folderFormatter = DateTimeFormatter.ofPattern("yyyy-MM"); // 用于遍历月份的目录格式
|
||||
private static final DateTimeFormatter fileFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 用于解析文件名中的日期格式
|
||||
|
||||
|
@ -62,7 +62,7 @@ mybatis-plus:
|
||||
# 数据库相关配置
|
||||
db-config:
|
||||
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
|
||||
id-type: ASSIGN_ID
|
||||
id-type: AUTO
|
||||
#驼峰下划线转换
|
||||
table-underline: true
|
||||
#是否开启大写命名,默认不开启
|
||||
@ -124,9 +124,10 @@ ignored:
|
||||
- /status/set
|
||||
- /test/setALL
|
||||
#logging:
|
||||
# config: classpath:log4j2.xml
|
||||
# level:
|
||||
# root: debug
|
||||
# org.springframework.web: trace
|
||||
# config: classpath:log4j2.xml
|
||||
|
||||
|
||||
monitorSwitch:
|
||||
|
@ -19,11 +19,11 @@
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/info.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/his/info.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM}/INFO-%d{yyyy-MM-dd}_%i.log</fileNamePattern>
|
||||
<!--单个文件-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<maxFileSize>10MB</maxFileSize>
|
||||
<!--文件保存时间(天)-->
|
||||
<maxHistory>700</maxHistory>
|
||||
<maxHistory>30</maxHistory>
|
||||
<!--总文件日志最大的大小-->
|
||||
<totalSizeCap>20GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
@ -37,14 +37,14 @@
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/warn.log</file>
|
||||
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/his/warn.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM}/sspweb-DEBUG-%d{yyyy-MM-dd}_%i.log</fileNamePattern>
|
||||
<!--单个文件-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<maxFileSize>10MB</maxFileSize>
|
||||
<!--文件保存时间(天)-->
|
||||
<maxHistory>700</maxHistory>
|
||||
<maxHistory>30</maxHistory>
|
||||
<!--总文件日志最大的大小-->
|
||||
<totalSizeCap>20GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
@ -54,18 +54,18 @@
|
||||
<charset>UTF-8</charset> <!-- 设置字符集 -->
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>WARN</level>
|
||||
<level>DEBUG</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/his/error.%d{yyyy-MM-dd }.%i.log</fileNamePattern>
|
||||
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM}/ERROR-%d{yyyy-MM-dd}_%i.log</fileNamePattern>
|
||||
<!--单个文件-->
|
||||
<maxFileSize>200MB</maxFileSize>
|
||||
<maxFileSize>10MB</maxFileSize>
|
||||
<!--文件保存时间(天)-->
|
||||
<maxHistory>700</maxHistory>
|
||||
<maxHistory>30</maxHistory>
|
||||
<!--总文件日志最大的大小-->
|
||||
<totalSizeCap>20GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="INFO_FILE"/>
|
||||
<appender-ref ref="WARN_FILE"/>
|
||||
<appender-ref ref="DEBUG_FILE"/>
|
||||
<appender-ref ref="ERROR_FILE"/>
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
|
Loading…
Reference in New Issue
Block a user