feat: 增加水温监测逻辑

This commit is contained in:
tangwei 2026-05-17 18:50:33 +08:00
parent 5218584728
commit 831a04dc40
12 changed files with 403 additions and 65 deletions

View File

@ -0,0 +1,36 @@
package com.yfd.platform.env.controller;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.env.service.SdDzChuiXiangListService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 电站专题垂向水温一级面板Controller
*
* @author
* @date 2023/04/18 19:22
*/
@RestController
@RequestMapping("/sw/dzCxList")
@Tag(name = "电站专题垂向水温一级面板")
@Validated
public class SdDzChuiXiangListController {
@Resource
private SdDzChuiXiangListService sdDzChuiXiangListService;
@PostMapping({"/GetKendoListCust"})
@Operation(summary = "电站专题垂向水温一级面板数据列表")
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
return ResponseResult.successData(sdDzChuiXiangListService.processKendoList(dataSourceRequest));
}
}

View File

@ -0,0 +1,36 @@
package com.yfd.platform.env.controller;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.env.service.SdWtvtRService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 垂向水温Controller
*
* @author
* @date 2023/04/18 19:22
*/
@RestController
@RequestMapping("/sw/wtvt")
@Tag(name = "垂向水温")
@Validated
public class SdWtvtRController {
@Resource
private SdWtvtRService sdWtvtRService;
@PostMapping({"/defaultYear/GetKendoListCust"})
@Operation(summary = "获取垂向水温有数据的年份")
public ResponseResult getWtrvDefaultYear(@RequestBody DataSourceRequest dataSourceRequest) {
return ResponseResult.successData(sdWtvtRService.getWtrvDefaultYear(dataSourceRequest));
}
}

View File

@ -0,0 +1,21 @@
package com.yfd.platform.env.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.FieldNameConstants;
import java.math.BigDecimal;
@Getter
@Setter
@FieldNameConstants
@Schema(description = "电站专题垂向水温一级面板VO")
public class SdDzChuiXiangListVO {
@Schema(description = "水温深度")
private BigDecimal wthg;
@Schema(description = "水温")
private BigDecimal vwt;
}

View File

@ -0,0 +1,21 @@
package com.yfd.platform.env.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.FieldNameConstants;
import java.math.BigDecimal;
@Getter
@Setter
@FieldNameConstants
@Schema(description = "垂向水温年份列表VO")
public class SdWtvtYearVo {
@Schema(description = "站码")
private String stcd;
@Schema(description = "年份")
private String yr;
}

View File

