| | |
| | | @Autowired |
| | | private ProgramAnnotationService programAnnotationService; |
| | | private String controlSystem; |
| | | //AnnotationProperties annotationProperties; |
| | | private Pattern PATTERN = Pattern.compile("^[oO]\\d{4}"); |
| | | private final int O_LINE = 1; |
| | | @Override |
| | | public InputStream setAnnotation(AnnotationData annoData,InputStream inputStream) throws IOException { |
| | | public InputStream putAnnotation(AnnotationData annoData, InputStream inputStream) throws IOException { |
| | | //在O0001 这种文字后面增加文件名(不带扩展名) |
| | | ByteArrayInputStream bais = new ByteArrayInputStream(IOUtils.toByteArray(inputStream)); |
| | | String line = FileContentUtil.readLineAt(bais,O_LINE); |
| | |
| | | InputStream ins1; |
| | | if(oMatched){ |
| | | List<DictBiz> annoDicts = programAnnotationService.getAnnotionDictList(); |
| | | String newline = line + generateAnnotation(FilenameUtils.removeExtension(annoData.getFilename()),getControlSystem(),annoDicts); |
| | | String newline = line + AnnotationUtil.generateAnnotation(FilenameUtils.removeExtension(annoData.getFilename()),getControlSystem(),annoDicts); |
| | | ins1 = FileContentUtil.replaceAtLine(bais,O_LINE,newline); |
| | | }else{ |
| | | ins1 = bais; |
| | | } |
| | | return super.setAnnotation(annoData, ins1); |
| | | return super.putAnnotation(annoData, ins1); |
| | | |
| | | } |
| | | |