shenweidong пре 1 година
родитељ
комит
05ffbb461a

+ 6 - 0
tenant/insurance/quotation-huatai/pom.xml

@@ -28,6 +28,12 @@
             <artifactId>zip4j</artifactId>
             <version>2.11.5</version>
         </dependency>
+        <dependency>
+            <!-- jsoup HTML parser library @ https://jsoup.org/ -->
+            <groupId>org.jsoup</groupId>
+            <artifactId>jsoup</artifactId>
+            <version>1.20.1</version>
+        </dependency>
 
     </dependencies>
 

+ 20 - 0
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/component/HtCrawlerRequestComponent.java

@@ -171,4 +171,24 @@ public class HtCrawlerRequestComponent {
     public HtCrawlerDownloadPolicyResponse downloadPolicy(HtCrawlerDownloadPolicyRequest downloadPolicyRequest, HttpHeaders headers) {
         return requestComponent.objectPost(RequestUrl.DOWNLOAD_POLICY.getRequestUrl(huaTaiCrawlerProperties.getBaseUrl()), downloadPolicyRequest, HtCrawlerDownloadPolicyResponse.class, headers ).getBody();
     }
+
+    /**
+     * 查询订单状态
+     * @param htCrawlerOrderStateRequest
+     * @param headers
+     * @return
+     */
+    public String queryOrderStatus(HtCrawlerOrderStateRequest htCrawlerOrderStateRequest, HttpHeaders headers) {
+        return requestComponent.objectPost(RequestUrl.ORDER_STATE.getRequestUrl(huaTaiCrawlerProperties.getBaseUrl()), htCrawlerOrderStateRequest, String.class, headers ).getBody();
+    }
+
+    /**
+     * 获取支付链接
+     * @param paymentLinkRequest
+     * @param headers
+     * @return
+     */
+    public HtCrawlerPaymentLinkResponse getPaymentLink(HtCrawlerPaymentLinkRequest paymentLinkRequest, HttpHeaders headers) {
+        return requestComponent.objectPost(RequestUrl.PAYMENT_LINK.getRequestUrl(huaTaiCrawlerProperties.getBaseUrl()), paymentLinkRequest, HtCrawlerPaymentLinkResponse.class, headers ).getBody();
+    }
 }

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

@@ -23,6 +23,10 @@ public enum RequestUrl implements CrawlerRequestUrlStandard {
 
     SUBMIT("/htcsp/checkInsAction.do?cmd=submit4ajax&SS=SS", "提交核保"),
 
+    ORDER_STATE("/htcsp/QuotationQueryAction.do?cmd=quotationListAll", "查询订单状态"),
+
+    PAYMENT_LINK("/htcsp/PaymentAction.do?cmd=Sendelectronicprop", "获取支付链接"),
+
     DOWNLOAD_POLICY("/htcsp/DocumentPrintAction.do?cmd=electronicPolicyEndorseDownload", "下载保单"),
     ;
 

+ 65 - 0
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/entity/Request/HtCrawlerOrderStateRequest.java

@@ -0,0 +1,65 @@
+package com.jzg.quotation.huatai.crawler.entity.Request;
+
+import com.jzg.quotation.huatai.crawler.entity.HtCrawlerConfigureParameters;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @description: 华泰财险 查询订单状态 请求参数
+ * @author: shenwd
+ * @date: 2025/5/7 10:53
+ **/
+@Data
+public class HtCrawlerOrderStateRequest implements Serializable {
+    @Serial
+    private static final long serialVersionUID = -2269873872568287435L;
+
+    public HtCrawlerOrderStateRequest(HtCrawlerConfigureParameters parameters, String quotationRelaNo) {
+        this.quotationNo = quotationRelaNo;
+        this.comcode = parameters.getComCode();
+    }
+
+    private String telemarketFlag = "0";
+    private String renewalTwoSwitch = "1";
+    /**
+     * 报价单号
+     */
+    private String quotationNo;
+    /**
+     * 车牌号
+     */
+    private String licensePlateNo;
+    /**
+     * 开始时间
+     */
+    private String createDate1;
+    /**
+     * 结束时间
+     */
+    private String createDate2;
+    private String comcode;
+    /**
+     * 出单系统:集成
+     */
+    private String Single_system = "8";
+    /**
+     * 状态:有效
+     */
+    private String validflag = "1";
+    /**
+     * 是否一家多车:全部
+     */
+    private String onemoreflag = "2";
+    /**
+     * 业务类型:全部
+     */
+    private String businesstype = "0";
+    private String iFlag = "3";
+    private Integer VENUS_PAGE_NO_KEY = 1;
+    private Integer VENUS_PAGE_COUNT_KEY = 1;
+    private Integer VENUS_PAGE_SIZE_KEY = 15;
+    private Integer VENUS_PAGE_NO_KEY_INPUT = 1;
+
+}

+ 55 - 0
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/entity/Request/HtCrawlerPaymentLinkRequest.java

@@ -0,0 +1,55 @@
+package com.jzg.quotation.huatai.crawler.entity.Request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.jzg.quotation.commons.entity.vo.aggregated.PaymentLinkVo;
+import com.jzg.quotation.huatai.crawler.entity.HtCrawlerConfigureParameters;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @description: 华泰财险 爬虫获取支付链接 请求参数
+ * @author: shenwd
+ * @date: 2025/5/7 18:04
+ **/
+@Data
+@NoArgsConstructor
+public class HtCrawlerPaymentLinkRequest implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 756412555027857067L;
+
+    public HtCrawlerPaymentLinkRequest(HtCrawlerConfigureParameters parameters, PaymentLinkVo paymentLinkVo) {
+        this.comcode = parameters.getComCode();
+        this.logincomcode = parameters.getComCode();
+        this.proposalno = "";//需设置投保单号
+    }
+
+    private String poatype;
+    private String proposalno;
+    private String systemFlag;
+    private String insuredname;
+    private String certitype;
+    private String certicode;
+    private String createtime;
+    private String comcode;
+    private String quoteamount;
+    private String assuredname;
+    private String licenseplateno;
+    private String status;
+    private String startdate;
+    private String paytype;
+    private String lastpaydate;
+    private String single_system;
+    private String logincomcode;
+    private String noTotalType;
+    private String realname;
+    private String poasource;
+    private String quotationno;
+    private String inquiryno;
+    private String allowdiscountflag;
+    private String totalAmount;
+    private String insuredidentifytype;
+    private String riskCode;
+}

