버스장착형cctv 연계 파일정보 조회 기능 추가

main
이범준 1 year ago
parent f7c9378afd
commit 5605d7236f

@ -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

@ -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<DataObject> parsing(Stream<Path> 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);
});

@ -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;
});

@ -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]);

@ -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;
@ -47,7 +48,9 @@ public class Crdn05Controller extends ApplicationController {
getTodayCrdnDataList = "/010/list.do",
getFileRegistrationScreen = "/020/info.do",
getCrdnFileListFromEquipmentEnterprise = "/020/list.do",
importFileFromServer = "/020/importFileFromServer",
importFileFromClient = "/020/importFileFromClient",
getEquipmentFileInfoList = "/020/list.do",
removeLinkFile = "/020/remove.do",
createCrdnByLinkFile = "/020/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,11 +141,7 @@ public class Crdn05Controller extends ApplicationController {
String downloadRoot = ""; //ftp나 usb에서 다운받는 파일 경로
if(entType.equals("INO") || entType.equals("KNL")) {
//ftp G클라우드
try {
if(entType.equals("INO")) {
//RemoteSystemInfo rs = new RemoteSystemInfo();
@ -158,18 +158,98 @@ public class Crdn05Controller extends ApplicationController {
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;
}
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";
}
//boolean result = FTPUtil.fileDown(rs, remoteWorkPath, downloadRoot);
} catch (Exception e) {
e.printStackTrace();
//TODO :
mav.addObject("saved", saved);
return mav;
}
/**, .
* @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;
}
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";
}
try {

@ -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) {

@ -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 {}

@ -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);
}

@ -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) {

@ -51,9 +51,9 @@
<input type="file" id="localFile--${pageName}" name="localFile" />
</c:if>
<span class="justify-content-end float-end me-4">
<c:if test="${taskSeCd == 'ECA' or taskSeCd == 'DPV'}">
<button type="button" id="btnSearch--${pageName}" class="btn btn-primary">조회</button>
</c:if>
<c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV' or taskSeCd == '미세먼지'}">
<button type="button" id="btnFileUpload--${pageName}" class="btn btn-primary">등록</button>
</c:if>
@ -65,13 +65,13 @@
</div>
</div>
<div class="d-flex flex-row justify-content-evenly">
<div class="card my-4 px-4" style="max-width:700px;height:600px;">
<div class="card my-4 px-4" style="min-width:700px;max-width:700px;height:600px;">
<form id="frmGrid--${pageName}">
<div>
<span class="container-page-btn">
<div class="d-flex flex-row justify-content-between">
<label id="crdnPaging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="crdnPaging--${pageName}" class="pagination pagination-primary">
<label id="parsedInfoPaging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="parsedInfoPaging--${pageName}" class="pagination pagination-primary">
</ul>
</div>
<span class="container-window-btn-right">
@ -82,17 +82,18 @@
<div id="DataTables_Table_0_wrapper--${pageName}" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div id="table-responsive--${pageName}" class="table-responsive"
style="overflow-x: scroll;height:560px;overflow-y: scroll;">
<table id="DataTables_Table_0--${pageName}"
<span class="ino" hidden>
<table
class="datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead">
<tr id="crdnTheadTr--${pageName}">
<tr id="parsedInfoTheadTr--${pageName}">
<th style="min-width: 80px;">단속자료</th>
<th style="min-width: 80px;" title="더블클릭시 축소/확대 됩니다."
class="downsize" ondblclick="fnDownsizeToggle(this);" href="#">
파일명 <i class='bx bx-expand'></i>
</th>
<th style="min-width: 80px;">타임스탬프</th>
<th style="min-width: 80px;">사이즈</th>
<th style="min-width: 80px;">단속자료</th>
<th style="min-width: 80px;">디바이스ID</th>
<th style="min-width: 80px;">날짜/시간</th>
<th style="min-width: 80px;">차량번호</th>
@ -107,22 +108,22 @@
<th style="min-width: 80px;">파일확장자</th>
</tr>
</thead>
<tbody id="crdnTbody--${pageName}"></tbody>
<template id="crdnRow--${pageName}">
<tbody></tbody>
<template class="found">
<tr data-key="{FILE_NAME}">
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{TEMP_GROUP_ID}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}"
title="{FILE_NAME}"
class="text-start text-truncate max-w-th">{FILE_NAME}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{TIMESTAMP}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{FILE_SIZE}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{TEMP_GROUP_ID}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{DEVICE_ID}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{CRDN_YMD_TM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{VHRNO}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{PHOTO_CNT}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{PHOTO_CNT}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{PHOTO_SEQ_NM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{LOCATION_X}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{LOCATION_Y}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{LOCATION_X}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{LOCATION_Y}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{INPUT_SE}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{CRDN_PLC}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{CRDN_ADDRESS}</td>
@ -130,19 +131,71 @@
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{EXTENSION}</td>
</tr>
</template>
<template id="crdnNotFound--${pageName}">
<template class="notFound">
<tr>
<td valign="top" colspan="17" class="dataTables_empty text-center">정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</span>
<span class="hitecom" hidden>
<table
class="datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead">
<tr id="parsedInfoTheadTr--${pageName}">
<th style="min-width: 80px;">단속자료</th>
<th style="min-width: 80px;" title="더블클릭시 축소/확대 됩니다."
class="downsize" ondblclick="fnDownsizeToggle(this);" href="#">
파일명 <i class='bx bx-expand'></i>
</th>
<th style="min-width: 80px;">장비번호</th>
<th style="min-width: 80px;">차량속도</th>
<th style="min-width: 80px;">날짜</th>
<th style="min-width: 80px;">시간</th>
<th style="min-width: 80px;">차량번호</th>
<th style="min-width: 80px;">번호판위치x</th>
<th style="min-width: 80px;">번호판위치y</th>
<th style="min-width: 80px;">번호판width</th>
<th style="min-width: 80px;">번호판height</th>
<th style="min-width: 80px;">위치좌표x</th>
<th style="min-width: 80px;">위치좌표y</th>
<th style="min-width: 80px;">총사진갯수</th>
</tr>
</thead>
<tbody></tbody>
<template class="found">
<tr data-key="{FILE_NAME}">
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{TEMP_GROUP_ID}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}"
title="{FILE_NAME}"
class="text-start text-truncate max-w-th">{FILE_NAME}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{EQUIPMENT}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CAR_VELOCITY}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{CRDN_YMD}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{CRDN_TM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{VHRNO}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{MOSC_X}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{MOSC_Y}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{PLATE_WIDTH}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{PLATE_HEIGHT}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{GPS_X}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{GPS_Y}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{PHOTO_CNT}</td>
</tr>
</template>
<template class="notFound">
<tr>
<td valign="top" colspan="17" class="dataTables_empty text-center">정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</span>
</div>
</div>
</div>
</form>
</div>
<div class="card my-4 px-4 justify-content-center" style="width:600px;height:600px;">
<img id="img--${pageName}" src="" style="object-fit:contain;" />
<div id="imageArea--${pageName}" class="card my-4 px-4 justify-content-center" style="width:600px;height:600px;">
</div>
<div class="card my-4 px-2" style="width:120px;height:600px;min-width:120px;">
@ -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,15 +251,32 @@ $(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);
}
}
};
@ -210,7 +284,8 @@ $(document).ready(function(){
* pageObject.function
**************************************************************************/
$P.searchFileList = () => {
//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.searchFileList = () => {
$P.parsedInfoControl.setData([]);
if($("#entType--${pageName}").val() == "INO"){
$P.entType = "ino";
} else if($("#entType--${pageName}").val() == "HITECOM"){
$P.entType = "hitecom";
} else {
$P.entType = "";
}
$("#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.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;
//테이블 렌더링
$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}'].clickCrdnList('" + dataItem.getValue("FILE_NAME") + "');");
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickParsedInfoList('" + dataItem.getValue("FILE_NAME") + "');");
var trs = empty ? notFound : crdnList.inStrings(found,replacer);
var trs = empty ? notFound : parsedInfoList.inStrings(found,replacer);
$("#crdnTbody--${pageName}").html(trs.join());
$("#table-responsive--${pageName}").find("."+entType).find("tbody").html(trs.join());
if(!empty){
fnDownsizeCheck(document.getElementById("DataTables_Table_0--${pageName}"));
fnDownsizeCheck($("#table-responsive--${pageName}").find("."+entType).find("table")[0]);
}
}
}
//사진 표시
$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.clickCrdnList = (dataKey) => {
$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,12 +498,13 @@ $(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)){
@ -369,23 +520,30 @@ $(document).ready(function(){
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([]);
});
</script>
Loading…
Cancel
Save