feat(govern): 添加治理方案功能并重构相关数据模型

- 引入PqGovernPlan实体类及对应的数据库映射
- 实现治理方案的增删改查API接口和服务逻辑
- 集成治理方案与监测点、敏感用户的关联关系
- 更新设备交付数据传输对象和持久化对象结构
- 修改台账服务以支持治理方案数据展示
- 优化治理报告生成功能,基于治理方案进行数据查询
- 移除过时的设备治理类型字段,统一使用治理方案管理
This commit is contained in:
xy
2026-06-16 16:26:43 +08:00
parent d44b4f3576
commit 9438f75c01
23 changed files with 873 additions and 219 deletions

View File

@@ -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);
}

View File

@@ -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);
}
};
}
}

View File

@@ -0,0 +1,69 @@
package com.njcn.csharmonic.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
/**
* 治理方案参数类
*
* @author xy
* @since 2026-06-16
*/
@Data
public class PqGovernPlanParam {
@ApiModelProperty(value = "用户id关联pq_sensitive_user的id")
@NotBlank(message = "用户id不能为空")
private String pid;
@ApiModelProperty(value = "治理点名称")
@NotBlank(message = "治理点名称不能为空")
private String governName;
@ApiModelProperty(value = "治理类型(稳态:harmonic 暂态:event)")
@NotBlank(message = "治理类型不能为空")
private String governType;
@ApiModelProperty(value = "治理方法")
private String governMethod;
@ApiModelProperty(value = "治理前-监测点id")
private String governBefore;
@ApiModelProperty(value = "治理后-监测点id")
private String governAfter;
@ApiModelProperty(value = "排序")
private Integer sort;
/**
* 修改参数类
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class UpdatePqGovernPlanParam extends PqGovernPlanParam {
@ApiModelProperty("ID")
@NotBlank(message = "ID不能为空")
private String id;
}
/**
* 分页查询参数类
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class QueryParam extends BaseParam {
@ApiModelProperty(value = "治理点名称")
private String governName;
@ApiModelProperty(value = "治理类型(稳态:harmonic 暂态:event)")
private String governType;
@ApiModelProperty(value = "用户id关联pq_sensitive_user的id")
private String pid;
}
}

View File

@@ -0,0 +1,64 @@
package com.njcn.csharmonic.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author xy
* @since 2026-06-16
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("pq_govern_plan")
public class PqGovernPlan extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 用户id关联pq_sensitive_user的id
*/
private String pid;
/**
* 治理点名称
*/
private String governName;
/**
* 治理类型(稳态:harmonic 暂态:event)
*/
private String governType;
/**
* 治理方法
*/
private String governMethod;
/**
* 治理前-监测点id
*/
private String governBefore;
/**
* 治理后-监测点id
*/
private String governAfter;
/**
* 排序
*/
private Integer sort;
}

View File

@@ -0,0 +1,56 @@
package com.njcn.csharmonic.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class PqGovernPlanVo implements Serializable {
/**
* id
*/
private String id;
/**
* 用户id关联pq_sensitive_user的id
*/
private String pid;
/**
* 治理点名称
*/
private String governName;
/**
* 治理类型(稳态:harmonic 暂态:event)
*/
private String governType;
/**
* 治理方法
*/
private String governMethod;
/**
* 治理前-监测点id
*/
private String governBefore;
@ApiModelProperty("治理前台账")
private String ledgerBefore;
/**
* 治理后-监测点id
*/
private String governAfter;
@ApiModelProperty("治理后台账")
private String ledgerAfter;
/**
* 排序
*/
private Integer sort;
}