liurunyu
2024-10-08 fd523aa5694b7f9350f87b30cab6bb3ae34e1c77
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/taskPlan/AssemblyPlanCtrl.java
@@ -129,7 +129,7 @@
    @GetMapping(path="exportDevice")
    @SsoPowerAop(power = "10200001")
    @Log("导出设备号")
    @Log("导出设备号及二维码")
    public void exportDevice(Long batchId, HttpServletResponse response){
        Date start = new Date() ;
        List<Converter> list = new ArrayList<>();
@@ -146,8 +146,29 @@
            }
            list.add(vo);
        });
        log.info("导出设备号耗时:"+(new Date().getTime()-start.getTime())+"ms");
        log.info("导出设备号及二维码耗时:"+(new Date().getTime()-start.getTime())+"ms");
        QrCodeUtil.downloadExcel(response, fileName,sheetName,list);
        log.info("导出设备号及二维码耗时:"+(new Date().getTime()-start.getTime())+"ms");
    }
    @GetMapping(path="exportDeviceNo")
    @SsoPowerAop(power = "10200001")
    @Log("导出设备号")
    public void exportDeviceNo(Long batchId, HttpServletResponse response){
        Date start = new Date() ;
        List<Converter> list = new ArrayList<>();
        List<PrDevice> deviceList = sv.selectDeviceByBatchId(batchId) ;
        // 使用并行流提高性能
        deviceList.parallelStream().forEach(device -> {
            ExcelDeviceNoVo vo = new ExcelDeviceNoVo();
            vo.deviceNo = device.deviceNo;
            list.add(vo);
        });
        //根据batchid找到任务名称
        PrAssemblyPlan plan = sv.selectByBatchId(batchId);
        String fileNameStr = plan.name +"-"+ fileName;
        log.info("导出设备号耗时:"+(new Date().getTime()-start.getTime())+"ms");
        QrCodeUtil.downloadExcel(response, fileNameStr,sheetName,list);
        log.info("导出设备号耗时:"+(new Date().getTime()-start.getTime())+"ms");
    }
}