VehicleInfoBean 추가
parent
1459127ea6
commit
096a765317
@ -0,0 +1,230 @@
|
|||||||
|
package cokr.xit.interfaces.lvis.service.bean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import cokr.xit.foundation.AbstractComponent;
|
||||||
|
import cokr.xit.foundation.ApplicationException;
|
||||||
|
import cokr.xit.interfaces.lvis.dao.VehicleInfoMapper;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.BasicInfoRequest;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.BasicInfoResponse;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.CustodyTrgetRequest;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.CustodyTrgetResponse;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.FrmrWlthReadngRequest;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.FrmrWlthReadngResponse;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.ScldgrReadngRequest;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.ScldgrReadngResponse;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.SeizureByVhrNoRequest;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.SeizureByVhrNoResponse;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.carreadng.CarReadngProxy;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.carreadng.FindFrmrWlthReadngReturn;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.carreadng.FindScldgrReadngReturn;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.carregbasicinfo.CarRegBasicInfoProxy;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.carregbasicinfo.FindRegBasicReturn;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.carregulation.CarRegulationProxy;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.carregulation.FindCustodyTrgetReturn;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.carseizure.CarSeizureProxy;
|
||||||
|
import cokr.xit.interfaces.lvis.service.reg.carseizure.FindSeizureByVhrNoReturn;
|
||||||
|
import cokr.xit.interfaces.lvis.service.seizure.AltrtvSeizureVhrnoRequest;
|
||||||
|
import cokr.xit.interfaces.lvis.service.seizure.AltrtvSeizureVhrnoResponse;
|
||||||
|
import cokr.xit.interfaces.lvis.service.seizure.SeizureByEttffRequest;
|
||||||
|
import cokr.xit.interfaces.lvis.service.seizure.SeizureByEttffResponse;
|
||||||
|
import cokr.xit.interfaces.lvis.service.seizure.seizure.AddAutoSeizureByEttffReturn;
|
||||||
|
import cokr.xit.interfaces.lvis.service.seizure.seizure.FindAltrtvSeizureVhrnoReturn;
|
||||||
|
import cokr.xit.interfaces.lvis.service.seizure.seizure.SeizureProxy;
|
||||||
|
import cokr.xit.interfaces.lvis.service.types.WsRequestContext;
|
||||||
|
|
||||||
|
/**자동차관리 정보시스템(자망)과 연계하는 Bean
|
||||||
|
* @author mjkhan
|
||||||
|
*/
|
||||||
|
@Component("vehicleInfoBean")
|
||||||
|
public class VehicleInfoBean extends AbstractComponent {
|
||||||
|
@Resource(name = "lvisHost")
|
||||||
|
private LvisHost lvisHost;
|
||||||
|
@Resource(name = "vehicleInfoMapper")
|
||||||
|
private VehicleInfoMapper vehicleInfoMapper;
|
||||||
|
|
||||||
|
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 (keepLog) {
|
||||||
|
Map<String, Object> params = Map.of(
|
||||||
|
"req", req,
|
||||||
|
"info", result.getBasicInfo(),
|
||||||
|
"msg", result.getResult(),
|
||||||
|
"currentUser", currentUser()
|
||||||
|
);
|
||||||
|
vehicleInfoMapper.insertBasicInfo(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log(e, "자동차 기본정보 조회");
|
||||||
|
return new BasicInfoResponse().setError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private BasicInfoResponse getLocalBasicInfo(BasicInfoRequest req) {
|
||||||
|
List<BasicInfoResponse.BasicInfo> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, BasicInfoResponse> getBasicInfo(List<String> vhrNos) {
|
||||||
|
List<BasicInfoRequest> reqs = vhrNos.stream().map(vhrNo -> {
|
||||||
|
BasicInfoRequest req = new BasicInfoRequest();
|
||||||
|
req.setVhrno(vhrNo);
|
||||||
|
return req;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
return reqs.stream()
|
||||||
|
.map(this::getBasicInfo)
|
||||||
|
.filter(BasicInfoResponse::isSuccess)
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
resp -> resp.getBasicInfo().getVhrno(),
|
||||||
|
resp -> resp
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public FrmrWlthReadngResponse getFrmrWlthReadng(FrmrWlthReadngRequest req) {
|
||||||
|
try {
|
||||||
|
req.validate();
|
||||||
|
FindFrmrWlthReadngReturn resp = new CarReadngProxy(lvisHost.getAddress()).findFrmrWlthReadng(req.getParams(), getRequestContext(req.getServiceID()));
|
||||||
|
FrmrWlthReadngResponse result = FrmrWlthReadngResponse.getResult(resp);
|
||||||
|
log().debug("자동차 등록원부(갑)를 {}", (result.getFrmrWlthReadng().isSuccess() ? "찾았습니다." : "찾지 못했습니다."));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log(e, "자동차 등록원부(갑) 조회");
|
||||||
|
return new FrmrWlthReadngResponse().setError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScldgrReadngResponse getScldgrReadng(ScldgrReadngRequest req) {
|
||||||
|
try {
|
||||||
|
req.validate();
|
||||||
|
FindScldgrReadngReturn resp = new CarReadngProxy(lvisHost.getAddress()).findScldgrReadng(req.getParams(), getRequestContext(req.getServiceID()));
|
||||||
|
ScldgrReadngResponse result = ScldgrReadngResponse.getResult(resp);
|
||||||
|
log().debug("자동차 등록원부(을)를 {}", (result.getScldgrReadng().isSuccess() ? "찾았습니다." : "찾지 못했습니다."));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log(e, "자동차 등록원부(을) 조회");
|
||||||
|
return new ScldgrReadngResponse().setError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeizureByVhrNoResponse getSeizureByVhrNo(SeizureByVhrNoRequest req) {
|
||||||
|
try {
|
||||||
|
req.validate();
|
||||||
|
FindSeizureByVhrNoReturn resp = new CarSeizureProxy(lvisHost.getAddress()).findSeizureByVhrNo(req.getParams(), getRequestContext(req.getServiceID()));
|
||||||
|
SeizureByVhrNoResponse result = SeizureByVhrNoResponse.getResult(resp);
|
||||||
|
log().debug("압류내역을 {}", (result.getSeizureByVhrNos().get(0).isSuccess() ? "찾았습니다." : "찾지 못했습니다."));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log(e, "압류내역 조회");
|
||||||
|
return new SeizureByVhrNoResponse().setError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeizureByEttffResponse addAutoSeizureByEttff(SeizureByEttffRequest req) {
|
||||||
|
try {
|
||||||
|
req.validate();
|
||||||
|
AddAutoSeizureByEttffReturn resp = new SeizureProxy(lvisHost.getAddress()).addAutoSeizureByEttff(req.getParams(), getRequestContext(req.getServiceID()));
|
||||||
|
SeizureByEttffResponse result = SeizureByEttffResponse.getResult(resp);
|
||||||
|
log().debug("압류내역을 {}", (result.getSeizureByEttff().isSuccess() ? "등록했습니다." : "등록하지 못했습니다."));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log(e, "압류 연계등록");
|
||||||
|
return new SeizureByEttffResponse().setError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AltrtvSeizureVhrnoResponse getAltrtvSeizureVhrno(AltrtvSeizureVhrnoRequest req) {
|
||||||
|
try {
|
||||||
|
req.validate();
|
||||||
|
FindAltrtvSeizureVhrnoReturn resp = new SeizureProxy(lvisHost.getAddress()).findAltrtvSeizureVhrno(req.getParams(), getRequestContext(req.getServiceID()));
|
||||||
|
AltrtvSeizureVhrnoResponse result = AltrtvSeizureVhrnoResponse.getResult(resp);
|
||||||
|
log().debug("대체압류차량을 {}", (result.getAltrtvSeizureVhrnos().get(0).isSuccess() ? "찾았습니다." : "찾지 못했습니다."));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log(e, "대체압류차량 조회");
|
||||||
|
return new AltrtvSeizureVhrnoResponse().setError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustodyTrgetResponse getCustodyTrget(CustodyTrgetRequest req) {
|
||||||
|
try {
|
||||||
|
req.validate();
|
||||||
|
FindCustodyTrgetReturn resp = new CarRegulationProxy(lvisHost.getAddress()).findCustodyTrget(req.getParams(), getRequestContext(req.getServiceID()));
|
||||||
|
CustodyTrgetResponse result = CustodyTrgetResponse.getResult(resp);
|
||||||
|
log().debug("번호판 영치대상을 {}", (result.getCustodyTrget().isSuccess() ? "찾았습니다." : "찾지 못했습니다."));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log(e, "번호판 영치대상 조회");
|
||||||
|
return new CustodyTrgetResponse().setError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationException log(Throwable t, String operationName) {
|
||||||
|
ApplicationException e = applicationException(t);
|
||||||
|
log().error("BEGIN::::★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆");
|
||||||
|
log().error(operationName + " 중 오류가 발생했습니다.");
|
||||||
|
log().error(e.getMessage());
|
||||||
|
log().error("END::::::★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆");
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**웹서비스 요청 컨텍스트를 반환한다.
|
||||||
|
* @return WsRequestContext 웹서비스 요청 컨텍스트
|
||||||
|
*/
|
||||||
|
private WsRequestContext getRequestContext(String serviceID){
|
||||||
|
WsRequestContext rctx = new WsRequestContext();
|
||||||
|
|
||||||
|
rctx.setSigungu_code(stringProperty("lvis.sigungu.code")); //시군구코드(필수)
|
||||||
|
|
||||||
|
rctx.setCharger_ihinum(stringProperty("lvis.charger.ihinum")); //담당자 주민등록번호
|
||||||
|
rctx.setCharger_ip_adres(stringProperty("lvis.charger.ip_adres")); //담당자 IP 어드레스
|
||||||
|
rctx.setCharger_nm(stringProperty("lvis.charger.nm")); //담당자명
|
||||||
|
rctx.setCharger_wrc_telno(stringProperty("lvis.charger.wrc_telno")); //담당자 연락처
|
||||||
|
|
||||||
|
rctx.setSvc_id(serviceID); //서비스ID
|
||||||
|
rctx.setInfo_sys_id(stringProperty("lvis.info_sys.id")); //정보시스템 ID(필수)
|
||||||
|
rctx.setInfo_sys_ip(stringProperty("lvis.info_sys.ip")); //정보시스템 IP(필수)
|
||||||
|
rctx.setInfo_sys_macaddress(stringProperty("lvis.info_sys.macaddress"));//정보시스템 MAC 어드레스
|
||||||
|
|
||||||
|
rctx.setEnc_key(stringProperty("lvis.enc.key")); //암호화키
|
||||||
|
rctx.setEnc_key_group(stringProperty("lvis.enc.key_group")); //암호화키 그룹
|
||||||
|
rctx.setEnc_key_no(stringProperty("lvis.enc.key_no")); //암호화키 번호
|
||||||
|
|
||||||
|
return rctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String stringProperty(String key) {
|
||||||
|
return properties.getString(key, "").trim();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue