1.审计管理

2.谐波检测bug修改
This commit is contained in:
wr
2023-05-19 16:20:57 +08:00
parent 6b7dfdb6f7
commit 373fe16ee1
18 changed files with 528 additions and 148 deletions

View File

@@ -0,0 +1,21 @@
package com.njcn.system.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.fallback.AuditFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022年01月05日 15:11
*/
@FeignClient(value = ServerInfo.SYSTEM, path = "/audit", fallbackFactory = AuditFeignClientFallbackFactory.class, contextId = "area")
public interface AuditFeignClient {
@PostMapping("/clearHistoryLog")
HttpResult clearHistoryLog();
}

View File

@@ -0,0 +1,41 @@
package com.njcn.system.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.AuditFeignClient;
import com.njcn.system.utils.SystemEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author denghuajun
* @version 1.0.0
* @date 2022年01月05日 15:08
*/
@Slf4j
@Component
public class AuditFeignClientFallbackFactory implements FallbackFactory<AuditFeignClient> {
@Override
public AuditFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if(cause.getCause() instanceof BusinessException){
BusinessException businessException = (BusinessException) cause.getCause();
exceptionEnum = SystemEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new AuditFeignClient() {
@Override
public HttpResult clearHistoryLog() {
log.error("{}异常,降级处理,异常为:{}","清空历史日志",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -11,7 +11,9 @@ public enum AuditLogEnum {
* 审计日志模块异常响应码
*/
NOT_FIND_FILE("A0300", "文件未备份,请先备份文件"),
LOG_EXCEPTION("A0301", "导入旧日志文件异常")
LOG_EXCEPTION("A0301", "导入旧日志文件异常"),
LOG_EXCEPTIONTIME("A0302", "导入旧日志文件异常:缺少时间范围"),
DELETE_DATA("A0303", "导入旧日志文件异常:删除数据失败")
;