CustVehiclePolicyInfo.java 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. package com.ydtech.modules.admin.model.po;
  2. import com.baomidou.mybatisplus.annotation.TableField;
  3. import com.baomidou.mybatisplus.annotation.TableId;
  4. import com.baomidou.mybatisplus.annotation.TableName;
  5. import com.ydtech.modules.ins.model.vo.CustomerInfoVo;
  6. import lombok.Data;
  7. import org.apache.commons.lang3.StringUtils;
  8. import java.io.Serializable;
  9. import java.text.SimpleDateFormat;
  10. import java.util.Calendar;
  11. import java.util.Date;
  12. /**
  13. * 车辆关联客户信息
  14. * @TableName cust_vehicle_policy_info
  15. */
  16. @TableName(value ="cust_vehicle_policy_info")
  17. @Data
  18. public class CustVehiclePolicyInfo implements Serializable {
  19. /**
  20. * 主键
  21. */
  22. @TableId
  23. private String id;
  24. /**
  25. * 客户ID
  26. */
  27. private String custId;
  28. /**
  29. * 子订单号
  30. */
  31. private String subOrderNo;
  32. /**
  33. * 车辆ID
  34. */
  35. private String vehicleId;
  36. /**
  37. * 投保人名称
  38. */
  39. private String applyName;
  40. /**
  41. * 投保人身份证号
  42. */
  43. private String applyIdentifyNumber;
  44. /**
  45. * 投保人身份证类型
  46. */
  47. private String applyIdentifyType;
  48. /**
  49. * 投保人地址
  50. */
  51. private String applyAddr;
  52. /**
  53. * 投保人年龄
  54. */
  55. private String applyAge;
  56. /**
  57. * 投保人性别
  58. */
  59. private String applyGender;
  60. /**
  61. * 投保人邮箱
  62. */
  63. private String applyEmail;
  64. /**
  65. * 投保人手机号
  66. */
  67. private String applyMobile;
  68. /**
  69. * 投保人有效时间开始
  70. */
  71. private Date applyIdentifyValidDate;
  72. /**
  73. * 投保人有效时间结束
  74. */
  75. private Date applyIdentifyValidEndDate;
  76. /**
  77. * 是否同车主
  78. */
  79. private Boolean applyOwnerFlag;
  80. /**
  81. * 是否同车主
  82. */
  83. private Boolean applyInsuranceHolderFlag;
  84. /**
  85. * 被保人名称
  86. */
  87. private String insureName;
  88. /**
  89. * 被保人身份证号
  90. */
  91. private String insureIdentifyNumber;
  92. /**
  93. * 被保人身份证类型
  94. */
  95. private String insureIdentifyType;
  96. /**
  97. * 被保人地址
  98. */
  99. private String insureAddr;
  100. /**
  101. * 被保人年齡
  102. */
  103. private String insureAge;
  104. /**
  105. * 被保人性別
  106. */
  107. private String insureGender;
  108. /**
  109. * 被保人邮箱
  110. */
  111. private String insureEmail;
  112. /**
  113. * 被保人手机号
  114. */
  115. private String insureMobile;
  116. /**
  117. * 被保人有效时间开始
  118. */
  119. private Date insureIdentifyValidDate;
  120. /**
  121. * 被保人有效时间结束
  122. */
  123. private Date insureIdentifyValidEndDate;
  124. /**
  125. * 是否同车主
  126. */
  127. private Boolean insureOwnerFlag;
  128. /**
  129. * 是否同车主
  130. */
  131. private Boolean insureInsuranceHolderFlag;
  132. /**
  133. * 车主名称
  134. */
  135. private String ownerName;
  136. /**
  137. * 车主身份证号
  138. */
  139. private String ownerIdentifyNumber;
  140. /**
  141. * 车主身份证类型
  142. */
  143. private String ownerIdentifyType;
  144. /**
  145. * 车主地址
  146. */
  147. private String ownerAddr;
  148. /**
  149. * 车主年齡
  150. */
  151. private String ownerAge;
  152. /**
  153. * 车主性別
  154. */
  155. private String ownerGender;
  156. /**
  157. * 车主邮箱
  158. */
  159. private String ownerEmail;
  160. /**
  161. * 车主手机号
  162. */
  163. private String ownerMobile;
  164. /**
  165. * 车主有效时间开始
  166. */
  167. private Date ownerIdentifyValidDate;
  168. /**
  169. * 车主有效时间结束
  170. */
  171. private Date ownerIdentifyValidEndDate;
  172. /**
  173. * 是否同车主
  174. */
  175. private Boolean ownerOwner;
  176. /**
  177. * 是否同车主
  178. */
  179. private Boolean ownerOwnerFlag;
  180. /**
  181. * 是否同车主
  182. */
  183. private Boolean OwnerInsuranceHolderFlag;
  184. /**
  185. * 创建人
  186. */
  187. private String createBy;
  188. /**
  189. * 创建时间
  190. */
  191. private Date createTime;
  192. /**
  193. * 修改人
  194. */
  195. private String updateBy;
  196. /**
  197. * 修改时间
  198. */
  199. private Date updateTime;
  200. /**
  201. * 是否删除 0表示未删除,1表示删除
  202. */
  203. private Integer delFlag;
  204. //企业车新增
  205. /**
  206. * 固定电话
  207. */
  208. private String applyTel;
  209. /**
  210. * 省
  211. */
  212. private String applyProvince;
  213. /**
  214. * 市
  215. */
  216. private String applyCity;
  217. /**
  218. * 县
  219. */
  220. private String applyCounty;
  221. /***
  222. * 车主类型(0:法人 1:个人(中国籍) 2: 个人(非中国籍))
  223. */
  224. private String applyProperty;
  225. /***
  226. * 注册资本金
  227. */
  228. private String applyRegisteredCapital;
  229. /***
  230. * 经营范围
  231. */
  232. private String applyScope;
  233. /***
  234. * 联系人
  235. */
  236. private String applyLegalPerson;
  237. /***
  238. * 组织机构代码
  239. */
  240. private String applyOrganizationCode;
  241. /**
  242. * 固定电话
  243. */
  244. private String insureTel;
  245. /**
  246. * 省
  247. */
  248. private String insureProvince;
  249. /**
  250. * 市
  251. */
  252. private String insureCity;
  253. /**
  254. * 县
  255. */
  256. private String insureCounty;
  257. /***
  258. * 车主类型(0:法人 1:个人(中国籍) 2: 个人(非中国籍))
  259. */
  260. private String insureProperty;
  261. /***
  262. * 注册资本金
  263. */
  264. private String insureRegisteredCapital;
  265. /***
  266. * 经营范围
  267. */
  268. private String insureScope;
  269. /***
  270. * 联系人
  271. */
  272. private String insureLegalPerson;
  273. /***
  274. * 组织机构代码
  275. */
  276. private String insureOrganizationCode;
  277. /**
  278. * 固定电话
  279. */
  280. private String ownerTel;
  281. /**
  282. * 省
  283. */
  284. private String ownerProvince;
  285. /**
  286. * 市
  287. */
  288. private String ownerCity;
  289. /**
  290. * 县
  291. */
  292. private String ownerCounty;
  293. /***
  294. * 车主类型(0:法人 1:个人(中国籍) 2: 个人(非中国籍))
  295. */
  296. private String ownerProperty;
  297. /***
  298. * 注册资本金
  299. */
  300. private String ownerRegisteredCapital;
  301. /***
  302. * 经营范围
  303. */
  304. private String ownerScope;
  305. /***
  306. * 联系人
  307. */
  308. private String ownerLegalPerson;
  309. /***
  310. * 组织机构代码
  311. */
  312. private String ownerOrganizationCode;
  313. @TableField(exist = false)
  314. private static final long serialVersionUID = 1L;
  315. public CustomerInfoVo trafferCustVehiclePolicyInfo(CustVehiclePolicyInfo custVehiclePolicyInfo, int type) {
  316. CustomerInfoVo customerInfoVo = new CustomerInfoVo();
  317. if(type==1){
  318. //姓名
  319. customerInfoVo.setName(custVehiclePolicyInfo.getOwnerName());
  320. //身份证号
  321. customerInfoVo.setIdentifyNumber(custVehiclePolicyInfo.getOwnerIdentifyNumber());
  322. //身份证类型
  323. customerInfoVo.setIdentifyType(custVehiclePolicyInfo.getOwnerIdentifyType());
  324. //地址
  325. customerInfoVo.setAddr(custVehiclePolicyInfo.getOwnerAddr());
  326. //年龄
  327. customerInfoVo.setAge(getAgeByIdCard(custVehiclePolicyInfo.getOwnerIdentifyNumber()));
  328. //性别
  329. customerInfoVo.setGender(checkGender(custVehiclePolicyInfo.getOwnerIdentifyNumber()));
  330. //邮箱
  331. customerInfoVo.setEmail(custVehiclePolicyInfo.getOwnerEmail());
  332. //手机号
  333. customerInfoVo.setMobile(custVehiclePolicyInfo.getOwnerMobile());
  334. //有效时间
  335. Date ownerIdentifyValidDateBegin = custVehiclePolicyInfo.getOwnerIdentifyValidDate();
  336. String ownerIdentifyValidDateBeginStr="";
  337. if(ownerIdentifyValidDateBegin!=null){
  338. ownerIdentifyValidDateBeginStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateBegin);
  339. }
  340. customerInfoVo.setIdentifyValidDate(ownerIdentifyValidDateBeginStr);
  341. Date ownerIdentifyValidDateEnd = custVehiclePolicyInfo.getOwnerIdentifyValidEndDate();
  342. String ownerIdentifyValidDateEndStr="";
  343. if(ownerIdentifyValidDateEnd!=null){
  344. ownerIdentifyValidDateEndStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateEnd);
  345. }
  346. //有效时间
  347. customerInfoVo.setIdentifyValidEndDate(ownerIdentifyValidDateEndStr);
  348. //同车主
  349. customerInfoVo.setOwner(custVehiclePolicyInfo.getOwnerOwnerFlag() != null && custVehiclePolicyInfo.getOwnerOwnerFlag());
  350. //同投保人
  351. customerInfoVo.setInsuranceHolder(custVehiclePolicyInfo.getOwnerInsuranceHolderFlag() != null && custVehiclePolicyInfo.getOwnerInsuranceHolderFlag());
  352. //车主相关信息 add hxl 2024-12-20
  353. customerInfoVo.setTel(custVehiclePolicyInfo.getOwnerTel());
  354. customerInfoVo.setOrganizationCode(custVehiclePolicyInfo.getOwnerOrganizationCode());
  355. customerInfoVo.setProvince(custVehiclePolicyInfo.getOwnerProvince());
  356. customerInfoVo.setCity(custVehiclePolicyInfo.getOwnerCity());
  357. customerInfoVo.setCounty(custVehiclePolicyInfo.getOwnerCounty());
  358. customerInfoVo.setProperty(custVehiclePolicyInfo.getOwnerProperty());
  359. customerInfoVo.setRegisteredCapital(custVehiclePolicyInfo.getOwnerRegisteredCapital());
  360. customerInfoVo.setScope(custVehiclePolicyInfo.getOwnerScope());
  361. customerInfoVo.setLegalPerson(custVehiclePolicyInfo.getOwnerLegalPerson());
  362. }else if(type ==2){
  363. //姓名
  364. customerInfoVo.setName(custVehiclePolicyInfo.getInsureName());
  365. //身份证号
  366. customerInfoVo.setIdentifyNumber(custVehiclePolicyInfo.getInsureIdentifyNumber());
  367. //身份证类型
  368. customerInfoVo.setIdentifyType(custVehiclePolicyInfo.getInsureIdentifyType());
  369. //地址
  370. customerInfoVo.setAddr(custVehiclePolicyInfo.getInsureAddr());
  371. //年龄
  372. customerInfoVo.setAge(getAgeByIdCard(custVehiclePolicyInfo.getInsureIdentifyNumber()));
  373. //性别
  374. customerInfoVo.setGender(checkGender(custVehiclePolicyInfo.getInsureIdentifyNumber()));
  375. //邮箱
  376. customerInfoVo.setEmail(custVehiclePolicyInfo.getInsureEmail());
  377. //手机号
  378. customerInfoVo.setMobile(custVehiclePolicyInfo.getInsureMobile());
  379. //有效时间
  380. Date ownerIdentifyValidDateBegin = custVehiclePolicyInfo.getInsureIdentifyValidDate();
  381. String ownerIdentifyValidDateBeginStr="";
  382. if(ownerIdentifyValidDateBegin!=null){
  383. ownerIdentifyValidDateBeginStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateBegin);
  384. }
  385. customerInfoVo.setIdentifyValidDate(ownerIdentifyValidDateBeginStr);
  386. Date ownerIdentifyValidDateEnd = custVehiclePolicyInfo.getInsureIdentifyValidEndDate();
  387. String ownerIdentifyValidDateEndStr="";
  388. if(ownerIdentifyValidDateEnd!=null){
  389. ownerIdentifyValidDateEndStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateEnd);
  390. }
  391. //有效时间
  392. customerInfoVo.setIdentifyValidEndDate(ownerIdentifyValidDateEndStr);
  393. //同车主
  394. customerInfoVo.setOwner(custVehiclePolicyInfo.getInsureOwnerFlag() != null && custVehiclePolicyInfo.getInsureOwnerFlag());
  395. //同投保人
  396. customerInfoVo.setInsuranceHolder(custVehiclePolicyInfo.getInsureInsuranceHolderFlag() != null && custVehiclePolicyInfo.getInsureInsuranceHolderFlag());
  397. //车主相关信息 add hxl 2024-12-20
  398. customerInfoVo.setTel(custVehiclePolicyInfo.getInsureTel());
  399. customerInfoVo.setOrganizationCode(custVehiclePolicyInfo.getInsureOrganizationCode());
  400. customerInfoVo.setProvince(custVehiclePolicyInfo.getInsureProvince());
  401. customerInfoVo.setCity(custVehiclePolicyInfo.getInsureCity());
  402. customerInfoVo.setCounty(custVehiclePolicyInfo.getInsureCounty());
  403. customerInfoVo.setProperty(custVehiclePolicyInfo.getInsureProperty());
  404. customerInfoVo.setRegisteredCapital(custVehiclePolicyInfo.getInsureRegisteredCapital());
  405. customerInfoVo.setScope(custVehiclePolicyInfo.getInsureScope());
  406. customerInfoVo.setLegalPerson(custVehiclePolicyInfo.getInsureLegalPerson());
  407. }else if(type ==3){
  408. //姓名
  409. customerInfoVo.setName(custVehiclePolicyInfo.getApplyName());
  410. //身份证号
  411. customerInfoVo.setIdentifyNumber(custVehiclePolicyInfo.getApplyIdentifyNumber());
  412. //身份证类型
  413. customerInfoVo.setIdentifyType(custVehiclePolicyInfo.getApplyIdentifyType());
  414. //地址
  415. customerInfoVo.setAddr(custVehiclePolicyInfo.getApplyAddr());
  416. //年龄
  417. customerInfoVo.setAge(getAgeByIdCard(custVehiclePolicyInfo.getApplyIdentifyNumber()));
  418. //性别
  419. customerInfoVo.setGender(checkGender(custVehiclePolicyInfo.getApplyIdentifyNumber()));
  420. //邮箱
  421. customerInfoVo.setEmail(custVehiclePolicyInfo.getApplyEmail());
  422. //手机号
  423. customerInfoVo.setMobile(custVehiclePolicyInfo.getApplyMobile());
  424. //有效时间
  425. Date ownerIdentifyValidDateBegin = custVehiclePolicyInfo.getApplyIdentifyValidDate();
  426. String ownerIdentifyValidDateBeginStr="";
  427. if(ownerIdentifyValidDateBegin!=null){
  428. ownerIdentifyValidDateBeginStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateBegin);
  429. }
  430. customerInfoVo.setIdentifyValidDate(ownerIdentifyValidDateBeginStr);
  431. Date ownerIdentifyValidDateEnd = custVehiclePolicyInfo.getApplyIdentifyValidEndDate();
  432. String ownerIdentifyValidDateEndStr="";
  433. if(ownerIdentifyValidDateEnd!=null){
  434. ownerIdentifyValidDateEndStr = new SimpleDateFormat("yyyy-MM-dd").format(ownerIdentifyValidDateEnd);
  435. }
  436. //有效时间
  437. customerInfoVo.setIdentifyValidEndDate(ownerIdentifyValidDateEndStr);
  438. //同车主
  439. customerInfoVo.setOwner(custVehiclePolicyInfo.getApplyOwnerFlag() != null && custVehiclePolicyInfo.getApplyOwnerFlag());
  440. //同投保人
  441. customerInfoVo.setInsuranceHolder(custVehiclePolicyInfo.getApplyInsuranceHolderFlag() != null && custVehiclePolicyInfo.getApplyInsuranceHolderFlag());
  442. //车主相关信息 add hxl 2024-12-20
  443. customerInfoVo.setTel(custVehiclePolicyInfo.getOwnerTel());
  444. customerInfoVo.setOrganizationCode(custVehiclePolicyInfo.getOwnerOrganizationCode());
  445. customerInfoVo.setProvince(custVehiclePolicyInfo.getOwnerProvince());
  446. customerInfoVo.setCity(custVehiclePolicyInfo.getOwnerCity());
  447. customerInfoVo.setCounty(custVehiclePolicyInfo.getOwnerCounty());
  448. customerInfoVo.setProperty(custVehiclePolicyInfo.getOwnerProperty());
  449. customerInfoVo.setRegisteredCapital(custVehiclePolicyInfo.getOwnerRegisteredCapital());
  450. customerInfoVo.setScope(custVehiclePolicyInfo.getOwnerScope());
  451. //车主相关信息 add hxl 2024-12-20
  452. customerInfoVo.setTel(custVehiclePolicyInfo.getOwnerTel());
  453. customerInfoVo.setOrganizationCode(custVehiclePolicyInfo.getOwnerOrganizationCode());
  454. customerInfoVo.setProvince(custVehiclePolicyInfo.getOwnerProvince());
  455. customerInfoVo.setCity(custVehiclePolicyInfo.getOwnerCity());
  456. customerInfoVo.setCounty(custVehiclePolicyInfo.getOwnerCounty());
  457. customerInfoVo.setProperty(custVehiclePolicyInfo.getOwnerProperty());
  458. customerInfoVo.setRegisteredCapital(custVehiclePolicyInfo.getOwnerRegisteredCapital());
  459. customerInfoVo.setScope(custVehiclePolicyInfo.getOwnerScope());
  460. customerInfoVo.setLegalPerson(custVehiclePolicyInfo.getOwnerLegalPerson());
  461. }
  462. return customerInfoVo;
  463. }
  464. private static String farmmatSex(String sex) {
  465. if(StringUtils.isNotBlank(sex)) {
  466. if ("1".equals(sex)) {
  467. return "女";
  468. } else if ("2".equals(sex)) {
  469. return "男";
  470. }
  471. }
  472. return "";
  473. }
  474. public static String getAgeByIdCard(String idCard) {
  475. // 截取身份证中的出生日期部分
  476. String birthDateStr = idCard.substring(6, 14);
  477. try {
  478. SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
  479. Date birthDate = sdf.parse(birthDateStr);
  480. Calendar birthCal = Calendar.getInstance();
  481. birthCal.setTime(birthDate);
  482. Calendar currentCal = Calendar.getInstance();
  483. int birthYear = birthCal.get(Calendar.YEAR);
  484. int currentYear = currentCal.get(Calendar.YEAR);
  485. int age = currentYear - birthYear;
  486. // 考虑生日是否已经过了
  487. int birthMonth = birthCal.get(Calendar.MONTH);
  488. int currentMonth = currentCal.get(Calendar.MONTH);
  489. if (birthMonth > currentMonth) {
  490. age--;
  491. } else if (birthMonth == currentMonth) {
  492. int birthDay = birthCal.get(Calendar.DAY_OF_MONTH);
  493. int currentDay = currentCal.get(Calendar.DAY_OF_MONTH);
  494. if (birthDay > currentDay) {
  495. age--;
  496. }
  497. }
  498. return String.valueOf(age);
  499. } catch (Exception e) {
  500. e.printStackTrace();
  501. return "";
  502. }
  503. }
  504. /**
  505. * @version
  506. * @author: hxl
  507. * @Date: 2024/11/22 9:10
  508. * @Description: 通过身份证号判断男女
  509. */
  510. public static String checkGender(String idCardNumber) {
  511. if (idCardNumber.length() == 18) {
  512. char genderDigit = idCardNumber.charAt(16);
  513. int genderValue = Integer.parseInt(String.valueOf(genderDigit));
  514. if (genderValue % 2 == 0) {
  515. return "女";
  516. } else {
  517. return "男";
  518. }
  519. } else if (idCardNumber.length() == 15) {
  520. char genderDigit = idCardNumber.charAt(14);
  521. int genderValue = Integer.parseInt(String.valueOf(genderDigit));
  522. if (genderValue % 2 == 0) {
  523. return "女";
  524. } else {
  525. return "男";
  526. }
  527. } else {
  528. return "";
  529. }
  530. }
  531. }