feat: tui-grid 페이징 처리시 rowNum 순차적 증가 적용

main
minuk926 2 years ago
parent 3a16f2e686
commit cf52e20ebe

@ -0,0 +1,30 @@
package kr.xit.fims.biz.cmm.extr;
import kr.xit.fims.biz.ec.model.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 CctvBusOnlyCrackDownFactory extends ExtrInterfaceDataFactory<CctvCrackdownDTO.Request, CctvCrackdownDTO.BusOnly>{
private CctvCrackdownDTO.BusOnly dto;
@Override
public CctvCrackdownDTO.BusOnly parseData(CctvCrackdownDTO.Request reqDto) {
return CctvCrackdownDTO.BusOnly.builder()
.carModel("dkkdkd").build();
}
// @Override
// public CctvCrackdownDTO.BusOnly createDTO() {
// return CctvCrackdownDTO.BusOnly.builder()
// .carModel("dkkdkd").build();
// }
}

@ -0,0 +1,93 @@
package kr.xit.fims.biz.cmm.extr;
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 org.apache.commons.collections4.ListUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.web.multipart.MultipartFile;
import kr.xit.fims.biz.ec.model.CctvCrackdownDTO;
import kr.xit.framework.support.exception.BizRuntimeException;
import kr.xit.framework.support.util.constants.MessageKey;
import lombok.Builder;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Builder
public class CctvBusOnlyCrackDownService implements IExtrStrategyService {
// private final IEcCctvCrackdownMapper mapper;
// private final IEcCtznSttemntMapper ctznSttemntMapper;
//
// private final ICmmFileService cmmFileService;
private final CctvCrackdownDTO.Request reqDTO;
private final CctvCrackdownDTO.BusOnly 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
}
// data set
// CctvCrackdownDTO.ExtrlRegltCntc extrRegltDTO = getExtrlRegltCntcDTO(txtNames[0], records);
// extrRegltDTO.setSysCode(getUserInfo().getOrgnztId());
// extrRegltDTO.setInsttCode(getUserInfo().getPstinstCode());
//
// if(records.size() >= 3){
// extrRegltDTO.setRegltSeCode(FimsConst.RegltSeCode.CCTV_DRV.getCode());
// }else{
// extrRegltDTO.setRegltSeCode(FimsConst.RegltSeCode.CCTV_FIX.getCode());
// }
// // 외부연계 데이타 생성
// //mapper.insertEcExtrlRegltCntc(extrRegltDTO);
//
// // CCTV image 저장
// List<MultipartFile> cpListMf = new ArrayList<>(mfList);
// cpListMf.remove(0);
// cmmFileService.saveFiles(getFileMst(extrRegltDTO.getRegltSeCode(), extrRegltDTO.getExtrlRegltCntcId()), cpListMf);
}
}
@Override
public void saveReglt() {
dto.setGpsX("xxxxxxxxx");;
}
public void saveErpp() {
dto.setGpsY("yyyyyyyyyyy");
}
}

@ -0,0 +1,14 @@
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();
}

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

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

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

@ -0,0 +1 @@
<mxfile host="drawio-plugin" modified="2023-01-12T05:59:52.357Z" agent="5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36" etag="ggNsjQ_OsLNwSKLSfTPj" version="20.5.3" type="embed"><diagram id="q4UBqUGSLsDwTan9hy4u" name="페이지-1"><mxGraphModel dx="1053" dy="502" 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="IExtrInterfaceMethod&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>
Loading…
Cancel
Save