feat: 野生动物锚点
This commit is contained in:
parent
fdaba51634
commit
61e896de25
@ -82,4 +82,10 @@ public class VapConstructionController {
|
|||||||
public ResponseResult getFhvapBuiltPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult getFhvapBuiltPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
return ResponseResult.successData(vpConstructionService.getFhvapBuiltPointKendoListCust(dataSourceRequest));
|
return ResponseResult.successData(vpConstructionService.getFhvapBuiltPointKendoListCust(dataSourceRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/wva/point/GetKendoListCust")
|
||||||
|
@Operation(summary = "野生动物锚点")
|
||||||
|
public ResponseResult getWvaPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
|
return ResponseResult.successData(vpConstructionService.getWvaPointKendoListCust(dataSourceRequest));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.yfd.platform.qgc_env.vap.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.vap.entity.vo.FhvapBuiltPointVo;
|
import com.yfd.platform.qgc_env.vap.entity.vo.FhvapBuiltPointVo;
|
||||||
|
import com.yfd.platform.qgc_env.vap.entity.vo.WvaPointVo;
|
||||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpBasinIntDetailVo;
|
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.VpVarVo;
|
||||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpStInfoResultVo;
|
import com.yfd.platform.qgc_env.vap.entity.vo.VpStInfoResultVo;
|
||||||
@ -30,4 +31,6 @@ public interface VpConstructionService {
|
|||||||
DataSourceResult getVprYearList(DataSourceRequest dataSourceRequest);
|
DataSourceResult getVprYearList(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
DataSourceResult<FhvapBuiltPointVo> getFhvapBuiltPointKendoListCust(DataSourceRequest dataSourceRequest);
|
DataSourceResult<FhvapBuiltPointVo> getFhvapBuiltPointKendoListCust(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
|
DataSourceResult<WvaPointVo> getWvaPointKendoListCust(DataSourceRequest dataSourceRequest);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import com.yfd.platform.common.GroupingInfo;
|
|||||||
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||||
import com.yfd.platform.common.PageInfo;
|
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.FhvapBuiltPointVo;
|
||||||
|
import com.yfd.platform.qgc_env.vap.entity.vo.WvaPointVo;
|
||||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpBasinIntDetailVo;
|
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.VpConstructionSituationVo;
|
||||||
import com.yfd.platform.qgc_env.vap.entity.vo.VpVarVo;
|
import com.yfd.platform.qgc_env.vap.entity.vo.VpVarVo;
|
||||||
@ -2124,4 +2125,188 @@ public class VpConstructionServiceImpl implements VpConstructionService {
|
|||||||
}
|
}
|
||||||
return " ORDER BY " + String.join(", ", orderItems);
|
return " ORDER BY " + String.join(", ", orderItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceResult<WvaPointVo> getWvaPointKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||||
|
DataSourceResult<WvaPointVo> 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" +
|
||||||
|
" we.DTIN AS dtin,\n" +
|
||||||
|
" we.STCD AS stcd,\n" +
|
||||||
|
" we.STNM AS stnm,\n" +
|
||||||
|
" we.STNM AS titleName,\n" +
|
||||||
|
" TO_CHAR(we.BLDSTT_CODE) AS bldsttCcode,\n" +
|
||||||
|
" TO_CHAR(we.BLDSTT_CODE) AS bldstt,\n" +
|
||||||
|
" we.LTTD AS lttd,\n" +
|
||||||
|
" we.LGTD AS lgtd,\n" +
|
||||||
|
" we.ELEV AS dtmel,\n" +
|
||||||
|
" we.RSTCD AS rstcds,\n" +
|
||||||
|
" eng.ENNM AS ennm,\n" +
|
||||||
|
" 'WVA' AS sttpMap,\n" +
|
||||||
|
" we.RVCD AS rvcd,\n" +
|
||||||
|
" we.ADDVCD AS addvcd,\n" +
|
||||||
|
" we.BASE_ID AS baseId,\n" +
|
||||||
|
" 'WVA' AS sttp,\n" +
|
||||||
|
" 'wild_animal_legend' AS anchoPointState,\n" +
|
||||||
|
" 'WVA' AS sttpCode\n" +
|
||||||
|
"FROM SD_WE_B_H we\n" +
|
||||||
|
"LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = we.RSTCD AND NVL(eng.IS_DELETED, 0) = 0\n" +
|
||||||
|
"WHERE we.LGTD IS NOT NULL AND we.LTTD IS NOT NULL ");
|
||||||
|
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
String filterSql = buildWvaPointFilterCondition(dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||||
|
if (StrUtil.isNotBlank(filterSql)) {
|
||||||
|
sql.append(" AND ").append(filterSql);
|
||||||
|
}
|
||||||
|
|
||||||
|
sql.append(buildWvaPointOrderBySql(dataSourceRequest.getSort()));
|
||||||
|
|
||||||
|
Page<?> page = KendoUtil.getPage(dataSourceRequest);
|
||||||
|
List<WvaPointVo> resultList = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, WvaPointVo.class);
|
||||||
|
|
||||||
|
dataSourceResult.setData(resultList);
|
||||||
|
dataSourceResult.setTotal(page == null ? resultList.size() : page.getTotal());
|
||||||
|
return dataSourceResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildWvaPointFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||||
|
Map<String, Object> paramMap,
|
||||||
|
int[] indexHolder) {
|
||||||
|
if (filter == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(filter.getField())) {
|
||||||
|
return buildWvaPointLeafCondition(filter, paramMap, indexHolder);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isEmpty(filter.getFilters())) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
List<String> conditions = new ArrayList<>();
|
||||||
|
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||||
|
String childSql = buildWvaPointFilterCondition(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 buildWvaPointLeafCondition(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 = mapWvaPointColumn(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 = "wvaParam" + indexHolder[0]++;
|
||||||
|
paramMap.put(paramKey, item);
|
||||||
|
placeholders.add("#{map." + paramKey + "}");
|
||||||
|
}
|
||||||
|
return column + " IN (" + String.join(", ", placeholders) + ")";
|
||||||
|
}
|
||||||
|
if (value == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
String paramKey = "wvaParam" + 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 mapWvaPointColumn(String field) {
|
||||||
|
if (StrUtil.isBlank(field)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Map<String, String> columnMap = new HashMap<>();
|
||||||
|
columnMap.put("stcd", "we.STCD");
|
||||||
|
columnMap.put("stnm", "we.STNM");
|
||||||
|
columnMap.put("sttpCode", "'WVA'");
|
||||||
|
columnMap.put("lgtd", "we.LGTD");
|
||||||
|
columnMap.put("lttd", "we.LTTD");
|
||||||
|
columnMap.put("baseId", "we.BASE_ID");
|
||||||
|
columnMap.put("rvcd", "we.RVCD");
|
||||||
|
columnMap.put("addvcd", "we.ADDVCD");
|
||||||
|
columnMap.put("rstcds", "we.RSTCD");
|
||||||
|
columnMap.put("ennm", "eng.ENNM");
|
||||||
|
return columnMap.get(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildWvaPointOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
|
||||||
|
if (sorts == null || sorts.isEmpty()) {
|
||||||
|
return " ORDER BY we.BASE_ID ASC, we.STCD ASC";
|
||||||
|
}
|
||||||
|
List<String> orderItems = new ArrayList<>();
|
||||||
|
for (DataSourceRequest.SortDescriptor sort : sorts) {
|
||||||
|
if (sort == null || StrUtil.isBlank(sort.getField())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String column = mapWvaPointColumn(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 we.BASE_ID ASC, we.STCD ASC";
|
||||||
|
}
|
||||||
|
return " ORDER BY " + String.join(", ", orderItems);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user