From 2ab86210fb27787cb1be8976286b9b827f90997f Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期一, 15 九月 2025 17:38:54 +0800
Subject: [PATCH] 去除两网交互多余功能

---
 src/main/java/com/lxzn/base/service/IDncPassLogService.java          |   22 
 src/main/java/com/lxzn/base/service/IReceiveFileService.java         |    8 
 src/main/java/com/lxzn/base/service/impl/DncPassLogServiceImpl.java  |  408 +++++++++++++++---------------
 src/main/java/com/lxzn/base/service/impl/ReceiveFileServiceImpl.java |  306 +++++++++++-----------
 src/main/java/com/lxzn/base/controller/ServiceOuterController.java   |    8 
 5 files changed, 376 insertions(+), 376 deletions(-)

diff --git a/src/main/java/com/lxzn/base/controller/ServiceOuterController.java b/src/main/java/com/lxzn/base/controller/ServiceOuterController.java
index dce8e26..69d1681 100644
--- a/src/main/java/com/lxzn/base/controller/ServiceOuterController.java
+++ b/src/main/java/com/lxzn/base/controller/ServiceOuterController.java
@@ -43,10 +43,10 @@
     @Autowired
     private IDncPassLogService dncPassLogService;
 
-    @RequestMapping("/nc")
-    public void fileClientTxtOrNc() {
-        dncPassLogService.fileClientTxtOrNc();
-    }
+//    @RequestMapping("/nc")
+//    public void fileClientTxtOrNc() {
+//        dncPassLogService.fileClientTxtOrNc();
+//    }
 
     @Value("${serviceIntranet.appIdCheck}")
     private String appIdCheck;
diff --git a/src/main/java/com/lxzn/base/service/IDncPassLogService.java b/src/main/java/com/lxzn/base/service/IDncPassLogService.java
index be4e553..63803fe 100644
--- a/src/main/java/com/lxzn/base/service/IDncPassLogService.java
+++ b/src/main/java/com/lxzn/base/service/IDncPassLogService.java
@@ -17,15 +17,15 @@
      * @return
      */
     DncPassLog findDayTime(String dateDay);
-
-    /**
-     * 鍙戦�佹枃浠�
-     */
-    void fileClientTxtOrNc();
-
-    /**
-     * 鍒犻櫎鍥哄畾璺緞涓嬭秴鏃舵枃浠�
-     * @return
-     */
-    void deleteNcSendFile();
+//
+//    /**
+//     * 鍙戦�佹枃浠�
+//     */
+//    void fileClientTxtOrNc();
+//
+//    /**
+//     * 鍒犻櫎鍥哄畾璺緞涓嬭秴鏃舵枃浠�
+//     * @return
+//     */
+//    void deleteNcSendFile();
 }
diff --git a/src/main/java/com/lxzn/base/service/IReceiveFileService.java b/src/main/java/com/lxzn/base/service/IReceiveFileService.java
index d26acc4..fbea062 100644
--- a/src/main/java/com/lxzn/base/service/IReceiveFileService.java
+++ b/src/main/java/com/lxzn/base/service/IReceiveFileService.java
@@ -6,8 +6,8 @@
  */
 public interface IReceiveFileService {
 
-    /**
-     * 瑙f瀽鏁版嵁
-     */
-    void analysisAndCopyFileRec();
+//    /**
+//     * 瑙f瀽鏁版嵁
+//     */
+//    void analysisAndCopyFileRec();
 }
diff --git a/src/main/java/com/lxzn/base/service/impl/DncPassLogServiceImpl.java b/src/main/java/com/lxzn/base/service/impl/DncPassLogServiceImpl.java
index 25281b1..d8b27cc 100644
--- a/src/main/java/com/lxzn/base/service/impl/DncPassLogServiceImpl.java
+++ b/src/main/java/com/lxzn/base/service/impl/DncPassLogServiceImpl.java
@@ -79,209 +79,209 @@
         return super.baseMapper.findDateTimeDay(dateDay);
     }
 
