| | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.UrlUtil; |
| | | import org.springblade.mdm.commons.vo.IdsVO; |
| | | import org.springblade.mdm.program.service.NcProgramApprovedService; |
| | | import org.springblade.mdm.program.service.NcProgramExportDNCService; |
| | | import org.springblade.mdm.program.service.NcProgramService; |
| | | import org.springblade.mdm.program.vo.NcNodeProgramQueryVO; |
| | | import org.springblade.mdm.program.vo.NcProgramExportDncPageVO; |
| | | import org.springblade.mdm.program.vo.NcProgramExportDncQueryVO; |
| | | import org.springblade.mdm.program.vo.NcProgramVO; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.server.ResponseStatusException; |
| | | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * 程序涉密网-工控网交换接口 |
| | |
| | | throw new ServiceException("未选择文件导出"); |
| | | } |
| | | //try { |
| | | ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
| | | ncProgramExportDNCService.exportDnc(vo.getIds(),bos); |
| | | response.getOutputStream().write(bos.toByteArray()); |
| | | String filename = "programexp-"+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".zip"; |
| | | response.setHeader("Content-Disposition", "attachment; filename="+filename); |
| | | response.setContentType("application/octet-stream"); |
| | | //导出文件名称要求导出人名字+时间戳 |
| | | |
| | | String uname = UrlUtil.encode(AuthUtil.getNickName()); |
| | | //String filename =AuthUtil.getNickName()+"-"+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".zip"; |
| | | String filename = uname+"-"+ DateUtil.format(DateUtil.now(), "yyyyMMddHHmm")+".zip"; |
| | | response.setHeader("Content-Disposition", "attachment; filename="+filename); |
| | | response.setContentType("application/octet-stream;charset=utf-8"); |
| | | |
| | | ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
| | | ncProgramExportDNCService.exportDnc(vo.getIds(),bos); |
| | | response.getOutputStream().write(bos.toByteArray()); |
| | | |
| | | |
| | | //} catch (Exception e) { |
| | | //log.error("导出DNC异常", e); |