From 25b353c520b9ba449d7bd478f3a7d5dfd7cd1307 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Wed, 19 Jul 2023 18:45:16 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B8=B0=EB=B3=B8=EA=B8=88=EC=95=A1=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EB=A9=94=EC=86=8C=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fims/crdn/service/bean/Crdn05Bean.java | 167 +++++------------- .../xit/fims/task/service/TaskService.java | 12 ++ .../task/service/bean/BpvServiceBean.java | 52 +++++- .../task/service/bean/DpvServiceBean.java | 27 ++- .../task/service/bean/EcaServiceBean.java | 24 ++- .../task/service/bean/PvsServiceBean.java | 68 ++++++- .../task/service/bean/TpvServiceBean.java | 62 ++++++- .../xit/fims/task/service/taskService.java | 5 - 8 files changed, 278 insertions(+), 139 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/task/service/TaskService.java delete mode 100644 src/main/java/cokr/xit/fims/task/service/taskService.java 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 1aaa53a3..8da4d4b6 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 @@ -4,14 +4,17 @@ import java.util.List; import javax.annotation.Resource; -import org.assertj.core.util.Arrays; import org.springframework.stereotype.Component; import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.fims.crdn.Crdn; -import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.dao.Crdn05Mapper; +import cokr.xit.fims.task.service.bean.BpvServiceBean; +import cokr.xit.fims.task.service.bean.DpvServiceBean; +import cokr.xit.fims.task.service.bean.EcaServiceBean; +import cokr.xit.fims.task.service.bean.PvsServiceBean; +import cokr.xit.fims.task.service.bean.TpvServiceBean; import cokr.xit.foundation.AbstractComponent; /** 단속 자료 등록 Bean @@ -19,11 +22,7 @@ import cokr.xit.foundation.AbstractComponent; */ @Component("crdn05Bean") public class Crdn05Bean extends AbstractComponent { - public String[] SAFE_TAG_AREA = {"03","06","07"}; //안전표지구역 - public String[] CAR_GROUP1 = {"12","14","15","21"}; //승합자동차등 - public String[] CAR_GROUP2 = {"11","13"}; //승용자동차등 - public String[] CAR_GROUP3 = {"31"}; //이륜자동차등 @Resource(name="fileBean") private FileBean fileBean; @@ -31,6 +30,16 @@ public class Crdn05Bean extends AbstractComponent { @Resource(name = "crdn05Mapper") private Crdn05Mapper crdn05Mapper; + @Resource(name = "pvsService") + private PvsServiceBean pvsService; + @Resource(name = "bpvService") + private BpvServiceBean bpvService; + @Resource(name = "dpvService") + private DpvServiceBean dpvService; + @Resource(name = "ecaService") + private EcaServiceBean ecaService; + @Resource(name = "tpvService") + private TpvServiceBean tpvService; public boolean create(Crdn crdn, List fileInfoList) { crdn.setAtchFileCnt(fileInfoList.size()); @@ -52,19 +61,36 @@ public class Crdn05Bean extends AbstractComponent { if(ifEmpty(crdn.getAtchFileCnt(), () -> 0) == 0) { crdn.setAtchFileCnt(0); } + int[] basicAmt; + switch (crdn.getTaskSeCd()) { + case "PVS": { + basicAmt = pvsService.getBasicAmt(crdn); + break; + } + case "BPV": { + basicAmt = bpvService.getBasicAmt(crdn); + break; + } + case "DPV": { + basicAmt = dpvService.getBasicAmt(crdn); + break; + } + case "ECA": { + basicAmt = ecaService.getBasicAmt(crdn); + break; + } + case "TPV": { + basicAmt = tpvService.getBasicAmt(crdn); + break; + } + default: + throw new IllegalArgumentException("Unexpected value: " + crdn.getTaskSeCd()); + } + crdn.setFfnlgAmt(basicAmt[0]); + crdn.setLevyAmt(basicAmt[0]); + crdn.setAdvntceLevyAmt(basicAmt[1]); - int basicAmt = this.getBasicAmt(crdn); - crdn.setFfnlgAmt(basicAmt); - crdn.setLevyAmt(basicAmt); - - boolean isPenaltyAmt = crdn.getTaskSeCd().equals("TPV") - && (crdn.getFfnlgCarmdlCd().equals("13") || crdn.getFfnlgCarmdlCd().equals("14")); //과징금 - if(crdn.getTaskSeCd().equals("BPV") || isPenaltyAmt) { - crdn.setAdvntceLevyAmt(basicAmt); - } else { - crdn.setAdvntceLevyAmt((int)(basicAmt * 0.8)); - } if(ifEmpty(crdn.getDoGuidance(), () -> "").equals("on")) { crdn.setCrdnSttsCd("83"); @@ -75,111 +101,4 @@ public class Crdn05Bean extends AbstractComponent { return crdn05Mapper.insert(crdn); } - /**기본금액을 계산한다. - * @param crdn 대장 정보 - * @return 기본금액 - */ - public int getBasicAmt(Crdn crdn) { - int amt = 0; - - CrdnQuery query = new CrdnQuery(); - query.setTaskSeCd(crdn.getTaskSeCd()); - query.setAplcnYmd(crdn.getCrdnYmd()); - - String ffnlgCarmdlCd = crdn.getFfnlgCarmdlCd(); - - if(crdn.getTaskSeCd().equals("PVS") || crdn.getTaskSeCd().equals("BPV") || crdn.getTaskSeCd().equals("TPV")) { - if(ifEmpty(ffnlgCarmdlCd, () -> "").equals("")) { - return 0; - } - } - - switch(crdn.getTaskSeCd()) { - case "PVS": - - query.setAmtDcsnCdGroupId("FIM055"); - String crdnSpareaCd = crdn.getCrdnSpareaCd(); - if(Arrays.asList(SAFE_TAG_AREA).contains(crdnSpareaCd)) { - query.setAmtDcsnCd("02"); - } else { - - String crdnTm = crdn.getCrdnTm(); - boolean workTimeYn = Integer.parseInt(crdnTm) >= 80000 && Integer.parseInt(crdnTm) <= 200000; - - if(crdnSpareaCd.equals("01") && workTimeYn) { - query.setAmtDcsnCd("03"); - } else if((crdnSpareaCd.equals("02") || crdnSpareaCd.equals("05")) && workTimeYn) { - query.setAmtDcsnCd("04"); - } else { - query.setAmtDcsnCd("01"); - } - } - - query.setDtlAmtDcsnCdGroupId("FIM056"); - if(Arrays.asList(CAR_GROUP1).contains(ffnlgCarmdlCd)) { - query.setDtlAmtDcsnCd("01"); - } - if(Arrays.asList(CAR_GROUP2).contains(ffnlgCarmdlCd)) { - query.setDtlAmtDcsnCd("02"); - } - - break; - case "BPV": - - query.setAmtDcsnCdGroupId("FIM056"); - if(Arrays.asList(CAR_GROUP1).contains(ffnlgCarmdlCd)) { - query.setAmtDcsnCd("01"); - } - if(Arrays.asList(CAR_GROUP2).contains(ffnlgCarmdlCd)) { - query.setAmtDcsnCd("02"); - } - if(Arrays.asList(CAR_GROUP3).contains(ffnlgCarmdlCd)) { - query.setAmtDcsnCd("03"); - } - break; - case "DPV": - - query.setAmtDcsnCdGroupId("FIM006"); - query.setAmtDcsnCd(crdn.getVltnCd()); - - break; - case "ECA": - - break; - case "TPV": - - query.setAmtDcsnCdGroupId("FIM057"); - - if(ffnlgCarmdlCd.equals("21")) { - query.setAmtDcsnCd("01"); - query.setDtlAmtDcsnCdGroupId("FIM059"); - - String vltnNmtm = crdn.getVltnNmtm(); - if(vltnNmtm == null || vltnNmtm.equals("") || vltnNmtm.equals("0") || vltnNmtm.equals("1")) { - query.setDtlAmtDcsnCd("01"); - } else if(vltnNmtm.equals("2")) { - query.setDtlAmtDcsnCd("02"); - } else { - query.setDtlAmtDcsnCd("03"); - } - } - - if(ffnlgCarmdlCd.equals("13") || ffnlgCarmdlCd.equals("14")) { - query.setAmtDcsnCd("02"); - query.setDtlAmtDcsnCdGroupId("FIM058"); - //query.setDtlAmtDcsnCd(업종); // TODO : 차주 업종 - } - break; - } - - amt = crdn05Mapper.selectBasicAmt(query); - - if(crdn.getTaskSeCd().equals("PVS")) { - if(crdn.getOvtimeYn().equals("Y")) { - amt += 10000; - } - } - - return amt; - } } diff --git a/src/main/java/cokr/xit/fims/task/service/TaskService.java b/src/main/java/cokr/xit/fims/task/service/TaskService.java new file mode 100644 index 00000000..c6dc6891 --- /dev/null +++ b/src/main/java/cokr/xit/fims/task/service/TaskService.java @@ -0,0 +1,12 @@ +package cokr.xit.fims.task.service; + +import cokr.xit.fims.crdn.Crdn; + +public interface TaskService { + + /**기본금액을 계산한다. + * @param crdn 대장 정보 + * @return 최초과태료/과징금 금액,사전통보금액 + */ + public int[] getBasicAmt(Crdn crdn); +} diff --git a/src/main/java/cokr/xit/fims/task/service/bean/BpvServiceBean.java b/src/main/java/cokr/xit/fims/task/service/bean/BpvServiceBean.java index d1057df0..e77a4e47 100644 --- a/src/main/java/cokr/xit/fims/task/service/bean/BpvServiceBean.java +++ b/src/main/java/cokr/xit/fims/task/service/bean/BpvServiceBean.java @@ -1,14 +1,62 @@ package cokr.xit.fims.task.service.bean; +import javax.annotation.Resource; + +import org.assertj.core.util.Arrays; import org.springframework.stereotype.Service; -import cokr.xit.fims.task.service.taskService; +import cokr.xit.fims.crdn.Crdn; +import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.dao.Crdn05Mapper; +import cokr.xit.fims.task.service.TaskService; import cokr.xit.foundation.component.AbstractServiceBean; /**업무 서비스 인터페이스의 전용차로위반 업무 서비스 구현체 * @author leebj */ @Service("bpvService") -public class BpvServiceBean extends AbstractServiceBean implements taskService { +public class BpvServiceBean extends AbstractServiceBean implements TaskService { + + public String[] CAR_GROUP1 = {"12","14","15","21"}; //승합자동차등 + public String[] CAR_GROUP2 = {"11","13"}; //승용자동차등 + public String[] CAR_GROUP3 = {"31"}; //이륜자동차등 + + @Resource(name = "crdn05Mapper") + private Crdn05Mapper crdn05Mapper; + + @Override + public int[] getBasicAmt(Crdn crdn) { + int[] amt = {0, 0}; + + + CrdnQuery query = new CrdnQuery(); + query.setTaskSeCd(crdn.getTaskSeCd()); + query.setAplcnYmd(crdn.getCrdnYmd()); + + String ffnlgCarmdlCd = crdn.getFfnlgCarmdlCd(); + + + if(ifEmpty(ffnlgCarmdlCd, () -> "").equals("")) { + return amt; + } + + query.setAmtDcsnCdGroupId("FIM056"); + if(Arrays.asList(CAR_GROUP1).contains(ffnlgCarmdlCd)) { + query.setAmtDcsnCd("01"); + } + if(Arrays.asList(CAR_GROUP2).contains(ffnlgCarmdlCd)) { + query.setAmtDcsnCd("02"); + } + if(Arrays.asList(CAR_GROUP3).contains(ffnlgCarmdlCd)) { + query.setAmtDcsnCd("03"); + } + + + + int ffnlgAmt = crdn05Mapper.selectBasicAmt(query); + amt[0] = ffnlgAmt; + amt[1] = ffnlgAmt; + return amt; + } } diff --git a/src/main/java/cokr/xit/fims/task/service/bean/DpvServiceBean.java b/src/main/java/cokr/xit/fims/task/service/bean/DpvServiceBean.java index a7e1b5cc..ba9b8a9a 100644 --- a/src/main/java/cokr/xit/fims/task/service/bean/DpvServiceBean.java +++ b/src/main/java/cokr/xit/fims/task/service/bean/DpvServiceBean.java @@ -1,14 +1,37 @@ package cokr.xit.fims.task.service.bean; +import javax.annotation.Resource; + import org.springframework.stereotype.Service; -import cokr.xit.fims.task.service.taskService; +import cokr.xit.fims.crdn.Crdn; +import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.dao.Crdn05Mapper; +import cokr.xit.fims.task.service.TaskService; import cokr.xit.foundation.component.AbstractServiceBean; /**업무 서비스 인터페이스의 장애인주차구역위반 업무 구현체 * @author leebj */ @Service("dpvService") -public class DpvServiceBean extends AbstractServiceBean implements taskService { +public class DpvServiceBean extends AbstractServiceBean implements TaskService { + @Resource(name = "crdn05Mapper") + private Crdn05Mapper crdn05Mapper; + + @Override + public int[] getBasicAmt(Crdn crdn) { + int[] amt = {0, 0}; + + CrdnQuery query = new CrdnQuery(); + query.setTaskSeCd(crdn.getTaskSeCd()); + query.setAplcnYmd(crdn.getCrdnYmd()); + + query.setAmtDcsnCdGroupId("FIM006"); + query.setAmtDcsnCd(crdn.getVltnCd()); + int ffnlgAmt = crdn05Mapper.selectBasicAmt(query); + amt[0] = ffnlgAmt; + amt[1] = (int)(ffnlgAmt * 0.8); + return amt; + } } diff --git a/src/main/java/cokr/xit/fims/task/service/bean/EcaServiceBean.java b/src/main/java/cokr/xit/fims/task/service/bean/EcaServiceBean.java index 21e14206..60f8d98f 100644 --- a/src/main/java/cokr/xit/fims/task/service/bean/EcaServiceBean.java +++ b/src/main/java/cokr/xit/fims/task/service/bean/EcaServiceBean.java @@ -1,14 +1,34 @@ package cokr.xit.fims.task.service.bean; +import javax.annotation.Resource; + import org.springframework.stereotype.Service; -import cokr.xit.fims.task.service.taskService; +import cokr.xit.fims.crdn.Crdn; +import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.dao.Crdn05Mapper; +import cokr.xit.fims.task.service.TaskService; import cokr.xit.foundation.component.AbstractServiceBean; /**업무 서비스 인터페이스의 전기차주차구역위반 업무 구현체 * @author leebj */ @Service("ecaService") -public class EcaServiceBean extends AbstractServiceBean implements taskService { +public class EcaServiceBean extends AbstractServiceBean implements TaskService { + @Resource(name = "crdn05Mapper") + private Crdn05Mapper crdn05Mapper; + + @Override + public int[] getBasicAmt(Crdn crdn) { + int[] amt = {0, 0}; + + CrdnQuery query = new CrdnQuery(); + query.setTaskSeCd(crdn.getTaskSeCd()); + query.setAplcnYmd(crdn.getCrdnYmd()); + int ffnlgAmt = crdn05Mapper.selectBasicAmt(query); + amt[0] = ffnlgAmt; + amt[1] = (int)(ffnlgAmt * 0.8); + return amt; + } } diff --git a/src/main/java/cokr/xit/fims/task/service/bean/PvsServiceBean.java b/src/main/java/cokr/xit/fims/task/service/bean/PvsServiceBean.java index 1a291c45..71eb4dfd 100644 --- a/src/main/java/cokr/xit/fims/task/service/bean/PvsServiceBean.java +++ b/src/main/java/cokr/xit/fims/task/service/bean/PvsServiceBean.java @@ -1,14 +1,78 @@ package cokr.xit.fims.task.service.bean; +import javax.annotation.Resource; + +import org.assertj.core.util.Arrays; import org.springframework.stereotype.Service; -import cokr.xit.fims.task.service.taskService; +import cokr.xit.fims.crdn.Crdn; +import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.dao.Crdn05Mapper; +import cokr.xit.fims.task.service.TaskService; import cokr.xit.foundation.component.AbstractServiceBean; /**업무 서비스 인터페이스의 주정차위반 업무 서비스 구현체 * @author leebj */ @Service("pvsService") -public class PvsServiceBean extends AbstractServiceBean implements taskService { +public class PvsServiceBean extends AbstractServiceBean implements TaskService { + + public String[] SAFE_TAG_AREA = {"03","06","07"}; //안전표지구역 + + public String[] CAR_GROUP1 = {"12","14","15","21"}; //승합자동차등 + public String[] CAR_GROUP2 = {"11","13"}; //승용자동차등 + + @Resource(name = "crdn05Mapper") + private Crdn05Mapper crdn05Mapper; + + @Override + public int[] getBasicAmt(Crdn crdn) { + int[] amt = {0, 0}; + + CrdnQuery query = new CrdnQuery(); + query.setTaskSeCd(crdn.getTaskSeCd()); + query.setAplcnYmd(crdn.getCrdnYmd()); + + String ffnlgCarmdlCd = crdn.getFfnlgCarmdlCd(); + + if(ifEmpty(ffnlgCarmdlCd, () -> "").equals("")) { + return amt; + } + + query.setAmtDcsnCdGroupId("FIM055"); + String crdnSpareaCd = crdn.getCrdnSpareaCd(); + if(Arrays.asList(SAFE_TAG_AREA).contains(crdnSpareaCd)) { + query.setAmtDcsnCd("02"); + } else { + + String crdnTm = crdn.getCrdnTm(); + boolean workTimeYn = Integer.parseInt(crdnTm) >= 80000 && Integer.parseInt(crdnTm) <= 200000; + + if(crdnSpareaCd.equals("01") && workTimeYn) { + query.setAmtDcsnCd("03"); + } else if((crdnSpareaCd.equals("02") || crdnSpareaCd.equals("05")) && workTimeYn) { + query.setAmtDcsnCd("04"); + } else { + query.setAmtDcsnCd("01"); + } + } + + query.setDtlAmtDcsnCdGroupId("FIM056"); + if(Arrays.asList(CAR_GROUP1).contains(ffnlgCarmdlCd)) { + query.setDtlAmtDcsnCd("01"); + } + if(Arrays.asList(CAR_GROUP2).contains(ffnlgCarmdlCd)) { + query.setDtlAmtDcsnCd("02"); + } + + int ffnlgAmt = crdn05Mapper.selectBasicAmt(query); + if(crdn.getOvtimeYn().equals("Y")) { + ffnlgAmt += 10000; + } + + amt[0] = ffnlgAmt; + amt[1] = (int)(ffnlgAmt * 0.8); + return amt; + } } diff --git a/src/main/java/cokr/xit/fims/task/service/bean/TpvServiceBean.java b/src/main/java/cokr/xit/fims/task/service/bean/TpvServiceBean.java index da154ad9..da552124 100644 --- a/src/main/java/cokr/xit/fims/task/service/bean/TpvServiceBean.java +++ b/src/main/java/cokr/xit/fims/task/service/bean/TpvServiceBean.java @@ -1,14 +1,72 @@ package cokr.xit.fims.task.service.bean; +import javax.annotation.Resource; + import org.springframework.stereotype.Service; -import cokr.xit.fims.task.service.taskService; +import cokr.xit.fims.crdn.Crdn; +import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.dao.Crdn05Mapper; +import cokr.xit.fims.task.service.TaskService; import cokr.xit.foundation.component.AbstractServiceBean; /**업무 서비스 인터페이스의 밤샘주차 업무 서비스 구현체 * @author leebj */ @Service("tpvService") -public class TpvServiceBean extends AbstractServiceBean implements taskService { +public class TpvServiceBean extends AbstractServiceBean implements TaskService { + @Resource(name = "crdn05Mapper") + private Crdn05Mapper crdn05Mapper; + + @Override + public int[] getBasicAmt(Crdn crdn) { + int[] amt = {0, 0}; + + + CrdnQuery query = new CrdnQuery(); + query.setTaskSeCd(crdn.getTaskSeCd()); + query.setAplcnYmd(crdn.getCrdnYmd()); + + String ffnlgCarmdlCd = crdn.getFfnlgCarmdlCd(); + + if(crdn.getTaskSeCd().equals("PVS") || crdn.getTaskSeCd().equals("BPV") || crdn.getTaskSeCd().equals("TPV")) { + if(ifEmpty(ffnlgCarmdlCd, () -> "").equals("")) { + return amt; + } + } + + query.setAmtDcsnCdGroupId("FIM057"); + + if(ffnlgCarmdlCd.equals("21")) { + query.setAmtDcsnCd("01"); + query.setDtlAmtDcsnCdGroupId("FIM059"); + + String vltnNmtm = crdn.getVltnNmtm(); + if(vltnNmtm == null || vltnNmtm.equals("") || vltnNmtm.equals("0") || vltnNmtm.equals("1")) { + query.setDtlAmtDcsnCd("01"); + } else if(vltnNmtm.equals("2")) { + query.setDtlAmtDcsnCd("02"); + } else { + query.setDtlAmtDcsnCd("03"); + } + } + + + if(ffnlgCarmdlCd.equals("13") || ffnlgCarmdlCd.equals("14")) { + query.setAmtDcsnCd("02"); + query.setDtlAmtDcsnCdGroupId("FIM058"); + //query.setDtlAmtDcsnCd(업종); // TODO : 차주 업종 + } + + int ffnlgAmt = crdn05Mapper.selectBasicAmt(query); + amt[0] = ffnlgAmt; + boolean isPenaltyAmt = (crdn.getFfnlgCarmdlCd().equals("13") || crdn.getFfnlgCarmdlCd().equals("14")); //과징금 + if(isPenaltyAmt) { + amt[1] = (ffnlgAmt); + } else { + amt[1] = (int)(ffnlgAmt * 0.8); + } + return amt; + } } diff --git a/src/main/java/cokr/xit/fims/task/service/taskService.java b/src/main/java/cokr/xit/fims/task/service/taskService.java deleted file mode 100644 index 673e2052..00000000 --- a/src/main/java/cokr/xit/fims/task/service/taskService.java +++ /dev/null @@ -1,5 +0,0 @@ -package cokr.xit.fims.task.service; - -public interface taskService { - -}