|
|
@@ -3,6 +3,7 @@ package com.yc.ship.module.trade.service.insurance;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
+import cn.hutool.extra.pinyin.PinyinUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
@@ -172,7 +173,25 @@ public class InsuranceServiceImpl implements InsuranceService {
|
|
|
tradeVisitorRespVOS.forEach(tradeVisitorRespVO -> {
|
|
|
InsuredDTO insuredDTO = new InsuredDTO();
|
|
|
insuredDTO.setExternalPolicyNumber(tradeVisitorRespVO.getId().toString());
|
|
|
- insuredDTO.setInsuredName(tradeVisitorRespVO.getName());
|
|
|
+ String name = tradeVisitorRespVO.getName();
|
|
|
+ insuredDTO.setInsuredName(name);
|
|
|
+ if(9 == tradeVisitorRespVO.getCredentialType()) {
|
|
|
+ if(PinyinUtil.isChinese(name.charAt(0))) {
|
|
|
+ String pinyin = PinyinUtil.getPinyin(name, " ");
|
|
|
+ insuredDTO.setInsuredName(pinyin);
|
|
|
+ insuredDTO.setFirstName(pinyin.substring(0, pinyin.indexOf(" ")));
|
|
|
+ insuredDTO.setLastName(pinyin.substring(pinyin.indexOf(" ") + 1));
|
|
|
+ }else {
|
|
|
+ insuredDTO.setInsuredName(name);
|
|
|
+ if(name.contains("/")) {
|
|
|
+ insuredDTO.setFirstName(name.substring(0, name.indexOf("/")));
|
|
|
+ insuredDTO.setLastName(name.substring(name.indexOf("/") + 1));
|
|
|
+ }else {
|
|
|
+ insuredDTO.setFirstName(name.substring(0, name.indexOf(" ")));
|
|
|
+ insuredDTO.setLastName(name.substring(name.indexOf(" ") + 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
insuredDTO.setCertificateType(transCredentialType(tradeVisitorRespVO.getCredentialType()));
|
|
|
insuredDTO.setCertificateNo(tradeVisitorRespVO.getCredentialNo());
|
|
|
insuredDTO.setBirthday(tradeVisitorRespVO.getBirthday());
|
|
|
@@ -182,13 +201,13 @@ public class InsuranceServiceImpl implements InsuranceService {
|
|
|
});
|
|
|
insuranceApplyReqDTO.setInsureds(insuredList);
|
|
|
|
|
|
- //验证投保信息
|
|
|
- CommonResult commonResult = insuranceUtil.validateInsuranceRequest(insuranceApplyReqDTO);
|
|
|
- if (!commonResult.isSuccess()) {
|
|
|
- throw exception0(commonResult.getCode(), commonResult.getMsg());
|
|
|
- }
|
|
|
+// //验证投保信息
|
|
|
+// CommonResult commonResult = insuranceUtil.validateInsuranceRequest(insuranceApplyReqDTO);
|
|
|
+// if (!commonResult.isSuccess()) {
|
|
|
+// throw exception0(commonResult.getCode(), commonResult.getMsg());
|
|
|
+// }
|
|
|
// 开始投保
|
|
|
- commonResult = insuranceUtil.sendInsuranceApply(insuranceApplyReqDTO);
|
|
|
+ CommonResult commonResult = insuranceUtil.sendInsuranceApply(insuranceApplyReqDTO);
|
|
|
if (!commonResult.isSuccess()) {
|
|
|
throw exception0(commonResult.getCode(), commonResult.getMsg());
|
|
|
}
|
|
|
@@ -217,32 +236,37 @@ public class InsuranceServiceImpl implements InsuranceService {
|
|
|
* @return
|
|
|
*/
|
|
|
private Integer transCredentialType(Integer credentialType) {
|
|
|
+// 证件类型 系统 保险
|
|
|
+// 身份证 0 1
|
|
|
+// 外国人永居证 2 16
|
|
|
+// 回乡证 7 5
|
|
|
+// 台胞证 8 26
|
|
|
+// 外籍护照 9 8
|
|
|
+// 户口本 10 18
|
|
|
// 保险类型 1身份证 17 港澳台居民居住证(18位8开头的身份证号码,例如830000198308030005) 8 外国护照 5 港澳居民来往内地通行证(H开头) 26 台湾居民来往内地通行证*8位数字
|
|
|
Integer transCredentialType = 6; //默认为其他
|
|
|
switch (credentialType) {
|
|
|
case 0: //身份证
|
|
|
- transCredentialType = 1; // 保险身份证
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- transCredentialType = 3;
|
|
|
+ transCredentialType = 1;
|
|
|
break;
|
|
|
case 2:
|
|
|
- case 3:
|
|
|
- case 4: // 港澳通行证
|
|
|
- transCredentialType = 5;//港澳居民来往内地通行证(H开头)
|
|
|
+ transCredentialType = 16;
|
|
|
break;
|
|
|
- case 6:
|
|
|
case 7:
|
|
|
+ transCredentialType = 5;
|
|
|
+ break;
|
|
|
case 8: // 外籍护照
|
|
|
- transCredentialType = 8; // 保险外国护照
|
|
|
+ transCredentialType = 26; // 保险外国护照
|
|
|
break;
|
|
|
case 9:
|
|
|
- case 99:
|
|
|
- transCredentialType = 6;
|
|
|
+ transCredentialType = 8;
|
|
|
break;
|
|
|
- case 5: //台湾通行证
|
|
|
- transCredentialType = 26; //保险台湾居民来往内地通行证*8位数字
|
|
|
+ case 10:
|
|
|
+ transCredentialType = 18; // 保险身份证
|
|
|
break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+
|
|
|
}
|
|
|
return transCredentialType;
|
|
|
}
|