-    @Override
-    @Scheduled(cron = "${fileCron}")
-    public void fileClientTxtOrNc() {
-        SysLogMessageDto message = new SysLogMessageDto();
-        String host = "127.0.0.1";
-        if (StringUtils.isNotBlank(serverIp)) {
-            host = serverIp;
-        }
-        String port = "8299";
-        if (StringUtils.isNotBlank(serverPort)) {
-            port = serverPort;
-        }
-        String username = "admin";
-        if (StringUtils.isNotBlank(usernameService)) {
-            username = usernameService;
-        }
-        String pwd = "123";
-        if (StringUtils.isNotBlank(pwdService)) {
-            pwd = pwdService;
-        }
-        //鏂囦欢鏈湴鍦板潃锛屾牴鎹湴鍧�鎵惧埌鏂囦欢锛屽皢鏂囦欢瑙f瀽鎴愭枃浠舵祦
-        String localFilePath = "E:\\test\\a\\";
-        if (StringUtils.isNotBlank(localFilePathC)) {
-            localFilePath = localFilePathC;
-        }
-        //鏂囦欢涓婁紶鐩殑鍦板潃锛屽皢鏂囦欢涓婁紶鍒拌鍦板潃
-        String servicePath = "E:\\test\\b\\";
-        if (StringUtils.isNotBlank(servicePathS)) {
-            servicePath = servicePathS;
-        }
-        boolean btelnetPort =  TelnetUtil.telnetPort(serverIp,Integer.valueOf(serverPort),10);
-        if (!btelnetPort) {
-            System.out.println("鏈嶅姟鍣ㄨ繛鎺ワ細 " + serverIp + ":" + serverPort + " 寮傚父锛�" );
-            return;
-        }
-        //绗竴姝ワ紝鑾峰彇token
-        String token = null;
-        try {
-            token = FileClient.getToken(host,port,username,pwd,addressToken);
-        } catch (Throwable throwable) {
-            throwable.printStackTrace();
-        }
-
-        //鑻ヨ幏鍙杢oken鎴愬姛锛屽啀杩涜涓婁紶鏂囦欢鎺ュ彛璋冪敤
-        if (token !=null && !token.equals("")){
-            try {
-                File f3 = new File(localFilePath);
-                File[] files = f3.listFiles();
-                for (File fi : files){
-                    if (fi.isFile()){
-                        SysLogTypeObjectDto objectName = new SysLogTypeObjectDto();
-                        objectName.setDateTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_TIME_SMALL));
-                        objectName.setFileName(fi.getName());
-                        objectName.setFileSize(FileUtil.changeFileFormatKb(String.valueOf(new File(localFilePath).length())));
-                        objectName.setSourceAddress(localFilePath);
-                        objectName.setDestination(serverIp);//鏈嶅姟绔疘P
-                        //椤哄簭鍙�
-                        DncPassLog passLog = getById("num0001");
-                        if (passLog == null) {
-                            passLog = new DncPassLog();
-                            passLog.setId("num0001");
-                            passLog.setSequenceNumber(1);
-                            objectName.setFileNum(Integer.toString(1));
-                            save(passLog);
-                        } else {
-                            Integer number = passLog.getSequenceNumber()+1;
-                            removeById("num0001");
-                            objectName.setFileNum(Integer.toString(number));
-
-                            passLog = new DncPassLog();
-                            passLog.setId("num0001");
-                            passLog.setSequenceNumber(number);
-                            save(passLog);
-                        }
-
-                        InetAddress address = null;
-                        try {
-                            address = InetAddress.getLocalHost();
-                            String ip = address.getHostAddress();
-                            objectName.setSourceAddress("20.10.17.11");//瀹㈡埛绔疘P
-                            objectName.setAddress(ip);
-                        } catch (UnknownHostException e) {
-                            objectName.setSourceAddress("127.0.0.1");
-                            objectName.setAddress("127.0.0.1");
-                        }
-                        objectName.setDestination(host);
-                        objectName.setResult("澶辫触");
-                        //鑾峰彇鏌愪釜鏂囦欢涓嬬殑鎵�鏈夋枃浠�
-                        String loFilePath = localFilePath + fi.getName();
-                        String servicePathName =servicePath+"//" + fi.getName();
-                        File file = new File(loFilePath);
-                        if (file == null || !file.exists()){
-                            objectName.setAbstract1("sm3");
-                        } else {
-                            String sm3 = SmUtil.sm3(file);
-                            objectName.setAbstract1(sm3);
-                        }
-
-                        String b  = FileClient.uploadFile(host,port,token,fi.getName(),servicePathName,loFilePath,addressUploadFile);
-                        //鏂囦欢澶囦唤鍒犻櫎
-                        if (b == null) {
-                            try {
-                                objectName.setResult("澶辫触");
-                                objectName.setTypes("error");
-                                SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString());
-                            }catch (Exception e) {
-                                return;
-                            }
-                        }
-                        else if ( b.equals("鎴愬姛")) {
-                            //澶囦唤鏁版嵁
-                            boolean fCopy = FileUtil.copyNcFile(loFilePath,newFilePathC + "/" + DateUtil.format(DateUtil.getNow(),
-                                    DateUtil.STR_YEARMONTHDAY) + "/" +fi.getName());
-                            if (fCopy) {
-                                FileUtil.deleteNcFile(loFilePath);
-                            } else {
-                                FileUtil.copyNcFile(loFilePath,newFilePathC + "/" + DateUtil.format(DateUtil.getNow(),
-                                        DateUtil.STR_YEARMONTHDAY) + "/" +fi.getName());
-                                FileUtil.deleteNcFile(loFilePath);
-                            }
-                            try {
-                                objectName.setTypes("Info");
-                                objectName.setResult("鎴愬姛");
-                                SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString());
-                            }catch (Exception e) {
-                                return;
-                            }
-                        } else {
-                            try {
-                                objectName.setResult("澶辫触");
-                                objectName.setTypes("error");
-                                SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString());
-                            }catch (Exception e) {
-                                return;
-                            }
-                        }
-                    }
-                }
-
-            } catch (Throwable throwable) {
-                throwable.printStackTrace();
-            }
-        }
-    }
-
-    /**
-     * 瀹氭椂浠诲姟鎵ц鍣ㄥ弬鏁�  姣忓ぉ鍑屾櫒1.30鎵ц
-     */
-    @Override
-    @Scheduled(cron = "0 30 1 * * ?")
-    public void deleteNcSendFile() {
-        Integer day;
-        //鍙栧瓧鍏告椂闂�
-        List<SingleDictionary> singleDictionaries=iSingleDictionaryService.findListFromTypeCode("DEL_TIME_SEND");
-        if (singleDictionaries.size()!=1){
-            return;
-        }else {
-            day= singleDictionaries.get(0).getDicValue();
-        }
-        Path ncDirectory = Paths.get("D:\\NC");
-        //澶╄浆绉�
-        long dayToSecond = day * 24 * 60 * 60;
-        if (Files.exists(ncDirectory) && Files.isDirectory(ncDirectory)) {
-            // 閫掑綊鏌ユ壘NC鐩綍涓嬫墍鏈夊悕涓簊end鐨勬枃浠跺す
-            try (Stream<Path> sendFolders = Files.walk(ncDirectory)
-                    .filter(Files::isDirectory)
-                    .filter(path -> path.getFileName().toString().equalsIgnoreCase("send"))) {
-                sendFolders.forEach(sendFolder -> {
-                    try {
-                        // 鑾峰彇褰撳墠鏃堕棿
-                        Instant now = Instant.now();
-                        // 閬嶅巻SEND鏂囦欢澶瑰唴鐨勬墍鏈夋枃浠�
-                        Files.walk(sendFolder)
-                                .filter(Files::isRegularFile)
-                                .forEach(file -> {
-                                    try {
-                                        // 鑾峰彇鏂囦欢鐨勬渶鍚庝慨鏀规椂闂�
-                                        Instant lastModified = Files.getLastModifiedTime(file).toInstant();
-                                        // 璁$畻鏃堕棿宸�
-                                        Duration duration = Duration.between(lastModified, now);
-                                        // 鍒ゆ柇鏄惁瓒呮椂锛堟椂闂村瓨鍦ㄥ瓧鍏镐腑锛宐ase_single_dictionary锛�
-                                        if (duration.getSeconds() > dayToSecond) {
-                                            try {
-                                                Files.delete(file);
-                                                System.out.println("宸插垹闄ゆ枃浠�: " + file);
-                                            } catch (IOException e) {
-                                                System.err.println("鍒犻櫎鏂囦欢 " + file + " 鏃跺嚭鐜伴敊璇�: " + e.getMessage());
-                                            }
-                                        }
-                                    } catch (IOException e) {
-                                        System.err.println("鑾峰彇鏂囦欢 " + file + " 鐨勬渶鍚庝慨鏀规椂闂存椂鍑虹幇閿欒: " + e.getMessage());
-                                    }
-                                });
-                    } catch (IOException e) {
-                        System.err.println("閬嶅巻 " + sendFolder + " 鏂囦欢澶规椂鍑虹幇閿欒: " + e.getMessage());
-                    }
-                });
-            } catch (IOException e) {
-                System.err.println("鏌ユ壘send鏂囦欢澶规椂鍑虹幇閿欒: " + e.getMessage());
-            }
-        } else {
-            System.err.println("D鐩樼殑NC鐩綍涓嶅瓨鍦ㄦ垨涓嶆槸鏈夋晥鐨勭洰褰�");
-        }
-    }
+//    @Override
+//    @Scheduled(cron = "${fileCron}")
+//    public void fileClientTxtOrNc() {
+//        SysLogMessageDto message = new SysLogMessageDto();
+//        String host = "127.0.0.1";
+//        if (StringUtils.isNotBlank(serverIp)) {
+//            host = serverIp;
+//        }
+//        String port = "8299";
+//        if (StringUtils.isNotBlank(serverPort)) {
+//            port = serverPort;
+//        }
+//        String username = "admin";
+//        if (StringUtils.isNotBlank(usernameService)) {
+//            username = usernameService;
+//        }
+//        String pwd = "123";
+//        if (StringUtils.isNotBlank(pwdService)) {
+//            pwd = pwdService;
+//        }
+//        //鏂囦欢鏈湴鍦板潃锛屾牴鎹湴鍧�鎵惧埌鏂囦欢锛屽皢鏂囦欢瑙f瀽鎴愭枃浠舵祦
+//        String localFilePath = "E:\\test\\a\\";
+//        if (StringUtils.isNotBlank(localFilePathC)) {
+//            localFilePath = localFilePathC;
+//        }
+//        //鏂囦欢涓婁紶鐩殑鍦板潃锛屽皢鏂囦欢涓婁紶鍒拌鍦板潃
+//        String servicePath = "E:\\test\\b\\";
+//        if (StringUtils.isNotBlank(servicePathS)) {
+//            servicePath = servicePathS;
+//        }
+//        boolean btelnetPort =  TelnetUtil.telnetPort(serverIp,Integer.valueOf(serverPort),10);
+//        if (!btelnetPort) {
+//            System.out.println("鏈嶅姟鍣ㄨ繛鎺ワ細 " + serverIp + ":" + serverPort + " 寮傚父锛�" );
+//            return;
+//        }
+//        //绗竴姝ワ紝鑾峰彇token
+//        String token = null;
+//        try {
+//            token = FileClient.getToken(host,port,username,pwd,addressToken);
+//        } catch (Throwable throwable) {
+//            throwable.printStackTrace();
+//        }
+//
+//        //鑻ヨ幏鍙杢oken鎴愬姛锛屽啀杩涜涓婁紶鏂囦欢鎺ュ彛璋冪敤
+//        if (token !=null && !token.equals("")){
+//            try {
+//                File f3 = new File(localFilePath);
+//                File[] files = f3.listFiles();
+//                for (File fi : files){
+//                    if (fi.isFile()){
+//                        SysLogTypeObjectDto objectName = new SysLogTypeObjectDto();
+//                        objectName.setDateTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_TIME_SMALL));
+//                        objectName.setFileName(fi.getName());
+//                        objectName.setFileSize(FileUtil.changeFileFormatKb(String.valueOf(new File(localFilePath).length())));
+//                        objectName.setSourceAddress(localFilePath);
+//                        objectName.setDestination(serverIp);//鏈嶅姟绔疘P
+//                        //椤哄簭鍙�
+//                        DncPassLog passLog = getById("num0001");
+//                        if (passLog == null) {
+//                            passLog = new DncPassLog();
+//                            passLog.setId("num0001");
+//                            passLog.setSequenceNumber(1);
+//                            objectName.setFileNum(Integer.toString(1));
+//                            save(passLog);
+//                        } else {
+//                            Integer number = passLog.getSequenceNumber()+1;
+//                            removeById("num0001");
+//                            objectName.setFileNum(Integer.toString(number));
+//
+//                            passLog = new DncPassLog();
+//                            passLog.setId("num0001");
+//                            passLog.setSequenceNumber(number);
+//                            save(passLog);
+//                        }
+//
+//                        InetAddress address = null;
+//                        try {
+//                            address = InetAddress.getLocalHost();
+//                            String ip = address.getHostAddress();
+//                            objectName.setSourceAddress("20.10.17.11");//瀹㈡埛绔疘P
+//                            objectName.setAddress(ip);
+//                        } catch (UnknownHostException e) {
+//                            objectName.setSourceAddress("127.0.0.1");
+//                            objectName.setAddress("127.0.0.1");
+//                        }
+//                        objectName.setDestination(host);
+//                        objectName.setResult("澶辫触");
+//                        //鑾峰彇鏌愪釜鏂囦欢涓嬬殑鎵�鏈夋枃浠�
+//                        String loFilePath = localFilePath + fi.getName();
+//                        String servicePathName =servicePath+"//" + fi.getName();
+//                        File file = new File(loFilePath);
+//                        if (file == null || !file.exists()){
+//                            objectName.setAbstract1("sm3");
+//                        } else {
+//                            String sm3 = SmUtil.sm3(file);
+//                            objectName.setAbstract1(sm3);
+//                        }
+//
+//                        String b  = FileClient.uploadFile(host,port,token,fi.getName(),servicePathName,loFilePath,addressUploadFile);
+//                        //鏂囦欢澶囦唤鍒犻櫎
+//                        if (b == null) {
+//                            try {
+//                                objectName.setResult("澶辫触");
+//                                objectName.setTypes("error");
+//                                SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString());
+//                            }catch (Exception e) {
+//                                return;
+//                            }
+//                        }
+//                        else if ( b.equals("鎴愬姛")) {
+//                            //澶囦唤鏁版嵁
+//                            boolean fCopy = FileUtil.copyNcFile(loFilePath,newFilePathC + "/" + DateUtil.format(DateUtil.getNow(),
+//                                    DateUtil.STR_YEARMONTHDAY) + "/" +fi.getName());
+//                            if (fCopy) {
+//                                FileUtil.deleteNcFile(loFilePath);
+//                            } else {
+//                                FileUtil.copyNcFile(loFilePath,newFilePathC + "/" + DateUtil.format(DateUtil.getNow(),
+//                                        DateUtil.STR_YEARMONTHDAY) + "/" +fi.getName());
+//                                FileUtil.deleteNcFile(loFilePath);
+//                            }
+//                            try {
+//                                objectName.setTypes("Info");
+//                                objectName.setResult("鎴愬姛");
+//                                SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString());
+//                            }catch (Exception e) {
+//                                return;
+//                            }
+//                        } else {
+//                            try {
+//                                objectName.setResult("澶辫触");
+//                                objectName.setTypes("error");
+//                                SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString());
+//                            }catch (Exception e) {
+//                                return;
+//                            }
+//                        }
+//                    }
+//                }
+//
+//            } catch (Throwable throwable) {
+//                throwable.printStackTrace();
+//            }
+//        }
+//    }
+//
+//    /**
+//     * 瀹氭椂浠诲姟鎵ц鍣ㄥ弬鏁�  姣忓ぉ鍑屾櫒1.30鎵ц
+//     */
+//    @Override
+//    @Scheduled(cron = "0 30 1 * * ?")
+//    public void deleteNcSendFile() {
+//        Integer day;
+//        //鍙栧瓧鍏告椂闂�
+//        List<SingleDictionary> singleDictionaries=iSingleDictionaryService.findListFromTypeCode("DEL_TIME_SEND");
+//        if (singleDictionaries.size()!=1){
+//            return;
+//        }else {
+//            day= singleDictionaries.get(0).getDicValue();
+//        }
+//        Path ncDirectory = Paths.get("D:\\NC");
+//        //澶╄浆绉�
+//        long dayToSecond = day * 24 * 60 * 60;
+//        if (Files.exists(ncDirectory) && Files.isDirectory(ncDirectory)) {
+//            // 閫掑綊鏌ユ壘NC鐩綍涓嬫墍鏈夊悕涓簊end鐨勬枃浠跺す
+//            try (Stream<Path> sendFolders = Files.walk(ncDirectory)
+//                    .filter(Files::isDirectory)
+//                    .filter(path -> path.getFileName().toString().equalsIgnoreCase("send"))) {
+//                sendFolders.forEach(sendFolder -> {
+//                    try {
+//                        // 鑾峰彇褰撳墠鏃堕棿
+//                        Instant now = Instant.now();
+//                        // 閬嶅巻SEND鏂囦欢澶瑰唴鐨勬墍鏈夋枃浠�
+//                        Files.walk(sendFolder)
+//                                .filter(Files::isRegularFile)
+//                                .forEach(file -> {
+//                                    try {
+//                                        // 鑾峰彇鏂囦欢鐨勬渶鍚庝慨鏀规椂闂�
+//                                        Instant lastModified = Files.getLastModifiedTime(file).toInstant();
+//                                        // 璁$畻鏃堕棿宸�
+//                                        Duration duration = Duration.between(lastModified, now);
+//                                        // 鍒ゆ柇鏄惁瓒呮椂锛堟椂闂村瓨鍦ㄥ瓧鍏镐腑锛宐ase_single_dictionary锛�
+//                                        if (duration.getSeconds() > dayToSecond) {
+//                                            try {
+//                                                Files.delete(file);
+//                                                System.out.println("宸插垹闄ゆ枃浠�: " + file);
+//                                            } catch (IOException e) {
+//                                                System.err.println("鍒犻櫎鏂囦欢 " + file + " 鏃跺嚭鐜伴敊璇�: " + e.getMessage());
+//                                            }
+//                                        }
+//                                    } catch (IOException e) {
+//                                        System.err.println("鑾峰彇鏂囦欢 " + file + " 鐨勬渶鍚庝慨鏀规椂闂存椂鍑虹幇閿欒: " + e.getMessage());
+//                                    }
+//                                });
+//                    } catch (IOException e) {
+//                        System.err.println("閬嶅巻 " + sendFolder + " 鏂囦欢澶规椂鍑虹幇閿欒: " + e.getMessage());
+//                    }
+//                });
+//            } catch (IOException e) {
+//                System.err.println("鏌ユ壘send鏂囦欢澶规椂鍑虹幇閿欒: " + e.getMessage());
+//            }
+//        } else {
+//            System.err.println("D鐩樼殑NC鐩綍涓嶅瓨鍦ㄦ垨涓嶆槸鏈夋晥鐨勭洰褰�");
+//        }
+//    }
 
 }
