From 30447a66552fc4eb2a8ce52f4162f3b0bb68633d Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Wed, 3 Apr 2024 15:52:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=9F=A5=E8=AF=A2=E5=BD=93?= =?UTF-8?q?=E5=A4=A9=E8=AE=BE=E5=A4=87=E6=8C=87=E5=AE=9A=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/controller/DcDeviceController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); }