업무구분 코드 추출 수정

main
mjkhan21 1 year ago
parent 2cbb2297d7
commit ecd7044a69

@ -44,18 +44,13 @@ public interface ImportMapper extends AbstractMapper {
/** . /** .
* @return * @return
*/ */
List<DataObject> selectTaskCd(); String selectTaskCd(Map<String, Object> params);
/** {"부서코드", "업무코드"} . /** {"부서코드", "업무코드"} .
* @return {"부서코드", "업무코드"} * @return {"부서코드", "업무코드"}
*/ */
default Map<String, String> selectTaskMap() { default String selectTaskCd(String violation) {
List<DataObject> list = selectTaskCd(); return selectTaskCd(params().set("violation", violation));
return list.stream()
.collect(Collectors.toMap(
row -> row.string("DEPT_CD"),
row -> row.string("TASK_CD")
));
} }
/** . /** .

@ -51,9 +51,8 @@ public class ImportBean extends AbstractComponent {
Map<String, String> Map<String, String>
ssgs = getSSGs(petitions), ssgs = getSSGs(petitions),
tasks = importMapper.selectTaskMap(), //TODO: 업무구분 추출 다시 검토할 것
carModels = importMapper.selectCarMdl(); carModels = importMapper.selectCarMdl();
List<Crdn> crdns = create(petitions, ssgs, tasks); List<Crdn> crdns = create(petitions, ssgs);
BiFunction<String, String, String> getCarModel = (vhctyAsortCd, mxmmLdg) -> { BiFunction<String, String, String> getCarModel = (vhctyAsortCd, mxmmLdg) -> {
if (isEmpty(vhctyAsortCd)) return null; if (isEmpty(vhctyAsortCd)) return null;
@ -86,7 +85,7 @@ public class ImportBean extends AbstractComponent {
* @param sggs * @param sggs
* @return * @return
*/ */
private List<Crdn> create(List<Petition> petitions, Map<String, String> sggs, Map<String, String> tasks) { private List<Crdn> create(List<Petition> petitions, Map<String, String> sggs) {
Petition.Violation violation = new Petition.Violation(); Petition.Violation violation = new Petition.Violation();
DateFormats dateFormats = new DateFormats(); DateFormats dateFormats = new DateFormats();
@ -100,6 +99,8 @@ public class ImportBean extends AbstractComponent {
.collect(Collectors.groupingBy(map -> map.get("vehicleNo"))); //차량번호별 단속정보 .collect(Collectors.groupingBy(map -> map.get("vehicleNo"))); //차량번호별 단속정보
List<String> vehicleNos = List.copyOf(byVehicleNo.keySet()); List<String> vehicleNos = List.copyOf(byVehicleNo.keySet());
String taskCd = importMapper.selectTaskCd(petition.getPetiTitleV() + " " + petition.getPetiReasonL()); //업무 구분(FIM054)
return byVehicleNo.entrySet().stream() return byVehicleNo.entrySet().stream()
.map(entry -> { .map(entry -> {
String vehicleNo = entry.getKey(); String vehicleNo = entry.getKey();
@ -109,8 +110,7 @@ public class ImportBean extends AbstractComponent {
String instDept = petition.getPcdAncCodeV() + "-" + petition.getPcdDeptV(), String instDept = petition.getPcdAncCodeV() + "-" + petition.getPcdDeptV(),
sgg = sggs.get(instDept); sgg = sggs.get(instDept);
crdn.setSggCd(sgg); crdn.setSggCd(sgg);
String dept = petition.getPcdDeptV(); crdn.setTaskSeCd(taskCd);
crdn.setTaskSeCd(ifEmpty(tasks.get(dept), () -> tasks.get("default")));
crdn.setCrdnRegSeCd(first ? "02" : "04"); // 첫번째면 자동등록, 아니면 복사등록 (FIM026) crdn.setCrdnRegSeCd(first ? "02" : "04"); // 첫번째면 자동등록, 아니면 복사등록 (FIM026)
crdn.setCrdnInptSeCd("14"); // 국민신문고 연계 (FIM003) crdn.setCrdnInptSeCd("14"); // 국민신문고 연계 (FIM003)

@ -18,18 +18,15 @@ SELECT CASE WHEN A.SGG_CD = B.SGG_CD THEN A.SGG_CD ELSE 'DIFF' END SGG_CD
) B ) B
ON A.SGG_CD = B.SGG_CD</select> ON A.SGG_CD = B.SGG_CD</select>
<select id="selectTaskCd" resultType="dataobject">/* importMapper.selectTaskCd(업무코드 조회) */ <select id="selectTaskCd" parameterType="map" resultType="string">/* importMapper.selectTaskCd(업무코드 조회) */
SELECT '3910354' DEPT_CD, 'PVS' TASK_CD UNION SELECT CASE WHEN VLTN LIKE CONCAT('%', '전용차로', '%') THEN 'BPV'
SELECT '3790034' DEPT_CD, 'PVS' TASK_CD UNION WHEN VLTN LIKE CONCAT('%', '장애인', '%') THEN 'DPV'
SELECT '3800029' DEPT_CD, 'PVS' TASK_CD UNION WHEN VLTN LIKE CONCAT('%', '전기차', '%') THEN 'ECA'
SELECT '3810054' DEPT_CD, 'PVS' TASK_CD UNION WHEN VLTN LIKE CONCAT('%', '밤샘', '%') THEN 'TPV'
SELECT '6300915' DEPT_CD, 'PVS' TASK_CD UNION ELSE 'PVS'
END TASK_CD
SELECT '6300753' DEPT_CD, 'BPV' TASK_CD UNION FROM (SELECT #{violation} VLTN
<!-- SELECT '6300915' DEPT_CD, 'BPV' TASK_CD UNION --> ) A</select>
SELECT '6301014' DEPT_CD, 'BPV' TASK_CD UNION
SELECT 'default' DEPT_CD, 'DPV' TASK_CD</select>
<select id="selectCarMdlCd" resultType="dataobject">/* importMapper.selectCarMdlCd(차종별 과태료 차종 조회) */ <select id="selectCarMdlCd" resultType="dataobject">/* importMapper.selectCarMdlCd(차종별 과태료 차종 조회) */
SELECT '1' VHCTY_ASORT_CODE, '11' FFNLG_CARMDL_CD UNION <!-- 승용 --> SELECT '1' VHCTY_ASORT_CODE, '11' FFNLG_CARMDL_CD UNION <!-- 승용 -->

Loading…
Cancel
Save