feat: 过鱼设施地图描点接口(仅查询在建状态的)

This commit is contained in:
tangwei 2026-07-06 10:49:40 +08:00
parent aa71489035
commit c056d30682
5 changed files with 272 additions and 5 deletions

View File

@ -106,9 +106,9 @@ public class FishPassageController {
return ResponseResult.successData(fpBuildService.getStInfoByStcd(stcd));
}
@GetMapping("/run/qgc/year/GetYearFpStatistics")
@Operation(summary = "全过程过鱼统计总数,根据基地分组")
public ResponseResult getYearFpStatic(@RequestParam("year") String year) {
return ResponseResult.successData(fpRunService.getYearFpStatic(year));
@PostMapping("/point/built/GetKendoListCust")
@Operation(summary = "过鱼设施地图描点接口(仅查询在建状态的)")
public ResponseResult getFpBuiltPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
return ResponseResult.successData(fpBuildService.getFpBuiltPointKendoListCust(dataSourceRequest));
}
}

View File

@ -0,0 +1,89 @@
package com.yfd.platform.qgc_env.fp.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(description = "过鱼设施锚点VO")
public class FpAnchoPointVo {
@Schema(description = "站点编码")
private String stcd;
@Schema(description = "站名")
private String stnm;
@Schema(description = "弹框站点名称")
private String titleName;
@Schema(description = "建设状态编码")
private String bldsttCcode;
@Schema(description = "建设状态")
private String bldstt;
@Schema(description = "纬度")
private BigDecimal lttd;
@Schema(description = "经度")
private BigDecimal lgtd;
@Schema(description = "高程")
private BigDecimal dtmel;
@Schema(description = "关联电站编码")
private String rstcds;
@Schema(description = "电站名称")
private String ennm;
@Schema(description = "站点类型编码")
private String sttpCode;
@Schema(description = "运行状态")
private String run;
@Schema(description = "设施类型")
private String dwtp;
@Schema(description = "设施类型名称")
private String dwtpName;
@Schema(description = "锚点类型")
private String sttpMap;
@Schema(description = "流域编码")
private String rvcd;
@Schema(description = "行政编码")
private String addvcd;
@Schema(description = "基地编码")
private String baseId;
@Schema(description = "站点类型")
private String sttp;
@Schema(description = "描点状态")
private String anchoPointState;
@Schema(description = "监测方式")
private Integer mway;
@Schema(description = "数据接入")
private Integer dtin;
@Schema(description = "达标状态子类型")
private Integer stdSstate;
@Schema(description = "地图避让")
private Integer distance;
@Schema(description = "过鱼种类")
private Integer ftpTypeCount;
@Schema(description = "过鱼数量")
private Integer ftpCount;
}

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.DataSourceResult;
import com.yfd.platform.qgc_env.fp.entity.vo.FpAnchoPointVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpConstructionSituationVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpFishDicVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpVmsstbprptVo;
@ -19,4 +20,6 @@ public interface FpBuildService {
DataSourceResult<FpVmsstbprptVo> getFpqMsstbprptList(DataSourceRequest dataSourceRequest);
FpVmsstbprptVo getStInfoByStcd(String stcd);
DataSourceResult<FpAnchoPointVo> getFpBuiltPointKendoListCust(DataSourceRequest dataSourceRequest);
}

View File

