/*    */ package com.picc.grab.service.impl;
/*    */ 
/*    */ import com.alibaba.fastjson.JSONArray;
/*    */ import com.alibaba.fastjson.JSONObject;
/*    */ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
/*    */ import com.picc.grab.config.PiccGrabConfig;
/*    */ import com.picc.grab.domain.Piccgrabaccount;
/*    */ import com.picc.grab.mapper.CarinfoMapper;
/*    */ import com.picc.grab.mapper.PiccgrabaccountMapper;
/*    */ import com.picc.grab.service.IBidWinningRaintenanceService;
/*    */ import com.picc.grab.service.ICarinfoService;
/*    */ import com.picc.grab.util.GrabUtil;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import org.slf4j.Logger;
/*    */ import org.slf4j.LoggerFactory;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Service;
/*    */ 
/*    */ @Service
/*    */ public class BidWinningRaintenanceImpl
/*    */   extends ServiceImpl<PiccgrabaccountMapper, Piccgrabaccount> implements IBidWinningRaintenanceService {
/*    */   @Autowired
/*    */   private CarinfoMapper carinfoMapper;
/*    */   @Autowired
/*    */   private PiccGrabConfig piccGrabConfig;
/*    */   @Autowired
/*    */   private ICarinfoService iCarinfoService;
/* 30 */   private static final Logger logger = LoggerFactory.getLogger(BidWinningRaintenanceImpl.class);
/*    */ 
/*    */ 
/*    */   
/*    */   public void bidWinning(Piccgrabaccount account) {
/* 35 */     if (account == null) {
/*    */       return;
/*    */     }
/* 38 */     List<Map<String, Object>> vehicleList = this.carinfoMapper.findVehicleByBid("太平保险", account.getFgsId(), Integer.valueOf(1));
/* 39 */     if (vehicleList != null && vehicleList.size() > 0) {
/* 40 */       GrabUtil httpsUtil = new GrabUtil();
/* 41 */       for (Map<String, Object> temp : vehicleList) {
/* 42 */         Map<Object, Object> map = new HashMap<>();
/* 43 */         map.put("auctionStatus", "02");
/* 44 */         map.put("comName", "");
/* 45 */         map.put("pageCount", Integer.valueOf(2000));
/* 46 */         map.put("pageNo", Integer.valueOf(1));
/* 47 */         map.put("reqSource", "saas");
/* 48 */         map.put("selectContions", temp.get("id"));
/* 49 */         map.put("selectContionsType", "02");
/* 50 */         String modelStr = httpsUtil.getHttpsByCookieConn(this.piccGrabConfig.getBidwinning(), map, account
/* 51 */             .getCookie(), account.getToken());
/* 52 */         JSONObject modelList = JSONObject.parseObject(modelStr);
/* 53 */         if (modelList != null && "200".equals(modelList.getString("code"))) {
/* 54 */           JSONObject data = modelList.getJSONObject("data");
/* 55 */           if ("1".equals(data.getString("countNum"))) {
/* 56 */             JSONArray carArray = data.getJSONArray("bbpAuctionSelectVoList");
/* 57 */             JSONObject car = (JSONObject)carArray.get(0);
/* 58 */             if ("01".equals(car.getString("bidStatus"))) {
/* 59 */               logger.info("车辆" + temp.get("id") + "中标");
/* 60 */               this.iCarinfoService.zbcar(temp.get("carid").toString(), car.getString("bidPrice"), "湖北同凯拍卖有限公司", "湖北同凯拍卖有限公司"); continue;
/*    */             } 
/* 62 */             logger.info("车辆" + temp.get("id") + "未中标");
/* 63 */             this.iCarinfoService.zbcar(temp.get("carid").toString(), car.getString("bidPrice"), "", "湖北同凯拍卖有限公司");
/*    */           } 
/*    */         } 
/*    */       } 
/*    */     } 
/*    */   }
/*    */ 
/*    */   
/*    */   public void entrustWinning(Piccgrabaccount account) {
/* 72 */     if (account == null)
/*    */       return; 
/* 74 */     List<Map<String, Object>> vehicleList = this.carinfoMapper.findVehicleByBid("太平保险", account.getFgsId(), Integer.valueOf(4));
/* 75 */     if (vehicleList != null && vehicleList.size() > 0) {
/* 76 */       GrabUtil httpsUtil = new GrabUtil();
/* 77 */       for (Map<String, Object> temp : vehicleList) {
/* 78 */         Map<Object, Object> map = new HashMap<>();
/* 79 */         map.put("auctionEndTime", "");
/* 80 */         map.put("auctionStatus", "04");
/* 81 */         map.put("comName", "");
/* 82 */         map.put("pageCount", Integer.valueOf(2000));
/* 83 */         map.put("pageNo", Integer.valueOf(1));
/* 84 */         map.put("reqSource", "saas");
/* 85 */         map.put("selectContions", temp.get("id"));
/* 86 */         map.put("selectContionsType", "02");
/* 87 */         String modelStr = httpsUtil.getHttpsByCookieConn(this.piccGrabConfig.getBidwinning(), map, account
/* 88 */             .getCookie(), account.getToken());
/* 89 */         JSONObject modelList = JSONObject.parseObject(modelStr);
/* 90 */         if (modelList != null && "200".equals(modelList.getString("code"))) {
/* 91 */           JSONObject data = modelList.getJSONObject("data");
/* 92 */           if ("1".equals(data.getString("countNum"))) {
/* 93 */             JSONArray carArray = data.getJSONArray("bbpAuctionSelectVoList");
/* 94 */             JSONObject car = (JSONObject)carArray.get(0);
/* 95 */             if ("已委托".equals(car.getString("carStatus"))) {
/* 96 */               logger.info("车辆" + temp.get("id") + "已委托");
/* 97 */               this.iCarinfoService.zbcar(temp.get("carid").toString(), car.getString("bidPrice"), "湖北同凯拍卖有限公司", "湖北同凯拍卖有限公司");
/*    */             } 
/*    */           } 
/*    */         } 
/*    */       } 
/*    */     } 
/*    */   }
/*    */ }


/* Location:              C:\Users\Administrator\Desktop\ROOT\WEB-INF\classes\!\com\picc\grab\service\impl\BidWinningRaintenanceImpl.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */