diff --git a/src/main/java/kr/xit/fims/biz/FimsConst.java b/src/main/java/kr/xit/fims/biz/FimsConst.java index 6f6da552..84d20ac5 100644 --- a/src/main/java/kr/xit/fims/biz/FimsConst.java +++ b/src/main/java/kr/xit/fims/biz/FimsConst.java @@ -21,6 +21,9 @@ public class FimsConst { @AllArgsConstructor public enum FileJobSeCode { NATL_NEWS_PAPER_RCV("NATL_NEWS_PAPER_RCV", "민원심사-국민신문고") + ,BUS_ONLY("BUS_ONLY", "버스전용차로-버스장착형CCTV") + ,CCTV_FIX("CCTV_FIX", "cctv-고정형") + ,CCTV_DRV("CCTV_DRV", "cctv-주행형") ,CMM_BOARD("CMM_BOARD???", "공지사항???") ; @@ -88,8 +91,11 @@ public class FimsConst { */ @Getter @AllArgsConstructor - public enum RegltSeCode { + public enum PkPrefix { CTZ("CTZ", "민원-시민신고(국민신문고)") + ,BOC("BOC", "버스장착형CCTV") + ,CFV("CFV", "고정형CCTV(CCTV-FIX)") + ,CDV("CDV", "주행형CCTV(CCTV-DRV)") ; private final String code; diff --git a/src/main/java/kr/xit/fims/biz/ec/mapper/IEcCctvCrackdownMapper.java b/src/main/java/kr/xit/fims/biz/ec/mapper/IEcCctvCrackdownMapper.java new file mode 100644 index 00000000..7705c2c7 --- /dev/null +++ b/src/main/java/kr/xit/fims/biz/ec/mapper/IEcCctvCrackdownMapper.java @@ -0,0 +1,45 @@ +package kr.xit.fims.biz.ec.mapper; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.session.RowBounds; + +import egovframework.rte.psl.dataaccess.mapper.Mapper; +import kr.xit.fims.biz.ec.model.CctvCrackdownDTO; + +@Mapper +public interface IEcCctvCrackdownMapper { + List selectEcExtrlRegltCntcs(final Map paraMap, final RowBounds rowBounds); + CctvCrackdownDTO.ExtrlRegltCntc selectEcExtrlRegltCntc(final String extrlRegltCntcId); + // List selectEcCtznSttemntDetails(final CtznStmtDTO.Request dto); + // CtznStmtDTO.CtznStmtDtl selectEcCtznSttemntDetail(final CtznStmtDTO.Request dto); + // + int insertEcExtrlRegltCntc(final CctvCrackdownDTO.ExtrlRegltCntc dto); + // + // int insertEcCtznSttemntDetail(final CtznStmtDTO.CtznStmtDtl dtl); + // int updateEcCtznSttemntDetail(final CtznStmtDTO.CtznStmtDtl dtl); + // int deleteEcCtznSttemntDetail(final CtznStmtDTO.CtznStmtDtl dtl); + // + // + // List selectCtznSttemnts(final Map paraMap, final RowBounds rowBounds); + // + // + // //----------------------------------------------------- + // // 단속자료 생성 - 단속 처리 + // //----------------------------------------------------- + // void insertRtRegltFromCtznStmt(final CtznStmtDTO.Request dto); + // //----------------------------------------------------- + // // 단속자료 생성 - 서손 처리 + // //----------------------------------------------------- + // void insertRtErppFromCtznStmt(final CtznStmtDTO.Request dto); + // + // void updateStatusAndRegltIdOfEcCtznSttemntDetail(final CtznStmtDTO.Request dto); + // + // int dragAndDropSaveImg(CmmFileDTO.FileDtl vo); + // + // int dragAndDropDeleteImg(CmmFileDTO.FileDtl vo); + // + // + // List dragAndDropIsExists(CmmFileDTO.FileDtl vo); +} diff --git a/src/main/java/kr/xit/fims/biz/ec/model/CctvCrackdownDTO.java b/src/main/java/kr/xit/fims/biz/ec/model/CctvCrackdownDTO.java new file mode 100644 index 00000000..d3d29bb4 --- /dev/null +++ b/src/main/java/kr/xit/fims/biz/ec/model/CctvCrackdownDTO.java @@ -0,0 +1,490 @@ +package kr.xit.fims.biz.ec.model; + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.io.Serializable; +import java.util.List; + +import org.springframework.web.multipart.MultipartFile; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import kr.xit.framework.support.util.CommUtils; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +public class CctvCrackdownDTO { + + @Getter + @Setter + @NoArgsConstructor + @AllArgsConstructor + @Builder + public static class BusOnly { + + // 텍스트size : 1 ~ 7(7) + private String textSize; + + // 단속장비 : 8 ~ 12(5) + private String regltEquip; + + // 차량속도 : 13 ~ 15(3) + private String carSpeed; + + // 차종 : 16 ~ 16(1) - 미사용 + private String carModel; + + // 도로코드 : 17 ~ 17(1) - 미사용 + private String roadCode; + + // 단속일자 : 18 ~ 25(8) + private String regltDe; + + // 단속시간 : 26 ~ 31(6) + private String regltTime; + + // 차량번호 : 32 ~ 43(12) + private String vhcleNo; + + // 번호판 X 좌표 : 44 ~ 47(4) + private String carNumXPos; + + // 번호판 Y 좌표 : 48 ~ 51(4) + private String carNumYPos; + + // 번호판 Width : 52 ~ 55(4) + private String carNumWidth; + + // 번호판 Height : 56 ~ 59(4) + private String carNumHeight; + + // (미사용) : 60 ~ 60(1) + private String skipFld; + + // 위반구분(미사용) : 61 ~ 61(1) + private String violtDiv; + + // 위반종류(미사용) : 62 ~ 62(1) + private String violtKind; + + // GPS X 좌표 : 62 ~ 84(23) + private String gpsX; + + // GPS Y 좌표 : 85 ~ 107(23) + private String gpsY; + + // 사진매수(미사용) : 108 ~ 109(2) + private String imgCnt; + + // tlcType(미사용) : 110 ~ 110(1) + private String tlcType; + + // movingType(미사용) : 111 ~ 111(1) + private String movingType; + + // tlcColor(미사용) : 112 ~ 112(1) + private String tlcColor; + } + + @Getter + @Setter + @NoArgsConstructor + @AllArgsConstructor + @Builder + public static class ExtrlRegltCntc implements Serializable { + private static final long serialVersionUID = 1L; + + // 외부 단속 연계 id + private String extrlRegltCntcId; + private String regltId; + private String insttCode; + private String sysCode; + private String regltSeCode; + private String inputSeCode; + private String vhcleNo; + private String regltDe; + private String regltBeginTime; + private String regltEndTime; + private String regltDongNm; + private String regltPlace; + private String regltSpeclZoneNm; + private String regltEntrpsCode; + private String regltEqpmnManageNo; + private String violtDtlsNm; + private String gpsX; + private String gpsY; + private String extrlRegltCntcProcessSttus; + private String cntcFileNm; + private String cntcPhotoFileNm1; + private String cntcPhotoFileNm2; + private String cntcPhotoFileNm3; + private String cntcPhotoFileNm4; + private String registDt; + private String register; + private String updtDt; + private String updusr; + private String deleteAt; + private String deleteResn; + private String deleteDt; + private String dltr; + + private String pkPrefix; + } + + + @Getter + @Setter + @NoArgsConstructor + @AllArgsConstructor + @Builder + public static class Request { + private String fileMastrId; + + /** + * 파일업무분류구분코드(ex. Board) + */ + private String jobSeCode; + + /** + * 파일업무ID(example = "BOARD001") + * DB pk값 - 파일분류구분코드 + 파일업무ID로 식별 가능 + */ + private String fileJobId; + + private String register; + private String extrlRegltCntcId; + + /** + * 업로드 파일 객체 + */ + @JsonIgnore + private List files; + } + + public static void main(String[] args) throws IOException { + + //String path = "D:\\project_data\\fims\\01. 연계\\02. CCTV\\CCTV 샘플자료\\버스전용차로\\2017072013474126.F0001"; + String path = "D:\\project_data\\fims\\01. 연계\\02. CCTV\\CCTV 샘플자료\\버스전용차로\\2017072013465031.F0002"; + + RandomAccessFile raf = new RandomAccessFile(path,"r"); + long fileSize = raf.length(); + System.out.println("fileSize="+fileSize); + long pos = 0; //뒤로 부터 + // while(true) { + // raf.seek(pos); //파일 포인터 이동 + // if(raf.readByte()=='\n') { //해당 위치의 바이트를 읽어 \n 문자와 같은지 검사 + // break; //같으면 멈춤 + // } + // pos--; //포인터 위치값 감소 (앞으로) + // } + raf.seek(pos); //\n 문자를 찾은 다음으로 파일 포인터 이동 + //String line = raf.readLine(); + + byte[] buff = new byte[7]; + raf.read(buff); + System.out.println(new String(buff)); + pos += 7; + + raf.seek(pos); + buff = new byte[5]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 5; + + raf.seek(pos); + buff = new byte[3]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 3; + + raf.seek(pos); + buff = new byte[1]; + + raf.read(buff); + System.out.println(new String(buff, "euc-kr")); + pos += 1; + + raf.seek(pos); + buff = new byte[1]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 1; + + raf.seek(pos); + buff = new byte[8]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 8; + + + raf.seek(pos); + buff = new byte[6]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 6; + + raf.seek(pos); + buff = new byte[12]; + + raf.read(buff); + System.out.println(new String(buff, "euc-kr")); + pos += 12; + + raf.seek(pos); + buff = new byte[4]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 4; + + raf.seek(pos); + buff = new byte[4]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 4; + + raf.seek(pos); + buff = new byte[4]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 4; + + raf.seek(pos); + buff = new byte[4]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 4; + + raf.seek(pos); + buff = new byte[1]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 1; + + raf.seek(pos); + buff = new byte[1]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 1; + + raf.seek(pos); + buff = new byte[1]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 1; + + + raf.seek(pos); + buff = new byte[23]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 23; + + raf.seek(pos); + buff = new byte[23]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 23; + + raf.seek(pos); + buff = new byte[2]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 2; + + + raf.seek(pos); + buff = new byte[1]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 1; + + + raf.seek(pos); + buff = new byte[1]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 1; + + + raf.seek(pos); + buff = new byte[1]; + + raf.read(buff); + System.out.println(new String(buff)); + pos += 1; + + + + // carImageSize + raf.seek(pos); + buff = new byte[7]; + + raf.read(buff); + int carImageSize = Integer.parseInt(new String(buff)); + System.out.println("carImageSize="+carImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[carImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("car.jpg", "d:/data/fims/upload/bus", buff, false); + pos += carImageSize; + + // plateImageSize + raf.seek(pos); + buff = new byte[7]; + + raf.read(buff); + int plateImageSize = Integer.parseInt(new String(buff)); + System.out.println("plateImageSize="+plateImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[plateImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("carNo.jpg", "d:/data/fims/upload/bus", buff, false); + pos += plateImageSize; + + + // movingImageSize + raf.seek(pos); + buff = new byte[7]; + // + raf.read(buff); + int movingImageSize = Integer.parseInt(new String(buff)); + System.out.println("movingImageSize="+movingImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[movingImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("moving1.jpg", "d:/data/fims/upload/bus", buff, false); + pos += movingImageSize; +if(fileSize <= pos) return; + + + + raf.seek(pos); + buff = new byte[7]; + // + raf.read(buff); + movingImageSize = Integer.parseInt(new String(buff)); + System.out.println("movingImageSize="+movingImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[movingImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("moving2.jpg", "d:/data/fims/upload/bus", buff, false); + pos += movingImageSize; + + raf.seek(pos); + buff = new byte[7]; + // + raf.read(buff); + movingImageSize = Integer.parseInt(new String(buff)); + System.out.println("movingImageSize="+movingImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[movingImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("moving3.jpg", "d:/data/fims/upload/bus", buff, false); + pos += movingImageSize; + + + raf.seek(pos); + buff = new byte[7]; + // + raf.read(buff); + movingImageSize = Integer.parseInt(new String(buff)); + System.out.println("movingImageSize="+movingImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[movingImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("moving4.jpg", "d:/data/fims/upload/bus", buff, false); + pos += movingImageSize; + + raf.seek(pos); + buff = new byte[7]; + // + raf.read(buff); + movingImageSize = Integer.parseInt(new String(buff)); + System.out.println("movingImageSize="+movingImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[movingImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("moving5.jpg", "d:/data/fims/upload/bus", buff, false); + pos += movingImageSize; + + raf.seek(pos); + buff = new byte[7]; + // + raf.read(buff); + movingImageSize = Integer.parseInt(new String(buff)); + System.out.println("movingImageSize="+movingImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[movingImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("moving6.jpg", "d:/data/fims/upload/bus", buff, false); + pos += movingImageSize; + + raf.seek(pos); + buff = new byte[7]; + // + raf.read(buff); + movingImageSize = Integer.parseInt(new String(buff)); + System.out.println("movingImageSize="+movingImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[movingImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("moving7.jpg", "d:/data/fims/upload/bus", buff, false); + pos += movingImageSize; + + raf.seek(pos); + buff = new byte[7]; + // + raf.read(buff); + movingImageSize = Integer.parseInt(new String(buff)); + System.out.println("movingImageSize="+movingImageSize); + pos += 7; + + raf.seek(pos); + buff = new byte[movingImageSize]; + raf.read(buff); + CommUtils.createMutipartFileFromBytes("moving8.jpg", "d:/data/fims/upload/bus", buff, false); + pos += movingImageSize; + + System.out.println("pos="+pos); + } + +} + diff --git a/src/main/java/kr/xit/fims/biz/ec/model/CctvDTO.java b/src/main/java/kr/xit/fims/biz/ec/model/CctvDTO.java deleted file mode 100644 index fc73e513..00000000 --- a/src/main/java/kr/xit/fims/biz/ec/model/CctvDTO.java +++ /dev/null @@ -1,223 +0,0 @@ -package kr.xit.fims.biz.ec.model; - -import java.io.IOException; -import java.io.RandomAccessFile; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.Setter; - -public class CctvDTO { - - @Getter - @Setter - @AllArgsConstructor - @Builder - public static class BusOnly { - - // 텍스트size : 1 ~ 7(7) - private String textSize; - - // 단속장비 : 8 ~ 12(5) - private String regltEquip; - - // 차량속도 : 13 ~ 15(3) - private String carSpeed; - - // 차종 : 16 ~ 16(1) - 미사용 - private String carModel; - - // 도로코드 : 17 ~ 17(1) - 미사용 - private String roadCode; - - // 단속일자 : 18 ~ 25(8) - private String regltDeDate; - - // 단속시간 : 26 ~ 31(6) - private String regltDeTime; - - // 차량번호 : 32 ~ 43(12) - private String carNum; - - // 번호판 X 좌표 : 44 ~ 47(4) - private String carNumXPos; - - // 번호판 Y 좌표 : 48 ~ 51(4) - private String carNumYPos; - - // 번호판 Width : 52 ~ 55(4) - private String carNumWidth; - - // 번호판 Height : 56 ~ 59(4) - private String carNumHeight; - - // (미사용) : 60 ~ 60(1) - private String skipFld; - - // 위반구분(미사용) : 61 ~ 61(1) - private String violtDiv; - - // 위반종류(미사용) : 62 ~ 62(1) - private String violtKind; - - // GPS X 좌표 : 62 ~ 84(23) - private String gpsX; - - // GPS Y 좌표 : 85 ~ 107(23) - private String gpsY; - - // 사진매수(미사용) : 108 ~ 109(2) - private String imgCnt; - } - - public static void main(String[] args) throws IOException { - - String path = "D:\\project_data\\fims\\01. 연계\\02. CCTV\\CCTV 샘플자료\\버스전용차로\\2017072013474126.F0001"; - - RandomAccessFile file = new RandomAccessFile(path,"r"); - long fileSize = file.length(); - long pos = 0; //뒤로 부터 - // while(true) { - // file.seek(pos); //파일 포인터 이동 - // if(file.readByte()=='\n') { //해당 위치의 바이트를 읽어 \n 문자와 같은지 검사 - // break; //같으면 멈춤 - // } - // pos--; //포인터 위치값 감소 (앞으로) - // } - file.seek(pos); //\n 문자를 찾은 다음으로 파일 포인터 이동 - //String line = file.readLine(); - - byte[] buff = new byte[7]; - file.read(buff); - System.out.println(new String(buff)); - - file.seek(7); - buff = new byte[5]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(12); - buff = new byte[3]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(15); - buff = new byte[1]; - - file.read(buff); - System.out.println(new String(buff, "euc-kr")); - - file.seek(16); - buff = new byte[1]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(17); - buff = new byte[8]; - - file.read(buff); - System.out.println(new String(buff)); - - - file.seek(25); - buff = new byte[6]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(31); - buff = new byte[12]; - - file.read(buff); - System.out.println(new String(buff, "euc-kr")); - - file.seek(43); - buff = new byte[4]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(47); - buff = new byte[4]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(51); - buff = new byte[4]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(55); - buff = new byte[4]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(59); - buff = new byte[1]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(60); - buff = new byte[1]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(61); - buff = new byte[1]; - - file.read(buff); - System.out.println(new String(buff)); - - - file.seek(62); - buff = new byte[23]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(85); - buff = new byte[23]; - - file.read(buff); - System.out.println(new String(buff)); - - file.seek(108); - buff = new byte[2]; - - file.read(buff); - System.out.println(new String(buff)); - - - - - - // BufferedImage image = null; - // FileInputStream fis = null; - // BufferedInputStream bis = null; - // - // try { - // fis = new FileInputStream(new File(path)); - // bis = new BufferedInputStream(fis); - // image = ImageIO.read(bis); - // }catch(Exception e) { - // e.printStackTrace(); - // }finally { - // if(bis != null) bis.close(); - // if(fis != null) fis.close(); - // } - // System.out.println(image); - } - - - -} - diff --git a/src/main/java/kr/xit/fims/biz/ec/model/CtznStmtDTO.java b/src/main/java/kr/xit/fims/biz/ec/model/CtznStmtDTO.java index 0daed417..27f5a553 100644 --- a/src/main/java/kr/xit/fims/biz/ec/model/CtznStmtDTO.java +++ b/src/main/java/kr/xit/fims/biz/ec/model/CtznStmtDTO.java @@ -224,7 +224,7 @@ public class CtznStmtDTO implements Serializable { //extends ExtlEsbDataType { // 단속자료 생성을 위한 필드 private String register; - private String regltSeCode = FimsConst.RegltSeCode.CTZ.getCode(); + private String pkPrefix = FimsConst.PkPrefix.CTZ.getCode(); private String jobSeCode = FimsConst.FileJobSeCode.NATL_NEWS_PAPER_RCV.getCode(); private String inputSeCode = FimsConst.InputSeCode.CITIZEN.getCode(); private String regltProcessSttusCode; diff --git a/src/main/java/kr/xit/fims/biz/ec/service/EcCctvCrackdownService.java b/src/main/java/kr/xit/fims/biz/ec/service/EcCctvCrackdownService.java new file mode 100644 index 00000000..4c0c651a --- /dev/null +++ b/src/main/java/kr/xit/fims/biz/ec/service/EcCctvCrackdownService.java @@ -0,0 +1,195 @@ +package kr.xit.fims.biz.ec.service; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.apache.commons.collections4.ListUtils; +import org.apache.commons.io.IOUtils; +import org.apache.ibatis.session.RowBounds; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import kr.xit.fims.biz.FimsConst; +import kr.xit.fims.biz.ec.mapper.IEcCctvCrackdownMapper; +import kr.xit.fims.biz.ec.mapper.IEcCtznSttemntMapper; +import kr.xit.fims.biz.ec.model.CctvCrackdownDTO; +import kr.xit.framework.biz.cmm.model.CmmFileDTO; +import kr.xit.framework.biz.cmm.service.ICmmFileService; +import kr.xit.framework.support.exception.BizRuntimeException; +import kr.xit.framework.support.util.constants.MessageKey; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@RequiredArgsConstructor +@Service +public class EcCctvCrackdownService implements IEcCctvCrackdownService { + + @Value("#{prop['file.upload.root']}") + private String uploadRoot; + + @Value("#{prop['file.upload.cctv-fix.path']}") + private String uploadCctvFixPath; + + @Value("#{prop['file.upload.cctv-drv.path']}") + private String uploadCctvDrvPath; + + // @Value("#{prop['file.rcv.root']}") + // private String rcvRoot; + // + // @Value("#{prop['file.rcv.natl-newspaper.path']}") + // private String rcvNewsPaperPath; + + private final IEcCctvCrackdownMapper mapper; + private final IEcCtznSttemntMapper ctznSttemntMapper; + + private final ICmmFileService cmmFileService; + + @Override + @Transactional(readOnly = true) + public List findExtrlRegltCntcs(final Map paraMap, final RowBounds rowBounds) { + return mapper.selectEcExtrlRegltCntcs(paraMap, rowBounds); + } + + @Override + @Transactional(readOnly = true) + public CctvCrackdownDTO.ExtrlRegltCntc findExtrlRegltCntc(final String extrlRegltCntcId) { + return mapper.selectEcExtrlRegltCntc(extrlRegltCntcId); + } + + /** + *
+     * 시민신고 xml 데이타 업무테이블 insert
+     * 1) ec_esb_interface 테이블 insert
+     * 2) tb_ec_ctzn_sttemnt insert
+     *    tb_ex_ctzn_sttemnt_detail insert
+     * 3) tb_cmm_file_mastr insert
+     *    tb_cmm_file_detail insert
+     * @param dto
+     * 
+ */ + @SuppressWarnings("ConstantConditions") + @Override + @Transactional + public void saveCctvCrackdownDatas(final CctvCrackdownDTO.Request dto) { + // 단속정보메타 1 + 이미지파일 4 = 5개로 구성 + if(dto.getFiles().size() % 5 != 0){ + throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, "단속정보[파일]가 부정확 합니다\n다시 확인해 주세요."); + } + final Comparator comp = (mf1, mf2) -> String.CASE_INSENSITIVE_ORDER.compare(mf1.getOriginalFilename(), mf2.getOriginalFilename()); + List sortedFileList = dto.getFiles().stream() + .sorted(comp) + .collect(Collectors.toList()); + + //Arrays.copyOfRange(sortedFileList.toArray(), 0, 4); + + List> listByMd = ListUtils.partition(sortedFileList, 5); + + for(int idx = 0; idx < listByMd.size(); idx++){ + List 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("_"); + + + List records = new ArrayList<>(); + try(InputStream inputStream = mf.getInputStream();){ + IOUtils.readLines(inputStream, "euc-kr") + .forEach(s -> records.add(s)); + } catch (IOException e) { + // handle exception + } + CctvCrackdownDTO.ExtrlRegltCntc extrRegltDTO = getExtrlRegltCntcDTO(txtNames[0], records); + if(records.size() >= 3){ + extrRegltDTO.setPkPrefix(FimsConst.PkPrefix.CDV.getCode()); + }else{ + extrRegltDTO.setPkPrefix(FimsConst.PkPrefix.CFV.getCode()); + } + + mapper.insertEcExtrlRegltCntc(extrRegltDTO); + + + List cpListMf = new ArrayList<>(mfList); + //List cpListMf = new ArrayList<>(mfList.size()); + //Collections.copy(cpListMf, mfList); + cpListMf.remove(0); + + cmmFileService.saveFiles(getFileMst(extrRegltDTO.getPkPrefix(), extrRegltDTO.getExtrlRegltCntcId()), cpListMf); + + + // CmmFileDTO.FileDtl fileDtl = CmmFileDTO.FileDtl.builder() + // .fileMastrId(CommUtils.getStringFromUUID()) + // .fileCours("/cctv/2022/1227") + // .build(); + // + // + // cmmFileService.saveAddFileDtl(fileDtl, cpListMf, false); + //mfList = null; + } + + } + + + // metaFileName : 20101224121055000_014_001_0 + // yyyyMMddHHmmssTTT_업체코드_장비코드 + // + // 주행형 : 서울11가1111,역삼동,국민은행앞,주정차위반,어린이보호구역,121010,122400 + // 127.482432 + // 37.362931 + // 고정형 : 서울11가1111,역삼동,국민은행앞,주정차위반,어린이보호구역,121010,122400 + // + // 차량번호,단속동명,단속장소명,법규,어린이보호구역,단속시작시간,단속종료시간 + // gpsX + // gpsY + private CctvCrackdownDTO.ExtrlRegltCntc getExtrlRegltCntcDTO(String metaFileName, List metaFileInfos){ + String[] metaFileNames = metaFileName.split("_"); + String[] mdInfos = metaFileInfos.get(0).split(","); + + return CctvCrackdownDTO.ExtrlRegltCntc.builder() + .vhcleNo(mdInfos[0]) + .regltDongNm(mdInfos[1]) + .regltPlace(mdInfos[2]) + //.법규 + //.어린이보호구역 + .regltBeginTime(mdInfos[5]) + .regltEndTime(mdInfos[6]) + .gpsX(metaFileInfos.size() >= 3? metaFileInfos.get(1).trim() : null) + .gpsY(metaFileInfos.size() >= 3? metaFileInfos.get(2).trim() : null) + + .regltDe(metaFileNames[0].substring(0,8)) + .regltEntrpsCode(metaFileNames[1]) + .regltEqpmnManageNo(metaFileNames[2]) + .register(getUserUniqId()) + .build(); + } + + private CmmFileDTO.FileMst getFileMst(String pkPrefix, String fileJobId) { + return CmmFileDTO.FileMst.builder() + .jobSeCode( + Objects.equals(pkPrefix, FimsConst.PkPrefix.CDV.getCode())? + FimsConst.FileJobSeCode.CCTV_DRV.getCode() + : FimsConst.FileJobSeCode.CCTV_FIX.getCode()) + .fileJobId(fileJobId) + .uploadeJobPath(Objects.equals(pkPrefix, FimsConst.PkPrefix.CDV.getCode())? + uploadCctvDrvPath + : uploadCctvFixPath) + .fileDirPath(FimsConst.FileDirDepth.DAY.getCode()) + .cmmFileDtls(new ArrayList<>()) + .build(); + } + + + +} diff --git a/src/main/java/kr/xit/fims/biz/ec/service/IEcCctvCrackdownService.java b/src/main/java/kr/xit/fims/biz/ec/service/IEcCctvCrackdownService.java new file mode 100644 index 00000000..7e66bef8 --- /dev/null +++ b/src/main/java/kr/xit/fims/biz/ec/service/IEcCctvCrackdownService.java @@ -0,0 +1,29 @@ +package kr.xit.fims.biz.ec.service; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.session.RowBounds; + +import kr.xit.fims.biz.ec.model.CctvCrackdownDTO; +import kr.xit.framework.core.utils.XitCmmnUtil; + +public interface IEcCctvCrackdownService { + + List findExtrlRegltCntcs(final Map paraMap, final RowBounds rowBounds); + CctvCrackdownDTO.ExtrlRegltCntc findExtrlRegltCntc(final String extrlRegltCntcId); + + void saveCctvCrackdownDatas(final CctvCrackdownDTO.Request dto); + + + + + + + + default String getUserUniqId(){ + return XitCmmnUtil.getUserUniqId(); + } + + +} diff --git a/src/main/java/kr/xit/fims/biz/ec/web/EcCctvCrackdownController.java b/src/main/java/kr/xit/fims/biz/ec/web/EcCctvCrackdownController.java new file mode 100644 index 00000000..6045d1cc --- /dev/null +++ b/src/main/java/kr/xit/fims/biz/ec/web/EcCctvCrackdownController.java @@ -0,0 +1,122 @@ +package kr.xit.fims.biz.ec.web; + +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.servlet.ModelAndView; + +import kr.xit.fims.biz.FimsConst; +import kr.xit.fims.biz.ec.model.CctvCrackdownDTO; +import kr.xit.fims.biz.ec.service.IEcCctvCrackdownService; +import kr.xit.framework.biz.cmm.model.CmmFileDTO; +import kr.xit.framework.biz.cmm.service.ICmmFileService; +import kr.xit.framework.core.constants.FrameworkConstants; +import kr.xit.framework.core.model.ResultResponse; +import kr.xit.framework.core.utils.fileExplorer.XitFileExplorerUtil; +import kr.xit.framework.core.utils.fileExplorer.function.DirectorySearch; +import kr.xit.framework.support.exception.BizRuntimeException; +import kr.xit.framework.support.mybatis.MybatisUtils; +import kr.xit.framework.support.util.AjaxMessageMapRenderer; +import kr.xit.framework.support.util.constants.MessageKey; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@RequiredArgsConstructor +@Controller +@RequestMapping(value = "/fims/biz/ec") +public class EcCctvCrackdownController { + @Value("#{prop['file.rcv.root']}") + private String fileRcvRoot; + + @Value("#{prop['file.rcv.busonly-cctv.path']}") + private String rcvBusonlyCctvPath; + + private final IEcCctvCrackdownService service; + private final ICmmFileService fileService; + + + @RequestMapping(value = "/ecCctvCrackdownMgtForm") + public void ecCctvCrackdownMgtForm(){ + } + + @RequestMapping(value = "/ecCctvCrackdownFileSelPopup") + public ModelAndView ecCctvCrackdownFileSelPopup(){ + ModelAndView mav = new ModelAndView(FimsConst.FIMS_JSP_BASE_PATH +"ec/ecCctvCrackdownFileSelPopup.popup"); + //mav.addObject("dirPath", fileRcvRoot + rcvBusonlyCctvPath); + return mav; + } + + @RequestMapping(value = "/ecCctvCrackdownPopup") + public ModelAndView ecCctvCrackdownPopup(final String extrlRegltCntcId, final String regltSeCode){ + ModelAndView mav = new ModelAndView(FimsConst.FIMS_JSP_BASE_PATH +"ec/ecCctvCrackdownPopup.popup"); + + String fileJobSeCode = getFileJobSeCode(regltSeCode); + mav.addObject("extrlRegltCntcDTO", service + .findExtrlRegltCntc(extrlRegltCntcId)); + mav.addObject("attchFiles", fileService.findFilesByJobSeCodeAndJobId( + CmmFileDTO.FileMst.builder() + .jobSeCode(fileJobSeCode) + .fileJobId(extrlRegltCntcId) + .build())); + return mav; + } + @RequestMapping(value = "/findCctvCrackdownFiles") + public ModelAndView findCctvCrackdownFiles(final String dirPath){ + + XitFileExplorerUtil explorer = new XitFileExplorerUtil(new DirectorySearch(dirPath)); + return ResultResponse.of( + explorer.getList().stream() + .filter(m->"Y".equals(m.get("isFile"))) + .collect(Collectors.toList()) + ); + } + + @PostMapping(value = "/saveCctvCrackdownDatas") + public ModelAndView saveCctvCrackdownDatas(final CctvCrackdownDTO.Request dto) { + ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW); + service.saveCctvCrackdownDatas(dto); + + AjaxMessageMapRenderer.success(mav, MessageKey.CMM_SUCCESS); + return mav; + } + + @GetMapping(value = "/findExtrlRegltCntcs") + public ModelAndView findExtrlRegltCntcs(@RequestParam final Map paraMap) { + return ResultResponse.of(service.findExtrlRegltCntcs(paraMap, MybatisUtils.getPagingInfo(paraMap))); + } + + @RequestMapping("/findExtrlRegltCntcAttchFiles") + public ModelAndView findExtrlRegltCntcAttchFiles(final String extrlRegltCntcId, final String regltSeCode) { + return ResultResponse.of( + fileService.findFilesByJobSeCodeAndJobId( + CmmFileDTO.FileMst.builder() + .jobSeCode(getFileJobSeCode(regltSeCode)) + .fileJobId(extrlRegltCntcId) + .build()).stream() + .filter(dtl -> !Objects.equals("png", dtl.getFileExtsn())) + .collect(Collectors.toList()) + ); + } + + private static String getFileJobSeCode(String regltSeCode) { + // 01 - 고정형CCTV + if(Objects.equals(regltSeCode, "01"))//FimsConst.FileJobSeCode.CCTV_FIX)) + return FimsConst.FileJobSeCode.CCTV_FIX.getCode(); + // 02 - 주행형CCTV + if(Objects.equals(regltSeCode, "02"))//FimsConst.FileJobSeCode.CCTV_DRV)) + return FimsConst.FileJobSeCode.CCTV_DRV.getCode(); + // 03 - 버스장착형CCTV + if(Objects.equals(regltSeCode, "03"))//FimsConst.FileJobSeCode.BUS_ONLY)) + return FimsConst.FileJobSeCode.BUS_ONLY.getCode(); + + throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, "데이타 오류[파일정보를 확인해 주세요"); + } +} diff --git a/src/main/java/kr/xit/framework/biz/cmm/service/CmmFileService.java b/src/main/java/kr/xit/framework/biz/cmm/service/CmmFileService.java index 03571597..2f589089 100644 --- a/src/main/java/kr/xit/framework/biz/cmm/service/CmmFileService.java +++ b/src/main/java/kr/xit/framework/biz/cmm/service/CmmFileService.java @@ -230,7 +230,7 @@ public class CmmFileService implements ICmmFileService { /** * - * @param dto + * @param t * @return */ @Override diff --git a/src/main/resources/props/local/globals.properties b/src/main/resources/props/local/globals.properties index 381c0860..2bf8be15 100644 --- a/src/main/resources/props/local/globals.properties +++ b/src/main/resources/props/local/globals.properties @@ -127,7 +127,11 @@ file.upload.allow.ext= #file.upload.root=/Users/minuk/data/fims/upload file.upload.root=D:/data/fims/upload file.upload.natl-newspaper.path=/natl-newspaper +file.upload.busonly-cctv.path=/busonly +file.upload.cctv-fix.path=/cctv-fix +file.upload.cctv-drv.path=/cctv-drv #file.rcv.root=/Users/minuk/project_data/fims/01. \uC5F0\uACC4/01. \uAD6D\uBBFC\uC2E0\uBB38\uACE0 -file.rcv.root=D:/project_data/fims/01. \uC5F0\uACC4/01. \uAD6D\uBBFC\uC2E0\uBB38\uACE0 -file.rcv.natl-newspaper.path=/rcv +file.rcv.root=D:/project_data/fims/01. \uC5F0\uACC4 +file.rcv.natl-newspaper.path=/01. \uAD6D\uBBFC\uC2E0\uBB38\uACE0/rcv +file.rcv.busonly-cctv.path=/02. CCTV/CCTV \uC0D8\uD50C\uC790\uB8CC/\uBC84\uC2A4\uC804\uC6A9\uCC28\uB85C diff --git a/src/main/resources/sqlmapper/biz/ec/ec-ctzn-sttemnt-mysql-mapper.xml b/src/main/resources/sqlmapper/biz/ec/ec-ctzn-sttemnt-mysql-mapper.xml index de17b7d3..f029486b 100644 --- a/src/main/resources/sqlmapper/biz/ec/ec-ctzn-sttemnt-mysql-mapper.xml +++ b/src/main/resources/sqlmapper/biz/ec/ec-ctzn-sttemnt-mysql-mapper.xml @@ -202,7 +202,7 @@ /* ec-ctzn-sttemnt-mysql-mapper|insertRtRegltFromCtznStmt-시민신고 단속 생성|julim */ - SELECT fn_get_key_seq(#{regltSeCode}, 13) + SELECT fn_get_key_seq(#{pkPrefix}, 13) INSERT INTO tb_rt_reglt ( reglt_id @@ -232,7 +232,7 @@ ) SELECT #{regltId} , ecsd.instt_code , ecsd.sys_code - , (SELECT code FROM xit_cmmn_detail_code WHERE code_id = 'FIM002' AND etc_1 = #{regltSeCode}) + , (SELECT code FROM xit_cmmn_detail_code WHERE code_id = 'FIM002' AND etc_1 = #{pkPrefix}) , #{inputSeCode} -- 입력 구분 코드 , SUBSTR(ecsd.reglt_de_time, 1, 8) , SUBSTR(ecsd.reglt_de_time, 9) -- 단속 시작 시간 @@ -268,7 +268,7 @@ /* ec-ctzn-sttemnt-mysql-mapper|insertRtErppFromCtznStmt-시민신고 서손 생성|julim */ - SELECT fn_get_key_seq(#{regltSeCode}, 9) + SELECT fn_get_key_seq(#{pkPrefix}, 9) INSERT INTO tb_rt_erpp ( erpp_id diff --git a/src/main/resources/sqlmapper/biz/ec/ec-extrl-reglt-cntc-mysql-mapper.xml b/src/main/resources/sqlmapper/biz/ec/ec-extrl-reglt-cntc-mysql-mapper.xml new file mode 100644 index 00000000..cd311fe6 --- /dev/null +++ b/src/main/resources/sqlmapper/biz/ec/ec-extrl-reglt-cntc-mysql-mapper.xml @@ -0,0 +1,111 @@ + + + + + + + + SELECT extrl_reglt_cntc_id + , reglt_id + , instt_code + , sys_code + , reglt_se_code + , input_se_code + , vhcle_no + , reglt_de + , reglt_begin_time + , reglt_end_time + , reglt_dong_nm + , reglt_place + , reglt_specl_zone_nm + , reglt_entrps_code + , reglt_eqpmn_manage_no + , violt_dtls_nm + , gps_x + , gps_y + , extrl_reglt_cntc_process_sttus + , cntc_file_nm + , cntc_photo_file_nm_1 + , cntc_photo_file_nm_2 + , cntc_photo_file_nm_3 + , cntc_photo_file_nm_4 + , delete_at + , delete_resn + , delete_dt + , dltr + , regist_dt + , register + , updt_dt + , updusr + FROM tb_ec_extrl_reglt_cntc + + + + + + + + /* ec-extrl-reglt-cntc-mysql-mapper|insertEcExtrlRegltCntc-외부연계 정보 등록|julim */ + + SELECT fn_get_key_seq(#{pkPrefix}, 9) + + INSERT + INTO tb_ec_extrl_reglt_cntc ( + extrl_reglt_cntc_id + , reglt_id + , instt_code + , sys_code + , reglt_se_code + , input_se_code + , vhcle_no + , reglt_de + , reglt_begin_time + , reglt_end_time + , reglt_dong_nm + , reglt_place + , reglt_specl_zone_nm + , reglt_entrps_code + , reglt_eqpmn_manage_no + , violt_dtls_nm + , gps_x + , gps_y + , extrl_reglt_cntc_process_sttus + , delete_at + , regist_dt + , register + ) VALUES ( + #{extrlRegltCntcId} + , #{regltId} + , #{insttCode} + , #{sysCode} + , (SELECT code FROM xit_cmmn_detail_code WHERE code_id = 'FIM002' AND etc_1 = #{pkPrefix}) + , #{inputSeCode} + , #{vhcleNo} + , #{regltDe} + , #{regltBeginTime} + , #{regltEndTime} + , #{regltDongNm} + , #{regltPlace} + , #{regltSpeclZoneNm} + , #{regltEntrpsCode} + , #{regltEqpmnManageNo} + , #{violtDtlsNm} + , #{gpsX} + , #{gpsY} + , #{extrlRegltCntcProcessSttus} + , 'N' + , DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') + , #{register} + ) + + + diff --git a/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCctvCrackdownFileSelPopup.jsp b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCctvCrackdownFileSelPopup.jsp new file mode 100644 index 00000000..e61d0ad3 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCctvCrackdownFileSelPopup.jsp @@ -0,0 +1,239 @@ +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %> + + + + + diff --git a/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCctvCrackdownMgtForm.jsp b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCctvCrackdownMgtForm.jsp new file mode 100644 index 00000000..edad5fac --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCctvCrackdownMgtForm.jsp @@ -0,0 +1,204 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> +<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %> + +
+ +
+ + +
+ +
전체 ㅣ
+
+ + 등록 + +
+ + + +
+ + diff --git a/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCctvCrackdownPopup.jsp b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCctvCrackdownPopup.jsp new file mode 100644 index 00000000..dcfcc9ac --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/fims/biz/ec/ecCctvCrackdownPopup.jsp @@ -0,0 +1,277 @@ +<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %> + +<%--rcvXmlDTO--%> + + + + + + + +