| | |
| | | package org.jeecg.modules.dnc.listener; |
| | | |
| | | import org.apache.commons.io.monitor.FileAlterationListener; |
| | | import org.apache.commons.io.monitor.FileAlterationObserver; |
| | | import org.jeecg.common.util.FileUtil; |
| | | import org.jeecg.modules.dnc.service.IDocInfoService; |
| | | import org.jeecg.modules.dnc.utils.file.FileUtilS; |
| | | import org.jeecg.modules.message.enums.DeployEnum; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | |
| | | @Component |
| | | public class FileListener implements FileAlterationListener { |
| | | private static final Logger log = LoggerFactory.getLogger(FileListener.class); |
| | | |
| | | @Value("${deploy.deployType}") |
| | | private String deployType; //工控网/涉密网部署 0为工控网 1为涉密网 |
| | | |
| | | @Autowired |
| | | private IDocInfoService docInfoService; // 文档服务 |
| | | |
| | |
| | | public void onFileCreate(File file) { |
| | | String filePath = file.getAbsolutePath(); |
| | | log.info("[新建]: {}", filePath); |
| | | if (DeployEnum.GW.getCode().equals(deployType)) { |
| | | //工控网解析涉密网传过来的NC文件与nc文件进行解析 |
| | | if (filePath.startsWith("D:\\hy_test\\ncFile")) { |
| | | handleIndustrialDocFile(file); |
| | | } |
| | | }else { |
| | | //涉密网解析工控网传过来的NC文件与nc文件进行解析(程序回传) |
| | | if (filePath.startsWith("D:\\hy_test\\ncFile")) { |
| | | handleSecretDocFile(file); |
| | | } |
| | | } |
| | | } |
| | | @Override |
| | | public void onFileChange(File file) { |