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/impl/ReceiveFileServiceImpl.java | 306 +++++++++++++++++++++++++------------------------- 1 files changed, 153 insertions(+), 153 deletions(-) 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