From a5e2a5196084b27f3fe044a42bc7c2e66a6f884a Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期一, 14 十二月 2020 20:10:47 +0800
Subject: [PATCH] 缴费成功信息推送
---
service-job/src/main/java/com/java110/job/adapt/ximoIot/GetToken.java | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/service-job/src/main/java/com/java110/job/adapt/ximoIot/GetToken.java b/service-job/src/main/java/com/java110/job/adapt/ximoIot/GetToken.java
index 236e082..d1b51dd 100644
--- a/service-job/src/main/java/com/java110/job/adapt/ximoIot/GetToken.java
+++ b/service-job/src/main/java/com/java110/job/adapt/ximoIot/GetToken.java
@@ -21,10 +21,7 @@
import com.java110.utils.cache.CommonCache;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
/**
* 鑾峰彇token
@@ -45,7 +42,7 @@
HttpEntity httpEntity = new HttpEntity(headers);
ResponseEntity<String> tokenRes = restTemplate.exchange(XimoIotConstant.GET_TOKEN_URL, HttpMethod.GET, httpEntity, String.class);
- if (tokenRes.getStatusCode() != null) {
+ if (tokenRes.getStatusCode() != HttpStatus.OK) {
throw new IllegalArgumentException("鑾峰彇token澶辫触" + tokenRes.getBody());
}
JSONObject tokenObj = JSONObject.parseObject(tokenRes.getBody());
@@ -55,7 +52,7 @@
}
token = tokenObj.getJSONObject("data").getString("accessToken");
- int expiresIn = tokenObj.getJSONObject("data").getInteger("accessToken");
+ int expiresIn = tokenObj.getJSONObject("data").getInteger("expiresIn");
CommonCache.setValue(XimoIotConstant.XI_MO_TOKEN, token, expiresIn - 200);
--
Gitblit v1.8.0