|  |  | 
 |  |  | import com.dy.common.webUtil.QueryResultVo; | 
 |  |  | import com.dy.pmsGlobal.aop.Log; | 
 |  |  | import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; | 
 |  |  | import com.dy.pmsGlobal.pojoPr.PrEquip; | 
 |  |  | import com.dy.pmsGlobal.pojoPr.PrDevice; | 
 |  |  | import com.dy.pmsGlobal.util.QrCodeUtil; | 
 |  |  | import com.google.zxing.WriterException; | 
 |  |  | import jakarta.servlet.http.HttpServletResponse; | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping(path="save") | 
 |  |  |     @SsoPowerAop(power = "-1") | 
 |  |  |     @SsoPowerAop(power = "10200001") | 
 |  |  |     @Log("保存组装任务计划") | 
 |  |  |     public BaseResponse<Boolean> save(@RequestBody @Valid PrAssemblyPlan plan){ | 
 |  |  |         int count = sv.save(plan); | 
 |  |  | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path="update") | 
 |  |  |     @SsoPowerAop(power = "-1") | 
 |  |  |     @SsoPowerAop(power = "10200001") | 
 |  |  |     @Log("更新组装任务计划") | 
 |  |  |     public BaseResponse<Boolean> update(@RequestBody @Valid PrAssemblyPlan plan){ | 
 |  |  |         int count = sv.update(plan); | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping(path="updateStatus") | 
 |  |  |     @SsoPowerAop(power = "-1") | 
 |  |  |     @SsoPowerAop(power = "10200001") | 
 |  |  |     @Log("更新任务计划状态") | 
 |  |  |     public BaseResponse<Boolean> updateStatus(@RequestBody PrAssemblyPlan plan){ | 
 |  |  |         int count = sv.updateStatus(plan); | 
 |  |  | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @GetMapping(path="one") | 
 |  |  |     @SsoPowerAop(power = "-1") | 
 |  |  |     @SsoPowerAop(power = "10200000") | 
 |  |  |     @Log("根据ID查询组装任务计划") | 
 |  |  |     public BaseResponse<PrAssemblyPlan> one(Long id){ | 
 |  |  |         PrAssemblyPlan plan=sv.selectById(id); | 
 |  |  | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path="some") | 
 |  |  |     @SsoPowerAop(power = "-1") | 
 |  |  |     @SsoPowerAop(power = "10200000") | 
 |  |  |     @Log("分页查询组装任务计划") | 
 |  |  |     public BaseResponse<QueryResultVo<List<PrAssemblyPlan>>> some(@RequestBody QueryVo vo){ | 
 |  |  |         QueryResultVo<List<PrAssemblyPlan>> list = sv.selectSome(vo) ; | 
 |  |  | 
 |  |  |     /** | 
 |  |  |      * 增加设备号 | 
 |  |  |      */ | 
 |  |  |     @PostMapping(path="addEquip") | 
 |  |  |     @SsoPowerAop(power = "-1") | 
 |  |  |     @PostMapping(path="addDevice") | 
 |  |  |     @SsoPowerAop(power = "10200001") | 
 |  |  |     @Log("增加设备号") | 
 |  |  |     public BaseResponse<?> addEquip(@RequestBody QueryVo vo){ | 
 |  |  |     public BaseResponse<?> addDevice(@RequestBody QueryVo vo){ | 
 |  |  |         if(vo.addNum == null || vo.addNum <= 0 || vo.planId == null){ | 
 |  |  |             return BaseResponseUtils.buildFail("参数错误"); | 
 |  |  |         } | 
 |  |  |         int count = sv.addEquip(vo.planId,vo.addNum); | 
 |  |  |         int count = sv.addDevice(vo.planId,vo.addNum); | 
 |  |  |         if (count <= 0) { | 
 |  |  |             return BaseResponseUtils.buildFail("数据库存储失败"); | 
 |  |  |         } else { | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping(path="someEquip") | 
 |  |  |     @SsoPowerAop(power = "-1") | 
 |  |  |     @PostMapping(path="someDevice") | 
 |  |  |     @SsoPowerAop(power = "10200000") | 
 |  |  |     @Log("分页查询设备号") | 
 |  |  |     public BaseResponse<QueryResultVo<List<PrEquip>>> someEquip(@RequestBody QueryVo queryVo){ | 
 |  |  |         QueryResultVo<List<PrEquip>> list = sv.selectSomeEquip(queryVo) ; | 
 |  |  |     public BaseResponse<QueryResultVo<List<PrDevice>>> someDevice(@RequestBody QueryVo queryVo){ | 
 |  |  |         QueryResultVo<List<PrDevice>> list = sv.selectSomeDevice(queryVo) ; | 
 |  |  |         return BaseResponseUtils.buildSuccess(list); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @GetMapping(path="exportEquip") | 
 |  |  |     @SsoPowerAop(power = "-1") | 
 |  |  |     @Log("导出设备号") | 
 |  |  |     public void exportEquip(Long batchId, HttpServletResponse response){ | 
 |  |  |     @GetMapping(path="exportDevice") | 
 |  |  |     @SsoPowerAop(power = "10200001") | 
 |  |  |     @Log("导出设备号及二维码") | 
 |  |  |     public void exportDevice(Long batchId, HttpServletResponse response){ | 
 |  |  |         Date start = new Date() ; | 
 |  |  |         List<Converter> list = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |         List<PrEquip> equipList = sv.selectEquipByBatchId(batchId) ; | 
 |  |  |         List<PrDevice> deviceList = sv.selectDeviceByBatchId(batchId) ; | 
 |  |  |         // 使用并行流提高性能 | 
 |  |  |         equipList.parallelStream().forEach(equip -> { | 
 |  |  |         deviceList.parallelStream().forEach(device -> { | 
 |  |  |             ExcelVo vo = new ExcelVo(); | 
 |  |  |             vo.equipNo = equip.equipNo; | 
 |  |  |             vo.deviceNo = device.deviceNo; | 
 |  |  |             try { | 
 |  |  |                 vo.qrCode = QrCodeUtil.genQrCode(vo.equipNo); | 
 |  |  |                 vo.qrCode = QrCodeUtil.genQrCode(vo.deviceNo); | 
 |  |  |             } catch (IOException | WriterException e) { | 
 |  |  |                 e.printStackTrace(); | 
 |  |  |             } | 
 |  |  |             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"); | 
 |  |  |     } | 
 |  |  | } |