作者 朱兆平

add:

1. 将回执解析的目录积压监控转移到此项目

Signed-off-by: mrz <17966059@qq.com>
@@ -23,40 +23,4 @@ public class IndexController { @@ -23,40 +23,4 @@ public class IndexController {
23 return "flight/res"; 23 return "flight/res";
24 } 24 }
25 25
26 - @RequestMapping("/devops/watchdir")  
27 - public Integer singlewindow(@RequestParam(value = "dir",required = true,defaultValue = "D:\\系统部署\\imf_Warehouse_reader\\xmlFromImf") String dir){  
28 - switch (dir){  
29 - case "stcs" :  
30 - dir = "D:\\TCSSingleWindow\\recive";  
31 - break;  
32 - case "tcs" :  
33 - dir = "D:\\Data\\Receive";  
34 - break;  
35 - case "cfps" :  
36 - dir = "D:\\系统部署\\imf_Warehouse_reader\\xmlFromImf";  
37 - break;  
38 - default:  
39 - dir = "D:\\TCSSingleWindow\\recive";  
40 - break;  
41 - }  
42 - try{  
43 - File fileDirectory = new File(dir);  
44 - if (!fileDirectory.exists()){  
45 - log.error("目录{}不存在",dir);  
46 - }else{  
47 - log.info("{}{}{}","开始获取目录",dir,"文件数量");  
48 - List<File> files = FileTool.readAllDirectoryFiles(fileDirectory);  
49 - if(files!=null && !files.isEmpty()){  
50 - log.info("{}{}{}{}","目录",dir,"文件数量为:",files.size());  
51 - return files.size();  
52 - }else {  
53 - return 0;  
54 - }  
55 - }  
56 - }catch (Exception e){  
57 - e.printStackTrace();  
58 - log.error("获取目录文件出错",e);  
59 - }  
60 - return 500;  
61 - }  
62 } 26 }
@@ -6,6 +6,7 @@ import com.tianbo.analysis.model.*; @@ -6,6 +6,7 @@ import com.tianbo.analysis.model.*;
6 import com.tianbo.analysis.service.OriginService; 6 import com.tianbo.analysis.service.OriginService;
7 import com.tianbo.util.Date.DateUtil; 7 import com.tianbo.util.Date.DateUtil;
8 8
  9 +import com.tianbo.util.IO.FileTool;
9 import io.swagger.annotations.ApiOperation; 10 import io.swagger.annotations.ApiOperation;
10 import lombok.extern.slf4j.Slf4j; 11 import lombok.extern.slf4j.Slf4j;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*; @@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
14 15
15 import javax.annotation.Resource; 16 import javax.annotation.Resource;
16 import javax.servlet.http.HttpServletRequest; 17 import javax.servlet.http.HttpServletRequest;
  18 +import java.io.File;
17 import java.util.*; 19 import java.util.*;
18 20
19 @Slf4j 21 @Slf4j
@@ -130,4 +132,40 @@ public class NmmsController { @@ -130,4 +132,40 @@ public class NmmsController {
130 return false; 132 return false;
131 } 133 }
132 134
  135 + @RequestMapping("/devops/watchdir")
  136 + public Integer singlewindow(@RequestParam(value = "dir",required = true,defaultValue = "D:\\系统部署\\imf_Warehouse_reader\\xmlFromImf") String dir){
  137 + switch (dir){
  138 + case "stcs" :
  139 + dir = "/Users/mrz/Documents/java项目";
  140 + break;
  141 + case "tcs" :
  142 + dir = "D:\\Data\\Receive";
  143 + break;
  144 + case "cfps" :
  145 + dir = "D:\\系统部署\\imf_Warehouse_reader\\xmlFromImf";
  146 + break;
  147 + default:
  148 + dir = "D:\\TCSSingleWindow\\recive";
  149 + break;
  150 + }
  151 + try{
  152 + File fileDirectory = new File(dir);
  153 + if (!fileDirectory.exists()){
  154 + log.error("目录{}不存在",dir);
  155 + }else{
  156 + log.info("{}{}{}","开始获取目录",dir,"文件数量");
  157 + List<File> files = FileTool.readAllDirectoryFiles(fileDirectory);
  158 + if(files!=null && !files.isEmpty()){
  159 + log.info("{}{}{}{}","目录",dir,"文件数量为:",files.size());
  160 + return files.size();
  161 + }else {
  162 + return 0;
  163 + }
  164 + }
  165 + }catch (Exception e){
  166 + e.printStackTrace();
  167 + log.error("获取目录文件出错",e);
  168 + }
  169 + return 500;
  170 + }
133 } 171 }