feat: 栖息地/珍稀植物园/动物救助站描点接口(仅查询在建状态的)
This commit is contained in:
parent
d6ab49711a
commit
fdaba51634
@ -76,4 +76,10 @@ public class VapConstructionController {
|
||||
public ResponseResult getVprYearKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(vpConstructionService.getVprYearList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/fhvap/built/GetKendoListCust")
|
||||
@Operation(summary = "栖息地/珍稀植物园/动物救助站描点接口(仅查询在建状态的)")
|
||||
public ResponseResult getFhvapBuiltPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(vpConstructionService.getFhvapBuiltPointKendoListCust(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
package com.yfd.platform.qgc_env.vap.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FhvapBuiltPointVo {
|
||||
|
||||
private String stcd;
|
||||
|
||||
private String stnm;
|
||||
|
||||
private String titleName;
|
||||
|
||||
private String bldsttCcode;
|
||||
|
||||
private String bldstt;
|
||||
|
||||
private Double lttd;
|
||||
|
||||
private Double lgtd;
|
||||
|
||||
private Double dtmel;
|
||||
|
||||
private String rstcds;
|
||||
|
||||
private String ennm;
|
||||
|
||||
private String sttpCode;
|
||||
|
||||
private String dwtp;
|
||||
|
||||
private String dwtpName;
|
||||
|
||||
private String sttpMap;
|
||||
|
||||
private String rvcd;
|
||||
|
||||
private String addvcd;
|
||||
|
||||
private String baseId;
|
||||
|
||||
private String sttp;
|
||||
|
||||
private String anchoPointState;
|
||||
|
||||
private String mway;
|
||||
|
||||
private Integer dtin;
|
||||
|
||||
private String stdSstate;
|
||||
|
||||
private Integer distance;
|
||||
|
||||
private Integer ftpTypeCount;
|
||||
|
||||
private Integer ftpCount;
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.yfd.platform.qgc_env.vap.service;
|
||||
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.qgc_env.vap.entity.vo.FhvapBuiltPointVo;
|
||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpBasinIntDetailVo;
|
||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpVarVo;
|
||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpStInfoResultVo;
|
||||
@ -27,4 +28,6 @@ public interface VpConstructionService {
|
||||
DataSourceResult getVarYearList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult getVprYearList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FhvapBuiltPointVo> getFhvapBuiltPointKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.yfd.platform.common.GroupHelper;
|
||||
import com.yfd.platform.common.GroupingInfo;
|
||||
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||
import com.yfd.platform.common.PageInfo;
|
||||
import com.yfd.platform.qgc_env.vap.entity.vo.FhvapBuiltPointVo;
|
||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpBasinIntDetailVo;
|
||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpConstructionSituationVo;
|
||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpVarVo;
|
||||
@ -1908,4 +1909,219 @@ public class VpConstructionServiceImpl implements VpConstructionService {
|
||||
dataSourceResult.setTotal(page != null ? page.getTotal() : (long) yList.size());
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<FhvapBuiltPointVo> getFhvapBuiltPointKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult<FhvapBuiltPointVo> 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" +
|
||||
" t.STCD AS stcd,\n" +
|
||||
" t.STNM AS stnm,\n" +
|
||||
" t.STNM AS titleName,\n" +
|
||||
" TO_CHAR(t.BLDSTT_CODE) AS bldsttCcode,\n" +
|
||||
" TO_CHAR(t.BLDSTT_CODE) AS bldstt,\n" +
|
||||
" t.LTTD AS lttd,\n" +
|
||||
" t.LGTD AS lgtd,\n" +
|
||||
" t.ELEV AS dtmel,\n" +
|
||||
" t.RSTCD AS rstcds,\n" +
|
||||
" eng.ENNM AS ennm,\n" +
|
||||
" t.STTP AS sttpCode,\n" +
|
||||
" t.STTP AS dwtp,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN t.STTP = 'VP' THEN '珍稀植物园'\n" +
|
||||
" WHEN t.STTP = 'VA' THEN '动物救助站'\n" +
|
||||
" WHEN t.STTP = 'FH' THEN '栖息地'\n" +
|
||||
" ELSE '其它'\n" +
|
||||
" END AS dwtpName,\n" +
|
||||
" t.STTP AS sttpMap,\n" +
|
||||
" t.RVCD AS rvcd,\n" +
|
||||
" t.ADDVCD AS addvcd,\n" +
|
||||
" t.BASE_ID AS baseId,\n" +
|
||||
" t.STTP AS sttp,\n" +
|
||||
" t.DTIN AS dtin\n" +
|
||||
"FROM (\n" +
|
||||
" SELECT STCD, STNM, STTP, LGTD, LTTD, ELEV, RSTCD, BASE_ID, RVCD, ADDVCD, BLDSTT_CODE, DTIN\n" +
|
||||
" FROM SD_VP_B_H\n" +
|
||||
" WHERE NVL(IS_DELETED, 0) = 0 AND BLDSTT_CODE = 1 AND LGTD IS NOT NULL AND LTTD IS NOT NULL\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT STCD, STNM, STTP, LGTD, LTTD, ELEV, RSTCD, BASE_ID, NULL AS RVCD, NULL AS ADDVCD, BLDSTT_CODE, DTIN\n" +
|
||||
" FROM SD_VA_B_H\n" +
|
||||
" WHERE NVL(IS_DELETED, 0) = 0 AND BLDSTT_CODE = 1 AND LGTD IS NOT NULL AND LTTD IS NOT NULL\n" +
|
||||
" UNION ALL\n" +
|
||||
" SELECT STCD, STNM, 'FH' AS STTP, LGTD, LTTD, ELEV, RSTCD, BASE_ID, RVCD, ADDVCD, 1 AS BLDSTT_CODE, DTIN\n" +
|
||||
" FROM SD_FHBT_B_H\n" +
|
||||
" WHERE NVL(IS_DELETED, 0) = 0 AND LGTD IS NOT NULL AND LTTD IS NOT NULL\n" +
|
||||
") t\n" +
|
||||
"LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = t.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 ");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
String filterSql = buildFhvapPointFilterCondition(dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql);
|
||||
}
|
||||
|
||||
sql.append(buildFhvapPointOrderBySql(dataSourceRequest.getSort()));
|
||||
|
||||
Page<?> page = KendoUtil.getPage(dataSourceRequest);
|
||||
List<FhvapBuiltPointVo> resultList = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, FhvapBuiltPointVo.class);
|
||||
|
||||
for (FhvapBuiltPointVo vo : resultList) {
|
||||
String sttp = vo.getSttp();
|
||||
if ("VP".equals(sttp)) {
|
||||
vo.setAnchoPointState("GY_1_BUILT");
|
||||
} else if ("VA".equals(sttp)) {
|
||||
vo.setAnchoPointState("GY_2_BUILT");
|
||||
} else if ("FH".equals(sttp)) {
|
||||
vo.setAnchoPointState("GY_3_BUILT");
|
||||
} else {
|
||||
vo.setAnchoPointState("GY_4_BUILT");
|
||||
}
|
||||
}
|
||||
|
||||
dataSourceResult.setData(resultList);
|
||||
dataSourceResult.setTotal(page == null ? resultList.size() : page.getTotal());
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
private String buildFhvapPointFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
if (filter == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(filter.getField())) {
|
||||
return buildFhvapPointLeafCondition(filter, paramMap, indexHolder);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(filter.getFilters())) {
|
||||
return "";
|
||||
}
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildFhvapPointFilterCondition(child, paramMap, indexHolder);
|
||||
if (StrUtil.isNotBlank(childSql)) {
|
||||
conditions.add("(" + childSql + ")");
|
||||
}
|
||||
}
|
||||
if (conditions.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return String.join("or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ", conditions);
|
||||
}
|
||||
|
||||
private String buildFhvapPointLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
String field = filter.getField();
|
||||
Object value = filter.getValue();
|
||||
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||
|
||||
String column = mapFhvapPointColumn(field);
|
||||
if (StrUtil.isBlank(column)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
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 = "fhvapParam" + indexHolder[0]++;
|
||||
paramMap.put(paramKey, item);
|
||||
placeholders.add("#{map." + paramKey + "}");
|
||||
}
|
||||
return column + " IN (" + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String paramKey = "fhvapParam" + 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 + "}";
|
||||
case "gt":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " > #{map." + paramKey + "}";
|
||||
case "gte":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " >= #{map." + paramKey + "}";
|
||||
case "lt":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " < #{map." + paramKey + "}";
|
||||
case "lte":
|
||||
paramMap.put(paramKey, value);
|
||||
return column + " <= #{map." + paramKey + "}";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private String mapFhvapPointColumn(String field) {
|
||||
if (StrUtil.isBlank(field)) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> columnMap = new HashMap<>();
|
||||
columnMap.put("stcd", "t.STCD");
|
||||
columnMap.put("stnm", "t.STNM");
|
||||
columnMap.put("sttpCode", "t.STTP");
|
||||
columnMap.put("bldsttCcode", "t.BLDSTT_CODE");
|
||||
columnMap.put("lgtd", "t.LGTD");
|
||||
columnMap.put("lttd", "t.LTTD");
|
||||
columnMap.put("baseId", "t.BASE_ID");
|
||||
columnMap.put("rvcd", "t.RVCD");
|
||||
columnMap.put("addvcd", "t.ADDVCD");
|
||||
columnMap.put("rstcds", "t.RSTCD");
|
||||
columnMap.put("ennm", "eng.ENNM");
|
||||
return columnMap.get(field);
|
||||
}
|
||||
|
||||
private String buildFhvapPointOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
|
||||
if (sorts == null || sorts.isEmpty()) {
|
||||
return " ORDER BY t.BASE_ID ASC, t.STCD ASC";
|
||||
}
|
||||
List<String> orderItems = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor sort : sorts) {
|
||||
if (sort == null || StrUtil.isBlank(sort.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = mapFhvapPointColumn(sort.getField());
|
||||
if (StrUtil.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
String direction = "desc".equalsIgnoreCase(sort.getDir()) || "des".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC";
|
||||
orderItems.add(column + " " + direction + " NULLS LAST");
|
||||
}
|
||||
if (orderItems.isEmpty()) {
|
||||
return " ORDER BY t.BASE_ID ASC, t.STCD ASC";
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderItems);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user