Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

liub 2 месяцев назад
Родитель
Сommit
ef9ceb155d

+ 17 - 3
tenant/insurance/quotation-huanong/src/main/java/com/jzg/quotation/huanong/crawler/entity/request/HuaNongCrawlerQuotedPriceRequestRequest.java

@@ -3227,8 +3227,8 @@ public class HuaNongCrawlerQuotedPriceRequestRequest implements HuaNongHeadReque
                 this.nativePlace = customerInfoVo.getAddr();
                 this.riskLevel = "0";
                 this.secrecyUnitFlag = false;
-                this.sex = customerInfoVo.getGender();
-                this.fxqSex = customerInfoVo.getGender();
+                this.sex = getSex(customerInfoVo.getIdentifyNumber());
+                this.fxqSex = getSex(customerInfoVo.getIdentifyNumber());
                /* this.sex = "2";
                 this.fxqSex = "2";*/
                 this.tandBRelationship = tandBRelationship;
@@ -3256,7 +3256,21 @@ public class HuaNongCrawlerQuotedPriceRequestRequest implements HuaNongHeadReque
                         new CustomerDTO(policyHolderInfo, "1", tandBRelationship, agentCode, comCode)
                 );
             }
-
+            /**
+             * 根据18位身份证获取性别
+             * @param idCard 身份证号
+             * @return 1-男  2-女
+             */
+            public static String getSex(String idCard) {
+                // 简单校验长度
+                if (idCard == null || idCard.length() != 18) {
+                    throw new IllegalArgumentException("身份证必须为18位");
+                }
+                // 取第17位字符,下标16
+                char sexChar = idCard.charAt(16);
+                int num = Character.getNumericValue(sexChar);
+                return num % 2 == 0 ? "2" : "1";
+            }
 
             @NoArgsConstructor
             @Data