|
|
@@ -26,11 +26,8 @@ import java.util.*;
|
|
|
@HttpCore(serviceName = ServiceNameConst.SERVICE_ADZN_GSSQ)
|
|
|
public class AdznGssqService extends HttpClient {
|
|
|
|
|
|
-// @Autowired
|
|
|
-// private MongoService mongoService;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IIotDeviceService iotDeviceService;
|
|
|
+ private String getDevListUrl = "/getDevList";
|
|
|
+ private String getDevLastDataUrl = "/getDevLastData";
|
|
|
|
|
|
|
|
|
public JSONObject requestPost(String url, Map<String, Object> payload) {
|
|
|
@@ -46,12 +43,16 @@ public class AdznGssqService extends HttpClient {
|
|
|
payload.put("userID", userID);
|
|
|
|
|
|
String response = HttpUtil.createPost(sendUrl).form(payload).execute().body();
|
|
|
- log.info("【爱迪智农管式墒情】:{} {} \n {}", payload, "请求结果:", response);
|
|
|
+ String msg = response;
|
|
|
+ if(getDevListUrl.equals(url)){
|
|
|
+ msg = "获取设备列表成功";
|
|
|
+ }
|
|
|
+ log.info("【爱迪智农管式墒情】: {} {} {} \n {}", sendUrl, payload, "请求结果:", msg);
|
|
|
return JSONObject.parseObject(response);
|
|
|
}
|
|
|
|
|
|
public JSONArray getDevList(){
|
|
|
- String url = "/getDevList";
|
|
|
+ String url = getDevListUrl;
|
|
|
Map<String, Object> payload = new HashMap<>();
|
|
|
JSONObject jsonObject = requestPost(url, payload);
|
|
|
JSONArray devListArray = jsonObject.getJSONArray("devList");
|
|
|
@@ -63,7 +64,7 @@ public class AdznGssqService extends HttpClient {
|
|
|
}
|
|
|
|
|
|
public JSONObject getDevLastData(String devCode){
|
|
|
- String url = "/getDevLastData";
|
|
|
+ String url = getDevLastDataUrl;
|
|
|
Map<String, Object> payload = new HashMap<>();
|
|
|
payload.put("devID", devCode);
|
|
|
JSONObject jsonObject = requestPost(url, payload);
|
|
|
@@ -158,8 +159,11 @@ public class AdznGssqService extends HttpClient {
|
|
|
Date updateTime = iotAdznGssqdata.getTime();
|
|
|
String devUpdateddate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, updateTime);
|
|
|
String oldUpdateddate = iotDevice.getDevUpdateddate();
|
|
|
- if(StringUtils.isNotEmpty(oldUpdateddate) && DateUtils.compareDateStr(devUpdateddate, oldUpdateddate)){
|
|
|
- continue;
|
|
|
+ if(StringUtils.isNotEmpty(oldUpdateddate)){
|
|
|
+ Date oldUpdateTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, oldUpdateddate);
|
|
|
+ if(updateTime.getTime() <= oldUpdateTime.getTime()){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
iotAdznGssqdataList.addAll(childList);
|
|
|
|