refactor : 버스장착형 파일업로드 메소드 위치 변경

main
이범준 1 year ago
parent 136b954c77
commit 996c4b473b

@ -1,24 +0,0 @@
package kr.xit.fims.biz.cmm.extr;
import kr.xit.fims.biz.ec.CctvCrackdownDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CctvBusInstallCrackDownFactory extends ExtrInterfaceDataFactory<CctvCrackdownDTO.Request, CctvCrackdownDTO.BusInstall>{
private CctvCrackdownDTO.BusInstall dto;
@Override
public CctvCrackdownDTO.BusInstall parseData(CctvCrackdownDTO.Request reqDto) {
return CctvCrackdownDTO.BusInstall.builder()
.carModel("dkkdkd").build();
}
}

@ -1,14 +0,0 @@
package kr.xit.fims.biz.cmm.extr;
public abstract class ExtrInterfaceDataFactory<E, T> {
//private T t;
public T parseInterfaceData(E e){
return this.parseData(e);
//return this.createDTO();
}
public abstract T parseData(E e);
//public abstract T createDTO();
}

@ -1 +0,0 @@
<mxfile host="drawio-plugin" modified="2023-01-13T03:44:27.993Z" agent="5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36" etag="JqmAsAEyE0D9sJjuU4hB" version="20.5.3" type="embed"><diagram id="q4UBqUGSLsDwTan9hy4u" name="페이지-1"><mxGraphModel dx="656" dy="482" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="2" value="ExtrInterfaceServiceStrategy" style="swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;" parent="1" vertex="1"><mxGeometry x="35" y="47.5" width="320" height="80" as="geometry"/></mxCell><mxCell id="4" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;" parent="2" vertex="1"><mxGeometry y="26" width="320" height="8" as="geometry"/></mxCell><mxCell id="5" value="+ processReglt(method: IExtrDataInterfaceMethod): void&#10;+ processErpp(method: IExtrDataInterfaceMethod): void" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontStyle=1" parent="2" vertex="1"><mxGeometry y="34" width="320" height="46" as="geometry"/></mxCell><mxCell id="26" style="edgeStyle=none;html=1;entryX=0.557;entryY=1.129;entryDx=0;entryDy=0;entryPerimeter=0;dashed=1;endArrow=block;endFill=0;" parent="1" source="14" target="23" edge="1"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="14" value="CctvCrackDown" style="swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;" parent="1" vertex="1"><mxGeometry x="500" y="260" width="180" height="100" as="geometry"/></mxCell><mxCell id="16" value="" style="line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;" parent="14" vertex="1"><mxGeometry y="26" width="180" height="8" as="geometry"/></mxCell><mxCell id="17" value="+ processReglt(): T&#10;+ processErpp(): T" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="14" vertex="1"><mxGeometry y="34" width="180" height="66" as="geometry"/></mxCell><mxCell id="20" style="edgeStyle=none;html=1;dashed=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="5" target="21" edge="1"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="21" value="IExtrStrategyService&amp;lt;T&amp;gt;&lt;br&gt;&amp;lt;&amp;lt; interface&amp;gt;&amp;gt;" style="swimlane;fontStyle=1;align=center;verticalAlign=middle;childLayout=stackLayout;horizontal=1;startSize=29;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;html=1;" parent="1" vertex="1"><mxGeometry x="500" y="47.5" width="160" height="100" as="geometry"/></mxCell><mxCell id="23" value="+ processReglt(): T&lt;br&gt;+ processErpp(): T" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="21" vertex="1"><mxGeometry y="29" width="160" height="71" as="geometry"/></mxCell></root></mxGraphModel></diagram></mxfile>

@ -1,18 +0,0 @@
package kr.xit.fims.biz.cmm.service;
import kr.xit.fims.framework.biz.cmm.XitLoginVO;
import kr.xit.fims.framework.core.utils.XitCmmnUtil;
public interface ExtrInterfaceService {
void processSave(ExtrStrategyService service);
void processReglt(ExtrStrategyService service);
void processErpp(ExtrStrategyService service);
default XitLoginVO getUserInfo(){
return XitCmmnUtil.getUserInfo();
}
}

