fix: 优化水质达标率的污染物
This commit is contained in:
parent
94fde50aad
commit
062590a032
@ -39,4 +39,9 @@ public interface SdWqRMapper extends BaseMapper<SdWqR> {
|
||||
List<Map<String, Object>> selectPollutants(@Param("stcdList") List<String> stcdList,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
/**
|
||||
* 查询 SD_WQ_R 表的字段注释(字段名 → 中文描述)
|
||||
*/
|
||||
List<Map<String, Object>> selectColumnComments();
|
||||
}
|
||||
|
||||
@ -518,9 +518,37 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
||||
List<Map<String, Object>> hourlyData = sdWqRMapper.selectComplianceData(uniqueStcds, startStr, endStr);
|
||||
// 查询日均达标数据
|
||||
List<Map<String, Object>> dailyData = sdWqdaySMapper.selectComplianceData(uniqueStcds, startStr, endStr);
|
||||
// 查询主要污染物
|
||||
// 查询主要污染物(从小时表 WQ_SFDBHN_YS 获取)
|
||||
List<Map<String, Object>> pollutantData = sdWqRMapper.selectPollutants(uniqueStcds, startStr, endStr);
|
||||
|
||||
// 查询要素中文名映射(通过 ST_TB_YS_B.YS_SHOW_NAME,COLUMN_NAME → 显示名)
|
||||
Map<String, String> colCommentMap = new LinkedHashMap<>();
|
||||
List<Map<String, Object>> colComments = sdWqRMapper.selectColumnComments();
|
||||
for (Map<String, Object> cm : colComments) {
|
||||
String colName = (String) cm.get("COLUMN_NAME");
|
||||
String comment = (String) cm.get("COMMENTS");
|
||||
if (colName != null && comment != null && !comment.isEmpty()) {
|
||||
colCommentMap.put(colName, comment);
|
||||
}
|
||||
}
|
||||
|
||||
// 按 STCD 聚合污染物(拆分逗号、映射中文名、去重)
|
||||
Map<String, Set<String>> pollutantSetMap = new LinkedHashMap<>();
|
||||
for (Map<String, Object> m : pollutantData) {
|
||||
String stcd = (String) m.get("STCD");
|
||||
String pol = (String) m.get("POLLUTANT");
|
||||
if (pol != null && !pol.isEmpty()) {
|
||||
Set<String> set = pollutantSetMap.computeIfAbsent(stcd, k -> new LinkedHashSet<>());
|
||||
for (String field : pol.split(",")) {
|
||||
String f = field.trim();
|
||||
if (!f.isEmpty()) {
|
||||
String desc = colCommentMap.getOrDefault(f, f);
|
||||
set.add(desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 按 STCD 索引达标统计
|
||||
Map<String, Map<String, Object>> hourlyMap = new LinkedHashMap<>();
|
||||
for (Map<String, Object> m : hourlyData) {
|
||||
@ -530,15 +558,6 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
||||
for (Map<String, Object> m : dailyData) {
|
||||
dailyMap.put((String) m.get("STCD"), m);
|
||||
}
|
||||
// 按 STCD 聚合污染物(去重后用逗号分隔)
|
||||
Map<String, Set<String>> pollutantSetMap = new LinkedHashMap<>();
|
||||
for (Map<String, Object> m : pollutantData) {
|
||||
String stcd = (String) m.get("STCD");
|
||||
String pol = (String) m.get("POLLUTANT");
|
||||
if (pol != null && !pol.isEmpty()) {
|
||||
pollutantSetMap.computeIfAbsent(stcd, k -> new LinkedHashSet<>()).add(pol);
|
||||
}
|
||||
}
|
||||
|
||||
// ======== Row 0: 子标题行 ========
|
||||
List<Object> subRow = new ArrayList<>();
|
||||
|
||||
@ -59,4 +59,13 @@
|
||||
AND TM < TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
|
||||
</select>
|
||||
|
||||
<!-- 查询 SD_WQ_R 表的要素中文名(通过 ST_TB_B + ST_TB_YS_B 关联) -->
|
||||
<select id="selectColumnComments" resultType="java.util.HashMap">
|
||||
SELECT YS.YS AS COLUMN_NAME, YS.YS_SHOW_NAME AS COMMENTS
|
||||
FROM ST_TB_B TB
|
||||
INNER JOIN ST_TB_YS_B YS ON YS.TB_ID = TB.ID AND NVL(YS.IS_DELETED, 0) = 0
|
||||
WHERE NVL(TB.IS_DELETED, 0) = 0
|
||||
AND TB.TB = 'SD_WQ_R'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user