| | |
| | | private Integer num; |
| | | |
| | | /** |
| | | * 金额 |
| | | */ |
| | | @ExcelProperty({"自贡市公共视频监控系统续维合同", "金额"}) |
| | | private BigDecimal money; |
| | | |
| | | /** |
| | | * 分数 |
| | | */ |
| | | @ExcelProperty({"自贡市公共视频监控系统续维合同", "分数"}) |
| | | private Integer score; |
| | | |
| | | /** |
| | | * 剩余分数 |
| | | * 金额 |
| | | */ |
| | | @ExcelProperty({"自贡市公共视频监控系统续维合同", "剩余分数"}) |
| | | private Integer surplusScore; |
| | | |
| | | /** |
| | | * 合计 |
| | | */ |
| | | @ExcelProperty({"自贡市公共视频监控系统续维合同", "合计"}) |
| | | private BigDecimal total; |
| | | @ExcelProperty({"自贡市公共视频监控系统续维合同", "金额"}) |
| | | private BigDecimal money; |
| | | |
| | | } |
| | |
| | | @Override |
| | | @SneakyThrows |
| | | public void export(Integer contractId, HttpServletResponse response) { |
| | | // 获取数据 |
| | | List<CalculateExport> list = baseMapper.exportData(contractId); |
| | | CalculateExport calculateExport = new CalculateExport(); |
| | | calculateExport.setRuleName("合计"); |
| | | calculateExport.setNum(list.stream().mapToInt(CalculateExport::getNum).sum()); |
| | | calculateExport.setScore(list.stream().mapToInt(CalculateExport::getScore).sum()); |
| | | list.add(calculateExport); |
| | | // 输出文件 |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = URLEncoder.encode("核算报告", StandardCharsets.UTF_8).replace("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), CalculateExport.class) |
| | | .sheet("核算报告") |
| | | .doWrite(baseMapper.exportData(contractId)); |
| | | .doWrite(list); |
| | | } |
| | | } |
| | |
| | | SELECT |
| | | SUBSTRING_INDEX(rule_name, '/', 1) AS rule_name, |
| | | COUNT(*) AS num, |
| | | SUM(score) AS score, |
| | | (100 - SUM(score)) AS surplusScore |
| | | -SUM(score) AS score |
| | | FROM t_contract_score |
| | | WHERE contract_id = #{contractId} AND auditing_status = 'PASS' AND deleted = 0 |
| | | GROUP BY SUBSTRING_INDEX(rule_name, '/', 1) |