연계파일(버스장착형cctv) 단속대장 등록 기능 추가

main
이범준 1 year ago
parent 80b53d0a8d
commit b9c546c671

@ -152,7 +152,7 @@ public class FTPUtil {
}
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException();
throw new RuntimeException(e);
}
// 커서 이동에 실패하면 false를 리턴한다.

@ -1,17 +1,20 @@
package cokr.xit.fims.crdn.parsing;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.InputStream;
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.Decoder;
import java.util.Base64.Encoder;
import java.util.List;
import java.util.stream.Stream;
import cokr.xit.base.file.FileInfo;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.foundation.data.DataObject;
@ -44,11 +47,10 @@ public class HiteCom implements EquipmentEnterprise {
String fileCn = "";
try {
fileCn = new String(fileCn0.getBytes("ISO-8859-1"), "EUC-KR");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (Exception e) {
throw new RuntimeException(e);
}
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+", "")); //차량속도
@ -122,8 +124,8 @@ public class HiteCom implements EquipmentEnterprise {
}
tempGroupSeq++;
dataObject.put("TEMP_GROUP_ID", tempGroupSeq);
tempGroupSeq++;
dataObject.put("ENT_TYPE", "hitecom");
dataObjectList.add(dataObject);
@ -137,4 +139,22 @@ public class HiteCom implements EquipmentEnterprise {
return true;
}
public static FileInfo base64ToFileInfo(String fileName, String base64str, int sortOrder) {
try {
Decoder decoder = Base64.getDecoder();
byte[] b64byte = decoder.decode(base64str.getBytes("ISO-8859-1"));
InputStream is = new ByteArrayInputStream(b64byte);
FileInfo fileInfo = new FileInfo();
fileInfo.setName(fileName+".jpg");
fileInfo.setInputStream(is);
fileInfo.setMimeType("image/jpeg");
fileInfo.setSize(is.available());
fileInfo.setSortOrder(sortOrder);
return fileInfo;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}

@ -368,7 +368,7 @@ public class CrdnBean extends AbstractComponent {
//빈 디렉토리 삭제
CmmnUtil.deleteEmptyDir(new File("files"+File.separator+"tempForIno"), false);
} catch (Exception e) {
throw new RuntimeException();
throw new RuntimeException(e);
}
return saved;

@ -19,6 +19,7 @@ import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.base.file.web.FileInfoFactory;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.crdn.parsing.HiteCom;
import cokr.xit.fims.crdn.service.CrdnService;
import cokr.xit.fims.crdn.service.ImportService;
import cokr.xit.foundation.component.AbstractServiceBean;
@ -91,6 +92,7 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
List<FileInfo> fileInfoList = new ArrayList<FileInfo>();
//
if(entType.equals("ino")) {
crdn.setCrdnInptSeCd("11");
@ -133,14 +135,62 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
}
//
if(entType.equals("knl")) {
crdn.setCrdnInptSeCd("12");
crdn.setVltnCd("01");
}
//
if(entType.equals("hitecom")) {
crdn.setCrdnInptSeCd("15");
crdn.setVltnCd("01");
//1. 연계파일정보를 단속 엔티티로 변환
if(linkFileInfoList.size() != 1) {
resultMap.put("saved", false);
resultMap.put("failReason", "그룹핑 오류");
return resultMap;
}
DataObject linkFileInfo = linkFileInfoList.get(0);
crdn.setSggCd(globalStngMapper.selectSggCdForCurrentUser());
crdn.setVhrno(linkFileInfo.string("VHRNO"));
crdn.setCrdnYmd(linkFileInfo.string("CRDN_YMD"));
crdn.setCrdnTm(linkFileInfo.string("CRDN_TM"));
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("EQUIPMENT");
//linkFileInfo.string("PLATE_WIDTH");
//linkFileInfo.string("PLATE_HEIGHT");
try {
FileInfo FileInfo1 = HiteCom.base64ToFileInfo(linkFileInfo.string("CAR_IMAGE_NM"), linkFileInfo.string("CAR_IMAGE"), 1);
fileInfoList.add(FileInfo1);
FileInfo FileInfo2 = HiteCom.base64ToFileInfo(linkFileInfo.string("PLATE_IMAGE_NM"), linkFileInfo.string("PLATE_IMAGE"), 2);
fileInfoList.add(FileInfo2);
int otherPhotoCnt = linkFileInfo.number("PHOTO_CNT").intValue() - 2;
for(int i=1; i <= otherPhotoCnt; i++){
String fileName = linkFileInfo.string("MOVING_IMAGE"+i+"_NM");
String b64str = linkFileInfo.string("MOVING_IMAGE"+i);
FileInfo FileInfo = HiteCom.base64ToFileInfo(fileName, b64str, i + 2);
fileInfoList.add(FileInfo);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
//2. 차적 조회
List<Crdn> crdns = new ArrayList<Crdn>();
crdns.add(crdn);

@ -292,8 +292,10 @@ public class Crdn05Controller extends ApplicationController {
List<DataObject> linkFileInfoList = new ArrayList<DataObject>();
for(String linkFileInfo : linkFileInfos) {
if(!linkFileInfo.equals("{}")) {
linkFileInfoList.add(fromJson(linkFileInfo, DataObject.class));
}
}
Map<String, String> processInfo = new HashMap<String,String>();
processInfo.put("institute", institute);

@ -460,6 +460,9 @@ $(document).ready(function(){
formData.append("taskSeCd", "${taskSeCd}");
formData.append("entType", $P.entType);
formData.append("equipmentType", $("#equipmentType--${pageName}").val());
if($P.tempGroup[firstGroupKey].length == 1){
formData.append("linkFileInfos", JSON.stringify({}));
}
for(var i=0; i<$P.tempGroup[firstGroupKey].length; i++){
formData.append("linkFileInfos", JSON.stringify($P.tempGroup[firstGroupKey][i]));
}
@ -520,7 +523,7 @@ $(document).ready(function(){
$P.removeTableRow = (removedFileName) => {
if($P.entType != ""){
var fileListTable = $("#table-responsive--${pageName}").find("."+$P.entType).find("table");
var fileListTable = $("#table-responsive--${pageName}").find("."+$P.entType).find("table")[0];
var targetArr = [];
if(Array.isArray(removedFileName)){

Loading…
Cancel
Save