From 88700e4d93e6d1e0892c488ffbf165b010d1a182 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期一, 15 一月 2024 11:49:40 +0800
Subject: [PATCH] 设备监控上报设备状态信息接口

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
index 3cdb4be..f0777d6 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -10,6 +10,7 @@
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
@@ -475,18 +476,21 @@
      */
     @AutoLog(value = "璁惧琛�-鎵嬪姩涓婃姤璁惧寮傚父鍙婅鏄�")
     @ApiOperation(value = "璁惧琛�-鎵嬪姩涓婃姤璁惧寮傚父鍙婅鏄�", notes = "璁惧琛�-鎵嬪姩涓婃姤璁惧寮傚父鍙婅鏄�")
-    @PostMapping("/updateEquipmentStatus")
-    public Result<?> updateEquipmentStatus(@RequestBody MdcEquipmentMonitor mdcEquipmentMonitor) {
+    @GetMapping("/updateEquipmentStatus")
+    public Result<?> updateEquipmentStatus(@RequestParam(name = "id", required = true) String id) {
         Result result = new Result<>();
         try {
-            MdcEquipment mdcEquipment1 = mdcEquipmentService.getById(mdcEquipmentMonitor.getId());
+            MdcEquipment mdcEquipment1 = mdcEquipmentService.getById(id);
             if (mdcEquipment1 == null) {
                 result.error500("鏈壘鍒板搴斿疄浣�");
             } else {
                 LambdaUpdateWrapper<MdcEquipment> updateWrapper = new LambdaUpdateWrapper<MdcEquipment>();
-                updateWrapper.eq(MdcEquipment::getId, mdcEquipmentMonitor.getId());
-                updateWrapper.set(MdcEquipment::getEquipmentStatus, mdcEquipmentMonitor.getEquipmentStatus());
-                updateWrapper.set(MdcEquipment::getEquipmentStatusRemark, mdcEquipmentMonitor.getEquipmentStatusRemark());
+                updateWrapper.eq(MdcEquipment::getId, id);
+                if (CommonConstant.STATUS_NORMAL.equals(mdcEquipment1.getEquipmentStatus())) {
+                    updateWrapper.set(MdcEquipment::getEquipmentStatus, CommonConstant.STATUS_DISABLE);
+                } else {
+                    updateWrapper.set(MdcEquipment::getEquipmentStatus, CommonConstant.STATUS_NORMAL);
+                }
                 mdcEquipmentService.update(updateWrapper);
                 result.success("鍙嶉鎴愬姛!");
             }

--
Gitblit v1.9.3