diff --git a/module-common/src/main/java/com/gunshi/project/hsz/common/model/vo/OsmoticShiftListVo2.java b/module-common/src/main/java/com/gunshi/project/hsz/common/model/vo/OsmoticShiftListVo2.java index 43aca26..192b95d 100644 --- a/module-common/src/main/java/com/gunshi/project/hsz/common/model/vo/OsmoticShiftListVo2.java +++ b/module-common/src/main/java/com/gunshi/project/hsz/common/model/vo/OsmoticShiftListVo2.java @@ -56,4 +56,8 @@ public class OsmoticShiftListVo2 { @JsonIgnore private String direction; + + private BigDecimal lttd; + + private BigDecimal lgtd; } diff --git a/src/main/java/com/gunshi/project/hsz/entity/vo/OsmoticPressVo.java b/src/main/java/com/gunshi/project/hsz/entity/vo/OsmoticPressVo.java index db0d611..fa08f1a 100644 --- a/src/main/java/com/gunshi/project/hsz/entity/vo/OsmoticPressVo.java +++ b/src/main/java/com/gunshi/project/hsz/entity/vo/OsmoticPressVo.java @@ -33,4 +33,8 @@ public class OsmoticPressVo { @Schema(description = "是否超过预警(0否 1是)") private Integer status = 0; + private BigDecimal lttd; + + private BigDecimal lgtd; + } diff --git a/src/main/java/com/gunshi/project/hsz/entity/vo/StStatusListVo.java b/src/main/java/com/gunshi/project/hsz/entity/vo/StStatusListVo.java index 06d504e..cdc955d 100644 --- a/src/main/java/com/gunshi/project/hsz/entity/vo/StStatusListVo.java +++ b/src/main/java/com/gunshi/project/hsz/entity/vo/StStatusListVo.java @@ -21,23 +21,32 @@ public class StStatusListVo { @Schema(description = "报到率") private BigDecimal reportPercentage; + @Schema(description = "雨量站") - private Map> rainStationMap; + private List rainStationList; @Schema(description = "水库水位站") - private Map> rsvrStationMap; + private List rsvrStationList; @Schema(description = "河道水位站") - private Map> riverStationMap; + private List riverStationList; @Schema(description = "流量站") - private Map> flowStationMap; + private List flowStationList; @Schema(description = "视频站") - private Map> cctvStationMap; + private List cctvStationList; + @Schema(description = "渗压") + private List syStationList; + + @Schema(description = "渗流") + private List slStationList; + + @Schema(description = "位移") + private List wyStationList; } diff --git a/src/main/java/com/gunshi/project/hsz/entity/vo/StStatusVo.java b/src/main/java/com/gunshi/project/hsz/entity/vo/StStatusVo.java index 2bf5833..e07c4aa 100644 --- a/src/main/java/com/gunshi/project/hsz/entity/vo/StStatusVo.java +++ b/src/main/java/com/gunshi/project/hsz/entity/vo/StStatusVo.java @@ -24,4 +24,7 @@ public class StStatusVo { @Schema(description = "纬度") private BigDecimal lttd; + @Schema(description = "状态 0 离线 1在线") + private Integer status; + } diff --git a/src/main/java/com/gunshi/project/hsz/mapper/OsmoticPressRMapper.java b/src/main/java/com/gunshi/project/hsz/mapper/OsmoticPressRMapper.java index b1e275a..6f060a8 100644 --- a/src/main/java/com/gunshi/project/hsz/mapper/OsmoticPressRMapper.java +++ b/src/main/java/com/gunshi/project/hsz/mapper/OsmoticPressRMapper.java @@ -197,7 +197,8 @@ public interface OsmoticPressRMapper extends BaseMapper { @Select(""" @@ -206,7 +207,8 @@ public interface OsmoticPressRMapper extends BaseMapper { @Select(""" """) List rzList(); @@ -120,7 +120,7 @@ public interface StbprpBVoMapper { @Select(""" """) diff --git a/src/main/java/com/gunshi/project/hsz/service/StStbprpBService.java b/src/main/java/com/gunshi/project/hsz/service/StStbprpBService.java index a494fa2..fe585d5 100644 --- a/src/main/java/com/gunshi/project/hsz/service/StStbprpBService.java +++ b/src/main/java/com/gunshi/project/hsz/service/StStbprpBService.java @@ -92,85 +92,137 @@ public class StStbprpBService extends ServiceImpl { //水雨情站超过2小时为离线;渗压,渗流,位移暂定超过24小时为离线 //雨量站 List rainList = stbprpBVoMapper.realRainList(); - Map> rainStationMap = new HashMap<>(); - rainStationMap.put("online",new ArrayList<>()); - rainStationMap.put("offline",new ArrayList<>()); - res.setRainStationMap(rainStationMap); for (StStatusVo stStatusVo : rainList) { String tm = stStatusVo.getTm(); if(tm != null && !(DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24 )){ - rainStationMap.get("online").add(stStatusVo); + stStatusVo.setStatus(1); onlineCount++; }else{ - rainStationMap.get("offline").add(stStatusVo); + stStatusVo.setStatus(0); offlineCount++; } } - //河道水位站 + res.setRainStationList(rainList); + //水库水位站 List rzList = stbprpBVoMapper.rzList(); - Map> riverStationMap = new HashMap<>(); - riverStationMap.put("online",new ArrayList<>()); - riverStationMap.put("offline",new ArrayList<>()); - res.setRiverStationMap(riverStationMap); for (StStatusVo stStatusVo : rzList) { String tm = stStatusVo.getTm(); if(tm != null && !(DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24 )){ - riverStationMap.get("online").add(stStatusVo); + stStatusVo.setStatus(1); onlineCount++; }else{ - riverStationMap.get("offline").add(stStatusVo); + stStatusVo.setStatus(0); offlineCount++; } } - //水库水情 + res.setRsvrStationList(rzList); + //河道 List zList = stbprpBVoMapper.zList(); - Map> rsvrStationMap = new HashMap<>(); - rsvrStationMap.put("online",new ArrayList<>()); - rsvrStationMap.put("offline",new ArrayList<>()); - res.setRsvrStationMap(rsvrStationMap); for (StStatusVo stStatusVo : zList) { String tm = stStatusVo.getTm(); if(tm != null && !(DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24 )){ - rsvrStationMap.get("online").add(stStatusVo); + stStatusVo.setStatus(1); onlineCount++; }else{ - rsvrStationMap.get("offline").add(stStatusVo); + stStatusVo.setStatus(0); offlineCount++; } } + res.setRiverStationList(zList); // 视频点 List attCctvBases = attCctvBaseService.queryList(); - Map> cctvStationMap = new HashMap<>(); - cctvStationMap.put("online",new ArrayList<>()); - cctvStationMap.put("offline",new ArrayList<>()); - res.setCctvStationMap(cctvStationMap); + List cctvList = new ArrayList<>(); for (AttCctvBase attCctvBase : attCctvBases) { StStatusVo stStatusVo = new StStatusVo(); stStatusVo.setStnm(attCctvBase.getName()); stStatusVo.setLgtd(attCctvBase.getLgtd() == null?null:new BigDecimal(attCctvBase.getLgtd())); stStatusVo.setLttd(attCctvBase.getLttd() == null?null:new BigDecimal(attCctvBase.getLttd())); - cctvStationMap.get("offline").add(stStatusVo); + stStatusVo.setStatus(0); + cctvList.add(stStatusVo); offlineCount++; } + res.setCctvStationList(cctvList); //流量站 //TODO 站点编码等真实站点编码来之后需要更改 List flowList = stbprpBVoMapper.flowStationList(); - Map> flowStationMap = new HashMap<>(); - flowStationMap.put("online",new ArrayList<>()); - flowStationMap.put("offline",new ArrayList<>()); - res.setFlowStationMap(flowStationMap); for (StStatusVo stStatusVo : flowList) { String tm = stStatusVo.getTm(); if(tm != null && !(DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24 )){ - flowStationMap.get("online").add(stStatusVo); + stStatusVo.setStatus(1); onlineCount++; }else{ - flowStationMap.get("offline").add(stStatusVo); + stStatusVo.setStatus(0); offlineCount++; } } + res.setFlowStationList(flowList); + + //大坝安全监测 渗流 渗压 位移 + //渗压 + List pressList = pressRMapper.listValue2(); + List syStationList = new ArrayList<>(); + for (OsmoticPressVo osmoticPressVo : pressList) { + StStatusVo vo = new StStatusVo(); + vo.setStcd(osmoticPressVo.getStationCode()); + vo.setStnm(osmoticPressVo.getStationCode()); + vo.setLttd(osmoticPressVo.getLttd()); + vo.setLgtd(osmoticPressVo.getLgtd()); + String tm = osmoticPressVo.getTm(); + if(tm != null && !(DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24 )){ + vo.setStatus(1); + onlineCount++; + }else{ + vo.setStatus(0); + offlineCount++; + } + syStationList.add(vo); + } + res.setSyStationList(syStationList); + //渗流 + List slList = pressRMapper.flowListValue2(); + List slStationList = new ArrayList<>(); + for (OsmoticPressVo osmoticPressVo : slList) { + StStatusVo vo = new StStatusVo(); + vo.setStcd(osmoticPressVo.getStationCode()); + vo.setStnm(osmoticPressVo.getStationCode()); + vo.setLttd(osmoticPressVo.getLttd()); + vo.setLgtd(osmoticPressVo.getLgtd()); + String tm = osmoticPressVo.getTm(); + if(tm != null && !(DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24 )){ + vo.setStatus(1); + onlineCount++; + }else{ + vo.setStatus(0); + offlineCount++; + } + slStationList.add(vo); + } + res.setSlStationList(slStationList); + //位移 + List wyList = shiftRMapper.listValue2(); + List wyStationList = new ArrayList<>(); + for (OsmoticShiftListVo2 wy : wyList) { + StStatusVo vo = new StStatusVo(); + vo.setStcd(wy.getCdNm()); + vo.setStnm(wy.getCdNm()); + vo.setLttd(wy.getLttd()); + vo.setLgtd(wy.getLgtd()); + String tm = wy.getTm(); + if(tm != null && !(DateUtil.hoursBetweenDate(DateUtil.convertStringToDate(tm), new Date()) > 24 )){ + vo.setStatus(1); + onlineCount++; + }else{ + vo.setStatus(0); + offlineCount++; + } + wyStationList.add(vo); + } + res.setWyStationList(wyStationList); BigDecimal totalCount = new BigDecimal(onlineCount).add(new BigDecimal(offlineCount)); - BigDecimal reportPercentage =new BigDecimal(onlineCount).divide(totalCount).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP); + BigDecimal reportPercentage = new BigDecimal(onlineCount) + .divide(totalCount, 4, RoundingMode.HALF_UP) // 这里先设置精度 + .multiply(BigDecimal.valueOf(100)) + .setScale(2, RoundingMode.HALF_UP); res.setOnlineCount(onlineCount); res.setOffLineCount(offlineCount); res.setReportPercentage(reportPercentage);