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