Compare commits

...

4 Commits

Author SHA1 Message Date
wany eddb6d85c7 审批流程配置,预警规则,影响区联络信息 2026-02-27 16:33:33 +08:00
wany a6e17a5154 大屏部分接口修改 2026-02-08 17:44:18 +08:00
wany 2641ac9282 大屏部分接口修改 2026-02-08 14:38:22 +08:00
wany 392f17b857 大屏部分接口修改 2026-02-08 13:56:19 +08:00
33 changed files with 673 additions and 202 deletions

View File

@ -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 = "线上测试环境"
)
}

View File

@ -17,10 +17,16 @@ public class OpenApiConfig {
@Bean
public GroupedOpenApi openApi() {
String[] packagesToScan = {
"com.gunshi.project.hsz.controller",
"com.gunshi.project.ss.controller",
};
String[] pathsToMatch = {
"/impactZoneInfo/**",
"/auditProcess/**",
"/warningRule/**"
};
return GroupedOpenApi.builder()
.group("hsz")
.group("ss")
.pathsToMatch(pathsToMatch)
.packagesToScan(packagesToScan)
.build();
}

View File

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

View File

@ -4,12 +4,12 @@ package com.gunshi.project.ss.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.core.result.R;
import com.gunshi.project.ss.entity.so.FundBudgetPageSo;
import com.gunshi.project.ss.mapper.FundBudgetMapper;
import com.gunshi.project.ss.model.FileAssociations;
import com.gunshi.project.ss.model.FundBudget;
import com.gunshi.project.ss.service.FileAssociationsService;
import com.gunshi.project.ss.service.FundBudgetService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -49,6 +49,12 @@ public class FundBudgetController extends AbstractCommonFileController {
return R.ok(page);
}
@Operation(description = "统计")
@GetMapping("stat")
public R<FundBudget> stat(@RequestParam(value = "year",required = false) @Parameter(description = "年份") Integer year){
FundBudget res = fundBudgetService.stat(year);
return R.ok(res);
}
@Operation(description = "新增")
@PostMapping("/insert")

View File

@ -0,0 +1,80 @@
package com.gunshi.project.ss.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.entity.so.IaCFlrvvlgPageSo;
import com.gunshi.project.ss.model.ImpactZoneInfo;
import com.gunshi.project.ss.service.ImpactZoneInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils;
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="/impactZoneInfo")
public class ImpactZoneInfoController{
@Autowired
private ImpactZoneInfoService service;
@Operation(summary = "新增")
@PostMapping("/insert")
public R<ImpactZoneInfo> insert(@Validated(Insert.class) @RequestBody ImpactZoneInfo dto) {
if (StringUtils.isNotBlank(dto.getName())){
if (service.lambdaQuery().eq(ImpactZoneInfo::getName,dto.getName()).count() > 0) {
throw new IllegalArgumentException("当前名称已存在");
}
}
boolean result = service.save(dto);
return R.ok(result ? dto : null);
}
@Operation(summary = "修改")
@PostMapping("/update")
public R<ImpactZoneInfo> update(@Validated(Update.class) @RequestBody ImpactZoneInfo 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 = "列表")
@PostMapping("/list")
public R<List<ImpactZoneInfo>> list() {
return R.ok(service.lambdaQuery().list());
}
@Operation(summary = "分页")
@PostMapping("/page")
public R<Page<ImpactZoneInfo>> page(@RequestBody IaCFlrvvlgPageSo pageSo) {
Page<ImpactZoneInfo> page = service.pageInfo(pageSo);
return R.ok(page);
}
}

View File

