|
@@ -434,6 +434,9 @@ public class HazardHiddenAccountServiceImpl extends ServiceImpl<HazardHiddenAcco
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 各区域隐患统计(饼图):按片区分组,片区编码经字典 drainage_district 转中文标签
|
|
* 各区域隐患统计(饼图):按片区分组,片区编码经字典 drainage_district 转中文标签
|
|
|
|
|
+ *
|
|
|
|
|
+ * 固定输出 城南/城北/太常 三个片区维度(无数据补 0),未填写片区或片区编码
|
|
|
|
|
+ * 不在字典内的数据归入「未知」兜底,避免隐患数据缺失片区时饼图只剩一块
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public List<Map<String, Object>> statisticsDistrictPie(String startDate, String endDate) {
|
|
public List<Map<String, Object>> statisticsDistrictPie(String startDate, String endDate) {
|
|
@@ -443,9 +446,22 @@ public class HazardHiddenAccountServiceImpl extends ServiceImpl<HazardHiddenAcco
|
|
|
h -> StringUtils.hasText(h.getDistrict()) ? h.getDistrict() : "未知",
|
|
h -> StringUtils.hasText(h.getDistrict()) ? h.getDistrict() : "未知",
|
|
|
Collectors.counting()));
|
|
Collectors.counting()));
|
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
|
|
|
+ // 固定三个片区维度:0城南 / 1城北 / 2太常
|
|
|
|
|
+ for (String code : new String[]{"0", "1", "2"}) {
|
|
|
|
|
+ String label = dictDataService.selectDictLabel("drainage_district", code);
|
|
|
|
|
+ Map<String, Object> item = new HashMap<>();
|
|
|
|
|
+ item.put("name", StringUtils.hasText(label) ? label : code);
|
|
|
|
|
+ item.put("value", grouped.getOrDefault(code, 0L));
|
|
|
|
|
+ result.add(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其余片区编码(脏数据)与未填片区的「未知」兜底追加
|
|
|
for (Map.Entry<String, Long> entry : grouped.entrySet()) {
|
|
for (Map.Entry<String, Long> entry : grouped.entrySet()) {
|
|
|
|
|
+ if ("0".equals(entry.getKey()) || "1".equals(entry.getKey()) || "2".equals(entry.getKey())) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ String label = "未知".equals(entry.getKey()) ? "未知"
|
|
|
|
|
+ : dictDataService.selectDictLabel("drainage_district", entry.getKey());
|
|
|
Map<String, Object> item = new HashMap<>();
|
|
Map<String, Object> item = new HashMap<>();
|
|
|
- String label = dictDataService.selectDictLabel("drainage_district", entry.getKey());
|
|
|
|
|
item.put("name", StringUtils.hasText(label) ? label : entry.getKey());
|
|
item.put("name", StringUtils.hasText(label) ? label : entry.getKey());
|
|
|
item.put("value", entry.getValue());
|
|
item.put("value", entry.getValue());
|
|
|
result.add(item);
|
|
result.add(item);
|