mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
添加一个日志记录异常参数打印
This commit is contained in:
+6
-1
@@ -8,6 +8,7 @@ import com.cf.imes.module.infra.dal.dataobject.logger.ApiErrorLogDO;
|
|||||||
import com.cf.imes.module.infra.dal.mysql.logger.ApiErrorLogMapper;
|
import com.cf.imes.module.infra.dal.mysql.logger.ApiErrorLogMapper;
|
||||||
import com.cf.imes.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
|
import com.cf.imes.module.infra.enums.logger.ApiErrorLogProcessStatusEnum;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@@ -35,7 +36,11 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
|
|||||||
public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
|
public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
|
||||||
ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
|
ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
|
||||||
.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
||||||
apiErrorLogMapper.insert(apiErrorLog);
|
try {
|
||||||
|
apiErrorLogMapper.insert(apiErrorLog);
|
||||||
|
}catch (DataIntegrityViolationException e) {
|
||||||
|
log.error(apiErrorLog.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user