|
|
1
|
+package com.tianbo.analysis.controller;
|
|
|
2
|
+
|
|
|
3
|
+import com.tianbo.analysis.handle.CustomXmlHandle;
|
|
|
4
|
+import com.tianbo.util.Date.DateUtil;
|
|
|
5
|
+import com.tianbo.util.IO.FileTool;
|
|
|
6
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
7
|
+import org.apache.commons.io.FileUtils;
|
|
|
8
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
9
|
+import org.springframework.stereotype.Controller;
|
|
|
10
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
11
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
12
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
13
|
+
|
|
|
14
|
+import java.io.File;
|
|
|
15
|
+import java.util.Iterator;
|
|
|
16
|
+import java.util.List;
|
|
|
17
|
+
|
|
|
18
|
+@RestController
|
|
|
19
|
+@Slf4j
|
|
|
20
|
+@RequestMapping("/devops")
|
|
|
21
|
+public class DevOpsController {
|
|
|
22
|
+
|
|
|
23
|
+ //单一窗口回执读取目录
|
|
|
24
|
+ @Value("${devops.dir.singlewindow-tcs-recept}")
|
|
|
25
|
+ private String singlewindow_tcs_recept_dir;
|
|
|
26
|
+
|
|
|
27
|
+ //天博TCS回执读取目录
|
|
|
28
|
+ @Value("${devops.dir.tianbo-tcs-recept}")
|
|
|
29
|
+ private String tianbo_tcs_recept_dir;
|
|
|
30
|
+
|
|
|
31
|
+ //CFPS订阅货运报文目录
|
|
|
32
|
+ @Value("${devops.dir.cfps-subscribe-dir}")
|
|
|
33
|
+ private String cfps_recept_dir;
|
|
|
34
|
+
|
|
|
35
|
+ @RequestMapping("/watchdir")
|
|
|
36
|
+ public Integer singlewindow(@RequestParam(value = "dir",required = true,defaultValue = "D:\\系统部署\\imf_Warehouse_reader\\xmlFromImf") String dir){
|
|
|
37
|
+ switch (dir){
|
|
|
38
|
+ case "stcs" :
|
|
|
39
|
+ dir = singlewindow_tcs_recept_dir;
|
|
|
40
|
+ break;
|
|
|
41
|
+ case "tcs" :
|
|
|
42
|
+ dir = tianbo_tcs_recept_dir;
|
|
|
43
|
+ break;
|
|
|
44
|
+ case "cfps" :
|
|
|
45
|
+ dir = cfps_recept_dir;
|
|
|
46
|
+ break;
|
|
|
47
|
+ default:
|
|
|
48
|
+ dir = cfps_recept_dir;
|
|
|
49
|
+ break;
|
|
|
50
|
+ }
|
|
|
51
|
+ try{
|
|
|
52
|
+ File fileDirectory = new File(dir);
|
|
|
53
|
+ List<File> files = FileTool.readDirectoryFiles(fileDirectory);
|
|
|
54
|
+ if(files!=null && !files.isEmpty()){
|
|
|
55
|
+ return files.size();
|
|
|
56
|
+ }else {
|
|
|
57
|
+ return 0;
|
|
|
58
|
+ }
|
|
|
59
|
+
|
|
|
60
|
+
|
|
|
61
|
+ }catch (Exception e){
|
|
|
62
|
+ e.printStackTrace();
|
|
|
63
|
+ log.error("获取目录文件出错",e);
|
|
|
64
|
+ }
|
|
|
65
|
+ return 500;
|
|
|
66
|
+ }
|
|
|
67
|
+
|
|
|
68
|
+
|
|
|
69
|
+
|
|
|
70
|
+} |