From d77c7d60bbf16ba284dd061ec1e508ee5dac2734 Mon Sep 17 00:00:00 2001 From: tangwei Date: Fri, 29 May 2026 14:28:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9F=A5=E8=AF=A2=E7=94=9F=E6=80=81?= =?UTF-8?q?=E7=8E=AF=E4=BF=9D=E6=89=B9=E5=A4=8D=E6=96=87=E4=BB=B6=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SdEngMonitorController.java | 11 +- .../qgc_base/domain/vo/EngEiaapprovalVo.java | 125 +++++++ .../qgc_base/service/ISdEngInfoBHService.java | 5 + .../service/impl/SdEngInfoBHServiceImpl.java | 309 ++++++++++++++++++ .../wq/controller/EnvWqDataController.java | 4 +- 5 files changed, 451 insertions(+), 3 deletions(-) create mode 100644 backend/src/main/java/com/yfd/platform/qgc_base/domain/vo/EngEiaapprovalVo.java diff --git a/backend/src/main/java/com/yfd/platform/qgc_base/controller/SdEngMonitorController.java b/backend/src/main/java/com/yfd/platform/qgc_base/controller/SdEngMonitorController.java index 6f23a0f4..1524a5a9 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_base/controller/SdEngMonitorController.java +++ b/backend/src/main/java/com/yfd/platform/qgc_base/controller/SdEngMonitorController.java @@ -1,17 +1,20 @@ package com.yfd.platform.qgc_base.controller; +import com.yfd.platform.common.DataSourceRequest; import com.yfd.platform.config.ResponseResult; import com.yfd.platform.qgc_base.service.ISdEngInfoBHService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController -@RequestMapping("/env/eng") +@RequestMapping("/eng/base") @Tag(name = "电站基础监测") public class SdEngMonitorController { @@ -23,4 +26,10 @@ public class SdEngMonitorController { public ResponseResult getStInfoByStcd(@RequestParam String stcd) { return ResponseResult.successData(engInfoBHService.getStInfoByStcd(stcd)); } + + @PostMapping("/eiaapproval/GetKendoList") + @Operation(summary = "查询生态环保批复文件列表") + public ResponseResult getEiaapprovalKendoList(@RequestBody DataSourceRequest dataSourceRequest) { + return ResponseResult.successData(engInfoBHService.getEiaapprovalKendoList(dataSourceRequest)); + } } diff --git a/backend/src/main/java/com/yfd/platform/qgc_base/domain/vo/EngEiaapprovalVo.java b/backend/src/main/java/com/yfd/platform/qgc_base/domain/vo/EngEiaapprovalVo.java new file mode 100644 index 00000000..21648517 --- /dev/null +++ b/backend/src/main/java/com/yfd/platform/qgc_base/domain/vo/EngEiaapprovalVo.java @@ -0,0 +1,125 @@ +package com.yfd.platform.qgc_base.domain.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.Date; + +@Data +@Schema(description = "生态环保批复文件列表") +public class EngEiaapprovalVo { + + @Schema(description = "主键ID") + private String id; + + @Schema(description = "流域") + private String basin; + + @Schema(description = "河流") + private String river; + + @Schema(description = "电站") + private String hydropowerStation; + + @Schema(description = "电站建设状态中文") + private String bldsttCName; + + @Schema(description = "批复文号") + private String approvalFileNo; + + @Schema(description = "批复文件标题") + private String approvalFileTitle; + + @Schema(description = "文件名") + private String fileName; + + @Schema(description = "附件路径") + private String flpath; + + @Schema(description = "生态流量") + private String ecologicalFlow; + + @Schema(description = "水环境保护措施") + private String waterEnvProtection; + + @Schema(description = "低温水减缓措施") + private String coldWaterMitigation; + + @Schema(description = "栖息地保护") + private String habitatProtection; + + @Schema(description = "过鱼措施") + private String fishPassageMeasures; + + @Schema(description = "鱼类增殖放流") + private String fishStocking; + + @Schema(description = "陆生生态保护/水土保持措施") + private String terrestrialEcoSoilCons; + + @Schema(description = "珍稀植物保护措施") + private String rarePlantProtection; + + @Schema(description = "动物救助") + private String animalRescue; + + @Schema(description = "移民安置") + private String resettlementMeasures; + + @Schema(description = "施工期防治措施或其他环境保护措施") + private String constructionPollutionCtrl; + + @Schema(description = "地下水及地质环境保护措施") + private String groundwaterGeoProtect; + + @Schema(description = "风景名胜区保护措施") + private String scenicAreaProtection; + + @Schema(description = "环境监测要求") + private String envMonitoringRequire; + + @Schema(description = "基地编码") + private String baseid; + + @Schema(description = "基地流域编码") + private String hbrvcd; + + @Schema(description = "环评表中的电站编码") + private String eiaStcd; + + @Schema(description = "电站编码") + private String stcd; + + @Schema(description = "电站名称") + private String stnm; + + @Schema(description = "电站类型") + private String sttp; + + @Schema(description = "电站类型名称") + private String sttpName; + + @Schema(description = "电站建设状态代码") + private String bldsttCcode; + + @Schema(description = "电站建设状态") + private String bldstt; + + @Schema(description = "经度") + private String lgtd; + + @Schema(description = "纬度") + private String lttd; + + @Schema(description = "基地排序") + private Integer baseStepSort; + + @Schema(description = "流域排序") + private Integer rvcdStepSort; + + @Schema(description = "电站排序") + private Integer rstcdStepSort; + + @Schema(description = "站点排序") + private Integer siteStepSort; +} diff --git a/backend/src/main/java/com/yfd/platform/qgc_base/service/ISdEngInfoBHService.java b/backend/src/main/java/com/yfd/platform/qgc_base/service/ISdEngInfoBHService.java index c8c9bc6c..5a14f586 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_base/service/ISdEngInfoBHService.java +++ b/backend/src/main/java/com/yfd/platform/qgc_base/service/ISdEngInfoBHService.java @@ -2,9 +2,12 @@ package com.yfd.platform.qgc_base.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.yfd.platform.common.DataSourceRequest; +import com.yfd.platform.common.DataSourceResult; import com.yfd.platform.qgc_base.domain.SdEngInfoBH; import com.yfd.platform.qgc_base.domain.SdEngInfoBHRequest; import com.yfd.platform.qgc_base.domain.vo.EngBaseInfoVo; +import com.yfd.platform.qgc_base.domain.vo.EngEiaapprovalVo; import java.util.List; import java.util.Set; @@ -61,4 +64,6 @@ public interface ISdEngInfoBHService extends IService { List selectRegDropdown(SdEngInfoBHRequest sdEngInfoBHRequest); EngBaseInfoVo getStInfoByStcd(String stcd); + + DataSourceResult getEiaapprovalKendoList(DataSourceRequest dataSourceRequest); } diff --git a/backend/src/main/java/com/yfd/platform/qgc_base/service/impl/SdEngInfoBHServiceImpl.java b/backend/src/main/java/com/yfd/platform/qgc_base/service/impl/SdEngInfoBHServiceImpl.java index 02e07744..d1e63e39 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_base/service/impl/SdEngInfoBHServiceImpl.java +++ b/backend/src/main/java/com/yfd/platform/qgc_base/service/impl/SdEngInfoBHServiceImpl.java @@ -5,12 +5,15 @@ import cn.hutool.core.bean.copier.CopyOptions; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yfd.platform.common.DataSourceRequest; +import com.yfd.platform.common.DataSourceResult; import com.yfd.platform.common.MicroservicDynamicSQLMapper; import com.yfd.platform.qgc_data.domain.SysUserDataScope; import com.yfd.platform.qgc_data.mapper.SysUserDataScopeMapper; import com.yfd.platform.qgc_base.domain.SdEngInfoBH; import com.yfd.platform.qgc_base.domain.SdEngInfoBHRequest; import com.yfd.platform.qgc_base.domain.vo.EngBaseInfoVo; +import com.yfd.platform.qgc_base.domain.vo.EngEiaapprovalVo; import com.yfd.platform.qgc_base.mapper.SdEngInfoBHMapper; import com.yfd.platform.qgc_base.service.ISdEngInfoBHService; import com.yfd.platform.utils.SecurityUtils; @@ -19,8 +22,10 @@ import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -202,6 +207,53 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl getEiaapprovalKendoList(DataSourceRequest dataSourceRequest) { + DataSourceResult result = new DataSourceResult<>(); + result.setAggregates(new HashMap<>()); + + if (dataSourceRequest == null) { + result.setData(new ArrayList<>()); + result.setTotal(0L); + return result; + } + +// if (!"admin".equals(SecurityUtils.getCurrentUsername())) { +// Set authorizedStations = getUserAuthorizedStationCodes(); +// if (authorizedStations == null || authorizedStations.isEmpty()) { +// result.setData(new ArrayList<>()); +// result.setTotal(0L); +// return result; +// } +// } + + Page page = null; + if (dataSourceRequest.getTake() > 0) { + page = new Page<>(dataSourceRequest.getSkip() / dataSourceRequest.getTake() + 1, + dataSourceRequest.getTake()); + } + + Map paramMap = new HashMap<>(); + StringBuilder sql = new StringBuilder(buildEiaapprovalBaseSql()); + +// if (!"admin".equals(SecurityUtils.getCurrentUsername())) { +// appendAuthorizedStations(sql, paramMap, getUserAuthorizedStationCodes()); +// } + + String filterSql = buildEiaapprovalFilterCondition(dataSourceRequest.getFilter(), paramMap, new int[]{0}); + if (StringUtils.hasText(filterSql)) { + sql.append(" AND ").append(filterSql); + } + + sql.append(buildEiaapprovalOrderBySql(dataSourceRequest.getSort())); + + List list = microservicDynamicSQLMapper.pageAllListWithResultType( + page, sql.toString(), paramMap, EngEiaapprovalVo.class); + result.setData(list); + result.setTotal(page == null ? list.size() : page.getTotal()); + return result; + } + @Override public EngBaseInfoVo getStInfoByStcd(String stcd) { SdEngInfoBH entity = this.getById(stcd); @@ -267,6 +319,263 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl paramMap, Set authorizedStations) { + if (authorizedStations == null || authorizedStations.isEmpty()) { + return; + } + List placeholders = new ArrayList<>(); + int index = 0; + for (String stcd : authorizedStations) { + String key = "authStcd" + index++; + paramMap.put(key, stcd); + placeholders.add("#{map." + key + "}"); + } + sql.append(" AND e.STCD IN (").append(String.join(", ", placeholders)).append(")"); + } + + private String buildEiaapprovalFilterCondition(DataSourceRequest.FilterDescriptor filter, + Map paramMap, + int[] indexHolder) { + if (filter == null) { + return ""; + } + if (StringUtils.hasText(filter.getField())) { + return buildEiaapprovalLeafCondition(filter, paramMap, indexHolder); + } + if (filter.getFilters() == null || filter.getFilters().isEmpty()) { + return ""; + } + List childConditions = new ArrayList<>(); + for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) { + String childSql = buildEiaapprovalFilterCondition(child, paramMap, indexHolder); + if (StringUtils.hasText(childSql)) { + childConditions.add("(" + childSql + ")"); + } + } + if (childConditions.isEmpty()) { + return ""; + } + String logic = "or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND "; + return String.join(logic, childConditions); + } + + private String buildEiaapprovalLeafCondition(DataSourceRequest.FilterDescriptor filter, + Map paramMap, + int[] indexHolder) { + String column = mapEiaapprovalColumn(filter.getField()); + if (!StringUtils.hasText(column)) { + 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 values = normalizeFilterValues(value); + if (values.isEmpty()) { + return ""; + } + List placeholders = new ArrayList<>(); + for (Object item : values) { + String key = "eiaParam" + indexHolder[0]++; + paramMap.put(key, item); + placeholders.add("#{map." + key + "}"); + } + return column + " IN (" + String.join(", ", placeholders) + ")"; + } + if (value == null) { + return ""; + } + String key = "eiaParam" + indexHolder[0]++; + return switch (operator) { + case "eq" -> { + paramMap.put(key, value); + yield column + " = #{map." + key + "}"; + } + case "neq" -> { + paramMap.put(key, value); + yield column + " <> #{map." + key + "}"; + } + case "contains" -> { + paramMap.put(key, "%" + value + "%"); + yield column + " LIKE #{map." + key + "}"; + } + case "startswith" -> { + paramMap.put(key, value + "%"); + yield column + " LIKE #{map." + key + "}"; + } + case "endswith" -> { + paramMap.put(key, "%" + value); + yield column + " LIKE #{map." + key + "}"; + } + case "gt" -> { + paramMap.put(key, value); + yield column + " > #{map." + key + "}"; + } + case "gte" -> { + paramMap.put(key, value); + yield column + " >= #{map." + key + "}"; + } + case "lt" -> { + paramMap.put(key, value); + yield column + " < #{map." + key + "}"; + } + case "lte" -> { + paramMap.put(key, value); + yield column + " <= #{map." + key + "}"; + } + default -> ""; + }; + } + + private List normalizeFilterValues(Object value) { + List values = new ArrayList<>(); + if (value instanceof List list) { + for (Object item : list) { + if (item != null) { + values.add(item); + } + } + return values; + } + if (value instanceof Object[] array) { + for (Object item : array) { + if (item != null) { + values.add(item); + } + } + return values; + } + if (value != null) { + values.add(value); + } + return values; + } + + private String mapEiaapprovalColumn(String field) { + if (!StringUtils.hasText(field)) { + return null; + } + return switch (field) { + case "stcd", "eiaStcd" -> "e.STCD"; + case "hydropowerStation" -> "e.ENNM"; + case "baseId", "baseid" -> "e.BASEID"; + case "hbrvcd" -> "e.HBRVCD"; + case "envMonitoringRequire" -> "e.ENV_MONITORING_REQUIRE"; + case "ecologicalFlow" -> "e.ECOLOGICAL_FLOW"; + case "approvalFileNo" -> "e.APPROVAL_FILE_NO"; + case "approvalFileTitle" -> "e.APPROVAL_FILE_TITLE"; + case "fishPassageMeasures" -> "e.FISH_PASSAGE_MEASURES"; + case "bldsttCcode" -> "s.BLDSTT_CODE"; + case "bldsttCName" -> "CASE WHEN s.BLDSTT_CODE = 0 OR s.BLDSTT_CODE IS NULL THEN '未建/规划' WHEN s.BLDSTT_CODE = 1 THEN '在建' WHEN s.BLDSTT_CODE = 2 THEN '已建' ELSE NULL END"; + case "basin" -> "e.BASIN"; + case "river" -> "e.RIVER"; + case "stnm" -> "s.ENNM"; + default -> null; + }; + } + + private String buildEiaapprovalOrderBySql(List sortList) { + if (sortList == null || sortList.isEmpty()) { + return " ORDER BY baseStepSort ASC, rvcdStepSort ASC, rstcdStepSort ASC, siteStepSort ASC, stnm ASC"; + } + List orderItems = new ArrayList<>(); + for (DataSourceRequest.SortDescriptor sortDescriptor : sortList) { + if (sortDescriptor == null || !StringUtils.hasText(sortDescriptor.getField())) { + continue; + } + String column = switch (sortDescriptor.getField()) { + case "baseStepSort" -> "baseStepSort"; + case "rvcdStepSort" -> "rvcdStepSort"; + case "rstcdStepSort" -> "rstcdStepSort"; + case "siteStepSort" -> "siteStepSort"; + case "stnm" -> "stnm"; + case "hydropowerStation" -> "e.HYDROPOWER_STATION"; + case "approvalFileNo" -> "e.APPROVAL_FILE_NO"; + case "recordTime" -> "e.RECORD_TIME"; + case "bldsttCcode" -> "s.BLDSTT_CODE"; + default -> null; + }; + if (!StringUtils.hasText(column)) { + continue; + } + String dir = "desc".equalsIgnoreCase(sortDescriptor.getDir()) ? "DESC" : "ASC"; + orderItems.add(column + " " + dir); + } + if (orderItems.isEmpty()) { + return " ORDER BY baseStepSort ASC, rvcdStepSort ASC, rstcdStepSort ASC, siteStepSort ASC, stnm ASC"; + } + return " ORDER BY " + String.join(", ", orderItems); + } + private String resolveBlprdName(Integer blprd) { if (blprd == null) { return null; diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/wq/controller/EnvWqDataController.java b/backend/src/main/java/com/yfd/platform/qgc_env/wq/controller/EnvWqDataController.java index ff4f0655..4157bcbe 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_env/wq/controller/EnvWqDataController.java +++ b/backend/src/main/java/com/yfd/platform/qgc_env/wq/controller/EnvWqDataController.java @@ -47,8 +47,8 @@ public class EnvWqDataController { public ResponseResult getStTbYsBVoKendoListCust( @RequestParam String stcd, @RequestParam String tbCode, - @RequestParam String startTime, - @RequestParam String endTime) { + @RequestParam(required = false) String startTime, + @RequestParam(required = false) String endTime) { return ResponseResult.successData(envWqDataService.getStTbYsBVoKendoListCust(stcd, tbCode, startTime, endTime)); }