From 101c60e8c0b4857829bd568a8fa5c1cff8dcd30a Mon Sep 17 00:00:00 2001 From: tangwei Date: Tue, 23 Jun 2026 15:07:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E6=AE=96=E7=AB=99=E9=B1=BC?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E5=AE=8C=E6=88=90=E6=83=85=E5=86=B5=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fb/controller/FbStationController.java | 6 ++ .../fb/entity/vo/FbFishCountFinishVo.java | 15 ++++ .../qgc_env/fb/service/FbStationService.java | 3 + .../fb/service/impl/FbStationServiceImpl.java | 90 +++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 backend/src/main/java/com/yfd/platform/qgc_env/fb/entity/vo/FbFishCountFinishVo.java diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/fb/controller/FbStationController.java b/backend/src/main/java/com/yfd/platform/qgc_env/fb/controller/FbStationController.java index ff227fa1..68489d04 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_env/fb/controller/FbStationController.java +++ b/backend/src/main/java/com/yfd/platform/qgc_env/fb/controller/FbStationController.java @@ -85,6 +85,12 @@ public class FbStationController { return ResponseResult.successData(fbStationService.getFbFlDataKendoListCust(dataSourceRequest)); } + @PostMapping("/fishCount/GetKendoListCust") + @Operation(summary = "增殖站鱼数量完成情况统计") + public ResponseResult getFishCountKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) { + return ResponseResult.successData(fbStationService.getFishCountKendoListCust(dataSourceRequest)); + } + @PostMapping("/fishType/GetKendoListCust") @Operation(summary = "增殖站鱼种完成情况统计") public ResponseResult getFishTypeKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) { diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/fb/entity/vo/FbFishCountFinishVo.java b/backend/src/main/java/com/yfd/platform/qgc_env/fb/entity/vo/FbFishCountFinishVo.java new file mode 100644 index 00000000..4a7a4419 --- /dev/null +++ b/backend/src/main/java/com/yfd/platform/qgc_env/fb/entity/vo/FbFishCountFinishVo.java @@ -0,0 +1,15 @@ +package com.yfd.platform.qgc_env.fb.entity.vo; + +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class FbFishCountFinishVo { + + private String stcd; + + private BigDecimal finished; + + private BigDecimal unfinished; +} diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/fb/service/FbStationService.java b/backend/src/main/java/com/yfd/platform/qgc_env/fb/service/FbStationService.java index 1737b5fe..c55257ea 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_env/fb/service/FbStationService.java +++ b/backend/src/main/java/com/yfd/platform/qgc_env/fb/service/FbStationService.java @@ -5,6 +5,7 @@ import com.yfd.platform.common.DataSourceResult; import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRQgcVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishTableVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbFlDataVo; +import com.yfd.platform.qgc_env.fb.entity.vo.FbFishCountFinishVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbFishTypeFinishVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbRelatedYrVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbMsfbrdmQgcVo; @@ -27,6 +28,8 @@ public interface FbStationService { DataSourceResult getFbFlDataKendoListCust(DataSourceRequest dataSourceRequest); + DataSourceResult getFishCountKendoListCust(DataSourceRequest dataSourceRequest); + DataSourceResult getFishTypeKendoListCust(DataSourceRequest dataSourceRequest); DataSourceResult getMsfbrdmKendoListCust(DataSourceRequest dataSourceRequest); diff --git a/backend/src/main/java/com/yfd/platform/qgc_env/fb/service/impl/FbStationServiceImpl.java b/backend/src/main/java/com/yfd/platform/qgc_env/fb/service/impl/FbStationServiceImpl.java index e4404592..de23128f 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_env/fb/service/impl/FbStationServiceImpl.java +++ b/backend/src/main/java/com/yfd/platform/qgc_env/fb/service/impl/FbStationServiceImpl.java @@ -15,6 +15,7 @@ import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRQgcVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishHeadColumnVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishSummaryVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishTableVo; +import com.yfd.platform.qgc_env.fb.entity.vo.FbFishCountFinishVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbFishTypeFinishVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbFtpStatisticsVo; import com.yfd.platform.qgc_env.fb.entity.vo.FbFlDataVo; @@ -84,6 +85,38 @@ public class FbStationServiceImpl implements FbStationService { return queryFbFlDataDetailList(dataSourceRequest, loadOptions); } + @Override + public DataSourceResult getFishCountKendoListCust(DataSourceRequest dataSourceRequest) { + DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest(); + String rstcdFilter = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "rstcd"); + String stcd = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stcd"); + String startTime = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "startTime"); + String endTime = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "endTime"); + + Map paramMap = new HashMap<>(); + String sql = buildFishCountFinishSql( + stcd, + parseFishTypeFilterValues(rstcdFilter), + parseFishTypeDate(startTime), + parseFishTypeDate(endTime), + paramMap + ) + buildFishCountOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()); + + Page page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake()); + List list = microservicDynamicSQLMapper.pageAllListWithResultType( + page, + sql, + paramMap, + FbFishCountFinishVo.class + ); + + DataSourceResult result = new DataSourceResult<>(); + result.setData(list); + result.setTotal(page != null ? page.getTotal() : list.size()); + result.setAggregates(new HashMap<>()); + return result; + } + @Override public DataSourceResult getFishTypeKendoListCust(DataSourceRequest dataSourceRequest) { DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest(); @@ -840,6 +873,63 @@ public class FbStationServiceImpl implements FbStationService { return null; } + private String buildFishCountFinishSql(String stcd, + List rstcdList, + Date startTime, + Date endTime, + Map paramMap) { + StringBuilder sql = new StringBuilder(); + sql.append("SELECT jh.RSTCD AS stcd, ") + .append("CASE WHEN imn.FCNT IS NULL THEN 0 ELSE imn.FCNT END AS finished, ") + .append("CASE WHEN imn.FCNT IS NULL THEN jh.FCNT ") + .append("WHEN jh.FCNT - imn.FCNT < 0 THEN 0 ") + .append("ELSE (jh.FCNT - imn.FCNT) END AS unfinished ") + .append("FROM ( ") + .append("SELECT jhr.RSTCD, SUM(jhrs.FCNT) AS FCNT ") + .append("FROM SD_ENGFRPLAN_B jhr ") + .append("JOIN SD_ENGFRPLANDET_B jhrs ON jhr.ID = jhrs.RPJH_ID ") + .append("WHERE NVL(jhr.IS_DELETED, 0) = 0 AND NVL(jhrs.IS_DELETED, 0) = 0 "); + appendFishTypeFilterSql(sql, "jhr", stcd, rstcdList, startTime, endTime, true, paramMap); + sql.append("GROUP BY jhr.RSTCD ") + .append(") jh ") + .append("LEFT JOIN ( ") + .append("SELECT imnr.RSTCD, SUM(imnrs.FCNT) AS FCNT ") + .append("FROM SD_ENGFR_R imnr ") + .append("JOIN SD_RPIMNFISH_R imnrs ON imnr.ID = imnrs.RPIMN_ID ") + .append("WHERE NVL(imnr.IS_DELETED, 0) = 0 AND NVL(imnrs.IS_DELETED, 0) = 0 "); + appendFishTypeFilterSql(sql, "imnr", stcd, rstcdList, startTime, endTime, false, paramMap); + sql.append("GROUP BY imnr.RSTCD ") + .append(") imn ON jh.RSTCD = imn.RSTCD"); + return sql.toString(); + } + + private String buildFishCountOrderBySql(List sorts) { + if (CollUtil.isEmpty(sorts)) { + return " ORDER BY stcd ASC"; + } + List orderByParts = new ArrayList<>(); + for (DataSourceRequest.SortDescriptor sort : sorts) { + if (sort == null || StrUtil.isBlank(sort.getField())) { + continue; + } + String column = switch (sort.getField()) { + case "stcd" -> "stcd"; + case "finished" -> "finished"; + case "unfinished" -> "unfinished"; + default -> null; + }; + if (StrUtil.isBlank(column)) { + continue; + } + String direction = "desc".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC"; + orderByParts.add(column + " " + direction); + } + if (orderByParts.isEmpty()) { + return " ORDER BY stcd ASC"; + } + return " ORDER BY " + String.join(", ", orderByParts); + } + private String buildFishTypeFinishSql(String stcd, List rstcdList, Date startTime,