diff --git a/pom.xml b/pom.xml index 5b54960..ef356fa 100644 --- a/pom.xml +++ b/pom.xml @@ -96,6 +96,75 @@ + + install + ${basedir}/target + ${artifactId}-${version} + + + ${basedir}/src/main/resources + + + ${basedir}/src/test/resources + ${basedir}/src/main/resources + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + **/*.class + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0 + + true + xml + + **/Abstract*.java + **/*Suite.java + + + **/*Test.java + + + + + org.codehaus.mojo + emma-maven-plugin + true + + + org.apache.maven.plugins + maven-source-plugin + 2.2 + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + + + diff --git a/src/main/java/cokr/xit/interfaces/lvis/dao/VehicleInfoMapper.java b/src/main/java/cokr/xit/interfaces/lvis/dao/VehicleInfoMapper.java index 4e4269b..9cfbb8f 100644 --- a/src/main/java/cokr/xit/interfaces/lvis/dao/VehicleInfoMapper.java +++ b/src/main/java/cokr/xit/interfaces/lvis/dao/VehicleInfoMapper.java @@ -1,7 +1,11 @@ package cokr.xit.interfaces.lvis.dao; +import java.util.List; +import java.util.Map; + import org.egovframe.rte.psl.dataaccess.mapper.Mapper; +import cokr.xit.interfaces.lvis.service.reg.BasicInfoRequest; import cokr.xit.interfaces.lvis.service.reg.BasicInfoResponse; /**자동차 기본사항 조회 결과 정보를 테이블에 등록하는 매퍼 @@ -9,9 +13,19 @@ import cokr.xit.interfaces.lvis.service.reg.BasicInfoResponse; */ @Mapper("vehicleInfoMapper") public interface VehicleInfoMapper { - /**자동차 기본사항 조회 결과 정보를 등록한다. - * @param basicInfo 자동차 기본사항 조회 결과 정보 + /** + * @param req + * @return + */ + List selectBasicInfo(BasicInfoRequest req); + + /**자동차 기본사항 조회 로그를 등록한다. + * @param params 파라미터 + *
  • req - 조회 조건
  • + *
  • info - 결과 정보
  • + *
  • msg - 결과 메시지
  • + *
* @return 등록된 정보 수 */ - int insertBasicInfo(BasicInfoResponse.BasicInfo basicInfo); + int insertBasicInfo(Map params); } \ No newline at end of file diff --git a/src/main/java/cokr/xit/interfaces/lvis/service/bean/LvisHost.java b/src/main/java/cokr/xit/interfaces/lvis/service/bean/LvisHost.java index 877246d..764032b 100644 --- a/src/main/java/cokr/xit/interfaces/lvis/service/bean/LvisHost.java +++ b/src/main/java/cokr/xit/interfaces/lvis/service/bean/LvisHost.java @@ -16,6 +16,10 @@ public class LvisHost extends AbstractComponent { return properties.getString("lvis.host.active", ""); } + public boolean isLocal() { + return "local".equalsIgnoreCase(hostActive()); + } + private String productionAddress() { return properties.getString("lvis.host.production", ""); } diff --git a/src/main/java/cokr/xit/interfaces/lvis/service/bean/VehicleInfoServiceBean.java b/src/main/java/cokr/xit/interfaces/lvis/service/bean/VehicleInfoServiceBean.java index 5b84e65..dd03b45 100644 --- a/src/main/java/cokr/xit/interfaces/lvis/service/bean/VehicleInfoServiceBean.java +++ b/src/main/java/cokr/xit/interfaces/lvis/service/bean/VehicleInfoServiceBean.java @@ -1,5 +1,8 @@ package cokr.xit.interfaces.lvis.service.bean; +import java.util.List; +import java.util.Map; + import javax.annotation.Resource; import org.springframework.stereotype.Service; @@ -50,14 +53,22 @@ public class VehicleInfoServiceBean extends AbstractServiceBean implements Vehic public BasicInfoResponse getBasicInfo(BasicInfoRequest req) { try { req.validate(); + if (lvisHost.isLocal()) + return getLocalBasicInfo(req); + FindRegBasicReturn resp = new CarRegBasicInfoProxy(lvisHost.getAddress()).findRegBasic(req.getParams(), getRequestContext(req.getServiceID())); BasicInfoResponse result = BasicInfoResponse.getResult(resp); boolean success = result.getBasicInfo().isSuccess(); log().debug("자동차 기본정보를 {}", (success ? "찾았습니다." : "찾지 못했습니다.")); boolean keepLog = properties.getBoolean("lvis.log.basicInfo", false); - if (success && keepLog) { - vehicleInfoMapper.insertBasicInfo(result.getBasicInfo()); + if (keepLog) { + Map params = Map.of( + "req", req, + "info", result.getBasicInfo(), + "msg", result.getResult() + ); + vehicleInfoMapper.insertBasicInfo(params); } return result; @@ -67,6 +78,18 @@ public class VehicleInfoServiceBean extends AbstractServiceBean implements Vehic } } + private BasicInfoResponse getLocalBasicInfo(BasicInfoRequest req) { + List list = vehicleInfoMapper.selectBasicInfo(req); + boolean empty = list.isEmpty(); + BasicInfoResponse.BasicInfo basicInfo = !empty ? list.get(0) : new BasicInfoResponse.BasicInfo(); + if (!empty) + basicInfo.setProcess_imprty_resn_code("00"); + + BasicInfoResponse response = new BasicInfoResponse(); + response.setBasicInfo(basicInfo); + return response; + } + @Override public FrmrWlthReadngResponse getFrmrWlthReadng(FrmrWlthReadngRequest req) { try { diff --git a/src/main/java/cokr/xit/interfaces/lvis/service/reg/BasicInfoResponse.java b/src/main/java/cokr/xit/interfaces/lvis/service/reg/BasicInfoResponse.java index 1cca625..6078996 100644 --- a/src/main/java/cokr/xit/interfaces/lvis/service/reg/BasicInfoResponse.java +++ b/src/main/java/cokr/xit/interfaces/lvis/service/reg/BasicInfoResponse.java @@ -1,7 +1,6 @@ package cokr.xit.interfaces.lvis.service.reg; import java.util.List; -import java.util.stream.Collectors; import java.util.stream.Stream; import cokr.xit.interfaces.lvis.service.LvisResponse; @@ -29,7 +28,7 @@ public class BasicInfoResponse extends LvisResponse { if (items != null) { List basicInfo = Stream.of(items) .map(item -> new BasicInfo().setResult(item)) - .collect(Collectors.toList()); + .toList(); response.setBasicInfo(basicInfo.get(0)); } diff --git a/src/main/resources/properties/xit-lvis.properties b/src/main/resources/properties/xit-lvis.properties index c065ffc..ce124c2 100644 --- a/src/main/resources/properties/xit-lvis.properties +++ b/src/main/resources/properties/xit-lvis.properties @@ -23,8 +23,8 @@ lvis.enc.key_group=1 #\uc554\ud638\ud654\ud0a4 \ubc88\ud638 lvis.enc.key_no=1 -#lvis \uc0ac\uc6a9 \uc11c\ube44\uc2a4 (production || test) -lvis.host.active=test +#lvis \uc0ac\uc6a9 \uc11c\ube44\uc2a4 (production || test || local) +lvis.host.active=local #lvis \uc6b4\uc601 \uc11c\ube44\uc2a4 \uc8fc\uc18c lvis.host.production=http://auto.car.go.kr:39700/lvis/services/WsFrontController #lvis \ud14c\uc2a4\ud2b8 \uc11c\ube44\uc2a4 \uc8fc\uc18c diff --git a/src/main/resources/spring/context-datasource.xml b/src/main/resources/spring/context-datasource.xml index 1bfebb6..87c5d12 100644 --- a/src/main/resources/spring/context-datasource.xml +++ b/src/main/resources/spring/context-datasource.xml @@ -10,9 +10,14 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /* vehicleInfoMapper.insertBasicInfo(자동차 기본사항 조회 로그 등록) */ -INSERT INTO TB_BASIC_INFO_LOG ( - LOG_ID +INSERT INTO TB_CAR_BSC_MTTR ( + BSC_MTTR_ID + , MESSAGEID + , MESSAGENAME + , MESSAGEREASON + , MESSAGEREMARK + , EXCEPTIONSTACKTRACE + + , DMND_LEVY_STDDE + , DMND_INQIRE_SE_CODE + , DMND_VHRNO + , DMND_VIN + , PRYE , REGIST_DE , ERSR_REGIST_SE_CODE @@ -93,94 +274,105 @@ INSERT INTO TB_BASIC_INFO_LOG ( , CBD_HG , FRST_MXMM_LDG ) VALUES ( - - , #{prye} - , #{regist_de} - , #{ersr_regist_se_code} - , #{ersr_regist_se_nm} - , #{ersr_regist_de} - , #{regist_detail_code} - , #{dsplvl} - , #{use_strnghld_legaldong_code} - , #{use_strnghld_adstrd_code} - , #{use_strnghld_mntn} - , #{use_strnghld_lnbr} - , #{use_strnghld_ho} - , #{use_strnghld_adres_nm} - , #{use_strnghld_road_nm_code} - , #{usgsrhld_undgrnd_buld_se_code} - , #{use_strnghld_buld_main_no} - , #{use_strnghld_buld_sub_no} - , #{mber_se_code} - , #{mber_nm} - , #{mber_se_no} - , #{telno} - , #{owner_legaldong_code} - , #{owner_adstrd_code} - , #{owner_mntn} - , #{owner_lnbr} - , #{owner_ho} - , #{owner_adres_nm} - , #{owner_road_nm_code} - , #{owner_undgrnd_buld_se_code} - , #{owner_buld_main_no} - , #{owner_buld_sub_no} - , #{owner_adres_full} - , #{aftr_vhrno} - , #{use_fuel_code} - , #{prpos_se_code} - , #{mtrs_fom_nm} - , #{frnt_vhrno} - , #{vhrno} - , #{vin} - , #{cnm} - , #{vhcle_tot_wt} - , #{caag_endde} - , #{change_de} - , #{vhcty_asort_code} - , #{vhcty_ty_code} - , #{vhcty_se_code} - , #{mxmm_ldg} - , #{vhcty_asort_nm} - , #{vhcty_ty_nm} - , #{vhcty_se_nm} - , #{frst_regist_de} - , #{fom_nm} - , #{acqs_de} - , #{acqs_end_de} - , #{ybl_md} - , #{transr_regist_de} - , #{spcf_regist_sttus_code} - , #{color_nm} - , #{mrtg_co} - , #{seizr_co} - , #{stmd_co} - , #{nmpl_csdy_at} - , #{nmpl_csdy_remnr_de} - , #{origin_se_code} - , #{nmpl_stndrd_code} - , #{acqs_amount} - , #{inspt_valid_pd_bgnde} - , #{inspt_valid_pd_endde} - , #{chck_valid_pd_bgnde} - , #{chck_valid_pd_endde} - , #{use_strnghld_grc_code} - , #{tkcar_pscap_co} - , #{spmnno} - , #{trvl_dstnc} - , #{frst_regist_rqrcno} - , #{vlnt_ersr_prvntc_ntice_de} - , #{regist_instt_nm} - , #{process_imprty_resn_code} - , #{process_imprty_resn_dtls} - , #{vims_prpos_se_code} - , #{vims_vhcty_asort_code} - , #{vims_vhcty_ty_code} - , #{vims_vhcty_se_code} - , #{cbd_lt} - , #{cbd_bt} - , #{cbd_hg} - , #{frst_mxmm_ldg} + #{bsc_mttr_id} + , #{msg.messageId} + , #{msg.messageName} + , #{msg.messageReason} + , #{msg.messageRemark} + , #{msg.exceptionStackTrace} + + , #{req.levy_stdde} + , #{req.inqire_se_code} + , #{req.vhrno} + , #{req.vin} + + , #{info.prye} + , #{info.regist_de} + , #{info.ersr_regist_se_code} + , #{info.ersr_regist_se_nm} + , #{info.ersr_regist_de} + , #{info.regist_detail_code} + , #{info.dsplvl} + , #{info.use_strnghld_legaldong_code} + , #{info.use_strnghld_adstrd_code} + , #{info.use_strnghld_mntn} + , #{info.use_strnghld_lnbr} + , #{info.use_strnghld_ho} + , #{info.use_strnghld_adres_nm} + , #{info.use_strnghld_road_nm_code} + , #{info.usgsrhld_undgrnd_buld_se_code} + , #{info.use_strnghld_buld_main_no} + , #{info.use_strnghld_buld_sub_no} + , #{info.mber_se_code} + , #{info.mber_nm} + , #{info.mber_se_no} + , #{info.telno} + , #{info.owner_legaldong_code} + , #{info.owner_adstrd_code} + , #{info.owner_mntn} + , #{info.owner_lnbr} + , #{info.owner_ho} + , #{info.owner_adres_nm} + , #{info.owner_road_nm_code} + , #{info.owner_undgrnd_buld_se_code} + , #{info.owner_buld_main_no} + , #{info.owner_buld_sub_no} + , #{info.owner_adres_full} + , #{info.aftr_vhrno} + , #{info.use_fuel_code} + , #{info.prpos_se_code} + , #{info.mtrs_fom_nm} + , #{info.frnt_vhrno} + , #{info.vhrno} + , #{info.vin} + , #{info.cnm} + , #{info.vhcle_tot_wt} + , #{info.caag_endde} + , #{info.change_de} + , #{info.vhcty_asort_code} + , #{info.vhcty_ty_code} + , #{info.vhcty_se_code} + , #{info.mxmm_ldg} + , #{info.vhcty_asort_nm} + , #{info.vhcty_ty_nm} + , #{info.vhcty_se_nm} + , #{info.frst_regist_de} + , #{info.fom_nm} + , #{info.acqs_de} + , #{info.acqs_end_de} + , #{info.ybl_md} + , #{info.transr_regist_de} + , #{info.spcf_regist_sttus_code} + , #{info.color_nm} + , #{info.mrtg_co} + , #{info.seizr_co} + , #{info.stmd_co} + , #{info.nmpl_csdy_at} + , #{info.nmpl_csdy_remnr_de} + , #{info.origin_se_code} + , #{info.nmpl_stndrd_code} + , #{info.acqs_amount} + , #{info.inspt_valid_pd_bgnde} + , #{info.inspt_valid_pd_endde} + , #{info.chck_valid_pd_bgnde} + , #{info.chck_valid_pd_endde} + , #{info.use_strnghld_grc_code} + , #{info.tkcar_pscap_co} + , #{info.spmnno} + , #{info.trvl_dstnc} + , #{info.frst_regist_rqrcno} + , #{info.vlnt_ersr_prvntc_ntice_de} + , #{info.regist_instt_nm} + , #{info.process_imprty_resn_code} + , #{info.process_imprty_resn_dtls} + , #{info.vims_prpos_se_code} + , #{info.vims_vhcty_asort_code} + , #{info.vims_vhcty_ty_code} + , #{info.vims_vhcty_se_code} + , #{info.cbd_lt} + , #{info.cbd_bt} + , #{info.cbd_hg} + , #{info.frst_mxmm_ldg} ) \ No newline at end of file diff --git a/src/test/java/cokr/xit/interfaces/lvis/service/VehicleInfoServiceTest.java b/src/test/java/cokr/xit/interfaces/lvis/service/VehicleInfoServiceTest.java index 76a19da..0bfe040 100644 --- a/src/test/java/cokr/xit/interfaces/lvis/service/VehicleInfoServiceTest.java +++ b/src/test/java/cokr/xit/interfaces/lvis/service/VehicleInfoServiceTest.java @@ -1,5 +1,7 @@ package cokr.xit.interfaces.lvis.service; +import java.util.Map; + import javax.annotation.Resource; import org.junit.jupiter.api.Assertions; @@ -44,6 +46,27 @@ public class VehicleInfoServiceTest extends TestSupport { Assertions.assertTrue(resp.getBasicInfo().isSuccess()); } + @Test + void getLocalBasicInfo() { + BasicInfoRequest req = new BasicInfoRequest(); + req.setVhrno("47너7721"); + req.setLevy_stdde("20230315"); + + BasicInfoResponse resp = service.getBasicInfo(req); + Assertions.assertTrue(resp.getBasicInfo().isSuccess()); + + req.setVhrno("zz두zzzz"); + resp = service.getBasicInfo(req); + Assertions.assertFalse(resp.getBasicInfo().isSuccess()); +/* + req = new BasicInfoRequest(); + req.setVin("KNABE911BGT176364"); + req.setLevy_stdde("20230315"); + resp = service.getBasicInfo(req); + Assertions.assertTrue(resp.getBasicInfo().isSuccess()); +*/ + } + @Test void insertBasicInfo() { BasicInfoResponse.BasicInfo basicInfo = new BasicInfoResponse.BasicInfo(); @@ -134,9 +157,9 @@ public class VehicleInfoServiceTest extends TestSupport { basicInfo.setCbd_bt("10"); basicInfo.setCbd_hg("10"); basicInfo.setFrst_mxmm_ldg("10"); - vehicleInfoMapper.insertBasicInfo(basicInfo); + vehicleInfoMapper.insertBasicInfo(Map.of("info", basicInfo)); - testMapper.execDelete("DELETE FROM TB_BASIC_INFO_LOG"); + testMapper.execDelete("DELETE FROM TB_CAR_BSC_MTTR"); } @Test