diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index e019af1a..c3c257b9 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -16,6 +16,7 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.regex.Pattern; import java.util.stream.Collectors; public class CmmnUtil { @@ -34,6 +35,16 @@ public class CmmnUtil { return str; } + public static boolean isNumeric(String str) { + String REGEXP_PATTERN_NUMBER = "^[\\d]*$"; + return Pattern.matches(REGEXP_PATTERN_NUMBER, str); + } + + public static boolean isKorean(String str) { + String REGEXP_PATTERN_KOR = "^[가-힣]*$"; + return Pattern.matches(REGEXP_PATTERN_KOR, str); + } + /** * 문자열을 바이트 단위로 substring하기 * diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java index 6ad2854c..9bf809fa 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnStngBean.java @@ -7,6 +7,7 @@ import javax.annotation.Resource; import org.assertj.core.util.Arrays; import org.springframework.stereotype.Component; +import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.ExmptnVhcl; @@ -224,6 +225,161 @@ public class CrdnStngBean extends AbstractComponent { } + /** 차량번호로 차량구분을 판단한다. + * @param vhrno 차량번호 + * @return 영업용 차량 여부 판단 결과 + */ + public String getCarGb(String vhrno) { + + if(vhrno.equals("")) { + return "차량번호 없음"; + } + + boolean first3isNumber = CmmnUtil.isNumeric(vhrno.substring(0, 3)); + if(first3isNumber) { + int first3 = Integer.parseInt(vhrno.substring(0, 3)); + if(first3 >= 0 && first3 <= 99) { + return "중기"; + } else if(first3 >= 100 && first3 <= 997) { + return "일반"; + } else if(first3 >= 998 && first3 <= 999) { + return "기타"; + } + } + + if(!(this.getHeavyEquipmentCarkind(vhrno).equals(""))) { + return "중기"; + } + + if(vhrno.contains("외교")) { + return "외교"; + } + if(vhrno.contains("준외")) { + return "준외"; + } + if(vhrno.contains("영사")) { + return "영사"; + } + if(vhrno.contains("준영")) { + return "준영"; + } + + if(vhrno.contains("국기") || vhrno.contains("협정") || vhrno.contains("대표") || vhrno.contains("외빈")) { + return "국제"; + } + + if(vhrno.substring(0,1).equals("임")) { + return "임시"; + } + + if(vhrno.length() == 7 + && vhrno.substring(0, 3).equals("16다") + && CmmnUtil.isNumeric(vhrno.substring(3, 7))) { + return "미군"; + } + + if(vhrno.length() == 10 + && this.isBiefSidoName(vhrno.substring(0, 2)) + && CmmnUtil.isNumeric(vhrno.substring(2, 5)) + && vhrno.substring(5, 6).equals("-") + && CmmnUtil.isNumeric(vhrno.substring(6, 10))) { + return "미군"; + } + + int vhrnoLength = vhrno.length(); + + if(this.isBiefSidoName(vhrno.substring(0, 2))) { + + //서울 0 가 0000 + //서울 00 가 0000 + //서울 중 가 0000 + //서울 마포 가 0000 + //서울 영등포 가 0000 + + if(vhrnoLength >= 8 && vhrnoLength <= 10) { + + String suffix1 = vhrno.substring(vhrnoLength-5, vhrnoLength-4); + String suffix2 = vhrno.substring(vhrnoLength-4); + + String middle = vhrno.substring(2, vhrnoLength-5); + + if(CmmnUtil.isKorean(suffix1) && CmmnUtil.isNumeric(suffix2)) { + + if(CmmnUtil.isNumeric(middle) && (middle.length() == 1 || middle.length() == 2)) { + return "일반"; + } + if(CmmnUtil.isKorean(middle) && (middle.length() >= 1 && middle.length() <= 3)) { + return "일반"; + } + } + } + + } else { + + //00가0000 + if(vhrnoLength == 7 + && CmmnUtil.isNumeric(vhrno.substring(0, 2)) + && CmmnUtil.isKorean(vhrno.substring(2, 3)) + && CmmnUtil.isNumeric(vhrno.substring(3, 7))) { + return "일반"; + } + } + + return ""; + } + + + + public String getHeavyEquipmentCarkind(String vhrno) { + + + + if(this.isBiefSidoName(vhrno.substring(0, 2)) + && CmmnUtil.isKorean(vhrno.substring(4, 5)) + && CmmnUtil.isNumeric(vhrno.substring(5, 9)) + ) { + switch(vhrno.substring(2, 4)) { + case "01" : return "불도저"; + case "02" : return "굴삭기"; + case "03" : return "로더"; + case "04" : return "지게차"; + case "05" : return "스크레이퍼"; + case "06" : return "덤프트럭"; + case "07" : return "기중기"; + case "08" : return "콘크리트믹서트럭"; + case "14" : + if(!vhrno.substring(4,5).equals("허")) { + return "콘크리트믹서트럭"; + } + } + + switch(vhrno.substring(2, 5)) { + case "26거" : return "도로보수트럭"; + case "26너" : return "노면파쇄기"; + case "26버" : return "터널고소용자동차"; + case "26어" : return "수목이식기"; + } + + } + + return ""; + } + + public boolean isBiefSidoName(String str) { + + String[] sidoNames = { + "서울","대전","대구","부산","광주","인천","울산","세종", + "경기","강원","충북","충남","전북","전남","경북","경남","제주" + }; + + if(Arrays.asList(sidoNames).contains(str)) { + return true; + } else { + return false; + } + + } + /** 연계파일 레이아웃 정보를 조회한다. * @param query 연계파일 레이아웃 조회조건 * @return 연계파일 레이아웃 정보 diff --git a/src/main/java/cokr/xit/fims/stat/service/bean/StatBean.java b/src/main/java/cokr/xit/fims/stat/service/bean/StatBean.java index 0edd3864..393b81c2 100644 --- a/src/main/java/cokr/xit/fims/stat/service/bean/StatBean.java +++ b/src/main/java/cokr/xit/fims/stat/service/bean/StatBean.java @@ -232,6 +232,11 @@ public class StatBean extends AbstractComponent { String vhrno = item.string("VHRNO"); key = crdnStngBean.getBusinessYnOfCar(ffnlgCarmdlCd, vhrno); + } else if(addOption.equals("carGb")){ + + String vhrno = item.string("VHRNO"); + key = crdnStngBean.getCarGb(vhrno); + } else { key = colValue; } diff --git a/src/main/webapp/WEB-INF/jsp/fims/stat/stat02010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/stat/stat02010-main.jsp index ac004f41..0372ecaa 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/stat/stat02010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/stat/stat02010-main.jsp @@ -22,17 +22,17 @@