黎星凯
2024-06-28 38e7fed751939294bd60bcdab077807a21299a2f
consum-base/src/main/java/com/consum/base/controller/LWhFormScrappedController.java
@@ -155,7 +155,7 @@
    @ApiOperation(value = "导出报废单", notes = "导出报废单")
    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query")})
    @GetMapping("/list/export")
    public void export(Long id, HttpServletResponse response) throws Exception {
    public ResponseValue<String> export(Long id, HttpServletResponse response) throws Exception {
        if (id == null) {
            throw new RuntimeException("报废单id为空");
        }
@@ -175,8 +175,8 @@
        int countNum =
            export.stream().filter(item -> item.getNum() != null).mapToInt(ScrappedInfoExcelTemplate::getNum).sum();
        int totalAmount = export.stream().filter(item -> item.getTotalAmount() != null)
            .mapToInt(ScrappedInfoExcelTemplate::getTotalAmount).sum();
        double totalAmount = export.stream().filter(item -> item.getTotalAmount() != null)
            .mapToDouble(ScrappedInfoExcelTemplate::getAmount).sum();
        Map<String, Object> map = new HashMap<>();
        map.put("code", businessFormCode);
@@ -186,7 +186,8 @@
        map.put("totalAmount", totalAmount);
        Workbook sheets = ExcelExportUtil.exportExcel(exportParams, ScrappedInfoExcelTemplate.class, export, map);
        downLoadExcel("报废登记单", response, sheets);
        String filePath = downLoadExcel("报废登记单", sheets);
        return ResponseValue.success("导出成功", filePath);
    }