|
|
package com.tianbo.analysis.controller;
|
|
|
|
|
|
import com.tianbo.util.IO.FileTool;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
|
@Controller
|
|
|
public class IndexController {
|
|
|
|
...
|
...
|
@@ -15,4 +22,41 @@ public class IndexController { |
|
|
public String reception(){
|
|
|
return "flight/res";
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/devops/watchdir")
|
|
|
public Integer singlewindow(@RequestParam(value = "dir",required = true,defaultValue = "D:\\系统部署\\imf_Warehouse_reader\\xmlFromImf") String dir){
|
|
|
switch (dir){
|
|
|
case "stcs" :
|
|
|
dir = "D:\\TCSSingleWindow\\recive";
|
|
|
break;
|
|
|
case "tcs" :
|
|
|
dir = "D:\\Data\\Receive";
|
|
|
break;
|
|
|
case "cfps" :
|
|
|
dir = "D:\\系统部署\\imf_Warehouse_reader\\xmlFromImf";
|
|
|
break;
|
|
|
default:
|
|
|
dir = "D:\\TCSSingleWindow\\recive";
|
|
|
break;
|
|
|
}
|
|
|
try{
|
|
|
File fileDirectory = new File(dir);
|
|
|
if (!fileDirectory.exists()){
|
|
|
log.error("目录{}不存在",dir);
|
|
|
}else{
|
|
|
log.info("{}{}{}","开始获取目录",dir,"文件数量");
|
|
|
List<File> files = FileTool.readAllDirectoryFiles(fileDirectory);
|
|
|
if(files!=null && !files.isEmpty()){
|
|
|
log.info("{}{}{}{}","目录",dir,"文件数量为:",files.size());
|
|
|
return files.size();
|
|
|
}else {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
log.error("获取目录文件出错",e);
|
|
|
}
|
|
|
return 500;
|
|
|
}
|
|
|
} |
...
|
...
|
|