diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn05Bean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn05Bean.java index 8da4d4b6..8b183aec 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn05Bean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn05Bean.java @@ -1,5 +1,7 @@ package cokr.xit.fims.crdn.service.bean; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; import javax.annotation.Resource; @@ -8,8 +10,12 @@ import org.springframework.stereotype.Component; import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.service.bean.FileBean; +import cokr.xit.fims.cmmn.CrdnSttsHstry; +import cokr.xit.fims.cmmn.service.bean.CrdnSttsHstryBean; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.dao.Crdn05Mapper; +import cokr.xit.fims.excl.Excl01; +import cokr.xit.fims.excl.service.bean.Excl01Bean; import cokr.xit.fims.task.service.bean.BpvServiceBean; import cokr.xit.fims.task.service.bean.DpvServiceBean; import cokr.xit.fims.task.service.bean.EcaServiceBean; @@ -27,6 +33,12 @@ public class Crdn05Bean extends AbstractComponent { @Resource(name="fileBean") private FileBean fileBean; + @Resource(name="excl01Bean") + private Excl01Bean excl01Bean; + + @Resource(name="crdnSttsHstryBean") + private CrdnSttsHstryBean crdnSttsHstryBean; + @Resource(name = "crdn05Mapper") private Crdn05Mapper crdn05Mapper; @@ -97,8 +109,51 @@ public class Crdn05Bean extends AbstractComponent { } else { crdn.setCrdnSttsCd("01"); } + boolean result = crdn05Mapper.insert(crdn); + + SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyyMMdd"); + SimpleDateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyyMMddHHmmss"); + Date curTime = new Date(); + String strCurrentDate = yyyyMMdd.format(curTime); + String strCurrentDatetime = yyyyMMddHHmmss.format(curTime); + + + String taskDtlId = crdn.getCrdnId(); + + if(crdn.getCrdnSttsCd().equals("83")) { + // 부과제외(TB_LEVY_EXCL) 대장 등록 + Excl01 excl01 = new Excl01(); + excl01.setSggCd(""); // TODO:시군구 + excl01.setTaskSeCd(crdn.getTaskSeCd()); + excl01.setCrdnId(crdn.getCrdnId()); + excl01.setLevyExclYmd(strCurrentDate); + excl01.setLevyExclSeCd("2"); + excl01.setLevyExclRsnCd("192"); + excl01.setEtcCn(""); + + result = excl01Bean.createLevyExclusion(excl01); + if (!result) { + return false; + } + + taskDtlId = excl01.getLevyExclId(); + } + + // 단속상태이력(TB_CRDN_STTS_HSTRY) 대장 등록 + CrdnSttsHstry crdnSttsHstry = new CrdnSttsHstry(); + crdnSttsHstry.setCrdnId(crdn.getCrdnId()); + crdnSttsHstry.setBfrSttsCd(""); + crdnSttsHstry.setBfrSttsChgDt(""); + crdnSttsHstry.setCrdnSttsCd(crdn.getCrdnSttsCd()); + crdnSttsHstry.setTaskDtlId(taskDtlId); + crdnSttsHstry.setEtcCn(""); + + result = crdnSttsHstryBean.create(crdnSttsHstry); + if (!result) { + return false; + } - return crdn05Mapper.insert(crdn); + return result; } } diff --git a/src/main/resources/sql/mapper/fims/crdn/crdn05-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/crdn05-mapper.xml index 3db81ae5..3cf96489 100644 --- a/src/main/resources/sql/mapper/fims/crdn/crdn05-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/crdn05-mapper.xml @@ -32,7 +32,7 @@ SELECT C.CRDN_ID /* 단속 대장 등록(crdn05Mapper.insertCrdn) */ -SELECT LPAD(IFNULL(MAX(TB_CRDN) + 1, 1), 20, '0') NEW_ID FROM TB_CRDN +SELECT LPAD(IFNULL(MAX(CRDN_ID) + 1, 1), 20, '0') NEW_ID FROM TB_CRDN INSERT INTO TB_CRDN ( CRDN_ID