审批流程配置,预警规则,影响区联络信息
parent
a6e17a5154
commit
eddb6d85c7
|
|
@ -16,7 +16,7 @@ import org.springframework.cache.annotation.EnableCaching;
|
|||
description = "本地测试环境"
|
||||
),
|
||||
@Server(
|
||||
url = "http://local.gunshiiot.com:18083/gunshiApp/ss",
|
||||
url = "http://223.75.53.141:83/gunshiApp/ss",
|
||||
description = "线上测试环境"
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ public class OpenApiConfig {
|
|||
"com.gunshi.project.ss.controller",
|
||||
};
|
||||
String[] pathsToMatch = {
|
||||
"/screen/responsibility/**"
|
||||
"/impactZoneInfo/**",
|
||||
"/auditProcess/**",
|
||||
"/warningRule/**"
|
||||
};
|
||||
return GroupedOpenApi.builder()
|
||||
.group("ss")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
package com.gunshi.project.ss.controller;
|
||||
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.ss.common.validate.markers.Insert;
|
||||
import com.gunshi.project.ss.common.validate.markers.Update;
|
||||
import com.gunshi.project.ss.model.AuditProcess;
|
||||
import com.gunshi.project.ss.service.AuditProcessService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Tag(name = "审批流程配置")
|
||||
@RestController
|
||||
@RequestMapping(value="/auditProcess")
|
||||
public class AuditProcessController {
|
||||
|
||||
@Autowired
|
||||
private AuditProcessService service;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<AuditProcess> insert(@Validated(Insert.class) @RequestBody AuditProcess dto) {
|
||||
if (dto.getWarningLevel() != null){
|
||||
if (service.lambdaQuery().eq(AuditProcess::getWarningLevel,dto.getAuditLevel()).count() > 0) {
|
||||
throw new IllegalArgumentException("当前预警级别的审批流程已存在");
|
||||
}
|
||||
}
|
||||
|
||||
boolean result = service.save(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<AuditProcess> update(@Validated(Update.class) @RequestBody AuditProcess dto) {
|
||||
if (Objects.isNull(service.getById(dto.getId()))) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
boolean result = service.updateById(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
if (Objects.isNull(service.getById(id))) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
boolean data = service.removeById(id);
|
||||
|
||||
return R.ok(data);
|
||||
}
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@GetMapping("/list")
|
||||
public R<List<AuditProcess>> list(@RequestParam(value = "warningLevel",required = false) @Parameter(description = "预警级别") Integer warningLevel) {
|
||||
if (warningLevel != null){
|
||||
return R.ok(service.lambdaQuery().eq(AuditProcess::getWarningLevel,warningLevel).list());
|
||||
}
|
||||
return R.ok(service.lambdaQuery().list());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ import java.util.Objects;
|
|||
|
||||
@Tag(name = "影响区联络信息管理")
|
||||
@RestController
|
||||
@RequestMapping(value="/ImpactZoneInfo")
|
||||
@RequestMapping(value="/impactZoneInfo")
|
||||
public class ImpactZoneInfoController{
|
||||
|
||||
@Autowired
|
||||
|
|
|
|||
|
|
@ -8,14 +8,12 @@ import com.gunshi.project.ss.common.validate.markers.Update;
|
|||
import com.gunshi.project.ss.entity.so.WarningRulePageSo;
|
||||
import com.gunshi.project.ss.model.WarningRule;
|
||||
import com.gunshi.project.ss.model.WarningRuleInfo;
|
||||
import com.gunshi.project.ss.service.HisWaterDataService;
|
||||
import com.gunshi.project.ss.service.StStbprpBService;
|
||||
import com.gunshi.project.ss.service.WarningRuleInfoService;
|
||||
import com.gunshi.project.ss.service.WarningRuleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -26,12 +24,20 @@ import java.util.List;
|
|||
@Tag(name = "预警规则")
|
||||
@RestController
|
||||
@RequestMapping(value="/warningRule")
|
||||
public class WarningRuleController extends AbstractCommonFileController {
|
||||
public class WarningRuleController{
|
||||
|
||||
@Autowired
|
||||
private WarningRuleService warningRuleService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private StStbprpBService stStbprpBService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private WarningRuleInfoService warningRuleInfoService;
|
||||
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<WarningRule>> page(@RequestBody @Validated WarningRulePageSo page) {
|
||||
|
|
@ -41,13 +47,7 @@ public class WarningRuleController extends AbstractCommonFileController {
|
|||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<WarningRule> insert(@RequestBody @Validated WarningRule dto, HttpServletRequest request) {
|
||||
// SessionUser sessionUser = checkLogin(request);
|
||||
// if(sessionUser == null){
|
||||
// throw new IllegalArgumentException("未登录");
|
||||
// }
|
||||
// Long userId = sessionUser.getUserId();
|
||||
// dto.setCreateName(userId.toString());
|
||||
public R<WarningRule> insert(@RequestBody @Validated WarningRule dto) {
|
||||
return R.ok(warningRuleService.saveData(dto));
|
||||
}
|
||||
|
||||
|
|
@ -66,10 +66,6 @@ public class WarningRuleController extends AbstractCommonFileController {
|
|||
return R.ok(b);
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private WarningRuleInfoService warningRuleInfoService;
|
||||
|
||||
@Operation(summary = "预警信息分页")
|
||||
@PostMapping("/info/page")
|
||||
public R<Page<WarningRuleInfo>> infoPage(@RequestBody @Validated WarningRulePageSo page) {
|
||||
|
|
@ -84,27 +80,17 @@ public class WarningRuleController extends AbstractCommonFileController {
|
|||
}
|
||||
|
||||
//获取降雨量测点
|
||||
|
||||
@Autowired
|
||||
private StStbprpBService stStbprpBService;
|
||||
|
||||
@Operation(summary = "获取降雨量测点")
|
||||
@GetMapping("/getRainStcd")
|
||||
public R<List<StStbprpB>> gerRainStcd(){
|
||||
public R<List<StStbprpB>> getRainStcd(){
|
||||
return R.ok(stStbprpBService.getPptnStations());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private HisWaterDataService hisWaterDataService;
|
||||
|
||||
@Operation(summary = "获取年份")
|
||||
@GetMapping("/getYear")
|
||||
public R<List<Integer>> getYear(){
|
||||
return R.ok(hisWaterDataService.getYearList());
|
||||
@Operation(summary = "获取流量测点")
|
||||
@GetMapping("/getFlowStcd")
|
||||
public R<List<StStbprpB>> getFlowStcd(){
|
||||
return R.ok(stStbprpBService.getFlowStations());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "warningRule";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.gunshi.project.ss.entity.so;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||
import com.gunshi.db.dto.PageSo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -14,9 +15,25 @@ public class WarningRulePageSo {
|
|||
@Schema(description = "分页参数")
|
||||
private PageSo pageSo;
|
||||
|
||||
private String ruleName;
|
||||
|
||||
/**
|
||||
* 预警类型:MONITOR-监测预警,FORE-预报预警
|
||||
*/
|
||||
@Schema(description="预警类型:MONITOR-监测预警,FORE-预报预警")
|
||||
private String warningType;
|
||||
|
||||
private DateTimeRangeSo dateTimeRangeSo;
|
||||
|
||||
/**
|
||||
* 预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)
|
||||
*/
|
||||
@Schema(description="预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)")
|
||||
private Integer warningObj;
|
||||
|
||||
/**
|
||||
* 预警级别(1蓝色 2黄色 3橙色 4红色)
|
||||
*/
|
||||
@Schema(description="预警级别(1蓝色 2黄色 3橙色 4红色)")
|
||||
private Integer warningLevel;
|
||||
|
||||
@Schema(description="状态:0-未启用,1-启用")
|
||||
private Integer status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package com.gunshi.project.ss.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.ss.model.AuditProcess;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AuditProcessMapper extends BaseMapper<AuditProcess> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.gunshi.project.ss.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.project.ss.common.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description="审批流程配置")
|
||||
@Data
|
||||
@TableName("public.audit_process")
|
||||
public class AuditProcess implements Serializable {
|
||||
|
||||
public final static String thisTableName = "AuditProcess";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@NotNull(message = "id不能为空",groups = { Update.class})
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 预警级别(1蓝色 2黄色 3橙色 4红色)
|
||||
*/
|
||||
@TableField(value="warning_level")
|
||||
@Schema(description="预警级别(1蓝色 2黄色 3橙色 4红色)")
|
||||
private Integer warningLevel;
|
||||
|
||||
/**
|
||||
* 审批层级(1一级 2二级)
|
||||
*/
|
||||
@TableField(value="audit_level")
|
||||
@Schema(description="审批层级(1一级 2二级)")
|
||||
private Integer auditLevel;
|
||||
|
||||
@TableField(value="first_audit_user_id")
|
||||
@Schema(description="一级审批人id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long firstAuditUserId;
|
||||
|
||||
@TableField(value="first_audit_user_name")
|
||||
@Schema(description="一级审批人")
|
||||
private String firstAuditUserName;
|
||||
|
||||
@TableField(value="second_audit_user_id")
|
||||
@Schema(description="二级审批人id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long secondAuditUserId;
|
||||
|
||||
@TableField(value="second_audit_user_name")
|
||||
@Schema(description="二级审批人")
|
||||
private String secondAuditUserName;
|
||||
|
||||
|
||||
@TableField("update_time")
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ public class ReservoirDemarcationInfo {
|
|||
|
||||
@TableField("management_scope_area_explain")
|
||||
@Schema(description = "管理范围(km²)说明")
|
||||
private BigDecimal managementScopeAreaExplain;
|
||||
private String managementScopeAreaExplain;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "管理范围(km²)文件")
|
||||
|
|
@ -40,7 +40,7 @@ public class ReservoirDemarcationInfo {
|
|||
|
||||
@TableField("protection_scope_area_explain")
|
||||
@Schema(description = "保护范围(km²)说明")
|
||||
private BigDecimal protectionScopeAreaExplain;
|
||||
private String protectionScopeAreaExplain;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "保护范围(km²)文件")
|
||||
|
|
@ -53,7 +53,7 @@ public class ReservoirDemarcationInfo {
|
|||
|
||||
@TableField("total_use_area_explain")
|
||||
@Schema(description = "用地总面积(万亩)说明")
|
||||
private BigDecimal totalUseAreaExplain;
|
||||
private String totalUseAreaExplain;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "用地总面积(万亩)文件")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
package com.gunshi.project.ss.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
|
@ -15,12 +22,16 @@ public class WarningCondition {
|
|||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 规则ID
|
||||
*/
|
||||
@TableField("rule_id")
|
||||
@Schema(description="规则ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long ruleId;
|
||||
|
||||
/**
|
||||
|
|
@ -29,59 +40,41 @@ public class WarningCondition {
|
|||
@TableField("_order")
|
||||
private Integer order;
|
||||
|
||||
/**
|
||||
* 预警指标类型
|
||||
* 实时水位 REAL_WATER_LEVEL
|
||||
* 预报洪峰流量 PEAK_FLOW
|
||||
* 降雨量 RAINFALL
|
||||
* 蓄水量 WATER_STORAGE
|
||||
* 预报降雨量 FORECAST_RAINFALL
|
||||
*/
|
||||
@TableField("indicator_type")
|
||||
private String indicatorType;
|
||||
|
||||
/**
|
||||
* 预警类型:FLOOD-洪水预警,DROUGHT-干旱预警
|
||||
*/
|
||||
@TableField("warning_type")
|
||||
private String warningType;
|
||||
|
||||
/**
|
||||
* 测点编码
|
||||
*/
|
||||
@TableField("stcd")
|
||||
private String stcd;
|
||||
|
||||
/**
|
||||
* 比较运算符
|
||||
*/
|
||||
@TableField("_operator")
|
||||
@Schema(description="比较运算符")
|
||||
private String operator;
|
||||
|
||||
/**
|
||||
* 阈值
|
||||
*/
|
||||
@TableField("threshold_value")
|
||||
@Schema(description="阈值")
|
||||
private BigDecimal thresholdValue;
|
||||
|
||||
/**
|
||||
* 时长/时段(小时)
|
||||
* 预报时长
|
||||
*/
|
||||
@TableField("duration_hours")
|
||||
@Schema(description="预报时长")
|
||||
private Integer durationHours;
|
||||
|
||||
/**
|
||||
* 位移方向
|
||||
*/
|
||||
@TableField("direction")
|
||||
@Schema(description="位移方向")
|
||||
private String direction;
|
||||
|
||||
/**
|
||||
* 与前一个条件的关系:AND-且,OR-或(最后一个条件为空)
|
||||
*/
|
||||
@TableField("relation_type")
|
||||
private String relationType;
|
||||
|
||||
@TableField("warning_level")
|
||||
private Integer warningLevel;
|
||||
|
||||
@TableField("year")
|
||||
private String year;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Boolean isEnjoy = false;//该预警规则是否满足条件,默认不满足
|
||||
}
|
||||
|
|
@ -2,6 +2,11 @@ package com.gunshi.project.ss.model;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.project.ss.common.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
|
@ -16,45 +21,65 @@ public class WarningRule {
|
|||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@NotNull(message = "id不能为空",groups = { Update.class})
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
@TableField("rule_name")
|
||||
private String ruleName;
|
||||
|
||||
/**
|
||||
* 预警类型:FLOOD-洪水预警,DROUGHT-干旱预警
|
||||
* 预警类型:MONITOR-监测预警,FORE-预报预警
|
||||
*/
|
||||
@TableField("warning_type")
|
||||
@Schema(description="预警类型:MONITOR-监测预警,FORE-预报预警")
|
||||
private String warningType;
|
||||
|
||||
|
||||
/**
|
||||
* 预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)
|
||||
*/
|
||||
@TableField("warning_obj")
|
||||
@Schema(description="预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)")
|
||||
private Integer warningObj;
|
||||
|
||||
/**
|
||||
* 预警级别(1蓝色 2黄色 3橙色 4红色)
|
||||
*/
|
||||
@TableField("warning_level")
|
||||
@Schema(description="预警级别(1蓝色 2黄色 3橙色 4红色)")
|
||||
private Integer warningLevel;
|
||||
|
||||
/**
|
||||
* 关联测点
|
||||
*/
|
||||
@TableField("rel_stcd")
|
||||
@Schema(description="关联测点")
|
||||
private String relStcd;
|
||||
|
||||
|
||||
/**
|
||||
* 状态:0-未启用,1-启用
|
||||
*/
|
||||
@TableField("status")
|
||||
@Schema(description="状态:0-未启用,1-启用")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
* 应对措施
|
||||
*/
|
||||
@TableField("create_name")
|
||||
private String createName;
|
||||
@TableField("solution")
|
||||
@Schema(description="应对措施")
|
||||
private String solution;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@Schema(description="创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@TableField("warning_level")
|
||||
private Integer warningLevel;
|
||||
|
||||
/**
|
||||
* 预警条件列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.project.ss.common.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -19,29 +24,42 @@ public class WarningRuleInfo {
|
|||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@TableField("rule_id")
|
||||
@Schema(description="规则主键")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long ruleId;
|
||||
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
@TableField("rule_name")
|
||||
private String ruleName;
|
||||
|
||||
/**
|
||||
* 预警类型:FLOOD-洪水预警,DROUGHT-干旱预警
|
||||
* 预警类型:MONITOR-监测预警,FORE-预报预警
|
||||
*/
|
||||
@TableField("warning_type")
|
||||
@Schema(description="预警类型:MONITOR-监测预警,FORE-预报预警")
|
||||
private String warningType;
|
||||
|
||||
/**
|
||||
* 预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)
|
||||
*/
|
||||
@TableField("warning_obj")
|
||||
@Schema(description="预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)")
|
||||
private Integer warningObj;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
* 预警级别(1蓝色 2黄色 3橙色 4红色)
|
||||
*/
|
||||
@TableField("create_name")
|
||||
private String createName;
|
||||
@TableField("warning_level")
|
||||
@Schema(description="预警级别(1蓝色 2黄色 3橙色 4红色)")
|
||||
private Integer warningLevel;
|
||||
|
||||
/**
|
||||
* 关联测点
|
||||
*/
|
||||
@TableField("rel_stcd")
|
||||
@Schema(description="关联测点")
|
||||
private String relStcd;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
|
@ -53,15 +71,12 @@ public class WarningRuleInfo {
|
|||
@TableField("rule_info")
|
||||
private String ruleInfo;
|
||||
|
||||
@TableField("warning_level")
|
||||
private Integer warningLevel;
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 预警条件列表
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<WarningCondition> conditions;
|
||||
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
package com.gunshi.project.ss.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.ss.mapper.AuditProcessMapper;
|
||||
import com.gunshi.project.ss.model.AuditProcess;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AuditProcessService extends ServiceImpl<AuditProcessMapper, AuditProcess>
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -31,18 +31,6 @@ public class WarningConditionService extends ServiceImpl<WarningConditionMapper,
|
|||
if(dto.getId() != null){
|
||||
queryWrapper.ne(WarningCondition::getId, dto.getId());
|
||||
}
|
||||
if(dto.getIndicatorType() != null){
|
||||
//预警指标类型
|
||||
queryWrapper.eq(WarningCondition::getIndicatorType,dto.getIndicatorType());
|
||||
}
|
||||
if(dto.getWarningLevel() != null){
|
||||
//预警等级
|
||||
queryWrapper.eq(WarningCondition::getWarningLevel,dto.getWarningLevel());
|
||||
}
|
||||
if(dto.getWarningType() != null){
|
||||
//预警类型
|
||||
queryWrapper.eq(WarningCondition::getWarningType,dto.getWarningType());
|
||||
}
|
||||
if(dto.getOperator() != null){
|
||||
//比较符
|
||||
queryWrapper.eq(WarningCondition::getOperator,dto.getOperator());
|
||||
|
|
|
|||
|
|
@ -26,16 +26,16 @@ public class WarningRuleInfoService extends ServiceImpl<WarningRuleInfoMapper,Wa
|
|||
|
||||
public Page<WarningRuleInfo> pageQuery(WarningRulePageSo page) {
|
||||
LambdaQueryWrapper<WarningRuleInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(!StringUtils.isBlank(page.getRuleName())){
|
||||
queryWrapper.like(WarningRuleInfo::getRuleName, page.getRuleName());
|
||||
}
|
||||
// if(!StringUtils.isBlank(page.getRuleName())){
|
||||
// queryWrapper.like(WarningRuleInfo::getRuleName, page.getRuleName());
|
||||
// }
|
||||
if(!StringUtils.isBlank(page.getWarningType())){
|
||||
queryWrapper.eq(WarningRuleInfo::getWarningType, page.getWarningType());
|
||||
}
|
||||
if(page.getDateTimeRangeSo() != null){
|
||||
queryWrapper.ge(WarningRuleInfo::getCreateTime,page.getDateTimeRangeSo().getStart());
|
||||
queryWrapper.le(WarningRuleInfo::getCreateTime,page.getDateTimeRangeSo().getEnd());
|
||||
}
|
||||
// if(page.getDateTimeRangeSo() != null){
|
||||
// queryWrapper.ge(WarningRuleInfo::getCreateTime,page.getDateTimeRangeSo().getStart());
|
||||
// queryWrapper.le(WarningRuleInfo::getCreateTime,page.getDateTimeRangeSo().getEnd());
|
||||
// }
|
||||
queryWrapper.orderByDesc(WarningRuleInfo::getCreateTime);
|
||||
Page<WarningRuleInfo> warningRuleInfoPage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
||||
List<WarningRuleInfo> records = warningRuleInfoPage.getRecords();
|
||||
|
|
|
|||
|
|
@ -28,12 +28,18 @@ public class WarningRuleService extends ServiceImpl<WarningRuleMapper, WarningRu
|
|||
|
||||
public Page<WarningRule> pageQuery(WarningRulePageSo page) {
|
||||
LambdaQueryWrapper<WarningRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(!StringUtils.isBlank(page.getRuleName())){
|
||||
queryWrapper.like(WarningRule::getRuleName, page.getRuleName());
|
||||
}
|
||||
if(!StringUtils.isBlank(page.getWarningType())){
|
||||
queryWrapper.eq(WarningRule::getWarningType, page.getWarningType());
|
||||
}
|
||||
if(page.getWarningObj() != null){
|
||||
queryWrapper.eq(WarningRule::getWarningObj, page.getWarningObj());
|
||||
}
|
||||
if(page.getWarningLevel() != null){
|
||||
queryWrapper.eq(WarningRule::getWarningLevel, page.getWarningLevel());
|
||||
}
|
||||
if(page.getStatus() != null){
|
||||
queryWrapper.eq(WarningRule::getStatus, page.getStatus());
|
||||
}
|
||||
queryWrapper.orderByDesc(WarningRule::getCreateTime);
|
||||
Page<WarningRule> warningRulePage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
||||
|
||||
|
|
@ -62,13 +68,7 @@ public class WarningRuleService extends ServiceImpl<WarningRuleMapper, WarningRu
|
|||
save(dto);
|
||||
List<WarningCondition> conditions = dto.getConditions();
|
||||
for (WarningCondition condition : conditions) {
|
||||
// WarningCondition warningCondition = warningConditionService.checkConditionExists(condition);
|
||||
// if(warningCondition != null){
|
||||
// throw new IllegalArgumentException("对不起,该预警规则已配置");
|
||||
// }
|
||||
condition.setRuleId(dto.getId());
|
||||
condition.setWarningType(dto.getWarningType());
|
||||
condition.setWarningLevel(dto.getWarningLevel());
|
||||
}
|
||||
warningConditionService.saveBatch(conditions);
|
||||
return dto;
|
||||
|
|
|
|||
|
|
@ -96,15 +96,15 @@ public class WarningRuleTask {
|
|||
|
||||
// 这里可以根据 isRuleSatisfied 进行后续处理,比如触发预警等
|
||||
if (isRuleSatisfied) {
|
||||
log.info("预警规则 {} 满足条件,触发预警", warningRule.getRuleName());
|
||||
log.info("预警规则 {} 满足条件,触发预警", warningRule.getId());
|
||||
|
||||
// 生成规则信息
|
||||
String ruleInfo = generateRuleInfo(conditions);
|
||||
|
||||
WarningRuleInfo warningRuleInfo = new WarningRuleInfo();
|
||||
warningRuleInfo.setCreateName(warningRule.getCreateName());
|
||||
// warningRuleInfo.setCreateName(warningRule.getCreateName());
|
||||
warningRuleInfo.setRuleId(warningRule.getId());
|
||||
warningRuleInfo.setRuleName(warningRule.getRuleName());
|
||||
// warningRuleInfo.setRuleName(warningRule.getRuleName());
|
||||
warningRuleInfo.setConditions(conditions);
|
||||
warningRuleInfo.setCreateTime(LocalDateTime.now());
|
||||
warningRuleInfo.setRuleInfo(ruleInfo);
|
||||
|
|
@ -141,8 +141,10 @@ public class WarningRuleTask {
|
|||
* 生成单个条件的描述信息 - 修改格式
|
||||
*/
|
||||
private String generateSingleConditionInfo(WarningCondition condition) {
|
||||
String indicatorType = condition.getIndicatorType();
|
||||
String stcd = condition.getStcd();
|
||||
// String indicatorType = condition.getIndicatorType();
|
||||
// String stcd = condition.getStcd();
|
||||
String indicatorType = null;
|
||||
String stcd = null;
|
||||
String stnm="";
|
||||
List<StStbprpB> stStbprpBS = stStbprpBService.lambdaQuery().eq(StStbprpB::getStcd, stcd).last("limit 1").list();
|
||||
if(stStbprpBS != null && !stStbprpBS.isEmpty()){
|
||||
|
|
@ -167,10 +169,10 @@ public class WarningRuleTask {
|
|||
stnm, durationHours != null ? durationHours : 24,
|
||||
currentRainfall, condition.getOperator(), thresholdValue);
|
||||
|
||||
case "WATER_STORAGE":
|
||||
BigDecimal currentStoragePercent = getWaterStorage(condition.getYear());
|
||||
return String.format("蓄水量 %s 同期%s%%",
|
||||
condition.getOperator(), thresholdValue);
|
||||
// case "WATER_STORAGE":
|
||||
// BigDecimal currentStoragePercent = getWaterStorage(condition.getYear());
|
||||
// return String.format("蓄水量 %s 同期%s%%",
|
||||
// condition.getOperator(), thresholdValue);
|
||||
|
||||
case "FORECAST_RAINFALL":
|
||||
return String.format("%s测点未来%dh降雨量 %s %smm",
|
||||
|
|
@ -186,8 +188,10 @@ public class WarningRuleTask {
|
|||
* 计算条件的实际值
|
||||
*/
|
||||
private BigDecimal calculateActualValue(WarningCondition condition, String warningType) {
|
||||
String indicatorType = condition.getIndicatorType();
|
||||
String stcd = condition.getStcd();
|
||||
// String indicatorType = condition.getIndicatorType();
|
||||
// String stcd = condition.getStcd();
|
||||
String indicatorType = null;
|
||||
String stcd = null;
|
||||
Integer durationHours = condition.getDurationHours();
|
||||
|
||||
switch (indicatorType) {
|
||||
|
|
@ -198,7 +202,7 @@ public class WarningRuleTask {
|
|||
case "RAINFALL":
|
||||
return getRealRainFall(stcd, durationHours);
|
||||
case "WATER_STORAGE":
|
||||
return getWaterStorage(condition.getYear());
|
||||
// return getWaterStorage(condition.getYear());
|
||||
case "FORECAST_RAINFALL":
|
||||
return getForecastRainFall(stcd, durationHours);
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in New Issue