|
@@ -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
|
} |