장비연계파일(xit권장포맷) 단속대장 등록 기능 추가

main
이범준 1 year ago
parent b9c546c671
commit 0e2fff8283

@ -20,7 +20,9 @@ public class ParsingUtil {
if(entType.equals("hitecom")) { if(entType.equals("hitecom")) {
workPath = "files"+File.separator+"tempForHitecom"; workPath = "files"+File.separator+"tempForHitecom";
} }
if(entType.equals("xit")) {
workPath = "files"+File.separator+"tempForXit";
}
return workPath; return workPath;
} }
} }

@ -3,7 +3,6 @@ package cokr.xit.fims.crdn.parsing;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Path; import java.nio.file.Path;
@ -19,6 +18,9 @@ import cokr.xit.foundation.data.DataObject;
public class XitRecommend implements EquipmentEnterprise{ public class XitRecommend implements EquipmentEnterprise{
private DataObject before = new DataObject();
private int tempGroupSeq = 1;
@Override @Override
public List<DataObject> parsing(Stream<Path> fileList) { public List<DataObject> parsing(Stream<Path> fileList) {
@ -36,9 +38,10 @@ public class XitRecommend implements EquipmentEnterprise{
dataObject.put("FILE_PATH", filePath); dataObject.put("FILE_PATH", filePath);
String fileName = file.getName(); String fileName = file.getName();
dataObject.put("FILE_NAME", fileName); dataObject.put("FILE_NAME", fileName);
String fileExtension = FilenameUtils.getExtension(fileName);
dataObject.put("EXTENSION", fileExtension);
//TODO: boolean isMetaData = fileExtension.toUpperCase().equals("TXT");
boolean isMetaData = FilenameUtils.getExtension(fileName).toUpperCase().equals("TXT");
String[] fileNameSplit = FilenameUtils.removeExtension(fileName).split(Matcher.quoteReplacement("_")); String[] fileNameSplit = FilenameUtils.removeExtension(fileName).split(Matcher.quoteReplacement("_"));
String crdnTiemstamp = fileNameSplit[0]; String crdnTiemstamp = fileNameSplit[0];
@ -54,18 +57,53 @@ public class XitRecommend implements EquipmentEnterprise{
BufferedReader br = null; BufferedReader br = null;
try { try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),Charset.forName("EUC-KR"))); br = new BufferedReader(new InputStreamReader(new FileInputStream(file),Charset.forName("EUC-KR")));
String line1 = br.readLine();
} catch (FileNotFoundException e) { String[] lineSplit = line1.split(Matcher.quoteReplacement(","));
dataObject.put("VHRNO", lineSplit[0]);
dataObject.put("CRDN_DONG_NM", lineSplit[1]);
dataObject.put("CRDN_PLC", lineSplit[2]);
dataObject.put("LAW", lineSplit[3]);
dataObject.put("SPECIAL_AREA", lineSplit[4]);
dataObject.put("CRDN_BGNG_TM", lineSplit[5]);
dataObject.put("CRDN_END_TM", lineSplit[6]);
String line2 = br.readLine();
if(line2 != null && !line2.equals("")) {
dataObject.put("CRDN_SE_CD", "02");
dataObject.put("GPS_X", line2);
String line3 = br.readLine();
dataObject.put("GPS_Y", line3);
} else {
dataObject.put("CRDN_SE_CD", "01");
} }
//파일내용.split(Matcher.quoteReplacement(",")); } catch (Exception e) {
throw new RuntimeException(e);
}
} else { } else {
dataObject.put("VHRNO", "");
dataObject.put("CRDN_DONG_NM", "");
dataObject.put("CRDN_PLC", "");
dataObject.put("LAW", "");
dataObject.put("SPECIAL_AREA", "");
dataObject.put("CRDN_BGNG_TM", "");
dataObject.put("CRDN_END_TM", "");
dataObject.put("GPS_X", "");
dataObject.put("GPS_Y", "");
} }
if(!before.isEmpty()) {
boolean isChangeTempGroup = this.isChangeCrackdown(dataObject, before);
if(isChangeTempGroup) {
tempGroupSeq++;
}
}
dataObject.put("TEMP_GROUP_ID", tempGroupSeq);
dataObject.put("ENT_TYPE", "xit");
dataObjectList.add(dataObject); dataObjectList.add(dataObject);
before = dataObject;
}); });
return dataObjectList; return dataObjectList;
@ -115,9 +153,15 @@ public class XitRecommend implements EquipmentEnterprise{
@Override @Override
public boolean isChangeCrackdown(DataObject currentItem, DataObject beforeItem) { public boolean isChangeCrackdown(DataObject currentItem, DataObject beforeItem) {
//TODO:
String currentFileNamePrefix = currentItem.string("FILE_NAME").substring(0,25);
String beforeFileNamePrefix = beforeItem.string("FILE_NAME").substring(0,25);
if(currentFileNamePrefix.equals(beforeFileNamePrefix)) {
return false; return false;
} else {
return true;
}
} }
} }

