fix: 优化过鱼倒数统计

This commit is contained in:
tangwei 2026-06-10 16:38:31 +08:00
parent 4ba5a2c05d
commit eb4cb28b39
3 changed files with 17 additions and 6 deletions

View File

@ -9,9 +9,11 @@ public interface FishStatisticsMapper {
List<FishStatisticsVO> queryStatistics(@Param("basinCode") String basinCode,
@Param("stationCode") String stationCode,
@Param("reportMonth") String reportMonth,
@Param("startRow") int startRow,
@Param("endRow") int endRow);
int countStatistics(@Param("basinCode") String basinCode,
@Param("stationCode") String stationCode);
@Param("stationCode") String stationCode,
@Param("reportMonth") String reportMonth);
}

View File

@ -12,6 +12,8 @@ import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -29,6 +31,10 @@ public class FishStatisticsServiceImpl implements IFishStatisticsService {
String basinNamesStr = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "basinCode");
String stationNamesStr = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stationCode");
String reportMonth = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "reportMonth");
if (StrUtil.isBlank(reportMonth)) {
reportMonth = LocalDate.now().minusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM"));
}
// List<String> basinNames = parseFilterList(basinNamesStr);
// List<String> stationNames = parseFilterList(stationNamesStr);
@ -47,9 +53,9 @@ public class FishStatisticsServiceImpl implements IFishStatisticsService {
int endRow = startRow + pageSize;
List<FishStatisticsVO> records = fishStatisticsMapper.queryStatistics(
basinNamesStr, stationNamesStr, startRow, endRow);
basinNamesStr, stationNamesStr, reportMonth, startRow, endRow);
int total = fishStatisticsMapper.countStatistics(basinNamesStr, basinNamesStr);
int total = fishStatisticsMapper.countStatistics(basinNamesStr, stationNamesStr, reportMonth);
Page<FishStatisticsVO> page = new Page<>();
page.setRecords(records);

View File

@ -167,6 +167,9 @@
FROM FISH_DRAFT_DATA
WHERE DELETED_FLAG = 0
AND STATUS IN ('PENDING','APPROVED')
<if test="reportMonth != null and reportMonth != ''">
AND TO_CHAR(STRDT, 'YYYY-MM') = #{reportMonth}
</if>
GROUP BY CREATED_BY, TO_CHAR(STRDT, 'YYYY-MM')
),
@ -186,7 +189,7 @@
sa.MIN_STATION_CODE,
ba.BASIN_NAMES,
sa.STATION_NAMES,
fm.REPORT_MONTH,
NVL(fm.REPORT_MONTH, #{reportMonth}) AS REPORT_MONTH,
fm.MIN_STRDT,
fm.MAX_ENDDT,
fm.TOTAL_FCNT,