@ -21,82 +21,105 @@ import java.util.List;
public interface AlongListMapper extends BaseMapper<SdAlongVO> {
@Select("<script>" +
"select to_char(max(TM),'yyyy-MM-dd HH24:mi:ss') tm from SD_WTRV_R " +
"where STCD in " +
"(select STCD from V_MS_STBPRP_T a " +
"where STTP_CODE='WTRV' " +
"and ENG_DWT_CODE is not null " +
"and IS_DELETED=0 " +
"and RSTCDSTEPSORT is not null " +
"select to_char(max(SWR.TM),'yyyy-MM-dd HH24:mi:ss') tm " +
"from SD_WTRV_R SWR " +
"where SWR.IS_DELETED=0 " +
"and SWR.STCD in (" +
" select SAD.STCD " +
" from MS_ALONG_B MAB " +
" inner join MS_ALONGDET_B SAD on SAD.ALONG_ID = MAB.ID " +
" where MAB.CODE='common' " +
" and MAB.IS_DELETED=0 " +
" and SAD.IS_DELETED=0 " +
" and SAD.STTP='WTRV' " +
" <if test='rvcd != null and rvcd != \"\"'>" +
"and HBRVCD=#{rvcd} " +
" and MAB.RVCD=#{rvcd} " +
" </if>" +
" ) " +
"</script>")
String getAlongLatestTm(@Param("rvcd") String rvcd);
@Select("<script>" +
"SELECT SARC.stcd, " +
"SARC.rstcd, " +
"MAB.RVCD, " +
"MAB.ORDER_INDEX AS rvcdSort, " +
"SARC.sort, " +
"CASE WHEN SARC.STTP = 'ENG' THEN '1' WHEN SARC.STTP = 'WTRV' THEN '2' END AS sttp, " +
"SWR.WT AS temperature, " +
"SWR.TM, " +
"SWR.TM AS minTm, " +
"MST.STNM " +
"FROM MS_ALONG_B MAB " +
"INNER JOIN MS_ALONGDET_B SARC ON MAB.ID = SARC.ALONG_ID " +
"INNER JOIN MS_STBPRP_T MST ON MST.stcd = SARC.STCD " +
"LEFT JOIN (" +
"SELECT * FROM SD_WTRV_R where is_deleted=0 " +
"<if test='maxTime != null'>" +
"and TM = #{maxTime} " +
"</if>" +
"<if test='maxTime == null'>" +
"and TM is null " +
"</if>" +
") SWR ON SWR.STCD = SARC.STCD " +
"WHERE MAB.CODE = 'common' " +
"AND (SARC.STTP = 'ENG' OR SARC.STTP = 'WTRV') " +
"AND SARC.IS_DELETED = 0 " +
"AND MST.IS_DELETED = 0 " +
"AND MAB.IS_DELETED = 0 " +
"select stcd, rstcd, sttp, temperature, stnm, tm, minTm from (" +
" select " +
" SAD.STCD as stcd, " +
" SAD.RSTCD as rstcd, " +
" '1' as sttp, " +
" null as temperature, " +
" ENG.ENNM as stnm, " +
" null as tm, " +
" null as minTm, " +
" MAB.ORDER_INDEX as rvcdSort, " +
" SAD.SORT as sort " +
" from MS_ALONG_B MAB " +
" inner join MS_ALONGDET_B SAD on MAB.ID = SAD.ALONG_ID " +
" inner join SD_ENGINFO_B_H ENG on ENG.STCD = SAD.STCD " +
" where MAB.CODE='common' " +
" and MAB.IS_DELETED=0 " +
" and SAD.IS_DELETED=0 " +
" and SAD.STTP='ENG' " +
" <if test='rvcd != null and rvcd != \"\"'>" +
"and MAB.rvcd=#{rvcd} " +
" and MAB.RVCD=#{rvcd} " +
" </if>" +
" <if test='baseId != null and baseId != \"\"'>" +
"and MAB.RVCD in (select WBS_CODE from SD_WBS_B where WBS_TYPE='PSB_RVCD' and is_deleted=0 and OBJ_ID=#{baseId}) " +
" and MAB.RVCD in (select HBRVCD from SD_HBRV_DIC where IS_DELETED=0 and ENABLED=1 and BASEID=#{baseId}) " +
" </if>" +
"order by MAB.order_index asc, SARC.sort asc" +
" union all " +
" select " +
" SAD.STCD as stcd, " +
" SAD.RSTCD as rstcd, " +
" '2' as sttp, " +
" SWR.WT as temperature, " +
" WT.STNM as stnm, " +
" null as tm, " +
" null as minTm, " +
" MAB.ORDER_INDEX as rvcdSort, " +
" SAD.SORT as sort " +
" from MS_ALONG_B MAB " +
" inner join MS_ALONGDET_B SAD on MAB.ID = SAD.ALONG_ID " +
" inner join SD_WT_B_H WT on WT.STCD = SAD.STCD and WT.IS_DELETED=0 and WT.STTP='WTRV' " +
" left join SD_WTRV_R SWR on SWR.STCD = SAD.STCD and SWR.IS_DELETED=0 " +
" <if test='maxTime != null'>" +
" and SWR.TM = #{maxTime} " +
" </if>" +
" <if test='maxTime == null'>" +
" and 1 = 0 " +
" </if>" +
" where MAB.CODE='common' " +
" and MAB.IS_DELETED=0 " +
" and SAD.IS_DELETED=0 " +
" and SAD.STTP='WTRV' " +
" <if test='rvcd != null and rvcd != \"\"'>" +
" and MAB.RVCD=#{rvcd} " +
" </if>" +
" <if test='baseId != null and baseId != \"\"'>" +
" and MAB.RVCD in (select HBRVCD from SD_HBRV_DIC where IS_DELETED=0 and ENABLED=1 and BASEID=#{baseId}) " +
" </if>" +
") T order by rvcdSort asc, sort asc" +
"</script>")
List<SdAlongVO> getAlongListData(@Param("rvcd") String rvcd,@Param("baseId") String baseId,@Param("maxTime") Date maxTime);
@Select("<script>" +
"select TM from (" +
"SELECT MST.STCD, SWR.TM " +
"SELECT SWR.TM " +
"FROM MS_ALONG_B MAB " +
"INNER JOIN MS_ALONGDET_B SARC ON MAB.ID = SARC.ALONG_ID " +
"INNER JOIN MS_STBPRP_T MST ON MST.stcd = SARC.STCD " +
"INNER JOIN (" +
"select * from SD_WTRV_R where is_deleted = 0 " +
"INNER JOIN MS_ALONGDET_B SAD ON MAB.ID = SAD.ALONG_ID " +
"INNER JOIN SD_WT_B_H WT ON WT.STCD = SAD.STCD and WT.IS_DELETED=0 and WT.STTP='WTRV' " +
"INNER JOIN SD_WTRV_R SWR ON SWR.STCD = SAD.STCD and SWR.IS_DELETED=0 " +
"<if test='startTime != null and endTime != null'>" +
"and tm between #{startTime} and #{endTime} " +
"and SWR.TM between #{startTime} and #{endTime} " +
"</if>" +
") SWR ON SWR.STCD = SARC.STCD " +
"WHERE MAB.CODE = 'common' " +
"and MST.IS_DELETED=0 " +
"AND SARC.STTP = 'WTRV' " +
"AND SARC.IS_DELETED = 0 " +
"AND SAD.STTP = 'WTRV' " +
"AND SAD.IS_DELETED = 0 " +
"AND MAB.IS_DELETED = 0 " +
"<if test='rvcd != null and rvcd != \"\"'>" +
"and MAB.rvcd=#{rvcd} " +
"and MAB.RVCD=#{rvcd} " +
"</if>" +
"<if test='baseId != null and baseId != \"\"'>" +
"and MAB.RVCD in (select WBS_CODE from SD_WBS_B where WBS_TYPE='PSB_RVCD' and is_deleted=0 and OBJ_ID=#{baseId}) " +
"and MAB.RVCD in (select HBRVCD from SD_HBRV_DIC where IS_DELETED=0 and ENABLED=1 and BASEID=#{baseId}) " +
"</if>" +
"order by MAB.order_index asc, SARC.SORT asc, SWR.TM desc" +
"order by MAB.ORDER_INDEX asc, SAD.SORT asc, SWR.TM desc" +
") where ROWNUM=1" +
"</script>")
Date getMaxTime(@Param("rvcd") String rvcd,@Param("baseId") String baseId,@Param("startTime") Date startTime,@Param("endTime") Date endTime);

View File

@ -0,0 +1,30 @@
package com.yfd.platform.env.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.env.entity.vo.SdDzChuiXiangListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 电站专题垂向水温一级面板Mapper
*
* @author
* @since 2023-04-23 09:32:10
*/
@Mapper
public interface SdDzChuiXiangListMapper extends BaseMapper<SdDzChuiXiangListVO> {
@Select("SELECT t1.WTHG, t1.VWT " +
"FROM SD_WTVTDRTP_S t1 " +
"WHERE t1.DRTP = 'MON' " +
"AND t1.MONTH = #{mon} " +
"AND t1.YEAR = #{year} " +
"AND t1.STCD = #{stcd} " +
"ORDER BY t1.WTHG ASC")
List<SdDzChuiXiangListVO> getYearTempChange(@Param("stcd") String stcd,
@Param("mon") Integer mon,
@Param("year") String year);
}

View File

@ -0,0 +1,31 @@
package com.yfd.platform.env.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yfd.platform.env.entity.vo.SdWtvtYearVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 垂向水温年份数据Mapper
*
* @author
* @since 2023-04-23 09:32:10
*/
@Mapper
public interface SdWtvtRMapper extends BaseMapper<SdWtvtYearVo> {
@Select("<script>" +
"SELECT STCD, TO_CHAR(TM, 'yyyy') AS yr " +
"FROM SD_WTVT_R " +
"WHERE IS_DELETED = 0 " +
"<if test='stcd != null and stcd != \"\"'>" +
"AND STCD = #{stcd} " +
"</if>" +
"GROUP BY STCD, TO_CHAR(TM, 'yyyy') " +
"ORDER BY STCD, TO_CHAR(TM, 'yyyy') DESC" +
"</script>")
List<SdWtvtYearVo> getWtrvDefaultYear(@Param("stcd") String stcd);
}

View File

@ -0,0 +1,23 @@
package com.yfd.platform.env.service;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
import java.util.Map;
/**
* 电站专题垂向水温一级面板Service接口
*
* @author
* @since 2023-04-23 09:32:10
*/
public interface SdDzChuiXiangListService {
/**
* 处理kendo列表数据
*
* @param dataSourceRequest 数据源请求
* @return 数据源结果
*/
DataSourceResult processKendoList(DataSourceRequest dataSourceRequest);
}

View File

@ -0,0 +1,21 @@
package com.yfd.platform.env.service;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
/**
* 垂向水温Service接口
*
* @author
* @since 2023-04-23 09:32:10
*/
public interface SdWtvtRService {
/**
* 获取垂向水温有数据的年份列表
*
* @param dataSourceRequest 数据源请求
* @return 数据源结果
*/
DataSourceResult getWtrvDefaultYear(DataSourceRequest dataSourceRequest);
}

View File

@ -62,8 +62,8 @@ public class AlongListServiceImpl extends ServiceImpl<AlongListMapper, SdAlongVO
"\t( SELECT RVCD,SORT FROM " +
"\t(select MAB.RVCD,SAB.STCD,CASE WHEN MAB.RVCD #{rvcd} THEN 0 ELSE 1 END AS SORT from MS_ALONG_B MAB inner join MS_ALONGDET_B SAB on SAB.ALONG_ID = MAB.ID WHERE SAB.IS_DELETED =0 AND MAB.IS_DELETED =0 AND SAB.STTP IN ('WTRV', 'ENG') and MAB.CODE='common') t1 " +
"\tINNER JOIN " +
"\t(SELECT WBS_CODE FROM SD_WBS_B WHERE wbs_type = 'PSB_RVCD' #{full_path} AND WBS_NAME IS NOT NULL) t2 " +
"\tON t1.RVCD = t2.WBS_CODE " +
"\t(SELECT HBRVCD FROM SD_HBRV_DIC WHERE IS_DELETED=0 AND ENABLED=1 #{full_path} AND HBRVNM IS NOT NULL) t2 " +
"\tON t1.RVCD = t2.HBRVCD " +
"\tINNER JOIN " +
"\t(SELECT STCD FROM SD_WTRV_R WHERE TM >= #{tm} AND TM <= #{tm_1} AND WT IS NOT NULL ) t3 " +
"\tON t1.STCD = t3.STCD ORDER BY SORT ASC " +
@ -76,7 +76,7 @@ public class AlongListServiceImpl extends ServiceImpl<AlongListMapper, SdAlongVO
if(fullPathStr.startsWith("'") && fullPathStr.endsWith("'")){
fullPathStr = fullPathStr.substring(1,fullPathStr.length()-1);
}
sqlWhereMap.put("full_path","AND OBJ_ID = '"+fullPathStr+"'");
sqlWhereMap.put("full_path","AND BASEID = '"+fullPathStr+"'");
}else{
sqlWhereMap.put("full_path"," ");
}