@ -142,8 +142,61 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
crdn.setVltnCd("01"); crdn.setVltnCd("01");
} }
//XIT권장포맷
if(entType.equals("xit")) {
crdn.setCrdnInptSeCd("15");
crdn.setVltnCd("01");
//1. 연계파일정보를 단속 엔티티로 변환
crdn.setSggCd(globalStngMapper.selectSggCdForCurrentUser());
DataObject metaFileInfo = null;
for (DataObject linkFileInfo0 : linkFileInfoList) {
if(linkFileInfo0.string("EXTENSION").toUpperCase().equals("TXT")) {
metaFileInfo = linkFileInfo0;
}
}
crdn.setCrdnSeCd(metaFileInfo.string("CRDN_SE_CD"));
crdn.setCrdnYmd(metaFileInfo.string("CRDN_YMD"));
crdn.setCrdnTm(metaFileInfo.string("CRDN_TM"));
crdn.setVhrno(metaFileInfo.string("VHRNO"));
crdn.setGpsX(metaFileInfo.string("GPS_X"));
crdn.setGpsY(metaFileInfo.string("GPS_Y"));
crdn.setCrdnBgngTm(metaFileInfo.string("CRDN_BGNG_TM"));
crdn.setCrdnEndTm(metaFileInfo.string("CRDN_END_TM"));
crdn.setCrdnPlc(metaFileInfo.string("CRDN_PLC"));
if(metaFileInfo.string("SPECIAL_AREA").equals("어린이보호구역")) {
crdn.setCrdnSpareaCd("01");
} else {
crdn.setCrdnSpareaCd("00");
}
//metaFileInfo.string("LAW");
//metaFileInfo.string("EQM_CD");
//metaFileInfo.string("CRDN_DONG_NM");
List<File> files = new ArrayList<>();
for (DataObject linkFileInfo0 : linkFileInfoList) {
if(!linkFileInfo0.string("EXTENSION").toUpperCase().equals("TXT")) {
files.add(new File(linkFileInfo0.string("FILE_PATH")));
}
}
fileInfoList = new FileInfoFactory().createFileInfos(null, files);
for (int iLoop = 0; iLoop < fileInfoList.size(); iLoop++) {
fileInfoList.get(iLoop).setName("image"+iLoop+"."+FilenameUtils.getExtension(fileInfoList.get(iLoop).getName()));
}
}
// //
if(entType.equals("hitecom")) { if(entType.equals("hitecom")) {
crdn.setCrdnSeCd("07");
crdn.setCrdnInptSeCd("15"); crdn.setCrdnInptSeCd("15");
crdn.setVltnCd("01"); crdn.setVltnCd("01");

@ -87,7 +87,7 @@
<table <table
class="datatables-ajax table table-bordered dataTable no-footer"> class="datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead"> <thead class="sticky-thead">
<tr id="parsedInfoTheadTr--${pageName}"> <tr>
<th style="min-width: 80px;">단속자료</th> <th style="min-width: 80px;">단속자료</th>
<th style="min-width: 80px;" title="더블클릭시 축소/확대 됩니다." <th style="min-width: 80px;" title="더블클릭시 축소/확대 됩니다."
class="downsize" ondblclick="fnDownsizeToggle(this);" href="#"> class="downsize" ondblclick="fnDownsizeToggle(this);" href="#">
@ -132,6 +132,64 @@
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{EXTENSION}</td> <td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{EXTENSION}</td>
</tr> </tr>
</template> </template>
<template class="notFound">
<tr>
<td valign="top" colspan="17" class="dataTables_empty text-center">정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</span>
<span class="xit" hidden>
<table
class="datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead">
<tr>
<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;">파일순번</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;">단속시작시간</th>
<th style="min-width: 80px;">단속종료시간</th>
<th style="min-width: 80px;">위치좌표x</th>
<th style="min-width: 80px;">위치좌표y</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">{EXTENSION}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CRDN_YMD}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CRDN_TM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{ENT_CD}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{EQM_CD}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{FILE_SN}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{VHRNO}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CRDN_DONG_NM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{CRDN_PLC}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{LAW}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-start">{SPECIAL_AREA}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CRDN_BGNG_TM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center">{CRDN_END_TM}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{GPS_X}</td>
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-end">{GPS_Y}</td>
</tr>
</template>
<template class="notFound"> <template class="notFound">
<tr> <tr>
<td valign="top" colspan="17" class="dataTables_empty text-center">정보를 찾지 못했습니다.</td> <td valign="top" colspan="17" class="dataTables_empty text-center">정보를 찾지 못했습니다.</td>
@ -143,7 +201,7 @@
<table <table
class="datatables-ajax table table-bordered dataTable no-footer"> class="datatables-ajax table table-bordered dataTable no-footer">
<thead class="sticky-thead"> <thead class="sticky-thead">
<tr id="parsedInfoTheadTr--${pageName}"> <tr>
<th style="min-width: 80px;">단속자료</th> <th style="min-width: 80px;">단속자료</th>
<th style="min-width: 80px;" title="더블클릭시 축소/확대 됩니다." <th style="min-width: 80px;" title="더블클릭시 축소/확대 됩니다."
class="downsize" ondblclick="fnDownsizeToggle(this);" href="#"> class="downsize" ondblclick="fnDownsizeToggle(this);" href="#">
@ -232,7 +290,9 @@ $(document).ready(function(){
formats: { formats: {
CRDN_YMD_TM : datetimeFormat, CRDN_YMD_TM : datetimeFormat,
CRDN_YMD : dateFormat, CRDN_YMD : dateFormat,
CRDN_TM : timeFormat CRDN_TM : timeFormat,
CRDN_BGNG_TM : timeFormat,
CRDN_END_TM : timeFormat
} }
}); });
@ -263,10 +323,7 @@ $(document).ready(function(){
$("#table-responsive--${pageName}").find("."+$P.entType).find("tbody").setCurrentRow(dataKey); $("#table-responsive--${pageName}").find("."+$P.entType).find("tbody").setCurrentRow(dataKey);
} }
if(item.data.ENT_TYPE == "ino"){ if(item.data.ENT_TYPE == "hitecom"){
var src = item.data.FILE_PATH;
$P.renderImage(src);
} else if(item.data.ENT_TYPE == "hitecom"){
var srcArr = [ var srcArr = [
"data:image/jpg;base64,"+item.data.CAR_IMAGE, "data:image/jpg;base64,"+item.data.CAR_IMAGE,
"data:image/jpg;base64,"+item.data.PLATE_IMAGE "data:image/jpg;base64,"+item.data.PLATE_IMAGE
@ -277,6 +334,11 @@ $(document).ready(function(){
} }
$P.renderImage(srcArr); $P.renderImage(srcArr);
} else {
if(!dataKey.endsWith(".txt") && !dataKey.endsWith(".TXT")){
var src = item.data.FILE_PATH;
$P.renderImage(src);
}
} }
} }
@ -295,7 +357,6 @@ $(document).ready(function(){
|| $("#entType--${pageName}").val() == "knl" || $("#entType--${pageName}").val() == "knl"
|| $("#entType--${pageName}").val() == "gasan" || $("#entType--${pageName}").val() == "gasan"
|| $("#entType--${pageName}").val() == "elisoft" || $("#entType--${pageName}").val() == "elisoft"
|| $("#entType--${pageName}").val() == "xit"
){ ){
dialog.alert("해당 업체 연계는 현재 준비중입니다."); dialog.alert("해당 업체 연계는 현재 준비중입니다.");
return false; return false;
@ -363,13 +424,7 @@ $(document).ready(function(){
$P.parsedInfoControl.setData([]); $P.parsedInfoControl.setData([]);
if($("#entType--${pageName}").val() == "ino"){ $P.entType = $("#entType--${pageName}").val();
$P.entType = "ino";
} else if($("#entType--${pageName}").val() == "hitecom"){
$P.entType = "hitecom";
} else {
$P.entType = "";
}
$P.equipmentType = $("#equipmentType--${pageName}").val(); $P.equipmentType = $("#equipmentType--${pageName}").val();

Loading…
Cancel
Save