From 4c7296d45efe849dc70a3b2e2240c905481a91c9 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期一, 29 九月 2025 17:44:46 +0800
Subject: [PATCH] 工控网涉密网联调
---
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/programannotation/AbstractProcessor.java | 42 +++++++++++++++++-------------------------
1 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/programannotation/AbstractProcessor.java b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/programannotation/AbstractProcessor.java
index cab30c0..f788405 100644
--- a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/programannotation/AbstractProcessor.java
+++ b/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);
--
Gitblit v1.9.3