|
|
@ -90,201 +90,234 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
|
|
|
|
Crdn crdn = new Crdn();
|
|
|
|
Crdn crdn = new Crdn();
|
|
|
|
crdn.setCrdnRegSeCd("07");
|
|
|
|
crdn.setCrdnRegSeCd("07");
|
|
|
|
crdn.setTaskSeCd(taskSeCd);
|
|
|
|
crdn.setTaskSeCd(taskSeCd);
|
|
|
|
|
|
|
|
crdn.setSggCd(globalStngMapper.selectSggCdForCurrentUser());
|
|
|
|
|
|
|
|
|
|
|
|
List<FileInfo> fileInfoList = new ArrayList<FileInfo>();
|
|
|
|
Map<String, Object> dividedInfo = this.divideInformation(linkFileInfoList, fileGroupType);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
DataObject metaFileInfo = (DataObject) dividedInfo.get("metaInfo");
|
|
|
|
if(fileGroupType.equals("JPG")) {
|
|
|
|
List<DataObject> imageFileInfoList = (List<DataObject>) dividedInfo.get("imageInfo");
|
|
|
|
|
|
|
|
DataObject bgngData = (DataObject) dividedInfo.get("bgngData");
|
|
|
|
|
|
|
|
DataObject endData = (DataObject) dividedInfo.get("endData");
|
|
|
|
|
|
|
|
|
|
|
|
//1. 연계파일정보를 단속 엔티티로 변환
|
|
|
|
//1. 연계파일정보를 단속 엔티티로 변환
|
|
|
|
DataObject bgngData = linkFileInfoList.stream()
|
|
|
|
this.crdnTimeRangeSet(crdn, bgngData, endData);
|
|
|
|
.min(Comparator.comparing(item -> new BigInteger(item.string("CRDN_TIMESTAMP"))))
|
|
|
|
|
|
|
|
.orElseThrow();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DataObject endData = linkFileInfoList.stream()
|
|
|
|
|
|
|
|
.max(Comparator.comparing(item -> new BigInteger(item.string("CRDN_TIMESTAMP"))))
|
|
|
|
|
|
|
|
.orElseThrow();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crdn.setCrdnBgngTm(bgngData.string("CRDN_TM"));
|
|
|
|
|
|
|
|
crdn.setCrdnEndTm(endData.string("CRDN_TM"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DataObject linkFileInfo = endData;
|
|
|
|
String entType = metaFileInfo.string("LINK_ENT_NM");
|
|
|
|
|
|
|
|
|
|
|
|
String entType = linkFileInfo.string("LINK_ENT_NM");
|
|
|
|
|
|
|
|
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
|
|
|
|
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
|
|
|
|
else if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
|
|
|
|
else if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
|
|
|
|
else crdn.setCrdnInptSeCd("15");
|
|
|
|
else crdn.setCrdnInptSeCd("15");
|
|
|
|
|
|
|
|
|
|
|
|
crdn.setCrdnInptSeCd("11");
|
|
|
|
|
|
|
|
|
|
|
|
if(metaFileInfo.string("VLTN_CD").equals("")) {
|
|
|
|
crdn.setVltnCd("01");
|
|
|
|
crdn.setVltnCd("01");
|
|
|
|
crdn.setSggCd(globalStngMapper.selectSggCdForCurrentUser());
|
|
|
|
} else {
|
|
|
|
crdn.setVhrno(linkFileInfo.string("VHRNO"));
|
|
|
|
crdn.setVltnCd(metaFileInfo.string("VLTN_CD"));
|
|
|
|
crdn.setCrdnYmd(linkFileInfo.string("CRDN_YMD"));
|
|
|
|
}
|
|
|
|
crdn.setCrdnTm(linkFileInfo.string("CRDN_TM"));
|
|
|
|
if(metaFileInfo.string("CRDN_SPAREA_CD").equals("")) {
|
|
|
|
crdn.setGpsX(linkFileInfo.string("GPS_X"));
|
|
|
|
crdn.setCrdnSpareaCd("00");
|
|
|
|
crdn.setGpsY(linkFileInfo.string("GPS_Y"));
|
|
|
|
} else {
|
|
|
|
crdn.setCrdnStdgNm(linkFileInfo.string("CRDN_STDG_NM"));
|
|
|
|
crdn.setCrdnSpareaCd(metaFileInfo.string("CRDN_SPAREA_CD"));
|
|
|
|
crdn.setCrdnPlc(linkFileInfo.string("CRDN_PLC"));
|
|
|
|
}
|
|
|
|
crdn.setCrdnRoadNm(linkFileInfo.string("CRDN_ROAD_NM"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//linkFileInfo.string("EQPMNT_CD");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<File> files = new ArrayList<>();
|
|
|
|
crdn.setVhrno(metaFileInfo.string("VHRNO"));
|
|
|
|
for (DataObject linkFileInfo0 : linkFileInfoList) {
|
|
|
|
crdn.setCrdnYmd(metaFileInfo.string("CRDN_YMD"));
|
|
|
|
files.add(new File(linkFileInfo0.string("FILE_PATH")));
|
|
|
|
crdn.setCrdnTm(metaFileInfo.string("CRDN_TM"));
|
|
|
|
|
|
|
|
if(crdn.getCrdnBgngTm() == null) {
|
|
|
|
|
|
|
|
crdn.setCrdnBgngTm(metaFileInfo.string("CRDN_BGNG_TM"));
|
|
|
|
|
|
|
|
crdn.setCrdnEndTm(metaFileInfo.string("CRDN_END_TM"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fileInfoList = new FileInfoFactory().createFileInfos(null, files);
|
|
|
|
crdn.setGpsX(metaFileInfo.string("GPS_X"));
|
|
|
|
for (int iLoop = 0; iLoop < fileInfoList.size(); iLoop++) {
|
|
|
|
crdn.setGpsY(metaFileInfo.string("GPS_Y"));
|
|
|
|
fileInfoList.get(iLoop).setName("image"+iLoop+"."+FilenameUtils.getExtension(fileInfoList.get(iLoop).getName()));
|
|
|
|
crdn.setCrdnPlc(metaFileInfo.string("CRDN_PLC"));
|
|
|
|
}
|
|
|
|
crdn.setCrdnRoadNm(metaFileInfo.string("CRDN_ROAD_NM"));
|
|
|
|
|
|
|
|
crdn.setCrdnStdgNm(metaFileInfo.string("CRDN_STDG_NM"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
crdn.setCrdnSeCd(metaFileInfo.string("CRDN_SE_CD"));
|
|
|
|
|
|
|
|
crdn.setMoscX(metaFileInfo.string("MOSC_X"));
|
|
|
|
|
|
|
|
crdn.setMoscY(metaFileInfo.string("MOSC_Y"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//metaFileInfo.string("EQPMNT_CD");
|
|
|
|
|
|
|
|
//metaFileInfo.string("PLATE_WIDTH");
|
|
|
|
|
|
|
|
//metaFileInfo.string("PLATE_HEIGHT");
|
|
|
|
|
|
|
|
|
|
|
|
//XIT권장포맷
|
|
|
|
List<FileInfo> fileInfoList = this.parsedDataInfoToFileInfo(imageFileInfoList, fileGroupType);
|
|
|
|
if(fileGroupType.equals("TXT")) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//1. 연계파일정보를 단속 엔티티로 변환
|
|
|
|
|
|
|
|
crdn.setSggCd(globalStngMapper.selectSggCdForCurrentUser());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DataObject metaFileInfo = null;
|
|
|
|
//2. 차적 조회
|
|
|
|
for (DataObject linkFileInfo0 : linkFileInfoList) {
|
|
|
|
List<Crdn> crdns = new ArrayList<Crdn>();
|
|
|
|
if(linkFileInfo0.string("FILE_EXTENSION").toUpperCase().equals("TXT")) {
|
|
|
|
crdns.add(crdn);
|
|
|
|
metaFileInfo = linkFileInfo0;
|
|
|
|
importBean.setVehicleInfo(crdns);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String entType = metaFileInfo.string("LINK_ENT_NM");
|
|
|
|
|
|
|
|
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
|
|
|
|
|
|
|
|
else if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
|
|
|
|
|
|
|
|
else crdn.setCrdnInptSeCd("15");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crdn.setVltnCd("01");
|
|
|
|
//3.등록
|
|
|
|
|
|
|
|
saved = crdnBean.create(null, crdn, fileInfoList);
|
|
|
|
|
|
|
|
|
|
|
|
crdn.setCrdnSeCd(metaFileInfo.string("CRDN_SE_CD"));
|
|
|
|
resultMap.put("saved", saved);
|
|
|
|
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("CRDN_SPAREA_NM").equals("어린이보호구역")) {
|
|
|
|
if(saved) {
|
|
|
|
crdn.setCrdnSpareaCd("01");
|
|
|
|
for(DataObject delInfo : linkFileInfoList) {
|
|
|
|
} else {
|
|
|
|
crdnBean.removeEquipmentLinkFile(workPath, delInfo.string("FILE_NAME"));
|
|
|
|
crdn.setCrdnSpareaCd("00");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
crdn.setCrdnStdgNm(metaFileInfo.string("CRDN_STDG_NM"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//metaFileInfo.string("VLTN_NM");
|
|
|
|
if(!ifEmpty(crdn.getErsrRegYmd(), () -> "").equals("")) {
|
|
|
|
//metaFileInfo.string("EQPMNT_CD");
|
|
|
|
String vhrno = crdn.getVhrno();
|
|
|
|
|
|
|
|
String ersrRegYmd = crdn.getErsrRegYmd();
|
|
|
|
|
|
|
|
String ersrYear = ersrRegYmd.substring(0, 4);
|
|
|
|
|
|
|
|
String ersrMonth = ersrRegYmd.substring(4, 6);
|
|
|
|
|
|
|
|
String ersrDay = ersrRegYmd.substring(6, 8);
|
|
|
|
|
|
|
|
|
|
|
|
List<File> files = new ArrayList<>();
|
|
|
|
String alertMessage = vhrno + " : " + ersrYear + "년" + ersrMonth + "월" + ersrDay + "일로 말소된 차량입니다.";
|
|
|
|
for (DataObject linkFileInfo0 : linkFileInfoList) {
|
|
|
|
resultMap.put("alertMessage", alertMessage);
|
|
|
|
if(!linkFileInfo0.string("FILE_EXTENSION").toUpperCase().equals("TXT")) {
|
|
|
|
|
|
|
|
files.add(new File(linkFileInfo0.string("FILE_PATH")));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fileInfoList = new FileInfoFactory().createFileInfos(null, files);
|
|
|
|
} else {
|
|
|
|
for (int iLoop = 0; iLoop < fileInfoList.size(); iLoop++) {
|
|
|
|
resultMap.put("failReason", "기타 오류");
|
|
|
|
fileInfoList.get(iLoop).setName("image"+iLoop+"."+FilenameUtils.getExtension(fileInfoList.get(iLoop).getName()));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
if(fileGroupType.equals("BIN")) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//1. 연계파일정보를 단속 엔티티로 변환
|
|
|
|
/**파싱된 데이터 목록을 메타정보, 이미지정보목록, 최초단속자료, 최종단속자료로 분리한다. <br />
|
|
|
|
if(linkFileInfoList.size() != 1) {
|
|
|
|
* @param linkFileInfoList 연계파일정보목록, fileGroupType 연계파일그룹형식
|
|
|
|
resultMap.put("saved", false);
|
|
|
|
* @return 메타정보, 이미지정보목록, 최초단속자료, 최종단속자료
|
|
|
|
resultMap.put("failReason", "그룹핑 오류");
|
|
|
|
*/
|
|
|
|
return resultMap;
|
|
|
|
public Map<String,Object> divideInformation(List<DataObject> linkFileInfoList, String fileGroupType) {
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<String, Object>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DataObject metaFileInfo = null;
|
|
|
|
|
|
|
|
List<DataObject> imageFileInfoList = new ArrayList<DataObject>();
|
|
|
|
|
|
|
|
DataObject[] bgngAndEnd = {null, null};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(fileGroupType.equals("TXT")) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (DataObject linkFileInfo : linkFileInfoList) {
|
|
|
|
|
|
|
|
if(linkFileInfo.string("FILE_EXTENSION").toUpperCase().equals("TXT")) {
|
|
|
|
|
|
|
|
metaFileInfo = linkFileInfo;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
imageFileInfoList.add(linkFileInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DataObject linkFileInfo = linkFileInfoList.get(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String entType = linkFileInfo.string("LINK_ENT_NM");
|
|
|
|
bgngAndEnd = getBgngDataAndEndData(imageFileInfoList);
|
|
|
|
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
|
|
|
|
|
|
|
|
else if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
|
|
|
|
|
|
|
|
else crdn.setCrdnInptSeCd("15");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if(fileGroupType.equals("JPG")){
|
|
|
|
|
|
|
|
|
|
|
|
crdn.setVltnCd("01");
|
|
|
|
imageFileInfoList = linkFileInfoList;
|
|
|
|
|
|
|
|
|
|
|
|
crdn.setCrdnSeCd("07");
|
|
|
|
bgngAndEnd = getBgngDataAndEndData(linkFileInfoList);
|
|
|
|
|
|
|
|
|
|
|
|
crdn.setSggCd(globalStngMapper.selectSggCdForCurrentUser());
|
|
|
|
if(bgngAndEnd[1] == null) {
|
|
|
|
crdn.setVhrno(linkFileInfo.string("VHRNO"));
|
|
|
|
metaFileInfo = linkFileInfoList.get(0);
|
|
|
|
crdn.setCrdnYmd(linkFileInfo.string("CRDN_YMD"));
|
|
|
|
} else {
|
|
|
|
crdn.setCrdnTm(linkFileInfo.string("CRDN_TM"));
|
|
|
|
metaFileInfo = bgngAndEnd[1];
|
|
|
|
crdn.setGpsX(linkFileInfo.string("GPS_X"));
|
|
|
|
}
|
|
|
|
crdn.setGpsY(linkFileInfo.string("GPS_Y"));
|
|
|
|
|
|
|
|
crdn.setMoscX(linkFileInfo.string("MOSC_X"));
|
|
|
|
|
|
|
|
crdn.setMoscY(linkFileInfo.string("MOSC_Y"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//linkFileInfo.string("EQPMNT_CD");
|
|
|
|
|
|
|
|
//linkFileInfo.string("PLATE_WIDTH");
|
|
|
|
|
|
|
|
//linkFileInfo.string("PLATE_HEIGHT");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
} else if(fileGroupType.equals("BIN")) {
|
|
|
|
FileInfo FileInfo1 = SingleFileParser.base64ToFileInfo(linkFileInfo.string("CAR_IMAGE_NM"), linkFileInfo.string("CAR_IMAGE"), 1);
|
|
|
|
|
|
|
|
fileInfoList.add(FileInfo1);
|
|
|
|
metaFileInfo = linkFileInfoList.get(0);
|
|
|
|
FileInfo FileInfo2 = SingleFileParser.base64ToFileInfo(linkFileInfo.string("PLATE_IMAGE_NM"), linkFileInfo.string("PLATE_IMAGE"), 2);
|
|
|
|
|
|
|
|
fileInfoList.add(FileInfo2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int otherPhotoCnt = linkFileInfo.number("PHOTO_CNT").intValue() - 2;
|
|
|
|
int otherPhotoCnt = metaFileInfo.number("PHOTO_CNT").intValue();
|
|
|
|
for(int i=1; i <= otherPhotoCnt; i++){
|
|
|
|
for(int i=1; i <= otherPhotoCnt; i++){
|
|
|
|
String fileName = linkFileInfo.string("MOVING_IMAGE"+i+"_NM");
|
|
|
|
String fileName = metaFileInfo.string("B64IMAGE"+i+"_NM");
|
|
|
|
String b64str = linkFileInfo.string("MOVING_IMAGE"+i);
|
|
|
|
String b64str = metaFileInfo.string("B64IMAGE"+i);
|
|
|
|
FileInfo FileInfo = SingleFileParser.base64ToFileInfo(fileName, b64str, i + 2);
|
|
|
|
DataObject dataObject = new DataObject();
|
|
|
|
fileInfoList.add(FileInfo);
|
|
|
|
dataObject.put("B64IMAGE_NM", fileName);
|
|
|
|
|
|
|
|
dataObject.put("B64IMAGE", b64str);
|
|
|
|
|
|
|
|
imageFileInfoList.add(dataObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
} else {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.put("metaInfo", metaFileInfo);
|
|
|
|
|
|
|
|
result.put("imageInfo", imageFileInfoList);
|
|
|
|
|
|
|
|
result.put("bgngData", bgngAndEnd[0]);
|
|
|
|
|
|
|
|
result.put("endData", bgngAndEnd[1]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**단속이미지정보 목록 내에서 최초단속자료와 최종단속자료를 반환한다. 단속일시 정보가 없을 경우 null을 반환한다. <br />
|
|
|
|
|
|
|
|
* @param imageDataList 단속이미지정보 목록
|
|
|
|
|
|
|
|
* @return 최초단속자료, 최종단속자료
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public DataObject[] getBgngDataAndEndData(List<DataObject> imageDataList) {
|
|
|
|
|
|
|
|
DataObject[] bgngAndEnd = {null, null};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!imageDataList.get(0).get("CRDN_TIMESTAMP").equals("")) {
|
|
|
|
|
|
|
|
|
|
|
|
//2. 차적 조회
|
|
|
|
DataObject bgngData = imageDataList.stream()
|
|
|
|
List<Crdn> crdns = new ArrayList<Crdn>();
|
|
|
|
.min(Comparator.comparing(item -> new BigInteger(item.string("CRDN_TIMESTAMP"))))
|
|
|
|
crdns.add(crdn);
|
|
|
|
.orElseThrow();
|
|
|
|
importBean.setVehicleInfo(crdns);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DataObject endData = imageDataList.stream()
|
|
|
|
|
|
|
|
.max(Comparator.comparing(item -> new BigInteger(item.string("CRDN_TIMESTAMP"))))
|
|
|
|
|
|
|
|
.orElseThrow();
|
|
|
|
|
|
|
|
|
|
|
|
//3.등록
|
|
|
|
bgngAndEnd[0] = bgngData;
|
|
|
|
saved = crdnBean.create(null, crdn, fileInfoList);
|
|
|
|
bgngAndEnd[1] = endData;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resultMap.put("saved", saved);
|
|
|
|
return bgngAndEnd;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(saved) {
|
|
|
|
/**최초단속정보와 최종단속정보를 기준으로 단속대장의 최초단속시간과 최종단속시간을 설정한다. <br />
|
|
|
|
for(DataObject delInfo : linkFileInfoList) {
|
|
|
|
* @param crdn 단속대장, bgngData 최초단속자료, endData 최종단속자료
|
|
|
|
crdnBean.removeEquipmentLinkFile(workPath, delInfo.string("FILE_NAME"));
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void crdnTimeRangeSet(Crdn crdn, DataObject bgngData, DataObject endData) {
|
|
|
|
|
|
|
|
if(bgngData != null && endData != null) {
|
|
|
|
|
|
|
|
if(!endData.string("CRDN_BGNG_TM").equals("")) {
|
|
|
|
|
|
|
|
crdn.setCrdnBgngTm(endData.string("CRDN_BGNG_TM"));
|
|
|
|
|
|
|
|
crdn.setCrdnEndTm(endData.string("CRDN_END_TM"));
|
|
|
|
|
|
|
|
} else if(!endData.string("CRDN_TM").equals("")){
|
|
|
|
|
|
|
|
crdn.setCrdnBgngTm(bgngData.string("CRDN_TM"));
|
|
|
|
|
|
|
|
crdn.setCrdnEndTm(endData.string("CRDN_TM"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!ifEmpty(crdn.getErsrRegYmd(), () -> "").equals("")) {
|
|
|
|
/**단속이미지정보를 List<FileInfo>로 변환한다. <br />
|
|
|
|
String vhrno = crdn.getVhrno();
|
|
|
|
* @param imageFileInfoList 단속이미지정보 목록, fileGroupType 연계파일그룹형식
|
|
|
|
String ersrRegYmd = crdn.getErsrRegYmd();
|
|
|
|
* @return fileInfo리스트
|
|
|
|
String ersrYear = ersrRegYmd.substring(0, 4);
|
|
|
|
*/
|
|
|
|
String ersrMonth = ersrRegYmd.substring(4, 6);
|
|
|
|
public List<FileInfo> parsedDataInfoToFileInfo(List<DataObject> imageFileInfoList, String fileGroupType){
|
|
|
|
String ersrDay = ersrRegYmd.substring(6, 8);
|
|
|
|
List<FileInfo> fileInfoList = new ArrayList<FileInfo>();
|
|
|
|
|
|
|
|
|
|
|
|
String alertMessage = vhrno + " : " + ersrYear + "년" + ersrMonth + "월" + ersrDay + "일로 말소된 차량입니다.";
|
|
|
|
try {
|
|
|
|
resultMap.put("alertMessage", alertMessage);
|
|
|
|
//이미지, 이미지및텍스트
|
|
|
|
|
|
|
|
if(fileGroupType.equals("JPG") || fileGroupType.equals("TXT")) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<File> files = new ArrayList<>();
|
|
|
|
|
|
|
|
for (DataObject imageFileInfo : imageFileInfoList) {
|
|
|
|
|
|
|
|
files.add(new File(imageFileInfo.string("FILE_PATH")));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
fileInfoList = new FileInfoFactory().createFileInfos(null, files);
|
|
|
|
resultMap.put("failReason", "기타 오류");
|
|
|
|
for (int iLoop = 0; iLoop < fileInfoList.size(); iLoop++) {
|
|
|
|
|
|
|
|
fileInfoList.get(iLoop).setName("image"+iLoop+"."+FilenameUtils.getExtension(fileInfoList.get(iLoop).getName()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return resultMap;
|
|
|
|
} else if(fileGroupType.equals("BIN")) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(int i=0; i < imageFileInfoList.size(); i++){
|
|
|
|
|
|
|
|
String fileName = imageFileInfoList.get(i).string("B64IMAGE_NM");
|
|
|
|
|
|
|
|
String b64str = imageFileInfoList.get(i).string("B64IMAGE");
|
|
|
|
|
|
|
|
FileInfo FileInfo = SingleFileParser.base64ToFileInfo(fileName, b64str, (i+1));
|
|
|
|
|
|
|
|
fileInfoList.add(FileInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return fileInfoList;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|