diff --git a/src/main/java/cokr/xit/fims/crdn/service/CrdnService.java b/src/main/java/cokr/xit/fims/crdn/service/CrdnService.java index 843f4391..0e6558bf 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/CrdnService.java +++ b/src/main/java/cokr/xit/fims/crdn/service/CrdnService.java @@ -97,10 +97,5 @@ public interface CrdnService { */ int countCrdn(CrdnQuery crdnQuery); - /** 단속자료를 압축파일로 생성하여 세외수입으로 전송한다. - * @param crdnIds 단속ID 목록 - * @return 결과메시지 - */ - String sendCrdn(String[] crdnIds); } 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 5d789b87..716240b7 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,9 +1,6 @@ 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; @@ -12,13 +9,10 @@ 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.ZIP; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.bean.FileBean; -import cokr.xit.fims.cmmn.CmmnQuery; import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.service.bean.CrdnPayerHstryBean; import cokr.xit.fims.cmmn.service.bean.CrdnSttsHstryBean; @@ -36,14 +30,10 @@ import cokr.xit.fims.cvlc.dao.CrdnCvlcptMapper; import cokr.xit.fims.cvlc.service.bean.CrdnCvlcptMainBean; import cokr.xit.fims.excl.service.bean.LevyExclBean; import cokr.xit.fims.mngt.dao.TaskMapper; -import cokr.xit.fims.nxrp.support.AttachedTxtMaker; -import cokr.xit.fims.nxrp.support.LinkFileMaker; -import cokr.xit.fims.nxrp.support.OnlyImageMaker; 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 cokr.xit.interfaces.filejob.JobConf; @Service("crdnService") public class CrdnServiceBean extends AbstractServiceBean implements CrdnService { @@ -380,189 +370,5 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService return crdnListMapper.countCrdn(crdnQuery); } - @Override - public String sendCrdn(String[] crdnIds) { - String rtnMsg = "[F]"; - - List fimsVltnCodes = codeBean.getCodes("FIM004"); - List nxrpVltnCodes = codeBean.getCodes("NTR055"); - - DataObject deptStng = stngBean.getStng("dept"); - String gujesi = deptStng.string("NXRP_RGN_SE_CD"); - - 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 = crdnStngMapper.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")) { - linkFileMaker = new AttachedTxtMaker(nxrpLinkSeCd, instDigit7); - if(nxrpLinkSeCd.equals("B01")) { - ((AttachedTxtMaker)linkFileMaker).appendVltnCodeInfo(fimsVltnCodes, nxrpVltnCodes); - } - } else { - linkFileMaker = new OnlyImageMaker(nxrpLinkSeCd, instDigit7); - } - - if(!gujesi.equals("")) { - linkFileMaker.setGujesiStng(gujesi); - } - - String workPath = "files/temp/sendCrdn/"+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; - boolean includeTxt = nxrpLinkSeDtlSn.equals("01"); - - if(taskSeCd.equals("PVS")) { - items = linkFileMaker.extractForPVS(crdnInfo,includeTxt).get(); - } else if(taskSeCd.equals("BPV")) { - items = linkFileMaker.extractForBPV(crdnInfo,includeTxt).get(); - } - - 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 { - * "affected": 저장된 정보수 - * "saved": 저장되었으면 true, 그렇지 않으면 false - * } - */ - @Task - @RequestMapping(name="단속자료압축파일 세외수입 전송", value=METHOD_URL.sendCrdn) - public ModelAndView sendCrdn(String... crdnIds) { - ModelAndView mav = new ModelAndView("jsonView"); - boolean saved = false; - String rtnMsg = crdnService.sendCrdn(crdnIds); - if(rtnMsg.contains("[S]")) { - saved = true; - } - mav.addObject("saved", saved); - mav.addObject("rtnMsg", rtnMsg); - return mav; - } - /**지정한 ID의 단속 정보(info)를 반환한다. * @param query 단속 대장 조회 조건 * @return fims/crdn/crdn06020-info 또는 jsonView diff --git a/src/main/java/cokr/xit/fims/nxrp/service/NisIndivService.java b/src/main/java/cokr/xit/fims/nxrp/service/NisIndivService.java index b699688c..9a1ffa3f 100644 --- a/src/main/java/cokr/xit/fims/nxrp/service/NisIndivService.java +++ b/src/main/java/cokr/xit/fims/nxrp/service/NisIndivService.java @@ -2,9 +2,8 @@ package cokr.xit.fims.nxrp.service; import java.util.List; -import cokr.xit.foundation.data.DataObject; - import cokr.xit.fims.nxrp.NisIndivQuery; +import cokr.xit.foundation.data.DataObject; /**과태료 대장 단속 정보 등록 관리 서비스 인터페이스. * @@ -81,4 +80,21 @@ public interface NisIndivService { */ String updateNisIndivA03(NisIndivQuery req); + /**주정차 과태료 대장 단속 정보 등록 정보를 등록한다. + * @param req 주정차 과태료 대장 단속 정보 등록 + * @return 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + String createNisIndivB01(NisIndivQuery req); + + /**전용차로 과태료 대장 단속 정보 등록 정보를 등록한다. + * @param req 전용차로 과태료 대장 단속 정보 등록 + * @return 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + String createNisIndivC01(NisIndivQuery req); } diff --git a/src/main/java/cokr/xit/fims/nxrp/service/bean/NisIndivBean.java b/src/main/java/cokr/xit/fims/nxrp/service/bean/NisIndivBean.java index cb990dbe..40af4fd8 100644 --- a/src/main/java/cokr/xit/fims/nxrp/service/bean/NisIndivBean.java +++ b/src/main/java/cokr/xit/fims/nxrp/service/bean/NisIndivBean.java @@ -2,6 +2,8 @@ package cokr.xit.fims.nxrp.service.bean; import java.io.BufferedReader; import java.io.BufferedWriter; +import java.io.File; +import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; @@ -11,7 +13,9 @@ import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.annotation.Resource; import javax.net.ssl.HostnameVerifier; @@ -23,27 +27,39 @@ import javax.net.ssl.X509TrustManager; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import cokr.xit.base.code.CommonCode; +import cokr.xit.base.code.service.bean.CodeBean; +import cokr.xit.base.file.ZIP; +import cokr.xit.base.file.service.FileQuery; +import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.user.service.bean.UserBean; import cokr.xit.fims.cmmn.CmmnQuery; +import cokr.xit.fims.cmmn.service.bean.StngBean; +import cokr.xit.fims.crdn.Crdn; +import cokr.xit.fims.crdn.dao.CrdnInfoMapper; +import cokr.xit.fims.crdn.dao.CrdnStngMapper; import cokr.xit.fims.crdn.dao.CrdnUpdtMapper; +import cokr.xit.fims.mngt.dao.TaskMapper; import cokr.xit.fims.mngt.service.bean.FactionBean; import cokr.xit.fims.nxrp.A01; import cokr.xit.fims.nxrp.A02; -import cokr.xit.fims.nxrp.A03; import cokr.xit.fims.nxrp.A03Rqst; import cokr.xit.fims.nxrp.NisIndivQuery; import cokr.xit.fims.nxrp.dao.NisA01Mapper; import cokr.xit.fims.nxrp.dao.NisA02Mapper; import cokr.xit.fims.nxrp.dao.NisA03Mapper; +import cokr.xit.fims.nxrp.support.AttachedTxtMaker; +import cokr.xit.fims.nxrp.support.LinkFileMaker; +import cokr.xit.fims.nxrp.support.OnlyImageMaker; import cokr.xit.fims.sndb.SndbQuery; import cokr.xit.fims.sndb.SndngDtl; import cokr.xit.fims.sndb.dao.SndngDtlMapper; import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.data.DataObject; +import cokr.xit.interfaces.filejob.JobConf; /**과태료 대장 단속 정보 등록 정보 관리 Bean * @@ -78,10 +94,30 @@ public class NisIndivBean extends AbstractComponent { @Resource(name = "crdnUpdtMapper") private CrdnUpdtMapper crdnUpdtMapper; + @Resource(name="crdnInfoMapper") + private CrdnInfoMapper crdnInfoMapper; + + @Resource(name="crdnStngMapper") + private CrdnStngMapper crdnStngMapper; + + @Resource(name="taskMapper") + private TaskMapper taskMapper; + + @Resource(name="fileBean") + private FileBean fileBean; + /** 사용자 정보 DAO */ @Resource(name="userBean") protected UserBean userBean; + /** 코드 정보 DAO */ + @Resource(name="codeBean") + protected CodeBean codeBean; + + /** 설정 정보 DAO */ + @Resource(name="stngBean") + protected StngBean stngBean; + /** 부서 정보 DAO */ @Resource(name = "factionBean") private FactionBean factionBean; @@ -818,4 +854,192 @@ public class NisIndivBean extends AbstractComponent { } // SSL 무시 ///////////////////////////////////////////////////////////////// + public String createNisIndivB01C01(NisIndivQuery req) { + + String[] crdnIds = req.getCrdnIds(); + + String rtnMsg = "[F]"; + + List fimsVltnCodes = codeBean.getCodes("FIM004"); + List nxrpVltnCodes = codeBean.getCodes("NTR055"); + + DataObject deptStng = stngBean.getStng("dept"); + String gujesi = deptStng.string("NXRP_RGN_SE_CD"); + + 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 = crdnStngMapper.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")) { + linkFileMaker = new AttachedTxtMaker(nxrpLinkSeCd, instDigit7); + if(nxrpLinkSeCd.equals("B01")) { + + ((AttachedTxtMaker)linkFileMaker).appendVltnCodeInfo(fimsVltnCodes, nxrpVltnCodes); + } + } else { + linkFileMaker = new OnlyImageMaker(nxrpLinkSeCd, instDigit7); + } + + if(!gujesi.equals("")) { + linkFileMaker.setGujesiStng(gujesi); + } + + String workPath = "files/temp/sendCrdn/"+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; + boolean includeTxt = nxrpLinkSeDtlSn.equals("01"); + + if(taskSeCd.equals("PVS")) { + items = linkFileMaker.extractForPVS(crdnInfo,includeTxt).get(); + } else if(taskSeCd.equals("BPV")) { + items = linkFileMaker.extractForBPV(crdnInfo,includeTxt).get(); + } + + 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 { + * "saved": 등록되었으면 true, 그렇지 않으면 false + * } + */ + @Task("PVS") + @RequestMapping(name="차세대 세외수입 주정차 과태료 대장 단속 정보 등록", value=METHOD_URL.createIndividualB01) + public ModelAndView createIndividualB01(NisIndivQuery req) { + boolean saved = false; + String rtnMsg = nisIndivService.createNisIndivB01(req); + + if (rtnMsg.contains("[S]")) { + saved = true; + } else { + saved = false; + } + + return new ModelAndView("jsonView") + .addObject("saved", saved) + .addObject("rtnMsg", rtnMsg); + } + + /**전용차로 과태료 대장 단속 정보 등록를 등록한다. + * @param nisIndivC01 전용차로 과태료 대장 단속 정보 등록 정보 + * @return jsonView + *
 {
+     *     "saved": 등록되었으면 true, 그렇지 않으면 false
+     * }
+ */ + @Task("BPV") + @RequestMapping(name="차세대 세외수입 전용차로 과태료 대장 단속 정보 등록", value=METHOD_URL.createIndividualC01) + public ModelAndView createIndividualC01(NisIndivQuery req) { + boolean saved = false; + String rtnMsg = nisIndivService.createNisIndivC01(req); + + if (rtnMsg.contains("[S]")) { + saved = true; + } else { + saved = false; + } + + return new ModelAndView("jsonView") + .addObject("saved", saved) + .addObject("rtnMsg", rtnMsg); + } } diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp index 1b853671..0195c04e 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn06010-main.jsp @@ -514,9 +514,17 @@ $(document).ready(function(){ var taskSeCd = datas[0].TASK_SE_CD; var keys = $P.crdnControl.dataset.getKeys("selected"); - + var url = ""; + if(taskSeCd == "PVS"){ + url = "/"+taskSeCd+"/nxrp/nxrp01/010/createIndivB01.do"; + } else if(taskSeCd == "BPV"){ + url = "/"+taskSeCd+"/nxrp/nxrp01/010/createIndivC01.do"; + } else { + return; + } + ajax.post({ - url : wctx.url("/"+taskSeCd+"/crdn/crdn06/010/sendCrdn.do"), + url : wctx.url(url), data : { "crdnIds" : keys.join(",") }, success : (resp) => { if(resp.saved){