Ver Fonte

远程开门

李天标 há 5 anos atrás
pai
commit
50750d5019

+ 16 - 4
src/main/java/com/shawn/web/controller/TEquipmentController.java

@@ -27,10 +27,7 @@ import com.shawn.util.PushUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import com.shawn.model.dto.ResultMessage;
 import com.shawn.web.controller.base.BaseController;
@@ -194,6 +191,21 @@ public class TEquipmentController extends BaseController<TEquipment, TEquipmentE
                         .setMessage("SUCCESS"));
     }
 
+
+    //远程开门
+    @PostMapping("/openDoor")
+    public ResponseEntity<?> openDoor(@RequestBody StatisticsParam param) {
+        String equipmentId = param.getEquipmentId();
+        Long id = Long.valueOf(equipmentId);
+        TEquipment equipment = tEquipmentService.selectEntityById(id);
+        PushUtils.push(equipment.getGtClientId(), "", "", PushUtils.buildJson("openDoor", "0").toString());
+        return ResponseEntity
+                .status(HttpStatus.OK)
+                .body(new ResultMessage()
+                        .setCode(true)
+                        .setData("SUCCESS")
+                        .setMessage("SUCCESS"));
+    }
     //机器睡眠
     @PostMapping("/sleep")
     public ResponseEntity<?> sleep(@RequestBody StatisticsParam param) {