From 597cae7743fde0ca86efb4659a2ded937fc308ae Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 19 一月 2021 00:32:28 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

---
 service-job/src/main/java/com/java110/job/adapt/hcIot/GetToken.java |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/service-job/src/main/java/com/java110/job/adapt/hcIot/GetToken.java b/service-job/src/main/java/com/java110/job/adapt/hcIot/GetToken.java
index eb4f90e..78829bc 100644
--- a/service-job/src/main/java/com/java110/job/adapt/hcIot/GetToken.java
+++ b/service-job/src/main/java/com/java110/job/adapt/hcIot/GetToken.java
@@ -35,14 +35,15 @@
 
 
     @Java110Synchronized(value = "hc_get_token")
-    public static String get(RestTemplate restTemplate) {
+    public static String get(RestTemplate restTemplate,boolean refreshAccessToken) {
         String token = CommonCache.getValue(IotConstant.HC_TOKEN);
-        if (!StringUtil.isEmpty(token)) {
+        if (!StringUtil.isEmpty(token) && !refreshAccessToken) {
             return token;
         }
         HttpHeaders headers = new HttpHeaders();
         HttpEntity httpEntity = new HttpEntity(headers);
-        ResponseEntity<String> tokenRes = restTemplate.exchange(IotConstant.GET_TOKEN_URL, HttpMethod.GET, httpEntity, String.class);
+        String url = IotConstant.getUrl(IotConstant.GET_TOKEN_URL.replace("APP_ID", IotConstant.getAppId()).replace("APP_SECRET", IotConstant.getAppSecret()));
+        ResponseEntity<String> tokenRes = restTemplate.exchange(url, HttpMethod.GET, httpEntity, String.class);
 
         if (tokenRes.getStatusCode() != HttpStatus.OK) {
             throw new IllegalArgumentException("鑾峰彇token澶辫触" + tokenRes.getBody());

--
Gitblit v1.8.0