| | |
| | | import org.springblade.mdm.utils.FileContentUtil; |
| | | import org.springblade.system.pojo.entity.DictBiz; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | |
| | | ByteArrayInputStream byteInputStream = new ByteArrayInputStream(IOUtils.toByteArray(inputStream)); |
| | | |
| | | //1加入发送路径的注释 |
| | | String sendPathAnnotation = generateAnnotation(annoData.getSendPath(),getControlSystem(),annoDicts);//加了注释之后的文本 |
| | | String sendPathAnnotation = AnnotationUtil.generateAnnotation(annoData.getSendPath(),getControlSystem(),annoDicts);//加了注释之后的文本 |
| | | |
| | | String sendDirLine = FileContentUtil.readLineAt(byteInputStream,annotationProperties.getSendPathLineIndex());//第2行是发送路径 |
| | | byteInputStream.reset(); |
| | |
| | | byteInputStream.reset(); |
| | | |
| | | InputStream insAfterSetSendDir ; |
| | | if(isAnnotation(sendDirLine,getControlSystem(),annoDicts)){ |
| | | if(AnnotationUtil.isAnnotation(sendDirLine,getControlSystem(),annoDicts)){ |
| | | insAfterSetSendDir = FileContentUtil.replaceAtLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation); |
| | | }else{ |
| | | insAfterSetSendDir = FileContentUtil.insertLine(byteInputStream,annotationProperties.getSendPathLineIndex(),sendPathAnnotation); |
| | |
| | | |
| | | insAfterSetSendDir.reset(); |
| | | //加入状态注释行 |
| | | String statusAnnotation = generateAnnotation(annoData.getProgramStatus(),getControlSystem(),annoDicts);//注释后的状态文本 |
| | | if(isAnnotation(statusLine,getControlSystem(),annoDicts)){ |
| | | String statusAnnotation = AnnotationUtil.generateAnnotation(annoData.getProgramStatus(),getControlSystem(),annoDicts);//注释后的状态文本 |
| | | if(AnnotationUtil.isAnnotation(statusLine,getControlSystem(),annoDicts)){ |
| | | finishedStream = FileContentUtil.replaceAtLine(insAfterSetSendDir,annotationProperties.getStatusLineIndex(),statusAnnotation); |
| | | }else{ |
| | | finishedStream = FileContentUtil.insertLine(insAfterSetSendDir,annotationProperties.getStatusLineIndex(),statusAnnotation); |