|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package cokr.xit.fims.crdn.web;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.nio.file.Path;
|
|
|
|
@ -29,6 +28,8 @@ import cokr.xit.fims.crdn.parsing.EquipmentEnterprise;
|
|
|
|
|
import cokr.xit.fims.crdn.parsing.HiteCom;
|
|
|
|
|
import cokr.xit.fims.crdn.parsing.Ino;
|
|
|
|
|
import cokr.xit.fims.crdn.parsing.Knl;
|
|
|
|
|
import cokr.xit.fims.crdn.parsing.ParsingUtil;
|
|
|
|
|
import cokr.xit.fims.crdn.parsing.XitRecommend;
|
|
|
|
|
import cokr.xit.fims.crdn.service.CrdnService;
|
|
|
|
|
import cokr.xit.fims.crdn.service.CrdnStngService;
|
|
|
|
|
import cokr.xit.fims.crdn.service.ImportService;
|
|
|
|
@ -48,8 +49,8 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
getTodayCrdnDataList = "/010/list.do",
|
|
|
|
|
|
|
|
|
|
getFileRegistrationScreen = "/020/info.do",
|
|
|
|
|
importFileFromServer = "/020/importFileFromServer",
|
|
|
|
|
importFileFromClient = "/020/importFileFromClient",
|
|
|
|
|
importFileFromServer = "/020/importFileFromServer.do",
|
|
|
|
|
importFileFromClient = "/020/importFileFromClient.do",
|
|
|
|
|
getEquipmentFileInfoList = "/020/list.do",
|
|
|
|
|
removeLinkFile = "/020/remove.do",
|
|
|
|
|
createCrdnByLinkFile = "/020/create.do",
|
|
|
|
@ -131,41 +132,31 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
case "INO": enterprise = new Ino(); break;
|
|
|
|
|
case "KNL": enterprise = new Knl(); break;
|
|
|
|
|
case "HITECOM": enterprise = new HiteCom(); break;
|
|
|
|
|
//case "": enterprise = new (); break;
|
|
|
|
|
case "XIT": enterprise = new XitRecommend(); break;
|
|
|
|
|
//case "": enterprise = new (); break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String institute = currentUser().getInstitute();
|
|
|
|
|
String taskSeCd = hReq.getParameter("taskSeCd");
|
|
|
|
|
String equipmentType = hReq.getParameter("equipmentType");
|
|
|
|
|
|
|
|
|
|
Stream<Path> fileList = null;
|
|
|
|
|
List<DataObject> dataObjectList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
String downloadRoot = ""; //ftp나 usb에서 다운받는 파일 경로
|
|
|
|
|
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
|
|
|
|
|
|
|
|
|
|
//ftp G클라우드
|
|
|
|
|
if(entType.equals("INO")) {
|
|
|
|
|
|
|
|
|
|
//RemoteSystemInfo rs = new RemoteSystemInfo();
|
|
|
|
|
//rs.setIp("211.119.124.9");
|
|
|
|
|
//rs.setId("xituser");
|
|
|
|
|
//rs.setPw("xituser!@");
|
|
|
|
|
//rs.setOsType("linux");
|
|
|
|
|
|
|
|
|
|
//String remoteWorkPath = File.separator + "applications"
|
|
|
|
|
// + File.separator + "tempForFTPTest"
|
|
|
|
|
// + File.separator + "ino"
|
|
|
|
|
// + File.separator;
|
|
|
|
|
|
|
|
|
|
downloadRoot = "files"+File.separator+"tempForIno";
|
|
|
|
|
}
|
|
|
|
|
if(entType.equals("KNL")) {
|
|
|
|
|
downloadRoot = "files"+File.separator+"tempForKnl";
|
|
|
|
|
}
|
|
|
|
|
if(entType.equals("HITECOM")) {
|
|
|
|
|
downloadRoot = "files"+File.separator+"tempForHitecom";
|
|
|
|
|
}
|
|
|
|
|
//RemoteSystemInfo rs = new RemoteSystemInfo();
|
|
|
|
|
//rs.setIp("211.119.124.9");
|
|
|
|
|
//rs.setId("xituser");
|
|
|
|
|
//rs.setPw("xituser!@");
|
|
|
|
|
//rs.setOsType("linux");
|
|
|
|
|
|
|
|
|
|
//String remoteWorkPath = File.separator + "applications"
|
|
|
|
|
// + File.separator + "tempForFTPTest"
|
|
|
|
|
// + File.separator + "ino"
|
|
|
|
|
// + File.separator;
|
|
|
|
|
try {
|
|
|
|
|
//boolean result = FTPUtil.fileDown(rs, remoteWorkPath, downloadRoot);
|
|
|
|
|
//boolean result = FTPUtil.fileDown(rs, remoteWorkPath, workPath);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
@ -189,26 +180,14 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
case "INO": enterprise = new Ino(); break;
|
|
|
|
|
case "KNL": enterprise = new Knl(); break;
|
|
|
|
|
case "HITECOM": enterprise = new HiteCom(); break;
|
|
|
|
|
case "XIT": enterprise = new XitRecommend(); break;
|
|
|
|
|
//case "": enterprise = new (); break;
|
|
|
|
|
//case "": enterprise = new (); break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Stream<Path> fileList = null;
|
|
|
|
|
List<DataObject> dataObjectList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
String downloadRoot = ""; //ftp나 usb에서 다운받는 파일 경로
|
|
|
|
|
|
|
|
|
|
if(entType.equals("INO")) {
|
|
|
|
|
downloadRoot = "files"+File.separator+"tempForIno";
|
|
|
|
|
}
|
|
|
|
|
if(entType.equals("KNL")) {
|
|
|
|
|
downloadRoot = "files"+File.separator+"tempForKnl";
|
|
|
|
|
}
|
|
|
|
|
if(entType.equals("HITECOM")) {
|
|
|
|
|
downloadRoot = "files"+File.separator+"tempForHitecom";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String institute = currentUser().getInstitute();
|
|
|
|
|
String taskSeCd = hReq.getParameter("taskSeCd");
|
|
|
|
|
String equipmentType = hReq.getParameter("equipmentType");
|
|
|
|
|
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
|
|
|
|
|
|
|
|
|
|
//TODO :
|
|
|
|
|
|
|
|
|
@ -229,37 +208,25 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
case "INO": enterprise = new Ino(); break;
|
|
|
|
|
case "KNL": enterprise = new Knl(); break;
|
|
|
|
|
case "HITECOM": enterprise = new HiteCom(); break;
|
|
|
|
|
//case "": enterprise = new (); break;
|
|
|
|
|
case "XIT": enterprise = new XitRecommend(); break;
|
|
|
|
|
//case "": enterprise = new (); break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Stream<Path> fileList = null;
|
|
|
|
|
List<DataObject> dataObjectList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
String downloadRoot = "";
|
|
|
|
|
|
|
|
|
|
if(entType.equals("INO") || entType.equals("KNL")) {
|
|
|
|
|
if(entType.equals("INO")) {
|
|
|
|
|
downloadRoot = "files"+File.separator+"tempForIno";
|
|
|
|
|
}
|
|
|
|
|
if(entType.equals("KNL")) {
|
|
|
|
|
downloadRoot = "files"+File.separator+"tempForKnl";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(entType.equals("HITECOM")) {
|
|
|
|
|
downloadRoot = "files"+File.separator+"tempForHitecom";
|
|
|
|
|
}
|
|
|
|
|
String institute = currentUser().getInstitute();
|
|
|
|
|
String taskSeCd = hReq.getParameter("taskSeCd");
|
|
|
|
|
String equipmentType = hReq.getParameter("equipmentType");
|
|
|
|
|
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
|
|
|
|
|
|
|
|
|
|
Stream<Path> fileList = null;
|
|
|
|
|
try {
|
|
|
|
|
//폴더는 제외하고 파일만 필터링
|
|
|
|
|
fileList = Files.walk(Paths.get(downloadRoot)).filter(Files::isRegularFile);
|
|
|
|
|
fileList = Files.walk(Paths.get(workPath)).filter(Files::isRegularFile);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dataObjectList = enterprise.parsing(fileList);
|
|
|
|
|
List<DataObject> dataObjectList = enterprise.parsing(fileList);
|
|
|
|
|
mav = setCollectionInfo(mav, dataObjectList, "");
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
@ -278,7 +245,12 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
String entType = hReq.getParameter("entType");
|
|
|
|
|
String fileName = hReq.getParameter("fileName");
|
|
|
|
|
|
|
|
|
|
boolean saved = crdnService.removeEquipmentLinkFile(entType, fileName);
|
|
|
|
|
String institute = currentUser().getInstitute();
|
|
|
|
|
String taskSeCd = hReq.getParameter("taskSeCd");
|
|
|
|
|
String equipmentType = hReq.getParameter("equipmentType");
|
|
|
|
|
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
|
|
|
|
|
|
|
|
|
|
boolean saved = crdnService.removeEquipmentLinkFile(workPath, fileName);
|
|
|
|
|
|
|
|
|
|
mav.addObject("saved", saved);
|
|
|
|
|
return mav;
|
|
|
|
@ -292,16 +264,25 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
* "saved": 등록되었으면 true, 그렇지 않으면 false
|
|
|
|
|
* }</code></pre>
|
|
|
|
|
*/
|
|
|
|
|
public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String[] linkFileInfos) {
|
|
|
|
|
public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String equipmentType, String[] linkFileInfos) {
|
|
|
|
|
ModelAndView mav = new ModelAndView("jsonView");
|
|
|
|
|
|
|
|
|
|
String institute = currentUser().getInstitute();
|
|
|
|
|
|
|
|
|
|
List<DataObject> linkFileInfoList = new ArrayList<DataObject>();
|
|
|
|
|
for(String linkFileInfo : linkFileInfos) {
|
|
|
|
|
linkFileInfoList.add(fromJson(linkFileInfo, DataObject.class));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> resultMap = importService.createCrdnByEquipmentLinkFile(taskSeCd, entType, linkFileInfoList);
|
|
|
|
|
Map<String, String> processInfo = new HashMap<String,String>();
|
|
|
|
|
processInfo.put("institute", institute);
|
|
|
|
|
processInfo.put("taskSeCd", taskSeCd);
|
|
|
|
|
processInfo.put("entType", entType);
|
|
|
|
|
processInfo.put("equipmentType", equipmentType);
|
|
|
|
|
|
|
|
|
|
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
|
|
|
|
|
processInfo.put("workPath", workPath);
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> resultMap = importService.createCrdnByEquipmentLinkFile(processInfo, linkFileInfoList);
|
|
|
|
|
|
|
|
|
|
boolean saved = (boolean) resultMap.get("saved");
|
|
|
|
|
mav.addObject("saved", saved);
|
|
|
|
|