helixiao hace 1 año
padre
commit
7abd5752f0

+ 8 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/component/ZhongAnCrawlerCacheComponent.java

@@ -2,6 +2,7 @@ package com.jzg.quotation.zhongan.crawler.component;
 
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
+import com.jzg.quotation.zhongan.crawler.entity.response.ZhongAnCrawlerPaymentResponse;
 import com.jzg.quotation.zhongan.crawler.entity.response.ZhongAnCrawlerUploadInitDateResponse;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -42,6 +43,8 @@ public class ZhongAnCrawlerCacheComponent {
 
     public static final String QUOTE_ID = "quoteId:";
 
+    public static final String PAYMENT = "payment:";
+
 
     public void cacheCookie(String zaLoginCookieKey, String flowId, String userName) {
         Map<String, String> authorizationMap = new HashMap<>();
@@ -89,5 +92,10 @@ public class ZhongAnCrawlerCacheComponent {
         return JSON.parseObject(bucket1.get(), ZhongAnCrawlerUploadInitDateResponse.ValueDTO.DatasDTO.class);
     }
 
+    public ZhongAnCrawlerPaymentResponse.ValueDTO.DatasDTO.InitInfoDTO getPayment(String ordersNo) {
+        RBucket<String> bucket1 = redissonClient.getBucket(ordersNo);
+        return JSON.parseObject(bucket1.get(), ZhongAnCrawlerPaymentResponse.ValueDTO.DatasDTO.InitInfoDTO.class);
+    }
+
 
 }

+ 6 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/component/ZhongAnCrawlerRequestComponent.java

@@ -15,6 +15,7 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.ByteArrayResource;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Component;
@@ -231,4 +232,9 @@ public class ZhongAnCrawlerRequestComponent {
     public String markCompleted(ZhongAnCrawlerMarkRequest markRequest, HttpHeaders headers) {
         return requestComponent.formDataString(RequestUrl.LICENCE_SEITCH.getRequestUrl(zhongAnCrawlerProperties.getBaseUrl()), markRequest, headers);
     }
+
+    public String policyList(ZhongAnCrawlerPolicyListRequest policyListRequest, HttpHeaders headers) {
+
+        return requestComponent.formDataString(RequestUrl.ORDER_LIST.getRequestUrl(zhongAnCrawlerProperties.getBaseUrl()), policyListRequest, headers);
+    }
 }

+ 2 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/constant/ZhongAnRequestConstant.java

@@ -37,6 +37,8 @@ public class ZhongAnRequestConstant {
      */
     public static final String UPLOAD_IMAGE_PAGE = "%2FuploadInfo";
 
+    public static final String POLICY_LIST = "%2Forder%2FmyOrders";
+
     /**
      * 保单下载地址
      */

+ 2 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/constant/enums/RequestUrl.java

@@ -49,6 +49,8 @@ public enum RequestUrl implements CrawlerRequestUrlStandard {
 
     PAYMENT_LINK("/open/newProcess/new_process_controller/qr_page_init_info.json", "获取支付链接"),
 
+    ORDER_LIST("/open/bmw/query_controller/query_policy_list.json", "订单列表"),
+
     DOWNLOAD_POLICY("/open/bmw/n/query_controller/queryDocumentInfo.json", "获取保单下载路径");
 
 

+ 56 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/request/ZhongAnCrawlerPolicyListRequest.java

@@ -0,0 +1,56 @@
+package com.jzg.quotation.zhongan.crawler.entity.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.commons.entity.quote.vo.image.InsuranceImageVo;
+import com.jzg.quotation.zhongan.crawler.constant.ZhongAnRequestConstant;
+import com.jzg.quotation.zhongan.crawler.entity.ZhongAnCrawlerConfigureParameters;
+import lombok.Data;
+import org.springframework.core.io.ByteArrayResource;
+
+import java.io.Serial;
+
+@Data
+public class ZhongAnCrawlerPolicyListRequest {
+
+    @Serial
+    private static final long serialVersionUID = -1L;
+
+
+    @JsonProperty("queryConditon")
+    private String queryConditon;
+
+    @JsonProperty("page")
+    private String page;
+    @JsonProperty("flag")
+    private String flag;
+    @JsonProperty("flowId")
+    private String flowId;
+
+    @JsonProperty("i")
+    private String i;
+
+    @JsonProperty("status")
+    private String status;
+
+    @JsonProperty("pageIndex")
+    private String pageIndex;
+
+    @JsonProperty("queryType")
+    private String queryType;
+
+
+
+    public ZhongAnCrawlerPolicyListRequest(String license,ZhongAnCrawlerConfigureParameters parameters) {
+
+        this.setFlowId(parameters.getFlowId());
+        this.setPage(ZhongAnRequestConstant.POLICY_LIST);
+        this.setFlag(parameters.getFlag());
+        this.setI(ZhongAnRequestConstant.I_PARAM);
+        this.setQueryConditon(license);
+        this.setStatus("1");
+        this.setPageIndex("1");
+        this.setQueryType("1");
+    }
+
+
+}

+ 10 - 3
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/request/ZhongAnCrawlerUploadImageRequest.java

@@ -1,9 +1,11 @@
 package com.jzg.quotation.zhongan.crawler.entity.request;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.commons.entity.quote.vo.image.InsuranceImageVo;
 import com.jzg.quotation.zhongan.crawler.constant.ZhongAnRequestConstant;
 import com.jzg.quotation.zhongan.crawler.entity.ZhongAnCrawlerConfigureParameters;
 import lombok.Data;
+import org.springframework.core.io.ByteArrayResource;
 
 import java.io.File;
 import java.io.Serial;
@@ -19,9 +21,14 @@ public class ZhongAnCrawlerUploadImageRequest implements Serializable {
     @Serial
     private static final long serialVersionUID = 6616361166719063753L;
 
-    public ZhongAnCrawlerUploadImageRequest(String imageType, byte[] fileItem, String orderNo, String policyId, ZhongAnCrawlerConfigureParameters parameters) {
+    public ZhongAnCrawlerUploadImageRequest(String imageType, InsuranceImageVo.ImageDTO imageDTO, String orderNo, String policyId, ZhongAnCrawlerConfigureParameters parameters) {
         this.imageType = imageType;
-        this.fileItem = fileItem;
+        this.fileItem = new ByteArrayResource(imageDTO.getImageByte()) {
+            @Override
+            public String getFilename() {
+                return imageDTO.getImageName(); // 必须重写此方法
+            }
+        };;
         this.orderNo = orderNo;
         this.policyId = policyId;
         this.page = ZhongAnRequestConstant.UPLOAD_IMAGE_PAGE;
@@ -41,7 +48,7 @@ public class ZhongAnCrawlerUploadImageRequest implements Serializable {
     private String imageType;
 
     @JsonProperty("fileItem")
-    private byte[] fileItem;
+    private ByteArrayResource fileItem;
     @JsonProperty("orderNo")
     private String orderNo;
     @JsonProperty("policyId")

+ 61 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/response/ZhongAnCrawlerPaymentResponse.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.io.Serial;
+import java.util.List;
 
 /**
  * @description: 众安保险 获取支付链接 返回参数
@@ -51,6 +52,66 @@ public class ZhongAnCrawlerPaymentResponse extends ZhongAnCrawlerBaseResponse{
             @NoArgsConstructor
             @Data
             public static class InitInfoDTO {
+
+                @JsonProperty("agentUserCode")
+                private String agentUserCode;
+                @JsonProperty("applicantName")
+                private String applicantName;
+                @JsonProperty("applicantPersonnelType")
+                private String applicantPersonnelType;
+                @JsonProperty("applySignStageFlag")
+                private String applySignStageFlag;
+                @JsonProperty("bizPremium")
+                private String bizPremium;
+                @JsonProperty("businessDiscount")
+                private String businessDiscount;
+                @JsonProperty("compelDiscount")
+                private String compelDiscount;
+                @JsonProperty("compelPremium")
+                private String compelPremium;
+                @JsonProperty("electricApplyPolicyFlag")
+                private String electricApplyPolicyFlag;
+                @JsonProperty("enterprisePayFlag")
+                private String enterprisePayFlag;
+                @JsonProperty("insurePlaceCode")
+                private String insurePlaceCode;
+                @JsonProperty("insurePlaceName")
+                private String insurePlaceName;
+                @JsonProperty("isEnableQrCode")
+                private String isEnableQrCode;
+                @JsonProperty("isNeedRealName")
+                private String isNeedRealName;
+                @JsonProperty("jyxPolicyList")
+                private List<JyxPolicyListDTO> jyxPolicyList;
+                @JsonProperty("miniProgramPaySwitch")
+                private String miniProgramPaySwitch;
+                @JsonProperty("modelEnergyType")
+                private String modelEnergyType;
+                @JsonProperty("orderNo")
+                private String orderNo;
+                @JsonProperty("ownerName")
+                private String ownerName;
+                @JsonProperty("ownerPhoneNo")
+                private String ownerPhoneNo;
+                @JsonProperty("payExpireDate")
+                private String payExpireDate;
+                @JsonProperty("personnelType")
+                private String personnelType;
+                @JsonProperty("premuim")
+                private String premuim;
+                @JsonProperty("productType")
+                private String productType;
+                @JsonProperty("quoteId")
+                private String quoteId;
+                @JsonProperty("showVAT")
+                private String showVAT;
+                @JsonProperty("splitPayFlag")
+                private String splitPayFlag;
+                @JsonProperty("taxPremium")
+                private String taxPremium;
+                @JsonProperty("vehicleName")
+                private String vehicleName;
+
                 @NoArgsConstructor
                 @Data
                 public static class JyxPolicyListDTO {

+ 45 - 0
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/entity/response/ZhongAnCrawlerPolicyListResponse.java

@@ -0,0 +1,45 @@
+package com.jzg.quotation.zhongan.crawler.entity.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serial;
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class ZhongAnCrawlerPolicyListResponse extends ZhongAnCrawlerBaseResponse{
+
+    @Serial
+    private static final long serialVersionUID = -1L;
+
+    @JsonProperty("ruleMsgTips")
+    private String ruleMsgTips;
+    @JsonProperty("value")
+    private ValueDTO value;
+    @JsonProperty("additionalInfo")
+    private AdditionalInfoDTO additionalInfo;
+
+    @NoArgsConstructor
+    @Data
+    public static class ValueDTO {
+        @JsonProperty("datas")
+        private DatasDTO datas;
+
+        @NoArgsConstructor
+        @Data
+        public static class DatasDTO {
+            @JsonProperty("maxPage")
+            private Integer maxPage;
+            @JsonProperty("policyLists")
+            private List<?> policyLists;
+
+        }
+    }
+
+    @NoArgsConstructor
+    @Data
+    public static class AdditionalInfoDTO {
+    }
+}

+ 22 - 27
tenant/insurance/quotation-zhongan/src/main/java/com/jzg/quotation/zhongan/crawler/service/Impl/ZhongAnCrawlerRequestImpl.java

@@ -267,9 +267,10 @@ public class ZhongAnCrawlerRequestImpl implements ZhongAnCrawlerRequest {
         ZhongAnCrawlerUploadInitDateResponse.ValueDTO.DatasDTO initData = zhongAnCrawlerCacheComponent.getInitData(underwritingVo.getOrder().getOrdersNo() + ZhongAnCrawlerCacheComponent.INITDATE);
         ZhongAnCrawlerPaymentRequest paymentRequest = new ZhongAnCrawlerPaymentRequest(zhongAnCrawlerOrder.getPolicyId(), initData.getCheckCode());
         ZhongAnCrawlerPaymentResponse payment = zhongAnCrawlerRequestComponent.payment(paymentRequest, headers);
+        zhongAnCrawlerCacheComponent.setCache(payment.getValue().getDatas().getInitInfo(),underwritingVo.getOrder().getOrdersNo()+ZhongAnCrawlerCacheComponent.PAYMENT);
 
         UnderwritingResultsVo underwritingResultsVo = new UnderwritingResultsVo();
-        underwritingResultsVo.setPaymentLink(payment.getValue().getDatas().getShareShortUrl());
+//        underwritingResultsVo.setPaymentLink(payment.getValue().getDatas().getShareShortUrl());
         //核保结果
         underwritingResultsVo.setUnderwritingResult("核保成功");
 //        //核保状态
@@ -361,33 +362,12 @@ public class ZhongAnCrawlerRequestImpl implements ZhongAnCrawlerRequest {
 
 
     private void extracted(ZhongAnCrawlerConfigureParameters parameters, HttpHeaders headers, ZhongAnCrawlerOrder zhongAnCrawlerOrder, String imageType, InsuranceImageVo.ImageDTO imageDTO) {
-        String imageBase64Str = imageDTO.getImageBase64Str();
-        byte[] imageBytes = Base64.getDecoder().decode(imageBase64Str);
-        String imageId = imageDTO.getImageId();
-        SysUploadFiles sysUploadFiles = platformClient.getUploadFile(imageId);
-//        String url = MinioUtils.getPresignedObjectUrl("jzg", sysUploadFiles.getFileName());
-        String url = "http://192.168.0.250:9000/jzg/fc69904cb8b3647fd80f2994bee6939f_82ab9c52b729ab1747ece717662cab08.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=v7Zb8XhyLcYNcSHlxvyK%2F20250910%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250910T103229Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=e7febb0154d1f4f6f499570ad0f77ddb019e176735b52932e07881923dcd397d ";
-        //需要设置一个临时图片路径
-//        FileOutputStream fileOutputStream = null;
-//        String filePath = url;
-//        try {
-//            fileOutputStream = new FileOutputStream(filePath);
-//            fileOutputStream.write(imageBytes);
-//            fileOutputStream.close();
-//        }  catch (Exception e) {
-//            throw new RuntimeException(e);
-//        }
-//        File file = new File(url);
-
-        byte[] convert = new byte[0];
-        try {
-            convert = convert(url);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
+        ZhongAnCrawlerUploadImageRequest uploadImageRequest = new ZhongAnCrawlerUploadImageRequest(imageType, imageDTO, zhongAnCrawlerOrder.getOrderNo(), zhongAnCrawlerOrder.getPolicyId(), parameters);
+        ZhongAnCrawlerUploadImageResponse uploadImageResponse = zhongAnCrawlerRequestComponent.uploadImage(uploadImageRequest, headers);
+        if (uploadImageResponse != null && StringUtils.isNotEmpty(uploadImageResponse.getErrorMsg())) {
+            throw new SystemException(uploadImageResponse.getErrorMsg());
         }
 
-        ZhongAnCrawlerUploadImageRequest uploadImageRequest = new ZhongAnCrawlerUploadImageRequest(imageType, convert, zhongAnCrawlerOrder.getOrderNo(), zhongAnCrawlerOrder.getPolicyId(), parameters);
-        ZhongAnCrawlerUploadImageResponse uploadImageResponse = zhongAnCrawlerRequestComponent.uploadImage(uploadImageRequest, headers);
     }
 
     public  byte[] convert(String filePath) throws IOException {
@@ -459,6 +439,21 @@ public class ZhongAnCrawlerRequestImpl implements ZhongAnCrawlerRequest {
     @Override
     public OrderStatusResultVo queryOrderState(OrderStatusVo orderStatusVo) throws JsonProcessingException {
         loginCookieCache(zhongAnId);
-        return null;
+        AttributionInformationVo attributionInformationVo = orderStatusVo.getOrder().getAttributionInformationVo();
+        //获取配置信息
+        ZhongAnCrawlerConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(ZhongAnCrawlerConfigureParameters.class, attributionInformationVo.getConfigInfo());
+        HttpHeaders headers = zhongAnCrawlerRequestComponent.getHeaders(zhongAnId);
+        String flowId = parameters.getFlowId();
+        if (StringUtils.isEmpty(flowId)) {
+            parameters.setFlowId(zhongAnCrawlerCacheComponent.getFlowId(zhongAnId));
+        }
+
+        ZhongAnCrawlerPaymentResponse.ValueDTO.DatasDTO.InitInfoDTO payment = zhongAnCrawlerCacheComponent.getPayment(orderStatusVo.getOrder().getOrdersNo() + ZhongAnCrawlerCacheComponent.PAYMENT);
+        ZhongAnCrawlerPolicyListRequest policyListRequest = new ZhongAnCrawlerPolicyListRequest(payment.getVehicleName(),parameters);
+        String s = zhongAnCrawlerRequestComponent.policyList(policyListRequest,headers);
+
+        OrderStatusResultVo orderStatusResultVo= new OrderStatusResultVo();
+
+        return orderStatusResultVo;
     }
 }