@ -97,6 +97,9 @@ public class ResPlanBController extends AbstractCommonFileController{
if (StringUtils.isNotBlank(so.getType())){
query.eq(ResPlanB::getType, so.getType());
}
if (so.getIsAvailable() != null){
query.eq(ResPlanB::getIsAvailable, so.getIsAvailable());
}
query.orderByDesc(ResPlanB::getModitime);
List<ResPlanB> list = query.list();

View File

@ -15,7 +15,7 @@ import java.util.Map;
@Tag(name = "维护养护-日常养护记录")
@RestController
@RequestMapping(value="/screen/mfr")
@RequestMapping(value="/screen/mfr")
public class ScreenMfrController {
@Autowired

View File

@ -3,10 +3,8 @@ package com.gunshi.project.ss.controller;
import com.gunshi.core.result.R;
import com.gunshi.project.ss.entity.vo.ScreenPositionTrainingVo;
import com.gunshi.project.ss.model.FileAssociations;
import com.gunshi.project.ss.model.ResPerson;
import com.gunshi.project.ss.service.FileAssociationsService;
import com.gunshi.project.ss.service.PersonnelPlanService;
import com.gunshi.project.ss.service.ScreenResponsibilityService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,8 +22,6 @@ public class ScreenResponsibilityController {
@Autowired
private ScreenResponsibilityService screenResponsibilityService;
@Autowired
private FileAssociationsService fileService;
@ -45,9 +41,9 @@ public class ScreenResponsibilityController {
@GetMapping("/getTraining")
public R<ScreenPositionTrainingVo> getTraining(){
ScreenPositionTrainingVo vo = screenResponsibilityService.getTraining();
if(vo.getLatestPersonnelPlan() != null){
List<FileAssociations> files = fileService.getFiles(getGroupId(), vo.getLatestPersonnelPlan().getId().toString());
vo.getLatestPersonnelPlan().setFiles(files);
if(vo.getLatestPersonnelLog() != null){
vo.getLatestPersonnelLog().setFiles1(fileService.getFiles(getGroupId(),vo.getLatestPersonnelLog().getId().toString(),"1"));
vo.getLatestPersonnelLog().setFiles2(fileService.getFiles(getGroupId(),vo.getLatestPersonnelLog().getId().toString(),"2"));
}
return R.ok(vo);
}

View File

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

View File

@ -16,4 +16,7 @@ public class IaCFlrvvlgPageSo {
private String name;
private String phone;
@Schema(description="状态0启用 1停用")
private Integer status;
}

View File

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

View File

@ -1,7 +1,7 @@
package com.gunshi.project.ss.entity.vo;
import com.gunshi.project.ss.model.PersonnelPlan;
import com.gunshi.project.ss.model.PersonnelPlanLog;
import lombok.Data;
@Data
@ -9,7 +9,7 @@ public class ScreenPositionTrainingVo {
//培训计划数量
private Long trainingCount;
private Integer trainingCount;
//已开展
private Long hasTraining;
@ -18,9 +18,9 @@ public class ScreenPositionTrainingVo {
private Long hasNoTraining;
//参训总人次
private Long totalTraining;
private Integer totalTraining;
//最新培训内容
private PersonnelPlan latestPersonnelPlan;
private PersonnelPlanLog latestPersonnelLog;
}

View File

@ -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> {
}

View File

@ -0,0 +1,10 @@
package com.gunshi.project.ss.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gunshi.project.ss.model.ImpactZoneInfo;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ImpactZoneInfoMapper extends BaseMapper<ImpactZoneInfo> {
}

View File

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

View File

@ -0,0 +1,98 @@
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.impact_zone_info")
public class ImpactZoneInfo implements Serializable {
public final static String thisTableName = "ImpactZoneInfo";
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;
/**
*
*/
@TableField(value="name")
@Schema(description="姓名")
@Size(max = 100,message = "姓名最大长度要小于 100")
private String name;
/**
*
*/
@TableField(value="org_name")
@Schema(description="单位")
@Size(max = 100,message = "单位最大长度要小于 100")
private String orgName;
/**
*
*/
@TableField(value="post_name")
@Schema(description="职务")
@Size(max = 100,message = "职务最大长度要小于 100")
private String postName;
/**
*
*/
@TableField(value="tel")
@Schema(description="联系方式")
private String tel;
/**
*
*/
@TableField(value="ass_impact_zone")
@Schema(description="关联影响区")
@Size(max = 500,message = "关联影响区最大长度要小于 500")
private String assImpactZone;
/**
*
*/
@TableField(value="main_duty")
@Schema(description="主要职责")
@Size(max = 500,message = "主要职责最大长度要小于 500")
private String mainDuty;
/**
* 0 1
*/
@TableField(value="status")
@Schema(description="状态0启用 1停用")
private Integer status;
@TableField("create_time")
@Schema(description = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
}

View File

@ -49,10 +49,10 @@ public class ResPerson extends CommUpdate implements Serializable {
private String name;
/**
* ,0:,1:,2:,3:,4:
* ,1:,2:,3:,4:,5:
*/
@TableField(value="type")
@Schema(description="类型,0:行政,1:主管部门,2:管理单位,3:巡查,4:技术")
@Schema(description="类型,1:行政,2:主管部门,3:管理单位,4:巡查,5:技术")
@NotNull(message = "责任类型不能为空")
private Integer type;

View File

@ -64,7 +64,6 @@ public class ResPlanB implements Serializable {
*/
@TableField(value="prep_time")
@Schema(description="编制时间")
// @Size(max = 0,message = "编制时间最大长度要小于 0")
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date prepTime;
@ -81,7 +80,6 @@ public class ResPlanB implements Serializable {
*/
@TableField(value="appr_time")
@Schema(description="批复时间")
// @Size(max = 0,message = "批复时间最大长度要小于 0")
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date apprTime;
@ -98,7 +96,6 @@ public class ResPlanB implements Serializable {
*/
@TableField(value="file_id")
@Schema(description="文件id")
// @Size(max = 0,message = "文件id最大长度要小于 0")
private Long fileId;
/**
@ -106,7 +103,6 @@ public class ResPlanB implements Serializable {
*/
@TableField(value="type")
@Schema(description="类型1防汛预案 2调度规程")
// @Size(max = 0,message = "类型1防汛预案 2调度规程最大长度要小于 0")
private Integer type;
/**
@ -114,7 +110,6 @@ public class ResPlanB implements Serializable {
*/
@TableField(value="moditime")
@Schema(description="时间戳")
// @Size(max = 0,message = "时间戳最大长度要小于 0")
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date moditime;

View File

@ -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 = "用地总面积(万亩)文件")

View File

@ -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,46 +40,34 @@ 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-
@ -76,12 +75,6 @@ public class WarningCondition {
@TableField("relation_type")
private String relationType;
@TableField("warning_level")
private Integer warningLevel;
@TableField("year")
private String year;
@TableField(exist = false)
private Boolean isEnjoy = false;//该预警规则是否满足条件,默认不满足
}

View File

@ -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;
/**
*
*/

View File

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

View File

@ -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>
{
}

View File

@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.ss.entity.so.FundBudgetPageSo;
import com.gunshi.project.ss.mapper.FundBudgetMapper;
import com.gunshi.project.ss.model.FundBudget;
import io.jsonwebtoken.lang.Collections;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@Service
@Slf4j
@ -24,6 +26,7 @@ public class FundBudgetService extends ServiceImpl<FundBudgetMapper, FundBudget
if(pageSo.getBudgetYear() != null){
queryWrapper.eq(FundBudget::getBudgetYear, pageSo.getBudgetYear());
}
queryWrapper.orderByDesc(FundBudget::getBudgetYear);
Page<FundBudget> fundBudgetPage = baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
return fundBudgetPage;
}
@ -67,4 +70,20 @@ public class FundBudgetService extends ServiceImpl<FundBudgetMapper, FundBudget
FundBudget one = baseMapper.selectOne(queryWrapper);
return one;
}
public FundBudget stat(Integer year) {
FundBudget fundBudget = new FundBudget();
LambdaQueryWrapper<FundBudget> queryWrapper = new LambdaQueryWrapper<>();
if(year != null){
queryWrapper.eq(FundBudget::getBudgetYear, year);
}
List<FundBudget> list = baseMapper.selectList(queryWrapper);
if (Collections.isEmpty(list)){
return fundBudget;
}
fundBudget.setAnnualIncomeBudget(list.stream().map(FundBudget::getAnnualIncomeBudget).reduce(BigDecimal.ZERO,BigDecimal::add));
fundBudget.setAnnualExpenditureBudget(list.stream().map(FundBudget::getAnnualExpenditureBudget).reduce(BigDecimal.ZERO,BigDecimal::add));
fundBudget.setBudgetBalance(list.stream().map(FundBudget::getBudgetBalance).reduce(BigDecimal.ZERO,BigDecimal::add));
return fundBudget;
}
}

View File

@ -0,0 +1,39 @@
package com.gunshi.project.ss.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.project.ss.entity.so.IaCFlrvvlgPageSo;
import com.gunshi.project.ss.entity.vo.HomeIaCBsnssinfoVo;
import com.gunshi.project.ss.mapper.IaCBsnssinfoMapper;
import com.gunshi.project.ss.mapper.ImpactZoneInfoMapper;
import com.gunshi.project.ss.model.IaCBsnssinfo;
import com.gunshi.project.ss.model.ImpactZoneInfo;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class ImpactZoneInfoService extends ServiceImpl<ImpactZoneInfoMapper, ImpactZoneInfo>
{
public Page<ImpactZoneInfo> pageInfo(IaCFlrvvlgPageSo pageSo) {
LambdaQueryWrapper<ImpactZoneInfo> queryWrapper = new LambdaQueryWrapper<>();
if(!StringUtils.isEmpty(pageSo.getName())){
queryWrapper.like(ImpactZoneInfo::getName, pageSo.getName());
}
if(pageSo.getStatus() != null){
queryWrapper.eq(ImpactZoneInfo::getStatus, pageSo.getStatus());
}
queryWrapper.orderByDesc(ImpactZoneInfo::getCreateTime);
return this.baseMapper.selectPage(pageSo.getPageSo().toPage(), queryWrapper);
}
}

View File

@ -1,7 +1,6 @@
package com.gunshi.project.ss.service;
import com.gunshi.core.result.R;
import com.gunshi.project.ss.model.ResPlanB;
import com.gunshi.project.ss.model.RotaB;
import lombok.extern.slf4j.Slf4j;

View File

@ -11,7 +11,6 @@ import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@ -29,42 +28,36 @@ public class ScreenResponsibilityService {
public ScreenPositionTrainingVo getTraining() {
ScreenPositionTrainingVo vo = new ScreenPositionTrainingVo();
List<PersonnelPlan> list = personnelPlanService.lambdaQuery().orderByDesc(PersonnelPlan::getCreateTime).list();
vo.setTrainingCount(Long.valueOf(list.size()));
vo.setTrainingCount(list.size());
//已开展
List<Long> ids = list.stream().map(o -> o.getId()).collect(Collectors.toList());
Long hasTraining = 0l;
Long hasNoTraining = 0l;
Long totalTraining = 0L;
//TODO 这里N+1问题自己去解决一下吧我懒得改了。
for (Long id : ids) {
List<PersonnelPlanLog> logs = personnelPlanLogService.lambdaQuery().eq(PersonnelPlanLog::getPlanId, id).list();
if(logs.isEmpty()){
hasNoTraining++;
}else{
hasTraining++;
totalTraining += logs.stream().mapToLong(o -> o.getNumPeople()).sum();
}
List<Long> ids = list.stream().map(PersonnelPlan::getId).toList();
List<PersonnelPlanLog> logs = personnelPlanLogService.lambdaQuery().orderByDesc(PersonnelPlanLog::getCreateTime).list();
if(logs.isEmpty()){
vo.setTotalTraining(0);
vo.setHasTraining(0L);
vo.setHasNoTraining(0L);
return vo;
}
vo.setLatestPersonnelLog(logs.getFirst());
vo.setTotalTraining(logs.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum());
//已开展数量
Long hasTraining = logs.stream().map(PersonnelPlanLog::getPlanId).filter(planId ->ids.contains(planId)).distinct().count();
vo.setHasTraining(hasTraining);
vo.setHasNoTraining(hasNoTraining);
vo.setTotalTraining(totalTraining);
if(!list.isEmpty()){
PersonnelPlan personnelPlan = list.get(0);
vo.setLatestPersonnelPlan(personnelPlan);
}
vo.setHasNoTraining(vo.getTrainingCount() - hasTraining);
return vo;
}
public List<ResPerson> getPerson() {
List<ResPerson> list = resPersonService.lambdaQuery().in(ResPerson::getType, Arrays.asList(0, 1, 2))
List<ResPerson> list = resPersonService.lambdaQuery().in(ResPerson::getType, Arrays.asList(1, 2, 3))
.orderByDesc(ResPerson::getCreateTime)
.list();
return list;
}
public List<ResPerson> getFxPerson() {
List<ResPerson> list = resPersonService.lambdaQuery().in(ResPerson::getType, Arrays.asList(0, 3, 4))
List<ResPerson> list = resPersonService.lambdaQuery().in(ResPerson::getType, Arrays.asList(1, 4, 5))
.orderByDesc(ResPerson::getCreateTime)
.list();
return list;

View File

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

View File

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

View File

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

View File

@ -1,8 +1,6 @@
package com.gunshi.project.ss.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.gunshi.project.ss.entity.vo.ScreenSecurityCheckVo;
import com.gunshi.project.ss.entity.vo.WholeCycleVo;
import com.gunshi.project.ss.model.*;

View File

@ -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:

View File

@ -1,25 +1,25 @@
spring:
profiles:
active: dev
active: local
datasource:
dynamic:
datasource:
master:
url: jdbc:postgresql://localhost:5432/ss?stringtype=unspecified
username: postgres
password: postgres
url: jdbc:postgresql://10.0.41.112:5432/ss?stringtype=unspecified
username: gunshiiot
password: 1234567a
driver-class-name: org.postgresql.Driver
access-logging:
url: jdbc:postgresql://localhost:5432/ss
username: postgres
password: postgres
url: jdbc:postgresql://10.0.41.112:5432/ss
username: gunshiiot
password: 1234567a
driver-class-name: org.postgresql.Driver
data:
redis:
host: localhost
host: r-wz9168ab2f2f7ec4pd.redis.rds.aliyuncs.com
port: 6379
#password: 1234567a
database: 0
password: CoWR1111
database: 9
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
@ -38,10 +38,32 @@ gunshi:
# 洪水预测数据库连接信息
algorithem:
datasource:
url: jdbc:postgresql://localhost:5432/ss?stringtype=unspecified
username: postgres
password: postgres
url: jdbc:postgresql://10.0.41.112:5432/ss?stringtype=unspecified
username: gunshiiot
password: 1234567a
driver-class-name: org.postgresql.Driver
jcskPath: http://64.97.142.113:8002/shareddata/api/v1/monitdata
jcskToken: FB1EE57468E0CB9A51306F9056A534776A505E95AB687866AD05EA91C61B1444D210FF3E3033E268869C0C0D788770D4DE62078895538CF5BA652F6F1C751D24
jcskToken: FB1EE57468E0CB9A51306F9056A534776A505E95AB687866AD05EA91C61B1444D210FF3E3033E268869C0C0D788770D4DE62078895538CF5BA652F6F1C751D24
knife4j:
enable: true
setting:
language: zh-CN
enable-swagger-models: true
swagger-model-name: OpenAPI 3.0 Models
cache:
enabled: true # 启用缓存
max-size: 1000 # 缓存最大数量
expire-after-write: 10m # 写入后过期时间
basic:
enable: false # 不需要basic认证可以关闭
username:
password:
response:
cache:
enabled: true
max-age: 3600