From 8f95880fef5e5cb178144bed6f7685a42d84e48b Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期四, 23 六月 2022 17:07:28 +0800
Subject: [PATCH] bug修复

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java |   84 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 70 insertions(+), 14 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
index fa11ba3..85ec47f 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedPlayerEntityService.java
@@ -7,9 +7,11 @@
 import com.sandu.common.service.impl.BaseServiceImpl;
 import com.sandu.common.util.SpringContextHolder;
 import com.sandu.ximon.admin.security.SecurityUtils;
+import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils;
 import com.sandu.ximon.admin.utils.VnnoxAPIUtil;
 import com.sandu.ximon.admin.vo.EquipmentInfomation;
 import com.sandu.ximon.dao.domain.LedPlayerEntity;
+import com.sandu.ximon.dao.enums.OrderByEnums;
 import com.sandu.ximon.dao.mapper.LedPlayerEntityMapper;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -38,8 +40,29 @@
         return getOne(Wrappers.lambdaQuery(LedPlayerEntity.class).eq(LedPlayerEntity::getPlayerId, playerId));
     }
 
+    /**
+     * 璇虹摝璁惧鏂板
+     *
+     * @param ledPlayerEntity
+     * @return
+     */
     public boolean saveLed(LedPlayerEntity ledPlayerEntity) {
-        return ledPlayerEntityMapper.saveLed(ledPlayerEntity);
+        boolean b = ledPlayerEntityMapper.saveLed(ledPlayerEntity);
+        /**
+         * 璇虹摝璁惧鏂板 鏃ュ織璁板綍寮�濮�
+         */
+        List<String> listCode = new ArrayList<>(1);
+        listCode.add(ledPlayerEntity.getSn());
+        String content = "{ 璁惧id:" + ledPlayerEntity.getId() + "璁惧code锛�" + ledPlayerEntity.getSn()
+                + "璇虹摝playId:" + ledPlayerEntity.getPlayerId()
+                + "璇虹摝璁惧鍚嶇О:" + ledPlayerEntity.getName() +
+                "}";
+
+        StoreOperationRecordsUtils.storeOperationData(listCode, null, "璇虹摝璁惧鏂板", content);
+        /**
+         * 璇虹摝璁惧鏂板 鏃ュ織璁板綍缁撴潫
+         */
+        return b;
     }
 
 
@@ -87,7 +110,7 @@
             if (onlineStatus == 0) {
                 equipmentInfo.setEquipmentState("鍦ㄧ嚎");
             } else {
-                equipmentInfo.setEquipmentName("绂荤嚎");
+                equipmentInfo.setEquipmentState("绂荤嚎");
             }
         }
 
@@ -95,9 +118,40 @@
     }
 
 
-    public List<LedPlayerEntity> ledPlayerEntityList(BaseConditionVO baseConditionVO, String keyword) {
+    public List<LedPlayerEntity> ledPlayerEntityList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) {
+        //鎺掑簭瀛楁
+        String orderByResult = OrderByEnums.VNNOX_ID.getCode();
+        //姝e簭銆佸�掑彊
+        String orderBySeq = OrderByEnums.ASC.getCode();
+        if (order != null) {
+            switch (order) {
+                case 1:
+                    orderByResult = OrderByEnums.VNNOX_POLE_NAME.getCode();
+                    break;
+                case 2:
+                    orderByResult = OrderByEnums.VNNOX_CREATE_TIMESTAMP.getCode();
+                    break;
+                default:
+            }
+        }
+        if (seq != null) {
+            switch (seq) {
+                case 1:
+                    orderBySeq = OrderByEnums.ASC.getCode();
+                    break;
+                case 2:
+                    orderBySeq = OrderByEnums.DESC.getCode();
+                    break;
+                default:
+                    break;
+            }
+        }
+        //鎺掑簭鏂瑰紡
+        String orderBy = orderByResult + " " + orderBySeq;
+
+
         if (baseConditionVO != null) {
-            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+            PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy);
         }
         List<LedPlayerEntity> list;
         //瓒呯
@@ -109,14 +163,16 @@
         return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
     }
 
-//    public List<LedPlayerEntity> ledPlayerEntityList() {
-//        List<LedPlayerEntity> list;
-//        //瓒呯
-//        if (SecurityUtils.getClientId() == null) {
-//            list = ledPlayerEntityMapper.ledPlayerEntityList(null, null);
-//        } else {
-//            list = ledPlayerEntityMapper.ledPlayerEntityList(null, SecurityUtils.getUserId());
-//        }
-//        return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
-//    }
+    public List<LedPlayerEntity> ledPlayerEntityListOnBinding(String keyword) {
+
+        List<LedPlayerEntity> list;
+        //瓒呯
+        if (SecurityUtils.getClientId() == null) {
+            list = ledPlayerEntityMapper.ledPlayerEntityListOnBinding(keyword, null);
+        } else {
+            list = ledPlayerEntityMapper.ledPlayerEntityListOnBinding(keyword, SecurityUtils.getUserId());
+        }
+        return SpringContextHolder.getBean(VnnoxService.class).setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list));
+    }
+
 }

--
Gitblit v1.9.3