|
@ -1,7 +1,6 @@ |
|
|
package com.storeroom.service.impl; |
|
|
package com.storeroom.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.storeroom.exception.BaseException; |
|
|
import com.storeroom.exception.BaseException; |
|
@ -12,14 +11,12 @@ import com.storeroom.service.dto.RealTimeDataDto; |
|
|
import com.storeroom.utils.FastjsonUtils; |
|
|
import com.storeroom.utils.FastjsonUtils; |
|
|
import com.storeroom.utils.HttpUtils; |
|
|
import com.storeroom.utils.HttpUtils; |
|
|
import com.storeroom.utils.RedisUtils; |
|
|
import com.storeroom.utils.RedisUtils; |
|
|
import com.storeroom.utils.StringUtils; |
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.SneakyThrows; |
|
|
import lombok.SneakyThrows; |
|
|
import okhttp3.*; |
|
|
import okhttp3.*; |
|
|
import org.apache.http.HttpResponse; |
|
|
import org.apache.http.HttpResponse; |
|
|
import org.apache.http.util.EntityUtils; |
|
|
import org.apache.http.util.EntityUtils; |
|
|
import org.springframework.cache.annotation.CacheConfig; |
|
|
import org.springframework.cache.annotation.CacheConfig; |
|
|
import org.springframework.cache.annotation.Cacheable; |
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
@ -116,8 +113,8 @@ public class ApiServiceImpl implements ApiService { |
|
|
map.put("Authorization", "Bearer" + token + ""); |
|
|
map.put("Authorization", "Bearer" + token + ""); |
|
|
HttpResponse response = HttpUtils.doGet("http://jiton.8800.org:800", "/Api/Third/GetCurAlarm", "Get", map, null); |
|
|
HttpResponse response = HttpUtils.doGet("http://jiton.8800.org:800", "/Api/Third/GetCurAlarm", "Get", map, null); |
|
|
if (response.getStatusLine().getStatusCode() == 200) { |
|
|
if (response.getStatusLine().getStatusCode() == 200) { |
|
|
String s = EntityUtils.toString(response.getEntity()); |
|
|
|
|
|
Map<String, Object> dataMap = FastjsonUtils.toJavaMap(s); |
|
|
|
|
|
|
|
|
String result = EntityUtils.toString(response.getEntity()); |
|
|
|
|
|
Map<String, Object> dataMap = FastjsonUtils.toJavaMap(result); |
|
|
List<GetCurAlarmDto> list = new ArrayList<>(); |
|
|
List<GetCurAlarmDto> list = new ArrayList<>(); |
|
|
dataMap.forEach((k, v) -> { |
|
|
dataMap.forEach((k, v) -> { |
|
|
if (k.equals("Data")) { |
|
|
if (k.equals("Data")) { |
|
@ -141,7 +138,9 @@ public class ApiServiceImpl implements ApiService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
return list; |
|
|
|
|
|
|
|
|
//PushServiceImpl pushService=new PushServiceImpl(); |
|
|
|
|
|
// pushService.pushMsgToAll(result); |
|
|
|
|
|
return result; |
|
|
} else { |
|
|
} else { |
|
|
throw new BaseException("访问失败" + response.getStatusLine().getStatusCode() + ""); |
|
|
throw new BaseException("访问失败" + response.getStatusLine().getStatusCode() + ""); |
|
|
} |
|
|
} |
|
|