diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java index 21dc324b..92ef6eac 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java @@ -1,13 +1,21 @@ package cokr.xit.fims.crdn.web; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.regex.Matcher; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import org.apache.commons.io.FilenameUtils; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; @@ -98,10 +106,82 @@ public class Crdn05Controller extends ApplicationController { List dataObjectList = new ArrayList<>(); + String downloadRoot = ""; + if(entType.equals("이노")) { + try { + + //TODO : FTP접속정보 설정 + + downloadRoot = "files"+File.separator+"tempForIno"; + //TODO : FTP접속 및 다운로드 + + } catch (Exception e) { + e.printStackTrace(); + } + try { + Files.walk(Paths.get(downloadRoot)) + .filter(Files::isRegularFile) + .forEach(item -> { + DataObject dataObject = new DataObject(); + File file = item.toFile(); + String filePath = file.getPath(); + dataObject.put("FILE_PATH", filePath); + String fileName = file.getName(); + dataObject.put("FILE_NAME", fileName); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd / HH:mm:ss"); + dataObject.put("TIMESTAMP", sdf.format(new Date(file.lastModified()))); + dataObject.put("FILE_SIZE", file.length()+" byte"); + + String extension = FilenameUtils.getExtension(fileName); + dataObject.put("EXTENSION", extension); + + String[] fileNameSplit = FilenameUtils.removeExtension(fileName).split(Matcher.quoteReplacement("_")); + + dataObject.put("DEVICE_ID", fileNameSplit[0]); + dataObject.put("CRDN_YMD_TM", fileNameSplit[1]); + dataObject.put("VHRNO", fileNameSplit[2]); + dataObject.put("PHOTO_CNT", fileNameSplit[3]); + + String photoSeq = fileNameSplit[4]; + if(photoSeq.equals("1")) photoSeq = "입차사진"; + else if(photoSeq.equals("2")) photoSeq = "주차사진"; + else if(photoSeq.equals("3")) photoSeq = "위반사진"; + else if(photoSeq.equals("4")) photoSeq = "출차사진"; + + dataObject.put("PHOTO_SEQ", photoSeq); + + dataObject.put("LOCATION_X", fileNameSplit[5]); + dataObject.put("LOCATION_Y", fileNameSplit[6]); + + String inputSe = fileNameSplit[7]; + if(inputSe.equals("S")) inputSe = "정상등록자료"; + else if(inputSe.equals("E")) inputSe = "삭제자료"; + + dataObject.put("INPUT_SE", inputSe); + dataObject.put("CRDN_PLC", fileNameSplit[8]); + dataObject.put("CRDN_ADDRESS", fileNameSplit[9]); + dataObject.put("CRDN_STDG_NM", fileNameSplit[10]); + + if(fileNameSplit.length >= 12) { + String crdnCn = fileNameSplit[11]; + if(crdnCn.equals("00")) crdnCn = "사용안함"; + else if(crdnCn.equals("01")) crdnCn = "일반차량(전기차)"; + else if(crdnCn.equals("02")) crdnCn = "장기주차(전기차)"; + dataObject.put("CRDN_CN", crdnCn); + } + + dataObjectList.add(dataObject); + }); + } catch (IOException e) { + e.printStackTrace(); + } + + mav = setCollectionInfo(mav, dataObjectList, ""); } return mav; diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05020-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05020-info.jsp index 7e49e2e0..4c6ebb0f 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05020-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05020-info.jsp @@ -2,184 +2,277 @@ <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> 단속 파일 등록
-
-
-
-
- - -
-
- - -
-
- - - + + + >${item.value} + - -
- +
- - + +
- -
- -
-
-
-
- - - - - - +
+ + + + +
+ +
+ + +
+
+
+ +
+
+
+
+ + + + + + +
-
- - + +
-
-
-
- +
\ No newline at end of file