From cae10e095f824ad86e61b461e727c90b9dd348b0 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期一, 22 一月 2024 11:19:25 +0800
Subject: [PATCH] 优化小区数据
---
service-job/src/main/java/com/java110/job/adapt/hcIotNew/http/SendIotImpl.java | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/service-job/src/main/java/com/java110/job/adapt/hcIotNew/http/SendIotImpl.java b/service-job/src/main/java/com/java110/job/adapt/hcIotNew/http/SendIotImpl.java
index a62782f..6dd6775 100644
--- a/service-job/src/main/java/com/java110/job/adapt/hcIotNew/http/SendIotImpl.java
+++ b/service-job/src/main/java/com/java110/job/adapt/hcIotNew/http/SendIotImpl.java
@@ -89,7 +89,7 @@
String password = MappingCache.getValue(IOT_DOMAIN, "IOT_PASSWORD");
JSONObject param = new JSONObject();
param.put("username", userName);
- param.put("password", password);
+ param.put("passwd", password);
HttpHeaders header = new HttpHeaders();
header.add(CommonConstant.APP_ID.toLowerCase(), MappingCache.getValue(IOT_DOMAIN, "APP_ID"));
@@ -101,11 +101,11 @@
ResponseEntity<String> tokenRes = outRestTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class);
- if (tokenRes.getStatusCode() != HttpStatus.OK) {
+
+ JSONObject tokenObj = JSONObject.parseObject(tokenRes.getBody());
+ if (tokenObj.getIntValue("code") != 0) {
throw new IllegalArgumentException("鑾峰彇token澶辫触" + tokenRes.getBody());
}
- JSONObject tokenObj = JSONObject.parseObject(tokenRes.getBody());
-
if (!tokenObj.containsKey("token")) {
throw new IllegalArgumentException("鑾峰彇token澶辫触" + tokenRes.getBody());
}
--
Gitblit v1.8.0