@ -11,9 +11,11 @@ import com.yfd.platform.common.GroupingInfo;
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
import com.yfd.platform.common.PageInfo;
import com.yfd.platform.common.exception.BizException;
import com.yfd.platform.qgc_env.fp.entity.vo.FpAnchoPointVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpConstructionSituationVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpFishDicVo;
import com.yfd.platform.qgc_env.fp.entity.vo.FpVmsstbprptVo;
import com.yfd.platform.qgc_env.wt.utils.SiteAvoidanceUtils;
import com.yfd.platform.qgc_env.fp.service.FpBuildService;
import com.yfd.platform.utils.QgcQueryWrapperUtil;
import jakarta.annotation.Resource;
@ -1142,4 +1144,177 @@ public class FpBuildServiceImpl implements FpBuildService {
default -> null;
};
}
@Override
public DataSourceResult<FpAnchoPointVo> getFpBuiltPointKendoListCust(DataSourceRequest dataSourceRequest) {
DataSourceResult<FpAnchoPointVo> dataSourceResult = new DataSourceResult<>();
dataSourceResult.setAggregates(new HashMap<>());
if (dataSourceRequest == null) {
dataSourceResult.setData(new ArrayList<>());
dataSourceResult.setTotal(0L);
return dataSourceResult;
}
StringBuilder sql = new StringBuilder("SELECT\n" +
" fp.STCD AS stcd,\n" +
" fp.STNM AS stnm,\n" +
" fp.STNM AS titleName,\n" +
" fp.BLDSTT_CODE AS bldsttCcode,\n" +
" fp.BLDSTT_CODE AS bldstt,\n" +
" fp.LTTD AS lttd,\n" +
" fp.LGTD AS lgtd,\n" +
" fp.ELEV AS dtmel,\n" +
" fp.RSTCD AS rstcds,\n" +
" eng.ENNM AS ennm,\n" +
" 'FP' AS sttpCode,\n" +
" fp.STTP AS dwtp,\n" +
" CASE\n" +
" WHEN fp.STTP = 'FP_1' THEN '鱼道'\n" +
" WHEN fp.STTP = 'FP_2' THEN '仿自然通道'\n" +
" WHEN fp.STTP = 'FP_3' THEN '集运鱼系统'\n" +
" WHEN fp.STTP = 'FP_4' THEN '升鱼机'\n" +
" ELSE '其它'\n" +
" END AS dwtpName,\n" +
" fp.STTP AS sttpMap,\n" +
" eng.RVCD AS rvcd,\n" +
" eng.ADDVCD AS addvcd,\n" +
" eng.BASE_ID AS baseId,\n" +
" fp.STTP AS sttp,\n" +
" fp.MWAY AS mway,\n" +
" fp.DTIN AS dtin\n" +
"FROM SD_FPSS_B_H fp\n" +
"LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = fp.RSTCD AND NVL(eng.IS_DELETED, 0) = 0\n" +
"WHERE NVL(fp.IS_DELETED, 0) = 0 AND fp.BLDSTT_CODE = 1 AND fp.LGTD IS NOT NULL AND fp.LTTD IS NOT NULL ");
Map<String, Object> paramMap = new HashMap<>();
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
String filterSql = buildFpPointFilterCondition(loadOptions.getFilter(), paramMap, new int[]{0});
if (StrUtil.isNotBlank(filterSql)) {
sql.append(" AND ").append(filterSql).append(" ");
}
sql.append(" ORDER BY fp.ORDER_INDEX ASC ");
Page<?> page = QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
List<FpAnchoPointVo> resultList = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, FpAnchoPointVo.class);
for (FpAnchoPointVo vo : resultList) {
String sttp = vo.getSttp();
if ("FP_1".equals(sttp)) {
vo.setAnchoPointState("GY_1_BUILT");
} else if ("FP_2".equals(sttp)) {
vo.setAnchoPointState("GY_2_BUILT");
} else if ("FP_3".equals(sttp)) {
vo.setAnchoPointState("GY_3_BUILT");
} else if ("FP_4".equals(sttp)) {
vo.setAnchoPointState("GY_4_BUILT");
} else {
vo.setAnchoPointState("GY_5_BUILT");
}
}
SiteAvoidanceUtils.calcSiteMapLev(resultList,
FpAnchoPointVo::getStcd,
FpAnchoPointVo::getLgtd,
FpAnchoPointVo::getLttd,
FpAnchoPointVo::getAnchoPointState,
FpAnchoPointVo::setDistance);
dataSourceResult.setData(resultList);
dataSourceResult.setTotal(page == null ? resultList.size() : page.getTotal());
return dataSourceResult;
}
private String buildFpPointFilterCondition(DataSourceRequest.FilterDescriptor filter,
Map<String, Object> paramMap,
int[] indexHolder) {
if (filter == null) {
return "";
}
if (filter.getField() != null && !filter.getField().isBlank()) {
return buildFpPointLeafCondition(filter, paramMap, indexHolder);
}
if (CollectionUtils.isEmpty(filter.getFilters())) {
return "";
}
List<String> conditions = new ArrayList<>();
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
String childSql = buildFpPointFilterCondition(child, paramMap, indexHolder);
if (!childSql.isBlank()) {
conditions.add("(" + childSql + ")");
}
}
if (conditions.isEmpty()) {
return "";
}
String logic = "or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ";
return String.join(logic, conditions);
}
private String buildFpPointLeafCondition(DataSourceRequest.FilterDescriptor filter,
Map<String, Object> paramMap,
int[] indexHolder) {
String field = filter.getField();
if (field == null || field.isBlank()) {
return "";
}
String column = switch (field) {
case "stcd" -> "fp.STCD";
case "stnm" -> "fp.STNM";
case "baseId" -> "eng.BASE_ID";
case "rvcd" -> "eng.RVCD";
case "addvcd" -> "eng.ADDVCD";
case "sttp" -> "fp.STTP";
default -> null;
};
if (column == null) {
return "";
}
String operator = filter.getOperator() == null ? "eq" : filter.getOperator().toLowerCase();
Object value = filter.getValue();
if ("isnull".equals(operator)) {
return column + " IS NULL";
}
if ("isnotnull".equals(operator)) {
return column + " IS NOT NULL";
}
if ("in".equals(operator)) {
List<Object> values = normalizeValues(value);
if (values.isEmpty()) {
return "";
}
List<String> placeholders = new ArrayList<>();
for (Object item : values) {
String paramKey = "fpPointParam" + indexHolder[0]++;
paramMap.put(paramKey, item);
placeholders.add("#{map." + paramKey + "}");
}
return column + " IN (" + String.join(", ", placeholders) + ")";
}
if (value == null) {
return "";
}
String paramKey = "fpPointParam" + indexHolder[0]++;
switch (operator) {
case "eq":
paramMap.put(paramKey, value);
return column + " = #{map." + paramKey + "}";
case "neq":
paramMap.put(paramKey, value);
return column + " <> #{map." + paramKey + "}";
case "contains":
paramMap.put(paramKey, "%" + value + "%");
return column + " LIKE #{map." + paramKey + "}";
case "startswith":
paramMap.put(paramKey, value + "%");
return column + " LIKE #{map." + paramKey + "}";
case "endswith":
paramMap.put(paramKey, "%" + value);
return column + " LIKE #{map." + paramKey + "}";
default:
return "";
}
}
}

View File

@ -2425,7 +2425,7 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
Map<String, Object> paramMap = new HashMap<>();
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
String filterSql = buildMsstbprptFilterCondition(loadOptions.getFilter(), paramMap, new int[]{0});
String filterSql = buildMsstbprptFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), paramMap, new int[]{0});
if (StrUtil.isNotBlank(filterSql)) {
sql.append(" AND ").append(filterSql).append(" ");
}