package com.nova.sankuai.domain.api.huizhixin;
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.TypeReference;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.nova.sankuai.domain.api.huizhixin.vo.LoanBeforeVo;
|
import com.nova.sankuai.domain.api.huizhixin.vo.LoanVo;
|
import com.nova.sankuai.domain.entity.Customer;
|
import com.nova.sankuai.domain.enums.ProfessionInfoEnum;
|
import com.nova.sankuai.domain.enums.customerinfo.*;
|
import com.nova.sankuai.domain.enums.huizhixin.*;
|
import com.nova.sankuai.domain.enums.yixin.YiXinCompanyNatureEnum;
|
import com.nova.sankuai.domain.enums.yixin.YiXinJobTitleEnum;
|
import com.nova.sankuai.domain.enums.yixin.YiXinOccupationEnum;
|
import com.nova.sankuai.infra.utils.RsaSecretUtils;
|
import com.nova.sankuai.security.HttpClientUtil;
|
import lombok.extern.slf4j.Slf4j;
|
import org.apache.commons.lang.StringUtils;
|
import org.apache.http.util.TextUtils;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.stereotype.Component;
|
|
import java.nio.charset.StandardCharsets;
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
/**
|
* 汇智信工具类
|
*/
|
@Component
|
@Slf4j
|
public class HzxUtil {
|
|
/**
|
* 对方公钥base64
|
*/
|
@Value("${hzx.other.public}")
|
private String publicKeyBase64;
|
|
/**
|
* 己方私钥base64
|
*/
|
@Value("${hzx.self.private}")
|
private String privateKeyBase64;
|
|
/**
|
* 产品号
|
*/
|
@Value("${hzx.product_cid}")
|
private String productCid;
|
|
|
/**
|
* 回调域名
|
*/
|
@Value("${hzx.callBackDomain}")
|
private String callBackDomain;
|
|
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
|
/**
|
* 请求地址
|
*/
|
@Value("${hzx.url}")
|
private String url;
|
|
private static final Logger logger = LoggerFactory.getLogger("capitalLogger");
|
|
private final RsaSecretUtils rsaSecretUtils;
|
|
public HzxUtil(RsaSecretUtils rsaSecretUtils) {
|
this.rsaSecretUtils = rsaSecretUtils;
|
}
|
|
/**
|
* 前置检测接口
|
*
|
* @param id 身份证号
|
* @param phone 手机号
|
* @param name 姓名
|
* @return
|
*/
|
public HzxResponse<HzxResponseData> checkUser(String id, String phone, String name) {
|
// 请求体
|
Map<String, Object> body = new HashMap<>(16);
|
// 原始参数
|
Map<String, Object> param = new HashMap<>(16);
|
param.put("f", "check_user");
|
param.put("id", id);
|
param.put("phone", phone);
|
param.put("name", name);
|
String response = "";
|
try {
|
logger.info("前置检测接口参数->:{}", param);
|
// 使用对方公钥加密后的字节数组
|
byte[] encryptByte = RsaSecretUtils.publicEncrypt(OBJECT_MAPPER.writeValueAsString(param).getBytes(StandardCharsets.UTF_8), publicKeyBase64);
|
// 使用己方私钥加签
|
String signStr = RsaSecretUtils.rsaSign(encryptByte, privateKeyBase64);
|
logger.info("前置检测接口加密参数->:{}", encryptByte);
|
logger.info("前置检测接口加签->:{}", signStr);
|
body.put("content", RsaSecretUtils.byte2Base64(encryptByte));
|
body.put("sign", signStr);
|
response = HttpClientUtil.getInstance().postJsonData(url + "/check_user", OBJECT_MAPPER.writeValueAsString(body));
|
logger.info("前置检测接口加密返回->:{}", response);
|
} catch (Exception e) {
|
logger.error("前置检测接口加密返回失败->:{}", response);
|
e.printStackTrace();
|
return null;
|
}
|
if (StringUtils.isEmpty(response)) {
|
logger.error("前置检测接口加密返回数据失败");
|
return null;
|
}
|
JSONObject jsonObject = null;
|
try {
|
jsonObject = JSONObject.parseObject(response);
|
logger.info("前置检测接口加密返回转换返回:{}", jsonObject);
|
} catch (Exception e) {
|
logger.error("前置检测接口加密返回转换json失败->:{}", jsonObject);
|
e.printStackTrace();
|
return null;
|
}
|
// 验签
|
boolean signPass = RsaSecretUtils.rsaSignCheck(Base64Utils.decode(jsonObject.getString("content")), Base64Utils.decode(jsonObject.getString("sign")), publicKeyBase64);
|
logger.info("前置检测验签:{}", signPass);
|
if (signPass == false) {
|
logger.info("前置检测接口验签失败");
|
return null;
|
}
|
String data = "";
|
HzxResponse<HzxResponseData> hzxResponse = null;
|
try {
|
data = new String(RsaSecretUtils.privateDecrypt(Base64Utils.decode(jsonObject.getString("content")), privateKeyBase64));
|
logger.info("汇智信原始返回数据:{}", data);
|
hzxResponse = JSON.parseObject(data, new TypeReference<HzxResponse<HzxResponseData>>() {
|
});
|
} catch (Exception e) {
|
logger.error("前置检测接口加密返回验签解签失败->:{}", data);
|
e.printStackTrace();
|
return null;
|
}
|
return hzxResponse;
|
}
|
|
/**
|
* 进件申请
|
*
|
* @param applyId 订单号,36位字符
|
* @return
|
*/
|
public HzxResponse apply(String applyId) {
|
// 请求体
|
Map<String, Object> body = new HashMap<>(16);
|
// 原始参数
|
Map<String, Object> param = new HashMap<>(16);
|
param.put("f", "apply");
|
param.put("apply_id", applyId);
|
param.put("product_cid", productCid + ";" + callBackDomain);
|
|
String response = "";
|
try {
|
logger.info("进件申请接口参数->:{}", param);
|
// 使用对方公钥加密后的字节数组
|
byte[] encryptByte = RsaSecretUtils.publicEncrypt(OBJECT_MAPPER.writeValueAsString(param).getBytes(StandardCharsets.UTF_8), publicKeyBase64);
|
// 使用己方私钥加签
|
String signStr = RsaSecretUtils.rsaSign(encryptByte, privateKeyBase64);
|
logger.info("进件申请接口加密参数->:{}", encryptByte);
|
logger.info("进件申请接口加签->:{}", signStr);
|
body.put("content", RsaSecretUtils.byte2Base64(encryptByte));
|
body.put("sign", signStr);
|
response = HttpClientUtil.getInstance().postJsonData(url + "/apply", OBJECT_MAPPER.writeValueAsString(body));
|
logger.info("进件申请接口加密返回->:{}", response);
|
} catch (Exception e) {
|
e.printStackTrace();
|
return null;
|
}
|
if (StringUtils.isEmpty(response)) {
|
logger.error("进件申请接口加密返回数据失败");
|
return null;
|
}
|
JSONObject jsonObject = null;
|
try {
|
jsonObject = JSONObject.parseObject(response);
|
} catch (Exception e) {
|
logger.error("进件申请接口加密返回转换json失败->:{}", jsonObject);
|
e.printStackTrace();
|
return null;
|
}
|
// 验签
|
boolean signPass = RsaSecretUtils.rsaSignCheck(Base64Utils.decode(jsonObject.getString("content")), Base64Utils.decode(jsonObject.getString("sign")), publicKeyBase64);
|
logger.info("进件申请验签:{}", signPass);
|
if (signPass == false) {
|
logger.info("进件申请接口验签失败");
|
return null;
|
}
|
HzxResponse hzxResponse = null;
|
String data = null;
|
try {
|
data = new String(RsaSecretUtils.privateDecrypt(Base64Utils.decode(jsonObject.getString("content")), privateKeyBase64));
|
hzxResponse = JSON.parseObject(data, HzxResponse.class);
|
} catch (Exception e) {
|
logger.error("进件申请接口加密返回验签解签失败失败->:{}", hzxResponse);
|
e.printStackTrace();
|
return null;
|
}
|
return hzxResponse;
|
}
|
|
/**
|
* 获取订单信息接口
|
*
|
* @param productCid 产品号
|
* @param applyId 订单号
|
* @param time 时间
|
* @return
|
*/
|
public HzxResponse loadApplyExtInfo(String productCid, String applyId, String time) {
|
// 请求体
|
Map<String, Object> body = new HashMap<>(16);
|
// 原始参数
|
Map<String, Object> param = new HashMap<>(16);
|
param.put("f", "load_apply_ext_info");
|
param.put("product_cid", productCid);
|
param.put("apply_id", applyId);
|
param.put("time", new Date());
|
try {
|
logger.info("获取订单信息接口参数->:{}", param);
|
// 使用对方公钥加密后的字节数组
|
byte[] encryptByte = RsaSecretUtils.publicEncrypt(OBJECT_MAPPER.writeValueAsString(param).getBytes(StandardCharsets.UTF_8), publicKeyBase64);
|
// 使用己方私钥加签
|
String signStr = RsaSecretUtils.rsaSign(encryptByte, privateKeyBase64);
|
logger.info("获取订单信息接口加密参数->:{}", encryptByte);
|
logger.info("获取订单信息接口加签->:{}", signStr);
|
body.put("content", RsaSecretUtils.byte2Base64(encryptByte));
|
body.put("sign", signStr);
|
|
String response = HttpClientUtil.getInstance().postJsonData(url + "/load_apply_ext_info", OBJECT_MAPPER.writeValueAsString(body));
|
logger.info("获取订单信息接口加密返回->:{}", response);
|
if (!TextUtils.isEmpty(response)) {
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
// 返回签名
|
String sign = jsonObject.getString("sign");
|
// 验签
|
boolean signPass = RsaSecretUtils.rsaSignCheck(Base64Utils.decode(jsonObject.getString("content")), Base64Utils.decode(jsonObject.getString("sign")), publicKeyBase64);
|
String data = new String(RsaSecretUtils.privateDecrypt(Base64Utils.decode(jsonObject.getString("content")), privateKeyBase64));
|
System.out.println(data);
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return null;
|
}
|
|
/**
|
* 参数解密、验签
|
*
|
* @param encodeData 密文
|
* @param signString 加签
|
* @return
|
*/
|
public String paramDecode(String encodeData, String signString) {
|
logger.info("密文->:{}", encodeData);
|
try {
|
// 使用己方私钥解密
|
byte[] decryptBytes = RsaSecretUtils.privateDecrypt(encodeData.getBytes(StandardCharsets.UTF_8), this.privateKeyBase64);
|
// 使用对方公钥验签
|
boolean result = RsaSecretUtils.rsaSignCheck(Base64Utils.decode(encodeData), Base64Utils.decode(signString), this.publicKeyBase64);
|
if (result) {
|
return new String(decryptBytes);
|
}
|
} catch (Exception e) {
|
return null;
|
}
|
return null;
|
}
|
|
/**
|
* 获取合作方其他 url
|
*
|
* @param apply_id 订单号
|
* @param return_url 操作成功之后的回调地址
|
* @return
|
*/
|
public HzxGetResponse getPartnerUrl(String apply_id, String return_url) {
|
// 请求体
|
Map<String, Object> body = new HashMap<>(16);
|
// 原始参数
|
Map<String, Object> param = new HashMap<>(16);
|
param.put("f", "get_partner_url");
|
param.put("apply_id", apply_id);
|
param.put("return_url", return_url);
|
String response = "";
|
try {
|
logger.info("获取合作方其他 url接口参数->:{}", param);
|
// 使用对方公钥加密后的字节数组
|
byte[] encryptByte = RsaSecretUtils.publicEncrypt(OBJECT_MAPPER.writeValueAsString(param).getBytes(StandardCharsets.UTF_8), publicKeyBase64);
|
// 使用己方私钥加签
|
String signStr = RsaSecretUtils.rsaSign(encryptByte, privateKeyBase64);
|
logger.info("获取合作方其他url加密参数->:{}", encryptByte);
|
logger.info("获取合作方其他url加签->:{}", signStr);
|
body.put("content", RsaSecretUtils.byte2Base64(encryptByte));
|
body.put("sign", signStr);
|
response = HttpClientUtil.getInstance().postJsonData(url + "/get_partner_url", OBJECT_MAPPER.writeValueAsString(body));
|
logger.info("获取合作方其他url加密返回->:{}", response);
|
} catch (Exception e) {
|
logger.error("获取合作方其他url加密返回失败->:{}", response);
|
e.printStackTrace();
|
return null;
|
}
|
if (StringUtils.isEmpty(response)) {
|
logger.error("获取合作方接口加密返回数据失败");
|
return null;
|
}
|
JSONObject jsonObject = null;
|
try {
|
jsonObject = JSONObject.parseObject(response);
|
} catch (Exception e) {
|
logger.error("获取合作方其他url加密返回转换json失败->:{}", jsonObject);
|
e.printStackTrace();
|
return null;
|
}
|
// 验签
|
boolean signPass = RsaSecretUtils.rsaSignCheck(Base64Utils.decode(jsonObject.getString("content")), Base64Utils.decode(jsonObject.getString("sign")), publicKeyBase64);
|
logger.info("获取地址验签:{}", signPass);
|
if (signPass == false) {
|
logger.info("获取合作方其他url验签失败");
|
return null;
|
}
|
String data = "";
|
HzxGetResponse hzxResponse = null;
|
try {
|
data = new String(RsaSecretUtils.privateDecrypt(Base64Utils.decode(jsonObject.getString("content")), privateKeyBase64));
|
logger.info("获取下载链接地址:{}", data);
|
hzxResponse = JSON.parseObject(data, HzxGetResponse.class);
|
logger.info("获取下载链接地址转化:{}", hzxResponse.toString());
|
} catch (Exception e) {
|
logger.error("获取合作方其他url加密返回转换失败->:{}", data);
|
e.printStackTrace();
|
return null;
|
}
|
return hzxResponse;
|
}
|
|
|
public void educationParse(LoanBeforeVo loanBeforeVo, Customer latestCustomer) {
|
if (StringUtils.isEmpty(latestCustomer.getEducation())) {
|
loanBeforeVo.setEducation(LoanEducationEnum.Education_4.getCode());
|
} else {
|
if (EducationEnum.Education_1.getCode().equals(latestCustomer.getEducation())
|
|| EducationEnum.Education_06.getCode().equals(latestCustomer.getEducation())
|
|| EducationEnum.Education_07.getCode().equals(latestCustomer.getEducation())) {
|
loanBeforeVo.setEducation(LoanEducationEnum.Education_1.getCode());
|
} else if (EducationEnum.Education_2.getCode().equals(latestCustomer.getEducation())
|
|| EducationEnum.Education_05.getCode().equals(latestCustomer.getEducation())) {
|
loanBeforeVo.setEducation(LoanEducationEnum.Education_2.getCode());
|
} else if (EducationEnum.Education_3.getCode().equals(latestCustomer.getEducation())
|
|| EducationEnum.Education_04.getCode().equals(latestCustomer.getEducation())) {
|
loanBeforeVo.setEducation(LoanEducationEnum.Education_3.getCode());
|
} else {
|
loanBeforeVo.setEducation(LoanEducationEnum.Education_4.getCode());
|
}
|
}
|
}
|
|
public void maritalStatusParse(LoanBeforeVo loanBeforeVo, Customer latestCustomer) {
|
if (StringUtils.isEmpty(latestCustomer.getMaritalStatus())) {
|
loanBeforeVo.setMarriage(LoanMarriageEnum.Marriage_1.getCode());
|
} else {
|
if (MaritalStatusEnum.MaritalStatus_1.getSys().equals(latestCustomer.getMaritalStatus())
|
|| MaritalStatusEnum.MaritalStatus_6.getSys().equals(latestCustomer.getMaritalStatus())) {
|
loanBeforeVo.setMarriage(LoanMarriageEnum.Marriage_2.getCode());
|
} else if (MaritalStatusEnum.MaritalStatus_2.getSys().equals(latestCustomer.getMaritalStatus())
|
|| MaritalStatusEnum.MaritalStatus_5.getSys().equals(latestCustomer.getMaritalStatus())) {
|
loanBeforeVo.setMarriage(LoanMarriageEnum.Marriage_1.getCode());
|
} else if (MaritalStatusEnum.MaritalStatus_3.getSys().equals(latestCustomer.getMaritalStatus())
|
|| MaritalStatusEnum.MaritalStatus_7.getSys().equals(latestCustomer.getMaritalStatus())) {
|
loanBeforeVo.setMarriage(LoanMarriageEnum.Marriage_3.getCode());
|
} else {
|
loanBeforeVo.setMarriage(LoanMarriageEnum.Marriage_4.getCode());
|
}
|
}
|
}
|
|
public void industryParse(LoanBeforeVo loanBeforeVo, Customer latestCustomer) {
|
if (latestCustomer.getProfessionInfo() == null) {
|
loanBeforeVo.setIndustry(LoanIndustryEnum.Industry_17.getCode());
|
} else {
|
if (ProfessionInfoEnum.OFFICE_WORKER.getCode().equals(latestCustomer.getProfessionInfo().toString())) {
|
loanBeforeVo.setIndustry(LoanIndustryEnum.Industry_18.getCode());
|
} else if (ProfessionInfoEnum.FREELANCE.getCode().equals(latestCustomer.getProfessionInfo().toString())) {
|
loanBeforeVo.setIndustry(LoanIndustryEnum.Industry_17.getCode());
|
} else if (ProfessionInfoEnum.BUSINESS_OWNERS.getCode().equals(latestCustomer.getProfessionInfo().toString())
|
|| ProfessionInfoEnum.SELF_EMPLOYED.getCode().equals(latestCustomer.getProfessionInfo().toString())) {
|
loanBeforeVo.setIndustry(LoanIndustryEnum.Industry_16.getCode());
|
} else if (ProfessionInfoEnum.CIVIL_SERVANTS.getCode().equals(latestCustomer.getProfessionInfo().toString())) {
|
loanBeforeVo.setIndustry(LoanIndustryEnum.Industry_1.getCode());
|
} else {
|
loanBeforeVo.setIndustry(LoanIndustryEnum.Industry_18.getCode());
|
}
|
}
|
}
|
|
public void positionParse(LoanBeforeVo loanBeforeVo, Customer latestCustomer) {
|
if (StringUtils.isEmpty(latestCustomer.getJobTitle())) {
|
loanBeforeVo.setPosition(LoanPositionEnum.Position_1.getCode());
|
} else {
|
if (YiXinJobTitleEnum.SENIOR_LEADER.getCode().equals(latestCustomer.getJobTitle())) {
|
loanBeforeVo.setPosition(LoanPositionEnum.Position_4.getCode());
|
} else if (YiXinJobTitleEnum.MID_LEADER.getCode().equals(latestCustomer.getJobTitle())) {
|
loanBeforeVo.setPosition(LoanPositionEnum.Position_2.getCode());
|
} else {
|
loanBeforeVo.setPosition(LoanPositionEnum.Position_1.getCode());
|
}
|
}
|
}
|
|
public void monthlySalaryParse(LoanBeforeVo loanBeforeVo, Customer latestCustomer) {
|
if (latestCustomer.getMonthlyIncome() == null) {
|
loanBeforeVo.setMonthlySalary(LoanMonthlySalaryEnum.MonthlySalary_1.getCode());
|
} else {
|
if (MonthlyIncomeEnum.INCOME_3Q_UNDER.getCode().equals(latestCustomer.getMonthlyIncome())) {
|
loanBeforeVo.setMonthlySalary(LoanMonthlySalaryEnum.MonthlySalary_1.getCode());
|
} else if (MonthlyIncomeEnum.Income_3Q_6Q.getCode().equals(latestCustomer.getMonthlyIncome())) {
|
loanBeforeVo.setMonthlySalary(LoanMonthlySalaryEnum.MonthlySalary_2.getCode());
|
} else if (MonthlyIncomeEnum.Income_6Q_1W.getCode().equals(latestCustomer.getMonthlyIncome())) {
|
loanBeforeVo.setMonthlySalary(LoanMonthlySalaryEnum.MonthlySalary_3.getCode());
|
} else if (MonthlyIncomeEnum.Income_1W_3W.getCode().equals(latestCustomer.getMonthlyIncome())) {
|
loanBeforeVo.setMonthlySalary(LoanMonthlySalaryEnum.MonthlySalary_6.getCode());
|
} else {
|
loanBeforeVo.setMonthlySalary(LoanMonthlySalaryEnum.MonthlySalary_7.getCode());
|
}
|
}
|
}
|
|
public void loanPurposeParse(LoanBeforeVo loanBeforeVo, Customer latestCustomer) {
|
if (StringUtils.isEmpty(latestCustomer.getUseOfLoan())) {
|
loanBeforeVo.setLoanPurpose(LoanPurposeEnum.Purpose_6.getCode());
|
} else {
|
if (UseOfLoanEnum.Loan_1.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_3.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_5.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_6.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_9.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_11.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_12.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_13.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_15.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_17.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_18.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_19.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_20.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_21.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_22.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_23.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_24.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_25.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanBeforeVo.setLoanPurpose(LoanPurposeEnum.Purpose_6.getCode());
|
} else if (UseOfLoanEnum.Loan_2.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_7.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanBeforeVo.setLoanPurpose(LoanPurposeEnum.Purpose_4.getCode());
|
} else if (UseOfLoanEnum.Loan_4.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_16.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanBeforeVo.setLoanPurpose(LoanPurposeEnum.Purpose_1.getCode());
|
} else if (UseOfLoanEnum.Loan_8.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanBeforeVo.setLoanPurpose(LoanPurposeEnum.Purpose_2.getCode());
|
} else if (UseOfLoanEnum.Loan_10.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanBeforeVo.setLoanPurpose(LoanPurposeEnum.Purpose_5.getCode());
|
} else if (UseOfLoanEnum.Loan_14.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanBeforeVo.setLoanPurpose(LoanPurposeEnum.Purpose_3.getCode());
|
} else {
|
loanBeforeVo.setLoanPurpose(LoanPurposeEnum.Purpose_6.getCode());
|
}
|
}
|
}
|
|
public void relationshipParse(LoanBeforeVo loanBeforeVo, Customer latestCustomer) {
|
if (!StringUtils.isEmpty(latestCustomer.getRelationship())) {
|
if (RelationshipEnum.Relationship_1.getCode().equals(latestCustomer.getRelationship())
|
|| RelationshipEnum.Relationship_4.getCode().equals(latestCustomer.getRelationship())) {
|
loanBeforeVo.setFirstContactRelation(LoanFirstContactEnum.FirstContact_2.getCode());
|
} else if (RelationshipEnum.Relationship_3.getCode().equals(latestCustomer.getRelationship())) {
|
loanBeforeVo.setFirstContactRelation(LoanFirstContactEnum.FirstContact_1.getCode());
|
} else {
|
loanBeforeVo.setFirstContactRelation(LoanFirstContactEnum.FirstContact_2.getCode());
|
}
|
} else {
|
loanBeforeVo.setFirstContactRelation(LoanFirstContactEnum.FirstContact_1.getCode());
|
}
|
}
|
|
public void secondContactParse(LoanBeforeVo loanBeforeVo, Customer latestCustomer) {
|
if (!StringUtils.isEmpty(latestCustomer.getContactRelation())) {
|
if (RelationshipEnum.Relationship_8.getCode().equals(latestCustomer.getRelationship())) {
|
loanBeforeVo.setSecondContactRelation(LoanSecondContactEnum.SecondContact_1.getCode());
|
} else if (RelationshipEnum.Relationship_7.getCode().equals(latestCustomer.getRelationship())) {
|
loanBeforeVo.setSecondContactRelation(LoanSecondContactEnum.SecondContact_4.getCode());
|
} else if (RelationshipEnum.Relationship_9.getCode().equals(latestCustomer.getRelationship())) {
|
loanBeforeVo.setSecondContactRelation(LoanSecondContactEnum.SecondContact_2.getCode());
|
} else {
|
loanBeforeVo.setSecondContactRelation(LoanSecondContactEnum.SecondContact_4.getCode());
|
}
|
} else {
|
loanBeforeVo.setSecondContactRelation(LoanSecondContactEnum.SecondContact_4.getCode());
|
}
|
}
|
|
public void houseSituationParse(LoanVo loanVo, Customer latestCustomer) {
|
if (latestCustomer.getHouseStatus() != null) {
|
if (HouseStatusEnum.House_1.getCode().equals(latestCustomer.getHouseStatus())) {
|
loanVo.setHouseSituation(LoanHouseSituationEnum.HouseSituation_1.getCode());
|
} else if (HouseStatusEnum.House_2.getCode().equals(latestCustomer.getHouseStatus())) {
|
loanVo.setHouseSituation(LoanHouseSituationEnum.HouseSituation_4.getCode());
|
} else if (HouseStatusEnum.House_3.getCode().equals(latestCustomer.getHouseStatus())) {
|
loanVo.setHouseSituation(LoanHouseSituationEnum.HouseSituation_6.getCode());
|
} else {
|
loanVo.setHouseSituation(LoanHouseSituationEnum.HouseSituation_5.getCode());
|
}
|
} else {
|
loanVo.setHouseSituation(LoanHouseSituationEnum.HouseSituation_7.getCode());
|
}
|
}
|
|
public void loanOccupationParse(LoanVo loanVo, Customer latestCustomer) {
|
if (!StringUtils.isEmpty(latestCustomer.getOccupation())) {
|
if (YiXinOccupationEnum.PUBLIC.getCode().equals(latestCustomer.getOccupation())) {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_1.getCode());
|
} else if (YiXinOccupationEnum.PROFESSIONAL.getCode().equals(latestCustomer.getOccupation())) {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_2.getCode());
|
} else if (YiXinOccupationEnum.OFFICE.getCode().equals(latestCustomer.getOccupation())) {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_3.getCode());
|
} else if (YiXinOccupationEnum.SERVICE.getCode().equals(latestCustomer.getOccupation())) {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_4.getCode());
|
} else if (YiXinOccupationEnum.CONSERVANCY.getCode().equals(latestCustomer.getOccupation())) {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_5.getCode());
|
} else if (YiXinOccupationEnum.HARD_CLASSIFY.getCode().equals(latestCustomer.getOccupation())) {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_8.getCode());
|
} else if (YiXinOccupationEnum.SOLDIER.getCode().equals(latestCustomer.getOccupation())) {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_7.getCode());
|
} else if (YiXinOccupationEnum.TRANSPORTATION.getCode().equals(latestCustomer.getOccupation())) {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_6.getCode());
|
} else if (YiXinOccupationEnum.UNKNOWN.getCode().equals(latestCustomer.getOccupation())) {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_9.getCode());
|
} else {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_9.getCode());
|
}
|
} else {
|
loanVo.setOccupation(LoanOccupationEnum.Occupation_9.getCode());
|
}
|
}
|
|
public void positionDutyParse(LoanVo loanVo, Customer latestCustomer) {
|
if (!StringUtils.isEmpty(latestCustomer.getJobTitle())) {
|
if (YiXinJobTitleEnum.SENIOR_LEADER.getCode().equals(latestCustomer.getJobTitle())) {
|
loanVo.setPositionDuty(LoanPositonDutyEnum.PositonDuty_4.getCode());
|
} else if (YiXinJobTitleEnum.MID_LEADER.getCode().equals(latestCustomer.getJobTitle())) {
|
loanVo.setPositionDuty(LoanPositonDutyEnum.PositonDuty_1.getCode());
|
} else {
|
loanVo.setPositionDuty(LoanPositonDutyEnum.PositonDuty_7.getCode());
|
}
|
} else {
|
loanVo.setPositionDuty(LoanPositonDutyEnum.PositonDuty_7.getCode());
|
}
|
}
|
|
public void companyTypeParse(LoanVo loanVo, Customer latestCustomer) {
|
if (!StringUtils.isEmpty(latestCustomer.getCompanyNature())) {
|
if (YiXinCompanyNatureEnum.Nature_1.getCode().equals(latestCustomer.getCompanyNature())) {
|
loanVo.setCompanyType(LoanCompanyNatureEnum.CompanyNature_1.getCode());
|
} else if (YiXinCompanyNatureEnum.Nature_2.getCode().equals(latestCustomer.getCompanyNature())) {
|
loanVo.setCompanyType(LoanCompanyNatureEnum.CompanyNature_3.getCode());
|
} else if (YiXinCompanyNatureEnum.Nature_3.getCode().equals(latestCustomer.getCompanyNature())) {
|
loanVo.setCompanyType(LoanCompanyNatureEnum.CompanyNature_5.getCode());
|
} else if (YiXinCompanyNatureEnum.Nature_4.getCode().equals(latestCustomer.getCompanyNature())) {
|
loanVo.setCompanyType(LoanCompanyNatureEnum.CompanyNature_7.getCode());
|
} else if (YiXinCompanyNatureEnum.Nature_5.getCode().equals(latestCustomer.getCompanyNature())) {
|
loanVo.setCompanyType(LoanCompanyNatureEnum.CompanyNature_11.getCode());
|
} else {
|
loanVo.setCompanyType(LoanCompanyNatureEnum.CompanyNature_11.getCode());
|
}
|
} else {
|
loanVo.setCompanyType(LoanCompanyNatureEnum.CompanyNature_11.getCode());
|
}
|
}
|
|
public void pullLoanPurposeParse(LoanVo loanVo, Customer latestCustomer) {
|
if (StringUtils.isEmpty(latestCustomer.getUseOfLoan())) {
|
loanVo.setLoanPurpose(LoanPurposeEnum.Purpose_6.getCode());
|
} else {
|
if (UseOfLoanEnum.Loan_1.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_3.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_5.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_6.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_9.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_11.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_12.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_13.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_15.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_17.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_18.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_19.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_20.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_21.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_22.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_23.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_24.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_25.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanVo.setLoanPurpose(LoanPurposeEnum.Purpose_6.getCode());
|
} else if (UseOfLoanEnum.Loan_2.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_7.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanVo.setLoanPurpose(LoanPurposeEnum.Purpose_4.getCode());
|
} else if (UseOfLoanEnum.Loan_4.getCode().equals(latestCustomer.getUseOfLoan())
|
|| UseOfLoanEnum.Loan_16.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanVo.setLoanPurpose(LoanPurposeEnum.Purpose_1.getCode());
|
} else if (UseOfLoanEnum.Loan_8.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanVo.setLoanPurpose(LoanPurposeEnum.Purpose_2.getCode());
|
} else if (UseOfLoanEnum.Loan_10.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanVo.setLoanPurpose(LoanPurposeEnum.Purpose_5.getCode());
|
} else if (UseOfLoanEnum.Loan_14.getCode().equals(latestCustomer.getUseOfLoan())) {
|
loanVo.setLoanPurpose(LoanPurposeEnum.Purpose_3.getCode());
|
} else {
|
loanVo.setLoanPurpose(LoanPurposeEnum.Purpose_6.getCode());
|
}
|
}
|
}
|
|
}
|