Bläddra i källkod

python 驾意险保单

wks 2 år sedan
förälder
incheckning
76656c45f5

+ 24 - 5
src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerPolicyPrintResponse.java

@@ -5,6 +5,9 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 
+import java.io.Serializable;
+import java.util.List;
+
 @EqualsAndHashCode(callSuper = true)
 @NoArgsConstructor
 @Data
@@ -30,10 +33,26 @@ public class CrawlerPolicyPrintResponse extends CrawlerBaseResponse {
     @JsonProperty("jqx_flag_url")
     private String jqxFlagUrl;
 
-    /**
-     * 驾意险保单地址
-     */
-    @JsonProperty("jyx_policy_url")
-    private String jyxPolicyUrl;
+    @JsonProperty("JQ_Application")
+    private String jqApplication;
+
+    @JsonProperty("SY_Application")
+    private String syApplication;
+
+    @JsonProperty("jyx_info_list")
+    private List<JyxInfoListDTO> jyxInfoList;
+
+    @NoArgsConstructor
+    @Data
+    public static class JyxInfoListDTO implements Serializable {
+
+        private static final long serialVersionUID = 4906476830758352334L;
+
+        @JsonProperty("application")
+        private String application;
+
+        @JsonProperty("jyx_policy_url")
+        private String jyxPolicyUrl;
 
+    }
 }

+ 9 - 9
src/main/java/com/ydtech/modules/order/entity/crawler/vo/CrawlerPolicyPrintVo.java

@@ -1,8 +1,10 @@
 package com.ydtech.modules.order.entity.crawler.vo;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.order.entity.crawler.response.CrawlerPolicyPrintResponse;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.springframework.util.ObjectUtils;
@@ -28,19 +30,11 @@ public class CrawlerPolicyPrintVo implements Serializable {
     private String jqxFlagUrl;
 
     @ApiModelProperty("驾意险列表")
-    @JsonProperty("jyx_info_list")
     private List<JyxInfoListDTO> jyxInfoList;
 
-
-    public List<JyxInfoListDTO> getJyxInfoList() {
-        if(ObjectUtils.isEmpty(jyxInfoList)){
-            return Collections.emptyList();
-        }
-        return jyxInfoList;
-    }
-
     @Data
     @NoArgsConstructor
+    @AllArgsConstructor
     public static class JyxInfoListDTO implements Serializable {
 
         private static final long serialVersionUID = -3291704768771057208L;
@@ -52,6 +46,12 @@ public class CrawlerPolicyPrintVo implements Serializable {
         @ApiModelProperty("驾意险保单地址")
         @JsonProperty("application")
         private String application;
+
+        public JyxInfoListDTO(CrawlerPolicyPrintResponse.JyxInfoListDTO jyxInfoListDTO) {
+            this.jyxPolicyUrl = jyxInfoListDTO.getJyxPolicyUrl();
+            this.application = jyxInfoListDTO.getApplication();
+        }
+
     }
 
 

+ 8 - 9
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -40,6 +40,7 @@ import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 
 @Service
@@ -189,19 +190,17 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         String apiUrl = ptlCrawlerApiService.getApiUrl(insAreaCompany.getAgreementId(), PtlCrawlerApiType.API_6);
         //组装参数
         CrawlerBaseRequest crawlerBaseRequest = new CrawlerBaseRequest(insAreaCompany.getInsOrderNo());
-        CrawlerPolicyPrintResponse request = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(), PtlCrawlerApiType.API_6.getDesc(), crawlerBaseRequest, CrawlerPolicyPrintResponse.class);
+        CrawlerPolicyPrintResponse response = insCrawlerOrderComponents.request(apiUrl, insAreaCompany.getCompanyId(), PtlCrawlerApiType.API_6.getDesc(), crawlerBaseRequest, CrawlerPolicyPrintResponse.class);
 
-        if (request.getCode() != 200) {
-            throw new SystemException(request.getMessage());
+        if (response.getCode() != 200) {
+            throw new SystemException(response.getMessage());
         }
 
         CrawlerPolicyPrintVo crawlerPolicyPrintVo = new CrawlerPolicyPrintVo();
-        crawlerPolicyPrintVo.setJqxFlagUrl(gainCarInsPolicy(request.getJqxFlagUrl(), licensePlate + "-交强险标志.pdf", licensePlate));
-        crawlerPolicyPrintVo.setJqxPolicyUrl(gainCarInsPolicy(request.getJqxPolicyUrl(), licensePlate + "-交强险保单.pdf", licensePlate));
-        crawlerPolicyPrintVo.setSyxPolicyUrl(gainCarInsPolicy(request.getSyxPolicyUrl(), licensePlate + "-商业险保单.pdf", licensePlate));
-        crawlerPolicyPrintVo.getJyxInfoList().forEach(
-                x -> x.setJyxPolicyUrl(gainCarInsPolicy(request.getJyxPolicyUrl(), licensePlate + "-" + x.getApplication() + "-非车险保单.pdf", licensePlate))
-        );
+        crawlerPolicyPrintVo.setJqxFlagUrl(gainCarInsPolicy(response.getJqxFlagUrl(), licensePlate + "-交强险标志.pdf", licensePlate));
+        crawlerPolicyPrintVo.setJqxPolicyUrl(gainCarInsPolicy(response.getJqxPolicyUrl(), licensePlate + "-交强险保单.pdf", licensePlate));
+        crawlerPolicyPrintVo.setSyxPolicyUrl(gainCarInsPolicy(response.getSyxPolicyUrl(), licensePlate + "-商业险保单.pdf", licensePlate));
+        crawlerPolicyPrintVo.setJyxInfoList(response.getJyxInfoList().stream().map(CrawlerPolicyPrintVo.JyxInfoListDTO::new).collect(Collectors.toList()));
         return HttpResult.ok(crawlerPolicyPrintVo);
     }