add:
1. 将回执解析的目录积压监控转移到此项目 Signed-off-by: mrz <17966059@qq.com>
正在显示
1 个修改的文件
包含
44 行增加
和
0 行删除
1 | package com.tianbo.analysis.controller; | 1 | package com.tianbo.analysis.controller; |
2 | 2 | ||
3 | +import com.tianbo.util.IO.FileTool; | ||
4 | +import lombok.extern.slf4j.Slf4j; | ||
3 | import org.springframework.stereotype.Controller; | 5 | import org.springframework.stereotype.Controller; |
4 | import org.springframework.web.bind.annotation.RequestMapping; | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
7 | +import org.springframework.web.bind.annotation.RequestParam; | ||
5 | 8 | ||
9 | +import java.io.File; | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +@Slf4j | ||
6 | @Controller | 13 | @Controller |
7 | public class IndexController { | 14 | public class IndexController { |
8 | 15 | ||
@@ -15,4 +22,41 @@ public class IndexController { | @@ -15,4 +22,41 @@ public class IndexController { | ||
15 | public String reception(){ | 22 | public String reception(){ |
16 | return "flight/res"; | 23 | return "flight/res"; |
17 | } | 24 | } |
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 | + } | ||
18 | } | 62 | } |
-
请 注册 或 登录 后发表评论