diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index 00b09ef1..06802610 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -240,7 +240,7 @@ public class DcDeviceController extends BaseController { Object data = JSON.parseObject(queryDeviceProperties(deviceId, propertyId, props).get("data").toString()).get("data"); JSONArray dataArray = JSON.parseArray(data.toString()); - List list = new ArrayList<>(); + List> list = new ArrayList<>(); dataArray.forEach(o -> { Map map = new HashMap<>(); JSONObject jsonObject = JSON.parseObject(o.toString()); @@ -250,6 +250,12 @@ public class DcDeviceController extends BaseController { map.put("timestamp", formatValue.get("equipmentReportingTime")); list.add(map); }); + Collections.sort(list, new Comparator>() { + @Override + public int compare(Map map1, Map map2) { + return map1.get("timestamp").toString().compareTo(map2.get("timestamp").toString()); + } + }); return AjaxResult.success(list); }