diff --git a/src/main/java/cokr/xit/fims/crdn/dao/ImportMapper.java b/src/main/java/cokr/xit/fims/crdn/dao/ImportMapper.java index cf6ac83d..cf032123 100644 --- a/src/main/java/cokr/xit/fims/crdn/dao/ImportMapper.java +++ b/src/main/java/cokr/xit/fims/crdn/dao/ImportMapper.java @@ -44,18 +44,13 @@ public interface ImportMapper extends AbstractMapper { /**업무코드를 조회한다. * @return 업무코드 목록 */ - List selectTaskCd(); + String selectTaskCd(Map params); /**업무코드를 조회하여 {"부서코드", "업무코드"} 형식의 맵으로 반환한다. * @return {"부서코드", "업무코드"} 맵 */ - default Map selectTaskMap() { - List list = selectTaskCd(); - return list.stream() - .collect(Collectors.toMap( - row -> row.string("DEPT_CD"), - row -> row.string("TASK_CD") - )); + default String selectTaskCd(String violation) { + return selectTaskCd(params().set("violation", violation)); } /**차종별 과태료 차종코드를 조회한다. diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java index bac38bbb..1e89106a 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java @@ -51,9 +51,8 @@ public class ImportBean extends AbstractComponent { Map ssgs = getSSGs(petitions), - tasks = importMapper.selectTaskMap(), //TODO: 업무구분 추출 다시 검토할 것 carModels = importMapper.selectCarMdl(); - List crdns = create(petitions, ssgs, tasks); + List crdns = create(petitions, ssgs); BiFunction getCarModel = (vhctyAsortCd, mxmmLdg) -> { if (isEmpty(vhctyAsortCd)) return null; @@ -86,7 +85,7 @@ public class ImportBean extends AbstractComponent { * @param sggs 시군구코드 * @return 단속자료 목록 */ - private List create(List petitions, Map sggs, Map tasks) { + private List create(List petitions, Map sggs) { Petition.Violation violation = new Petition.Violation(); DateFormats dateFormats = new DateFormats(); @@ -100,6 +99,8 @@ public class ImportBean extends AbstractComponent { .collect(Collectors.groupingBy(map -> map.get("vehicleNo"))); //차량번호별 단속정보 List vehicleNos = List.copyOf(byVehicleNo.keySet()); + String taskCd = importMapper.selectTaskCd(petition.getPetiTitleV() + " " + petition.getPetiReasonL()); //업무 구분(FIM054) + return byVehicleNo.entrySet().stream() .map(entry -> { String vehicleNo = entry.getKey(); @@ -109,8 +110,7 @@ public class ImportBean extends AbstractComponent { String instDept = petition.getPcdAncCodeV() + "-" + petition.getPcdDeptV(), sgg = sggs.get(instDept); crdn.setSggCd(sgg); - String dept = petition.getPcdDeptV(); - crdn.setTaskSeCd(ifEmpty(tasks.get(dept), () -> tasks.get("default"))); + crdn.setTaskSeCd(taskCd); crdn.setCrdnRegSeCd(first ? "02" : "04"); // 첫번째면 자동등록, 아니면 복사등록 (FIM026) crdn.setCrdnInptSeCd("14"); // 국민신문고 연계 (FIM003) diff --git a/src/main/resources/sql/mapper/fims/crdn/import-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/import-mapper.xml index 49512477..0dbec528 100644 --- a/src/main/resources/sql/mapper/fims/crdn/import-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/import-mapper.xml @@ -18,18 +18,15 @@ SELECT CASE WHEN A.SGG_CD = B.SGG_CD THEN A.SGG_CD ELSE 'DIFF' END SGG_CD ) B ON A.SGG_CD = B.SGG_CD - +