+ 25 - 0
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/entity/Response/HtCrawlerPaymentLinkResponse.java

@@ -0,0 +1,25 @@
+package com.jzg.quotation.huatai.crawler.entity.Response;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @description: 华泰财险 爬虫获取支付链接 返回参数
+ * @author: shenwd
+ * @date: 2025/5/7 18:11
+ **/
+@Data
+public class HtCrawlerPaymentLinkResponse implements Serializable {
+    @Serial
+    private static final long serialVersionUID = -4240412834122629201L;
+
+    private String errorInfo;
+    private String messageContent;
+    /**
+     * 支付小程序码base64照片
+     */
+    private String img;
+    private Integer sumAmount;
+}

+ 36 - 1
tenant/insurance/quotation-huatai/src/main/java/com/jzg/quotation/huatai/crawler/service/Impl/HuaTaiCrawlerRequestImpl.java

@@ -22,9 +22,17 @@ import com.jzg.quotation.huatai.crawler.entity.po.HtCrawlerOrder;
 import com.jzg.quotation.huatai.crawler.service.HtCrawlerOrderService;
 import com.jzg.quotation.huatai.crawler.service.HuaTaiCrawlerRequest;
 import lombok.RequiredArgsConstructor;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.select.Elements;
 import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Service;
+import org.xml.sax.InputSource;
 
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
 import java.io.*;
 import java.util.Base64;
 
@@ -127,6 +135,13 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
      */
     @Override
     public PaymentLinkResultsVo getPaymentLink(PaymentLinkVo paymentLinkVo) throws JsonProcessingException {
+        AttributionInformationVo attributionInformationVo = paymentLinkVo.getOrder().getAttributionInformationVo();
+        //获取配置信息
+        HtCrawlerConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(HtCrawlerConfigureParameters.class, attributionInformationVo.getConfigInfo());
+        HttpHeaders headers = htCrawlerRequestComponent.getHeaders(attributionInformationVo.getUsername(), attributionInformationVo.getPassword(), parameters.getComCode());
+
+        HtCrawlerPaymentLinkRequest htCrawlerPaymentLinkRequest = new HtCrawlerPaymentLinkRequest(parameters, paymentLinkVo);
+        HtCrawlerPaymentLinkResponse paymentLinkResponse = htCrawlerRequestComponent.getPaymentLink(htCrawlerPaymentLinkRequest, headers);
         return null;
     }
 
@@ -201,7 +216,27 @@ public class HuaTaiCrawlerRequestImpl implements HuaTaiCrawlerRequest {
      * @param orderStatusVo
      */
     @Override
-    public OrderStatusResultVo queryOrderState(OrderStatusVo orderStatusVo) throws JsonProcessingException {
+    public OrderStatusResultVo queryOrderState(OrderStatusVo orderStatusVo) {
+        AttributionInformationVo attributionInformationVo = orderStatusVo.getOrder().getAttributionInformationVo();
+        //获取配置信息
+        HtCrawlerConfigureParameters parameters = ConfigureParametersConversion.conversionEntity(HtCrawlerConfigureParameters.class, attributionInformationVo.getConfigInfo());
+        HttpHeaders headers = htCrawlerRequestComponent.getHeaders(attributionInformationVo.getUsername(), attributionInformationVo.getPassword(), parameters.getComCode());
+
+        HtCrawlerOrder htCrawlerOrder = htCrawlerOrderService.findByOrdersNo(orderStatusVo.getOrder().getOrdersNo());
+        String quotationRelaNo = htCrawlerOrder.getQuotationRelaNo();
+
+        HtCrawlerOrderStateRequest htCrawlerOrderStateRequest = new HtCrawlerOrderStateRequest(parameters, quotationRelaNo);
+        String html = htCrawlerRequestComponent.queryOrderStatus(htCrawlerOrderStateRequest, headers);
+
+        Document document = Jsoup.parse(html);
+        Elements trElement = document.select("table[id='table']").select("tbody").select("tr");
+        Elements tdElements = trElement.select("td");
+
+        tdElements.get(1).firstElementChild().text();//客户名称
+        tdElements.get(2).firstElementChild().text();//保险起保日期
+        tdElements.get(3).firstElementChild().text();//车牌号
+        tdElements.get(4).firstElementChild().text();//报价单创建日期
+        tdElements.get(7).firstElementChild().text();//订单状态
         return null;
     }
 }