| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineExcelVO; |
| | | 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.machineback.service.MachineBackFileService; |
| | | import org.springblade.mdm.machineback.service.NcProgramExportInnerService; |
| | | import org.springblade.mdm.machineback.vo.MachineBackFileHandleExcelVO; |
| | | import org.springblade.mdm.machineback.vo.MachineBackFileHandleQueryVO; |
| | | import org.springblade.mdm.machineback.vo.MachineBackFileQueryVO; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/machineback/filehandle") |
| | | @Tag(name = "机床回传程序处理", description = "机床回传程序处理") |
| | | public class MachineBackFileHandleController { |
| | | |
| | | @Autowired |
| | | private MachineBackFileService service; |
| | | |
| | | private final MachineBackFileService service; |
| | | private final NcProgramExportInnerService ncProgramExportInnerService; |
| | | /** |
| | | * 分页 |
| | | */ |
| | |
| | | @GetMapping("export-to-inner") |
| | | @ApiOperationSupport(order = 13) |
| | | @Operation(summary = "导出到涉密网", description = "导出到涉密网") |
| | | public void exportToInner(MachineBackFileHandleQueryVO query, HttpServletResponse response) { |
| | | public void exportToInner(@RequestBody @Parameter(description = "审批表id数组") IdsVO vo, HttpServletResponse response) { |
| | | |
| | | if(vo.getIds() == null || vo.getIds().length == 0) { |
| | | 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()); |
| | | } catch (IOException e) { |
| | | log.error("工控网导出回传文件异常", e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | |