feat: 全过程过鱼人工监测数据查询优化&查询过鱼设施指定年份鱼类下拉选

This commit is contained in:
tangwei 2026-06-11 10:38:58 +08:00
parent f0dcf99d28
commit dda9e145ae
5 changed files with 97 additions and 1 deletions

View File

@ -46,6 +46,12 @@ public class FishPassageController {
return ResponseResult.successData(fpRunService.processQgcFpssTableKendoList(dataSourceRequest)); return ResponseResult.successData(fpRunService.processQgcFpssTableKendoList(dataSourceRequest));
} }
@PostMapping("/run/fish/select")
@Operation(summary = "查询过鱼设施指定年份鱼类下拉选")
public ResponseResult getFishSelect(@RequestBody DataSourceRequest dataSourceRequest) {
return ResponseResult.successData(fpRunService.getFishSelect(dataSourceRequest));
}
@PostMapping("/build/GetKendoListCust") @PostMapping("/build/GetKendoListCust")
@Operation(summary = "过鱼设施建设及接入情况统计") @Operation(summary = "过鱼设施建设及接入情况统计")
public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) { public ResponseResult getKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {

View File

@ -0,0 +1,11 @@
package com.yfd.platform.qgc_env.fp.entity.vo;
import lombok.Data;
@Data
public class FpFishSelectVo {
private String id;
private String name;
}

View File

@ -63,6 +63,12 @@ public class FpSdfpssrVo {
@Schema(description = "附件ID") @Schema(description = "附件ID")
private String fid; private String fid;
@Schema(description = "视频")
private String vdpth;
@Schema(description = "图片")
private String picpth;
@Schema(description = "游向") @Schema(description = "游向")
private Integer direction; private Integer direction;

View File

@ -2,6 +2,7 @@ package com.yfd.platform.qgc_env.fp.service;
import com.yfd.platform.common.DataSourceRequest; import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult; import com.yfd.platform.common.DataSourceResult;
import com.yfd.platform.qgc_env.fp.entity.vo.FpFishSelectVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpSdfpssrVo; 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.FpTableVo;
import com.yfd.platform.qgc_env.fp.entity.vo.YearFpStatisticsVo; import com.yfd.platform.qgc_env.fp.entity.vo.YearFpStatisticsVo;
@ -17,5 +18,7 @@ public interface FpRunService {
DataSourceResult<FpTableVo> processQgcFpssTableKendoList(DataSourceRequest dataSourceRequest); DataSourceResult<FpTableVo> processQgcFpssTableKendoList(DataSourceRequest dataSourceRequest);
DataSourceResult<FpFishSelectVo> getFishSelect(DataSourceRequest dataSourceRequest);
List<YearFpStatisticsVo> getYearFpStatic(String year); List<YearFpStatisticsVo> getYearFpStatic(String year);
} }

View File

@ -13,6 +13,7 @@ import com.yfd.platform.common.GroupHelper;
import com.yfd.platform.common.GroupingInfo; import com.yfd.platform.common.GroupingInfo;
import com.yfd.platform.common.MicroservicDynamicSQLMapper; import com.yfd.platform.common.MicroservicDynamicSQLMapper;
import com.yfd.platform.common.exception.BizException; import com.yfd.platform.common.exception.BizException;
import com.yfd.platform.qgc_env.fp.entity.vo.FpFishSelectVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpFtpStatisticsVo; import com.yfd.platform.qgc_env.fp.entity.vo.FpFtpStatisticsVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpRunPlanVo; 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.FpSdfpssrVo;
@ -128,6 +129,39 @@ public class FpRunServiceImpl implements FpRunService {
return queryQgcFpssTableGroupList(dataSourceRequest, loadOptions, stcd); return queryQgcFpssTableGroupList(dataSourceRequest, loadOptions, stcd);
} }
@Override
public DataSourceResult<FpFishSelectVo> getFishSelect(DataSourceRequest dataSourceRequest) {
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
String stcd = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stcd");
if (StrUtil.isBlank(stcd)) {
throw new BizException("过鱼设施(stcd)编码不能为空.");
}
String tm = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "tm");
if (StrUtil.isBlank(tm) || !tm.contains(",")) {
throw new BizException("时间范围(tm)不能为空,格式应为开始时间,结束时间.");
}
String[] tmArr = tm.split(",");
if (tmArr.length < 2 || StrUtil.isBlank(tmArr[0]) || StrUtil.isBlank(tmArr[1])) {
throw new BizException("时间范围(tm)格式错误.");
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("stcd", StrUtil.trim(stcd));
paramMap.put("tmStart", StrUtil.trim(tmArr[0]));
paramMap.put("tmEnd", StrUtil.trim(tmArr[1]));
List<FpFishSelectVo> list = microservicDynamicSQLMapper.getAllListWithResultType(
buildFpFishSelectSql(),
paramMap,
FpFishSelectVo.class
);
DataSourceResult<FpFishSelectVo> result = new DataSourceResult<>();
result.setData(list);
result.setTotal(list == null ? 0L : list.size());
result.setAggregates(new HashMap<>());
return result;
}
@Override @Override
public List<YearFpStatisticsVo> getYearFpStatic(String year) { public List<YearFpStatisticsVo> getYearFpStatic(String year) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
@ -737,7 +771,9 @@ public class FpRunServiceImpl implements FpRunService {
"t.FTP AS fishId, " + "t.FTP AS fishId, " +
"t.FCNT AS fcnt, " + "t.FCNT AS fcnt, " +
"t.FSZ AS fsz, " + "t.FSZ AS fsz, " +
"t.FID AS fid, " + "NULL AS fid, " +
"t.PICPTH AS picpth, " +
"t.VDPTH AS vdpth, " +
"t.DIRECTION AS direction, " + "t.DIRECTION AS direction, " +
"1 AS mway, " + "1 AS mway, " +
"t.STRDT AS strdt, " + "t.STRDT AS strdt, " +
@ -790,6 +826,8 @@ public class FpRunServiceImpl implements FpRunService {
selectMap.put("fcnt", "t.fcnt AS fcnt"); selectMap.put("fcnt", "t.fcnt AS fcnt");
selectMap.put("fsz", "t.fsz AS fsz"); selectMap.put("fsz", "t.fsz AS fsz");
selectMap.put("fid", "t.fid AS fid"); selectMap.put("fid", "t.fid AS fid");
selectMap.put("picpth", "t.picpth AS picpth");
selectMap.put("vdpth", "t.vdpth AS vdpth");
selectMap.put("direction", "t.direction AS direction"); selectMap.put("direction", "t.direction AS direction");
selectMap.put("mway", "t.mway AS mway"); selectMap.put("mway", "t.mway AS mway");
selectMap.put("strdt", "t.strdt AS strdt"); selectMap.put("strdt", "t.strdt AS strdt");
@ -1141,6 +1179,38 @@ public class FpRunServiceImpl implements FpRunService {
"ORDER BY eng.BASE_ID, a.FTP"; "ORDER BY eng.BASE_ID, a.FTP";
} }
private String buildFpFishSelectSql() {
return "SELECT DISTINCT t.ID AS id, t.NAME AS name " +
"FROM ( " +
" SELECT a.FTP AS ID, " +
" COALESCE(fishRv.NAME, relRv.FISH_NAME, fishZy.NAME, relZy.FISH_NAME, fishDirect.NAME) AS NAME " +
" FROM SD_FPSS_R a " +
" INNER JOIN SD_FPSS_B_H fp ON fp.STCD = a.STCD " +
" LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = fp.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 " +
" LEFT JOIN SD_FISHDICTORY_RLTN_B relRv ON relRv.FISH_ID = a.FTP " +
" AND relRv.RVCD = eng.HBRVCD " +
" AND NVL(relRv.IS_DELETED, 0) = 0 " +
" LEFT JOIN SD_FISHDICTORY_B fishRv ON fishRv.ID = NVL(relRv.ZY_FISH_ID, relRv.FISH_ID) " +
" AND NVL(fishRv.IS_DELETED, 0) = 0 " +
" AND NVL(fishRv.ENABLE, 1) = 1 " +
" LEFT JOIN SD_FISHDICTORY_RLTN_B relZy ON relZy.FISH_ID = a.FTP " +
" AND relZy.RVCD = 'ZY' " +
" AND NVL(relZy.IS_DELETED, 0) = 0 " +
" LEFT JOIN SD_FISHDICTORY_B fishZy ON fishZy.ID = NVL(relZy.ZY_FISH_ID, relZy.FISH_ID) " +
" AND NVL(fishZy.IS_DELETED, 0) = 0 " +
" AND NVL(fishZy.ENABLE, 1) = 1 " +
" LEFT JOIN SD_FISHDICTORY_B fishDirect ON fishDirect.ID = a.FTP " +
" AND NVL(fishDirect.IS_DELETED, 0) = 0 " +
" AND NVL(fishDirect.ENABLE, 1) = 1 " +
" WHERE NVL(a.IS_DELETED, 0) = 0 " +
" AND a.STCD = #{map.stcd} " +
" AND a.STRDT >= TO_DATE(#{map.tmStart}, 'YYYY-MM-DD HH24:MI:SS') " +
" AND a.STRDT <= TO_DATE(#{map.tmEnd}, 'YYYY-MM-DD HH24:MI:SS') " +
") t " +
"WHERE t.NAME IS NOT NULL " +
"ORDER BY t.NAME";
}
private String resolveFallbackFishText(String fallbackFishJson, String fallbackFishText) { private String resolveFallbackFishText(String fallbackFishJson, String fallbackFishText) {
if (StrUtil.isNotBlank(fallbackFishJson)) { if (StrUtil.isNotBlank(fallbackFishJson)) {
Set<String> fishNames = new LinkedHashSet<>(); Set<String> fishNames = new LinkedHashSet<>();