From d647b819f2a73b98df27469e09846dcc34bc383d Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期一, 14 三月 2022 12:00:00 +0800
Subject: [PATCH] C3充电桩

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
index 257dff5..3989271 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
@@ -17,6 +17,7 @@
 import com.sandu.ximon.admin.security.SecurityUtils;
 import com.sandu.ximon.admin.service.*;
 import com.sandu.ximon.admin.utils.LightemitUtils;
+import com.sandu.ximon.dao.domain.Pole;
 import com.sandu.ximon.dao.domain.PoleBinding;
 import com.sandu.ximon.dao.domain.PoleLightemitEntity;
 import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
@@ -42,6 +43,7 @@
     private final LightemitUtils lightemitUtils;
     private final LedScheduleService scheduleService;
     private final PoleBindingService bindingService;
+    private final PoleService poleService;
     // private final ListPageUtil listPageUtil;
 
     /**
@@ -229,11 +231,12 @@
         if (isOnLine) {
             List<PoleLightemitEntity> results = poleLightemitService.ledOnline(list);
             results.forEach(
-                    led->{
+                    led -> {
                         bindings.forEach(
-                                bind->{
-                                    if(bind.getDeviceCode()!=null&&led.getLightemitControlCode()==bind.getDeviceCode()){
+                                bind -> {
+                                    if (bind.getDeviceCode() != null && led.getLightemitControlCode() == bind.getDeviceCode()) {
                                         led.setStreetlightId(bind.getPoleId());
+                                        led.setStreetlightName(poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, bind.getPoleId())).getPoleName());
                                     }
                                 }
                         );
@@ -250,17 +253,26 @@
         } else {
             poleLightemitService.ledOnlineCheck(list);
             list.forEach(
-                    led->{
+                    led -> {
                         bindings.forEach(
-                                bind->{
-                                    if(bind.getDeviceCode()!=null&&led.getLightemitControlCode().equals(bind.getDeviceCode())){
+                                bind -> {
+                                    if (bind.getDeviceCode() != null && led.getLightemitControlCode().equals(bind.getDeviceCode())) {
                                         led.setStreetlightId(bind.getPoleId());
+                                        led.setStreetlightName(poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, bind.getPoleId())).getPoleName());
                                     }
                                 }
                         );
                     }
             );
-            return ResponseUtil.success(list);
+            CommonPage commonPage = CommonPage.restPage(list);
+            int size = list.size();
+            commonPage.setTotal((long) size);
+            commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1);
+            if (size % baseConditionVO.getPageSize() == 0) {
+                commonPage.setTotalPage(size / baseConditionVO.getPageSize());
+            }
+            return ResponseUtil.success(commonPage);
+           // return ResponseUtil.success(list);
         }
 //        return ResponseUtil.success(poleLightemitService.list(wrapper));
     }

--
Gitblit v1.9.3