diff --git a/src/main/java/com/lxzn/base/service/impl/ReceiveFileServiceImpl.java b/src/main/java/com/lxzn/base/service/impl/ReceiveFileServiceImpl.java
index 43b6d20..507852c 100644
--- a/src/main/java/com/lxzn/base/service/impl/ReceiveFileServiceImpl.java
+++ b/src/main/java/com/lxzn/base/service/impl/ReceiveFileServiceImpl.java
@@ -37,157 +37,157 @@
     @Value("${fileNCPath}")
     private String fileNCPath;
 
-    @Override
-    @Scheduled(cron = "${ncFileRec}")
-    public void analysisAndCopyFileRec() {
-        if (StringUtils.isBlank(filePath)) {
-            return;
-        }
-        File f3 = new File(filePath);
-        File[] files = f3.listFiles();
-        for (File fi : files){
-            InputStreamReader input =null;
-            BufferedReader bufferedReader =null;
-            String loFilePath = filePath + fi.getName();
-            System.out.println(loFilePath);
-            try {
-                if (FileUtil.getFileSuffix(fi.getName()).equals("nc")) {
-                    String line;
-                    int count = 0;
-                    NcTxtFilePathInfo result = new NcTxtFilePathInfo();
-                    FileInputStream fis = null;
-                    try {
-                        fis = new FileInputStream(loFilePath);
-                    } catch (Exception e1) {
-                        e1.printStackTrace();
-                    }
-                    Scanner sc = new Scanner(fis, "UTF-8");
-                    while (count < 8 &&  sc.hasNext()) {
-                        line = sc.nextLine();
-                        if (count ==0) {
-                            result.setFileTxtName(line.trim());
-                        } else  if (count ==1) {
-                            result.setFileNcName(line.trim());
-                        }else  if (count ==2) {
-                            result.setOrigFileName(line.trim());
-                        }else  if (count ==3) {
-                            result.setOrigFileSuffix(line.trim());
-                        }else  if (count ==4) {
-                            result.setFilePath(line.trim());
-                        }else  if (count ==5) {
-                            result.setEquipmentId(line.trim());
-                        }else  if (count ==6) {
-                            result.setFileAddOrDelete(Integer.valueOf(line.trim()));
-                        }else  if (count == 7) {
-                            result.setFileSize(line.trim());
-                        }
-                        count++;
-                    }
-                    if (sc != null) {
-                        sc.close();
-                    }
-                    if (bufferedReader != null) {
-                        bufferedReader.close();
-                    }
-                    if (input != null) {
-                        input.close();
-                    }
-                    if (result == null) {
-                        continue;
-                    }
-                    if (result.getFileAddOrDelete() != null ) {
-                        if ( result.getFileAddOrDelete()==1) {
-                            String path = "";
-                            SingleDictionary singleDictionary=dictionaryService.findListFromTypeCode("virtual_equipment_id").get(0);
-                            String docEquipmentId = null;
-                            if (singleDictionary != null) {
-                                docEquipmentId= String.valueOf(singleDictionary.getDicValue());
-                            }
-                            if (result.getEquipmentId().equals(docEquipmentId)) {
-                                //铏氭嫙璁惧澶勭悊
-                                path = filePath + result.getOrigFileName();
-                                if (StringUtils.isNotBlank(result.getOrigFileName()) &&
-                                        result.getOrigFileName().equals("null")) {
-                                    //鏂囦欢寰呭鐞�
-                                    //澶囦唤鏁版嵁
-                                    FileUtil.deleteFileNewRec(loFilePath);
-                                    continue;
-                                }
-                            }else {
-                                path = filePath + result.getFileNcName()+ ".NC";
-                                if (StringUtils.isNotBlank(result.getFileNcName()) &&
-                                        result.getFileNcName().equals("null")) {
-                                    //鏂囦欢寰呭鐞�
-                                    //澶囦唤鏁版嵁
-                                    FileUtil.deleteFileNewRec(loFilePath);
-                                    continue;
-                                }
-                            }
-                            File ncFile = new File(path);
-                            if (ncFile == null) {
-                                continue;
-                            } else {
-                                //宸茬粡瀛樺湪鏂囦欢闇�瑕佸浠�
-                                String size = String.valueOf(ncFile.length());
-                                if (!size.equals(result.getFileSize())) {
-                                    continue;
-                                }
-
-                                boolean bool = docInfoService.addDocInfoRecService(result.getEquipmentId(),
-                                        ncFile,result.getOrigFileSuffix(),
-                                        FileUtil.getFilenameNonSuffix(result.getOrigFileName())
-                                        ,result.getFilePath());
-                                if (bool) {
-                                    FileUtil.deleteFileNewRec(path);
-                                    FileUtil.deleteFileNewRec(loFilePath);
-                                }
-                            }
-                        } else {
-                            String path;
-                            /*if(StringUtils.isBlank(result.getOrigFileSuffix())) {
-                                path = fileNCPath + "/" + result.getFilePath() + "/send/" +result.getOrigFileName();
-                            } else {
-                                path = fileNCPath + "/" + result.getFilePath() + "/send/" +result.getOrigFileName()+ "." + result.getOrigFileSuffix();
-                            }*/
-
-                            /*File ncFile = new File(path);*/
-                            /*if (ncFile == null) {
-                                return;
-                            } else {
-                                //寰呬紭鍖�
-                                boolean deleteFile = FileUtil.copyFileNcToBak(result.getFilePath(),
-                                        result.getOrigFileName(), result.getOrigFileSuffix());
-                                FileUtil.deleteFile(path);
-                                FileUtil.deleteFile(loFilePath);
-                            }*/
-                        }
-
-                    }
-                }
-            } catch (Exception e1) {
-                try {
-                    if (bufferedReader != null) {
-                        bufferedReader.close();
-                    }
-                    if (input != null) {
-                        input.close();
-                    }
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-                e1.printStackTrace();
-            } finally {
-                try {
-                    if (bufferedReader != null) {
-                        bufferedReader.close();
-                    }
-                    if (input != null) {
-                        input.close();
-                    }
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-    }
+//    @Override
+//    @Scheduled(cron = "${ncFileRec}")
+//    public void analysisAndCopyFileRec() {
+//        if (StringUtils.isBlank(filePath)) {
+//            return;
+//        }
+//        File f3 = new File(filePath);
+//        File[] files = f3.listFiles();
+//        for (File fi : files){
+//            InputStreamReader input =null;
+//            BufferedReader bufferedReader =null;
+//            String loFilePath = filePath + fi.getName();
+//            System.out.println(loFilePath);
+//            try {
+//                if (FileUtil.getFileSuffix(fi.getName()).equals("nc")) {
+//                    String line;
+//                    int count = 0;
+//                    NcTxtFilePathInfo result = new NcTxtFilePathInfo();
+//                    FileInputStream fis = null;
+//                    try {
+//                        fis = new FileInputStream(loFilePath);
+//                    } catch (Exception e1) {
+//                        e1.printStackTrace();
+//                    }
+//                    Scanner sc = new Scanner(fis, "UTF-8");
+//                    while (count < 8 &&  sc.hasNext()) {
+//                        line = sc.nextLine();
+//                        if (count ==0) {
+//                            result.setFileTxtName(line.trim());
+//                        } else  if (count ==1) {
+//                            result.setFileNcName(line.trim());
+//                        }else  if (count ==2) {
+//                            result.setOrigFileName(line.trim());
+//                        }else  if (count ==3) {
+//                            result.setOrigFileSuffix(line.trim());
+//                        }else  if (count ==4) {
+//                            result.setFilePath(line.trim());
+//                        }else  if (count ==5) {
+//                            result.setEquipmentId(line.trim());
+//                        }else  if (count ==6) {
+//                            result.setFileAddOrDelete(Integer.valueOf(line.trim()));
+//                        }else  if (count == 7) {
+//                            result.setFileSize(line.trim());
+//                        }
+//                        count++;
+//                    }
+//                    if (sc != null) {
+//                        sc.close();
+//                    }
+//                    if (bufferedReader != null) {
+//                        bufferedReader.close();
+//                    }
+//                    if (input != null) {
+//                        input.close();
+//                    }
+//                    if (result == null) {
+//                        continue;
+//                    }
+//                    if (result.getFileAddOrDelete() != null ) {
+//                        if ( result.getFileAddOrDelete()==1) {
+//                            String path = "";
+//                            SingleDictionary singleDictionary=dictionaryService.findListFromTypeCode("virtual_equipment_id").get(0);
+//                            String docEquipmentId = null;
+//                            if (singleDictionary != null) {
+//                                docEquipmentId= String.valueOf(singleDictionary.getDicValue());
+//                            }
+//                            if (result.getEquipmentId().equals(docEquipmentId)) {
+//                                //铏氭嫙璁惧澶勭悊
+//                                path = filePath + result.getOrigFileName();
+//                                if (StringUtils.isNotBlank(result.getOrigFileName()) &&
+//                                        result.getOrigFileName().equals("null")) {
+//                                    //鏂囦欢寰呭鐞�
+//                                    //澶囦唤鏁版嵁
+//                                    FileUtil.deleteFileNewRec(loFilePath);
+//                                    continue;
+//                                }
+//                            }else {
+//                                path = filePath + result.getFileNcName()+ ".NC";
+//                                if (StringUtils.isNotBlank(result.getFileNcName()) &&
+//                                        result.getFileNcName().equals("null")) {
+//                                    //鏂囦欢寰呭鐞�
+//                                    //澶囦唤鏁版嵁
+//                                    FileUtil.deleteFileNewRec(loFilePath);
+//                                    continue;
+//                                }
+//                            }
+//                            File ncFile = new File(path);
+//                            if (ncFile == null) {
+//                                continue;
+//                            } else {
+//                                //宸茬粡瀛樺湪鏂囦欢闇�瑕佸浠�
+//                                String size = String.valueOf(ncFile.length());
+//                                if (!size.equals(result.getFileSize())) {
+//                                    continue;
+//                                }
+//
+//                                boolean bool = docInfoService.addDocInfoRecService(result.getEquipmentId(),
+//                                        ncFile,result.getOrigFileSuffix(),
+//                                        FileUtil.getFilenameNonSuffix(result.getOrigFileName())
+//                                        ,result.getFilePath());
+//                                if (bool) {
+//                                    FileUtil.deleteFileNewRec(path);
+//                                    FileUtil.deleteFileNewRec(loFilePath);
+//                                }
+//                            }
+//                        } else {
+//                            String path;
+//                            /*if(StringUtils.isBlank(result.getOrigFileSuffix())) {
+//                                path = fileNCPath + "/" + result.getFilePath() + "/send/" +result.getOrigFileName();
+//                            } else {
+//                                path = fileNCPath + "/" + result.getFilePath() + "/send/" +result.getOrigFileName()+ "." + result.getOrigFileSuffix();
+//                            }*/
+//
+//                            /*File ncFile = new File(path);*/
+//                            /*if (ncFile == null) {
+//                                return;
+//                            } else {
+//                                //寰呬紭鍖�
+//                                boolean deleteFile = FileUtil.copyFileNcToBak(result.getFilePath(),
+//                                        result.getOrigFileName(), result.getOrigFileSuffix());
+//                                FileUtil.deleteFile(path);
+//                                FileUtil.deleteFile(loFilePath);
+//                            }*/
+//                        }
+//
+//                    }
+//                }
+//            } catch (Exception e1) {
+//                try {
+//                    if (bufferedReader != null) {
+//                        bufferedReader.close();
+//                    }
+//                    if (input != null) {
+//                        input.close();
+//                    }
+//                } catch (IOException e) {
+//                    e.printStackTrace();
+//                }
+//                e1.printStackTrace();
+//            } finally {
+//                try {
+//                    if (bufferedReader != null) {
+//                        bufferedReader.close();
+//                    }
+//                    if (input != null) {
+//                        input.close();
+//                    }
+//                } catch (IOException e) {
+//                    e.printStackTrace();
+//                }
+//            }
+//        }
+//    }
 }

--
Gitblit v1.9.3