yangys
2025-09-29 4c7296d45efe849dc70a3b2e2240c905481a91c9
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/programannotation/AbstractProcessor.java
@@ -19,28 +19,34 @@
   private ProgramAnnotationService programAnnotationService;
   protected AnnotationProperties annotationProperties;
   protected List<DictBiz> getAnnotationDictList(){
      return programAnnotationService.getAnnotionDictList();
   }
   @Override
   public InputStream putSendPathAnnotation(String sendPath, InputStream inputStream,List<DictBiz> annoDicts) throws IOException{
      String sendPathRepl = StringUtils.replace(sendPath,"\\","/");
      InputStream finishedStream;
      try(inputStream){
         ByteArrayInputStream byteInputStream =  new ByteArrayInputStream(IOUtils.toByteArray(inputStream));
         //1加入发送路径的注释
         String sendPathAnnotation = AnnotationUtil.generateAnnotation(sendPath,getControlSystem(),annoDicts);//加了注释之后的文本
         String sendPathAnnotation = AnnotationUtil.generateAnnotation(sendPathRepl,getControlSystem(),annoDicts);//加了注释之后的文本
         String sendDirLine = FileContentUtil.readLineAt(byteInputStream,annotationProperties.getSendPathLineIndex());//第2行是发送路径
         String sendPathLine = FileContentUtil.readLineAt(byteInputStream,annotationProperties.getSendPathLineIndex());//第2行是发送路径
         byteInputStream.reset();
         if(AnnotationUtil.isAnnotation(sendDirLine,getControlSystem(),annoDicts)){
            String planText = AnnotationUtil.removeAnnotation(getControlSystem(),sendDirLine,annoDicts);
            if(!planText.equals(sendPath)) {
         if(AnnotationUtil.isAnnotation(sendPathLine,getControlSystem(),annoDicts)){
            String planText = AnnotationUtil.removeAnnotation(getControlSystem(),sendPathLine,annoDicts);
            //String planTextRepl = StringUtils.replace(planText,"\\","/");
            if(!planText.equals(sendPath) && !planText.equals(sendPathRepl)) {
               //非路径的注释,插入
               finishedStream = FileContentUtil.insertLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation);
            }else{
               //是路径,不处理直接返回原输入流
               finishedStream = inputStream;
            }
            //finishedStream = FileContentUtil.replaceAtLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation);
         }else{
            finishedStream = FileContentUtil.insertLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation);
         }
@@ -76,12 +82,7 @@
         //非注释,插入状态
         insAfterProgramName = FileContentUtil.insertLine(byteStream,annotationProperties.getProgramNameLineIndex(),proNameAnnotation);
      }
      /*
      if(isAnnotation){
         insAfter = FileContentUtil.replaceAtLine(bais, annotationProperties.getProgramNameLineIndex(),proNameLine);
      }else{
         insAfter = FileContentUtil.insertLine(bais, annotationProperties.getProgramNameLineIndex(),proNameLine);
      }*/
      return insAfterProgramName;
   }
@@ -95,18 +96,7 @@
         //1加入发送路径的注释
         InputStream insAfterSetSendDir = putSendPathAnnotation(annoData.getSendPath(),byteInputStream,annoDicts);
         /*
         String statusLine = FileContentUtil.readLineAt(insAfterSetSendDir,annotationProperties.getStatusLineIndex());//状态注释
         insAfterSetSendDir.reset();
         //加入状态注释行
         InputStream insAfterStatus;
         String statusAnnotation = AnnotationUtil.generateAnnotation(annoData.getProgramStatus(),getControlSystem(),annoDicts);//注释后的状态文本
         if(AnnotationUtil.isAnnotation(statusLine,getControlSystem(),annoDicts)){
            insAfterStatus = FileContentUtil.replaceAtLine(insAfterSetSendDir,annotationProperties.getStatusLineIndex(),statusAnnotation);
         }else{
            insAfterStatus = FileContentUtil.insertLine(insAfterSetSendDir,annotationProperties.getStatusLineIndex(),statusAnnotation);
         }*/
         InputStream insAfterStatus = putStatusAnnotation(annoData.getProgramStatus(),insAfterSetSendDir,annoDicts);
         if(StringUtils.isNotBlank(annoData.getDeviation())){
@@ -208,9 +198,11 @@
         String statusText = AnnotationUtil.removeAnnotation(this.getControlSystem(),statusLine,annoDictList);
         if(AnnotationUtil.isStatusContent(statusText)){
            data.setProgramStatus(statusText);
         }
         data.setDeviation(AnnotationUtil.removeAnnotation(this.getControlSystem(),devLine,annoDictList));
            if(AnnotationUtil.LG.equals(statusText)) {
               data.setDeviation(AnnotationUtil.removeAnnotation(this.getControlSystem(), devLine, annoDictList));
            }
         }
      } catch (IOException e) {
         throw new RuntimeException(e);