预警内容管理,预警信息审核
parent
eddb6d85c7
commit
51a0155568
|
|
@ -22,7 +22,9 @@ public class OpenApiConfig {
|
||||||
String[] pathsToMatch = {
|
String[] pathsToMatch = {
|
||||||
"/impactZoneInfo/**",
|
"/impactZoneInfo/**",
|
||||||
"/auditProcess/**",
|
"/auditProcess/**",
|
||||||
"/warningRule/**"
|
"/warningRule/**",
|
||||||
|
"/reservoirDemarcationInfo/**",
|
||||||
|
"/safety/degradeScrapLedger/**"
|
||||||
};
|
};
|
||||||
return GroupedOpenApi.builder()
|
return GroupedOpenApi.builder()
|
||||||
.group("ss")
|
.group("ss")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.gunshi.project.ss.controller;
|
package com.gunshi.project.ss.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.project.ss.common.validate.markers.Insert;
|
import com.gunshi.project.ss.common.validate.markers.Insert;
|
||||||
import com.gunshi.project.ss.common.validate.markers.Update;
|
import com.gunshi.project.ss.common.validate.markers.Update;
|
||||||
|
|
@ -29,22 +32,31 @@ public class AuditProcessController {
|
||||||
@Operation(summary = "新增")
|
@Operation(summary = "新增")
|
||||||
@PostMapping("/insert")
|
@PostMapping("/insert")
|
||||||
public R<AuditProcess> insert(@Validated(Insert.class) @RequestBody AuditProcess dto) {
|
public R<AuditProcess> insert(@Validated(Insert.class) @RequestBody AuditProcess dto) {
|
||||||
if (dto.getWarningLevel() != null){
|
checkParam(dto);
|
||||||
if (service.lambdaQuery().eq(AuditProcess::getWarningLevel,dto.getAuditLevel()).count() > 0) {
|
dto.setId(IdWorker.getId());
|
||||||
throw new IllegalArgumentException("当前预警级别的审批流程已存在");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean result = service.save(dto);
|
boolean result = service.save(dto);
|
||||||
return R.ok(result ? dto : null);
|
return R.ok(result ? dto : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkParam(AuditProcess dto) {
|
||||||
|
Long id = dto.getId();
|
||||||
|
LambdaQueryWrapper<AuditProcess> queryWrapper = Wrappers.lambdaQuery();
|
||||||
|
queryWrapper.eq(AuditProcess::getWarningLevel,dto.getWarningLevel());
|
||||||
|
if(id != null){
|
||||||
|
queryWrapper.ne(AuditProcess::getId,id);
|
||||||
|
}
|
||||||
|
if(service.count(queryWrapper ) > 0){
|
||||||
|
throw new IllegalArgumentException("当前预警级别的审批流程已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "修改")
|
@Operation(summary = "修改")
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public R<AuditProcess> update(@Validated(Update.class) @RequestBody AuditProcess dto) {
|
public R<AuditProcess> update(@Validated(Update.class) @RequestBody AuditProcess dto) {
|
||||||
if (Objects.isNull(service.getById(dto.getId()))) {
|
if (Objects.isNull(service.getById(dto.getId()))) {
|
||||||
throw new IllegalArgumentException("当前数据不存在");
|
throw new IllegalArgumentException("当前数据不存在");
|
||||||
}
|
}
|
||||||
|
checkParam(dto);
|
||||||
boolean result = service.updateById(dto);
|
boolean result = service.updateById(dto);
|
||||||
return R.ok(result ? dto : null);
|
return R.ok(result ? dto : null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.gunshi.project.ss.controller;
|
package com.gunshi.project.ss.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.project.ss.common.validate.markers.Insert;
|
import com.gunshi.project.ss.common.validate.markers.Insert;
|
||||||
|
|
@ -36,7 +37,7 @@ public class ImpactZoneInfoController{
|
||||||
throw new IllegalArgumentException("当前名称已存在");
|
throw new IllegalArgumentException("当前名称已存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dto.setId(IdWorker.getId());
|
||||||
boolean result = service.save(dto);
|
boolean result = service.save(dto);
|
||||||
return R.ok(result ? dto : null);
|
return R.ok(result ? dto : null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.core.result.R;
|
import com.gunshi.core.result.R;
|
||||||
import com.gunshi.project.ss.common.model.StStbprpB;
|
import com.gunshi.project.ss.common.model.StStbprpB;
|
||||||
import com.gunshi.project.ss.common.validate.markers.Update;
|
import com.gunshi.project.ss.common.validate.markers.Update;
|
||||||
|
import com.gunshi.project.ss.entity.dto.WarningAuditDto;
|
||||||
import com.gunshi.project.ss.entity.so.WarningRulePageSo;
|
import com.gunshi.project.ss.entity.so.WarningRulePageSo;
|
||||||
|
import com.gunshi.project.ss.model.WarningRecObj;
|
||||||
import com.gunshi.project.ss.model.WarningRule;
|
import com.gunshi.project.ss.model.WarningRule;
|
||||||
import com.gunshi.project.ss.model.WarningRuleInfo;
|
import com.gunshi.project.ss.model.WarningRuleInfo;
|
||||||
import com.gunshi.project.ss.service.StStbprpBService;
|
import com.gunshi.project.ss.service.StStbprpBService;
|
||||||
|
|
@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Tag(name = "预警规则")
|
@Tag(name = "预警规则")
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -66,11 +69,6 @@ public class WarningRuleController{
|
||||||
return R.ok(b);
|
return R.ok(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "预警信息分页")
|
|
||||||
@PostMapping("/info/page")
|
|
||||||
public R<Page<WarningRuleInfo>> infoPage(@RequestBody @Validated WarningRulePageSo page) {
|
|
||||||
return R.ok(warningRuleInfoService.pageQuery(page));
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取水位站测点
|
//获取水位站测点
|
||||||
@Operation(summary = "获取水位站测点")
|
@Operation(summary = "获取水位站测点")
|
||||||
|
|
@ -92,5 +90,39 @@ public class WarningRuleController{
|
||||||
return R.ok(stStbprpBService.getFlowStations());
|
return R.ok(stStbprpBService.getFlowStations());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "预警内容管理分页")
|
||||||
|
@PostMapping("/info/page")
|
||||||
|
public R<Page<WarningRuleInfo>> infoPage(@RequestBody @Validated WarningRulePageSo page) {
|
||||||
|
return R.ok(warningRuleInfoService.pageQuery(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "预警信息统计")
|
||||||
|
@PostMapping("/info/stat")
|
||||||
|
public R<Map<Integer,Long>> infoStat(@RequestBody @Validated WarningRulePageSo page) {
|
||||||
|
return R.ok(warningRuleInfoService.infoStat(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "发布")
|
||||||
|
@PostMapping("/publish")
|
||||||
|
public R<String> publish(@RequestBody @Validated WarningRuleInfo dto) {
|
||||||
|
return R.ok(warningRuleInfoService.publish(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据预警内容id查询接收对象")
|
||||||
|
@GetMapping("/queryObj/{id}")
|
||||||
|
public R<List<WarningRecObj>> queryObj(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||||
|
return R.ok(warningRuleInfoService.queryObj(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "预警信息审核分页")
|
||||||
|
@PostMapping("/audit/page")
|
||||||
|
public R<Page<WarningRuleInfo>> auditPage(@RequestBody @Validated WarningRulePageSo page) {
|
||||||
|
return R.ok(warningRuleInfoService.auditPage(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "审核")
|
||||||
|
@PostMapping("/audit")
|
||||||
|
public R<Boolean> audit(@RequestBody @Validated WarningAuditDto dto) {
|
||||||
|
return R.ok(warningRuleInfoService.audit(dto));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.gunshi.project.ss.entity.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WarningAuditDto {
|
||||||
|
|
||||||
|
@Schema(description = "预警内容id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "审核级别 1-一级 2-二级")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "审核结果(5-审核通过 9-审核不通过)")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
|
|
@ -34,6 +34,15 @@ public class WarningRulePageSo {
|
||||||
@Schema(description="预警级别(1蓝色 2黄色 3橙色 4红色)")
|
@Schema(description="预警级别(1蓝色 2黄色 3橙色 4红色)")
|
||||||
private Integer warningLevel;
|
private Integer warningLevel;
|
||||||
|
|
||||||
|
@Schema(description="时间范围")
|
||||||
|
private DateTimeRangeSo dateTimeRangeSo;
|
||||||
|
|
||||||
@Schema(description="状态:0-未启用,1-启用")
|
@Schema(description="状态:0-未启用,1-启用")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态:1-待审核,5-审核通过,9-审核不通过
|
||||||
|
*/
|
||||||
|
@Schema(description="状态:1-待审核,5-审核通过,9-审核不通过")
|
||||||
|
private Integer auditStatus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.gunshi.project.ss.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.gunshi.project.ss.model.WarningRecObj;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface WarningRecObjMapper extends BaseMapper<WarningRecObj> {
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,88 @@
|
||||||
package com.gunshi.project.ss.mapper;
|
package com.gunshi.project.ss.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.project.ss.entity.so.WarningRulePageSo;
|
||||||
import com.gunshi.project.ss.model.WarningRuleInfo;
|
import com.gunshi.project.ss.model.WarningRuleInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface WarningRuleInfoMapper extends BaseMapper<WarningRuleInfo> {
|
public interface WarningRuleInfoMapper extends BaseMapper<WarningRuleInfo> {
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select t1.*,t2.warning_type,t2.warning_obj,t2.warning_level,t2.rel_stcd from public.warning_rule_info t1
|
||||||
|
left join public.warning_rule t2 on t1.rule_id = t2.id
|
||||||
|
where 1=1
|
||||||
|
<if test="obj.warningType != null and obj.warningType != ''">
|
||||||
|
and t2.warning_type = #{obj.warningType}
|
||||||
|
</if>
|
||||||
|
<if test="obj.warningObj != null ">
|
||||||
|
and t2.warning_obj = #{obj.warningObj}
|
||||||
|
</if>
|
||||||
|
<if test="obj.warningLevel != null ">
|
||||||
|
and t2.warning_level = #{obj.warningLevel}
|
||||||
|
</if>
|
||||||
|
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
|
||||||
|
and t1.create_time <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
|
||||||
|
</if>
|
||||||
|
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
|
||||||
|
and t1.create_time <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
|
||||||
|
</if>
|
||||||
|
order by t1.create_time desc
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
Page<WarningRuleInfo> page(Page<WarningRuleInfo> page,@Param("obj") WarningRulePageSo page1);
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select t1.id,t2.warning_level from public.warning_rule_info t1
|
||||||
|
left join public.warning_rule t2 on t1.rule_id = t2.id
|
||||||
|
where 1=1
|
||||||
|
<if test="obj.warningType != null and obj.warningType != ''">
|
||||||
|
and t2.warning_type = #{obj.warningType}
|
||||||
|
</if>
|
||||||
|
<if test="obj.warningObj != null ">
|
||||||
|
and t2.warning_obj = #{obj.warningObj}
|
||||||
|
</if>
|
||||||
|
<if test="obj.warningLevel != null ">
|
||||||
|
and t2.warning_level = #{obj.warningLevel}
|
||||||
|
</if>
|
||||||
|
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
|
||||||
|
and t1.create_time <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
|
||||||
|
</if>
|
||||||
|
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
|
||||||
|
and t1.create_time <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
|
||||||
|
</if>
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
List<WarningRuleInfo> infoStat(@Param("obj") WarningRulePageSo page);
|
||||||
|
|
||||||
|
@Select("""
|
||||||
|
<script>
|
||||||
|
select t1.*,t2.warning_type,t2.warning_obj,t2.warning_level,t2.rel_stcd from public.warning_rule_info t1
|
||||||
|
left join public.warning_rule t2 on t1.rule_id = t2.id
|
||||||
|
where t1.status != 0
|
||||||
|
<if test="obj.warningType != null and obj.warningType != ''">
|
||||||
|
and t2.warning_type = #{obj.warningType}
|
||||||
|
</if>
|
||||||
|
<if test="obj.warningLevel != null ">
|
||||||
|
and t2.warning_level = #{obj.warningLevel}
|
||||||
|
</if>
|
||||||
|
<if test="obj.auditStatus != null ">
|
||||||
|
and t1.status = #{obj.auditStatus}
|
||||||
|
</if>
|
||||||
|
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
|
||||||
|
and t1.init_audit_time <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
|
||||||
|
</if>
|
||||||
|
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
|
||||||
|
and t1.init_audit_time <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
|
||||||
|
</if>
|
||||||
|
order by t1.init_audit_time desc
|
||||||
|
</script>
|
||||||
|
""")
|
||||||
|
Page<WarningRuleInfo> auditPage(Page<WarningRuleInfo> page,@Param("obj") WarningRulePageSo page1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警接收对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("warning_rec_obj")
|
||||||
|
public class WarningRecObj {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId(value="id", type= IdType.AUTO)
|
||||||
|
@Schema(description="主键")
|
||||||
|
@NotNull(message = "id不能为空",groups = { Update.class})
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@TableField("warning_info_id")
|
||||||
|
@Schema(description="预警内容id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long warningInfoId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型:1-内部 2-外部
|
||||||
|
*/
|
||||||
|
@TableField("type")
|
||||||
|
@Schema(description="类型:1-内部 2-外部")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@TableField(value="user_id")
|
||||||
|
@Schema(description="用户id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@TableField(value="user_name")
|
||||||
|
@Schema(description="用户")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -36,10 +36,10 @@ public class WarningRule {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)
|
* 预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 6-渗流 7-预报最高库水位 8-预报累计雨量 9-预报入库洪峰流量 10-预报渗压)
|
||||||
*/
|
*/
|
||||||
@TableField("warning_obj")
|
@TableField("warning_obj")
|
||||||
@Schema(description="预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)")
|
@Schema(description="预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 6-渗流 7-预报最高库水位 8-预报累计雨量 9-预报入库洪峰流量 10-预报渗压)")
|
||||||
private Integer warningObj;
|
private Integer warningObj;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,10 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -34,32 +33,20 @@ public class WarningRuleInfo {
|
||||||
private Long ruleId;
|
private Long ruleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预警类型:MONITOR-监测预警,FORE-预报预警
|
* 监测值/预报值
|
||||||
*/
|
*/
|
||||||
@TableField("warning_type")
|
@TableField("value")
|
||||||
@Schema(description="预警类型:MONITOR-监测预警,FORE-预报预警")
|
@Schema(description="监测值/预报值")
|
||||||
private String warningType;
|
private BigDecimal value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)
|
* 预测预报最高水位出现的时间点/预测预报入库洪峰流量出现的时间点
|
||||||
*/
|
*/
|
||||||
@TableField("warning_obj")
|
@TableField("fore_time")
|
||||||
@Schema(description="预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 5-渗流 6-预报最高库水位 7-预报累计雨量 8-预报入库洪峰流量 9-预报渗压)")
|
@Schema(description="预测预报最高水位出现的时间点/预测预报入库洪峰流量出现的时间点")
|
||||||
private Integer warningObj;
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime foreTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 预警级别(1蓝色 2黄色 3橙色 4红色)
|
|
||||||
*/
|
|
||||||
@TableField("warning_level")
|
|
||||||
@Schema(description="预警级别(1蓝色 2黄色 3橙色 4红色)")
|
|
||||||
private Integer warningLevel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关联测点
|
|
||||||
*/
|
|
||||||
@TableField("rel_stcd")
|
|
||||||
@Schema(description="关联测点")
|
|
||||||
private String relStcd;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
|
|
@ -68,15 +55,134 @@ public class WarningRuleInfo {
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@TableField("rule_info")
|
/**
|
||||||
private String ruleInfo;
|
* 状态:0-未发布,1-待审核,5-审核通过,9-审核不通过
|
||||||
|
*/
|
||||||
@TableField("status")
|
@TableField("status")
|
||||||
|
@Schema(description="状态:0-未发布,1-待审核,5-审核通过,9-审核不通过")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*发起审核时间
|
||||||
|
*/
|
||||||
|
@TableField("init_audit_time")
|
||||||
|
@Schema(description="发起审核时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime initAuditTime;
|
||||||
|
|
||||||
|
@TableField(value="init_audit_user_id")
|
||||||
|
@Schema(description="发起人id")
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long initAuditUserId;
|
||||||
|
|
||||||
|
@TableField(value="init_audit_user_name")
|
||||||
|
@Schema(description="发起人")
|
||||||
|
private String initAuditUserName;
|
||||||
|
|
||||||
|
@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("first_audit_time")
|
||||||
|
@Schema(description="一级审核时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime firstAuditTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级审核结果(5-审核通过 9-审核不通过)
|
||||||
|
*/
|
||||||
|
@TableField("first_audit_status")
|
||||||
|
@Schema(description="一级审核结果(5-审核通过 9-审核不通过)")
|
||||||
|
private Integer firstAuditStatus;
|
||||||
|
|
||||||
|
@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("second_audit_time")
|
||||||
|
@Schema(description="二级审核时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime secondAuditTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级审核结果(5-审核通过 9-审核不通过)
|
||||||
|
*/
|
||||||
|
@TableField("second_audit_status")
|
||||||
|
@Schema(description="二级审核结果(5-审核通过 9-审核不通过)")
|
||||||
|
private Integer secondAuditStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布渠道(1-短信 2-APP 3-短信,APP)
|
||||||
|
*/
|
||||||
|
@TableField("release_channel")
|
||||||
|
@Schema(description="发布渠道(1-短信 2-APP 3-短信,APP)")
|
||||||
|
private Integer releaseChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
@TableField("title")
|
||||||
|
@Schema(description="标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警内容
|
||||||
|
*/
|
||||||
|
@TableField("content")
|
||||||
|
@Schema(description="预警内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警类型:MONITOR-监测预警,FORE-预报预警
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Schema(description="预警类型:MONITOR-监测预警,FORE-预报预警")
|
||||||
|
private String warningType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 6-渗流 7-预报最高库水位 8-预报累计雨量 9-预报入库洪峰流量 10-预报渗压)
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Schema(description="预警对象(1-库水位 2-累计雨量 3-出入库流量 4-位移 5-渗压 6-渗流 7-预报最高库水位 8-预报累计雨量 9-预报入库洪峰流量 10-预报渗压)")
|
||||||
|
private Integer warningObj;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警级别(1蓝色 2黄色 3橙色 4红色)
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Schema(description="预警级别(1蓝色 2黄色 3橙色 4红色)")
|
||||||
|
private Integer warningLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联测点
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Schema(description="关联测点")
|
||||||
|
private String relStcd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预警条件列表
|
* 预警条件列表
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<WarningCondition> conditions;
|
private List<WarningCondition> conditions;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<WarningRecObj> objs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class FundBudgetService extends ServiceImpl<FundBudgetMapper, FundBudget
|
||||||
}
|
}
|
||||||
if(fundBudget.getAnnualIncomeBudget() != null && fundBudget.getAnnualExpenditureBudget() != null){
|
if(fundBudget.getAnnualIncomeBudget() != null && fundBudget.getAnnualExpenditureBudget() != null){
|
||||||
|
|
||||||
BigDecimal budget_balance = fundBudget.getAnnualIncomeBudget().subtract(fundBudget.getAnnualExpenditureBudget());
|
BigDecimal budget_balance = fundBudget.getAnnualExpenditureBudget().subtract(fundBudget.getAnnualIncomeBudget());
|
||||||
fundBudget.setBudgetBalance(budget_balance);
|
fundBudget.setBudgetBalance(budget_balance);
|
||||||
}
|
}
|
||||||
fundBudget.setCreateTime(LocalDateTime.now());
|
fundBudget.setCreateTime(LocalDateTime.now());
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.gunshi.project.ss.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gunshi.project.ss.mapper.WarningRecObjMapper;
|
||||||
|
import com.gunshi.project.ss.model.WarningRecObj;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class WarningRecObjService extends ServiceImpl<WarningRecObjMapper, WarningRecObj> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,19 +1,27 @@
|
||||||
package com.gunshi.project.ss.service;
|
package com.gunshi.project.ss.service;
|
||||||
|
|
||||||
import com.alibaba.excel.util.StringUtils;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gunshi.project.ss.entity.dto.WarningAuditDto;
|
||||||
import com.gunshi.project.ss.entity.so.WarningRulePageSo;
|
import com.gunshi.project.ss.entity.so.WarningRulePageSo;
|
||||||
import com.gunshi.project.ss.mapper.WarningRuleInfoMapper;
|
import com.gunshi.project.ss.mapper.WarningRuleInfoMapper;
|
||||||
|
import com.gunshi.project.ss.model.AuditProcess;
|
||||||
import com.gunshi.project.ss.model.WarningCondition;
|
import com.gunshi.project.ss.model.WarningCondition;
|
||||||
|
import com.gunshi.project.ss.model.WarningRecObj;
|
||||||
import com.gunshi.project.ss.model.WarningRuleInfo;
|
import com.gunshi.project.ss.model.WarningRuleInfo;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -23,21 +31,15 @@ public class WarningRuleInfoService extends ServiceImpl<WarningRuleInfoMapper,Wa
|
||||||
@Autowired
|
@Autowired
|
||||||
private WarningConditionService warningConditionService;
|
private WarningConditionService warningConditionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AuditProcessService auditProcessService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WarningRecObjService objService;
|
||||||
|
|
||||||
|
|
||||||
public Page<WarningRuleInfo> pageQuery(WarningRulePageSo page) {
|
public Page<WarningRuleInfo> pageQuery(WarningRulePageSo page) {
|
||||||
LambdaQueryWrapper<WarningRuleInfo> queryWrapper = new LambdaQueryWrapper<>();
|
Page<WarningRuleInfo> warningRuleInfoPage = this.baseMapper.page(page.getPageSo().toPage(), page);
|
||||||
// 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());
|
|
||||||
// }
|
|
||||||
queryWrapper.orderByDesc(WarningRuleInfo::getCreateTime);
|
|
||||||
Page<WarningRuleInfo> warningRuleInfoPage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
|
||||||
List<WarningRuleInfo> records = warningRuleInfoPage.getRecords();
|
List<WarningRuleInfo> records = warningRuleInfoPage.getRecords();
|
||||||
for (WarningRuleInfo record : records) {
|
for (WarningRuleInfo record : records) {
|
||||||
List<WarningCondition> listByRuleId = warningConditionService.getListByRuleId(record.getRuleId());
|
List<WarningCondition> listByRuleId = warningConditionService.getListByRuleId(record.getRuleId());
|
||||||
|
|
@ -45,4 +47,64 @@ public class WarningRuleInfoService extends ServiceImpl<WarningRuleInfoMapper,Wa
|
||||||
}
|
}
|
||||||
return warningRuleInfoPage;
|
return warningRuleInfoPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Integer, Long> infoStat(WarningRulePageSo page) {
|
||||||
|
List<WarningRuleInfo> list = this.baseMapper.infoStat(page);
|
||||||
|
return list.stream().collect(Collectors.groupingBy(WarningRuleInfo::getWarningLevel, Collectors.counting()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String publish(WarningRuleInfo warningRuleInfo) {
|
||||||
|
warningRuleInfo.setStatus(2);
|
||||||
|
Integer warningLevel = warningRuleInfo.getWarningLevel();
|
||||||
|
LambdaQueryWrapper<AuditProcess> queryWrapper = Wrappers.lambdaQuery();
|
||||||
|
queryWrapper.eq(AuditProcess::getWarningLevel,warningLevel);
|
||||||
|
AuditProcess auditProcess = auditProcessService.getOne(queryWrapper);
|
||||||
|
if (auditProcess == null) {
|
||||||
|
return "未找到该预警级别对应的审批流程";
|
||||||
|
}
|
||||||
|
warningRuleInfo.setInitAuditUserId(SecurityUtils.getUserId());
|
||||||
|
warningRuleInfo.setInitAuditUserName(SecurityUtils.getUsername());
|
||||||
|
warningRuleInfo.setInitAuditTime(LocalDateTime.now());
|
||||||
|
warningRuleInfo.setFirstAuditUserId(auditProcess.getFirstAuditUserId());
|
||||||
|
warningRuleInfo.setFirstAuditUserName(auditProcess.getFirstAuditUserName());
|
||||||
|
this.updateById(warningRuleInfo);
|
||||||
|
objService.saveOrUpdateBatch(warningRuleInfo.getObjs());
|
||||||
|
return "发布成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<WarningRecObj> queryObj(Serializable id) {
|
||||||
|
LambdaQueryWrapper<WarningRecObj> queryWrapper = Wrappers.lambdaQuery();
|
||||||
|
queryWrapper.eq(WarningRecObj::getWarningInfoId,id);
|
||||||
|
return objService.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Page<WarningRuleInfo> auditPage(WarningRulePageSo page) {
|
||||||
|
return this.baseMapper.auditPage(page.getPageSo().toPage(), page);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean audit(WarningAuditDto dto) {
|
||||||
|
WarningRuleInfo info = this.getById(dto.getId());
|
||||||
|
if (info == null) {
|
||||||
|
throw new IllegalArgumentException("id不存在");
|
||||||
|
}
|
||||||
|
if (dto.getType() == 1) {
|
||||||
|
if (!info.getFirstAuditUserId().equals(SecurityUtils.getUserId())) {
|
||||||
|
throw new IllegalArgumentException("对不起,您没有审核权限");
|
||||||
|
}
|
||||||
|
info.setFirstAuditStatus(dto.getStatus());
|
||||||
|
info.setFirstAuditTime(LocalDateTime.now());
|
||||||
|
if (info.getSecondAuditUserId() == null){
|
||||||
|
info.setStatus(dto.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dto.getType() == 2) {
|
||||||
|
if (!info.getSecondAuditUserId().equals(SecurityUtils.getUserId())) {
|
||||||
|
throw new IllegalArgumentException("对不起,您没有审核权限");
|
||||||
|
}
|
||||||
|
info.setSecondAuditStatus(dto.getStatus());
|
||||||
|
info.setSecondAuditTime(LocalDateTime.now());
|
||||||
|
info.setStatus(dto.getStatus());
|
||||||
|
}
|
||||||
|
return this.updateById(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,15 +102,10 @@ public class WarningRuleTask {
|
||||||
String ruleInfo = generateRuleInfo(conditions);
|
String ruleInfo = generateRuleInfo(conditions);
|
||||||
|
|
||||||
WarningRuleInfo warningRuleInfo = new WarningRuleInfo();
|
WarningRuleInfo warningRuleInfo = new WarningRuleInfo();
|
||||||
// warningRuleInfo.setCreateName(warningRule.getCreateName());
|
|
||||||
warningRuleInfo.setRuleId(warningRule.getId());
|
warningRuleInfo.setRuleId(warningRule.getId());
|
||||||
// warningRuleInfo.setRuleName(warningRule.getRuleName());
|
|
||||||
warningRuleInfo.setConditions(conditions);
|
warningRuleInfo.setConditions(conditions);
|
||||||
warningRuleInfo.setCreateTime(LocalDateTime.now());
|
warningRuleInfo.setCreateTime(LocalDateTime.now());
|
||||||
warningRuleInfo.setRuleInfo(ruleInfo);
|
warningRuleInfo.setStatus(0);
|
||||||
warningRuleInfo.setWarningType(warningType);
|
|
||||||
warningRuleInfo.setWarningLevel(warningRule.getWarningLevel());
|
|
||||||
warningRuleInfo.setStatus(warningRule.getStatus());
|
|
||||||
warningRuleInfoService.save(warningRuleInfo);
|
warningRuleInfoService.save(warningRuleInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue