43

所花时间:6小时
博客量:1
代码量:211
@Service
public class RiskStatisticsService {
@Autowired
private RiskMapper riskMapper;

// 按组织层级统计风险数量
public Map<String, Object> getRiskCountByLevel(String level) {
    Map<String, Object> result = new HashMap<>();
    // 公司层级统计
    if ("company".equals(level)) {
        result.put("total", riskMapper.countByCompany());
        result.put("major", riskMapper.countMajorByCompany());
        // 其他等级统计...
    }
    // 部门/工区/班组层级逻辑类似
    return result;
}

// 自动生成月度分析报告
public String generateMonthlyReport() {
    LocalDate now = LocalDate.now();
    List<Risk> monthlyRisks = riskMapper.getByMonth(now.getMonthValue());
    // 计算同比/环比
    double monthOnMonth = calculateMonthOnMonth(monthlyRisks);
    return String.format("本月风险总数:%d,同比增长:%.2f%%", 
        monthlyRisks.size(), monthOnMonth);
}

}

posted @ 2025-05-08 21:40  龚恒。  阅读(6)  评论(0)    收藏  举报