View File

@ -0,0 +1,49 @@
package com.yfd.platform.env.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfd.platform.common.DataSourceLoadOptionsBase;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.env.entity.vo.SdDzChuiXiangListVO;
import com.yfd.platform.env.mapper.SdDzChuiXiangListMapper;
import com.yfd.platform.env.service.SdDzChuiXiangListService;
import com.yfd.platform.utils.QgcQueryWrapperUtil;
import com.yfd.platform.utils.QueryWrapperUtil;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 电站专题垂向水温一级面板Service实现类
*
* @author
* @since 2023-04-23 09:32:10
*/
@Service
public class SdDzChuiXiangListServiceImpl extends ServiceImpl<SdDzChuiXiangListMapper, SdDzChuiXiangListVO> implements SdDzChuiXiangListService {
@Resource
private SdDzChuiXiangListMapper sdDzChuiXiangListMapper;
@Override
public DataSourceResult processKendoList(DataSourceRequest dataSourceRequest) {
DataSourceResult dataSourceResult = new DataSourceResult<>();
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
String stcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stcd");
String year = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "year");
int m = 12;
Map<String, List<SdDzChuiXiangListVO>> map = new LinkedHashMap<>();
for (int i = 1; i <= m; i++) {
List<SdDzChuiXiangListVO> list = sdDzChuiXiangListMapper.getYearTempChange(stcd, i, year);
map.put(String.valueOf(i), list != null ? list : List.of());
}
dataSourceResult.setData(null);
dataSourceResult.setTotal(map.size());
dataSourceResult.setAggregates(map);
return dataSourceResult;
}
}

