From d1b080916d12a18ffa83e1a42a5f0bef9f4137db Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 1 Feb 2024 18:39:43 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=B8=EC=99=B8=EC=88=98=EC=9E=85=EC=A0=84?= =?UTF-8?q?=EC=86=A1=EC=9A=A9=20=EC=95=95=EC=B6=95=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/fims/cmmn/CmmnUtil.java | 28 ++- .../xit/fims/crdn/dao/CrdnUpdtMapper.java | 2 + .../xit/fims/crdn/dao/GlobalStngMapper.java | 7 + .../fims/crdn/send/nxrp/AttachedTxtMaker.java | 221 ++++++++++++++++++ .../fims/crdn/send/nxrp/LinkFileMaker.java | 25 ++ .../fims/crdn/send/nxrp/OnlyImageMaker.java | 153 ++++++++++++ .../crdn/service/bean/CrdnServiceBean.java | 147 +++++++++++- .../xit/fims/crdn/web/Crdn06Controller.java | 2 +- .../bean/IntegrationSearchServiceBean.java | 2 +- .../sql/mapper/fims/crdn/crdn-info-mapper.xml | 26 ++- .../sql/mapper/fims/crdn/crdn-updt-mapper.xml | 12 + .../mapper/fims/crdn/global-stng-mapper.xml | 11 + .../WEB-INF/jsp/fims/crdn/crdn06010-main.jsp | 2 + 13 files changed, 616 insertions(+), 22 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/crdn/send/nxrp/AttachedTxtMaker.java create mode 100644 src/main/java/cokr/xit/fims/crdn/send/nxrp/LinkFileMaker.java create mode 100644 src/main/java/cokr/xit/fims/crdn/send/nxrp/OnlyImageMaker.java diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index a82a3a80..e84bc207 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -51,6 +51,21 @@ public class CmmnUtil { return str; } + public static String spacedJoin(String... strings) { + String result = ""; + for(String str : strings) { + if(str == null) { + str = ""; + } + if(result.equals("") || str.equals("")) { + result += str; + } else { + result += " " + str; + } + } + return result; + } + /** * 문자열 안의 모든 문자가 숫자인지 테스트한다. * @param 문자열 @@ -72,12 +87,15 @@ public class CmmnUtil { } /** - * 순서를 숫자에서 알파벳대문자로 변환한다. - * @param index 순서번호, startFromZero 0부터시작(또는 1부터 시작) + * 순서를 숫자에서 알파벳문자로 변환한다. + * @param index 순서번호, 대소문자여부(대문자일경우 true, 소문자일경우 false), startFromZero 0부터 시작 여부(0부터 시작시 true, 1부터 시작시 false) * @return 알파벳대문자(A~Z) */ - public static String indexToAlphabet(int index, boolean startFromZero) { - int charCode = 64; + public static String indexToAlphabet(int index, boolean isUpper, boolean startFromZero) { + int A = isUpper ? 65 : 97; + int Z = isUpper ? 90 : 122; + + int charCode = (A-1); charCode += index; @@ -85,7 +103,7 @@ public class CmmnUtil { charCode++; } - if(charCode < 65 || charCode > 90) { + if(charCode < A || charCode > Z) { return ""; } diff --git a/src/main/java/cokr/xit/fims/crdn/dao/CrdnUpdtMapper.java b/src/main/java/cokr/xit/fims/crdn/dao/CrdnUpdtMapper.java index f80923fb..38c41a3c 100644 --- a/src/main/java/cokr/xit/fims/crdn/dao/CrdnUpdtMapper.java +++ b/src/main/java/cokr/xit/fims/crdn/dao/CrdnUpdtMapper.java @@ -80,4 +80,6 @@ public interface CrdnUpdtMapper extends AbstractMapper { */ int deleteCrdnPayer(Crdn crdn); + int updateNxrpCrdnLinkYn(Crdn crdn); + } diff --git a/src/main/java/cokr/xit/fims/crdn/dao/GlobalStngMapper.java b/src/main/java/cokr/xit/fims/crdn/dao/GlobalStngMapper.java index 6ca211b0..a01525ea 100644 --- a/src/main/java/cokr/xit/fims/crdn/dao/GlobalStngMapper.java +++ b/src/main/java/cokr/xit/fims/crdn/dao/GlobalStngMapper.java @@ -1,6 +1,7 @@ package cokr.xit.fims.crdn.dao; import java.util.List; +import java.util.Map; import org.egovframe.rte.psl.dataaccess.mapper.Mapper; @@ -31,6 +32,12 @@ public interface GlobalStngMapper extends AbstractMapper { */ List selectStdgNmList(String sggCd); + /**법정동명으로 법정동코드를 조회한다.
+ * @param map 시군구코드 및 법정동명 + * @return 법정동코드 목록 + */ + List selectStdgCdListByStdgNm(Map map); + /** 연계파일 레이아웃 정보를 조회한다. * @param query 연계파일 레이아웃 조회조건 * @return 연계파일 레이아웃 정보 diff --git a/src/main/java/cokr/xit/fims/crdn/send/nxrp/AttachedTxtMaker.java b/src/main/java/cokr/xit/fims/crdn/send/nxrp/AttachedTxtMaker.java new file mode 100644 index 00000000..0779f950 --- /dev/null +++ b/src/main/java/cokr/xit/fims/crdn/send/nxrp/AttachedTxtMaker.java @@ -0,0 +1,221 @@ +package cokr.xit.fims.crdn.send.nxrp; + +import java.io.File; +import java.io.FileWriter; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import org.apache.commons.io.FilenameUtils; + +import cokr.xit.base.code.CommonCode; +import cokr.xit.fims.cmmn.CmmnUtil; +import cokr.xit.fims.cmmn.Hangul; +import cokr.xit.foundation.data.DataObject; + +public class AttachedTxtMaker extends LinkFileMaker { + + private String innerFilePrefix; + private String textFileName; + + private List fimsVltnCodes; + private List nxrpVltnCodes; + + public void appendVltnCodeInfo(List fimsVltnCodes, List nxrpVltnCodes) { + this.fimsVltnCodes = fimsVltnCodes; + this.nxrpVltnCodes = nxrpVltnCodes; + } + + public AttachedTxtMaker(String nxrpLinkSeCd, String instDigit7){ + + String ifId = "EBF_Z000001LGE_1741000NIS_"; + String systemCode = ""; + if(nxrpLinkSeCd.equals("B01")) { + ifId += "0001"; + systemCode = "PVS"; + this.maxImageFileCnt = 4; + } else if(nxrpLinkSeCd.equals("C01")) { + ifId += "0003"; + systemCode = "BPV"; + this.maxImageFileCnt = 7; + } + this.ifId = ifId; + + SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String currentTime = ymdhmsFormat.format(new Date()); + + this.zipFileName = ifId + "_" + currentTime + "@" + instDigit7 + systemCode + ".zip"; + + + this.innerFilePrefix = ifId + "_" + currentTime + "_" + instDigit7 + "_"; + this.textFileName = this.innerFilePrefix + "0.txt"; + + } + + public String getTextFileName() { + return this.textFileName; + } + + public void writeTextFileContents(String workPath, String... contents) { + try { + + File txtFile = new File(workPath + "/" + this.textFileName); + txtFile.createNewFile(); + + FileWriter fileWriter = new FileWriter(workPath + "/" + this.textFileName); + + for(int i=0; i < contents.length; i++) { + if(i != 0) { + fileWriter.write("|"); + } + fileWriter.write(contents[i]); + } + fileWriter.close(); + } catch (Exception e) { + throw new RuntimeException("[F]"+e); + } + } + + @Override + public String[] extractForPVS(DataObject crdnInfo) { + String[] B01 = new String[14]; + Hangul hangul = new Hangul(3); + + B01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM"); + B01[1] = crdnInfo.string("VHRNO"); + String crdnSeCd = crdnInfo.string("CRDN_SE_CD"); + if(!crdnSeCd.equals("01") && !crdnSeCd.equals("02") && !crdnSeCd.equals("07")) { + throw new RuntimeException("[F]잘못된 단속구분입니다."); + } + B01[2] = crdnSeCd; + B01[3] = crdnInfo.string("TEAM_ID"); + String vltnCd = crdnInfo.string("VLTN_CD"); + + boolean vltnCdMatch = false; + for(CommonCode nxrpVltnCode : this.nxrpVltnCodes) { + if(nxrpVltnCode.getCode().equals(vltnCd)) { + vltnCdMatch = true; + } + } + + if(vltnCdMatch) { + B01[4] = vltnCd; + B01[5] = ""; + } else { + B01[4] = "99"; + String vltnNm = ""; + for(CommonCode fimsVltnCode : this.fimsVltnCodes) { + if(fimsVltnCode.getCode().equals(vltnCd)) { + vltnNm = fimsVltnCode.getValue(); + } + } + B01[5] = vltnNm; + } + + String law = CmmnUtil.spacedJoin(crdnInfo.string("VLTN_LAW_NM"), crdnInfo.string("VLTN_LAW1"), crdnInfo.string("VLTN_LAW2")); + if(hangul.getByteLength(law) > 60) { + throw new RuntimeException("[F]위반법규가 60byte를 초과하여 오류가 발생하였습니다."); + } + B01[6] = law; + String crdnPlc = crdnInfo.string("CRDN_PLC"); + if(hangul.getByteLength(crdnPlc) > 60) { + throw new RuntimeException("[F]단속장소가 60byte를 초과하여 오류가 발생하였습니다."); + } + B01[7] = crdnPlc; + String crdnSpareaCd = crdnInfo.string("CRDN_SPAREA_CD"); + if(crdnSpareaCd.equals("00")) { + crdnSpareaCd = ""; + } else if(crdnSpareaCd.equals("06") || crdnSpareaCd.equals("07")) { + crdnSpareaCd = "03"; + } + B01[8] = crdnSpareaCd; + String gujesi = "1"; + //TODO : 구제시 + B01[9] = gujesi; + + if(crdnInfo.string("STDG_CD").equals("")) { + B01[10] = "0000000000"; + } else { + B01[10] = crdnInfo.string("STDG_CD"); + } + + B01[11] = crdnInfo.string("GPS_X"); + B01[12] = crdnInfo.string("GPS_Y"); + int atchFileCnt = crdnInfo.number("ATCH_FILE_CNT").intValue(); + if(atchFileCnt > this.maxImageFileCnt) { + atchFileCnt = this.maxImageFileCnt; + } + B01[13] = Integer.toString(atchFileCnt); + + return B01; + } + + @Override + public String[] extractForBPV(DataObject crdnInfo) { + String[] C01 = new String[14]; + Hangul hangul = new Hangul(3); + + C01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM"); + C01[1] = crdnInfo.string("VHRNO"); + String crdnSeCd = crdnInfo.string("CRDN_SE_CD"); + if(!crdnSeCd.equals("01") && !crdnSeCd.equals("02") && !crdnSeCd.equals("07")) { + throw new RuntimeException("[F]잘못된 단속구분입니다."); + } + C01[2] = crdnSeCd; + C01[3] = crdnInfo.string("TEAM_ID"); + String vltnCd = crdnInfo.string("VLTN_CD"); + C01[4] = vltnCd; + + String law = CmmnUtil.spacedJoin(crdnInfo.string("VLTN_LAW_NM"), crdnInfo.string("VLTN_LAW1"), crdnInfo.string("VLTN_LAW2")); + if(hangul.getByteLength(law) > 60) { + throw new RuntimeException("[F]위반법규가 60byte를 초과하여 오류가 발생하였습니다."); + } + + C01[5] = law; + String crdnPlc = crdnInfo.string("CRDN_PLC"); + if(hangul.getByteLength(crdnPlc) > 60) { + throw new RuntimeException("[F]단속장소가 60byte를 초과하여 오류가 발생하였습니다."); + } + C01[6] = crdnPlc; + + String gujesi = "1"; + //TODO : 구제시 + C01[7] = gujesi; + + if(crdnInfo.string("STDG_CD").equals("")) { + C01[8] = "0000000000"; + } else { + C01[8] = crdnInfo.string("STDG_CD"); + } + + C01[9] = crdnInfo.string("GPS_X"); + C01[10] = crdnInfo.string("GPS_Y"); + C01[11] = crdnInfo.string("MOSC_X"); + C01[12] = crdnInfo.string("MOSC_Y"); + + int atchFileCnt = crdnInfo.number("ATCH_FILE_CNT").intValue(); + if(atchFileCnt > this.maxImageFileCnt) { + atchFileCnt = this.maxImageFileCnt; + } + C01[13] = Integer.toString(atchFileCnt); + + return C01; + } + + @Override + public void copyFile(String workPath, String filePath, int fileIndex, String... items) { + + String fileExtension = FilenameUtils.getExtension(filePath); + + String newFileName = this.innerFilePrefix + (fileIndex+1) + "." + fileExtension; + String newPath = workPath + "/" + newFileName; + try { + Files.copy(new File(filePath).toPath(), new File(newPath).toPath(), StandardCopyOption.REPLACE_EXISTING); + } catch (Exception e) { + throw new RuntimeException("[F]"+e); + } + + } +} diff --git a/src/main/java/cokr/xit/fims/crdn/send/nxrp/LinkFileMaker.java b/src/main/java/cokr/xit/fims/crdn/send/nxrp/LinkFileMaker.java new file mode 100644 index 00000000..70652d0c --- /dev/null +++ b/src/main/java/cokr/xit/fims/crdn/send/nxrp/LinkFileMaker.java @@ -0,0 +1,25 @@ +package cokr.xit.fims.crdn.send.nxrp; + +import cokr.xit.foundation.data.DataObject; + +public abstract class LinkFileMaker { + + protected String ifId; + protected String zipFileName; + protected int maxImageFileCnt; + + public int getMaxImageFileCnt() { + return this.maxImageFileCnt; + } + + public String getIfId() { + return this.ifId; + } + public String getZipFileName() { + return this.zipFileName; + } + + abstract public String[] extractForPVS(DataObject crdnInfo); + abstract public String[] extractForBPV(DataObject crdnInfo); + abstract public void copyFile(String workPath, String filePath, int fileIndex, String... items); +} diff --git a/src/main/java/cokr/xit/fims/crdn/send/nxrp/OnlyImageMaker.java b/src/main/java/cokr/xit/fims/crdn/send/nxrp/OnlyImageMaker.java new file mode 100644 index 00000000..aa99c058 --- /dev/null +++ b/src/main/java/cokr/xit/fims/crdn/send/nxrp/OnlyImageMaker.java @@ -0,0 +1,153 @@ +package cokr.xit.fims.crdn.send.nxrp; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.apache.commons.io.FilenameUtils; + +import cokr.xit.fims.cmmn.Hangul; +import cokr.xit.foundation.data.DataObject; + +public class OnlyImageMaker extends LinkFileMaker { + + public OnlyImageMaker(String nxrpLinkSeCd, String instDigit7){ + + String ifId = "EBF_Z000001LGE_1741000NIS_"; + String systemCode = ""; + if(nxrpLinkSeCd.equals("B01")) { + ifId += "0002"; + systemCode = "PVS"; + this.maxImageFileCnt = 4; + } else if(nxrpLinkSeCd.equals("C01")) { + ifId += "0004"; + systemCode = "BPV"; + this.maxImageFileCnt = 7; + } + this.ifId = ifId; + + SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String currentTime = ymdhmsFormat.format(new Date()); + + this.zipFileName = ifId + "_" + currentTime + "@" + instDigit7 + systemCode + ".zip"; + } + + @Override + public String[] extractForPVS(DataObject crdnInfo) { + String[] B01 = new String[11]; + Hangul hangul = new Hangul(3); + + B01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM"); + B01[1] = crdnInfo.string("VHRNO"); + String crdnSeCd = crdnInfo.string("CRDN_SE_CD"); + if(!crdnSeCd.equals("01") && !crdnSeCd.equals("02") && !crdnSeCd.equals("07")) { + throw new RuntimeException("[F]잘못된 단속구분입니다."); + } + B01[2] = crdnSeCd; + B01[3] = crdnInfo.string("TEAM_ID"); + String vltnCd = crdnInfo.string("VLTN_CD"); + B01[4] = vltnCd; + + String crdnPlc = crdnInfo.string("CRDN_PLC"); + if(hangul.getByteLength(crdnPlc) > 60) { + throw new RuntimeException("[F]단속장소가 60byte를 초과하여 오류가 발생하였습니다."); + } + B01[5] = crdnPlc; + String crdnSpareaCd = crdnInfo.string("CRDN_SPAREA_CD"); + if(crdnSpareaCd.equals("00")) { + crdnSpareaCd = ""; + } else if(crdnSpareaCd.equals("06") || crdnSpareaCd.equals("07")) { + crdnSpareaCd = "03"; + } + B01[6] = crdnSpareaCd; + String gujesi = "1"; + //TODO : 구제시 + B01[7] = gujesi; + + if(crdnInfo.string("STDG_CD").equals("")) { + B01[8] = "0000000000"; + } else { + B01[8] = crdnInfo.string("STDG_CD"); + } + + String gpsX = crdnInfo.string("GPS_X"); + if(gpsX.equals("")) { + gpsX = "000"; + } + String gpsY = crdnInfo.string("GPS_Y"); + if(gpsY.equals("")) { + gpsY = "000"; + } + B01[9] = gpsX; + B01[10] = gpsY; + + return B01; + } + + @Override + public String[] extractForBPV(DataObject crdnInfo) { + String[] C01 = new String[10]; + Hangul hangul = new Hangul(3); + + C01[0] = crdnInfo.string("CRDN_YMD")+crdnInfo.string("CRDN_TM"); + C01[1] = crdnInfo.string("VHRNO"); + String crdnSeCd = crdnInfo.string("CRDN_SE_CD"); + if(!crdnSeCd.equals("01") && !crdnSeCd.equals("02") && !crdnSeCd.equals("07")) { + throw new RuntimeException("[F]잘못된 단속구분입니다."); + } + C01[2] = crdnSeCd; + C01[3] = crdnInfo.string("TEAM_ID"); + String vltnCd = crdnInfo.string("VLTN_CD"); + C01[4] = vltnCd; + + String crdnPlc = crdnInfo.string("CRDN_PLC"); + if(hangul.getByteLength(crdnPlc) > 60) { + throw new RuntimeException("[F]단속장소가 60byte를 초과하여 오류가 발생하였습니다."); + } + C01[5] = crdnPlc; + + String gujesi = "1"; + //TODO : 구제시 + C01[6] = crdnInfo.string(gujesi); + + if(crdnInfo.string("STDG_CD").equals("")) { + C01[7] = "0000000000"; + } else { + C01[7] = crdnInfo.string("STDG_CD"); + } + + String gpsX = crdnInfo.string("GPS_X"); + if(gpsX.equals("")) { + gpsX = "000"; + } + String gpsY = crdnInfo.string("GPS_Y"); + if(gpsY.equals("")) { + gpsY = "000"; + } + C01[8] = gpsX; + C01[9] = gpsY; + + return C01; + } + + @Override + public void copyFile(String workPath, String filePath, int fileIndex, String... items) { + + String fileExtension = FilenameUtils.getExtension(filePath); + + String delim = "_"; + String newFileName = String.join(delim, items) + delim + fileIndex + "." + fileExtension; + + String newPath = workPath + "/" + newFileName; + + try { + Files.copy(new File(filePath).toPath(), new File(newPath).toPath(), StandardCopyOption.REPLACE_EXISTING); + } catch (Exception e) { + throw new RuntimeException("[F]"+e); + } + + } + +} diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java index ae4d2b4d..1aaad5ab 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java @@ -1,6 +1,9 @@ package cokr.xit.fims.crdn.service.bean; +import java.io.File; +import java.io.FilenameFilter; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -9,6 +12,8 @@ import javax.annotation.Resource; import org.springframework.stereotype.Service; +import cokr.xit.base.code.CommonCode; +import cokr.xit.base.code.service.bean.CodeBean; import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.bean.FileBean; @@ -24,6 +29,9 @@ import cokr.xit.fims.crdn.dao.CrdnListMapper; import cokr.xit.fims.crdn.dao.CrdnUpdtMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper; import cokr.xit.fims.crdn.dao.ImportMapper; +import cokr.xit.fims.crdn.send.nxrp.AttachedTxtMaker; +import cokr.xit.fims.crdn.send.nxrp.LinkFileMaker; +import cokr.xit.fims.crdn.send.nxrp.OnlyImageMaker; import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.cvlc.dao.CrdnCvlcptMapper; import cokr.xit.fims.cvlc.service.bean.CrdnCvlcptMainBean; @@ -33,6 +41,7 @@ import cokr.xit.fims.sprt.dao.TotalInfoMapper; import cokr.xit.fims.sprt.service.bean.MediaBean; import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.data.DataObject; +import net.lingala.zip4j.ZipFile; @Service("crdnService") public class CrdnServiceBean extends AbstractServiceBean implements CrdnService { @@ -64,6 +73,9 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService @Resource(name="fileBean") private FileBean fileBean; + @Resource(name="codeBean") + private CodeBean codeBean; + @Resource(name="mediaBean") private MediaBean mediaBean; @@ -352,38 +364,159 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService public String sendCrdn(String[] crdnIDs) { String rtnMsg = "[F]"; + List fimsVltnCodes = codeBean.getCodes("FIM004"); + List nxrpVltnCodes = codeBean.getCodes("NTR055"); + for(String crdnID : crdnIDs) { DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdnID); + if(crdnInfo.string("NXRP_CRDN_LINK_YN").equals("Y")) { + rtnMsg += "이미 세외수입 단속 연계 처리된 자료입니다."; + throw new RuntimeException(rtnMsg); + } + + String firstTaskSeCd = ""; String taskSeCd = crdnInfo.string("TASK_SE_CD"); + if(firstTaskSeCd.equals("")) { + firstTaskSeCd = taskSeCd; + } if(!taskSeCd.equals("PVS") && !taskSeCd.equals("BPV")) { rtnMsg += "주정차위반 또는 전용차로위반 자료만 처리 가능합니다."; throw new RuntimeException(rtnMsg); } + if(!firstTaskSeCd.equals(taskSeCd)) { + rtnMsg += "과태료 구분이 동일한 자료만 처리가능합니다."; + throw new RuntimeException(rtnMsg); + } + + if(crdnInfo.number("ATCH_FILE_CNT").intValue() < 1) { + rtnMsg += "단속사진이 없습니다."; + throw new RuntimeException(rtnMsg); + } + CmmnQuery cmmnQuery = new CmmnQuery(); cmmnQuery.setUseYN("Y"); cmmnQuery.setSggCd(crdnInfo.string("SGG_CD")); cmmnQuery.setTaskSeCd(taskSeCd); DataObject nxrpLinkInfo = taskMapper.selectTaskInfo(cmmnQuery); + if(nxrpLinkInfo == null) { + rtnMsg += "과태료 설정 정보가 없습니다."; + throw new RuntimeException(rtnMsg); + } String nxrpLinkSeCd = nxrpLinkInfo.string("NXRP_LINK_SE_CD"); String nxrpLinkSeDtlSn = nxrpLinkInfo.string("NXRP_LINK_SE_DTL_SN"); + if(!nxrpLinkSeCd.equals("B01") && !nxrpLinkSeCd.equals("C01")) { + rtnMsg += "세외수입 연계 구분 코드 설정 오류입니다."; + throw new RuntimeException(rtnMsg); + } + if(!nxrpLinkSeDtlSn.equals("01") && !nxrpLinkSeDtlSn.equals("02")) { + rtnMsg += "세외수입 연계 구분 상세 순번 설정 오류입니다."; + throw new RuntimeException(rtnMsg); + } + + String instDigit7 = currentUser().getInstitute(); + + //법정동코드 구하기 + if(!crdnInfo.string("CRDN_STDG_NM").equals("")) { + + Map stdgQuery = new HashMap<>(); + stdgQuery.put("sggCd", crdnInfo.string("SGG_CD")); + stdgQuery.put("emdNm", crdnInfo.string("CRDN_STDG_NM")); + List stdgCds = globalStngMapper.selectStdgCdListByStdgNm(stdgQuery); + + if(stdgCds != null && stdgCds.size() == 1 && stdgCds.get(0) != null && !stdgCds.get(0).equals("")) { + crdnInfo.put("STDG_CD", stdgCds.get(0)); + } + } + + LinkFileMaker linkFileMaker = null; if(nxrpLinkSeDtlSn.equals("01")) { - //TODO - } else if(nxrpLinkSeDtlSn.equals("02")){ - //TODO + linkFileMaker = new AttachedTxtMaker(nxrpLinkSeCd, instDigit7); + if(nxrpLinkSeCd.equals("B01")) { + + ((AttachedTxtMaker)linkFileMaker).appendVltnCodeInfo(fimsVltnCodes, nxrpVltnCodes); + } } else { - rtnMsg += "세외수입 연계 설정 오류"; - throw new RuntimeException(rtnMsg); + linkFileMaker = new OnlyImageMaker(nxrpLinkSeCd, instDigit7); + } + + String workPath = "files/temp/"+crdnInfo.string("SGG_CD")+"/"+crdnInfo.string("CRDN_ID"); + File workFolder = new File(workPath); + if(workFolder.exists()) { + boolean del = false; + File[] lf = workFolder.listFiles(); + if(lf != null && lf.length > 0) { + for(File f : lf) { + del = f.delete(); + if(!del) { + throw new RuntimeException("[F]파일삭제오류"); + } + } + } + del = workFolder.delete(); + if(!del) { + throw new RuntimeException("[F]파일삭제오류"); + } + } + workFolder.mkdirs(); + + try { + String[] items = null; + if(taskSeCd.equals("PVS")) { + items = linkFileMaker.extractForPVS(crdnInfo); + } else if(taskSeCd.equals("BPV")) { + items = linkFileMaker.extractForBPV(crdnInfo); + } + + if(nxrpLinkSeDtlSn.equals("01")) { + + ((AttachedTxtMaker)linkFileMaker).writeTextFileContents(workPath, items); + + } + + FileQuery fileQuery = new FileQuery(); + fileQuery.setInfoType(Crdn.INF_TYPE); + fileQuery.setInfoKeys(crdnID); + fileQuery.setOrderBy("SRT_ORD"); + List crdnFileList = fileBean.getFileList(fileQuery); + for(int j=0; (j , C.FFNLG_CRDN_AMT , C.ETC_CN + , C.ATCH_FILE_CNT , C.CRDN_STTS_CD , C.CRDN_STTS_CHG_DT + , C.NXRP_CRDN_LINK_YN + , C.NXRP_CRDN_LINK_USER_ID + , C.NXRP_CRDN_LINK_DT , C.LINK_TBL_NM , C.LINK_ID - , (SELECT VLTN_CD FROM TB_VLTN WHERE VLTN_ID = C.VLTN_ID) AS VLTN_CD - , CA.CRDN_SE_CD - , CA.TEAM_ID - , CA.DTL_CRDN_PLC + , V.VLTN_CD + , V.VLTN_LAW_NM + , V.VLTN_LAW1 + , V.VLTN_LAW2 + , CA.CRDN_SE_CD + , CA.TEAM_ID + , CA.DTL_CRDN_PLC , CA.CRDN_SPAREA_CD , CA.CRDN_BGNG_TM , CA.CRDN_END_TM - , CA.CRDN_SN + , CA.CRDN_SN + , C.GPS_X + , C.GPS_Y , CA.MOSC_X , CA.MOSC_Y , CA.TOWNG_YN @@ -131,10 +140,11 @@ , LE.LEVY_EXCL_SE_CD , LE.LEVY_EXCL_RSN_CD FROM TB_CRDN C - INNER JOIN TB_CRDN_ADI CA ON (C.CRDN_ID = CA.CRDN_ID) + INNER JOIN TB_CRDN_ADI CA ON (C.CRDN_ID = CA.CRDN_ID) + INNER JOIN TB_VLTN V ON (C.VLTN_ID = V.VLTN_ID) LEFT OUTER JOIN TB_CRDN_CVLCPT CC ON (C.CVLCPT_LINK_YN = 'Y' AND C.LINK_ID = CC.CVLCPT_LINK_ID) - LEFT OUTER JOIN TB_PAYER P ON (C.RTPYR_ID = P.RTPYR_ID) - LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID AND LE.DEL_YN = 'N') + LEFT OUTER JOIN TB_PAYER P ON (C.RTPYR_ID = P.RTPYR_ID) + LEFT OUTER JOIN TB_LEVY_EXCL LE ON (C.CRDN_ID = LE.CRDN_ID AND LE.DEL_YN = 'N') WHERE C.DEL_YN = 'N' AND C.CRDN_ID = #{crdnId} diff --git a/src/main/resources/sql/mapper/fims/crdn/crdn-updt-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/crdn-updt-mapper.xml index 2af4cbec..72b4e86d 100644 --- a/src/main/resources/sql/mapper/fims/crdn/crdn-updt-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/crdn-updt-mapper.xml @@ -179,4 +179,16 @@ AND DEL_YN = 'N' + + /* 세외수입 단속 연계 여부 변경(crdnUpdtMapper.updateNxrpCrdnLinkYn) */ + UPDATE TB_CRDN + SET NXRP_CRDN_LINK_YN = 'Y' + , NXRP_CRDN_LINK_DT = + , NXRP_CRDN_LINK_USER_ID = #{modifiedBy} + , MDFCN_DT = + , MDFR = #{modifiedBy} + WHERE CRDN_ID = #{crdnId} + AND DEL_YN = 'N' + + \ No newline at end of file diff --git a/src/main/resources/sql/mapper/fims/crdn/global-stng-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/global-stng-mapper.xml index 5f4cfff2..a69ccafb 100644 --- a/src/main/resources/sql/mapper/fims/crdn/global-stng-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/global-stng-mapper.xml @@ -63,6 +63,17 @@ SELECT CONCAT(A.EMD_NM, ORDER BY A.EMD_NM, A.LI_NM + +