| | |
| | | |
| | | @Override |
| | | public InputStream setAnnotation(AnnotationData annoData, InputStream inputStream) throws IOException { |
| | | List<DictBiz> annoDicts = programAnnotationService.getAnnotionDictList(); |
| | | ByteArrayInputStream bais = new ByteArrayInputStream(IOUtils.toByteArray(inputStream)); |
| | | |
| | | String line = FileContentUtil.readLineAt(bais, annotationProperties.getProgramNameLineIndex()); |
| | | bais.reset(); |
| | | boolean isAnnotation = AnnotationUtil.isAnnotation(line,controlSystem,annoDicts); |
| | | InputStream insAfter; |
| | | //加入程序名注释行 |
| | | String proNameLine = AnnotationUtil.generateAnnotation(FilenameUtils.removeExtension(annoData.getFilename()),getControlSystem(),annoDicts); |
| | | if(isAnnotation){ |
| | | insAfter = FileContentUtil.replaceAtLine(bais, annotationProperties.getProgramNameLineIndex(),proNameLine); |
| | | }else{ |
| | | insAfter = FileContentUtil.insertLine(bais, annotationProperties.getProgramNameLineIndex(),proNameLine); |
| | | } |
| | | InputStream insAfter = super.setFilenameAnnotation(annoData.getFilename(),inputStream); |
| | | |
| | | return super.setAnnotation(annoData, insAfter); |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void setControlSystem(String controlSystemDictVal) { |
| | | this.controlSystem = controlSystemDictVal; |