风控中台-修复address_id为空时NPE异常

This commit is contained in:
zhanglei@ap-leasing.com.cn 2023-09-26 15:29:53 +08:00
parent f936fc5cd6
commit 601aacd037

View File

@ -414,6 +414,9 @@ public class AmpServiceImpl extends EsbCommon implements AmpService {
int ageInMonth = DateUtils.monthDiffByDate(idBirthday,nowDay);
String workAddressId = boCpt.getAttribute("work_address_id").getString();
BizObject boRai = this.getAddressById(workAddressId);
if(boRai==null){
}
String workProvinceCode = boRai.getAttribute("province_code").toString();
String workCityCode = boRai.getAttribute("city_code").toString();
String workDistrictCode = boRai.getAttribute("district_code").toString();
@ -1049,22 +1052,24 @@ public class AmpServiceImpl extends EsbCommon implements AmpService {
public BizObject getAddressById(String addressId) throws JBOException {
BizObject boRai = null;
BizObjectManager rcAddressInfo = JBOFactory.getBizObjectManager(RC_ADDRESS_INFO.CLASS_NAME);
if(addressId==null || "".equals(addressId)){
boRai = rcAddressInfo.newObject();
boRai.setAttributeValue("province_code","");
boRai.setAttributeValue("city_code","");
boRai.setAttributeValue("district_code","");
boRai.setAttributeValue("address_detail","¿ÕµØÖ·");
return boRai;
}
BizObjectManager rcAddressInfo = JBOFactory.getBizObjectManager(RC_ADDRESS_INFO.CLASS_NAME);
boRai = rcAddressInfo.createQuery("address_id=:id").setParameter("id", addressId).getSingleResult(false);
if(boRai == null){
boRai = rcAddressInfo.newObject();
boRai.setAttributeValue("province_code","");
boRai.setAttributeValue("city_code","");
boRai.setAttributeValue("district_code","");
boRai.setAttributeValue("address_detail","帤脤腕華硊");
boRai.setAttributeValue("address_detail","根据address_id未查得地址");
}
return boRai;
}