fix:过鱼数量获取有数据的测站树形下拉

This commit is contained in:
tangwei 2026-08-11 11:55:57 +08:00
parent d9cf63e993
commit 8e70007bd3
7 changed files with 158 additions and 1 deletions

View File

@ -84,4 +84,11 @@ public class SdEngMonitorController {
DataSourceResult<RstcdTreeInfoVo> result = engInfoBHService.getEngTreeByAlong(dataSourceRequest);
return ResponseResult.successData(result);
}
@PostMapping("/vmsstbprpt/engTree/GetKendoList")
@Operation(summary = "沿程对象视图 树形结构数据信息 电站沿程排序")
public ResponseResult getVmsstbprptEngTreeKendoList(@RequestBody DataSourceRequest dataSourceRequest) {
DataSourceResult<RstcdTreeInfoVo> result = engInfoBHService.getEngTreeByAlong(dataSourceRequest);
return ResponseResult.successData(result);
}
}

View File

@ -130,4 +130,10 @@ public class FishPassageController {
public ResponseResult getYearFpStatic(@RequestParam("year") String year,@RequestParam(value = "stcd",required = false) String stcd) {
return ResponseResult.successData(fpRunService.getYearFpStatic(year,stcd));
}
@PostMapping("/query/getTreeStcdList")
@Operation(summary = "过鱼数量获取有数据的测站树形下拉")
public ResponseResult getTreeStcdList(@RequestBody DataSourceRequest dataSourceRequest) {
return ResponseResult.successData(fpRunService.getTreeStcdList(dataSourceRequest));
}
}

View File

@ -0,0 +1,24 @@
package com.yfd.platform.qgc_env.fp.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 过鱼设施测站树形分组 VO RSTCD 分组
*/
@Data
@Schema(description = "过鱼设施测站树形分组")
public class FpTreeStcdGroupVo {
@Schema(description = "电站编码")
private String rstcd;
@Schema(description = "电站名称")
private String ennm;
@Schema(description = "测站列表")
private List<FpTreeStcdVo> items = new ArrayList<>();
}

View File

@ -0,0 +1,36 @@
package com.yfd.platform.qgc_env.fp.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 过鱼设施测站条目 VO
*/
@Data
@Schema(description = "过鱼设施测站条目")
public class FpTreeStcdVo {
@Schema(description = "测站编码")
private String stcd;
@Schema(description = "测站名称")
private String stnm;
@Schema(description = "监测方式1=人工 2=自动")
private Integer mway;
@Schema(description = "经度")
private String lgtd;
@Schema(description = "纬度")
private String lttd;
@Schema(description = "所属基地编码")
private String baseId;
@Schema(description = "所属电站编码")
private String rstcd;
@Schema(description = "所属电站名称")
private String ennm;
}

View File

@ -8,6 +8,7 @@ import com.yfd.platform.qgc_env.fp.entity.vo.FpFpssrlQueryVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpRunAnalysisTableVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpSdfpssrVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpTableVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpTreeStcdGroupVo;
import com.yfd.platform.qgc_env.fp.entity.vo.YearFpStatisticsVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpRunPlanVo;
@ -32,4 +33,6 @@ public interface FpRunService {
DataSourceResult<FpFishSelectVo> getFishSelect(DataSourceRequest dataSourceRequest);
List<YearFpStatisticsVo> getYearFpStatic(String year,String stcd);
DataSourceResult<FpTreeStcdGroupVo> getTreeStcdList(DataSourceRequest dataSourceRequest);
}

View File

@ -23,6 +23,8 @@ import com.yfd.platform.qgc_env.fp.entity.vo.FpRunAnalysisVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpRunPlanVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpSdfpssrVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpTableVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpTreeStcdGroupVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpTreeStcdVo;
import com.yfd.platform.qgc_env.fp.entity.vo.YearFpStatisticsVo;
import com.yfd.platform.qgc_env.fp.service.FpRunService;
import com.yfd.platform.utils.QgcQueryWrapperUtil;
@ -2734,4 +2736,83 @@ public class FpRunServiceImpl implements FpRunService {
}
return StrUtil.blankToDefault(StrUtil.trim(fallbackFishText), null);
}
@Override
public DataSourceResult<FpTreeStcdGroupVo> getTreeStcdList(DataSourceRequest dataSourceRequest) {
// 查询 SD_FPSSRL_R自动, MWAY=2 SD_FPSS_R人工, MWAY=1中有过鱼数据的测站
// 关联 V_MS_STBPRP_T 视图获取测站基础信息 ENNM 电站名称
String sql = "SELECT STCD, STNM, MWAY, LGTD, LTTD, BASE_ID, RSTCD, ENNM "
+ "FROM ("
+ " SELECT DISTINCT t2.STCD, t2.STNM, t2.BASE_ID, t2.RSTCD, t2.LGTD, t2.LTTD, t2.MWAY, t2.ENNM "
+ " FROM SD_FPSSRL_R t1 "
+ " INNER JOIN V_MS_STBPRP_T t2 ON t1.STCD = t2.STCD "
+ " WHERE NVL(t2.IS_DELETED, 0) = 0 AND t2.MWAY = 2 AND t1.FTP IS NOT NULL "
+ " UNION "
+ " SELECT DISTINCT t4.STCD, t4.STNM, t4.BASE_ID, t4.RSTCD, t4.LGTD, t4.LTTD, t4.MWAY, t4.ENNM "
+ " FROM SD_FPSS_R t3 "
+ " INNER JOIN V_MS_STBPRP_T t4 ON t3.STCD = t4.STCD "
+ " WHERE NVL(t4.IS_DELETED, 0) = 0 AND t4.MWAY = 1 AND t3.FTP IS NOT NULL "
+ " AND NVL(t3.IS_DELETED, 0) = 0"
+ ")";
Map<String, Object> paramMap = new HashMap<>();
List<FpTreeStcdVo> allItems = microservicDynamicSQLMapper
.getAllListWithResultType(sql, paramMap, FpTreeStcdVo.class);
if (CollUtil.isEmpty(allItems)) {
DataSourceResult<FpTreeStcdGroupVo> emptyResult = new DataSourceResult<>();
emptyResult.setData(new ArrayList<>());
emptyResult.setTotal(0L);
emptyResult.setAggregates(new HashMap<>());
return emptyResult;
}
// RSTCD 分组构建树形结构
Map<String, FpTreeStcdGroupVo> groupedMap = new LinkedHashMap<>();
for (FpTreeStcdVo item : allItems) {
String rstcd = StrUtil.blankToDefault(item.getRstcd(), "");
if (rstcd.contains(",")) {
// 处理逗号分隔的多个 RSTCD
for (String singleRstcd : rstcd.split(",")) {
String r = singleRstcd.trim();
if (StrUtil.isNotBlank(r)) {
groupedMap.computeIfAbsent(r, k -> {
FpTreeStcdGroupVo group = new FpTreeStcdGroupVo();
group.setRstcd(r);
group.setEnnm(item.getEnnm());
return group;
}).getItems().add(item);
}
}
} else if (StrUtil.isNotBlank(rstcd)) {
groupedMap.computeIfAbsent(rstcd, k -> {
FpTreeStcdGroupVo group = new FpTreeStcdGroupVo();
group.setRstcd(rstcd);
group.setEnnm(item.getEnnm());
return group;
}).getItems().add(item);
} else {
groupedMap.computeIfAbsent("other", k -> {
FpTreeStcdGroupVo group = new FpTreeStcdGroupVo();
group.setRstcd("other");
group.setEnnm("其它");
return group;
}).getItems().add(item);
}
}
List<FpTreeStcdGroupVo> resultList = new ArrayList<>(groupedMap.values());
// RSTCD 排序other 排最后
resultList.sort((a, b) -> {
if ("other".equals(a.getRstcd())) return 1;
if ("other".equals(b.getRstcd())) return -1;
return a.getRstcd().compareTo(b.getRstcd());
});
DataSourceResult<FpTreeStcdGroupVo> result = new DataSourceResult<>();
result.setData(resultList);
result.setTotal(resultList.size());
result.setAggregates(new HashMap<>());
return result;
}
}

View File

@ -28,7 +28,7 @@ public interface MsMapmoduleBMapper extends BaseMapper<MsMapmoduleB> {
+ "BML.PARAMJSON AS paramJson, BML.URL, BML.URL_THD AS urlThd, BML.OPACITY, BML.SYSTEM_ID AS systemId, "
+ "BML.OPTIONS, BMM.MULTI_SELECT AS multiSelect, BMM.CAN_BE_CHECKED AS canBeChecked, "
+ "CASE WHEN BMM.CHECKED IS NULL THEN 0 ELSE BMM.CHECKED END AS checked, BML.ORDER_INDEX "
+ "FROM MS_MAPLAYER_B BML LEFT JOIN MS_MAPMODULE_B BMM ON BML.ID = BMM.RES_ID "
+ "FROM MS_MAPLAYER_B BML LEFT JOIN MS_MAPMODULE_B BMM ON BML.ID = BMM.RES_ID AND BMM.IS_DELETED = 0"
+ "<if test=\"moduleId != null and moduleId != ''\"> AND BMM.MODULE_ID = #{moduleId}</if>"
+ "<if test=\"sid != null and sid != ''\"> AND BMM.SYSTEM_ID = #{sid}</if>"
+ "<choose>"