|
@@ -15,6 +15,7 @@ import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.util.Objects;
|
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
@@ -73,6 +74,20 @@ public class ZijinDuplicateInsuranceComponents {
|
|
|
throw new SystemException(message);
|
|
throw new SystemException(message);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取终保日期
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param rtnMsg 返回信息
|
|
|
|
|
+ * @param regex 正则
|
|
|
|
|
+ * @return 终保日期
|
|
|
|
|
+ */
|
|
|
|
|
+ public String getEndDate(String rtnMsg, String regex) {
|
|
|
|
|
+ String endDate = getTheExpiryDate(rtnMsg, regex);
|
|
|
|
|
+ if (!endDate.isEmpty()) {
|
|
|
|
|
+ return endDate;
|
|
|
|
|
+ }
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 重复投保处理
|
|
* 重复投保处理
|
|
@@ -88,42 +103,32 @@ public class ZijinDuplicateInsuranceComponents {
|
|
|
String rtnMsg = calculatePremiumResponse.getRtnMsg();
|
|
String rtnMsg = calculatePremiumResponse.getRtnMsg();
|
|
|
CalculatePremiumRequest.BaseInfoDTO baseInfo = calculatePremiumRequest.getBaseInfo();
|
|
CalculatePremiumRequest.BaseInfoDTO baseInfo = calculatePremiumRequest.getBaseInfo();
|
|
|
|
|
|
|
|
- boolean jq = true;
|
|
|
|
|
- boolean sy = true;
|
|
|
|
|
|
|
+ String jqEndDate = "";
|
|
|
|
|
+ String syEndDate = "";
|
|
|
|
|
|
|
|
// 关联单标识
|
|
// 关联单标识
|
|
|
String calculateFlag = calculatePremiumRequest.getBaseInfo().getCalculateFlag();
|
|
String calculateFlag = calculatePremiumRequest.getBaseInfo().getCalculateFlag();
|
|
|
|
|
|
|
|
// 单交强
|
|
// 单交强
|
|
|
if (CalculateFlagEnum.CF_2.getCode().equals(calculateFlag)) {
|
|
if (CalculateFlagEnum.CF_2.getCode().equals(calculateFlag)) {
|
|
|
- String jqEndDate = getTheExpiryDate(rtnMsg, DAN_JQ_REGEX);
|
|
|
|
|
- if (!jqEndDate.isEmpty()) {
|
|
|
|
|
- baseInfo.setTrafficTime(jqEndDate);
|
|
|
|
|
- jq = false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ jqEndDate = getEndDate(rtnMsg, DAN_JQ_REGEX);
|
|
|
}
|
|
}
|
|
|
// 交强险
|
|
// 交强险
|
|
|
else if (rtnMsg.contains(JQ)) {
|
|
else if (rtnMsg.contains(JQ)) {
|
|
|
- String jqEndDate = getTheExpiryDate(rtnMsg, JQ_REGEX);
|
|
|
|
|
- if (!jqEndDate.isEmpty()) {
|
|
|
|
|
- baseInfo.setTrafficTime(jqEndDate);
|
|
|
|
|
- jq = false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ jqEndDate = getEndDate(rtnMsg, JQ_REGEX);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 商业险
|
|
// 商业险
|
|
|
if (rtnMsg.contains(SY)) {
|
|
if (rtnMsg.contains(SY)) {
|
|
|
- String syEndDate = getTheExpiryDate(rtnMsg, SY_REGEX);
|
|
|
|
|
- if (!syEndDate.isEmpty()) {
|
|
|
|
|
- baseInfo.setBusinessTime(syEndDate);
|
|
|
|
|
- sy = false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ syEndDate = getEndDate(rtnMsg, SY_REGEX);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (jq && sy) {
|
|
|
|
|
|
|
+ if (jqEndDate.isEmpty() && syEndDate.isEmpty()) {
|
|
|
throw new SystemException(rtnMsg);
|
|
throw new SystemException(rtnMsg);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ baseInfo.setTrafficTime(jqEndDate);
|
|
|
|
|
+ baseInfo.setBusinessTime(jqEndDate);
|
|
|
return zijinRequestApiComponents.calculatePremium(calculatePremiumRequest, httpHeaders, modelQueryRequest);
|
|
return zijinRequestApiComponents.calculatePremium(calculatePremiumRequest, httpHeaders, modelQueryRequest);
|
|
|
}
|
|
}
|
|
|
return calculatePremiumResponse;
|
|
return calculatePremiumResponse;
|