From e949c039209af21f652dc9c66b48d3c3558fc5c6 Mon Sep 17 00:00:00 2001
From: whycrzg <ruanzhigang@whycst.com>
Date: 星期三, 31 三月 2021 17:30:02 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into master

---
 src/main/java/com/whyc/controller/TestDataController.java |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/whyc/controller/TestDataController.java b/src/main/java/com/whyc/controller/TestDataController.java
index 7d20e7f..e8709c7 100644
--- a/src/main/java/com/whyc/controller/TestDataController.java
+++ b/src/main/java/com/whyc/controller/TestDataController.java
@@ -1,8 +1,11 @@
 package com.whyc.controller;
 
+import com.google.gson.JsonObject;
 import com.whyc.dto.Response;
+import com.whyc.dto.TestDataDTO;
 import com.whyc.pojo.MotorState;
 import com.whyc.pojo.TestPlan;
+import com.whyc.service.DeviceInfService;
 import com.whyc.service.MotorStateService;
 import com.whyc.service.TestPlanService;
 import io.swagger.annotations.Api;
@@ -29,6 +32,8 @@
     private TestPlanService testPlanService;
     @Resource
     private MotorStateService motorStateService;
+    @Autowired
+    private DeviceInfService deviceInfService;
 
     @GetMapping()
     @ApiOperation("鑾峰彇鍘嗗彶鏁版嵁")
@@ -42,11 +47,16 @@
         String startTime = dateFormat.format(testPlan.getStartTime());
         String endTime = dateFormat.format(testPlan.getEndTime());
         //閫氳繃璁惧鍜屽紑濮嬬粨鏉熸椂闂存潵鑾峰彇瀵瑰簲鐨勬暟鎹�
-        Map<String,List<MotorState>> map = new HashMap<>();
+        List<TestDataDTO> list = new ArrayList<TestDataDTO>();
         for (String deviceId: devIds) {
             List<MotorState> historyData =  motorStateService.getHistoryData(deviceId,startTime,endTime);
-            map.put(deviceId,historyData);
+            String deviceName = deviceInfService.getOneByDeviceId(Integer.valueOf(deviceId)).getDeviceName();
+            TestDataDTO testDataDTO = new TestDataDTO();
+            testDataDTO.setDeviceId(deviceId);
+            testDataDTO.setDeviceName(deviceName);
+            testDataDTO.setData(historyData);
+            list.add(testDataDTO);
         }
-        return new Response().set(1,map);
+        return new Response().set(1,list);
     }
 }

--
Gitblit v1.9.1