/*     */ package com.picc.grab.service.impl;
/*     */ 
/*     */ import com.alibaba.fastjson.JSONObject;
/*     */ import com.picc.grab.common.CommonMenthod;
/*     */ import com.picc.grab.config.CarManageConfig;
/*     */ import com.picc.grab.config.KgConfig;
/*     */ import com.picc.grab.entity.ShiroUser;
/*     */ import com.picc.grab.entity.grab.vo.FgsFindAllVO;
/*     */ import com.picc.grab.service.IInterfaceRequestService;
/*     */ import com.picc.grab.util.HttpUtil;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Date;
/*     */ 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 InterfaceRequestServiceImpl
/*     */   implements IInterfaceRequestService
/*     */ {
/*  28 */   private static final Logger logger = LoggerFactory.getLogger(IInterfaceRequestService.class);
/*     */   
/*     */   @Autowired
/*     */   private CommonMenthod commonMenthod;
/*     */   
/*     */   @Autowired
/*     */   private CarManageConfig manageConfig;
/*     */   
/*     */   @Autowired
/*     */   private KgConfig kgConfig;
/*     */ 
/*     */   
/*     */   public ShiroUser shiroUser(String username) {
/*  41 */     if (!username.equals("admin")) {
/*  42 */       this.commonMenthod.throwBusinessException(Integer.valueOf(10001));
/*     */     }
/*  44 */     return null;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public void updateLoginErrData(String id, Date lastErrLoginTime, Integer loginErrTimes) {
/*  50 */     Map<String, Object> header = this.commonMenthod.getHeader(this.manageConfig.getSecret(), this.manageConfig.getAppname());
/*     */     
/*  52 */     JSONObject paramJo = new JSONObject();
/*  53 */     paramJo.put("id", id);
/*  54 */     paramJo.put("lastErrLoginTime", lastErrLoginTime);
/*  55 */     paramJo.put("loginErrTimes", loginErrTimes);
/*  56 */     JSONObject jsonObject = null;
/*     */     try {
/*  58 */       String url = this.manageConfig.getUrl() + "/uminterface" + "/updateLoginErrData";
/*  59 */       logger.info("updateLoginErrData url：{} start ！", url);
/*  60 */       jsonObject = HttpUtil.doPostJson(url, paramJo.toJSONString(), header);
/*  61 */       logger.info("updateLoginErrData end ！", url);
/*  62 */     } catch (Exception e) {
/*  63 */       logger.info("updateLoginErrData error: " + e.getMessage() + "请求异常！");
/*     */     } 
/*  65 */     if (jsonObject != null) {
/*     */       
/*  67 */       Integer code = jsonObject.getInteger("code");
/*  68 */       this.commonMenthod.throwBusinessException(code);
/*     */     } 
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public List<FgsFindAllVO> findFgsAll() {
/*  75 */     Map<String, Object> header = this.commonMenthod.getHeader(this.manageConfig.getSecret(), this.manageConfig.getAppname());
/*     */     
/*  77 */     JSONObject paramJo = new JSONObject();
/*  78 */     JSONObject jsonObject = null;
/*     */     try {
/*  80 */       String url = this.manageConfig.getUrl() + "/uminterface" + "/findFgsAll";
/*  81 */       logger.info("findFgsAll url：{} start ！", url);
/*  82 */       jsonObject = HttpUtil.doPostJson(url, paramJo.toJSONString(), header);
/*  83 */       logger.info("findFgsAll end ！", url);
/*  84 */     } catch (Exception e) {
/*  85 */       logger.info("findFgsAll error: " + e.getMessage() + "请求异常！");
/*     */     } 
/*  87 */     List<FgsFindAllVO> list = new ArrayList<>();
/*  88 */     if (jsonObject != null) {
/*     */       
/*  90 */       Integer code = jsonObject.getInteger("code");
/*  91 */       this.commonMenthod.throwBusinessException(code);
/*     */       
/*  93 */       if (jsonObject.get("data") != null) {
/*  94 */         list = JSONObject.parseArray(jsonObject.getString("data"), FgsFindAllVO.class);
/*     */       }
/*     */     } 
/*  97 */     return list;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public List<FgsFindAllVO> findFgsAllByUserFgsIds(String fgsIds) {
/* 103 */     Map<String, Object> header = this.commonMenthod.getHeader(this.manageConfig.getSecret(), this.manageConfig.getAppname());
/*     */     
/* 105 */     JSONObject paramJo = new JSONObject();
/* 106 */     paramJo.put("fgsIds", fgsIds);
/* 107 */     JSONObject jsonObject = null;
/*     */     try {
/* 109 */       String url = this.manageConfig.getUrl() + "/uminterface" + "/findFgsAllByUserFgsIds";
/* 110 */       logger.info("findFgsAllByUserFgsIds url：{} start ！", url);
/* 111 */       jsonObject = HttpUtil.doPostJson(url, paramJo.toJSONString(), header);
/* 112 */       logger.info("findFgsAllByUserFgsIds end ！", url);
/* 113 */     } catch (Exception e) {
/* 114 */       logger.info("findFgsAllByUserFgsIds error: " + e.getMessage() + "请求异常！");
/*     */     } 
/* 116 */     List<FgsFindAllVO> list = new ArrayList<>();
/* 117 */     if (jsonObject != null) {
/*     */       
/* 119 */       Integer code = jsonObject.getInteger("code");
/* 120 */       this.commonMenthod.throwBusinessException(code);
/*     */       
/* 122 */       if (jsonObject.get("data") != null) {
/* 123 */         list = JSONObject.parseArray(jsonObject.getString("data"), FgsFindAllVO.class);
/*     */       }
/*     */     } 
/* 126 */     return list;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public void syncKgCarxx() {
/* 132 */     (new Thread(new Runnable()
/*     */         {
/*     */           public void run()
/*     */           {
/* 136 */             Map<String, Object> header = InterfaceRequestServiceImpl.this.commonMenthod.getHeader(InterfaceRequestServiceImpl.this.kgConfig.getSecret(), InterfaceRequestServiceImpl.this.kgConfig.getAppname());
/*     */             
/* 138 */             JSONObject paramJo = new JSONObject();
/*     */             try {
/* 140 */               String url = InterfaceRequestServiceImpl.this.kgConfig.getUrl() + "/uminterface" + "/syncKgCarxx";
/* 141 */               InterfaceRequestServiceImpl.logger.info("syncKgCarxx url：{} start ！", url);
/* 142 */               HttpUtil.doPostJson(url, paramJo.toJSONString(), header);
/* 143 */               InterfaceRequestServiceImpl.logger.info("syncKgCarxx end ！", url);
/* 144 */             } catch (Exception e) {
/* 145 */               InterfaceRequestServiceImpl.logger.info("syncKgCarxx error: " + e.getMessage() + "请求异常！");
/*     */             } 
/*     */           }
/* 148 */         })).start();
/*     */   }
/*     */ }


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