feat(govern): 添加治理方案功能并重构相关数据模型
- 引入PqGovernPlan实体类及对应的数据库映射 - 实现治理方案的增删改查API接口和服务逻辑 - 集成治理方案与监测点、敏感用户的关联关系 - 更新设备交付数据传输对象和持久化对象结构 - 修改台账服务以支持治理方案数据展示 - 优化治理报告生成功能,基于治理方案进行数据查询 - 移除过时的设备治理类型字段,统一使用治理方案管理
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.PqGovernPlanClientFallbackFactory;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/pqGovernPlan", fallbackFactory = PqGovernPlanClientFallbackFactory.class,contextId = "pqGovernPlan")
|
||||
|
||||
public interface PqGovernPlanFeignClient {
|
||||
|
||||
@GetMapping("/getListExcludeNull")
|
||||
@ApiOperation("查询所有治理方案(剔除治理前后监测点为空的数据)")
|
||||
HttpResult<List<PqGovernPlan>> getListExcludeNull();
|
||||
|
||||
@PostMapping("/getListByMonitorPoint")
|
||||
@ApiOperation("清空治理前后监测点数据")
|
||||
HttpResult<List<PqGovernPlan>> getListByMonitorPoint(@RequestBody List<String> ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.csharmonic.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.csharmonic.api.PqGovernPlanFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PqGovernPlanClientFallbackFactory implements FallbackFactory<PqGovernPlanFeignClient> {
|
||||
@Override
|
||||
public PqGovernPlanFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PqGovernPlanFeignClient() {
|
||||
@Override
|
||||
public HttpResult<List<PqGovernPlan>> getListExcludeNull() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询所有治理方案异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<PqGovernPlan>> getListByMonitorPoint(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","清空治理前后监测点数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user