[P1] 监管看板模块存在大量硬编码模拟数据 #3

Open
opened 2026-01-18 17:03:52 +08:00 by tangweijie · 0 comments
Owner

问题描述

监管看板 (PrisonDashboard) 模块存在大量硬编码的模拟数据,导致前端展示的数据不真实,无法用于生产环境。

涉及文件

  • backend/yudao-module-prison/src/main/java/cn/iocoder/yudao/module/prison/service/dashboard/impl/PrisonDashboardServiceImpl.java

问题详情

硬编码数据列表

1. 中心左侧数据 (第 276-287 行)

private PrisonerDashboardStatsRespVO.CenterLeftData buildCenterLeftData() {
    return PrisonerDashboardStatsRespVO.CenterLeftData.builder()
            .topValue("1054")   // 硬编码
            .topLabel("监区总人数")
            .middleLeftValue("124")  // 硬编码
            .middleLeftLabel("本月出监人数")
            .middleRightValue("78.24%")  // 硬编码
            .middleRightLabel("教育完成率")
            .bottomValue("108位")  // 硬编码
            .bottomLabel("重点关注人员")
            .build();
}

2. 中心右侧数据 (第 292-305 行)

private PrisonerDashboardStatsRespVO.CenterRightData buildCenterRightData() {
    return PrisonerDashboardStatsRespVO.CenterRightData.builder()
            .topValue("13")  // 硬编码
            .topLabel("当前考核等级")
            .middleLeftValue("15")  // 硬编码
            .middleLeftLabel("奖励次数")
            .middleRightValue("34")  // 硬编码
            .middleRightLabel("处罚次数")
            .bottomLeftValue("58位")  // 硬编码
            .bottomLeftLabel("就医人员")
            .bottomRightValue("58辆")  // 硬编码
            .bottomRightLabel("探视车辆")
            .build();
}

3. 月度消费数据 (第 310-326 行)

private List<PrisonerDashboardStatsRespVO.MonthlyConsumptionData> buildMonthlyConsumptionData(Long prisonerId) {
    // 默认数据,后续可从数据库查询
    int[] standards = {24, 18, 15, 37, 29, 17, 15, 15, 15, 15, 15, 15};
    int[] perCapitas = {17, 24, 30, 18, 15, 24, 30, 30, 30, 30, 30, 30};
    // ...
}

4. 消费汇总 (第 127-131 行)

vo.setConsumptionSummary(ConsumptionSummary.builder()
        .inProgress(5)  // 硬编码
        .toWarehouse(5)  // 硬编码
        .outWarehouse(5)  // 硬编码
        .build());

5. 风险评估分 (第 139-141 行)

vo.setRiskScore(92.23);  // 硬编码
vo.setRiskLevel(1);  // 硬编码

6. 奖惩记录 (第 398-417 行)

private List<PrisonerDashboardStatsRespVO.RewardsPunishment> buildRewardsPunishments(Long prisonerId) {
    // 默认数据,后续可从奖惩模块获取
    // ...
}

7. 默认访谈记录 (第 359-378 行)

使用 2023 年的旧数据作为默认值。

影响

  • 前端看板展示的数据全部为模拟数据,无法反映真实业务情况
  • 系统上线后需要重新实现所有数据查询逻辑
  • 无法用于生产环境

建议修复

  1. 实现真实的数据查询逻辑,从数据库获取真实数据
  2. 如果是开发期间需要模拟数据,使用配置文件或测试数据开关
  3. 对硬编码的方法添加 @Deprecated 注释和 TODO 说明

优先级

P1 (High)

标签

bug, backend, feature

## 问题描述 监管看板 (PrisonDashboard) 模块存在大量硬编码的模拟数据,导致前端展示的数据不真实,无法用于生产环境。 ## 涉及文件 - `backend/yudao-module-prison/src/main/java/cn/iocoder/yudao/module/prison/service/dashboard/impl/PrisonDashboardServiceImpl.java` ## 问题详情 ### 硬编码数据列表 #### 1. 中心左侧数据 (第 276-287 行) ```java private PrisonerDashboardStatsRespVO.CenterLeftData buildCenterLeftData() { return PrisonerDashboardStatsRespVO.CenterLeftData.builder() .topValue("1054") // 硬编码 .topLabel("监区总人数") .middleLeftValue("124") // 硬编码 .middleLeftLabel("本月出监人数") .middleRightValue("78.24%") // 硬编码 .middleRightLabel("教育完成率") .bottomValue("108位") // 硬编码 .bottomLabel("重点关注人员") .build(); } ``` #### 2. 中心右侧数据 (第 292-305 行) ```java private PrisonerDashboardStatsRespVO.CenterRightData buildCenterRightData() { return PrisonerDashboardStatsRespVO.CenterRightData.builder() .topValue("13") // 硬编码 .topLabel("当前考核等级") .middleLeftValue("15") // 硬编码 .middleLeftLabel("奖励次数") .middleRightValue("34") // 硬编码 .middleRightLabel("处罚次数") .bottomLeftValue("58位") // 硬编码 .bottomLeftLabel("就医人员") .bottomRightValue("58辆") // 硬编码 .bottomRightLabel("探视车辆") .build(); } ``` #### 3. 月度消费数据 (第 310-326 行) ```java private List<PrisonerDashboardStatsRespVO.MonthlyConsumptionData> buildMonthlyConsumptionData(Long prisonerId) { // 默认数据,后续可从数据库查询 int[] standards = {24, 18, 15, 37, 29, 17, 15, 15, 15, 15, 15, 15}; int[] perCapitas = {17, 24, 30, 18, 15, 24, 30, 30, 30, 30, 30, 30}; // ... } ``` #### 4. 消费汇总 (第 127-131 行) ```java vo.setConsumptionSummary(ConsumptionSummary.builder() .inProgress(5) // 硬编码 .toWarehouse(5) // 硬编码 .outWarehouse(5) // 硬编码 .build()); ``` #### 5. 风险评估分 (第 139-141 行) ```java vo.setRiskScore(92.23); // 硬编码 vo.setRiskLevel(1); // 硬编码 ``` #### 6. 奖惩记录 (第 398-417 行) ```java private List<PrisonerDashboardStatsRespVO.RewardsPunishment> buildRewardsPunishments(Long prisonerId) { // 默认数据,后续可从奖惩模块获取 // ... } ``` #### 7. 默认访谈记录 (第 359-378 行) 使用 2023 年的旧数据作为默认值。 ## 影响 - 前端看板展示的数据全部为模拟数据,无法反映真实业务情况 - 系统上线后需要重新实现所有数据查询逻辑 - 无法用于生产环境 ## 建议修复 1. 实现真实的数据查询逻辑,从数据库获取真实数据 2. 如果是开发期间需要模拟数据,使用配置文件或测试数据开关 3. 对硬编码的方法添加 `@Deprecated` 注释和 TODO 说明 ## 优先级 P1 (High) ## 标签 bug, backend, feature
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tangweijie/xlcp-backend#3
No description provided.