Explorar el Código

爬虫非车 空判断

785834757 hace 2 años
padre
commit
ef3602ac16

+ 9 - 0
src/main/java/com/ydtech/modules/order/entity/InsAreaCompanyAccidentalDriving.java

@@ -54,41 +54,50 @@ public class InsAreaCompanyAccidentalDriving implements Serializable {
      * @return
      */
     public void convertCrawler(BaseQuoteVo<Object> t) {
+        if(t.getAccidentalDrivingVo() == null){
+            return;
+        }
         //众安
         if (t.getCompanyId().equals("ZAPA1000000")) {
             JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(t.getAccidentalDrivingVo()));
             this.setRideRiskName(jsonObject.getString("name"));
             this.setQuantity(jsonObject.getInteger("quantity"));
+            this.setCompanyId(t.getCompanyId());
         } else  //恒邦
              if (t.getCompanyId().equals("HBIC1000000")) {
                 JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(t.getAccidentalDrivingVo()));
                 this.setRideRiskName(jsonObject.getString("programname"));
                 this.setQuantity(jsonObject.getInteger("quantity"));
                 this.setRideRiskCode(jsonObject.getString("programcode"));
+                this.setCompanyId(t.getCompanyId());
             } else //人寿
                 if (t.getCompanyId().equals("GPIC1000000")) {
                     JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(t.getAccidentalDrivingVo()));
                     this.setRideRiskName(jsonObject.getString("productName"));
                     this.setQuantity(jsonObject.getInteger("quantity"));
                     this.setRideRiskCode(jsonObject.getString("quotaProjectNo"));
+                    this.setCompanyId(t.getCompanyId());
             }else //太平
                 if (t.getCompanyId().equals("TPIC1000000")) {
                     JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(t.getAccidentalDrivingVo()));
                     this.setRideRiskName(jsonObject.getString("rationName"));
                     this.setQuantity(jsonObject.getInteger("quantity"));
                     this.setRideRiskCode(jsonObject.getString("productCode"));
+                    this.setCompanyId(t.getCompanyId());
             }else //华农
                 if (t.getCompanyId().equals("HNIC1000000")) {
                     JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(t.getAccidentalDrivingVo()));
                     this.setRideRiskName(jsonObject.getString("planName"));
                     this.setQuantity(jsonObject.getInteger("quantity"));
                     this.setRideRiskCode(jsonObject.getString("planCode"));
+                    this.setCompanyId(t.getCompanyId());
                 }else //安盛
             if(t.getCompanyId().equals("TPBX1000000")) {
                 JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(t.getAccidentalDrivingVo()));
                 this.setRideRiskName(jsonObject.getString("productName"));
                 this.setQuantity(jsonObject.getInteger("quantity"));
                 this.setRideRiskCode(jsonObject.getString("productCode"));
+                this.setCompanyId(t.getCompanyId());
             }
     }
 }

+ 6 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.order.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.ydtech.constants.enums.InsurKind;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.core.page.HttpResult;
@@ -131,6 +132,11 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
         InsAreaCompanyAccidentalDriving insAreaCompanyAccidentalDriving = new InsAreaCompanyAccidentalDriving();
         insAreaCompanyAccidentalDriving.convertCrawler(t);
+        //如果是太平 将id 设置为 riskcode
+        if(t.getCompanyId().equals("TPIC1000000")){
+            JSONObject jsonObject = JSON.parseObject(t.getAccidentalDrivingVo().toString());
+            insAreaCompanyAccidentalDriving.setRideRiskCode(jsonObject.get("id").toString());
+        }
         //处理订单信息
         QuoteRespVo responseVo = responseOrder(response, quoteRespVo, ptlAgreementAttribution, insAreaCompanyAccidentalDriving);
 
@@ -409,7 +415,6 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
 
         // 保险公司订单号
         insAreaCompany.setInsOrderNo(response.getOrderNo());
-        insAreaCompanyAccidentalDriving.setCompanyId(ptlAgreementAttribution.getInsCompanyId());
         insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDriving);
         quoteRespVo.setCompanyId(insAreaCompany.getId());
         return quoteRespVo;