| | |
| | | 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; |
| | |
| | | @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; |
| | |
| | | * @param annotationList 注释注释字典项列表 |
| | | * @return |
| | | */ |
| | | /* |
| | | public boolean isAnnotation(String line,String systemDictVal,List<DictBiz> annotationList){ |
| | | ProgramAnnotation progAnnotation = this.getProgramAnnotationFormat(systemDictVal,annotationList); |
| | | |
| | |
| | | public String generateAnnotation(String oriTest,String systemDictVal,List<DictBiz> annotationList) { |
| | | ProgramAnnotation progAnnotation = this.getProgramAnnotationFormat(systemDictVal,annotationList); |
| | | return progAnnotation.addAnnotation(oriTest); |
| | | } |
| | | }*/ |
| | | |
| | | /** |
| | | * 提取注释中的文本 |
| | |
| | | * @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); |
| | | } |
| | | /** |
| | |
| | | * @return 加好注释的 |
| | | * @throws IOException |
| | | */ |
| | | /* |
| | | public InputStream setGHAnnotation(InputStream inputStream, String systemDictVal,List<DictBiz> annoDictList) throws IOException { |
| | | return setAnnotationAndGetInputStream(inputStream, systemDictVal, annoDictList, GH, STATUS_LINE_INDEX); |
| | | } |
| | | }*/ |
| | | |
| | | /** |
| | | * 设置偏离单注释 |
| | |
| | | * @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; |
| | |
| | | return finishedStream; |
| | | } |
| | | |
| | | */ |
| | | |
| | | /** |
| | | * 为输入流设置发送目录(第二行)和状态(第三行) |
| | |
| | | * @return 加好发送路径和状态文本的输入流 |
| | | * @throws IOException |
| | | */ |
| | | /* |
| | | public InputStream setSendDirAndStatusAnnotation(String sendPath,String statusText,InputStream inputStream, String systemDictVal) throws IOException { |
| | | List<DictBiz> annoDicts = getAnnotionDictList(); |
| | | |
| | |
| | | } |
| | | |
| | | return finishedStream; |
| | | } |
| | | }*/ |
| | | |
| | | /** |
| | | * 解析出机床程序注释的格式 |
| | |
| | | * @param annoDictList 配置的注释字典数据 |
| | | * @return |
| | | */ |
| | | /* |
| | | ProgramAnnotation getProgramAnnotationFormat(String systemDictVal,List<DictBiz> annoDictList){ |
| | | String begin; |
| | | String end; |
| | |
| | | programAnnotation.setBegin(begin); |
| | | programAnnotation.setEnd(end); |
| | | return programAnnotation; |
| | | } |
| | | }*/ |
| | | } |
| | | |
| | | |