@ -1,14 +0,0 @@
package kr.xit.fims.biz.cmm.service;
import kr.xit.fims.framework.biz.cmm.XitLoginVO;
import kr.xit.fims.framework.core.utils.XitCmmnUtil;
public interface ExtrStrategyService {
void saveInterfaceData();
void saveReglt();
void saveErpp();
default XitLoginVO getUserInfo(){
return XitCmmnUtil.getUserInfo();
}
}

@ -1,78 +0,0 @@
package kr.xit.fims.biz.cmm.service.bean;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import kr.xit.fims.biz.cmm.service.ExtrStrategyService;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.web.multipart.MultipartFile;
import kr.xit.fims.biz.ec.CctvCrackdownDTO;
import kr.xit.fims.framework.support.exception.BizRuntimeException;
import kr.xit.fims.framework.support.util.constants.MessageKey;
import lombok.Builder;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Builder
public class CctvBusInstallCrackDownServiceBean implements ExtrStrategyService {
// private final IEcCctvCrackdownMapper mapper;
// private final IEcCtznSttemntMapper ctznSttemntMapper;
//
// private final ICmmFileService cmmFileService;
private final CctvCrackdownDTO.Request reqDTO;
private final CctvCrackdownDTO.BusInstall dto;
@Override
public void saveInterfaceData() {
// 단속정보메타 1 + 이미지파일 4 = 5개로 구성
if(reqDTO.getFiles().size() % 5 != 0){
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, "단속정보[파일]가 부정확 합니다\n다시 확인해 주세요.");
}
final Comparator<MultipartFile> comp = (mf1, mf2) -> String.CASE_INSENSITIVE_ORDER.compare(mf1.getOriginalFilename(), mf2.getOriginalFilename());
List<MultipartFile> sortedFileList = reqDTO.getFiles().stream()
.sorted(comp)
.collect(Collectors.toList());
//Arrays.copyOfRange(sortedFileList.toArray(), 0, 4);
List<List<MultipartFile>> listByMd = ListUtils.partition(sortedFileList, 5);
for(int idx = 0; idx < listByMd.size(); idx++){
List<MultipartFile> mfList = listByMd.get(idx);
MultipartFile mf = mfList.get(0);
String[] txtNames = mf.getOriginalFilename().split("[.]");
if(txtNames.length != 2 || !Objects.equals("txt", txtNames[1].toLowerCase()))
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, String.format("[%s]%s", txtNames[0], "의 단속정보[파일]가 없습니다."));
//String[] mdInfos = txtNames[0].split("_");
// meta정보 read
List<String> records = new ArrayList<>();
try(InputStream inputStream = mf.getInputStream();){
records.addAll(IOUtils.readLines(inputStream, "euc-kr"));
} catch (IOException e) {
// handle exception
}
}
}
@Override
public void saveReglt() {
dto.setGpsX("xxxxxxxxx");;
}
public void saveErpp() {
dto.setGpsY("yyyyyyyyyyy");
}
}

@ -1,47 +0,0 @@
package kr.xit.fims.biz.cmm.service.bean;
import kr.xit.fims.biz.cmm.extr.CctvBusInstallCrackDownFactory;
import kr.xit.fims.biz.cmm.extr.ExtrInterfaceDataFactory;
import kr.xit.fims.biz.cmm.service.ExtrInterfaceService;
import kr.xit.fims.biz.cmm.service.ExtrStrategyService;
import kr.xit.fims.biz.ec.CctvCrackdownDTO;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class ExtrInterfaceServiceBean implements ExtrInterfaceService {
@Override
public void processSave(ExtrStrategyService service){
service.saveInterfaceData();
}
@Override
public void processReglt(ExtrStrategyService service){
service.saveReglt();
}
@Override
public void processErpp(ExtrStrategyService service){
service.saveErpp();
}
public static void main(String[] args) {
ExtrInterfaceDataFactory<CctvCrackdownDTO.Request, CctvCrackdownDTO.BusInstall> factory = new CctvBusInstallCrackDownFactory();
CctvCrackdownDTO.BusInstall dto = factory.parseInterfaceData(CctvCrackdownDTO.Request.builder().build());
log.debug("{}", dto);
ExtrInterfaceServiceBean eds = new ExtrInterfaceServiceBean();
ExtrStrategyService strategy = new CctvBusInstallCrackDownServiceBean(CctvCrackdownDTO.Request.builder().build(), dto);
eds.processSave(strategy);
log.debug("{}", dto);
eds.processReglt(strategy);
log.debug("{}", dto);
eds.processErpp(strategy);
log.debug("{}", dto);
}
}

