|
@ -13,6 +13,7 @@ import com.kms.yg.cz.enmu.*; |
|
|
import com.kms.yg.cz.enmu.MonitorTypeEnum; |
|
|
import com.kms.yg.cz.enmu.MonitorTypeEnum; |
|
|
import com.kms.yg.cz.mapper.MonitorConfigMapper; |
|
|
import com.kms.yg.cz.mapper.MonitorConfigMapper; |
|
|
import com.kms.yg.sk.domain.AttResRspp; |
|
|
import com.kms.yg.sk.domain.AttResRspp; |
|
|
|
|
|
import com.kms.yg.sk.domain.DwsAttDamRspp; |
|
|
import com.kms.yg.sk.dto.AttResTaskViewDto; |
|
|
import com.kms.yg.sk.dto.AttResTaskViewDto; |
|
|
import com.kms.yxgh.base.domain.monitor.MsHdmObp; |
|
|
import com.kms.yxgh.base.domain.monitor.MsHdmObp; |
|
|
import com.kms.yxgh.base.domain.monitor.MsHdmRsvr; |
|
|
import com.kms.yxgh.base.domain.monitor.MsHdmRsvr; |
|
@ -56,20 +57,9 @@ public class MonitorService { |
|
|
@Value("#{${dataSync.paths:{}}}") |
|
|
@Value("#{${dataSync.paths:{}}}") |
|
|
private Map<String, String> paths = new HashMap<>(); |
|
|
private Map<String, String> paths = new HashMap<>(); |
|
|
|
|
|
|
|
|
// todo 临时
|
|
|
|
|
|
private void initPath (Map<String, String> map) { |
|
|
|
|
|
paths.put("att_res_sw","/ZHSL_ZY/jck/yggx/dws_att_res_sw"); |
|
|
|
|
|
paths.put("att_res_rspp","/ZHSL_ZY/jck/ytjgx/dws_att_res_rspp"); |
|
|
|
|
|
paths.put("att_dam_base","/ZHSL_ZY/jck/yggx/dws_att_dam_base"); |
|
|
|
|
|
paths.put("ms_hdm_rsvr","/ZHSL_ZY/bzjck/ms_hdm_rsvr"); |
|
|
|
|
|
paths.put("dws_rel_st_res","/ZHSL_ZY/jck/ytjgx/dws_rel_st_res"); |
|
|
|
|
|
paths.put("ms_hdm_obp","/ZHSL_ZY/bzjck/ms_hdm_obp"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IPage<Object> pageQuery(MonitorQueDto queDto) { |
|
|
public IPage<Object> pageQuery(MonitorQueDto queDto) { |
|
|
MonitorSourceEnum table = queDto.getMonitorType(); |
|
|
MonitorSourceEnum table = queDto.getMonitorType(); |
|
|
initPath(paths); |
|
|
|
|
|
String path = paths.get(table.getTableName()); |
|
|
String path = paths.get(table.getTableName()); |
|
|
if (path == null) { |
|
|
if (path == null) { |
|
|
log.error("未找到对应的路径配置, table:{}", table); |
|
|
log.error("未找到对应的路径配置, table:{}", table); |
|
@ -209,10 +199,9 @@ public class MonitorService { |
|
|
return (List<T>) page.getRecords(); |
|
|
return (List<T>) page.getRecords(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private <T> IPage<T> queryDataPage(MonitorSourceEnum source, MonitorQueDto queDto) { |
|
|
public <T> IPage<T> queryDataPage(MonitorSourceEnum source, MonitorQueDto queDto) { |
|
|
MonitorSourceEnum.ResultWrapper resultWrapper = new MonitorSourceEnum.ResultWrapper(); |
|
|
MonitorSourceEnum.ResultWrapper resultWrapper = new MonitorSourceEnum.ResultWrapper(); |
|
|
resultWrapper.setQueDto(queDto); |
|
|
resultWrapper.setQueDto(queDto); |
|
|
initPath(paths); |
|
|
|
|
|
String path = paths.get(source.getTableName()); |
|
|
String path = paths.get(source.getTableName()); |
|
|
if (path == null) { |
|
|
if (path == null) { |
|
|
resultWrapper.setResultJson(source.getMockData()); |
|
|
resultWrapper.setResultJson(source.getMockData()); |
|
@ -301,48 +290,61 @@ public class MonitorService { |
|
|
AttResTaskViewDto attResTaskViewDto=new AttResTaskViewDto(); |
|
|
AttResTaskViewDto attResTaskViewDto=new AttResTaskViewDto(); |
|
|
BsSgcSkStatisticsService.dtoInit(attResTaskViewDto); |
|
|
BsSgcSkStatisticsService.dtoInit(attResTaskViewDto); |
|
|
MonitorQueDto sp=new MonitorQueDto(); |
|
|
MonitorQueDto sp=new MonitorQueDto(); |
|
|
sp.setResCode(dto.getResCode()); |
|
|
String resCode = dto.getResCode(); |
|
|
|
|
|
sp.setResCode(resCode); |
|
|
|
|
|
|
|
|
CompletableFuture<AttResSw> currentWatterFuture = CompletableFuture.supplyAsync(() -> queryDataOne(MonitorSourceEnum.ATT_RES_SW, sp)); |
|
|
AttResSw attResSw = queryDataOne(MonitorSourceEnum.ATT_RES_SW, sp); |
|
|
AttResSw attResSw = currentWatterFuture.join(); |
|
|
|
|
|
// 堰顶高程
|
|
|
// 堰顶高程
|
|
|
if (!Objects.isNull(attResSw)) { |
|
|
if (!Objects.isNull(attResSw)) { |
|
|
attResTaskViewDto.setElevationWeirCrest(attResSw.getWrcrel()); |
|
|
attResTaskViewDto.setElevationWeirCrest(attResSw.getWrcrel()); |
|
|
} |
|
|
} |
|
|
// 设计洪水位、校核洪水位
|
|
|
// 设计洪水位、校核洪水位
|
|
|
CompletableFuture<AttResRspp> attResRsppJsonModelFuture = CompletableFuture.supplyAsync(() -> queryDataOne(MonitorSourceEnum.ATT_RES_RSPP, sp)); |
|
|
AttResRspp attResRspp = queryDataOne(MonitorSourceEnum.ATT_RES_RSPP, sp); |
|
|
AttResRspp attResRsppJsonModel = attResRsppJsonModelFuture.join(); |
|
|
if (!Objects.isNull(attResRspp)) { |
|
|
if (!Objects.isNull(attResRsppJsonModel)) { |
|
|
attResTaskViewDto.setDesignLevel(attResRspp.getDsfllv()); |
|
|
attResTaskViewDto.setDesignLevel(attResRsppJsonModel.getDsfllv()); |
|
|
attResTaskViewDto.setCheckWaterLevel(attResRspp.getChfllv()); |
|
|
attResTaskViewDto.setCheckWaterLevel(attResRsppJsonModel.getChfllv()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 获取嵌套关联字段
|
|
|
|
|
|
DwsAttDamRspp dwsAttDamRspp = queryDataOne(DWS_ATT_DAM_RSPP, sp); |
|
|
|
|
|
if (!Objects.isNull(dwsAttDamRspp)) { |
|
|
|
|
|
String damCode = dwsAttDamRspp.getDamCode(); |
|
|
|
|
|
sp.setDamCode(damCode); |
|
|
|
|
|
sp.setResCode(""); |
|
|
// 坝顶高程
|
|
|
// 坝顶高程
|
|
|
CompletableFuture<List<SkAttDamBase>> attDamBaseJsonMoldeFuture = CompletableFuture.supplyAsync(() -> queryDataList(MonitorSourceEnum.ATT_DAM_BASE, sp)); |
|
|
List<SkAttDamBase> attDamBaseJsonMoldeList = queryDataList(MonitorSourceEnum.ATT_DAM_BASE, sp); |
|
|
List<SkAttDamBase> attDamBaseJsonMoldeList = attDamBaseJsonMoldeFuture.join(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(attDamBaseJsonMoldeList)) { |
|
|
if (!CollectionUtils.isEmpty(attDamBaseJsonMoldeList)) { |
|
|
attDamBaseJsonMoldeList.stream() |
|
|
attDamBaseJsonMoldeList.stream() |
|
|
.map(SkAttDamBase::getDamTopElev) |
|
|
.map(SkAttDamBase::getDamTopElev) |
|
|
.filter(e-> !StringUtils.isNotEmpty(e)) |
|
|
.filter(StringUtils::isNotEmpty) |
|
|
.mapToDouble(Double::parseDouble) |
|
|
.mapToDouble(Double::parseDouble) |
|
|
.max() |
|
|
.max() |
|
|
.ifPresent(aDouble -> attResTaskViewDto.setCrestElevation(String.format("%.2f", aDouble))); |
|
|
.ifPresent(aDouble -> attResTaskViewDto.setCrestElevation(String.format("%.2f", aDouble))); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
sp.setResCode(resCode); |
|
|
// 代表站
|
|
|
// 代表站
|
|
|
CompletableFuture<SkRelStRes> relStResJsonModeFuture = CompletableFuture.supplyAsync(() -> queryDataOne(MonitorSourceEnum.DWS_REL_ST_RES, sp)); |
|
|
List<SkRelStRes> relStResJsonModeList = queryDataList(MonitorSourceEnum.DWS_REL_ST_RES, sp); |
|
|
SkRelStRes relStResJsonMode = relStResJsonModeFuture.join(); |
|
|
if (CollectionUtils.isEmpty(relStResJsonModeList)) { |
|
|
if (Objects.isNull(relStResJsonMode)) { |
|
|
|
|
|
return attResTaskViewDto; |
|
|
return attResTaskViewDto; |
|
|
} |
|
|
} |
|
|
attResTaskViewDto.setStationName(relStResJsonMode.getStName()); |
|
|
SkRelStRes skRelStRes = relStResJsonModeList.stream() |
|
|
attResTaskViewDto.setStationCode(relStResJsonMode.getStCode()); |
|
|
.filter(e -> StringUtils.isNotEmpty(e.getFlag())) |
|
|
|
|
|
.filter(e -> Objects.equals(e.getFlag(), "1")) |
|
|
|
|
|
.findFirst() |
|
|
|
|
|
.orElse(null); |
|
|
|
|
|
log.info("获取SkRelStRes返回数据:{}",JSON.toJSONString(skRelStRes)); |
|
|
|
|
|
if (Objects.isNull(skRelStRes)) { |
|
|
|
|
|
return attResTaskViewDto; |
|
|
|
|
|
} |
|
|
|
|
|
attResTaskViewDto.setStationName(skRelStRes.getStName()); |
|
|
|
|
|
attResTaskViewDto.setStationCode(skRelStRes.getStCode()); |
|
|
|
|
|
|
|
|
// 当前水位
|
|
|
// 当前水位
|
|
|
sp.setStcd(relStResJsonMode.getStCode()); |
|
|
sp.setStcd(skRelStRes.getStCode()); |
|
|
sp.setStartTime(BsSgcSkStatisticsService.getStartOfDay()); |
|
|
sp.setStartTime(BsSgcSkStatisticsService.getStartOfDay()); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getStartOfNextDay()); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getStartOfNextDay()); |
|
|
CompletableFuture<List<MsHdmRsvr>> msHdmRsvrFuture = CompletableFuture.supplyAsync(() -> queryDataList(MonitorSourceEnum.MS_HDM_RSVR, sp)); |
|
|
List<MsHdmRsvr> msHdmRsvrFutureList = queryDataList(MonitorSourceEnum.MS_HDM_RSVR, sp); |
|
|
List<MsHdmRsvr> msHdmRsvrFutureList = msHdmRsvrFuture.join(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(msHdmRsvrFutureList)) { |
|
|
if (!CollectionUtils.isEmpty(msHdmRsvrFutureList)) { |
|
|
// 当前水位
|
|
|
// 当前水位
|
|
|
MsHdmRsvr msHdmRsvr = msHdmRsvrFutureList.stream() |
|
|
MsHdmRsvr msHdmRsvr = msHdmRsvrFutureList.stream() |
|
@ -360,8 +362,7 @@ public class MonitorService { |
|
|
// 去年今日
|
|
|
// 去年今日
|
|
|
sp.setStartTime(BsSgcSkStatisticsService.getLastYearTodayStartOfDay()); |
|
|
sp.setStartTime(BsSgcSkStatisticsService.getLastYearTodayStartOfDay()); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getLastYearTomorrowStartOfDay()); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getLastYearTomorrowStartOfDay()); |
|
|
CompletableFuture<List<MsHdmRsvr>> msHdmRsvrLastFuture = CompletableFuture.supplyAsync(() -> queryDataList(MonitorSourceEnum.MS_HDM_RSVR, sp)); |
|
|
List<MsHdmRsvr> msHdmRsvrLastFutureList = queryDataList(MonitorSourceEnum.MS_HDM_RSVR, sp); |
|
|
List<MsHdmRsvr> msHdmRsvrLastFutureList = msHdmRsvrLastFuture.join(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(msHdmRsvrLastFutureList)) { |
|
|
if (!CollectionUtils.isEmpty(msHdmRsvrLastFutureList)) { |
|
|
MsHdmRsvr msHdmRsvr = msHdmRsvrFutureList.stream() |
|
|
MsHdmRsvr msHdmRsvr = msHdmRsvrFutureList.stream() |
|
|
.filter(e->!Objects.isNull(e.getTm())) |
|
|
.filter(e->!Objects.isNull(e.getTm())) |
|
@ -375,8 +376,7 @@ public class MonitorService { |
|
|
// 近一个小时
|
|
|
// 近一个小时
|
|
|
sp.setStartTime(BsSgcSkStatisticsService.getTimeBeforeHours(1)); |
|
|
sp.setStartTime(BsSgcSkStatisticsService.getTimeBeforeHours(1)); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getCurrentTime()); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getCurrentTime()); |
|
|
CompletableFuture<List<MsHdmObp>> msHdmObpOneListFuture = CompletableFuture.supplyAsync(() -> queryDataList(MonitorSourceEnum.MS_HDM_OBP, sp)); |
|
|
List<MsHdmObp> msHdmObpOneList = queryDataList(MonitorSourceEnum.MS_HDM_OBP, sp); |
|
|
List<MsHdmObp> msHdmObpOneList = msHdmObpOneListFuture.join(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(msHdmObpOneList)) { |
|
|
if (!CollectionUtils.isEmpty(msHdmObpOneList)) { |
|
|
// 近一个小时
|
|
|
// 近一个小时
|
|
|
attResTaskViewDto.setNearlyAnHour(BsSgcSkStatisticsService.getSum(msHdmObpOneList)); |
|
|
attResTaskViewDto.setNearlyAnHour(BsSgcSkStatisticsService.getSum(msHdmObpOneList)); |
|
@ -385,8 +385,7 @@ public class MonitorService { |
|
|
// 近6个小时
|
|
|
// 近6个小时
|
|
|
sp.setStartTime(BsSgcSkStatisticsService.getTimeBeforeHours(6)); |
|
|
sp.setStartTime(BsSgcSkStatisticsService.getTimeBeforeHours(6)); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getCurrentTime()); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getCurrentTime()); |
|
|
CompletableFuture<List<MsHdmObp>> msHdmObpSixListFuture = CompletableFuture.supplyAsync(() -> queryDataList(MonitorSourceEnum.MS_HDM_OBP, sp)); |
|
|
List<MsHdmObp> msHdmObpSixList = queryDataList(MonitorSourceEnum.MS_HDM_OBP, sp); |
|
|
List<MsHdmObp> msHdmObpSixList = msHdmObpSixListFuture.join(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(msHdmObpSixList)) { |
|
|
if (!CollectionUtils.isEmpty(msHdmObpSixList)) { |
|
|
// 近6个小时
|
|
|
// 近6个小时
|
|
|
attResTaskViewDto.setNearlySixHours(BsSgcSkStatisticsService.getSum(msHdmObpSixList)); |
|
|
attResTaskViewDto.setNearlySixHours(BsSgcSkStatisticsService.getSum(msHdmObpSixList)); |
|
@ -395,8 +394,7 @@ public class MonitorService { |
|
|
// 近9个小时
|
|
|
// 近9个小时
|
|
|
sp.setStartTime(BsSgcSkStatisticsService.getTimeBeforeHours(9)); |
|
|
sp.setStartTime(BsSgcSkStatisticsService.getTimeBeforeHours(9)); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getCurrentTime()); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getCurrentTime()); |
|
|
CompletableFuture<List<MsHdmObp>> msHdmObpNineListFuture = CompletableFuture.supplyAsync(() -> queryDataList(MonitorSourceEnum.MS_HDM_OBP, sp)); |
|
|
List<MsHdmObp> msHdmObpNineList = queryDataList(MonitorSourceEnum.MS_HDM_OBP, sp); |
|
|
List<MsHdmObp> msHdmObpNineList = msHdmObpNineListFuture.join(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(msHdmObpNineList)) { |
|
|
if (!CollectionUtils.isEmpty(msHdmObpNineList)) { |
|
|
// 近9个小时
|
|
|
// 近9个小时
|
|
|
attResTaskViewDto.setNearlyNineHours(BsSgcSkStatisticsService.getSum(msHdmObpNineList)); |
|
|
attResTaskViewDto.setNearlyNineHours(BsSgcSkStatisticsService.getSum(msHdmObpNineList)); |
|
@ -405,8 +403,7 @@ public class MonitorService { |
|
|
// 近12个小时
|
|
|
// 近12个小时
|
|
|
sp.setStartTime(BsSgcSkStatisticsService.getTimeBeforeHours(12)); |
|
|
sp.setStartTime(BsSgcSkStatisticsService.getTimeBeforeHours(12)); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getCurrentTime()); |
|
|
sp.setEndTime(BsSgcSkStatisticsService.getCurrentTime()); |
|
|
CompletableFuture<List<MsHdmObp>> msHdmObpTwelveListFuture = CompletableFuture.supplyAsync(() -> queryDataList(MonitorSourceEnum.MS_HDM_OBP, sp)); |
|
|
List<MsHdmObp> msHdmObpTwelveList = queryDataList(MonitorSourceEnum.MS_HDM_OBP, sp); |
|
|
List<MsHdmObp> msHdmObpTwelveList = msHdmObpTwelveListFuture.join(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(msHdmObpTwelveList)) { |
|
|
if (!CollectionUtils.isEmpty(msHdmObpTwelveList)) { |
|
|
// 近12个小时
|
|
|
// 近12个小时
|
|
|
attResTaskViewDto.setNearlyTwelveHours(BsSgcSkStatisticsService.getSum(msHdmObpNineList)); |
|
|
attResTaskViewDto.setNearlyTwelveHours(BsSgcSkStatisticsService.getSum(msHdmObpNineList)); |
|
|