View File

@ -0,0 +1,47 @@
package com.yfd.platform.env.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfd.platform.common.DataSourceLoadOptionsBase;
import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.env.entity.vo.SdWtvtYearVo;
import com.yfd.platform.env.mapper.SdWtvtRMapper;
import com.yfd.platform.env.service.SdWtvtRService;
import com.yfd.platform.utils.QgcQueryWrapperUtil;
import com.yfd.platform.utils.QueryWrapperUtil;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 垂向水温Service实现类
*
* @author
* @since 2023-04-23 09:32:10
*/
@Service
public class SdWtvtRServiceImpl extends ServiceImpl<SdWtvtRMapper, SdWtvtYearVo> implements SdWtvtRService {
@Resource
private SdWtvtRMapper sdWtvtRMapper;
@Override
public DataSourceResult getWtrvDefaultYear(DataSourceRequest dataSourceRequest) {
DataSourceResult<SdWtvtYearVo> dataSourceResult = new DataSourceResult<>();
DataSourceLoadOptionsBase loadOptionsBase = dataSourceRequest.toDevRequest();
String stcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "stcd");
if (StringUtils.isNotBlank(stcd)) {
stcd = stcd.replaceAll("\\[", "")
.replaceAll("]", "")
.replaceAll("\"", "");
}
List<SdWtvtYearVo> result = sdWtvtRMapper.getWtrvDefaultYear(stcd);
dataSourceResult.setTotal(result.size());
dataSourceResult.setData(result);
return dataSourceResult;
}
}