修改了很多很多BUG
parent
58bafbf409
commit
56333a6227
|
|
@ -18,7 +18,8 @@ public interface StRiverRMapper extends BaseMapper<StRiverR> {
|
|||
|
||||
@Select("""
|
||||
<script>
|
||||
select * from st_river_r t1
|
||||
select t1.*,t2.stnm,t2.lgtd,t2.lttd from st_river_r t1
|
||||
left join st_stbprp_b t2 on t1.stcd = t2.stcd
|
||||
where 1=1
|
||||
<if test="stcd != null and stcd != ''">
|
||||
and t1.stcd = #{stcd}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,11 @@ public interface StRsvrRMapper extends BaseMapper<StRsvrR> {
|
|||
* 根据stcd获取8点的rz
|
||||
*/
|
||||
@Select("""
|
||||
select rz from public.st_rsvr_r
|
||||
where stcd = #{stcd}
|
||||
select rz
|
||||
from public.st_rsvr_r
|
||||
where stcd = '232'
|
||||
and tm <= date_trunc('day', now()) + interval '8 hours'
|
||||
and tm >= now() - interval '24 hours' -- 增加这个条件
|
||||
order by tm desc
|
||||
limit 1
|
||||
""")
|
||||
|
|
@ -36,9 +38,11 @@ public interface StRsvrRMapper extends BaseMapper<StRsvrR> {
|
|||
* 根据stcd获取昨日8点的rz
|
||||
*/
|
||||
@Select("""
|
||||
select rz from public.st_rsvr_r
|
||||
select rz
|
||||
from public.st_rsvr_r
|
||||
where stcd = #{stcd}
|
||||
and tm <= date_trunc('day', now() - interval '1 day') + interval '8 hours'
|
||||
and tm >= date_trunc('day', now() - interval '1 day') + interval '7 hours 50 minutes'
|
||||
and tm <= date_trunc('day', now() - interval '1 day') + interval '8 hours 10 minutes'
|
||||
order by tm desc
|
||||
limit 1
|
||||
""")
|
||||
|
|
|
|||
|
|
@ -155,4 +155,13 @@ public class StRiverR implements Serializable {
|
|||
@Schema(description="source_int")
|
||||
private Integer sourceInt;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String stnm;
|
||||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal lgtd;
|
||||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal lttd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class AttCctvBaseController {
|
|||
@Operation(summary = "获取预览地址")
|
||||
@GetMapping("/preview/{indexCode}")
|
||||
public R<String> preview(@PathVariable("indexCode") String indexCode) {
|
||||
String api = "http://223.75.53.141:81/isc/liveAddressLimited?cameraIndexCode=%s&protocol=ws&token=111";
|
||||
String api = "http://10.42.6.68:7000/liveAddressLimited?cameraIndexCode=%s&protocol=ws&token=111";
|
||||
OkHttpClient client = OkHttpUtil.build();
|
||||
String ret = null;
|
||||
try {
|
||||
|
|
@ -172,7 +172,7 @@ public class AttCctvBaseController {
|
|||
Integer action = vo.getAction();
|
||||
Integer speed = vo.getSpeed();
|
||||
String command = vo.getCommand();
|
||||
String api = "http://223.75.53.141:81/isc/controlling?cameraIndexCode="+indexCode+"&action="+action+"&speed="+speed+"&command="+command+"&token=111";
|
||||
String api = "http://10.42.6.68:7000/controlling?cameraIndexCode="+indexCode+"&action="+action+"&speed="+speed+"&command="+command+"&token=111";
|
||||
OkHttpClient client = OkHttpUtil.build();
|
||||
String ret = null;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.gunshi.project.hsz.controller;
|
||||
|
||||
import com.gunshi.core.annotation.Post;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.hsz.entity.so.RainfallAnalysisSo;
|
||||
import com.gunshi.project.hsz.entity.vo.RainfallAnalysisVo;
|
||||
import com.gunshi.project.hsz.service.CurrentFormAnalysisService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @ClassName CurrentFormAnalysisController
|
||||
* @Author Huang Qianxiang
|
||||
* @Date 2024/3/12 17:39
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/analysis")
|
||||
@Tag(name = "防汛调度-当前形势分析-降雨分析")
|
||||
public class CurrentFormAnalysisController {
|
||||
|
||||
@Resource
|
||||
private CurrentFormAnalysisService currentFormAnalysisService;
|
||||
|
||||
@Post(path = "/rainfallAnalysis",summary = "当前形势分析-降雨分析")
|
||||
public R<Map<Integer,List<RainfallAnalysisVo>>> rainfallAnalysis(@RequestBody RainfallAnalysisSo rainfallAnalysisSo){
|
||||
return R.ok(currentFormAnalysisService.rainfallAnalysis(rainfallAnalysisSo));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.gunshi.project.hsz.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@Tag(name = "流量表")
|
||||
@RestController
|
||||
@RequestMapping(value="/stFlowR")
|
||||
public class StFlowRController {
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,8 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.gunshi.project.hsz.model.StWaterR;
|
||||
import com.gunshi.project.hsz.service.StWaterRService;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -49,6 +51,9 @@ public class StWaterRRealController {
|
|||
@Autowired
|
||||
private ResMonthEcoFlowService resMonthEcoFlowService;
|
||||
|
||||
@Autowired
|
||||
private StWaterRService stWaterRService;
|
||||
|
||||
@Operation(summary = "根据测站编码查询实时供水量")
|
||||
@PostMapping("/getByStcd/{stcd}")
|
||||
public R<StWaterRReal> getById(@Schema(name = "stcd", description = "测站编码")@PathVariable("stcd") @NotNull String stcd) {
|
||||
|
|
@ -100,10 +105,5 @@ public class StWaterRRealController {
|
|||
return R.ok(list);
|
||||
}
|
||||
|
||||
// @Operation(summary = "分页")
|
||||
// @PostMapping("/page")
|
||||
public R<List<StWaterRReal>> page() {
|
||||
return R.ok(service.page(null,null));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.gunshi.project.hsz.entity.so;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @ClassName RainfallAnalysisSo
|
||||
* @Author Huang Qianxiang
|
||||
* @Date 2024/3/12 16:33
|
||||
*/
|
||||
@Data
|
||||
public class RainfallAnalysisSo {
|
||||
|
||||
@Schema(description="频率统计中时间段范围类型 1:1小时 3:3小时 6:6小时 12:12小时 24:24小时")
|
||||
private Integer timeType;
|
||||
|
||||
@Schema(description="来源 只能是SH SW SK QX这4种")
|
||||
@Size(min = 1, message = "来源不能为空")
|
||||
private List<String> source;
|
||||
|
||||
}
|
||||
|
|
@ -2,8 +2,11 @@ package com.gunshi.project.hsz.entity.so;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class RealRainBaseSo {
|
||||
|
|
@ -15,4 +18,26 @@ public class RealRainBaseSo {
|
|||
@NotBlank(message = "结束时间不能为空")
|
||||
private String etm;
|
||||
|
||||
@Schema(description="行政区划15位")
|
||||
private String adcd;
|
||||
|
||||
@Schema(description="流域编码")
|
||||
private String basCode;
|
||||
|
||||
@Schema(description="来源 只能是SH SW SK QX这4种")
|
||||
@Size(min = 1, message = "来源不能为空")
|
||||
private List<String> source;
|
||||
|
||||
@Schema(description="查询类型 1:量级统计 2:频率统计 3:流域降雨 4:区域降雨")
|
||||
private Integer queryType;
|
||||
|
||||
@Schema(description="频率统计中时间段范围类型 1:1小时 3:3小时 6:6小时 12:12小时 24:24小时")
|
||||
private Integer timeType;
|
||||
|
||||
@Schema(description = "站点模糊查询参数")
|
||||
private String stArg;
|
||||
|
||||
@Schema(description="APP中雨情排序 1:按昨日降雨降序 2:按时段雨量降序")
|
||||
private Integer orderType = 2;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package com.gunshi.project.hsz.entity.vo;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AiWarningVo {
|
||||
|
||||
@Schema(description = "视频点名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "告警时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime warningTime;
|
||||
|
||||
private BigDecimal lgtd;
|
||||
|
||||
private BigDecimal lttd;
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
|
|
@ -16,29 +17,17 @@ import java.util.List;
|
|||
@Data
|
||||
public class HomeWarnVo {
|
||||
|
||||
@Schema(description = "水位告警")
|
||||
private String rzWarn;
|
||||
|
||||
@Schema(description="气象告警")
|
||||
private List<QXWarningVo> qxWarn;
|
||||
@Schema(description = "水库预警")
|
||||
private Map<String,List<SKWarningVo>> skWarningVoMap;
|
||||
|
||||
@Schema(description="位移告警")
|
||||
private List<OsmoticWarnVo> shiftWarn;
|
||||
@Schema(description = "河道预警")
|
||||
private Map<String,List<RiverWarningVo>> riverWarningVoMap;
|
||||
|
||||
@Schema(description="渗压告警")
|
||||
private List<OsmoticWarnVo> pressWarn;
|
||||
@Schema(description = "大坝安全监测预警")
|
||||
private Map<String,List<OsmoticWarnVo>> osmoticWarnVoMap;
|
||||
|
||||
@Schema(description="渗流告警")
|
||||
private List<OsmoticWarnVo> flowWarn;
|
||||
|
||||
@Schema(description = "超河道警告 上游")
|
||||
private String overRvUp;
|
||||
|
||||
@Schema(description = "超河道警告 下游")
|
||||
private String overRvDown;
|
||||
|
||||
|
||||
@Schema(description="AI告警个数")
|
||||
private Long aiWarnCount;
|
||||
@Schema(description = "AI告警监测")
|
||||
private Map<String,List<AiWarningVo>> aiWarnVoMap;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,4 +59,10 @@ public class OsmoticWarnVo extends OsmoticWarnRule {
|
|||
*/
|
||||
@Schema(description="监测类型(1渗压 2渗流 3位移)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "预警描述")
|
||||
private String direction;
|
||||
|
||||
@Schema(description = "预警等级")
|
||||
private String warnLevel;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.gunshi.project.hsz.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @ClassName RainfallAnalysisVo
|
||||
* @Author Huang Qianxiang
|
||||
* @Date 2024/3/12 16:24
|
||||
*/
|
||||
@Data
|
||||
public class RainfallAnalysisVo {
|
||||
private String stcd;
|
||||
private String stnm;
|
||||
private String stlc;
|
||||
private Double drp;
|
||||
private String adcd;
|
||||
private String adnm;
|
||||
private String basCode;
|
||||
private String basName;
|
||||
private String lgtd;
|
||||
private String lttd;
|
||||
private String source;
|
||||
@Schema(description = "降雨分析等级 0: 暴雨 1: 大暴雨 2: 特大暴雨 3: 50年一遇以上 4: 100年一遇以上")
|
||||
private Integer level;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.gunshi.project.hsz.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
* @version 1.0
|
||||
* @date 2024/3/11
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class RealRainStatListVo {
|
||||
private String stcd;
|
||||
private String sttp;
|
||||
private String stnm;
|
||||
private String stlc;
|
||||
private Double h1;
|
||||
private Double h3;
|
||||
private Double h6;
|
||||
private Double h12;
|
||||
private Double h24;
|
||||
private Date tm;
|
||||
private String adcd;
|
||||
private String adnm;
|
||||
private String basCode;
|
||||
private String basName;
|
||||
private String lgtd;
|
||||
private String lttd;
|
||||
private String source;
|
||||
@Schema(description="重现期频率 1:5~10年一遇 2:10~20年一遇 3:20~50年一遇 4:50~100年一遇 5:超100年一遇")
|
||||
private Integer freqH1;
|
||||
@Schema(description="重现期频率 1:5~10年一遇 2:10~20年一遇 3:20~50年一遇 4:50~100年一遇 5:超100年一遇")
|
||||
private Integer freqH3;
|
||||
@Schema(description="重现期频率 1:5~10年一遇 2:10~20年一遇 3:20~50年一遇 4:50~100年一遇 5:超100年一遇")
|
||||
private Integer freqH6;
|
||||
@Schema(description="重现期频率 1:5~10年一遇 2:10~20年一遇 3:20~50年一遇 4:50~100年一遇 5:超100年一遇")
|
||||
private Integer freqH12;
|
||||
@Schema(description="重现期频率 1:5~10年一遇 2:10~20年一遇 3:20~50年一遇 4:50~100年一遇 5:超100年一遇")
|
||||
private Integer freqH24;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.gunshi.project.hsz.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RiverWarningVo {
|
||||
@Schema(description = "站点编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "站点名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private BigDecimal lgtd;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private BigDecimal lttd;
|
||||
|
||||
@Schema(description = "告警内容")
|
||||
private String rzWarn;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.gunshi.project.hsz.entity.vo;
|
||||
|
||||
|
||||
import com.itextpdf.layout.properties.BackgroundImage;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SKWarningVo {
|
||||
|
||||
@Schema(description = "站点编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "站点名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private BigDecimal lgtd;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private BigDecimal lttd;
|
||||
|
||||
@Schema(description = "告警内容")
|
||||
private String rzWarn;
|
||||
}
|
||||
|
|
@ -3,17 +3,40 @@ package com.gunshi.project.hsz.entity.vo;
|
|||
import com.gunshi.project.hsz.entity.vo.StStatusVo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.bouncycastle.cert.dane.DANEEntry;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StStatusListVo {
|
||||
|
||||
@Schema(description = "在线个数")
|
||||
private Integer onlineCount;
|
||||
|
||||
@Schema(description = "离线")
|
||||
private List<StStatusVo> offLine;
|
||||
@Schema(description = "离线个数")
|
||||
private Integer offLineCount;
|
||||
|
||||
@Schema(description = "在线")
|
||||
@Schema(description = "报到率")
|
||||
private BigDecimal reportPercentage;
|
||||
|
||||
@Schema(description = "雨量站")
|
||||
private List<StStatusVo> rainStation;
|
||||
|
||||
@Schema(description = "水库水位站")
|
||||
private List<StStatusVo> rsvrStation;
|
||||
|
||||
@Schema(description = "河道水位站")
|
||||
private List<StStatusVo> riverStation;
|
||||
|
||||
@Schema(description = "流量站")
|
||||
private List<StStatusVo> flowStation;
|
||||
|
||||
@Schema(description = "流量站")
|
||||
private List<StStatusVo> online;
|
||||
|
||||
@Schema(description = "流量站")
|
||||
private List<StStatusVo> offLine;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,4 +18,7 @@ public class StStatusVo {
|
|||
@Schema(description = "测站名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "状态 0 离线 1在线")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,4 +313,23 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
|||
""")
|
||||
List<AttResBaseVo> queryYhd(@Param("stcd") String stcd);
|
||||
|
||||
|
||||
@Select("""
|
||||
select t.stcd,t.stnm,t.lgtd lgtd,t.lttd lttd,t.source,t.sttp,t.stlc,t.adcd,t.esstym,s.res_code,s.fl_low_lim_lev,
|
||||
s.tot_cap,s.ben_res_cap,s.norm_wat_lev,s.crest_elev,s.des_flood_lev,s.dead_lev,s.cal_flood_lev,s.wat_shed_area,s.dead_cap,sad.adnm,
|
||||
m.tm,m.rz,(m.rz-s.fl_low_lim_lev) as aFsltdz,sprr.tm as drpTm,sprr.h1,sprr.h3,sprr.h6,sprr.h12,sprr.h24,sprr.today,
|
||||
case when s.cal_flood_lev is not null and m.rz-s.cal_flood_lev >= 0 then 1 else 0 end as calState,
|
||||
case when s.des_flood_lev is not null and m.rz-s.des_flood_lev >= 0 then 1 else 0 end as desState,
|
||||
case when s.fl_low_lim_lev is not null and m.rz-s.fl_low_lim_lev >= 0 then 1 else 0 end as flState
|
||||
from public.st_stbprp_b t
|
||||
left join public.att_res_base s on 1=1
|
||||
left join public.st_addvcd_d sad on t.adcd = sad.adcd
|
||||
left join public.st_rsvr_r_real m on t.stcd = m.stcd
|
||||
left join public.st_pptn_r_real sprr on t.stcd = sprr.stcd
|
||||
join public.st_stbprp_b_elem stbe on t.stcd = stbe.stcd
|
||||
where stbe.elem ='rz'
|
||||
order by aFsltdz desc nulls last
|
||||
""")
|
||||
List<AttResBaseVo> queryList2();
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.hsz.mapper;
|
|||
|
||||
import com.gunshi.project.hsz.entity.vo.ForeRainVo;
|
||||
import com.gunshi.project.hsz.entity.vo.RealRainListVo;
|
||||
import com.gunshi.project.hsz.entity.vo.RealRainStatListVo;
|
||||
import com.gunshi.project.hsz.entity.vo.StPptnVo;
|
||||
import com.gunshi.project.hsz.model.StPptnRD;
|
||||
import com.gunshi.project.hsz.common.model.StPptnRReal;
|
||||
|
|
@ -136,4 +137,7 @@ public interface RealRainMapper {
|
|||
</script>
|
||||
""")
|
||||
List<ForeRainVo> querySttpList();
|
||||
|
||||
|
||||
List<RealRainStatListVo> getRealRainStatList(@Param("adcd") String adcd, @Param("basCode") String basCode, @Param("source") String source, @Param("stm") String stm, @Param("etm") String etm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,148 @@
|
|||
package com.gunshi.project.hsz.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 io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 流域基础信息表
|
||||
*/
|
||||
@Schema(description="流域基础信息表")
|
||||
@Data
|
||||
@TableName(value = "public.att_bas_base")
|
||||
public class AttBasBase implements Serializable {
|
||||
/**
|
||||
* 流域代码
|
||||
*/
|
||||
@TableId(value = "bas_code", type = IdType.INPUT)
|
||||
@Schema(description="流域代码")
|
||||
@Size(max = 18,message = "流域代码最大长度要小于 18")
|
||||
@NotBlank(message = "流域代码不能为空")
|
||||
private String basCode;
|
||||
|
||||
/**
|
||||
* 流域名称
|
||||
*/
|
||||
@TableField(value = "bas_name")
|
||||
@Schema(description="流域名称")
|
||||
@Size(max = 100,message = "流域名称最大长度要小于 100")
|
||||
private String basName;
|
||||
|
||||
/**
|
||||
* 左下角经度
|
||||
*/
|
||||
@TableField(value = "low_left_long")
|
||||
@Schema(description="左下角经度")
|
||||
private BigDecimal lowLeftLong;
|
||||
|
||||
/**
|
||||
* 左下角纬度
|
||||
*/
|
||||
@TableField(value = "low_left_lat")
|
||||
@Schema(description="左下角纬度")
|
||||
private BigDecimal lowLeftLat;
|
||||
|
||||
/**
|
||||
* 右上角经度
|
||||
*/
|
||||
@TableField(value = "up_right_long")
|
||||
@Schema(description="右上角经度")
|
||||
private BigDecimal upRightLong;
|
||||
|
||||
/**
|
||||
* 右上角纬度
|
||||
*/
|
||||
@TableField(value = "up_right_lat")
|
||||
@Schema(description="右上角纬度")
|
||||
private BigDecimal upRightLat;
|
||||
|
||||
/**
|
||||
* 跨界类型 未知 0 跨国并跨省 1 跨国 2 跨省 3 跨市 4 跨县 5 县界内 6
|
||||
*/
|
||||
@TableField(value = "cr_over_type")
|
||||
@Schema(description="跨界类型 未知 0 跨国并跨省 1 跨国 2 跨省 3 跨市 4 跨县 5 县界内 6")
|
||||
@Size(max = 1,message = "跨界类型 未知 0 跨国并跨省 1 跨国 2 跨省 3 跨市 4 跨县 5 县界内 6最大长度要小于 1")
|
||||
private String crOverType;
|
||||
|
||||
/**
|
||||
* 流域所属行政区 填名称
|
||||
*/
|
||||
@TableField(value = "bas_ad_name")
|
||||
@Schema(description="流域所属行政区 填名称")
|
||||
@Size(max = 100,message = "流域所属行政区 填名称最大长度要小于 100")
|
||||
private String basAdName;
|
||||
|
||||
/**
|
||||
* 流域级别 一级流域 1 二级流域 2 三级流域 3 四级流域 4 五级流域 5 六级流域 6 七级流域 7
|
||||
*/
|
||||
@TableField(value = "bas_grad")
|
||||
@Schema(description="流域级别 一级流域 1 二级流域 2 三级流域 3 四级流域 4 五级流域 5 六级流域 6 七级流域 7")
|
||||
@Size(max = 1,message = "流域级别 一级流域 1 二级流域 2 三级流域 3 四级流域 4 五级流域 5 六级流域 6 七级流域 7最大长度要小于 1")
|
||||
private String basGrad;
|
||||
|
||||
/**
|
||||
* 流域面积 km2
|
||||
*/
|
||||
@TableField(value = "bas_area")
|
||||
@Schema(description="流域面积 km2")
|
||||
private BigDecimal basArea;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "note")
|
||||
@Schema(description="备注")
|
||||
@Size(max = 256,message = "备注最大长度要小于 256")
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 记录生效时间
|
||||
*/
|
||||
@TableField(value = "eff_date")
|
||||
@Schema(description="记录生效时间")
|
||||
private Date effDate;
|
||||
|
||||
/**
|
||||
* 记录失效时间
|
||||
*/
|
||||
@TableField(value = "expr_date")
|
||||
@Schema(description="记录失效时间")
|
||||
private Date exprDate;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String COL_BAS_CODE = "bas_code";
|
||||
|
||||
public static final String COL_BAS_NAME = "bas_name";
|
||||
|
||||
public static final String COL_LOW_LEFT_LONG = "low_left_long";
|
||||
|
||||
public static final String COL_LOW_LEFT_LAT = "low_left_lat";
|
||||
|
||||
public static final String COL_UP_RIGHT_LONG = "up_right_long";
|
||||
|
||||
public static final String COL_UP_RIGHT_LAT = "up_right_lat";
|
||||
|
||||
public static final String COL_CR_OVER_TYPE = "cr_over_type";
|
||||
|
||||
public static final String COL_BAS_AD_NAME = "bas_ad_name";
|
||||
|
||||
public static final String COL_BAS_GRAD = "bas_grad";
|
||||
|
||||
public static final String COL_BAS_AREA = "bas_area";
|
||||
|
||||
public static final String COL_NOTE = "note";
|
||||
|
||||
public static final String COL_EFF_DATE = "eff_date";
|
||||
|
||||
public static final String COL_EXPR_DATE = "expr_date";
|
||||
}
|
||||
|
|
@ -58,6 +58,17 @@ public class ForecastDispatchPlan implements Serializable {
|
|||
@NotNull(message = "方案名称不能为空")
|
||||
private String forecastPlanName;
|
||||
|
||||
/**
|
||||
* 调度规程id
|
||||
*/
|
||||
@TableField(value = "res_plan_b_id")
|
||||
@Schema(description = "调度规程id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long resPlanBId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String resPlanBName;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.gunshi.project.hsz.common.validate.markers.Update;
|
|||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.bouncycastle.cert.dane.DANEEntry;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -47,6 +48,8 @@ public class ForecastDispatchResult implements Serializable {
|
|||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long planId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 最大入库流量(m³/s)
|
||||
*/
|
||||
|
|
@ -55,6 +58,13 @@ public class ForecastDispatchResult implements Serializable {
|
|||
@NotNull(message = "最大入库流量不能为空")
|
||||
private java.math.BigDecimal maxInflow;
|
||||
|
||||
@TableField(value = "max_inflow_date")
|
||||
@Schema(description = "最大入库流量时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime maxInflowDate;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 总入库水量(万m³)
|
||||
*/
|
||||
|
|
@ -76,6 +86,11 @@ public class ForecastDispatchResult implements Serializable {
|
|||
@Schema(description = "最高库水位(m)")
|
||||
private java.math.BigDecimal maxReservoirLevel;
|
||||
|
||||
@TableField(value = "max_reservoir_level_date")
|
||||
@Schema(description = "最高库水位时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime maxReservoirLevelDate;
|
||||
|
||||
/**
|
||||
* 超汛限水位值(m)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ public class TaskGroupHandler {
|
|||
// 小于1,就是0.5小时,转为分钟
|
||||
if(forecastTask.getTimeInterval().compareTo(BigDecimal.ONE) < 0){
|
||||
cronExpression = "0 0/" + Integer.valueOf(forecastTask.getTimeInterval().multiply(new BigDecimal(60)).setScale(0).toString()) + " * * * ?";
|
||||
}else if(forecastTask.getTimeInterval().compareTo(new BigDecimal(24)) == 0){
|
||||
cronExpression = "0 0 0 * * ?"; // 每天0点执行
|
||||
} else {
|
||||
cronExpression = "0 0 */" + Integer.valueOf(forecastTask.getTimeInterval().setScale(0).toString()) + " * * ?";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,106 @@
|
|||
package com.gunshi.project.hsz.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.gunshi.project.hsz.entity.so.RainfallAnalysisSo;
|
||||
import com.gunshi.project.hsz.entity.so.RealRainBaseSo;
|
||||
import com.gunshi.project.hsz.entity.vo.RainfallAnalysisVo;
|
||||
import com.gunshi.project.hsz.entity.vo.RealRainListVo;
|
||||
import com.gunshi.project.hsz.entity.vo.RealRainStatListVo;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @ClassName CurrentFormAnalysisService
|
||||
* @Author Huang Qianxiang
|
||||
* @Date 2024/3/12 16:19
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CurrentFormAnalysisService {
|
||||
@Resource
|
||||
private RealRainService realRainService;
|
||||
|
||||
|
||||
/**
|
||||
* 当前形势分析-降雨分析
|
||||
* @param rainfallAnalysisSo
|
||||
* @return
|
||||
*/
|
||||
public Map<Integer,List<RainfallAnalysisVo>> rainfallAnalysis(RainfallAnalysisSo rainfallAnalysisSo){
|
||||
|
||||
Date etm = new Date();
|
||||
Date stm = new Date(etm.getTime() - rainfallAnalysisSo.getTimeType() * 60 * 60*1000);
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String etmStr = df.format(etm);
|
||||
String stmStr = df.format(stm);
|
||||
|
||||
RealRainBaseSo realRainBaseSo = new RealRainBaseSo();
|
||||
realRainBaseSo.setStm(stmStr);
|
||||
realRainBaseSo.setEtm(etmStr);
|
||||
realRainBaseSo.setSource(rainfallAnalysisSo.getSource());
|
||||
realRainBaseSo.setTimeType(rainfallAnalysisSo.getTimeType());
|
||||
|
||||
List<RealRainListVo> realRainList = realRainService.getRealRainList(realRainBaseSo);
|
||||
|
||||
realRainList = realRainList.stream().filter(t -> Objects.nonNull(t.getRainTag())).collect(Collectors.toList());
|
||||
|
||||
List<RainfallAnalysisVo> analysisVos = new ArrayList<>();
|
||||
for (RealRainListVo realRainListVo : realRainList) {
|
||||
RainfallAnalysisVo rainfallAnalysisVo = new RainfallAnalysisVo();
|
||||
BeanUtil.copyProperties(realRainListVo,rainfallAnalysisVo);
|
||||
// 4
|
||||
if (realRainListVo.getRainTag() >= 4){
|
||||
rainfallAnalysisVo.setLevel(realRainListVo.getRainTag()-4);
|
||||
analysisVos.add(rainfallAnalysisVo);
|
||||
}
|
||||
}
|
||||
|
||||
Map<Integer, List<RealRainStatListVo>> map = realRainService.getRealRainStatLevel(realRainBaseSo);
|
||||
|
||||
List<RealRainStatListVo> realRainStatListVos = new ArrayList<>();
|
||||
if (map.get(4) != null){
|
||||
realRainStatListVos.addAll(map.get(4));
|
||||
}
|
||||
if (map.get(5) != null){
|
||||
realRainStatListVos.addAll(map.get(5));
|
||||
}
|
||||
|
||||
for (RealRainStatListVo realRainStatListVo : realRainStatListVos) {
|
||||
RainfallAnalysisVo rainfallAnalysisVo = new RainfallAnalysisVo();
|
||||
BeanUtil.copyProperties(realRainStatListVo,rainfallAnalysisVo);
|
||||
if (rainfallAnalysisSo.getTimeType() == 3) {
|
||||
rainfallAnalysisVo.setLevel(realRainStatListVo.getFreqH3());
|
||||
} else if (rainfallAnalysisSo.getTimeType() == 6) {
|
||||
rainfallAnalysisVo.setLevel(realRainStatListVo.getFreqH6());
|
||||
} else if (rainfallAnalysisSo.getTimeType() == 12) {
|
||||
rainfallAnalysisVo.setLevel(realRainStatListVo.getFreqH12());
|
||||
} else if (rainfallAnalysisSo.getTimeType() == 24) {
|
||||
rainfallAnalysisVo.setLevel(realRainStatListVo.getFreqH24());
|
||||
} else {
|
||||
rainfallAnalysisVo.setLevel(realRainStatListVo.getFreqH1());
|
||||
}
|
||||
analysisVos.add(rainfallAnalysisVo);
|
||||
}
|
||||
|
||||
Map<Integer, List<RainfallAnalysisVo>> map1 = analysisVos.stream().collect(
|
||||
Collectors.groupingBy(RainfallAnalysisVo::getLevel, Collectors.toList())
|
||||
);
|
||||
|
||||
for (int i = 0; i <= 4; i++) {
|
||||
if (map1.get(i) == null){
|
||||
map1.put(i, Lists.newArrayList());
|
||||
}
|
||||
}
|
||||
return map1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -12,6 +12,8 @@ import com.gunshi.project.hsz.mapper.DispatchRecordMapper;
|
|||
import com.gunshi.project.hsz.model.DispatchRecord;
|
||||
import com.gunshi.project.hsz.util.ExcelUtil;
|
||||
import com.gunshi.project.hsz.util.MyBeanUtil;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -36,10 +38,21 @@ public class DispatchRecordService extends ServiceImpl<DispatchRecordMapper, Dis
|
|||
@Autowired
|
||||
private FileAssociationsService fileService;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
public Page<DispatchRecord> pageQuery(DispatchRecordPageSo page) {
|
||||
Page<DispatchRecord> res = this.page(page.getPageSo().toPage(), commonWrapper(page));
|
||||
if (res.getRecords() != null) {
|
||||
fillAttach(res.getRecords());
|
||||
for (DispatchRecord record : res.getRecords()) {
|
||||
if(record.getOpUserId() != null){
|
||||
SysUser sysUser = sysUserMapper.selectUserById(record.getOpUserId());
|
||||
if(sysUser != null){
|
||||
record.setOpUserName(sysUser.getNickName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -70,6 +83,14 @@ public class DispatchRecordService extends ServiceImpl<DispatchRecordMapper, Dis
|
|||
|
||||
public void export(DispatchRecordPageSo page, HttpServletResponse response) {
|
||||
List<DispatchRecord> list = this.list(commonWrapper(page));
|
||||
for (DispatchRecord record : list) {
|
||||
if(record.getOpUserId() != null){
|
||||
SysUser sysUser = sysUserMapper.selectUserById(record.getOpUserId());
|
||||
if(sysUser != null){
|
||||
record.setOpUserName(sysUser.getNickName());
|
||||
}
|
||||
}
|
||||
}
|
||||
List<DispatchRecordVo> dispatchRecordVos = MyBeanUtil.collectionCopy(list, DispatchRecordVo.class);
|
||||
ExcelUtil.exportExcel(dispatchRecordVos,"调度指令", DispatchRecordVo.class,response,"调度指令");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.gunshi.project.hsz.mapper.ForecastDispatchPlanMapper;
|
|||
import com.gunshi.project.hsz.model.ForecastDispatchCommand;
|
||||
import com.gunshi.project.hsz.model.ForecastDispatchPlan;
|
||||
import com.gunshi.project.hsz.model.ForecastDispatchResult;
|
||||
import com.gunshi.project.hsz.model.ResPlanB;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -48,6 +49,9 @@ public class ForecastDispatchPlanService extends ServiceImpl<ForecastDispatchPla
|
|||
@Autowired
|
||||
private ForecastDispatchCommandService forecastDispatchCommandService;
|
||||
|
||||
@Autowired
|
||||
private ResPlanBService resPlanBService;
|
||||
|
||||
public Page<ForecastDispatchPlan> pageDetail(ForecastDispatchPlanPageSo pageSo) {
|
||||
LambdaQueryWrapper<ForecastDispatchPlan> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(!StringUtils.isBlank(pageSo.getPlanName())){
|
||||
|
|
@ -60,7 +64,14 @@ public class ForecastDispatchPlanService extends ServiceImpl<ForecastDispatchPla
|
|||
record.setForecastDispatchCommands(forecastDispatchCommandList);
|
||||
ForecastDispatchResult forecastDispatchResult = forecastDispatchResultService.lambdaQuery().eq(ForecastDispatchResult::getPlanId, record.getId()).one();
|
||||
record.setForecastDispatchResult(forecastDispatchResult);
|
||||
if(record.getResPlanBId() != null){
|
||||
ResPlanB byId = resPlanBService.getById(record.getResPlanBId());
|
||||
if(byId != null){
|
||||
record.setResPlanBName(byId.getPlanName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return forecastDispatchPlanPage;
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +84,12 @@ public class ForecastDispatchPlanService extends ServiceImpl<ForecastDispatchPla
|
|||
record.setForecastDispatchCommands(forecastDispatchCommandList);
|
||||
ForecastDispatchResult forecastDispatchResult = forecastDispatchResultService.lambdaQuery().eq(ForecastDispatchResult::getPlanId, record.getId()).one();
|
||||
record.setForecastDispatchResult(forecastDispatchResult);
|
||||
if(record.getResPlanBId() != null){
|
||||
ResPlanB byId = resPlanBService.getById(record.getResPlanBId());
|
||||
if(byId != null){
|
||||
record.setResPlanBName(byId.getPlanName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return forecastDispatchPlans;
|
||||
}
|
||||
|
|
@ -286,13 +303,13 @@ public class ForecastDispatchPlanService extends ServiceImpl<ForecastDispatchPla
|
|||
Row resultDataRow = sheet.createRow(startRow++);
|
||||
int colNum = 0;
|
||||
resultDataRow.createCell(colNum++).setCellValue(result.getMaxInflow() != null ?
|
||||
result.getMaxInflow().doubleValue() : 0);
|
||||
result.getMaxInflow() + "(" + result.getMaxInflowDate().toString() + ")": "");
|
||||
resultDataRow.createCell(colNum++).setCellValue(result.getTotalInflowVolume() != null ?
|
||||
result.getTotalInflowVolume().doubleValue() : 0);
|
||||
resultDataRow.createCell(colNum++).setCellValue(result.getTotalOutflowVolume() != null ?
|
||||
result.getTotalOutflowVolume().doubleValue() : 0);
|
||||
resultDataRow.createCell(colNum++).setCellValue(result.getMaxReservoirLevel() != null ?
|
||||
result.getMaxReservoirLevel().doubleValue() : 0);
|
||||
result.getMaxReservoirLevel() +"(" + result.getMaxReservoirLevelDate().toString() +")" : "");
|
||||
resultDataRow.createCell(colNum++).setCellValue(result.getExceedLimitValue() != null ?
|
||||
result.getExceedLimitValue().doubleValue() : 0);
|
||||
resultDataRow.createCell(colNum++).setCellValue(formatDateTime(result.getExceedLimitStart()));
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ public class GateValveRealService extends ServiceImpl<GateValveRealMapper, GateV
|
|||
now.set(Calendar.MILLISECOND, 0);
|
||||
Date currentHour = now.getTime();
|
||||
if(tm.before(currentHour)){
|
||||
result.put(null,"当前时间无最新水位数据");
|
||||
result.put(BigDecimal.ZERO,"当前时间无最新水位数据");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,22 @@ package com.gunshi.project.hsz.service;
|
|||
|
||||
import com.gunshi.project.hsz.entity.so.RealRainBaseSo;
|
||||
import com.gunshi.project.hsz.entity.vo.RealRainListVo;
|
||||
import com.gunshi.project.hsz.entity.vo.RealRainStatListVo;
|
||||
import com.gunshi.project.hsz.mapper.RealRainMapper;
|
||||
import com.gunshi.project.hsz.model.AttBasBase;
|
||||
import com.gunshi.project.hsz.model.AttBasBaseAutoDao;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
|
|
@ -26,6 +34,8 @@ public class RealRainService {
|
|||
@Autowired
|
||||
private RealRainMapper realRainMapper;
|
||||
|
||||
private final AttBasBaseAutoDao attBasBaseAutoDao;
|
||||
|
||||
/**
|
||||
* 实时雨情-降雨信息-查询接口
|
||||
*
|
||||
|
|
@ -38,4 +48,138 @@ public class RealRainService {
|
|||
// result.sort(Comparator.comparing(RealRainListVo::getDrp, Comparator.nullsFirst(Double::compareTo)).reversed().thenComparing(RealRainListVo::getStcd));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 频率统计
|
||||
*/
|
||||
public Map<Integer, List<RealRainStatListVo>> getRealRainStatLevel(RealRainBaseSo realRainBaseSo) {
|
||||
|
||||
Map<Integer, List<RealRainStatListVo>> map = new HashMap<>();
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
if (map.get(i) == null) {
|
||||
map.put(i, Lists.newArrayList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (realRainBaseSo.getSource().size() == 0) {
|
||||
return map;
|
||||
}
|
||||
|
||||
List<RealRainStatListVo> result = getRealRainStat(realRainBaseSo);
|
||||
//判断result是否为空
|
||||
if (CollectionUtils.isEmpty(result)) {
|
||||
return map;
|
||||
}
|
||||
|
||||
//按照降雨量级进行分组
|
||||
if (realRainBaseSo.getTimeType() == null) {
|
||||
result = result.stream().filter(res -> res.getFreqH1() != 0).collect(Collectors.toList());
|
||||
map = result.stream().collect(
|
||||
Collectors.groupingBy(RealRainStatListVo::getFreqH1, Collectors.toList())
|
||||
);
|
||||
}
|
||||
if (realRainBaseSo.getTimeType() == 3) {
|
||||
result = result.stream().filter(res -> res.getFreqH3() != 0).collect(Collectors.toList());
|
||||
map = result.stream().collect(
|
||||
Collectors.groupingBy(RealRainStatListVo::getFreqH3, Collectors.toList())
|
||||
);
|
||||
} else if (realRainBaseSo.getTimeType() == 6) {
|
||||
result = result.stream().filter(res -> res.getFreqH6() != 0).collect(Collectors.toList());
|
||||
map = result.stream().collect(
|
||||
Collectors.groupingBy(RealRainStatListVo::getFreqH6, Collectors.toList())
|
||||
);
|
||||
} else if (realRainBaseSo.getTimeType() == 12) {
|
||||
result = result.stream().filter(res -> res.getFreqH12() != 0).collect(Collectors.toList());
|
||||
map = result.stream().collect(
|
||||
Collectors.groupingBy(RealRainStatListVo::getFreqH12, Collectors.toList())
|
||||
);
|
||||
} else if (realRainBaseSo.getTimeType() == 24) {
|
||||
result = result.stream().filter(res -> res.getFreqH24() != 0).collect(Collectors.toList());
|
||||
map = result.stream().collect(
|
||||
Collectors.groupingBy(RealRainStatListVo::getFreqH24, Collectors.toList())
|
||||
);
|
||||
} else {
|
||||
result = result.stream().filter(res -> res.getFreqH1() != 0).collect(Collectors.toList());
|
||||
map = result.stream().collect(
|
||||
Collectors.groupingBy(RealRainStatListVo::getFreqH1, Collectors.toList())
|
||||
);
|
||||
}
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
if (!map.containsKey(i)) {
|
||||
map.put(i, Lists.newArrayList());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
if (map.get(i) == null) {
|
||||
map.put(i, Lists.newArrayList());
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 频率分析
|
||||
*
|
||||
* @param realRainBaseSo
|
||||
*/
|
||||
public List<RealRainStatListVo> getRealRainStat(RealRainBaseSo realRainBaseSo) {
|
||||
List<RealRainStatListVo> result = Lists.newArrayList();
|
||||
|
||||
if (realRainBaseSo.getSource().size() == 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
checkParam(realRainBaseSo);
|
||||
List<String> source = realRainBaseSo.getSource();
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(4);
|
||||
for (String sourceStr : source) {
|
||||
executorService.execute(() -> {
|
||||
List<RealRainStatListVo> realRainList = realRainMapper.getRealRainStatList(
|
||||
realRainBaseSo.getAdcd(), realRainBaseSo.getBasCode(), sourceStr,
|
||||
realRainBaseSo.getStm(), realRainBaseSo.getEtm()
|
||||
);
|
||||
result.addAll(realRainList);
|
||||
});
|
||||
}
|
||||
executorService.shutdown();
|
||||
try {
|
||||
executorService.awaitTermination(2, TimeUnit.MINUTES);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流域选择列表
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public List<AttBasBase> queryBasNameList() {
|
||||
return attBasBaseAutoDao.list();
|
||||
}
|
||||
|
||||
|
||||
private void checkParam(RealRainBaseSo realRainBaseSo) {
|
||||
if (Objects.nonNull(realRainBaseSo.getQueryType()) && realRainBaseSo.getQueryType() == 2 && realRainBaseSo.getTimeType() == null) {
|
||||
throw new IllegalArgumentException("频率统计中时间段范围类型不能为空");
|
||||
}
|
||||
//检查source是否为空
|
||||
if (realRainBaseSo.getSource() == null || realRainBaseSo.getSource().isEmpty()) {
|
||||
throw new IllegalArgumentException("来源不能为空");
|
||||
}
|
||||
//检查source字段是否合法
|
||||
for (String source : realRainBaseSo.getSource()) {
|
||||
if (!"SH".equals(source) && !"SW".equals(source) && !"SK".equals(source) && !"QX".equals(source)) {
|
||||
throw new IllegalArgumentException("来源只能是SH SW SK QX这4种");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ public class ResBriefRService extends com.gunshi.project.hsz.model.ResBriefRAuto
|
|||
vo.setFlLowLimLev(flLowLimLev);
|
||||
|
||||
ResBriefVo.PptnVo pptnDrp24Sum = pptnVos.stream()
|
||||
.filter(o -> o.getDrp24Sum() != null)
|
||||
.max(Comparator.comparing(
|
||||
ResBriefVo.PptnVo::getDrp24Sum,
|
||||
Comparator.nullsLast(Comparator.naturalOrder()) // null 值排在最后
|
||||
|
|
@ -85,6 +86,7 @@ public class ResBriefRService extends com.gunshi.project.hsz.model.ResBriefRAuto
|
|||
vo.setDrp24Sum(pptnDrp24Sum != null ? pptnDrp24Sum.getDrp24Sum() : null);
|
||||
vo.setSumStnm(pptnDrp24Sum != null ? pptnDrp24Sum.getStnm() : null);
|
||||
ResBriefVo.PptnVo pptnDrp24Max = pptnVos.stream()
|
||||
.filter(o -> o.getDrp24Max() != null)
|
||||
.max(Comparator.comparing(
|
||||
ResBriefVo.PptnVo::getDrp24Max,
|
||||
Comparator.nullsLast(Comparator.naturalOrder())
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ public class ReservoirWaterService {
|
|||
|
||||
if(tm != null && tm.before(currentHour)){
|
||||
vo.setRz(null);
|
||||
vo.setTm(null);
|
||||
}else if (tm != null && rz != null){
|
||||
if (rz != null) {
|
||||
//BigDecimal w = stZvarlBService.getWFromZvarl(rz, null, zvarlList);
|
||||
|
|
|
|||
|
|
@ -6,10 +6,9 @@ import cn.hutool.json.JSONUtil;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||
import com.gunshi.project.hsz.common.model.JcskByR;
|
||||
import com.gunshi.project.hsz.common.model.StRiverR;
|
||||
import com.gunshi.project.hsz.common.model.StRiverRReal;
|
||||
import com.gunshi.project.hsz.entity.vo.*;
|
||||
import com.gunshi.project.hsz.mapper.AttCctvBaseMapper;
|
||||
import com.gunshi.project.hsz.mapper.AttResBaseMapper;
|
||||
import com.gunshi.project.hsz.mapper.StQxWarnRMapper;
|
||||
import com.gunshi.project.hsz.model.*;
|
||||
|
|
@ -31,10 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -75,117 +71,175 @@ public class StQxWarnRService extends ServiceImpl<StQxWarnRMapper, StQxWarnR> {
|
|||
@Resource
|
||||
private JcskByRService jcskByRService;
|
||||
|
||||
@Resource
|
||||
private AttCctvBaseService attCctvBaseService;
|
||||
|
||||
public HomeWarnVo homeWarn(DateTimeRangeSo dateTimeRangeSo) {
|
||||
HomeWarnVo vo = new HomeWarnVo();
|
||||
|
||||
List<AttResBaseVo> attResBaseVos = attResBaseMapper.queryList();
|
||||
AttResBaseVo attResBaseVo = attResBaseVos.get(0);
|
||||
List<AttResBaseVo> attResBaseVos = attResBaseMapper.queryList2();
|
||||
|
||||
Map<String,List<SKWarningVo>> skWarningVoMap = new HashMap<>();
|
||||
//超校核水位
|
||||
List<SKWarningVo> cals = new ArrayList<>();
|
||||
//超设计水位
|
||||
List<SKWarningVo> des = new ArrayList<>();
|
||||
//超汛限水位
|
||||
List<SKWarningVo> fl = new ArrayList<>();
|
||||
for (AttResBaseVo attResBaseVo : attResBaseVos) {
|
||||
Date tm = attResBaseVo.getTm();
|
||||
if(tm == null){
|
||||
continue;
|
||||
}
|
||||
//水位的最新采集时间不在24小时内
|
||||
if (tm.before(dateTimeRangeSo.getStart())) {
|
||||
vo.setRzWarn("-");
|
||||
continue;
|
||||
}else{
|
||||
BigDecimal rz = attResBaseVo.getRz();
|
||||
if(rz == null){
|
||||
continue;
|
||||
}
|
||||
SKWarningVo skWarningVo = new SKWarningVo();
|
||||
skWarningVo.setLttd(attResBaseVo.getLttd());
|
||||
skWarningVo.setLgtd(attResBaseVo.getLgtd());
|
||||
skWarningVo.setStnm(attResBaseVo.getStnm());
|
||||
skWarningVo.setStcd(attResBaseVo.getStcd());
|
||||
if (attResBaseVo.getCalState() == 1) {
|
||||
BigDecimal aboveCal = rz.subtract(attResBaseVo.getCalFloodLev());
|
||||
vo.setRzWarn("超校核(" + aboveCal.setScale(2, RoundingMode.HALF_UP) + "m)");
|
||||
attResBaseVo.setDesState(0);
|
||||
attResBaseVo.setFlState(0);
|
||||
skWarningVo.setRzWarn(rz + "(" + aboveCal.setScale(2, RoundingMode.HALF_EVEN) + ")" );
|
||||
cals.add(skWarningVo);
|
||||
} else if (attResBaseVo.getDesState() == 1) {
|
||||
BigDecimal aboveDes = rz.subtract(attResBaseVo.getDesFloodLev());
|
||||
vo.setRzWarn("超设计(" + aboveDes.setScale(2, RoundingMode.HALF_UP) + "m)");
|
||||
attResBaseVo.setFlState(0);
|
||||
skWarningVo.setRzWarn(rz + "(" + aboveDes.setScale(2, RoundingMode.HALF_EVEN) + ")" );
|
||||
des.add(skWarningVo);
|
||||
} else if (attResBaseVo.getFlState() == 1) {
|
||||
vo.setRzWarn("超汛限(" + attResBaseVo.getAFsltdz().setScale(2, RoundingMode.HALF_UP) + "m)");
|
||||
} else if (rz.compareTo(attResBaseVo.getDeadLev()) < 0) {
|
||||
BigDecimal aboveDead = rz.subtract(attResBaseVo.getDeadLev());
|
||||
vo.setRzWarn("低水位(" + aboveDead.setScale(1, RoundingMode.HALF_UP) + "m)");
|
||||
} else {
|
||||
vo.setRzWarn("正常(" + attResBaseVo.getAFsltdz().setScale(2, RoundingMode.HALF_UP) + "m)");
|
||||
BigDecimal aboveFl = attResBaseVo.getAFsltdz().setScale(2, RoundingMode.HALF_UP);
|
||||
skWarningVo.setRzWarn(rz + "(" + aboveFl.setScale(2, RoundingMode.HALF_UP) + ")" );
|
||||
fl.add(skWarningVo);
|
||||
}
|
||||
}
|
||||
|
||||
// vo.setQxWarn(queryQxWarn());
|
||||
|
||||
}
|
||||
skWarningVoMap.put("calState", cals);
|
||||
skWarningVoMap.put("desState",des);
|
||||
skWarningVoMap.put("flState",fl);
|
||||
vo.setSkWarningVoMap(skWarningVoMap);
|
||||
List<OsmoticWarnVo> warnVos = baseMapper.queryOsmoticWarn(dateTimeRangeSo);
|
||||
vo.setPressWarn(warnVos.stream().filter(o -> o.getType() == 1).collect(Collectors.toList()));
|
||||
vo.setFlowWarn(warnVos.stream().filter(o -> o.getType() == 2).collect(Collectors.toList()));
|
||||
vo.setShiftWarn(warnVos.stream().filter(o -> o.getType() == 3).collect(Collectors.toList()));
|
||||
Long aiWarnCount = iscaiEventService.lambdaQuery()
|
||||
List<OsmoticWarnVo> pressWarn = warnVos.stream().filter(o -> o.getType() == 1).collect(Collectors.toList());
|
||||
pressWarn.stream().forEach(o ->{
|
||||
if(o.getLevel() != null){
|
||||
if(o.getLevel() == 1){
|
||||
o.setWarnLevel("黄色");
|
||||
}else{
|
||||
o.setWarnLevel("红色");
|
||||
}
|
||||
}
|
||||
});
|
||||
List<OsmoticWarnVo> flowWarn = warnVos.stream().filter(o -> o.getType() == 2).collect(Collectors.toList());
|
||||
flowWarn.stream().forEach(o->{
|
||||
if(o.getLevel() != null){
|
||||
if(o.getLevel() == 1){
|
||||
o.setWarnLevel("黄色");
|
||||
}else{
|
||||
o.setWarnLevel("红色");
|
||||
}
|
||||
}
|
||||
});
|
||||
List<OsmoticWarnVo> shiftWarn = warnVos.stream().filter(o -> o.getType() == 3).collect(Collectors.toList());
|
||||
shiftWarn.stream().forEach(o ->{
|
||||
if(o.getLevel() != null){
|
||||
if(o.getLevel() == 1){
|
||||
o.setWarnLevel("黄色");
|
||||
}else{
|
||||
o.setWarnLevel("红色");
|
||||
}
|
||||
}
|
||||
});
|
||||
Map<String,List<OsmoticWarnVo>> osmoticWarnMaps = new HashMap<>();
|
||||
osmoticWarnMaps.put("pressWarn",pressWarn);
|
||||
osmoticWarnMaps.put("flowWarn",flowWarn);
|
||||
osmoticWarnMaps.put("shiftWarn",shiftWarn);
|
||||
vo.setOsmoticWarnVoMap(osmoticWarnMaps);
|
||||
List<ISCAIEvent> iscaiEvents = iscaiEventService.lambdaQuery()
|
||||
.ge(ISCAIEvent::getStartTime, dateTimeRangeSo.getStart())
|
||||
.le(ISCAIEvent::getStartTime,dateTimeRangeSo.getEnd())
|
||||
.count();
|
||||
vo.setAiWarnCount(aiWarnCount);
|
||||
.le(ISCAIEvent::getStartTime, dateTimeRangeSo.getEnd()).orderByDesc(ISCAIEvent::getStartTime).list();
|
||||
List<String> distinctResNames = iscaiEvents.stream()
|
||||
.map(ISCAIEvent::getEventTypeName)
|
||||
.filter(Objects::nonNull) // 过滤null值
|
||||
.distinct() // 去重
|
||||
.collect(Collectors.toList());
|
||||
Map<String,List<AiWarningVo>> aiWarnVoMap = new HashMap<>();
|
||||
distinctResNames.forEach(resName -> {
|
||||
aiWarnVoMap.put(resName, new ArrayList<>());
|
||||
});
|
||||
for (ISCAIEvent iscaiEvent : iscaiEvents) {
|
||||
if(aiWarnVoMap.containsKey(iscaiEvent.getEventTypeName())){
|
||||
List<AiWarningVo> aiWarningVos = aiWarnVoMap.get(iscaiEvent.getEventTypeName());
|
||||
List<AttCctvBase> list = attCctvBaseService.lambdaQuery().eq(AttCctvBase::getIndexCode, iscaiEvent.getResIndexCode()).list();
|
||||
for (AttCctvBase attCctvBase : list) {
|
||||
AiWarningVo aiWarningVo = new AiWarningVo();
|
||||
aiWarningVo.setWarningTime(iscaiEvent.getStartTime());
|
||||
aiWarningVo.setStnm(attCctvBase.getName());
|
||||
if(attCctvBase.getLgtd() !=null){
|
||||
aiWarningVo.setLgtd(new BigDecimal(attCctvBase.getLgtd()));
|
||||
}
|
||||
if(attCctvBase.getLttd() != null){
|
||||
aiWarningVo.setLttd(new BigDecimal(attCctvBase.getLttd()));
|
||||
}
|
||||
aiWarningVos.add(aiWarningVo);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
vo.setAiWarnVoMap(aiWarnVoMap);
|
||||
Map<String,List<RiverWarningVo>> riverWarningVoMap = new HashMap<>();
|
||||
List<RiverWarningVo> overWarn = new ArrayList<>();
|
||||
List<RiverWarningVo> overPmis = new ArrayList<>();
|
||||
//TODO 超河道上游
|
||||
String upperStcd = "999999999";//固定的站点编码
|
||||
setUpAndDownOverRvUp(upperStcd,vo,dateTimeRangeSo);
|
||||
setUpAndDownOverRvUpAndDown(upperStcd,dateTimeRangeSo,overWarn,overPmis);
|
||||
|
||||
//TODO 超河道下游
|
||||
String lowerStcd = "61610700";//固定的站点编码
|
||||
setUpAndDownOverRvDown(lowerStcd,vo,dateTimeRangeSo);
|
||||
setUpAndDownOverRvUpAndDown(lowerStcd,dateTimeRangeSo,overWarn,overPmis);
|
||||
riverWarningVoMap.put("overWarn",overWarn);
|
||||
riverWarningVoMap.put("overPromise",overPmis);
|
||||
vo.setRiverWarningVoMap(riverWarningVoMap);
|
||||
return vo;
|
||||
}
|
||||
|
||||
private void setUpAndDownOverRvUp(String stcd, HomeWarnVo vo, DateTimeRangeSo dateTimeRangeSo){
|
||||
//StRsvrRReal stRsvrRReal = stRsvrRRealService.getBaseMapper().queryRzByStcd(stcd);
|
||||
//StRiverRReal stRiverRReal = stRiverRRealService.getBaseMapper().queryQByStcd(stcd);
|
||||
private void setUpAndDownOverRvUpAndDown(String stcd, DateTimeRangeSo dateTimeRangeSo, List<RiverWarningVo> overWarn, List<RiverWarningVo> overPmis){
|
||||
StRiverR stRiverR = stRiverRService.getBaseMapper().queryByOneByTimeRange(stcd,dateTimeRangeSo);
|
||||
RiverWarningVo riverWarningVo = new RiverWarningVo();
|
||||
if(stRiverR != null){
|
||||
riverWarningVo.setStcd(stcd);
|
||||
riverWarningVo.setStnm(stRiverR.getStnm());
|
||||
riverWarningVo.setLgtd(stRiverR.getLgtd());
|
||||
riverWarningVo.setLgtd(stRiverR.getLgtd());
|
||||
AlarmSet alarmSet = alarmSetService.getBaseMapper().queryByStcd(stcd);
|
||||
if(alarmSet == null){
|
||||
riverWarningVo.setRzWarn("告警设置未配置,请检查");
|
||||
}else{
|
||||
//警告水位
|
||||
BigDecimal warnWaterLevel = alarmSet.getWarnWaterLevel();
|
||||
//保证水位
|
||||
BigDecimal promiseWaterLevel = alarmSet.getPromiseWaterLevel();
|
||||
if(alarmSet == null){
|
||||
vo.setOverRvUp("告警设置未配置,请检查");
|
||||
}else{
|
||||
BigDecimal rz = stRiverR.getZ();
|
||||
if(rz == null){
|
||||
vo.setOverRvUp("无水位数据");
|
||||
return;
|
||||
}
|
||||
if(rz.compareTo(warnWaterLevel) >=0){
|
||||
if(rz.compareTo(warnWaterLevel) >=0 && rz.compareTo(promiseWaterLevel) <0){
|
||||
BigDecimal gap = rz.subtract(warnWaterLevel);
|
||||
vo.setOverRvUp("超警戒(" +gap.setScale(2, RoundingMode.HALF_UP)+")m");
|
||||
}else{
|
||||
riverWarningVo.setRzWarn(gap.toString());
|
||||
overWarn.add(riverWarningVo);
|
||||
}else if (rz.compareTo(promiseWaterLevel) >=0){
|
||||
BigDecimal gap = rz.subtract(warnWaterLevel);
|
||||
vo.setOverRvUp("正常(" +gap.setScale(2, RoundingMode.HALF_UP)+")m");
|
||||
riverWarningVo.setRzWarn(gap.toString());
|
||||
overPmis.add(riverWarningVo);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
vo.setOverRvUp("-");
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpAndDownOverRvDown(String stcd, HomeWarnVo vo, DateTimeRangeSo dateTimeRangeSo){
|
||||
StRiverR stRiverR = stRiverRService.getBaseMapper().queryByOneByTimeRange(stcd,dateTimeRangeSo);
|
||||
if(stRiverR != null){
|
||||
AlarmSet alarmSet = alarmSetService.getBaseMapper().queryByStcd(stcd);
|
||||
//警告水位
|
||||
BigDecimal warnWaterLevel = alarmSet.getWarnWaterLevel();
|
||||
//保证水位
|
||||
BigDecimal promiseWaterLevel = alarmSet.getPromiseWaterLevel();
|
||||
if(alarmSet == null){
|
||||
vo.setOverRvDown("告警设置未配置,请检查");
|
||||
|
||||
}else{
|
||||
BigDecimal rz = stRiverR.getZ();
|
||||
if(rz == null){
|
||||
vo.setOverRvUp("无水位数据");
|
||||
return;
|
||||
}
|
||||
if(rz.compareTo(warnWaterLevel) >=0){
|
||||
BigDecimal gap = rz.subtract(warnWaterLevel);
|
||||
vo.setOverRvDown("超警戒(" +gap.setScale(2, RoundingMode.HALF_UP)+")m");
|
||||
}else{
|
||||
BigDecimal gap = rz.subtract(warnWaterLevel);
|
||||
vo.setOverRvDown("正常(" +gap.setScale(2, RoundingMode.HALF_UP)+")m");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
vo.setOverRvDown("-");
|
||||
}
|
||||
}
|
||||
|
||||
private List<QXWarningVo> queryQxWarn() {
|
||||
List<QXWarningVo> list = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ public class StWaterRService extends ServiceImpl<StWaterRMapper, StWaterR>
|
|||
public StWaterR selectNewDataByStcd(String stcd) {
|
||||
return this.baseMapper.selectNewDataByStcd(stcd);
|
||||
}
|
||||
|
||||
public List<StWaterR> queryDetail() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.gunshi.project.hsz.timetask;
|
||||
|
||||
|
||||
import com.gunshi.project.hsz.common.model.StStbprpB;
|
||||
import com.gunshi.project.hsz.entity.enums.AlarmTypeEnum;
|
||||
import com.gunshi.project.hsz.entity.vo.AttResBaseVo;
|
||||
import com.gunshi.project.hsz.mapper.AlarmSetMapper;
|
||||
|
|
@ -9,6 +10,8 @@ import com.gunshi.project.hsz.model.AlarmSet;
|
|||
import com.gunshi.project.hsz.common.model.StRiverRReal;
|
||||
import com.gunshi.project.hsz.model.WaterAlarm;
|
||||
import com.gunshi.project.hsz.service.StRiverRRealService;
|
||||
import com.gunshi.project.hsz.service.StRsvrRService;
|
||||
import com.gunshi.project.hsz.service.StStbprpBService;
|
||||
import com.gunshi.project.hsz.service.WaterAlarmService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -44,6 +47,9 @@ public class AlarmTask {
|
|||
@Autowired
|
||||
private StRiverRRealService stRiverRRealService;
|
||||
|
||||
@Autowired
|
||||
private StStbprpBService stStbprpBService;
|
||||
|
||||
@Async
|
||||
@Scheduled(cron = "0 7 * * * *")
|
||||
public void updateAlarmSet(){
|
||||
|
|
@ -59,10 +65,11 @@ public class AlarmTask {
|
|||
@Async
|
||||
@Scheduled(cron = "0 7 * * * *")
|
||||
public void updateWaterAlarm(){
|
||||
List<AttResBaseVo> attResBaseVos = attResBaseMapper.queryList();
|
||||
AttResBaseVo attResBaseVo = attResBaseVos.get(0);
|
||||
List<AttResBaseVo> attResBaseVos = attResBaseMapper.queryList2();
|
||||
for (AttResBaseVo attResBaseVo : attResBaseVos) {
|
||||
saveResStData(attResBaseVo);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveResStData(AttResBaseVo entity){
|
||||
Integer calState = entity.getCalState();//是否超校核
|
||||
|
|
|
|||
|
|
@ -0,0 +1,147 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gunshi.project.hsz.mapper.RealRainMapper">
|
||||
<select id="getRealRainStatList" resultType="com.gunshi.project.hsz.entity.vo.RealRainStatListVo">
|
||||
with m1 as (
|
||||
select t1.stcd,
|
||||
t1.sttp,
|
||||
s1.adcd,
|
||||
t1.stlc,
|
||||
s1.adnm,
|
||||
t1.stnm,
|
||||
t1.lgtd,
|
||||
t1.lttd,
|
||||
t1.source,
|
||||
b1.m60_y5,
|
||||
b1.m60_y10,
|
||||
b1.m60_y20,
|
||||
b1.m60_y50,
|
||||
b1.m60_y100,
|
||||
b1.h3_y5,
|
||||
b1.h3_y10,
|
||||
b1.h3_y20,
|
||||
b1.h3_y50,
|
||||
b1.h3_y100,
|
||||
b1.h6_y5,
|
||||
b1.h6_y10,
|
||||
b1.h6_y20,
|
||||
b1.h6_y50,
|
||||
b1.h6_y100,
|
||||
b1.h12_y5,
|
||||
b1.h12_y10,
|
||||
b1.h12_y20,
|
||||
b1.h12_y50,
|
||||
b1.h12_y100,
|
||||
b1.h24_y5,
|
||||
b1.h24_y10,
|
||||
b1.h24_y20,
|
||||
b1.h24_y50,
|
||||
b1.h24_y100
|
||||
from st_stbprp_b t1
|
||||
left join att_res_base t3 on t3.stcd = t1.stcd
|
||||
left join st_addvcd_d s1 on s1.adcd = t1.adcd
|
||||
left join st_stbprp_b_elem s2 on s2.stcd = t1.stcd
|
||||
left join basic_station_recurrence b1 on b1.stcd = t1.stcd
|
||||
<where>
|
||||
s2.elem = 'drp'
|
||||
<if test="adcd != null and adcd != ''">
|
||||
and s2.adcd like concat("left"(#{adcd}, 9),'%')
|
||||
</if>
|
||||
<!-- 已删除basCode相关条件 -->
|
||||
</where>
|
||||
),
|
||||
m2 as (
|
||||
select t1.stcd,
|
||||
t1.h1 h1,
|
||||
t1.h3 h3,
|
||||
t1.h6 h6,
|
||||
t1.h12 h12,
|
||||
t1.h24 h24,
|
||||
t1.tm
|
||||
from st_pptn_r_real t1
|
||||
WHERE exists (select 1 from m1 m1 where m1.stcd = t1.stcd)
|
||||
and t1.tm > #{stm}::timestamp and t1.tm <= #{etm}::timestamp
|
||||
),
|
||||
m3 as (
|
||||
select m2.stcd,
|
||||
m1.stnm,
|
||||
m1.sttp,
|
||||
m1.stlc,
|
||||
h1,
|
||||
h3,
|
||||
h6,
|
||||
h12,
|
||||
h24,
|
||||
tm,
|
||||
m1.adcd,
|
||||
m1.adnm,
|
||||
m1.lgtd,
|
||||
m1.lttd,
|
||||
m1.source,
|
||||
(case
|
||||
when h1 between m60_y5 and m60_y10 then 1
|
||||
when h1 between m60_y10 and m60_y20 then 2
|
||||
when h1 between m60_y20 and m60_y50 then 3
|
||||
when h1 between m60_y50 and m60_y100 then 4
|
||||
when h1 > m60_y100 then 5
|
||||
else 0
|
||||
end) freq_h1,
|
||||
(case
|
||||
when h3 between h3_y5 and h3_y10 then 1
|
||||
when h3 between h3_y10 and h3_y20 then 2
|
||||
when h3 between h3_y20 and h3_y50 then 3
|
||||
when h3 between h3_y50 and h3_y100 then 4
|
||||
when h3 > h3_y100 then 5
|
||||
else 0
|
||||
end) freq_h3,
|
||||
(case
|
||||
when h6 between h6_y5 and h6_y10 then 1
|
||||
when h6 between h6_y10 and h6_y20 then 2
|
||||
when h6 between h6_y20 and h6_y50 then 3
|
||||
when h6 between h6_y50 and h6_y100 then 4
|
||||
when h6 > h6_y100 then 5
|
||||
else 0
|
||||
end) freq_h6,
|
||||
(case
|
||||
when h12 between h12_y5 and h12_y10 then 1
|
||||
when h12 between h12_y10 and h12_y20 then 2
|
||||
when h12 between h12_y20 and h12_y50 then 3
|
||||
when h12 between h12_y50 and h12_y100 then 4
|
||||
when h12 > h12_y100 then 5
|
||||
else 0
|
||||
end) freq_h12,
|
||||
(case
|
||||
when h24 between h24_y5 and h24_y10 then 1
|
||||
when h24 between h24_y10 and h24_y20 then 2
|
||||
when h24 between h24_y20 and h24_y50 then 3
|
||||
when h24 between h24_y50 and h24_y100 then 4
|
||||
when h24 > h24_y100 then 5
|
||||
else 0
|
||||
end) freq_h24
|
||||
from m2 m2
|
||||
left join m1 on m1.stcd = m2.stcd
|
||||
)
|
||||
select stcd,
|
||||
stnm,
|
||||
sttp,
|
||||
stlc,
|
||||
h1,
|
||||
h3,
|
||||
h6,
|
||||
h12,
|
||||
h24,
|
||||
tm,
|
||||
adcd,
|
||||
adnm,
|
||||
lgtd,
|
||||
lttd,
|
||||
source,
|
||||
freq_h1,
|
||||
freq_h3,
|
||||
freq_h6,
|
||||
freq_h12,
|
||||
freq_h24
|
||||
from m3
|
||||
where freq_h1+freq_h3+freq_h6+freq_h12+freq_h24 > 0
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue