sunshine
2024-11-05 53bd8a8d8184b3f19695b756ee78f343cdb9b9b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package com.nova.sankuai.domain.api.yangqianguan.dto;
 
import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.nova.sankuai.domain.api.yangqianguan.vo.*;
import com.nova.sankuai.domain.entity.Customer;
import com.nova.sankuai.domain.enums.CustomerInfoStatusEnum;
import com.nova.sankuai.domain.enums.SourceTypeEnum;
import com.nova.sankuai.domain.enums.yixin.YiXinCompanyNatureEnum;
import com.nova.sankuai.domain.enums.yixin.YiXinJobTitleEnum;
import com.nova.sankuai.domain.enums.yixin.YiXinLivestEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
 
import java.text.DecimalFormat;
import java.util.Date;
 
/**
 * @Description 洋钱罐校验Vo
 * @Author CWR
 * @Date 2022/4/26 21:57
 */
@Data
@ApiModel(value = "授信申请Dto")
public class CreditApplyDto {
 
    @ApiModelProperty(value = "基本信息")
    @JsonProperty("basic_info")
    private BasicInfoVo basicInfo;
 
    @ApiModelProperty(value = "申请信息")
    @JsonProperty("apply_info")
    private ApplyInfoVo applyInfo;
 
    @ApiModelProperty(value = "身份证信息")
    @JsonProperty("id_info")
    private IdInfoVo idInfo;
 
    @ApiModelProperty(value = "活体信息")
    @JsonProperty("living_info")
    private LivingInfoVo livingInfo;
 
    @ApiModelProperty(value = "设备信息")
    @JsonProperty("device_info")
    private DeviceInfoVo deviceInfo;
 
    public Customer parseCustomer() {
        //授信申请数据映射
        OptionInfoVo optionInfo = applyInfo.getOptionInfo();
        Customer customer = new Customer();
        //授信信息-授信编号
        customer.setCreditNo(basicInfo.getCreditNo());
        customer.setSourceChannel(SourceTypeEnum.YangQianGuan.getCode());
        //用户授信信息
        customer.setLoanAmount(Customer.DEFAULT_QUOTA);
        customer.setLoanTerm(12);
        customer.setUseOfLoan(applyInfo.formatUseOfLoan());
        customer.setName(basicInfo.getUserName());
        customer.setIdCard(basicInfo.getIdentityNumber());
        customer.setBirthday(parseBirth(basicInfo.getIdentityNumber()));
        customer.setPhone(basicInfo.getMobile());
        customer.setSex(idInfo.getSex());
        customer.setNation(idInfo.getNation());
        customer.setIdAddress(idInfo.getAddress());
        customer.setSignOrganization(idInfo.getIssueAgency());
        String begin = DateUtil.format(new Date(idInfo.getIssueDate()), "yyyy-MM-dd");
        customer.setIdValidDateBegin(begin);
        if (idInfo.getExpireDate() == 0) {
            customer.setIdValidDateEnd("长期");
        } else {
            String end = DateUtil.format(new Date(idInfo.getExpireDate()), "yyyy-MM-dd");
            customer.setIdValidDateEnd(end);
        }
        customer.setEducation(applyInfo.formatEducation());
        customer.setMaritalStatus(optionInfo.formatMaritalStatus());
        ResultFaceidVo resultFaceid = livingInfo.getResultFaceid();
        if (resultFaceid.getConfidence() != null) {
            DecimalFormat df = new DecimalFormat("#.00");
            String format = df.format(resultFaceid.getConfidence());
            customer.setVerifySimilarity(format);
        } else {
            customer.setVerifySimilarity("0");
        }
        customer.setVerifySimilarityName("03");
        customer.setLng(applyInfo.getLongitude());
        customer.setLat(applyInfo.getLatitude());
        customer.setDeviceOsVersion(deviceInfo.getOsVersion());
        customer.setOs(deviceInfo.getOsType());
        customer.setDeviceId(deviceInfo.getUdid());
        customer.setIdfa(deviceInfo.getIdfa());
        customer.setIdfv(deviceInfo.getIdfv());
        customer.setImei(deviceInfo.getImei());
        customer.setLiveProvince(applyInfo.getAddressProvince());
        customer.setLiveCity(applyInfo.getAddressCity());
        customer.setLiveArea(applyInfo.getAddressDistrict());
        customer.setAddress(applyInfo.getAddressDetail());
        customer.setClientIp(deviceInfo.getIp());
        customer.setFamilyMonthlyIncome(applyInfo.getMonthlyIncome());
        customer.setLivest(YiXinLivestEnum.UNKNOWN.getCode());
        customer.setGpsProvince(applyInfo.getGpsProvince());
        customer.setGpsCity(applyInfo.getGpsCity());
        customer.setGpsArea(applyInfo.getGpsDistrict());
        //联系人信息
        customer.setRelationship(applyInfo.formatHomeRelation());
        customer.setRelationshipName(applyInfo.getImmediateContact().getName());
        customer.setRelationshipPhone(applyInfo.getImmediateContact().getMobilePhoneNo());
        customer.setContactRelation(applyInfo.formatContractRelation());
        customer.setContactName(applyInfo.getSecondImmediateContact().getName());
        customer.setContactPhone(applyInfo.getSecondImmediateContact().getMobilePhoneNo());
 
        //职位信息
        customer.setMonthlyIncome(applyInfo.formatMonthlyIncome());
        customer.setCompanyName(optionInfo.getCompanyName());
        customer.setCompanyAddress(optionInfo.getOfficeAddressDistrict());
        customer.setCompanyProvince(optionInfo.getOfficeAddressProvince());
        customer.setCompanyCity(optionInfo.getOfficeAddressCity());
        customer.setCompanyArea(optionInfo.getOfficeAddressDistrict());
        customer.setCompanyPhone(basicInfo.getMobile());
        customer.setOccupation(applyInfo.formatCareer());
        customer.setJobTitle(YiXinJobTitleEnum.UNKNOWN.getCode());
        customer.setCompanyNature(YiXinCompanyNatureEnum.Nature_6.getCode());
        //其余字段
        customer.setYqgUserId(basicInfo.getUserId());
        customer.setApplyDate(new Date(basicInfo.getCreditTime()));
        customer.setCompanyTrade(applyInfo.formatIndustry());
        customer.setSimCardStatus(deviceInfo.getSimCardStatus());
        customer.setIsEmulator(deviceInfo.getIsEmulator());
        customer.setStatus(CustomerInfoStatusEnum.CAPITAL_INFO.getCode());
        return customer;
    }
 
    private String parseBirth(String idCard) {
        if (StringUtils.isEmpty(idCard)) {
            return null;
        } else if (idCard.length() == 18) {
            String year = idCard.substring(6).substring(0, 4);
            String month = idCard.substring(10).substring(0, 2);
            String day = idCard.substring(12).substring(0, 2);
            return (year + "-" + month + "-" + day);
        } else if (idCard.length() == 15) {
            String year = "19" + idCard.substring(6, 8);
            String month = idCard.substring(8, 10);
            String day = idCard.substring(10, 12);
            return (year + "-" + month + "-" + day);
        }
        return null;
    }
}