package cn.iocoder.yudao.module.mes.controller.admin.safety.vo.dashboard; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; /** * 安全生产 - 可视化看板 Response VO * * 聚合风险、隐患、作业票、培训、证书的统计数据,供看板一次性渲染 * * @author 超级管理员 */ @Schema(description = "管理后台 - 安全生产看板 Response VO") @Data public class MesSafetyDashboardRespVO { // ==================== 风险 ==================== @Schema(description = "风险总数", example = "25") private Long riskTotal; @Schema(description = "风险等级分布") private List riskLevelStats; @Schema(description = "风险按车间分布(Top 10)") private List riskByWorkshop; // ==================== 隐患 ==================== @Schema(description = "隐患统计") private HazardStats hazardStats; @Schema(description = "隐患按车间分布(Top 10)") private List hazardByWorkshop; // ==================== 作业票 ==================== @Schema(description = "作业票统计") private TicketStats ticketStats; // ==================== 培训 ==================== @Schema(description = "培训统计") private TrainingStats trainingStats; // ==================== 证书 ==================== @Schema(description = "证书统计") private CertificateStats certificateStats; // ==================== 最近动态 ==================== @Schema(description = "最近隐患(5 条)") private List recentHazards; @Schema(description = "最近作业票(5 条)") private List recentTickets; // ==================== 内部类 ==================== @Schema(description = "名称-数量") @Data public static class NameCount { @Schema(description = "名称", example = "重大风险") private String name; @Schema(description = "数量", example = "3") private Long count; @Schema(description = "附加项:等级编码,用于前端配色", example = "1") private Integer extra; public NameCount() {} public NameCount(String name, Long count) { this.name = name; this.count = count; } public NameCount(String name, Long count, Integer extra) { this.name = name; this.count = count; this.extra = extra; } } @Schema(description = "隐患统计") @Data public static class HazardStats { @Schema(description = "隐患总数") private Long total; @Schema(description = "待整改") private Long pending; @Schema(description = "整改中") private Long rectifying; @Schema(description = "待验收") private Long toCheck; @Schema(description = "已闭环") private Long closed; @Schema(description = "已超期(未闭环且超过整改期限)") private Long overdue; @Schema(description = "整改闭环率(%)") private BigDecimal closedRate; } @Schema(description = "作业票统计") @Data public static class TicketStats { @Schema(description = "作业票总数") private Long total; @Schema(description = "待审批") private Long pending; @Schema(description = "已批准") private Long approved; @Schema(description = "已完工") private Long finished; @Schema(description = "已归档") private Long archived; @Schema(description = "已驳回") private Long rejected; @Schema(description = "已批准但超计划结束时间") private Long overdue; } @Schema(description = "培训统计") @Data public static class TrainingStats { @Schema(description = "培训总数") private Long total; @Schema(description = "已完成") private Long finished; @Schema(description = "进行中") private Long ongoing; @Schema(description = "计划中") private Long planned; @Schema(description = "累计参训人次") private Long attendeeTotal; @Schema(description = "平均考试成绩") private BigDecimal avgScore; } @Schema(description = "证书统计") @Data public static class CertificateStats { @Schema(description = "证书总数") private Long total; @Schema(description = "有效") private Long valid; @Schema(description = "已过期") private Long expired; @Schema(description = "30 天内到期") private Long expiringSoon; } @Schema(description = "最近隐患") @Data public static class RecentHazard { @Schema(description = "编号") private Long id; @Schema(description = "隐患编码") private String code; @Schema(description = "隐患名称") private String name; @Schema(description = "隐患等级") private Integer hazardLevel; @Schema(description = "状态") private Integer status; @Schema(description = "发现日期") private LocalDate foundDate; } @Schema(description = "最近作业票") @Data public static class RecentTicket { @Schema(description = "编号") private Long id; @Schema(description = "作业票号") private String code; @Schema(description = "作业类型") private Integer ticketType; @Schema(description = "作业地点") private String workLocation; @Schema(description = "状态") private Integer status; @Schema(description = "创建时间") private LocalDateTime createTime; } }