diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index e6044b27..727818f8 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -18,6 +18,87 @@ public class CmmnUtil { return str; } + /** + * 문자열을 바이트 단위로 substring하기 + * + * new String(str.getBytes(), 0, endBytes) 코드를 사용하면 + * 한글 바이트에 딱 맞춰 자르지 않는 경우 깨지는 문제가 있어서 따로 메서드를 만들었다. + * + * UTF-8 기준 한글은 3바이트, 알파벳 대소문자나 숫자 및 띄어쓰기는 1바이트로 계산된다. + * + * @param str + * @param beginBytes + * @param endBytes + * @return + */ + public static String substringByBytes(String str, int beginBytes, int endBytes) { + if (str == null || str.length() == 0) { + return ""; + } + + if (beginBytes < 0) { + beginBytes = 0; + } + + if (endBytes < 1) { + return ""; + } + + int len = str.length(); + + int beginIndex = -1; + int endIndex = 0; + + int curBytes = 0; + String ch = null; + for (int i = 0; i < len; i++) { + ch = str.substring(i, i + 1); + curBytes += ch.getBytes().length; + + + if (beginIndex == -1 && curBytes >= beginBytes) { + beginIndex = i; + } + + if (curBytes > endBytes) { + break; + } else { + endIndex = i + 1; + } + } + + return str.substring(beginIndex, endIndex); + } + + public static String substringByBytes(String str, int beginBytes) { + if (str == null || str.length() == 0) { + return ""; + } + + if (beginBytes < 0) { + beginBytes = 0; + } + + int len = str.length(); + + int beginIndex = -1; + + int curBytes = 0; + String ch = null; + for (int i = 0; i < len; i++) { + ch = str.substring(i, i + 1); + curBytes += ch.getBytes().length; + + + if (beginIndex == -1 && curBytes >= beginBytes) { + beginIndex = i; + } + + } + + return str.substring(beginIndex); + } + /** * 하위 폴더가 비워져 있으면 삭제한다. * @param file 대상 폴더, removeSelf 대상 폴더까지 삭제할 지 여부 diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/HiteCom.java b/src/main/java/cokr/xit/fims/crdn/parsing/HiteCom.java index f81fc8a4..854bfb6f 100644 --- a/src/main/java/cokr/xit/fims/crdn/parsing/HiteCom.java +++ b/src/main/java/cokr/xit/fims/crdn/parsing/HiteCom.java @@ -1,15 +1,24 @@ package cokr.xit.fims.crdn.parsing; import java.io.File; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; +import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; +import java.util.Base64; +import java.util.Base64.Encoder; import java.util.List; import java.util.stream.Stream; +import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.foundation.data.DataObject; public class HiteCom implements EquipmentEnterprise { + private int tempGroupSeq = 1; + @Override public List parsing(Stream fileList) { @@ -23,38 +32,99 @@ public class HiteCom implements EquipmentEnterprise { String fileName = file.getName(); dataObject.put("FILE_NAME", fileName); - //TODO: - - dataObject.put("text부사이즈", ""); - dataObject.put("장비번호", ""); - dataObject.put("속도", ""); - dataObject.put("차종", ""); - dataObject.put("차로", ""); - dataObject.put("위반날짜", ""); - dataObject.put("위반시간", ""); - dataObject.put("차량번호", ""); - dataObject.put("번호판시작X", ""); - dataObject.put("번호판시작Y", ""); - dataObject.put("번호판크기W", ""); - dataObject.put("번호판크기H", ""); - dataObject.put("번호판유무", ""); - dataObject.put("위반코드", ""); - dataObject.put("위반종류", ""); - dataObject.put("정지선통과시", ""); - dataObject.put("교차로선통과시", ""); - dataObject.put("영상프레임수", ""); - dataObject.put("신호등형태", ""); - dataObject.put("진행형태", ""); - dataObject.put("신호등종류", ""); - dataObject.put("사진매수", ""); - dataObject.put("plate", ""); - dataObject.put("carNo", ""); - dataObject.put("movingImage1", ""); - dataObject.put("movingImage1", ""); - dataObject.put("movingImage1", ""); - dataObject.put("movingImage1", ""); - dataObject.put("movingImage1", ""); - dataObject.put("movingImage1", ""); + //파일내용 + String fileCn0 = ""; + try { + + fileCn0 = Files.readString(item, Charset.forName("ISO-8859-1")); + } catch (IOException e) { + e.printStackTrace(); + } + + String fileCn = ""; + try { + fileCn = new String(fileCn0.getBytes("ISO-8859-1"), "EUC-KR"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + System.out.println("substring...."); + dataObject.put("TEXT_SIZE", CmmnUtil.substringByBytes(fileCn, 0, 7)); + dataObject.put("EQUIPMENT", CmmnUtil.substringByBytes(fileCn, 8, 12)); + dataObject.put("CAR_VELOCITY", CmmnUtil.substringByBytes(fileCn, 13, 15).replaceAll("^0+", "")); //차량속도 + dataObject.put("CAR_TYPE", CmmnUtil.substringByBytes(fileCn, 16, 16)); //차종(미사용) + dataObject.put("ROAD_CD", CmmnUtil.substringByBytes(fileCn, 17, 17)); //도로코드(미사용) + dataObject.put("CRDN_YMD", CmmnUtil.substringByBytes(fileCn, 18, 25)); + dataObject.put("CRDN_TM", CmmnUtil.substringByBytes(fileCn, 26, 31)); + dataObject.put("VHRNO", CmmnUtil.substringByBytes(fileCn, 32, 43).trim()); + dataObject.put("MOSC_X", CmmnUtil.substringByBytes(fileCn, 44, 47).replaceAll("^0+", "")); + dataObject.put("MOSC_Y", CmmnUtil.substringByBytes(fileCn, 48, 51).replaceAll("^0+", "")); + dataObject.put("PLATE_WIDTH", CmmnUtil.substringByBytes(fileCn, 52, 55).replaceAll("^0+", "")); //번호판width + dataObject.put("PLATE_HEIGHT", CmmnUtil.substringByBytes(fileCn, 56, 59).replaceAll("^0+", "")); //번호판height + dataObject.put("PLATE_YN", CmmnUtil.substringByBytes(fileCn, 60, 60)); //번호판유무(미사용) + dataObject.put("CRDN_SE", CmmnUtil.substringByBytes(fileCn, 61, 61)); //위반구분(미사용) + dataObject.put("CRDN_TYPE", CmmnUtil.substringByBytes(fileCn, 62, 62)); //위반종류(미사용) + String gpsX = CmmnUtil.substringByBytes(fileCn, 63, 85).replaceAll("^0+", "").replaceAll("0+$", ""); + String gpsY = CmmnUtil.substringByBytes(fileCn, 86, 108).replaceAll("^0+", "").replaceAll("0+$", ""); + dataObject.put("GPS_X", gpsX.endsWith(".") ? gpsX + "0" : gpsX); + dataObject.put("GPS_Y", gpsY.endsWith(".") ? gpsY + "0" : gpsY); + String photoCnt = CmmnUtil.substringByBytes(fileCn, 109, 110); + dataObject.put("PHOTO_CNT", photoCnt.startsWith("0") ? photoCnt.substring(1,2) : photoCnt); + dataObject.put("TRAFFIC_LIGHT_FORM", CmmnUtil.substringByBytes(fileCn, 111, 111)); //신호등형태(미사용) + dataObject.put("PROGRESS_FORM", CmmnUtil.substringByBytes(fileCn, 112, 112)); //진행형태(미사용) + dataObject.put("TRAFFIC_LIGHT_TYPE", CmmnUtil.substringByBytes(fileCn, 113, 113)); //신호등종류(미사용) + dataObject.put("SOME", CmmnUtil.substringByBytes(fileCn, 113, 113)); //?(미사용) + + + String fileAreaText = fileCn0.substring(114); + + Encoder encoder = Base64.getEncoder(); + + String jpgString = ""; + String jpgName = ""; + boolean jpgIn = false; + int jpgNum = 0; + for (int i = 0; i < fileAreaText.length(); i++) { + + boolean jpgStart = (i != fileAreaText.length()-1) && (fileAreaText.charAt(i) == 0xFF && fileAreaText.charAt(i+1) == 0xD8); + boolean jpgEnd = (i != 0) && (fileAreaText.charAt(i-1) == 0xFF && fileAreaText.charAt(i) == 0xD9); + + if(jpgStart) { + jpgName = "" + fileAreaText.charAt(i-6)+fileAreaText.charAt(i-5)+fileAreaText.charAt(i-4) + + fileAreaText.charAt(i-3)+fileAreaText.charAt(i-2)+fileAreaText.charAt(i-1); + jpgIn = true; + } + + if(jpgIn) { + jpgString += fileAreaText.charAt(i); + } + + if(jpgIn && jpgEnd) { + + jpgNum++; + + jpgString = new String(encoder.encode(jpgString.getBytes(Charset.forName("ISO-8859-1")))); + + if(jpgNum == 1){ + dataObject.put("CAR_IMAGE", jpgString); + dataObject.put("CAR_IMAGE_NM", jpgName); + } else if(jpgNum == 2){ + dataObject.put("PLATE_IMAGE", jpgString); + dataObject.put("PLATE_IMAGE_NM", jpgName); + + } else { + dataObject.put("MOVING_IMAGE"+(jpgNum-2), jpgString); + dataObject.put("MOVING_IMAGE"+(jpgNum-2)+"_NM", jpgName); + } + jpgString = ""; + jpgIn = false; + } + + } + + tempGroupSeq++; + dataObject.put("TEMP_GROUP_ID", tempGroupSeq); + dataObject.put("ENT_TYPE", "HITECOM"); dataObjectList.add(dataObject); }); diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java b/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java index fd0e0215..278ded5e 100644 --- a/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java +++ b/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java @@ -91,7 +91,7 @@ public class Ino implements EquipmentEnterprise { } dataObject.put("TEMP_GROUP_ID", tempGroupSeq); - + dataObject.put("ENT_TYPE", "INO"); dataObjectList.add(dataObject); before = dataObject; }); diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java b/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java index 34003b80..771dfa83 100644 --- a/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java +++ b/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java @@ -43,7 +43,7 @@ public class XitRecommend implements EquipmentEnterprise{ String crdnTiemstamp = fileNameSplit[0]; dataObject.put("CRDN_YMD", crdnTiemstamp.substring(0, 8)); - dataObject.put("CRDN_HM", crdnTiemstamp.substring(8, 14)); + dataObject.put("CRDN_TM", crdnTiemstamp.substring(8, 14)); dataObject.put("ENT_CD", fileNameSplit[1]); dataObject.put("EQM_CD", fileNameSplit[2]); 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 987b7883..46a59f39 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java @@ -26,6 +26,7 @@ import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.dao.CrdnInstMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper; 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.service.CrdnService; @@ -43,16 +44,18 @@ public class Crdn05Controller extends ApplicationController { public class METHOD_URL { public static final String - crackdownDataRegistrationMain = "/010/main.do", - getTodayCrdnDataList = "/010/list.do", - - getFileRegistrationScreen = "/020/info.do", - getCrdnFileListFromEquipmentEnterprise = "/020/list.do", - removeLinkFile = "/020/remove.do", - createCrdnByLinkFile = "/020/create.do", - - getManualRegistrationScreen = "/030/info.do", - createCrdnDataByManual = "/030/create.do" + crackdownDataRegistrationMain = "/010/main.do", + getTodayCrdnDataList = "/010/list.do", + + getFileRegistrationScreen = "/020/info.do", + importFileFromServer = "/020/importFileFromServer", + importFileFromClient = "/020/importFileFromClient", + getEquipmentFileInfoList = "/020/list.do", + removeLinkFile = "/020/remove.do", + createCrdnByLinkFile = "/020/create.do", + + getManualRegistrationScreen = "/030/info.do", + createCrdnDataByManual = "/030/create.do" ; } @@ -114,19 +117,20 @@ public class Crdn05Controller extends ApplicationController { return mav; } - /**연계를 통해 서버의 스토리지로 전송된 장비업체의 단속파일을 조회한다. + /** FTP 서버로부터 단속연계파일을 가져온다. * @param * @return */ - public ModelAndView getCrdnFileListFromEquipmentEnterprise(HttpServletRequest hReq) { + public ModelAndView importFileFromServer(HttpServletRequest hReq) { ModelAndView mav = new ModelAndView("jsonView"); + boolean saved = false; String entType = hReq.getParameter("entType"); EquipmentEnterprise enterprise = null; switch(entType){ case "INO": enterprise = new Ino(); break; case "KNL": enterprise = new Knl(); break; - //case "": enterprise = new (); break; + case "HITECOM": enterprise = new HiteCom(); break; //case "": enterprise = new (); break; //case "": enterprise = new (); break; } @@ -137,39 +141,115 @@ public class Crdn05Controller extends ApplicationController { String downloadRoot = ""; //ftp나 usb에서 다운받는 파일 경로 - if(entType.equals("INO") || entType.equals("KNL")) { - //ftp G클라우드 + //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"; + } + + try { + //boolean result = FTPUtil.fileDown(rs, remoteWorkPath, downloadRoot); + } catch (Exception e) { + e.printStackTrace(); + } + + saved = true; + mav.addObject("saved", saved); + return mav; + } + + /** 사용자 클라이언트(브라우저)로부터 단속연계파일을 가져온다. + * @param + * @return + */ + public ModelAndView importFileFromClient(HttpServletRequest hReq, MultipartFile[] uploadFiles) { + ModelAndView mav = new ModelAndView("jsonView"); + boolean saved = false; + + String entType = hReq.getParameter("entType"); + EquipmentEnterprise enterprise = null; + switch(entType){ + case "INO": enterprise = new Ino(); break; + case "KNL": enterprise = new Knl(); break; + case "HITECOM": enterprise = new HiteCom(); break; + //case "": enterprise = new (); break; + //case "": enterprise = new (); break; + } - try { - if(entType.equals("INO")) { + Stream fileList = null; + List dataObjectList = new ArrayList<>(); - //RemoteSystemInfo rs = new RemoteSystemInfo(); - //rs.setIp("211.119.124.9"); - //rs.setId("xituser"); - //rs.setPw("xituser!@"); - //rs.setOsType("linux"); + String downloadRoot = ""; //ftp나 usb에서 다운받는 파일 경로 - //String remoteWorkPath = File.separator + "applications" - // + File.separator + "tempForFTPTest" - // + File.separator + "ino" - // + File.separator; + 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"; + } - downloadRoot = "files"+File.separator+"tempForIno"; - } - if(entType.equals("KNL")) { + //TODO : + mav.addObject("saved", saved); + return mav; + } - downloadRoot = "files"+File.separator+"tempForKnl"; - } + /**전송,업로드 완료된 장비업체의 단속연계파일 정보를 조회한다. + * @param + * @return + */ + public ModelAndView getEquipmentFileInfoList(HttpServletRequest hReq) { + ModelAndView mav = new ModelAndView("jsonView"); + + String entType = hReq.getParameter("entType"); + EquipmentEnterprise enterprise = null; + switch(entType){ + case "INO": enterprise = new Ino(); break; + case "KNL": enterprise = new Knl(); break; + case "HITECOM": enterprise = new HiteCom(); break; + //case "": enterprise = new (); break; + //case "": enterprise = new (); break; + } - //boolean result = FTPUtil.fileDown(rs, remoteWorkPath, downloadRoot); - } catch (Exception e) { - e.printStackTrace(); + Stream fileList = null; + List 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"; } try { diff --git a/src/main/java/cokr/xit/fims/task/web/BpvController.java b/src/main/java/cokr/xit/fims/task/web/BpvController.java index 26c802e2..8c087f61 100644 --- a/src/main/java/cokr/xit/fims/task/web/BpvController.java +++ b/src/main/java/cokr/xit/fims/task/web/BpvController.java @@ -216,6 +216,30 @@ public class BpvController { return super.getFileRegistrationScreen(hReq); } + @Override + @RequestMapping(name="전용차로과태료업무 단속연계파일 가져오기(FTP)", value=METHOD_URL.importFileFromServer) + public ModelAndView importFileFromServer(HttpServletRequest hReq) { + return super.importFileFromServer(hReq); + } + + @Override + @RequestMapping(name="전용차로과태료업무 단속연계파일 가져오기(파일업로드)", value=METHOD_URL.importFileFromClient) + public ModelAndView importFileFromClient(HttpServletRequest hReq, MultipartFile[] uploadFiles) { + return super.importFileFromClient(hReq, uploadFiles); + } + + @Override + @RequestMapping(name="전용차로과태료업무 장비업체 단속파일 목록 조회", value=METHOD_URL.getEquipmentFileInfoList) + public ModelAndView getEquipmentFileInfoList(HttpServletRequest hReq) { + return super.getEquipmentFileInfoList(hReq); + } + + @Override + @RequestMapping(name="전용차로과태료업무 장비업체 단속파일 삭제", value=METHOD_URL.removeLinkFile) + public ModelAndView removeLinkFile(HttpServletRequest hReq) { + return super.removeLinkFile(hReq); + } + @Override @RequestMapping(name="전용차로과태료업무 단속자료 수기 등록 화면", value=METHOD_URL.getManualRegistrationScreen) public ModelAndView getManualRegistrationScreen(HttpServletRequest hReq) { diff --git a/src/main/java/cokr/xit/fims/task/web/DpvController.java b/src/main/java/cokr/xit/fims/task/web/DpvController.java index b5c5ca8f..979e953b 100644 --- a/src/main/java/cokr/xit/fims/task/web/DpvController.java +++ b/src/main/java/cokr/xit/fims/task/web/DpvController.java @@ -3,7 +3,6 @@ package cokr.xit.fims.task.web; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; @@ -243,9 +242,21 @@ public class DpvController { } @Override - @RequestMapping(name="장애인과태료업무 장비업체 단속파일 목록 조회", value=METHOD_URL.getCrdnFileListFromEquipmentEnterprise) - public ModelAndView getCrdnFileListFromEquipmentEnterprise(HttpServletRequest hReq) { - return super.getCrdnFileListFromEquipmentEnterprise(hReq); + @RequestMapping(name="장애인과태료업무 단속연계파일 가져오기(FTP)", value=METHOD_URL.importFileFromServer) + public ModelAndView importFileFromServer(HttpServletRequest hReq) { + return super.importFileFromServer(hReq); + } + + @Override + @RequestMapping(name="전용차로과태료업무 단속연계파일 가져오기(파일업로드)", value=METHOD_URL.importFileFromClient) + public ModelAndView importFileFromClient(HttpServletRequest hReq, MultipartFile[] uploadFiles) { + return super.importFileFromClient(hReq, uploadFiles); + } + + @Override + @RequestMapping(name="장애인과태료업무 장비업체 단속파일 목록 조회", value=METHOD_URL.getEquipmentFileInfoList) + public ModelAndView getEquipmentFileInfoList(HttpServletRequest hReq) { + return super.getEquipmentFileInfoList(hReq); } @Override @@ -255,7 +266,7 @@ public class DpvController { } @Override - @PostMapping(name="장애인과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile) + @RequestMapping(name="장애인과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile) public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String[] linkFileInfos) { return super.createCrdnByLinkFile(taskSeCd, entType, linkFileInfos); } @@ -483,7 +494,7 @@ public class DpvController { } @Controller - @RequestMapping(name="장애인과태료업무 발송,반송 관리_계고장 발송", value=CLASS_URL+Sndb01Controller.CLASS_URL) + @RequestMapping(name="장애인과태료업무 발송, 반송 관리", value=CLASS_URL+Sndb01Controller.CLASS_URL) class Sndb01Controller extends cokr.xit.fims.sndb.web.Sndb01Controller { @Override @@ -492,24 +503,12 @@ public class DpvController { return super.getWrngSndngTrgtList(req); } - @Override - @RequestMapping(name="장애인과태료업무 계고장 발송 대상 등록", value=METHOD_URL.getWrngSndngTrgtInfo) - public ModelAndView getWrngSndngTrgtInfo(SndbQuery req) { - return super.getWrngSndngTrgtInfo(req); - } - @Override @RequestMapping(name="장애인과태료업무 계고장 발송 현황 목록 조회", value=METHOD_URL.getWrngSndngList) public ModelAndView getWrngSndngList(SndbQuery req) { return super.getWrngSndngList(req); } - } - - @Controller - @RequestMapping(name="장애인과태료업무 발송,반송 관리_사전통보 발송", value=CLASS_URL+Sndb02Controller.CLASS_URL) - class Sndb02Controller extends cokr.xit.fims.sndb.web.Sndb02Controller { - @Override @RequestMapping(name="장애인과태료업무 사전통보 발송 대상 목록 조회", value=METHOD_URL.getAdvntceSndngTrgtList) public ModelAndView getAdvntceSndngTrgtList(SndbQuery req) { @@ -522,12 +521,6 @@ public class DpvController { return super.getAdvntceSndngList(req); } - } - - @Controller - @RequestMapping(name="장애인과태료업무 발송,반송 관리_고지서 발송", value=CLASS_URL+Sndb03Controller.CLASS_URL) - class Sndb03Controller extends cokr.xit.fims.sndb.web.Sndb03Controller { - @Override @RequestMapping(name="장애인과태료업무 고지서 발송 현황 목록 조회", value=METHOD_URL.getNhtSndngList) public ModelAndView getNhtSndngList(SndbQuery req) { @@ -536,12 +529,6 @@ public class DpvController { } - @Controller - @RequestMapping(name="장애인과태료업무 발송,반송 관리_반송, 공시송달", value=CLASS_URL+Sndb04Controller.CLASS_URL) - class Sndb04Controller extends cokr.xit.fims.sndb.web.Sndb04Controller { - - } - @Controller @RequestMapping(name="장애인과태료업무 업무지원_통합조회", value=CLASS_URL+"/sprt/sprt01") class Sprt01Controller extends cokr.xit.fims.sprt.web.Sprt01Controller {} diff --git a/src/main/java/cokr/xit/fims/task/web/EcaController.java b/src/main/java/cokr/xit/fims/task/web/EcaController.java index 5c36f6d6..44aca075 100644 --- a/src/main/java/cokr/xit/fims/task/web/EcaController.java +++ b/src/main/java/cokr/xit/fims/task/web/EcaController.java @@ -3,7 +3,6 @@ package cokr.xit.fims.task.web; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; @@ -219,9 +218,21 @@ public class EcaController { } @Override - @RequestMapping(name="전기차과태료업무 장비업체 단속파일 목록 조회", value=METHOD_URL.getCrdnFileListFromEquipmentEnterprise) - public ModelAndView getCrdnFileListFromEquipmentEnterprise(HttpServletRequest hReq) { - return super.getCrdnFileListFromEquipmentEnterprise(hReq); + @RequestMapping(name="전기차과태료업무 단속연계파일 가져오기(FTP)", value=METHOD_URL.importFileFromServer) + public ModelAndView importFileFromServer(HttpServletRequest hReq) { + return super.importFileFromServer(hReq); + } + + @Override + @RequestMapping(name="전용차로과태료업무 단속연계파일 가져오기(파일업로드)", value=METHOD_URL.importFileFromClient) + public ModelAndView importFileFromClient(HttpServletRequest hReq, MultipartFile[] uploadFiles) { + return super.importFileFromClient(hReq, uploadFiles); + } + + @Override + @RequestMapping(name="전기차과태료업무 장비업체 단속파일 목록 조회", value=METHOD_URL.getEquipmentFileInfoList) + public ModelAndView getEquipmentFileInfoList(HttpServletRequest hReq) { + return super.getEquipmentFileInfoList(hReq); } @Override @@ -231,7 +242,7 @@ public class EcaController { } @Override - @PostMapping(name="전기차과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile) + @RequestMapping(name="전기차과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile) public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String[] linkFileInfos) { return super.createCrdnByLinkFile(taskSeCd, entType, linkFileInfos); } diff --git a/src/main/java/cokr/xit/fims/task/web/PvsController.java b/src/main/java/cokr/xit/fims/task/web/PvsController.java index 9745fb54..1cbab5fd 100644 --- a/src/main/java/cokr/xit/fims/task/web/PvsController.java +++ b/src/main/java/cokr/xit/fims/task/web/PvsController.java @@ -229,6 +229,30 @@ public class PvsController { return super.getFileRegistrationScreen(hReq); } + @Override + @RequestMapping(name="주정차과태료업무 단속연계파일 가져오기(FTP)", value=METHOD_URL.importFileFromServer) + public ModelAndView importFileFromServer(HttpServletRequest hReq) { + return super.importFileFromServer(hReq); + } + + @Override + @RequestMapping(name="전용차로과태료업무 단속연계파일 가져오기(파일업로드)", value=METHOD_URL.importFileFromClient) + public ModelAndView importFileFromClient(HttpServletRequest hReq, MultipartFile[] uploadFiles) { + return super.importFileFromClient(hReq, uploadFiles); + } + + @Override + @RequestMapping(name="주정차과태료업무 장비업체 단속파일 목록 조회", value=METHOD_URL.getEquipmentFileInfoList) + public ModelAndView getEquipmentFileInfoList(HttpServletRequest hReq) { + return super.getEquipmentFileInfoList(hReq); + } + + @Override + @RequestMapping(name="주정차과태료업무 장비업체 단속파일 삭제", value=METHOD_URL.removeLinkFile) + public ModelAndView removeLinkFile(HttpServletRequest hReq) { + return super.removeLinkFile(hReq); + } + @Override @RequestMapping(name="주정차과태료업무 단속자료 수기 등록 화면", value=METHOD_URL.getManualRegistrationScreen) public ModelAndView getManualRegistrationScreen(HttpServletRequest hReq) { 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 e7da3e8e..9c3adaaf 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 @@ -51,9 +51,9 @@ - - - + + + @@ -65,13 +65,13 @@
-
+
- -
    + +
@@ -82,67 +82,120 @@
-
- +
@@ -163,30 +216,34 @@ pageObject["${pageName}"] = {}; $(document).ready(function(){ var $P = pageObject["${pageName}"]; + $P.entType = ""; $P.tempGroup = {}; /************************************************************************** * DatasetControl **************************************************************************/ - $P.crdnControl = new DatasetControl({ + $P.parsedInfoControl = new DatasetControl({ urls : { }, keymapper : info => info ? info.FILE_NAME : "", dataGetter : obj => obj["List"], formats: { - CRDN_YMD_TM : datetimeFormat + CRDN_YMD_TM : datetimeFormat, + CRDN_YMD : dateFormat, + CRDN_TM : timeFormat } }); /************************************************************************** * DatasetControl.on **************************************************************************/ - $P.crdnControl.onDatasetChange = (obj) => { - $P.renderCrdnList(obj["Total"]); + $P.parsedInfoControl.onDatasetChange = (obj) => { + + $P.renderParsedInfoList(obj["Total"], $P.entType); - $("#crdnPaging--${pageName}").setPagingInfo({ - list: $P.crdnControl.dataset, - prefix: "crdnPaging--${pageName}", + $("#parsedInfoPaging--${pageName}").setPagingInfo({ + list: $P.parsedInfoControl.dataset, + prefix: "parsedInfoPaging--${pageName}", start: obj["Start"], totalSize: obj["Total"], fetchSize: obj["Fetch"], @@ -194,24 +251,42 @@ $(document).ready(function(){ }); }; - $P.crdnControl.onCurrentChange = (item) => { + $P.parsedInfoControl.onCurrentChange = (item) => { + $("#imageArea--${pageName}").html(""); + if(item && item.data){ var dataKey = item.data.FILE_NAME; - $("#crdnTbody--${pageName}").setCurrentRow(dataKey); - var url = item.data.FILE_PATH; - $("#img--${pageName}").attr("src",url); - } else { - $("#img--${pageName}").attr("src",""); + if($P.entType != ""){ + $("#table-responsive--${pageName}").find("."+$P.entType).find("tbody").setCurrentRow(dataKey); + } + + if(item.data.ENT_TYPE == "INO"){ + var src = item.data.FILE_PATH; + $P.renderImage(src); + } else if(item.data.ENT_TYPE == "HITECOM"){ + var srcArr = [ + "data:image/jpg;base64,"+item.data.CAR_IMAGE, + "data:image/jpg;base64,"+item.data.PLATE_IMAGE + ]; + + for(var i=1; i <= item.data.PHOTO_CNT-2; i++){ + srcArr.push("data:image/jpg;base64," + item.data["MOVING_IMAGE"+i]) + } + + $P.renderImage(srcArr); + } + } }; - + /************************************************************************** * pageObject.function **************************************************************************/ - $P.searchFileList = () => { - if($("#entType--${pageName}").val() == ""){ + //ftp체크 + $P.checkFTP() = () => { + if($("#entType--${pageName}").val() == ""){ dialog.alert("장비업체를 선택하세요."); return; } @@ -227,24 +302,27 @@ $(document).ready(function(){ } ajax.post({ - url : wctx.url("/${taskSeCd}/crdn/crdn05/020/list.do"), + url : wctx.url("/${taskSeCd}/crdn/crdn05/020/importFileFromServer.do"), data : { entType : $("#entType--${pageName}").val() }, success : (resp) => { - $("#img--${pageName}").attr("src",""); - $P.crdnControl.setData(resp); + if(resp.saved){ + $P.searchFileList(); + } } }); - } - + + } + + //로컬파일업로드 $P.uploadLocalFile = () => { if($("#entType--${pageName}").val() == ""){ dialog.alert("장비업체를 선택하세요."); return; } - if($("#entType--${pageName}").val() != "가산정보통신" - && $("#entType--${pageName}").val() != "엘리소프트" - && $("#entType--${pageName}").val() != "하이테콤" + if($("#entType--${pageName}").val() != "GASAN" + && $("#entType--${pageName}").val() != "ELISOFT" + && $("#entType--${pageName}").val() != "HITECOM" && $("#entType--${pageName}").val() != "XIT" ){ dialog.alert("해당 과태료 업무와 관련된 장비업체가 아닙니다."); @@ -258,31 +336,103 @@ $(document).ready(function(){ dialog.alert("주정차,전용차로,미세먼지 과태료 파일 등록 기능은 서비스 준비 중입니다."); return; + + ajax.post({ + url : wctx.url("/${taskSeCd}/crdn/crdn05/020/importFileFromClient.do"), + data : { entType : $("#entType--${pageName}").val() }, + success : (resp) => { + if(resp.saved){ + $P.searchFileList(); + } + } + }); + + } - $P.renderCrdnList = (total) => { - var crdnList = $P.crdnControl.dataset; - var empty = crdnList.empty; - var notFound = [document.getElementById("crdnNotFound--${pageName}").innerHTML]; - var found = document.getElementById("crdnRow--${pageName}").innerHTML; - var replacer = (str, dataItem) => str - .replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('" + dataItem.getValue("FILE_NAME") + "');"); - - var trs = empty ? notFound : crdnList.inStrings(found,replacer); - - $("#crdnTbody--${pageName}").html(trs.join()); + //서버에 등록된 파일 조회 + $P.searchFileList = () => { + + + $P.parsedInfoControl.setData([]); + + if($("#entType--${pageName}").val() == "INO"){ + $P.entType = "ino"; + } else if($("#entType--${pageName}").val() == "HITECOM"){ + $P.entType = "hitecom"; + } else { + $P.entType = ""; + } - if(!empty){ - fnDownsizeCheck(document.getElementById("DataTables_Table_0--${pageName}")); + $("#table-responsive--${pageName}").find("span").attr("hidden","hidden"); + $("#table-responsive--${pageName}").find("."+$P.entType).removeAttr("hidden"); + + ajax.post({ + url : wctx.url("/${taskSeCd}/crdn/crdn05/020/list.do"), + data : { entType : $("#entType--${pageName}").val() }, + success : (resp) => { + $P.parsedInfoControl.setData(resp); + } + }); + } + + //테이블 렌더링 + $P.renderParsedInfoList = (total, entType) => { + if(entType != ""){ + var parsedInfoList = $P.parsedInfoControl.dataset; + var empty = parsedInfoList.empty; + var notFound = [$("#table-responsive--${pageName}").find("."+entType).find("template.notFound")[0].innerHTML]; + var found = $("#table-responsive--${pageName}").find("."+entType).find("template.found")[0].innerHTML; + var replacer = (str, dataItem) => str + .replace(/{onclick}/gi, "pageObject['${pageName}'].clickParsedInfoList('" + dataItem.getValue("FILE_NAME") + "');"); + + var trs = empty ? notFound : parsedInfoList.inStrings(found,replacer); + + $("#table-responsive--${pageName}").find("."+entType).find("tbody").html(trs.join()); + + if(!empty){ + fnDownsizeCheck($("#table-responsive--${pageName}").find("."+entType).find("table")[0]); + } } } - $P.clickCrdnList = (dataKey) => { + //사진 표시 + $P.renderImage = (src) => { + + if(Array.isArray(src)){ + var div = document.createElement("div"); + div.style["margin-top"] = "20px"; + div.style["margin-bottom"] = "20px"; + div.style["overflow-y"] = "scroll"; + for(var i=0; i < src.length; i++){ + var span = document.createElement("span"); + span.style["max-width"] = "260px"; + span.style["max-height"] = "260px"; + var img = document.createElement("img"); + img.style["object-fit"] = "contain"; + img.style["max-width"] = "inherit"; + img.style["max-height"] = "inherit"; + img.src = src[i]; + span.appendChild(img); + div.appendChild(span); + } + $("#imageArea--${pageName}").append(div); + } else { + + var img = document.createElement("img"); + img.style["object-fit"] = "contain"; + img.src = src; + $("#imageArea--${pageName}").append(img); + } + + } + + $P.clickParsedInfoList = (dataKey) => { if(dataKey == ""){ return; } - $P.crdnControl.setCurrent(dataKey); + $P.parsedInfoControl.setCurrent(dataKey); }; $P.createCrdn = () => { @@ -295,7 +445,7 @@ $(document).ready(function(){ var firstGroupKey = Object.keys($P.tempGroup)[0]; var formData = new FormData(document.getElementById("frmMultipart--${pageName}")); formData.append("taskSeCd", "${taskSeCd}"); - formData.append("entType", $("#entType--${pageName}").val()); + formData.append("entType", $P.entType); for(var i=0; i<$P.tempGroup[firstGroupKey].length; i++){ formData.append("linkFileInfos", JSON.stringify($P.tempGroup[firstGroupKey][i])); } @@ -328,7 +478,7 @@ $(document).ready(function(){ }; $P.deleteFile = () => { - var current = $P.crdnControl.getCurrent(); + var current = $P.parsedInfoControl.getCurrent(); if(current == null) return; var fileName = current.FILE_NAME; @@ -336,7 +486,7 @@ $(document).ready(function(){ ajax.get({ url : wctx.url("/${taskSeCd}/crdn/crdn05/020/remove.do"), data : { - entType : $("#entType--${pageName}").val(), + entType : $P.entType, fileName : fileName }, success : (resp) => { @@ -348,44 +498,52 @@ $(document).ready(function(){ } $P.removeCallback = (removedFileName) => { - $P.crdnControl.dataset.remove(removedFileName); + $P.parsedInfoControl.dataset.remove(removedFileName); $P.removeTableRow(removedFileName); } $P.removeTableRow = (removedFileName) => { - var fileListTable = document.getElementById("DataTables_Table_0--${pageName}"); + if($P.entType != ""){ + var fileListTable = $("#table-responsive--${pageName}").find("."+$P.entType).find("table"); - var targetArr = []; - if(Array.isArray(removedFileName)){ - targetArr = removedFileName; - } else { - targetArr = [removedFileName]; - } - - for(var i = 0; i < targetArr.length; i++){ - var target = targetArr[i]; - var tr = $(fileListTable).find("tbody").find("tr[data-key='"+target+"']"); - var trIndex = $(fileListTable).find("tbody tr").index(tr); - fileListTable.deleteRow(trIndex+1); + var targetArr = []; + if(Array.isArray(removedFileName)){ + targetArr = removedFileName; + } else { + targetArr = [removedFileName]; + } + + for(var i = 0; i < targetArr.length; i++){ + var target = targetArr[i]; + var tr = $(fileListTable).find("tbody").find("tr[data-key='"+target+"']"); + var trIndex = $(fileListTable).find("tbody tr").index(tr); + fileListTable.deleteRow(trIndex+1); + } } } /************************************************************************** * element.on **************************************************************************/ - $("#btnSearch--${pageName}").on("click", function(){ $P.searchFileList(); }); + $("#btnSearch--${pageName}").on("click", function(){ $P.checkFTP(); }); $("#btnFileUpload--${pageName}").on("click", function(){ $P.uploadLocalFile(); }); $("#btnInsertCrdn--${pageName}").on("click", function(){ - $P.tempGroup = Object.groupBy($P.crdnControl.dataset.getDataset(), ({ TEMP_GROUP_ID }) => "temp"+TEMP_GROUP_ID); + $P.tempGroup = Object.groupBy($P.parsedInfoControl.dataset.getDataset(), ({ TEMP_GROUP_ID }) => "temp"+TEMP_GROUP_ID); + + if($.isEmptyObject($P.tempGroup)){ + alert("처리할 자료가 없습니다."); + return; + } + $P.createCrdn(); }); $("#btnDelete--${pageName}").on("click", function(){ $P.deleteFile(); }); - $P.crdnControl.setData([]); + $P.parsedInfoControl.setData([]); }); \ No newline at end of file