Commit 46b31f43a5a0d77b4e0f012616519a53c2df636d
1 parent
4f6f132f
✨ feat(mes): 增加生产趋势查询参数验证和首页组件优化
为生产趋势查询添加最小和最大天数验证,确保输入有效性。 优化首页组件,增加数据存在性判断,提升用户体验。
Showing
2 changed files
with
9 additions
and
3 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/home/MesHomeStatisticsController.java
| ... | ... | @@ -9,6 +9,8 @@ import io.swagger.v3.oas.annotations.Operation; |
| 9 | 9 | import io.swagger.v3.oas.annotations.Parameter; |
| 10 | 10 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 11 | 11 | import jakarta.annotation.Resource; |
| 12 | +import jakarta.validation.constraints.Max; | |
| 13 | +import jakarta.validation.constraints.Min; | |
| 12 | 14 | import org.springframework.security.access.prepost.PreAuthorize; |
| 13 | 15 | import org.springframework.validation.annotation.Validated; |
| 14 | 16 | import org.springframework.web.bind.annotation.GetMapping; |
| ... | ... | @@ -48,7 +50,7 @@ public class MesHomeStatisticsController { |
| 48 | 50 | @Parameter(name = "days", description = "天数", example = "7") |
| 49 | 51 | @PreAuthorize("@ss.hasPermission('mes:home:query')") |
| 50 | 52 | public CommonResult<List<MesHomeProductionTrendRespVO>> getProductionTrend( |
| 51 | - @RequestParam(value = "days", defaultValue = "7") Integer days) { | |
| 53 | + @RequestParam(value = "days", defaultValue = "7") @Min(1) @Max(90) Integer days) { | |
| 52 | 54 | return success(homeStatisticsService.getProductionTrend(days)); |
| 53 | 55 | } |
| 54 | 56 | ... | ... |
yudao-module-mes/src/main/resources/mapper/home/MesHomeStatisticsMapper.xml
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | IFNULL(SUM(unqualified_quantity), 0) AS unqualifiedQuantity |
| 18 | 18 | FROM mes_pro_feedback |
| 19 | 19 | WHERE deleted = 0 |
| 20 | + AND status = ${@cn.iocoder.yudao.module.mes.enums.pro.MesProFeedbackStatusEnum@FINISHED.status} | |
| 20 | 21 | AND feedback_time >= #{beginTime} |
| 21 | 22 | <if test="endTime != null"> |
| 22 | 23 | AND feedback_time < #{endTime} |
| ... | ... | @@ -36,7 +37,7 @@ |
| 36 | 37 | SELECT COUNT(*) |
| 37 | 38 | FROM mes_pro_andon_record |
| 38 | 39 | WHERE deleted = 0 |
| 39 | - AND status = 0 | |
| 40 | + AND status = ${@cn.iocoder.yudao.module.mes.enums.pro.MesProAndonStatusEnum@ACTIVE.status} | |
| 40 | 41 | </select> |
| 41 | 42 | |
| 42 | 43 | <!-- 统计未完成维修工单数(草稿 0、维修中 1、待验收 2) --> |
| ... | ... | @@ -44,7 +45,9 @@ |
| 44 | 45 | SELECT COUNT(*) |
| 45 | 46 | FROM mes_dv_repair |
| 46 | 47 | WHERE deleted = 0 |
| 47 | - AND status IN (0, 1, 2) | |
| 48 | + AND status IN (${@cn.iocoder.yudao.module.mes.enums.dv.MesDvRepairStatusEnum@PREPARE.status}, | |
| 49 | + ${@cn.iocoder.yudao.module.mes.enums.dv.MesDvRepairStatusEnum@CONFIRMED.status}, | |
| 50 | + ${@cn.iocoder.yudao.module.mes.enums.dv.MesDvRepairStatusEnum@APPROVING.status}) | |
| 48 | 51 | </select> |
| 49 | 52 | |
| 50 | 53 | <!-- 按天聚合报工产量 --> |
| ... | ... | @@ -55,6 +58,7 @@ |
| 55 | 58 | IFNULL(SUM(unqualified_quantity), 0) AS unqualifiedQuantity |
| 56 | 59 | FROM mes_pro_feedback |
| 57 | 60 | WHERE deleted = 0 |
| 61 | + AND status = ${@cn.iocoder.yudao.module.mes.enums.pro.MesProFeedbackStatusEnum@FINISHED.status} | |
| 58 | 62 | AND feedback_time >= #{beginTime} |
| 59 | 63 | <if test="endTime != null"> |
| 60 | 64 | AND feedback_time < #{endTime} | ... | ... |