| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617 |
- package com.ydtech.modules.admin.model.po;
- import com.baomidou.mybatisplus.annotation.TableField;
- import com.baomidou.mybatisplus.annotation.TableId;
- import com.baomidou.mybatisplus.annotation.TableName;
- import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
- import lombok.Data;
- import org.apache.commons.lang3.StringUtils;
- import java.io.Serializable;
- import java.text.SimpleDateFormat;
- import java.util.Calendar;
- import java.util.Date;
- /**
- * 车辆关联客户信息
- * @TableName cust_vehicle_policy_info
- */
- @TableName(value ="cust_vehicle_policy_info")
- @Data
- public class CustVehiclePolicyInfo implements Serializable {
- /**
- * 主键
- */
- @TableId
- private String id;
- /**
- * 客户ID
- */
- private String custId;
- /**
- * 子订单号
- */
- private String subOrderNo;
- /**
- * 车辆ID
- */
- private String vehicleId;
- /**
- * 投保人名称
- */
- private String applyName;
- /**
- * 投保人身份证号
- */
- private String applyIdentifyNumber;
- /**
- * 投保人身份证类型
- */
- private String applyIdentifyType;
- /**
- * 投保人地址
- */
- private String applyAddr;
- /**
- * 投保人年龄
- */
- private String applyAge;
- /**
- * 投保人性别
- */
- private String applyGender;
- /**
- * 投保人邮箱
- */
- private String applyEmail;
- /**
- * 投保人手机号
- */
- private String applyMobile;
- /**
- * 投保人有效时间开始
- */
- private Date applyIdentifyValidDate;
- /**
- * 投保人有效时间结束
- */
- private Date applyIdentifyValidEndDate;
- /**
- * 是否同车主
- */
- private Boolean applyOwnerFlag;
- /**
- * 是否同车主
- */
- private Boolean applyInsuranceHolderFlag;
- /**
- * 被保人名称
- */
- private String insureName;
- /**
- * 被保人身份证号
- */
- private String insureIdentifyNumber;
- /**
- * 被保人身份证类型
- */
- private String insureIdentifyType;
- /**
- * 被保人地址
- */
- private String insureAddr;
- /**
- * 被保人年齡
- */
- private String insureAge;
- /**
- * 被保人性別
- */
- private String insureGender;
- /**
- * 被保人邮箱
- */
- private String insureEmail;
- /**
- * 被保人手机号
- */
- private String insureMobile;
- /**
- * 被保人有效时间开始
- */
- private Date insureIdentifyValidDate;
- /**
- * 被保人有效时间结束
- */
- private Date insureIdentifyValidEndDate;
- /**
- * 是否同车主
- */
- private Boolean insureOwnerFlag;
- /**
- * 是否同车主
- */
- private Boolean insureInsuranceHolderFlag;
- /**
- * 车主名称
- */
- private String ownerName;
- /**
- * 车主身份证号
- */
- private String ownerIdentifyNumber;
- /**
- * 车主身份证类型
- */
- private String ownerIdentifyType;
- /**
- * 车主地址
- */
- private String ownerAddr;
- /**
- * 车主年齡
- */
- private String ownerAge;
- /**
- * 车主性別
- */
- private String ownerGender;
- /**
- * 车主邮箱
- */
- private String ownerEmail;
- /**
- * 车主手机号
- */
- private String ownerMobile;
- /**
- * 车主有效时间开始
- */
- private Date ownerIdentifyValidDate;
- /**
- * 车主有效时间结束
- */
- private Date ownerIdentifyValidEndDate;
- /**
- * 是否同车主
- */
- private Boolean ownerOwner;
- /**
- * 是否同车主
- */
- private Boolean ownerOwnerFlag;
- /**
- * 是否同车主
- */
- private Boolean OwnerInsuranceHolderFlag;
- /**
- * 创建人
- */
- private String createBy;
- /**
- * 创建时间
- */
- private Date createTime;
- /**
- * 修改人
- */
- private String updateBy;
- /**
- * 修改时间
- */
- private Date updateTime;
- /**
- * 是否删除 0表示未删除,1表示删除
- */
- private Integer delFlag;
- //企业车新增
- /**
- * 固定电话
- */
- private String applyTel;
- /**
- * 省
- */
- private String applyProvince;
- /**
- * 市
- */
- private String applyCity;
- /**
- * 县
- */
- private String applyCounty;
- /***
- * 车主类型(0:法人 1:个人(中国籍) 2: 个人(非中国籍))
- */
- private String applyProperty;
- /***
- * 注册资本金
- */
- private String applyRegisteredCapital;
- /***
- * 经营范围
- */
- private String applyScope;
- /***
- * 联系人
- */
- private String applyLegalPerson;
- /***
- * 组织机构代码
- */
- private String applyOrganizationCode;
- /**
- * 固定电话
- */
- private String insureTel;
- /**
- * 省
- */
- private String insureProvince;
- /**
- * 市
- */
- private String insureCity;
- /**
- * 县
- */
- private String insureCounty;
- /***
- * 车主类型(0:法人 1:个人(中国籍) 2: 个人(非中国籍))
- */
- private String insureProperty;
- /***
- * 注册资本金
- */
- private String insureRegisteredCapital;
- /***
- * 经营范围
- */
- private String insureScope;
- /***
- * 联系人
- */
- private String insureLegalPerson;
- /***
- * 组织机构代码
- */
- private String insureOrganizationCode;
- /**
- * 固定电话
- */
- private String ownerTel;
- /**
- * 省
- */
- private String ownerProvince;
- /**
- * 市
- */
- private String ownerCity;
- /**
- * 县
- */
- private String ownerCounty;
- /***
- * 车主类型(0:法人 1:个人(中国籍) 2: 个人(非中国籍))
- */
- private String ownerProperty;
- /***
- * 注册资本金
- */
- private String ownerRegisteredCapital;
- /***
- * 经营范围
- */
- private String ownerScope;
- /***
- * 联系人
- */
- private String ownerLegalPerson;
- /***
- * 组织机构代码
- */
- private String ownerOrganizationCode;
- @TableField(exist = false)
- private static final long serialVersionUID = 1L;
- public CustomerInfoVo trafferCustVehiclePolicyInfo(CustVehiclePolicyInfo custVehiclePolicyInfo, int type) {
- CustomerInfoVo customerInfoVo = new CustomerInfoVo();
- if(type==1){
- //姓名
- customerInfoVo.setName(custVehiclePolicyInfo.getOwnerName());
- //身份证号
- customerInfoVo.setIdentifyNumber(custVehiclePolicyInfo.getOwnerIdentifyNumber());
- //身份证类型
- customerInfoVo.setIdentifyType(custVehiclePolicyInfo.getOwnerIdentifyType());
- //地址
- customerInfoVo.setAddr(custVehiclePolicyInfo.getOwnerAddr());
- //年龄
- customerInfoVo.setAge(getAgeByIdCard(custVehiclePolicyInfo.getOwnerIdentifyNumber()));
- //性别
- customerInfoVo.setGender(checkGender(custVehiclePolicyInfo.getOwnerIdentifyNumber()));
- //邮箱
- customerInfoVo.setEmail(custVehiclePolicyInfo.getOwnerEmail());
- //手机号
- customerInfoVo.setMobile(custVehiclePolicyInfo.getOwnerMobile());
- //有效时间
- Date ownerIdentifyValidDateBegin = custVehiclePolicyInfo.getOwnerIdentifyValidDate();
- String ownerIdentifyValidDateBeginStr="";
- if(ownerIdentifyValidDateBegin!=null){
- ownerIdentifyValidDateBeginStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateBegin);
- }
- customerInfoVo.setIdentifyValidDate(ownerIdentifyValidDateBeginStr);
- Date ownerIdentifyValidDateEnd = custVehiclePolicyInfo.getOwnerIdentifyValidEndDate();
- String ownerIdentifyValidDateEndStr="";
- if(ownerIdentifyValidDateEnd!=null){
- ownerIdentifyValidDateEndStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateEnd);
- }
- //有效时间
- customerInfoVo.setIdentifyValidEndDate(ownerIdentifyValidDateEndStr);
- //同车主
- customerInfoVo.setOwner(custVehiclePolicyInfo.getOwnerOwnerFlag() != null && custVehiclePolicyInfo.getOwnerOwnerFlag());
- //同投保人
- customerInfoVo.setInsuranceHolder(custVehiclePolicyInfo.getOwnerInsuranceHolderFlag() != null && custVehiclePolicyInfo.getOwnerInsuranceHolderFlag());
- //车主相关信息 add hxl 2024-12-20
- customerInfoVo.setTel(custVehiclePolicyInfo.getOwnerTel());
- customerInfoVo.setOrganizationCode(custVehiclePolicyInfo.getOwnerOrganizationCode());
- customerInfoVo.setProvince(custVehiclePolicyInfo.getOwnerProvince());
- customerInfoVo.setCity(custVehiclePolicyInfo.getOwnerCity());
- customerInfoVo.setCounty(custVehiclePolicyInfo.getOwnerCounty());
- customerInfoVo.setProperty(custVehiclePolicyInfo.getOwnerProperty());
- customerInfoVo.setRegisteredCapital(custVehiclePolicyInfo.getOwnerRegisteredCapital());
- customerInfoVo.setScope(custVehiclePolicyInfo.getOwnerScope());
- customerInfoVo.setLegalPerson(custVehiclePolicyInfo.getOwnerLegalPerson());
- }else if(type ==2){
- //姓名
- customerInfoVo.setName(custVehiclePolicyInfo.getInsureName());
- //身份证号
- customerInfoVo.setIdentifyNumber(custVehiclePolicyInfo.getInsureIdentifyNumber());
- //身份证类型
- customerInfoVo.setIdentifyType(custVehiclePolicyInfo.getInsureIdentifyType());
- //地址
- customerInfoVo.setAddr(custVehiclePolicyInfo.getInsureAddr());
- //年龄
- customerInfoVo.setAge(getAgeByIdCard(custVehiclePolicyInfo.getInsureIdentifyNumber()));
- //性别
- customerInfoVo.setGender(checkGender(custVehiclePolicyInfo.getInsureIdentifyNumber()));
- //邮箱
- customerInfoVo.setEmail(custVehiclePolicyInfo.getInsureEmail());
- //手机号
- customerInfoVo.setMobile(custVehiclePolicyInfo.getInsureMobile());
- //有效时间
- Date ownerIdentifyValidDateBegin = custVehiclePolicyInfo.getInsureIdentifyValidDate();
- String ownerIdentifyValidDateBeginStr="";
- if(ownerIdentifyValidDateBegin!=null){
- ownerIdentifyValidDateBeginStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateBegin);
- }
- customerInfoVo.setIdentifyValidDate(ownerIdentifyValidDateBeginStr);
- Date ownerIdentifyValidDateEnd = custVehiclePolicyInfo.getInsureIdentifyValidEndDate();
- String ownerIdentifyValidDateEndStr="";
- if(ownerIdentifyValidDateEnd!=null){
- ownerIdentifyValidDateEndStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateEnd);
- }
- //有效时间
- customerInfoVo.setIdentifyValidEndDate(ownerIdentifyValidDateEndStr);
- //同车主
- customerInfoVo.setOwner(custVehiclePolicyInfo.getInsureOwnerFlag() != null && custVehiclePolicyInfo.getInsureOwnerFlag());
- //同投保人
- customerInfoVo.setInsuranceHolder(custVehiclePolicyInfo.getInsureInsuranceHolderFlag() != null && custVehiclePolicyInfo.getInsureInsuranceHolderFlag());
- //车主相关信息 add hxl 2024-12-20
- customerInfoVo.setTel(custVehiclePolicyInfo.getInsureTel());
- customerInfoVo.setOrganizationCode(custVehiclePolicyInfo.getInsureOrganizationCode());
- customerInfoVo.setProvince(custVehiclePolicyInfo.getInsureProvince());
- customerInfoVo.setCity(custVehiclePolicyInfo.getInsureCity());
- customerInfoVo.setCounty(custVehiclePolicyInfo.getInsureCounty());
- customerInfoVo.setProperty(custVehiclePolicyInfo.getInsureProperty());
- customerInfoVo.setRegisteredCapital(custVehiclePolicyInfo.getInsureRegisteredCapital());
- customerInfoVo.setScope(custVehiclePolicyInfo.getInsureScope());
- customerInfoVo.setLegalPerson(custVehiclePolicyInfo.getInsureLegalPerson());
- }else if(type ==3){
- //姓名
- customerInfoVo.setName(custVehiclePolicyInfo.getApplyName());
- //身份证号
- customerInfoVo.setIdentifyNumber(custVehiclePolicyInfo.getApplyIdentifyNumber());
- //身份证类型
- customerInfoVo.setIdentifyType(custVehiclePolicyInfo.getApplyIdentifyType());
- //地址
- customerInfoVo.setAddr(custVehiclePolicyInfo.getApplyAddr());
- //年龄
- customerInfoVo.setAge(getAgeByIdCard(custVehiclePolicyInfo.getApplyIdentifyNumber()));
- //性别
- customerInfoVo.setGender(checkGender(custVehiclePolicyInfo.getApplyIdentifyNumber()));
- //邮箱
- customerInfoVo.setEmail(custVehiclePolicyInfo.getApplyEmail());
- //手机号
- customerInfoVo.setMobile(custVehiclePolicyInfo.getApplyMobile());
- //有效时间
- Date ownerIdentifyValidDateBegin = custVehiclePolicyInfo.getApplyIdentifyValidDate();
- String ownerIdentifyValidDateBeginStr="";
- if(ownerIdentifyValidDateBegin!=null){
- ownerIdentifyValidDateBeginStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateBegin);
- }
- customerInfoVo.setIdentifyValidDate(ownerIdentifyValidDateBeginStr);
- Date ownerIdentifyValidDateEnd = custVehiclePolicyInfo.getApplyIdentifyValidEndDate();
- String ownerIdentifyValidDateEndStr="";
- if(ownerIdentifyValidDateEnd!=null){
- ownerIdentifyValidDateEndStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateEnd);
- }
- //有效时间
- customerInfoVo.setIdentifyValidEndDate(ownerIdentifyValidDateEndStr);
- //同车主
- customerInfoVo.setOwner(custVehiclePolicyInfo.getApplyOwnerFlag() != null && custVehiclePolicyInfo.getApplyOwnerFlag());
- //同投保人
- customerInfoVo.setInsuranceHolder(custVehiclePolicyInfo.getApplyInsuranceHolderFlag() != null && custVehiclePolicyInfo.getApplyInsuranceHolderFlag());
- //车主相关信息 add hxl 2024-12-20
- customerInfoVo.setTel(custVehiclePolicyInfo.getOwnerTel());
- customerInfoVo.setOrganizationCode(custVehiclePolicyInfo.getOwnerOrganizationCode());
- customerInfoVo.setProvince(custVehiclePolicyInfo.getOwnerProvince());
- customerInfoVo.setCity(custVehiclePolicyInfo.getOwnerCity());
- customerInfoVo.setCounty(custVehiclePolicyInfo.getOwnerCounty());
- customerInfoVo.setProperty(custVehiclePolicyInfo.getOwnerProperty());
- customerInfoVo.setRegisteredCapital(custVehiclePolicyInfo.getOwnerRegisteredCapital());
- customerInfoVo.setScope(custVehiclePolicyInfo.getOwnerScope());
- //车主相关信息 add hxl 2024-12-20
- customerInfoVo.setTel(custVehiclePolicyInfo.getOwnerTel());
- customerInfoVo.setOrganizationCode(custVehiclePolicyInfo.getOwnerOrganizationCode());
- customerInfoVo.setProvince(custVehiclePolicyInfo.getOwnerProvince());
- customerInfoVo.setCity(custVehiclePolicyInfo.getOwnerCity());
- customerInfoVo.setCounty(custVehiclePolicyInfo.getOwnerCounty());
- customerInfoVo.setProperty(custVehiclePolicyInfo.getOwnerProperty());
- customerInfoVo.setRegisteredCapital(custVehiclePolicyInfo.getOwnerRegisteredCapital());
- customerInfoVo.setScope(custVehiclePolicyInfo.getOwnerScope());
- customerInfoVo.setLegalPerson(custVehiclePolicyInfo.getOwnerLegalPerson());
- }
- return customerInfoVo;
- }
- private static String farmmatSex(String sex) {
- if(StringUtils.isNotBlank(sex)) {
- if ("1".equals(sex)) {
- return "女";
- } else if ("2".equals(sex)) {
- return "男";
- }
- }
- return "";
- }
- public static String getAgeByIdCard(String idCard) {
- // 截取身份证中的出生日期部分
- String birthDateStr = idCard.substring(6, 14);
- try {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
- Date birthDate = sdf.parse(birthDateStr);
- Calendar birthCal = Calendar.getInstance();
- birthCal.setTime(birthDate);
- Calendar currentCal = Calendar.getInstance();
- int birthYear = birthCal.get(Calendar.YEAR);
- int currentYear = currentCal.get(Calendar.YEAR);
- int age = currentYear - birthYear;
- // 考虑生日是否已经过了
- int birthMonth = birthCal.get(Calendar.MONTH);
- int currentMonth = currentCal.get(Calendar.MONTH);
- if (birthMonth > currentMonth) {
- age--;
- } else if (birthMonth == currentMonth) {
- int birthDay = birthCal.get(Calendar.DAY_OF_MONTH);
- int currentDay = currentCal.get(Calendar.DAY_OF_MONTH);
- if (birthDay > currentDay) {
- age--;
- }
- }
- return String.valueOf(age);
- } catch (Exception e) {
- e.printStackTrace();
- return "";
- }
- }
- /**
- * @version
- * @author: hxl
- * @Date: 2024/11/22 9:10
- * @Description: 通过身份证号判断男女
- */
- public static String checkGender(String idCardNumber) {
- if (idCardNumber.length() == 18) {
- char genderDigit = idCardNumber.charAt(16);
- int genderValue = Integer.parseInt(String.valueOf(genderDigit));
- if (genderValue % 2 == 0) {
- return "女";
- } else {
- return "男";
- }
- } else if (idCardNumber.length() == 15) {
- char genderDigit = idCardNumber.charAt(14);
- int genderValue = Integer.parseInt(String.valueOf(genderDigit));
- if (genderValue % 2 == 0) {
- return "女";
- } else {
- return "男";
- }
- } else {
- return "";
- }
- }
- }
|