장비업체(이노) 단속파일정보 파싱 및 조회 기능 추가

main
이범준 1 year ago
parent 790e550326
commit b8e3d219b4

@ -1,13 +1,21 @@
package cokr.xit.fims.crdn.web; 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.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
@ -98,10 +106,82 @@ public class Crdn05Controller extends ApplicationController {
List<DataObject> dataObjectList = new ArrayList<>(); List<DataObject> dataObjectList = new ArrayList<>();
String downloadRoot = "";
if(entType.equals("이노")) { 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; return mav;

@ -2,184 +2,277 @@
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="pageKorName" scope="request">단속 파일 등록</c:set> <c:set var="pageKorName" scope="request">단속 파일 등록</c:set>
<div class="d-flex" style="flex-flow:column"> <div class="d-flex" style="flex-flow:column">
<div class="card" style="max-width:1400px;height:100px;"> <div class="d-flex flex-row justify-content-evenly">
<form id="frmFirst--${pageName}"> <div class="card" style="width:1400px;height:100px;">
<div class="row g-1"> <form id="frmFirst--${pageName}">
<div class="col-md-4"> <div class="row g-1">
<label for="taskSeCd--${pageName}" <div class="col-md-4">
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">과태료업무</label> <label for="taskSeCd--${pageName}"
<select id="taskSeCd--${pageName}" name="taskSeCd" class="form-select" disabled> class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">과태료업무</label>
<c:forEach items="${FIM054List}" var="item"> <select id="taskSeCd--${pageName}" name="taskSeCd" class="form-select" disabled>
<option value="${item.code}" <c:forEach items="${FIM054List}" var="item">
<c:if test="${item.code eq taskSeCd}"> selected="selected" </c:if> <option value="${item.code}"
>${item.value}</option> <c:if test="${item.code eq taskSeCd}"> selected="selected" </c:if>
</c:forEach> >${item.value}</option>
</select> </c:forEach>
</div>
<div class="col-md-4">
<label for="entType--${pageName}"
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">장비업체</label>
<select id="entType--${pageName}" name="entType" class="form-select">
<option value="">선택하세요</option>
<option value="KNL">KNL</option>
<option value="이노">이노</option>
<option value="가산정보통신">가산정보통신</option>
<option value="앨리소프트">엘리소프트</option>
<option value="하이테콤">하이테콤</option>
</select>
</div>
<div class="col-md-4">
<c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV'}">
<label for="cctvType--${pageName}"
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">cctv 구분</label>
<select id="cctvType--${pageName}" name="cctvType" class="form-select">
<option value="">선택</option>
<option value="고정형">고정형</option>
<option value="주행형">주행형</option>
<option value="버스장착형">버스장착형</option>
</select> </select>
</c:if> </div>
</div>
<c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV' or taskSeCd == '미세먼지'}">
<div class="col-md-4"> <div class="col-md-4">
<label for="localFile--${pageName}" <label for="entType--${pageName}"
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">파일</label> class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">장비업체</label>
<input type="file" id="localFile--${pageName}" name="localFile" /> <select id="entType--${pageName}" name="entType" class="form-select">
<option value="">선택하세요</option>
<option value="KNL">KNL</option>
<option value="이노">이노</option>
<option value="가산정보통신">가산정보통신</option>
<option value="앨리소프트">엘리소프트</option>
<option value="하이테콤">하이테콤</option>
</select>
</div> </div>
</c:if> <div class="col-md-4">
</div> <c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV'}">
<label for="cctvType--${pageName}"
<div class="row mt-4 justify-content-end mb-3"> class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">cctv 구분</label>
<div class="col-md-6"> <select id="cctvType--${pageName}" name="cctvType" class="form-select">
<div class="row justify-content-end"> <option value="">선택</option>
<div class="col-sm-3"> <option value="고정형">고정형</option>
<c:if test="${taskSeCd == 'ECA' or taskSeCd == 'DPV'}"> <option value="주행형">주행형</option>
<button type="button" id="btnSearch--${pageName}" class="btn btn-primary">조회</button> <option value="버스장착형">버스장착형</option>
</c:if> </select>
<c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV' or taskSeCd == '미세먼지'}"> </c:if>
<button type="button" id="btnFileUpload--${pageName}" class="btn btn-primary">등록</button> </div>
</c:if> <c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV' or taskSeCd == '미세먼지'}">
<div class="col-md-4">
<label for="localFile--${pageName}"
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">파일</label>
<input type="file" id="localFile--${pageName}" name="localFile" />
</div>
</c:if>
</div>
<div class="row mt-4 justify-content-end mb-3">
<div class="col-md-6">
<div class="row justify-content-end">
<div class="col-sm-3">
<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>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </form>
</form> </div>
</div> </div>
<div class="card" style="max-width:1400px;height:300px;"> <div class="d-flex flex-row justify-content-evenly">
<form id="frmGrid--${pageName}"> <div class="card my-4 px-4" style="max-width:700px;height:600px;">
<div class="card-datatable text-nowrap"> <form id="frmGrid--${pageName}">
<div id="DataTables_Table_0_wrapper--${pageName}" class="dataTables_wrapper dt-bootstrap5 no-footer"> <div>
<div id="table-responsive--${pageName}" class="table-responsive" <span class="container-page-btn">
style="overflow-x: scroll;height:298px;overflow-y: scroll;"> <div class="d-flex flex-row justify-content-between">
<table id="DataTables_Table_0--${pageName}" <label id="crdnPaging--${pageName}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
class="datatables-ajax table table-bordered dataTable no-footer"> <ul id="crdnPaging--${pageName}" class="pagination pagination-primary">
<thead> </ul>
<tr id="crdnTheadTr--${pageName}"> </div>
<th style="min-width: 50px;">No.</th> <span class="container-window-btn-right">
<th style="min-width: 80px;">파일명</th> </span>
<th style="min-width: 80px;">타임스탬프</th> </span>
<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>
<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;">입력구분</th>
<th style="min-width: 80px;">location</th>
<th style="min-width: 80px;">address</th>
<th style="min-width: 80px;">법정동</th>
<th style="min-width: 80px;">파일확장자</th>
</tr>
</thead>
<tbody id="crdnTbody--${pageName}"></tbody>
<template id="crdnRow--${pageName}">
<tr data-key="{CRDN_ID}">
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{순번}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{파일명}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{타임스탬프}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{사이즈}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{디바이스ID}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{날짜/시간}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{차량번호}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{총사진갯수}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{사진시퀀스}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{위치좌표X}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{위치좌표Y}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{입력구분}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{address}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{법정동}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{파일확장자}</td>
</tr>
</template>
<template id="crdnNotFound--${pageName}">
<tr>
<td valign="top" colspan="16" class="dataTables_empty text-center">정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
</div> </div>
</div> <div class="card-datatable text-nowrap">
</form> <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}"
class="datatables-ajax table table-bordered dataTable no-footer">
<thead>
<tr id="crdnTheadTr--${pageName}">
<th style="min-width: 80px;"
class="downsize" ondblclick="fnDownsizeToggle(this);">파일명</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>
<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;">입력구분</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>
</tr>
</thead>
<tbody id="crdnTbody--${pageName}"></tbody>
<template id="crdnRow--${pageName}">
<tr data-key="{FILE_NAME}">
<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">{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-start">{PHOTO_SEQ}</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-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>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{CRDN_STDG_NM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{EXTENSION}</td>
</tr>
</template>
<template id="crdnNotFound--${pageName}">
<tr>
<td valign="top" colspan="16" class="dataTables_empty text-center">정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</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>
<div class="card my-4 px-2" style="width:100px;height:600px;">
<div class="d-flex my-2" style="flex-flow:column">
<button type="button" class="btn btn-primary my-2">부과등록</button>
<button type="button" class="btn btn-primary my-2">삭제</button>
</div>
</div>
</div> </div>
</div> </div>
<script> <script>
pageObject["${pageName}"] = {};
$("#btnSearch--${pageName}").on("click", function(){ $(document).ready(function(){
if($("#entType--${pageName}").val() == ""){
dialog.alert("장비업체를 선택하세요."); var $P = pageObject["${pageName}"];
return;
}
if($("#entType--${pageName}").val() != "KNL" && $("#entType--${pageName}").val() != "이노"){ /**************************************************************************
dialog.alert("해당 과태료 업무와 관련된 장비업체가 아닙니다."); * DatasetControl
return; **************************************************************************/
} $P.crdnControl = new DatasetControl({
urls : { },
keymapper : info => info ? info.FILE_NAME : "",
dataGetter : obj => obj["List"],
formats: {
CRDN_YMD_TM : datetimeFormat
}
});
if($("#entType--${pageName}").val() == "KNL"){ /**************************************************************************
dialog.alert("KNL 파일 등록 기능은 서비스 준비 중입니다."); * DatasetControl.on
} **************************************************************************/
$P.crdnControl.onDatasetChange = (obj) => {
$P.renderCrdnList(obj["Total"]);
$("#crdnPaging--${pageName}").setPagingInfo({
list: $P.crdnControl.dataset,
prefix: "crdnPaging--${pageName}",
start: obj["Start"],
totalSize: obj["Total"],
fetchSize: obj["Fetch"],
func: ""
});
};
if($("#entType--${pageName}").val() == "이노"){ /**************************************************************************
* pageObject.function
**************************************************************************/
$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());
if(!empty){
fnDownsizeCheck(document.getElementById("DataTables_Table_0--${pageName}"));
}
} }
ajax.post({ $P.clickCrdnList = (dataKey) => {
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/list.do"), if(dataKey == ""){
data : { entType : $("#entType--${pageName}").val() }, return;
success : (resp) => {
} }
$("#crdnTbody--${pageName}").setCurrentRow(dataKey);
var url = $P.crdnControl.dataset.getData(dataKey).FILE_PATH;
$("#img--${pageName}").attr("src",url);
};
/**************************************************************************
* element.on
**************************************************************************/
$("#btnSearch--${pageName}").on("click", function(){
if($("#entType--${pageName}").val() == ""){
dialog.alert("장비업체를 선택하세요.");
return;
}
if($("#entType--${pageName}").val() != "KNL" && $("#entType--${pageName}").val() != "이노"){
dialog.alert("해당 과태료 업무와 관련된 장비업체가 아닙니다.");
return;
}
if($("#entType--${pageName}").val() == "KNL"){
dialog.alert("KNL 파일 등록 기능은 서비스 준비 중입니다.");
return;
}
ajax.post({
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/list.do"),
data : { entType : $("#entType--${pageName}").val() },
success : (resp) => {
$("#img--${pageName}").attr("src","");
$P.crdnControl.setData(resp);
}
});
}); });
});
$("#btnFileUpload--${pageName}").on("click", function(){ $("#btnFileUpload--${pageName}").on("click", function(){
if($("#entType--${pageName}").val() == ""){ if($("#entType--${pageName}").val() == ""){
dialog.alert("장비업체를 선택하세요."); dialog.alert("장비업체를 선택하세요.");
return; return;
} }
if($("#entType--${pageName}").val() != "가산정보통신" if($("#entType--${pageName}").val() != "가산정보통신"
&& $("#entType--${pageName}").val() != "엘리소프트" && $("#entType--${pageName}").val() != "엘리소프트"
&& $("#entType--${pageName}").val() != "하이테콤" && $("#entType--${pageName}").val() != "하이테콤"
){ ){
dialog.alert("해당 과태료 업무와 관련된 장비업체가 아닙니다."); dialog.alert("해당 과태료 업무와 관련된 장비업체가 아닙니다.");
return; return;
} }
if($("#localFile--${pageName}").val() == ""){ if($("#localFile--${pageName}").val() == ""){
dialog.alert("파일이 없습니다."); dialog.alert("파일이 없습니다.");
return;
}
dialog.alert("주정차,전용차로,미세먼지 과태료 파일 등록 기능은 서비스 준비 중입니다.");
return; return;
} });
dialog.alert("주정차,전용차로,미세먼지 과태료 파일 등록 기능은 서비스 준비 중입니다.");
return;
}); });
</script> </script>
Loading…
Cancel
Save