yangys
2025-09-18 a3048fa6fa72fa3cc5da2c43c59bd000e00c9599
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/ProgramAnnotationService.java
@@ -7,6 +7,7 @@
import org.jetbrains.annotations.NotNull;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springblade.mdm.program.service.programannotation.AnnotationUtil;
import org.springblade.mdm.program.vo.ProgramAnnotation;
import org.springblade.mdm.utils.FileContentUtil;
import org.springblade.system.feign.IDictBizClient;
@@ -33,26 +34,24 @@
   @Autowired
   private IDictBizClient bizDictClient;
   private static final String DEFAULT_ANNOTATION_SETTING = "(,)";
   //private static final String DEFAULT_ANNOTATION_SETTING = "(,)";
   public static final String ANNOTATION_DICT = "machine_annotation";
   /**
    * 发送目录行索引(第2行) 0 based
    */
   public static final int SENDPATH_LINE_INDEX = 1;
   ///public static final int SENDPATH_LINE_INDEX = 2;
   /**
    * 状态行索引(第三行) 0 based
    */
   public static final int STATUS_LINE_INDEX = 2;
   //public static final int STATUS_LINE_INDEX = 3;
   /**
    * 偏离单注释行索引号 0 based
    */
   public static final int STATUS_DEVIATION_INDEX = 3;
   //public static final int STATUS_DEVIATION_INDEX = 4;
   public static final String SQ = "SQ";
   public static final String GH = "GH";
   public static final String PL = "PL";
   public List<DictBiz> getAnnotionDictList(){
      List<DictBiz> annotationList;
@@ -74,6 +73,7 @@
    * @param annotationList 注释注释字典项列表
    * @return
    */
   /*
   public boolean isAnnotation(String line,String systemDictVal,List<DictBiz> annotationList){
      ProgramAnnotation progAnnotation = this.getProgramAnnotationFormat(systemDictVal,annotationList);
@@ -86,7 +86,7 @@
   public String generateAnnotation(String oriTest,String systemDictVal,List<DictBiz> annotationList) {
      ProgramAnnotation progAnnotation = this.getProgramAnnotationFormat(systemDictVal,annotationList);
      return progAnnotation.addAnnotation(oriTest);
   }
   }*/
   /**
    * 提取注释中的文本
@@ -94,13 +94,13 @@
    * @param text 清除注释标记
    * @return 清除后的文本
    */
   public String removeAnnotation(String systemDictVal,String text){
      List<DictBiz> annoDicts = getAnnotionDictList();
      return removeAnnotation(systemDictVal,text,annoDicts);
   }
   public String removeAnnotation(String systemDictVal,String text,List<DictBiz> annotatiionList){
      ProgramAnnotation panno = this.getProgramAnnotationFormat(systemDictVal,annotatiionList);
      ProgramAnnotation panno = AnnotationUtil.getProgramAnnotationFormat(systemDictVal,annotatiionList);
      return panno.cleanAnnotation(text);
   }
      /**
@@ -111,9 +111,10 @@
       * @return 加好注释的
       * @throws IOException
       */
      /*
   public InputStream setGHAnnotation(InputStream inputStream, String systemDictVal,List<DictBiz> annoDictList) throws IOException {
      return setAnnotationAndGetInputStream(inputStream, systemDictVal, annoDictList, GH, STATUS_LINE_INDEX);
   }
   }*/
   /**
    * 设置偏离单注释
@@ -123,10 +124,12 @@
    * @return 加好注释的输入流
    * @throws IOException 访问流可能抛出异常
    */
   /*
   public InputStream setPldAnnotation(String deviation,InputStream inputStream,String systemDictVal,List<DictBiz> annoDictList) throws IOException {
      return setAnnotationAndGetInputStream(inputStream, systemDictVal, annoDictList, deviation, STATUS_DEVIATION_INDEX);
   }
    */
   /*
   @NotNull
   private InputStream setAnnotationAndGetInputStream(InputStream inputStream, String systemDictVal, List<DictBiz> annoDictList, String text, int lineIndex) throws IOException {
      InputStream finishedStream;
@@ -149,6 +152,7 @@
      return finishedStream;
   }
   */
   /**
    * 为输入流设置发送目录(第二行)和状态(第三行)
@@ -159,6 +163,7 @@
    * @return 加好发送路径和状态文本的输入流
    * @throws IOException
    */
   /*
   public InputStream setSendDirAndStatusAnnotation(String sendPath,String statusText,InputStream inputStream, String systemDictVal) throws IOException {
      List<DictBiz> annoDicts = getAnnotionDictList();
@@ -192,7 +197,7 @@
      }
      return finishedStream;
   }
   }*/
   /**
    * 解析出机床程序注释的格式
@@ -200,6 +205,7 @@
    * @param annoDictList 配置的注释字典数据
    * @return
    */
   /*
   ProgramAnnotation getProgramAnnotationFormat(String systemDictVal,List<DictBiz> annoDictList){
      String begin;
      String end;
@@ -224,7 +230,7 @@
      programAnnotation.setBegin(begin);
      programAnnotation.setEnd(end);
      return programAnnotation;
   }
   }*/
}