Ver Fonte

永诚 过户车 即时起保 重复投保处理

785834757 há 1 ano atrás
pai
commit
2f84665fe4

+ 19 - 1
src/main/java/com/ydtech/modules/order/service/impl/YongchengOrderApiServiceImpl.java

@@ -120,6 +120,8 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
 
     public static final String JQ_REGEX = "交强险.+?(?:保险止期|终保日期)[是::\\s]*?([0-9\\-:]+)";
 
+    public static final String JQ_GUOHU_AND_JISHI_REGEX = "重复投保提示:.*?投保确认码\\s*[\\w\\d]+.*?起保日期\\s*[0-9\\-: ]+;.*?终保日期\\s*([0-9\\-: ]+);";
+
     public static final String REGEX_ALONE = "(?:保险止期|终保日期)[是::\\s]*?([0-9\\-:]+)";
 
     public static final String SY_REGEX = "(?:商业险|商业保险).+?(?:保险止期|终保日期)[是::\\s]*?([0-9\\-:]+)";
@@ -470,7 +472,23 @@ public class YongchengOrderApiServiceImpl implements YongchengOrderApiService {
             TimeEntity timeEntity = getRepeatStartEndTime(errorMsg, JQ_REGEX, JQ_RULE);
 
             if (StringUtils.isEmpty(timeEntity.getCoverageEndDate())) {
-                return "";
+                //重试第二种过户 及时起保的错误
+                TimeEntity repeatStartEndTime = getRepeatStartEndTime(errorMsg, JQ_GUOHU_AND_JISHI_REGEX, "");
+                if(StringUtils.isEmpty(repeatStartEndTime.getCoverageEndDate())) {
+                    return "";
+                }else{
+                    //如果是及时起保的则 终保日期 + 1天
+                    // 定义时间格式
+                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+                    // 解析原始时间
+                    LocalDateTime dateTime = LocalDateTime.parse(repeatStartEndTime.getCoverageEndDate(), formatter);
+                    LocalDateTime tomorrowMidnight = dateTime.toLocalDate().plusDays(1).atStartOfDay();
+                    timeEntity.setCoverageEndDate(tomorrowMidnight.format(formatter));
+                    LocalDateTime end = tomorrowMidnight.plusYears(1L);
+                    timeEntity.setNewStartDate(DateTimeUtil.format(tomorrowMidnight, DateTimeUtil.DATETIME_PATTERN));
+                    LocalDateTime localDateTime = end.minusSeconds(1L);
+                    timeEntity.setNewEndDate(DateTimeUtil.format(localDateTime, DateTimeUtil.DATETIME_PATTERN));
+                }
             }
 
             log.error("新起:{}", timeEntity.getNewStartDate());