Parcourir la source

修改华泰问题

wks il y a 2 ans
Parent
commit
f8becb2577

+ 4 - 0
src/main/java/com/ydtech/modules/order/components/huatai/HuaTaiRepeatInsuranceComponents.java

@@ -9,6 +9,7 @@ import com.ydtech.modules.order.entity.api.huatai.request.HuaTaiQuotedPriceReque
 import com.ydtech.modules.order.entity.api.huatai.response.HuaTaiQuotedPriceResponse;
 import com.ydtech.modules.order.entity.api.zhongmei.constants.TimeConstants;
 import com.ydtech.modules.order.utils.InsuranceLog;
+import com.ydtech.utils.StringOperations;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -75,6 +76,8 @@ public class HuaTaiRepeatInsuranceComponents {
         if (StringUtils.isNotEmpty(returnMessage) && returnMessage.contains("重复投保")) {
             String jqEndDate = GuorenDuplicateInsuranceComponent.getEndDate(returnMessage,
                     GuorenDuplicateInsuranceComponent.THE_FIRST_REGEX);
+            StringOperations.nullException(jqEndDate, returnMessage);
+
             warnMessageList.add(returnMessage);
             getPeriodDate(jqEndDate, contractMain);
             return true;
@@ -123,6 +126,7 @@ public class HuaTaiRepeatInsuranceComponents {
             String syEndDate = GuorenDuplicateInsuranceComponent.getEndDate(reInsureMsg,
                     GuorenDuplicateInsuranceComponent.THE_FIRST_REGEX);
             warnMessageList.add(reInsureMsg);
+            StringOperations.nullException(syEndDate, reInsureMsg);
             getPeriodDate(syEndDate, contractMain);
             return true;
         }

+ 25 - 0
src/main/java/com/ydtech/utils/StringOperations.java

@@ -1,13 +1,38 @@
 package com.ydtech.utils;
 
+import com.ydtech.exception.SystemException;
+
+/**
+ * @version
+ * @description: 业务中字符串处理
+ * @author: wenks
+ * @date: 2024/6/6 10:15
+ **/
+
 public class StringOperations {
 
     private StringOperations() {
         throw new IllegalStateException("Utility class");
     }
 
+    /**
+     * 将空字符串和null 都处理为null
+     * @param s 字符
+     * @return
+     */
     public static String emptyStringToNull(String s){
         return StringUtils.isEmpty(s) ? null : s;
     }
 
+    /**
+     * 字符串为空报错
+     * @param s 字符
+     * @return
+     */
+    public static void nullException(String s, String message){
+        if (StringUtils.isEmpty(s)) {
+            throw new SystemException(message);
+        }
+    }
+
 }