| | |
| | | private final OssTemplate ossTemplate; |
| | | private final MachineFileService machineFileService; |
| | | private final MachineService machineService; |
| | | private final MachineAnnotationConfig annoConfig; |
| | | private final AnnotationProcessorHelper annotationProcessorHelper; |
| | | private final ProgramAnnotationService programAnnotationService; |
| | | /** |
| | | * 导出到涉密网 |
| | |
| | | os.close(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * j将输入流加入zip |
| | | * @param zipOut zip文件输出里路 |
| | | * @param inputStream 文件的输入流 |
| | | * @param entryName entryName |
| | | * @param filename 原始文件名 |
| | | * @param machineCode 机床代码 |
| | | * @throws IOException 异常 |
| | | */ |
| | | public void addInputStreamToZip(ZipOutputStream zipOut, InputStream inputStream, String entryName,String filename,String machineCode) |
| | | throws IOException { |
| | | // 创建新的 ZIP 条目 |
| | |
| | | */ |
| | | InputStream setAnnotations(InputStream inputStream,String filename,String machineCode) throws IOException { |
| | | Machine machine = this.machineService.getByCode(machineCode); |
| | | AnnotationProcessor annoProcessor = ProcessorHelper.getProcessor(machine.getControlSystem(),annoConfig); |
| | | AnnotationProcessor annoProcessor = annotationProcessorHelper.getProcessor(machine.getControlSystem()); |
| | | |
| | | AnnotationData annoData = new AnnotationData(); |
| | | annoData.setFilename(filename); |
| | |
| | | |
| | | AnnotationProperties annoProps = annoProcessor.getAnnotationProperties(); |
| | | |
| | | ByteArrayInputStream bais = new ByteArrayInputStream(IOUtils.toByteArray(inputStream)); |
| | | String statusLine = FileContentUtil.readLineAt(bais,annoProps.getStatusLineIndex()); |
| | | ByteArrayInputStream byteInsStream = new ByteArrayInputStream(IOUtils.toByteArray(inputStream)); |
| | | String statusLine = FileContentUtil.readLineAt(byteInsStream,annoProps.getStatusLineIndex()); |
| | | String text = programAnnotationService.removeAnnotation(machine.getControlSystem(),statusLine); |
| | | |
| | | if(AnnotationUtil.isStatusContent(text)){ |
| | |
| | | //没有按试切处理 |
| | | annoData.setProgramStatus(AnnotationUtil.SQ); |
| | | } |
| | | bais.reset(); |
| | | byteInsStream.reset(); |
| | | // |
| | | return annoProcessor.putAnnotation(annoData,bais); |
| | | return annoProcessor.putAnnotation(annoData,byteInsStream); |
| | | } |
| | | } |
| | | |