Parcourir la source

紫金重复投保日期问题

wks il y a 3 ans
Parent
commit
be4bd724b0

+ 6 - 6
src/main/java/com/ydtech/modules/order/components/InsOrdersComponents.java

@@ -8,6 +8,7 @@ import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocol.service.PtlAgreementUnderwritingRulesService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.util.ObjectUtils;
@@ -20,19 +21,18 @@ public class InsOrdersComponents {
 
     private final StringRedisTemplate redisTemplate;
 
-    private InsOrdersComponents proxyService;
+    private final InsOrdersComponents proxyService;
 
     private final PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService;
 
-    @Autowired
-    public void setProxyService(InsOrdersComponents proxyService) {
-        this.proxyService = proxyService;
-    }
 
-    public InsOrdersComponents(InsOrdersService insOrdersService, StringRedisTemplate redisTemplate, PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService) {
+    public InsOrdersComponents(InsOrdersService insOrdersService, StringRedisTemplate redisTemplate,
+                               PtlAgreementUnderwritingRulesService ptlAgreementUnderwritingRulesService,
+                               @Lazy InsOrdersComponents proxyService) {
         this.insOrdersService = insOrdersService;
         this.redisTemplate = redisTemplate;
         this.ptlAgreementUnderwritingRulesService = ptlAgreementUnderwritingRulesService;
+        this.proxyService = proxyService;
     }
 
     /**

+ 7 - 3
src/main/java/com/ydtech/modules/order/components/zj/ZijinVehicleTypeErrorComponents.java

@@ -6,18 +6,17 @@ import com.ydtech.exception.SystemException;
 import com.ydtech.modules.order.entity.api.zj.constants.enums.ResultEnum;
 import com.ydtech.modules.order.entity.api.zj.request.CalculatePremiumRequest;
 import com.ydtech.modules.order.entity.api.zj.request.ModelQueryRequest;
-import com.ydtech.modules.order.entity.api.zj.response.BaseResponse;
 import com.ydtech.modules.order.entity.api.zj.response.CalculatePremiumResponse;
 import com.ydtech.modules.order.entity.api.zj.response.ModelQueryResponse;
 import com.ydtech.modules.order.utils.InsuranceLog;
-import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Component;
 
-import java.util.List;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -99,5 +98,10 @@ public class ZijinVehicleTypeErrorComponents {
         }
     }
 
+    public static void main(String[] args) {
+
+
+    }
+
 
 }

+ 29 - 15
src/main/java/com/ydtech/modules/order/entity/api/zj/response/CalculatePremiumResponse.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.order.entity.api.zj.response;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.ydtech.modules.ins.model.vo.AccidentResponseVo;
+import com.ydtech.modules.order.entity.api.zm.constants.TimeConstants;
 import com.ydtech.modules.order.entity.vo.zj.ZjQuoteAccidentVo;
 import com.ydtech.utils.StringUtils;
 import lombok.Data;
@@ -10,6 +11,8 @@ import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -271,32 +274,43 @@ public class CalculatePremiumResponse extends BaseResponse implements Serializab
 
         public static final String DATE_FORMAT = "%s %s:%s:%s";
 
-        public String getJqStartTime() {
-            if (StringUtils.isEmpty(this.getStartDateCI())) {
-                return null;
+        public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        /**
+         * 获取上一秒时间
+         *
+         * @return 上一秒时间
+         */
+        private String getInTheLastSecond(String dateTime) {
+            if (dateTime.contains(TimeConstants.START_TIME)) {
+                return dateTime;
             }
-            return String.format(DATE_FORMAT, this.getStartDateCI(), this.getStartHourCI(), this.getStartMinuteCI(), "00");
+            LocalDateTime parse = LocalDateTime.parse(dateTime, DATE_TIME_FORMATTER);
+            LocalDateTime localDateTime = parse.plusSeconds(-1);
+            return localDateTime.format(DATE_TIME_FORMATTER);
         }
 
-        public String getJqEndTime() {
-            if (StringUtils.isEmpty(this.getEndDateCI())) {
+        private String nullData(String date, String dateTime) {
+            if (StringUtils.isEmpty(date)) {
                 return null;
             }
-            return String.format(DATE_FORMAT, this.getEndDateCI(), this.getEndHourCI(), this.getEndMinuteCI(), "00");
+            return dateTime;
+        }
+
+        public String getJqStartTime() {
+            return nullData(this.getStartDateCI(), String.format(DATE_FORMAT, this.getStartDateCI(), this.getStartHourCI(), this.getStartMinuteCI(), "00"));
+        }
+
+        public String getJqEndTime() {
+            return nullData(this.getEndDateCI(), getInTheLastSecond(String.format(DATE_FORMAT, this.getEndDateCI(), this.getEndHourCI(), this.getEndMinuteCI(), "00")));
         }
 
         public String getSyStartTime() {
-            if (StringUtils.isEmpty(this.getStartDate())) {
-                return null;
-            }
-            return String.format(DATE_FORMAT, this.getStartDate(), this.getStartHour(), this.getStartMinute(), "00");
+            return nullData(this.getStartDate(), String.format(DATE_FORMAT, this.getStartDate(), this.getStartHour(), this.getStartMinute(), "00"));
         }
 
         public String getSyEndTime() {
-            if (StringUtils.isEmpty(this.getEndDate())) {
-                return null;
-            }
-            return String.format(DATE_FORMAT, this.getEndDate(), this.getEndHour(), this.getEndMinute(), "00");
+            return nullData(this.getEndDate(), getInTheLastSecond(String.format(DATE_FORMAT, this.getEndDate(), this.getEndHour(), this.getEndMinute(), "00")));
         }
 
     }