| | |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineQueryVO; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineVO; |
| | | import org.springblade.mdm.commons.vo.IdsVO; |
| | | import org.springblade.mdm.gkw.programnode.service.MachineFileService; |
| | | import org.springblade.mdm.machineback.service.MachineBackFileService; |
| | | import org.springblade.mdm.machineback.service.NcProgramExportInnerService; |
| | | import org.springblade.mdm.machineback.vo.MachineBackFileHandleExcelVO; |
| | |
| | | public class MachineBackFileHandleController { |
| | | |
| | | private final MachineBackFileService service; |
| | | private final MachineFileService machineFileService; |
| | | private final NcProgramExportInnerService ncProgramExportInnerService; |
| | | /** |
| | | * 分页 |
| | | */ |
| | | @Operation(summary = "分页查询", description = "名称或编码") |
| | | @Operation(summary = "分页查询", description = "名称或编码,已接受的文件列表") |
| | | @GetMapping("/page") |
| | | public R<IPage<MachineBackFileVO>> page(MachineBackFileHandleQueryVO query) { |
| | | IPage<MachineBackFileVO> pages = service.handlePageQuery(query); |
| | | IPage<MachineBackFileVO> pages = machineFileService.handlePageQuery(query); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | @GetMapping("export-to-inner") |
| | | @ApiOperationSupport(order = 13) |
| | | @Operation(summary = "导出到涉密网", description = "导出到涉密网") |
| | | public void exportToInner(@RequestBody @Parameter(description = "审批表id数组") IdsVO vo, HttpServletResponse response) { |
| | | public void exportToInner(@Parameter(description = "审批表id数组") String ids, HttpServletResponse response) { |
| | | |
| | | if(vo.getIds() == null || vo.getIds().length == 0) { |
| | | if(Func.isBlank(ids)) { |
| | | throw new ServiceException("未选择文件导出"); |
| | | } |
| | | try { |
| | | String filename = "toinnerexp-"+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".zip"; |
| | | response.setHeader("Content-Disposition", "attachment; filename="+filename); |
| | | response.setContentType("application/octet-stream"); |
| | | ncProgramExportInnerService.exportToInner(vo.getIds(),response.getOutputStream()); |
| | | ncProgramExportInnerService.exportToInner(Func.toLongList(ids),response.getOutputStream()); |
| | | } catch (IOException e) { |
| | | log.error("工控网导出回传文件异常", e); |
| | | throw new RuntimeException(e); |
| | |
| | | public void exportExcel(MachineBackFileHandleQueryVO query, HttpServletResponse response) { |
| | | query.setCurrent(1); |
| | | query.setSize(Integer.MAX_VALUE); |
| | | IPage<MachineBackFileVO> pages = service.handlePageQuery(query); |
| | | |
| | | //IPage<MachineBackFileVO> pages = service.handlePageQuery(query); |
| | | IPage<MachineBackFileVO> pages = machineFileService.handlePageQuery(query); |
| | | List<MachineBackFileHandleExcelVO> list = new ArrayList<>(); |
| | | pages.getRecords().forEach(vo ->{ |
| | | MachineBackFileHandleExcelVO excelVO = new MachineBackFileHandleExcelVO(); |