diff --git a/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java b/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java index 6294f026..95019910 100644 --- a/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java +++ b/src/main/java/cokr/xit/fims/cvlc/service/CrdnCvlcptService.java @@ -54,7 +54,7 @@ public interface CrdnCvlcptService { * @param nonQueryRequest 처리 요청, crdnCvlcpt 단속민원정보, crdn 단속정보, newFileInfoList 업로드 파일 목록 * @return 저장여부 */ - boolean updateCvlcptPrcsSe(Map nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn, List newFileInfoList); + boolean updateCvlcptProcessSection(Map nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn, List newFileInfoList); /** 단속민원 자료를 복사하여 신규단속자료를 생성한다. * @param crdnId 단속 ID diff --git a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java index 2599617d..425121e6 100644 --- a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java +++ b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptServiceBean.java @@ -16,12 +16,9 @@ import org.springframework.stereotype.Service; import org.springframework.util.ResourceUtils; import cokr.xit.base.file.FileInfo; -import cokr.xit.base.file.FileInfo.Relation; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.bean.FileBean; -import cokr.xit.base.file.web.FileInfoFactory; import cokr.xit.fims.cmmn.CmmnUtil; -import cokr.xit.fims.cmmn.CrdnPayerHstry; import cokr.xit.fims.cmmn.CrdnSttsHstry; import cokr.xit.fims.cmmn.dao.CrdnPayerHstryMapper; import cokr.xit.fims.cmmn.dao.CrdnSttsHstryMapper; @@ -39,7 +36,6 @@ import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.cvlc.dao.AnswerWordsMapper; import cokr.xit.fims.cvlc.dao.CrdnCvlcptMapper; import cokr.xit.fims.cvlc.service.CrdnCvlcptService; -import cokr.xit.fims.excl.LevyExcl; import cokr.xit.fims.excl.dao.LevyExclMapper; import cokr.xit.fims.excl.service.bean.Excl01Bean; import cokr.xit.fims.sprt.Sprt; @@ -308,40 +304,9 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdnId); - //부과제외 대장을 등록 한다. - LevyExcl excl01 = new LevyExcl(); - excl01.setSggCd(crdnInfo.string("SGG_CD")); - excl01.setTaskSeCd(crdnInfo.string("TASK_SE_CD")); - excl01.setCrdnId(crdnInfo.string("CRDN_ID")); - excl01.setLevyExclYmd((new SimpleDateFormat("yyyyMMdd")).format(new Date())); - excl01.setLevyExclSeCd("1"); - excl01.setLevyExclRsnCd("191"); - excl01.setEtcCn("이송(이첩)"); - saved = levyExclMapper.insert(excl01); - if (!saved) { - throw new RuntimeException("반송처리 중 부과제외 대장 등록에 실패하였습니다."); - } - - //단속상태를 변경한다. - Crdn crdn = new Crdn(); - crdn.setCrdnId(crdnId); - crdn.setCrdnSttsCd("81"); - saved = crdnUpdtMapper.updateCrdnStatus(crdn) == 1 ? true : false; - if (!saved) { - throw new RuntimeException("반송처리 중 단속상태변경에 실패하였습니다."); - } - - //단속상태 변경 이력 기록 - CrdnSttsHstry crdnSttsHstry = new CrdnSttsHstry(); - crdnSttsHstry.setCrdnId(crdnId); - crdnSttsHstry.setBfrSttsCd(crdnInfo.string("CRDN_STTS_CD")); - crdnSttsHstry.setBfrSttsChgDt(crdnInfo.string("CRDN_STTS_CHG_DT")); - crdnSttsHstry.setCrdnSttsCd("81"); - crdnSttsHstry.setTaskDtlId(excl01.getLevyExclId()); - crdnSttsHstry.setEtcCn("이송(이첩)"); - saved = crdnSttsHstryMapper.insert(crdnSttsHstry); - if (!saved) { - throw new RuntimeException("반송 처리 중 단속상태이력 등록에 실패하였습니다."); + saved = crdnCvlcptSubBean.executelevyExcl("sendBack", crdnId); + if(!saved) { + throw new RuntimeException("반송 처리 중 서손처리에 실패하였습니다."); } boolean isFirstBorn = crdnInfo.string("CRDN_REG_SE_CD").equals("02"); @@ -370,136 +335,17 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv } @Override - public boolean updateCvlcptPrcsSe(Map nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn, List newFileInfoList) { + public boolean updateCvlcptProcessSection(Map nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn, List newFileInfoList) { boolean saved = false; DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdn.getCrdnId()); - - crdnCvlcpt.setCvlcptLinkId(crdnInfo.string("CVLCPT_LINK_ID")); - String acceptType = (String)ifEmpty(nonQueryRequest.get("acceptType"), ""); - - //첨수파일 수 변경 - int fileInsertCnt = 0; - int fileDeleteCnt = 0; - if(newFileInfoList != null && !newFileInfoList.isEmpty()) { - fileInsertCnt = newFileInfoList.size(); - } - String[] deleteFileKeyList = (String[])ifEmpty(nonQueryRequest.get("deleteFileKeyList"), new String[] {}); - if(deleteFileKeyList.length > 0) { - fileDeleteCnt = deleteFileKeyList.length; - } - int changeFileCnt = (fileInsertCnt - fileDeleteCnt); - nonQueryRequest.put("changeFileCnt", changeFileCnt); - - //금액 변경 - if(crdnInfo.string("TASK_SE_CD").equals("PVS") && "Y".equals(crdnInfo.string("OVTIME_PRTTN_YN"))) { - nonQueryRequest.put("changeAmountYn","N"); - } else { - int[] basicAmt = crdnStngBean.getBasicAmt(crdn); - int ffnlgCrdnAmt = crdnInfo.number("FFNLG_CRDN_AMT").intValue(); - if(ffnlgCrdnAmt != basicAmt[0]){ - nonQueryRequest.put("changeAmountYn","Y"); - crdn.setFfnlgCrdnAmt(basicAmt[0]); - crdn.setFfnlgAmt(basicAmt[0]); - crdn.setAdvntceAmt(basicAmt[1]); - crdn.setFfnlgRductRt("0"); - } else { - nonQueryRequest.put("changeAmountYn","N"); - } - } - - //납부자 변경 - if(!crdnInfo.string("RTPYR_ID").equals(crdn.getRtpyrId())) { - nonQueryRequest.put("changePayerYn","Y"); - } else { - nonQueryRequest.put("changePayerYn","N"); - } - - //단속상태값 변경 - nonQueryRequest.put("changeStatusYn","Y"); - if(acceptType.equals("accept")) { - if(!crdnInfo.string("CRDN_REG_SE_CD").equals("02") - || Arrays.asList(new String[]{"04","05","06"}).contains(crdnInfo.string("CVLCPT_TRSM_CD"))) { - crdn.setCrdnSttsCd("22"); - } else { - crdn.setCrdnSttsCd("21"); - } - - } else if(acceptType.equals("someAccept")){ - crdn.setCrdnSttsCd("83"); - } else if(acceptType.equals("nonAccept")) { - crdn.setCrdnSttsCd("81"); - } else { - throw new RuntimeException("단속민원답변 수정에 실패하였습니다."); - } - - //부과 제외 대장 등록 - String dtlTaskId = ""; - if(acceptType.equals("someAccept") || acceptType.equals("nonAccept")) { //일부수용,불수용 - boolean retSuccess = false; - LevyExcl excl01 = new LevyExcl(); - excl01.setCrdnId(crdn.getCrdnId()); - excl01.setSggCd(crdn.getSggCd()); - excl01.setTaskSeCd(crdn.getTaskSeCd()); - excl01.setLevyExclYmd(crdn.getLevyExclYmd()); - excl01.setLevyExclSeCd(crdn.getLevyExclSeCd()); - excl01.setLevyExclRsnCd(crdn.getLevyExclRsnCd()); - excl01.setEtcCn(crdn.getEtcCn()); - - retSuccess = levyExclMapper.insert(excl01); - if (!retSuccess) { - // 예외를 발생시켜서 오류메세지를 보내고 DB Rollback - throw new RuntimeException("부과제외 대장 등록에 실패하였습니다."); - } - - dtlTaskId = excl01.getLevyExclId(); - } else { - dtlTaskId = crdn.getCrdnId(); - } - - //단속정보변경 - saved = crdnCvlcptSubBean.updateCrdn(nonQueryRequest, crdn); + saved = crdnCvlcptSubBean.updateSubInfo(nonQueryRequest, crdn, newFileInfoList); if(!saved) { - throw new RuntimeException("단속민원답변 수정 중 단속정보변경에 실패하였습니다."); - } - - - - //단속 납부자 변경 이력 등록 - if(((String)nonQueryRequest.get("changePayerYn")).equals("Y")) { - CrdnPayerHstry crdnPayerHstry = new CrdnPayerHstry(); - - crdnPayerHstry.setCrdnId(crdn.getCrdnId()); - crdnPayerHstry.setRtpyrId(crdn.getRtpyrId()); - - boolean retSuccess = crdnPayerHstryMapper.insert(crdnPayerHstry); - if(!retSuccess) { - throw new RuntimeException("단속민원답변 수정 중 단속납부자변경 이력 등록에 실패하였습니다."); - } - } - - //단속상태 변경 이력 등록 - if(((String)nonQueryRequest.get("changeStatusYn")).equals("Y")) { - CrdnSttsHstry crdnSttsHstry = new CrdnSttsHstry(); - - crdnSttsHstry.setCrdnId(crdn.getCrdnId()); - crdnSttsHstry.setBfrSttsCd(crdnInfo.string("CRDN_STTS_CD")); - crdnSttsHstry.setBfrSttsChgDt(crdnInfo.string("CRDN_STTS_CHG_DT")); - crdnSttsHstry.setCrdnSttsCd(crdn.getCrdnSttsCd()); - crdnSttsHstry.setTaskDtlId(dtlTaskId); - if(crdn.getCrdnSttsCd().equals("81") || crdn.getCrdnSttsCd().equals("83")) { - crdnSttsHstry.setEtcCn("부과제외 대장 등록"); - } else { - crdnSttsHstry.setEtcCn("민원 요청 수용"); - } - - boolean retSuccess = crdnSttsHstryMapper.insert(crdnSttsHstry); - if(!retSuccess) { - throw new RuntimeException("단속민원답변 수정 중 단속상태변경 이력 등록에 실패하였습니다."); - } + throw new RuntimeException("민원자료 저장 중 오류가 발생하였습니다."); } + crdnCvlcpt.setCvlcptLinkId(crdnInfo.string("CVLCPT_LINK_ID")); boolean isFirstBorn = crdnInfo.string("CRDN_REG_SE_CD").equals("02"); boolean isNotYetTransmit = !Arrays.asList(new String[]{"04","05","06"}).contains(crdnInfo.string("CVLCPT_TRSM_CD")); @@ -569,58 +415,12 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv } } - //파일 처리 - if(newFileInfoList != null && !newFileInfoList.isEmpty()) { - int fileInsertEffected = fileBean.create(newFileInfoList); - if(fileInsertCnt != fileInsertEffected) { - throw new RuntimeException("단속민원답변 수정 중 파일 등록에 실패하였습니다."); - } - } - if(deleteFileKeyList.length > 0) { - int fileDeleteEffected = fileBean.remove((String[])nonQueryRequest.get("deleteFileKeyList")); - if(fileDeleteCnt != fileDeleteEffected) { - throw new RuntimeException("단속민원답변 수정 중 파일 삭제에 실패하였습니다."); - } - } - return saved; } @Override public boolean copyCvlcptCrdnInfo(String crdnId) { - - FileQuery fileQuery = new FileQuery().setInfoType(Crdn.INF_TYPE).setInfoKeys(crdnId); - List orgnlCrdnFileList = fileBean.getFileList(fileQuery); - - - String newCrdnId = crdnCvlcptSubBean.insertCrdnFromSelect(crdnId); - if(ifEmpty(newCrdnId, () -> "").equals("")) { - throw new RuntimeException("단속민원 복사 등록 중 단속대장 등록에 실패하였습니다."); - } - - - if (!orgnlCrdnFileList.isEmpty() && orgnlCrdnFileList.size() > 0) { - List fileInfoList = new ArrayList(); - - List files = new ArrayList<>(); - for (int iLoop = 0; iLoop < orgnlCrdnFileList.size(); iLoop++) { - files.add(new File(orgnlCrdnFileList.get(iLoop).string("FILE_PATH"))); - } - - Relation relation = new Relation(); - relation.setInfoType(Crdn.INF_TYPE); - relation.setInfoKey(newCrdnId); - fileInfoList = new FileInfoFactory().createFileInfos(relation, files); - for (int iLoop = 0; iLoop < fileInfoList.size(); iLoop++) { - fileInfoList.get(iLoop).setName(orgnlCrdnFileList.get(iLoop).string("FILE_NM")); - } - int effected = fileBean.create(fileInfoList); - if(effected == 0) { - throw new RuntimeException("단속민원 복사 등록 중 파일복사에 실패하였습니다."); - } - } - - return true; + return crdnCvlcptSubBean.copyCvlcptCrdnInfo(crdnId); } @Override @@ -656,11 +456,6 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv return false; } - int effected = crdnCvlcptMapper.updateAnswerTargetTransmitStatus(crdnCvlcpt); - if(effected != 1) { - throw new RuntimeException("민원 전송 상태 변경 중 오류가 발생하였습니다."); - } - //단속상태 변경(차적조회완료 -> 부과대상) if(targetDataList.get(i).string("CRDN_STTS_CD").equals("21")) { CrdnSttsHstry crdnSttsHstry = new CrdnSttsHstry(); @@ -676,6 +471,10 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv } } + int effected = crdnCvlcptMapper.updateAnswerTargetTransmitStatus(crdnCvlcpt); + if(effected != 1) { + throw new RuntimeException("민원 전송 상태 변경 중 오류가 발생하였습니다."); + } if(processType.equals("answerExecute")) { boolean result = crdnCvlcptMainBean.insertTransmitInfo(false, targetDataList.get(i).string("CVLCPT_LINK_ID")); @@ -781,40 +580,9 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv boolean result = vehicleResultMap.get(vhrno); if(result) { - //부과제외 대장을 등록 한다. - LevyExcl excl01 = new LevyExcl(); - excl01.setSggCd(crdnInfo.string("SGG_CD")); - excl01.setTaskSeCd(crdnInfo.string("TASK_SE_CD")); - excl01.setCrdnId(crdnInfo.string("CRDN_ID")); - excl01.setLevyExclYmd((new SimpleDateFormat("yyyyMMdd")).format(new Date())); - excl01.setLevyExclSeCd("1"); - excl01.setLevyExclRsnCd("103"); - excl01.setEtcCn("표지조회실행"); - boolean saved = levyExclMapper.insert(excl01); - if (!saved) { - throw new RuntimeException("서손처리 중 부과제외 대장 등록에 실패하였습니다."); - } - - //단속자료 변경 - Crdn crdn = new Crdn(); - crdn.setCrdnId(crdnInfo.string("CRDN_ID")); - crdn.setCrdnSttsCd("81"); - saved = crdnUpdtMapper.updateCrdnStatus(crdn) == 1 ? true : false; - if (!saved) { - throw new RuntimeException("서손처리 중 단속상태변경에 실패하였습니다."); - } - - //단속상태 변경 이력 기록 - CrdnSttsHstry crdnSttsHstry = new CrdnSttsHstry(); - crdnSttsHstry.setCrdnId(crdn.getCrdnId()); - crdnSttsHstry.setBfrSttsCd(crdnInfo.string("CRDN_STTS_CD")); - crdnSttsHstry.setBfrSttsChgDt(crdnInfo.string("CRDN_STTS_CHG_DT")); - crdnSttsHstry.setCrdnSttsCd("81"); - crdnSttsHstry.setTaskDtlId(excl01.getLevyExclId()); - crdnSttsHstry.setEtcCn("표지조회실행"); - saved = crdnSttsHstryMapper.insert(crdnSttsHstry); - if (!saved) { - throw new RuntimeException("서손처리 중 단속상태이력 등록에 실패하였습니다."); + boolean saved = crdnCvlcptSubBean.executelevyExcl("inquireTag", crdnInfo.string("CRDN_ID")); + if(!saved) { + throw new RuntimeException("서손처리에 실패하였습니다."); } boolean isFirstBorn = crdnInfo.string("CRDN_REG_SE_CD").equals("02"); @@ -850,7 +618,6 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv } - } else { Crdn crdn = new Crdn(); crdn.setCrdnId(crdnInfo.string("CRDN_ID")); diff --git a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptSubBean.java b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptSubBean.java index 997f9041..03b0b72b 100644 --- a/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptSubBean.java +++ b/src/main/java/cokr/xit/fims/cvlc/service/bean/CrdnCvlcptSubBean.java @@ -1,5 +1,10 @@ package cokr.xit.fims.cvlc.service.bean; +import java.io.File; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -9,11 +14,26 @@ import org.springframework.stereotype.Component; import cokr.xit.base.code.dao.CodeMapper; import cokr.xit.base.code.service.CodeQuery; +import cokr.xit.base.file.FileInfo; +import cokr.xit.base.file.FileInfo.Relation; +import cokr.xit.base.file.service.FileQuery; +import cokr.xit.base.file.service.bean.FileBean; +import cokr.xit.base.file.web.FileInfoFactory; +import cokr.xit.fims.cmmn.CrdnPayerHstry; +import cokr.xit.fims.cmmn.CrdnSttsHstry; +import cokr.xit.fims.cmmn.dao.CrdnPayerHstryMapper; +import cokr.xit.fims.cmmn.dao.CrdnSttsHstryMapper; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.dao.CrdnInfoMapper; +import cokr.xit.fims.crdn.dao.CrdnUpdtMapper; +import cokr.xit.fims.crdn.service.bean.CrdnStngBean; import cokr.xit.fims.cvlc.CrdnCvlcpt; +import cokr.xit.fims.cvlc.dao.AnswerWordsMapper; import cokr.xit.fims.cvlc.dao.CrdnCvlcptMapper; import cokr.xit.fims.cvlc.dao.WarningWordsMapper; +import cokr.xit.fims.excl.LevyExcl; +import cokr.xit.fims.excl.dao.LevyExclMapper; import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.UserInfo; import cokr.xit.foundation.data.DataObject; @@ -27,9 +47,33 @@ public class CrdnCvlcptSubBean extends AbstractComponent { @Resource(name = "crdnCvlcptMapper") private CrdnCvlcptMapper crdnCvlcptMapper; + @Resource(name = "crdnInfoMapper") + private CrdnInfoMapper crdnInfoMapper; + + @Resource(name = "crdnUpdtMapper") + private CrdnUpdtMapper crdnUpdtMapper; + + @Resource(name = "crdnStngBean") + private CrdnStngBean crdnStngBean; + + @Resource(name = "fileBean") + private FileBean fileBean; + @Resource(name = "codeMapper") private CodeMapper codeMapper; + @Resource(name = "levyExclMapper") + private LevyExclMapper levyExclMapper; + + @Resource(name = "answerWordsMapper") + private AnswerWordsMapper answerWordsMapper; + + @Resource(name = "crdnPayerHstryMapper") + private CrdnPayerHstryMapper crdnPayerHstryMapper; + + @Resource(name = "crdnSttsHstryMapper") + private CrdnSttsHstryMapper crdnSttsHstryMapper; + @Resource(name = "warningWordsMapper") private WarningWordsMapper warningWordsMapper; @@ -107,4 +151,258 @@ public class CrdnCvlcptSubBean extends AbstractComponent { return warningWordsMapper.updateWarningWordsInfo(crdnCvlcpt) == 1 ? true : false; } } + + /** 민원초기자료 상세화면에서 입력한 값대로 단속정보,납부자정보를 수정한다. + * @param nonQueryRequest 수정 요청, crdn 단속정보, 파일정보 newFileInfoList + * @return 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + + public boolean updateSubInfo(Map nonQueryRequest, Crdn crdn, + List newFileInfoList) { + + boolean saved = false; + + DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdn.getCrdnId()); + + + String acceptType = (String)ifEmpty(nonQueryRequest.get("acceptType"), ""); + + + //첨수파일 수 변경 + int fileInsertCnt = 0; + int fileDeleteCnt = 0; + if(newFileInfoList != null && !newFileInfoList.isEmpty()) { + fileInsertCnt = newFileInfoList.size(); + } + String[] deleteFileKeyList = (String[])ifEmpty(nonQueryRequest.get("deleteFileKeyList"), new String[] {}); + if(deleteFileKeyList.length > 0) { + fileDeleteCnt = deleteFileKeyList.length; + } + int changeFileCnt = (fileInsertCnt - fileDeleteCnt); + nonQueryRequest.put("changeFileCnt", changeFileCnt); + + //금액 변경 + if(crdnInfo.string("TASK_SE_CD").equals("PVS") && "Y".equals(crdnInfo.string("OVTIME_PRTTN_YN"))) { + nonQueryRequest.put("changeAmountYn","N"); + } else { + int[] basicAmt = crdnStngBean.getBasicAmt(crdn); + int ffnlgCrdnAmt = crdnInfo.number("FFNLG_CRDN_AMT").intValue(); + if(ffnlgCrdnAmt != basicAmt[0]){ + nonQueryRequest.put("changeAmountYn","Y"); + crdn.setFfnlgCrdnAmt(basicAmt[0]); + crdn.setFfnlgAmt(basicAmt[0]); + crdn.setAdvntceAmt(basicAmt[1]); + crdn.setFfnlgRductRt("0"); + } else { + nonQueryRequest.put("changeAmountYn","N"); + } + } + + //납부자 변경 + if(!crdnInfo.string("RTPYR_ID").equals(crdn.getRtpyrId())) { + nonQueryRequest.put("changePayerYn","Y"); + } else { + nonQueryRequest.put("changePayerYn","N"); + } + + //단속상태값 변경 + nonQueryRequest.put("changeStatusYn","Y"); + if(acceptType.equals("accept")) { + if(!crdnInfo.string("CRDN_REG_SE_CD").equals("02") + || Arrays.asList(new String[]{"04","05","06"}).contains(crdnInfo.string("CVLCPT_TRSM_CD"))) { + crdn.setCrdnSttsCd("22"); + } else { + crdn.setCrdnSttsCd("21"); + } + + } else if(acceptType.equals("someAccept")){ + crdn.setCrdnSttsCd("83"); + } else if(acceptType.equals("nonAccept")) { + crdn.setCrdnSttsCd("81"); + } else { + throw new RuntimeException("단속민원답변 수정에 실패하였습니다."); + } + + //부과 제외 대장 등록 + String dtlTaskId = ""; + if(acceptType.equals("someAccept") || acceptType.equals("nonAccept")) { //일부수용,불수용 + boolean retSuccess = false; + LevyExcl excl01 = new LevyExcl(); + excl01.setCrdnId(crdn.getCrdnId()); + excl01.setSggCd(crdn.getSggCd()); + excl01.setTaskSeCd(crdn.getTaskSeCd()); + excl01.setLevyExclYmd(crdn.getLevyExclYmd()); + excl01.setLevyExclSeCd(crdn.getLevyExclSeCd()); + excl01.setLevyExclRsnCd(crdn.getLevyExclRsnCd()); + excl01.setEtcCn(crdn.getEtcCn()); + + retSuccess = levyExclMapper.insert(excl01); + if (!retSuccess) { + // 예외를 발생시켜서 오류메세지를 보내고 DB Rollback + throw new RuntimeException("부과제외 대장 등록에 실패하였습니다."); + } + + dtlTaskId = excl01.getLevyExclId(); + } else { + dtlTaskId = crdn.getCrdnId(); + } + + //단속정보변경 + saved = this.updateCrdn(nonQueryRequest, crdn); + if(!saved) { + throw new RuntimeException("단속민원답변 수정 중 단속정보변경에 실패하였습니다."); + } + + //단속 납부자 변경 이력 등록 + if(((String)nonQueryRequest.get("changePayerYn")).equals("Y")) { + CrdnPayerHstry crdnPayerHstry = new CrdnPayerHstry(); + + crdnPayerHstry.setCrdnId(crdn.getCrdnId()); + crdnPayerHstry.setRtpyrId(crdn.getRtpyrId()); + + boolean retSuccess = crdnPayerHstryMapper.insert(crdnPayerHstry); + if(!retSuccess) { + throw new RuntimeException("단속민원답변 수정 중 단속납부자변경 이력 등록에 실패하였습니다."); + } + } + + //단속상태 변경 이력 등록 + if(((String)nonQueryRequest.get("changeStatusYn")).equals("Y")) { + CrdnSttsHstry crdnSttsHstry = new CrdnSttsHstry(); + + crdnSttsHstry.setCrdnId(crdn.getCrdnId()); + crdnSttsHstry.setBfrSttsCd(crdnInfo.string("CRDN_STTS_CD")); + crdnSttsHstry.setBfrSttsChgDt(crdnInfo.string("CRDN_STTS_CHG_DT")); + crdnSttsHstry.setCrdnSttsCd(crdn.getCrdnSttsCd()); + crdnSttsHstry.setTaskDtlId(dtlTaskId); + if(crdn.getCrdnSttsCd().equals("81") || crdn.getCrdnSttsCd().equals("83")) { + crdnSttsHstry.setEtcCn("부과제외 대장 등록"); + } else { + crdnSttsHstry.setEtcCn("민원 요청 수용"); + } + + boolean retSuccess = crdnSttsHstryMapper.insert(crdnSttsHstry); + if(!retSuccess) { + throw new RuntimeException("단속민원답변 수정 중 단속상태변경 이력 등록에 실패하였습니다."); + } + } + + //파일 처리 + if(newFileInfoList != null && !newFileInfoList.isEmpty()) { + int fileInsertEffected = fileBean.create(newFileInfoList); + if(fileInsertCnt != fileInsertEffected) { + throw new RuntimeException("단속민원답변 수정 중 파일 등록에 실패하였습니다."); + } + } + if(deleteFileKeyList.length > 0) { + int fileDeleteEffected = fileBean.remove((String[])nonQueryRequest.get("deleteFileKeyList")); + if(fileDeleteCnt != fileDeleteEffected) { + throw new RuntimeException("단속민원답변 수정 중 파일 삭제에 실패하였습니다."); + } + } + + return true; + } + + /** 단속자료를 복사하여 신규단속자료를 생성한다. + * @param crdnId 단속 ID + * @return 저장여부 + */ + public boolean copyCvlcptCrdnInfo(String crdnId) { + FileQuery fileQuery = new FileQuery().setInfoType(Crdn.INF_TYPE).setInfoKeys(crdnId); + List orgnlCrdnFileList = fileBean.getFileList(fileQuery); + + + String newCrdnId = this.insertCrdnFromSelect(crdnId); + if(ifEmpty(newCrdnId, () -> "").equals("")) { + throw new RuntimeException("단속민원 복사 등록 중 단속대장 등록에 실패하였습니다."); + } + + + if (!orgnlCrdnFileList.isEmpty() && orgnlCrdnFileList.size() > 0) { + List fileInfoList = new ArrayList(); + + List files = new ArrayList<>(); + for (int iLoop = 0; iLoop < orgnlCrdnFileList.size(); iLoop++) { + files.add(new File(orgnlCrdnFileList.get(iLoop).string("FILE_PATH"))); + } + + Relation relation = new Relation(); + relation.setInfoType(Crdn.INF_TYPE); + relation.setInfoKey(newCrdnId); + fileInfoList = new FileInfoFactory().createFileInfos(relation, files); + for (int iLoop = 0; iLoop < fileInfoList.size(); iLoop++) { + fileInfoList.get(iLoop).setName(orgnlCrdnFileList.get(iLoop).string("FILE_NM")); + } + int effected = fileBean.create(fileInfoList); + if(effected == 0) { + throw new RuntimeException("단속민원 복사 등록 중 파일복사에 실패하였습니다."); + } + } + + return true; + } + + /** 단속자료에 대해 서손 처리한다. + * @param trigger 서손 실행 원인, crdnId 단속 ID + * @return 저장여부 + */ + public boolean executelevyExcl(String trigger, String crdnId) { + boolean saved = false; + + String levyExclRsnCd = ""; + String etcCn = ""; + + DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdnId); + if(trigger.equals("sendBack")) { //반송으로 인한 서손 + levyExclRsnCd = "191"; + etcCn = "이송(이첩)"; + } else if(trigger.equals("inquireTag")) { //표지조회실행으로 인한 서손 + levyExclRsnCd = "103"; + etcCn = "표지조회실행"; + } else { + return false; + } + + //부과제외 대장을 등록 한다. + LevyExcl excl01 = new LevyExcl(); + excl01.setSggCd(crdnInfo.string("SGG_CD")); + excl01.setTaskSeCd(crdnInfo.string("TASK_SE_CD")); + excl01.setCrdnId(crdnInfo.string("CRDN_ID")); + excl01.setLevyExclYmd((new SimpleDateFormat("yyyyMMdd")).format(new Date())); + excl01.setLevyExclSeCd("1"); + excl01.setLevyExclRsnCd(levyExclRsnCd); + excl01.setEtcCn(etcCn); + saved = levyExclMapper.insert(excl01); + if (!saved) { + throw new RuntimeException("서손처리 중 부과제외 대장 등록에 실패하였습니다."); + } + + //단속상태를 변경한다. + Crdn crdn = new Crdn(); + crdn.setCrdnId(crdnId); + crdn.setCrdnSttsCd("81"); + saved = crdnUpdtMapper.updateCrdnStatus(crdn) == 1 ? true : false; + if (!saved) { + throw new RuntimeException("서손처리 중 단속상태변경에 실패하였습니다."); + } + + //단속상태 변경 이력 기록 + CrdnSttsHstry crdnSttsHstry = new CrdnSttsHstry(); + crdnSttsHstry.setCrdnId(crdnId); + crdnSttsHstry.setBfrSttsCd(crdnInfo.string("CRDN_STTS_CD")); + crdnSttsHstry.setBfrSttsChgDt(crdnInfo.string("CRDN_STTS_CHG_DT")); + crdnSttsHstry.setCrdnSttsCd("81"); + crdnSttsHstry.setTaskDtlId(excl01.getLevyExclId()); + crdnSttsHstry.setEtcCn(etcCn); + saved = crdnSttsHstryMapper.insert(crdnSttsHstry); + if (!saved) { + throw new RuntimeException("서손처리 중 단속상태이력 등록에 실패하였습니다."); + } + + return true; + } } diff --git a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java index 4a48b3ec..5c0966cd 100644 --- a/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java +++ b/src/main/java/cokr/xit/fims/cvlc/web/Cvlc01Controller.java @@ -40,7 +40,7 @@ public class Cvlc01Controller extends ApplicationController { getCivilComplaintReceiptDataList = "/010/list.do", removeCivilComplaint = "/010/remove.do", getCivilComplaintReceiptInitialDataInfo = "/020/info.do", - saveCivilComplaintProcessSe = "/020/update.do", + saveCivilComplaintProcessSection = "/020/update.do", copyCivilComplaintInfo = "/020/create.do", sendBackCivilComplaintInfo = "/020/remove.do", getCivilComplaintOriginalInfo = "/050/info.do", @@ -196,7 +196,7 @@ public class Cvlc01Controller extends ApplicationController { * "saved": 저장되었으면 true, 그렇지 않으면 false * } */ - public ModelAndView saveCivilComplaintProcessSe(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { + public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { String sggCd = globalStngMapper.selectSggCdForCurrentUser(); crdn.setSggCd(sggCd); @@ -245,7 +245,7 @@ public class Cvlc01Controller extends ApplicationController { } } - saved = crdnCvlcptService.updateCvlcptPrcsSe(nonQueryRequest, crdnCvlcpt, crdn, newFileInfoList); + saved = crdnCvlcptService.updateCvlcptProcessSection(nonQueryRequest, crdnCvlcpt, crdn, newFileInfoList); return new ModelAndView("jsonView") diff --git a/src/main/java/cokr/xit/fims/task/web/BpvController.java b/src/main/java/cokr/xit/fims/task/web/BpvController.java index 42187e56..b35dd0ba 100644 --- a/src/main/java/cokr/xit/fims/task/web/BpvController.java +++ b/src/main/java/cokr/xit/fims/task/web/BpvController.java @@ -41,9 +41,9 @@ public class BpvController { } @Override - @RequestMapping(name="전용차로과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSe) - public ModelAndView saveCivilComplaintProcessSe(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { - return super.saveCivilComplaintProcessSe(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); + @RequestMapping(name="전용차로과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection) + public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { + return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); } @Override diff --git a/src/main/java/cokr/xit/fims/task/web/DpvController.java b/src/main/java/cokr/xit/fims/task/web/DpvController.java index 7766dd2a..8f637fae 100644 --- a/src/main/java/cokr/xit/fims/task/web/DpvController.java +++ b/src/main/java/cokr/xit/fims/task/web/DpvController.java @@ -40,9 +40,9 @@ public class DpvController { } @Override - @RequestMapping(name="장애인과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSe) - public ModelAndView saveCivilComplaintProcessSe(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { - return super.saveCivilComplaintProcessSe(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); + @RequestMapping(name="장애인과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection) + public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { + return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); } @Override diff --git a/src/main/java/cokr/xit/fims/task/web/EcaController.java b/src/main/java/cokr/xit/fims/task/web/EcaController.java index f89e30f1..8fdc1efb 100644 --- a/src/main/java/cokr/xit/fims/task/web/EcaController.java +++ b/src/main/java/cokr/xit/fims/task/web/EcaController.java @@ -41,9 +41,9 @@ public class EcaController { } @Override - @RequestMapping(name="전기차과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSe) - public ModelAndView saveCivilComplaintProcessSe(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { - return super.saveCivilComplaintProcessSe(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); + @RequestMapping(name="전기차과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection) + public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { + return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); } @Override diff --git a/src/main/java/cokr/xit/fims/task/web/PvsController.java b/src/main/java/cokr/xit/fims/task/web/PvsController.java index 7c247947..9c0e93b1 100644 --- a/src/main/java/cokr/xit/fims/task/web/PvsController.java +++ b/src/main/java/cokr/xit/fims/task/web/PvsController.java @@ -41,9 +41,9 @@ public class PvsController { } @Override - @RequestMapping(name="주정차과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSe) - public ModelAndView saveCivilComplaintProcessSe(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { - return super.saveCivilComplaintProcessSe(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); + @RequestMapping(name="주정차과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection) + public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { + return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); } @Override