@ -12,6 +12,7 @@ import java.util.stream.Collectors;
import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.component.AbstractServiceBean;
import kr.xit.fims.biz.ec.service.EcCctvCrackdownService; import kr.xit.fims.biz.ec.service.EcCctvCrackdownService;
import kr.xit.fims.biz.ec.util.ExtnlBusInstallInterfaceUtils;
import kr.xit.fims.framework.biz.cmm.dao.XitFrameCodeMapper; import kr.xit.fims.framework.biz.cmm.dao.XitFrameCodeMapper;
import kr.xit.fims.framework.biz.cmm.service.XitFrameCodeService; import kr.xit.fims.framework.biz.cmm.service.XitFrameCodeService;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
@ -188,7 +189,7 @@ public class EcCctvCrackdownServiceBean extends AbstractServiceBean implements E
//for(FolderReqDTO.FileInfo fi: dto.getFileInfoList()) { //for(FolderReqDTO.FileInfo fi: dto.getFileInfoList()) {
dto.getFileInfoList().forEach((fi) -> { dto.getFileInfoList().forEach((fi) -> {
CctvCrackdownDTO.BusInstall busInstallDTO = new CctvCrackdownDTO.BusInstall(); CctvCrackdownDTO.BusInstall busInstallDTO = new CctvCrackdownDTO.BusInstall();
ExtnlInterfaceUtils.parseFileBusinstallToObject(busInstallDTO, filePath + "/" + fi.getFileNm(), ExtnlBusInstallInterfaceUtils.parseFileBusinstallToObject(busInstallDTO, filePath + "/" + fi.getFileNm(),
uploadRoot + uploadTempPath); uploadRoot + uploadTempPath);
String sggCd = xitFrameCodeService.instCdToSggCd(getUserInfo().getNsttCd()); String sggCd = xitFrameCodeService.instCdToSggCd(getUserInfo().getNsttCd());

@ -0,0 +1,155 @@
package kr.xit.fims.biz.ec.util;
import kr.xit.fims.biz.ec.CctvCrackdownDTO;
import kr.xit.fims.framework.biz.util.ExtnlInterfaceUtils;
import kr.xit.fims.framework.support.exception.BizRuntimeException;
import kr.xit.fims.framework.support.util.CommUtils;
import kr.xit.fims.framework.support.util.constants.MessageKey;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
public class ExtnlBusInstallInterfaceUtils {
/**
* <pre>
* parsing
* @param dto CctvCrackdownDTO.BusInstall DTO
* @param fullFilePath full file path info
* @param tempDir directory
* </pre>
*/
public static void parseFileBusinstallToObject(CctvCrackdownDTO.BusInstall dto, final String fullFilePath, final String tempDir) {
String tempPath = tempDir + "/" + CommUtils.getStringFromUUID();
try(RandomAccessFile raf = new RandomAccessFile(fullFilePath,"r")) {
long fileSize = raf.length();
byte[] buff = null;
long pos = 0;
// 텍스트size : 1 ~ 7(7)
dto.setTextSize(ExtnlInterfaceUtils.readBuff(raf, pos, 7));
pos += 7;
// 단속장비 : 8 ~ 12(5)
dto.setRegltEquip(ExtnlInterfaceUtils.readBuff(raf, pos, 5));
pos += 5;
// 차량속도 : 13 ~ 15(3)
dto.setCarSpeed(ExtnlInterfaceUtils.readBuff(raf, pos, 3));
pos += 3;
// 차종 : 16 ~ 16(1) - 미사용
dto.setCarModel(ExtnlInterfaceUtils.readBuff(raf, pos, 1));
pos += 1;
// 도로코드 : 17 ~ 17(1) - 미사용
dto.setRoadCode(ExtnlInterfaceUtils.readBuff(raf, pos, 1));
pos += 1;
// 단속일자 : 18 ~ 25(8)
dto.setCrdnYmd(ExtnlInterfaceUtils.readBuff(raf, pos, 8));
pos += 8;
// 단속시간 : 26 ~ 31(6)
dto.setRegltTime(ExtnlInterfaceUtils.readBuff(raf, pos, 6));
pos += 6;
// 차량번호 : 32 ~ 43(12)
dto.setVhrno(ExtnlInterfaceUtils.readBuff(raf, pos, 12, "euc-kr"));
pos += 12;
// 번호판 X 좌표 : 44 ~ 47(4)
dto.setCarNumXPos(ExtnlInterfaceUtils.readBuff(raf, pos, 4));
pos += 4;
// 번호판 Y 좌표 : 48 ~ 51(4)
dto.setCarNumYPos(ExtnlInterfaceUtils.readBuff(raf, pos, 4));
pos += 4;
// 번호판 Width : 52 ~ 55(4)
dto.setCarNumWidth(ExtnlInterfaceUtils.readBuff(raf, pos, 4));
pos += 4;
// 번호판 Height : 56 ~ 59(4)
dto.setCarNumHeight(ExtnlInterfaceUtils.readBuff(raf, pos, 4));
pos += 4;
// (미사용) : 60 ~ 60(1)
dto.setSkipFld(ExtnlInterfaceUtils.readBuff(raf, pos, 1));
pos += 1;
// 위반구분(미사용) : 61 ~ 61(1)
dto.setVioltDiv(ExtnlInterfaceUtils.readBuff(raf, pos, 1));
pos += 1;
// 위반종류(미사용) : 62 ~ 62(1)
dto.setVioltKind(ExtnlInterfaceUtils.readBuff(raf, pos, 1));
pos += 1;
// GPS X 좌표 : 62 ~ 84(23)
dto.setGpsX(ExtnlInterfaceUtils.readBuff(raf, pos, 23));
pos += 23;
// GPS Y 좌표 : 85 ~ 107(23)
dto.setGpsY(ExtnlInterfaceUtils.readBuff(raf, pos, 23));
pos += 23;
// 사진매수(미사용) : 108 ~ 109(2)
dto.setImgCnt(ExtnlInterfaceUtils.readBuff(raf, pos, 2));
pos += 2;
// tlcType(미사용) : 110 ~ 110(1)
dto.setTlcType(ExtnlInterfaceUtils.readBuff(raf, pos, 1));
pos += 1;
// movingType(미사용) : 111 ~ 111(1)
dto.setMovingType(ExtnlInterfaceUtils.readBuff(raf, pos, 1));
pos += 1;
// tlcColor(미사용) : 112 ~ 112(1)
dto.setTlcColor(ExtnlInterfaceUtils.readBuff(raf, pos, 1));
pos += 1;
// car image
int imgSize = Integer.parseInt(ExtnlInterfaceUtils.readBuff(raf, pos, 7));
pos += 7;
dto.getBusinstallImgList().add(ExtnlInterfaceUtils.getImgMultipartFile(raf, pos, imgSize, "car.jpg", tempPath));
pos += imgSize;
// plate image : car number
imgSize = Integer.parseInt(ExtnlInterfaceUtils.readBuff(raf, pos, 7));
pos += 7;
dto.getBusinstallImgList().add(ExtnlInterfaceUtils.getImgMultipartFile(raf, pos, imgSize, "carNum.jpg", tempPath));
pos += imgSize;
// moving image
int idx = 1;
do{
imgSize = Integer.parseInt(ExtnlInterfaceUtils.readBuff(raf, pos, 7));
pos += 7;
dto.getBusinstallImgList().add(ExtnlInterfaceUtils.getImgMultipartFile(raf, pos, imgSize, String.format("%s%d%s","moving", idx, ".jpg"), tempPath));
pos += imgSize;
idx++;
} while(fileSize > pos);
//FIXME: moving image수 체크 : 불필요 하면 삭제
// dto.getImgCnt() - moving image count 이므로, car image and carNum image (2개) 제외한 수량으로 check
if(Integer.parseInt(dto.getImgCnt()) != dto.getBusinstallImgList().size() - 2){
String errMsg = String.format("버스장착형 단속이미지 정보[이미지수: %d, 실제이미지: %d]가 부정확 합니다[%s]", Integer.parseInt(dto.getImgCnt()), dto.getBusinstallImgList().size() - 2, fullFilePath);
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, errMsg);
}
}catch(IOException e){
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, e.getMessage());
}finally {
File f = new File(tempPath);
if(f.exists()) {
//noinspection ResultOfMethodCallIgnored
f.delete();
}
}
}
}

@ -25,146 +25,7 @@ import java.util.List;
@Slf4j @Slf4j
public class ExtnlInterfaceUtils { public class ExtnlInterfaceUtils {
/**
* <pre>
* parsing
* @param dto CctvCrackdownDTO.BusInstall DTO
* @param fullFilePath full file path info
* @param tempDir directory
* </pre>
*/
public static void parseFileBusinstallToObject(CctvCrackdownDTO.BusInstall dto, final String fullFilePath, final String tempDir) {
String tempPath = tempDir + "/" + CommUtils.getStringFromUUID();
try(RandomAccessFile raf = new RandomAccessFile(fullFilePath,"r")) {
long fileSize = raf.length();
byte[] buff = null;
long pos = 0;
// 텍스트size : 1 ~ 7(7)
dto.setTextSize(readBuff(raf, pos, 7));
pos += 7;
// 단속장비 : 8 ~ 12(5)
dto.setRegltEquip(readBuff(raf, pos, 5));
pos += 5;
// 차량속도 : 13 ~ 15(3)
dto.setCarSpeed(readBuff(raf, pos, 3));
pos += 3;
// 차종 : 16 ~ 16(1) - 미사용
dto.setCarModel(readBuff(raf, pos, 1));
pos += 1;
// 도로코드 : 17 ~ 17(1) - 미사용
dto.setRoadCode(readBuff(raf, pos, 1));
pos += 1;
// 단속일자 : 18 ~ 25(8)
dto.setCrdnYmd(readBuff(raf, pos, 8));
pos += 8;
// 단속시간 : 26 ~ 31(6)
dto.setRegltTime(readBuff(raf, pos, 6));
pos += 6;
// 차량번호 : 32 ~ 43(12)
dto.setVhrno(readBuff(raf, pos, 12, "euc-kr"));
pos += 12;
// 번호판 X 좌표 : 44 ~ 47(4)
dto.setCarNumXPos(readBuff(raf, pos, 4));
pos += 4;
// 번호판 Y 좌표 : 48 ~ 51(4)
dto.setCarNumYPos(readBuff(raf, pos, 4));
pos += 4;
// 번호판 Width : 52 ~ 55(4)
dto.setCarNumWidth(readBuff(raf, pos, 4));
pos += 4;
// 번호판 Height : 56 ~ 59(4)
dto.setCarNumHeight(readBuff(raf, pos, 4));
pos += 4;
// (미사용) : 60 ~ 60(1)
dto.setSkipFld(readBuff(raf, pos, 1));
pos += 1;
// 위반구분(미사용) : 61 ~ 61(1)
dto.setVioltDiv(readBuff(raf, pos, 1));
pos += 1;
// 위반종류(미사용) : 62 ~ 62(1)
dto.setVioltKind(readBuff(raf, pos, 1));
pos += 1;
// GPS X 좌표 : 62 ~ 84(23)
dto.setGpsX(readBuff(raf, pos, 23));
pos += 23;
// GPS Y 좌표 : 85 ~ 107(23)
dto.setGpsY(readBuff(raf, pos, 23));
pos += 23;
// 사진매수(미사용) : 108 ~ 109(2)
dto.setImgCnt(readBuff(raf, pos, 2));
pos += 2;
// tlcType(미사용) : 110 ~ 110(1)
dto.setTlcType(readBuff(raf, pos, 1));
pos += 1;
// movingType(미사용) : 111 ~ 111(1)
dto.setMovingType(readBuff(raf, pos, 1));
pos += 1;
// tlcColor(미사용) : 112 ~ 112(1)
dto.setTlcColor(readBuff(raf, pos, 1));
pos += 1;
// car image
int imgSize = Integer.parseInt(readBuff(raf, pos, 7));
pos += 7;
dto.getBusinstallImgList().add(getImgMultipartFile(raf, pos, imgSize, "car.jpg", tempPath));
pos += imgSize;
// plate image : car number
imgSize = Integer.parseInt(readBuff(raf, pos, 7));
pos += 7;
dto.getBusinstallImgList().add(getImgMultipartFile(raf, pos, imgSize, "carNum.jpg", tempPath));
pos += imgSize;
// moving image
int idx = 1;
do{
imgSize = Integer.parseInt(readBuff(raf, pos, 7));
pos += 7;
dto.getBusinstallImgList().add(getImgMultipartFile(raf, pos, imgSize, String.format("%s%d%s","moving", idx, ".jpg"), tempPath));
pos += imgSize;
idx++;
} while(fileSize > pos);
//FIXME: moving image수 체크 : 불필요 하면 삭제
// dto.getImgCnt() - moving image count 이므로, car image and carNum image (2개) 제외한 수량으로 check
if(Integer.parseInt(dto.getImgCnt()) != dto.getBusinstallImgList().size() - 2){
String errMsg = String.format("버스장착형 단속이미지 정보[이미지수: %d, 실제이미지: %d]가 부정확 합니다[%s]", Integer.parseInt(dto.getImgCnt()), dto.getBusinstallImgList().size() - 2, fullFilePath);
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, errMsg);
}
}catch(IOException e){
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, e.getMessage());
}finally {
File f = new File(tempPath);
if(f.exists()) {
//noinspection ResultOfMethodCallIgnored
f.delete();
}
}
}
/** /**
* null, NtriDTO.PhotoFileError return * null, NtriDTO.PhotoFileError return
@ -307,7 +168,7 @@ public class ExtnlInterfaceUtils {
return null; return null;
} }
private static String readBuff(RandomAccessFile raf, Long startPos, int readLength){ public static String readBuff(RandomAccessFile raf, Long startPos, int readLength){
try { try {
raf.seek(startPos); raf.seek(startPos);
byte[] buff = new byte[readLength]; byte[] buff = new byte[readLength];
@ -319,7 +180,7 @@ public class ExtnlInterfaceUtils {
} }
private static String readBuff(RandomAccessFile raf, long startPos, int readLength, String encoding){ public static String readBuff(RandomAccessFile raf, long startPos, int readLength, String encoding){
try { try {
raf.seek(startPos); raf.seek(startPos);
byte[] buff = new byte[readLength]; byte[] buff = new byte[readLength];
@ -331,7 +192,7 @@ public class ExtnlInterfaceUtils {
} }
private static MultipartFile getImgMultipartFile(RandomAccessFile raf, long startPos, int imgSize, String imgName, String tempPath){ public static MultipartFile getImgMultipartFile(RandomAccessFile raf, long startPos, int imgSize, String imgName, String tempPath){
try { try {
raf.seek(startPos); raf.seek(startPos);
byte[] buff = new byte[imgSize]; byte[] buff = new byte[imgSize];
@ -344,9 +205,6 @@ public class ExtnlInterfaceUtils {
} }
public static void main(String[] args) {
}
} }

Loading…
Cancel
Save