TRX hai 1 ano
pai
achega
9844d42b3e

+ 5 - 18
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/controller/iot/openAPI/IotThingOpenAPIController.java

@@ -2,9 +2,12 @@ package com.zhongshu.iot.server.core.controller.iot.openAPI;
 
 import com.github.microservice.auth.security.annotations.ResourceAuth;
 import com.github.microservice.auth.security.type.AuthType;
-import com.github.microservice.busInfoModel.thing.*;
-import com.github.microservice.net.ResultContent;
+import com.github.microservice.busInfoModel.thing.IotThing2DeviceModel;
+import com.github.microservice.busInfoModel.thing.IotThing2DeviceSearch;
+import com.github.microservice.busInfoModel.thing.IotThingModel;
+import com.github.microservice.busInfoModel.thing.IotThingSearch;
 import com.github.microservice.models.baseParam.IDParam;
+import com.github.microservice.net.ResultContent;
 import com.zhongshu.iot.server.core.service.iot.IotThing2DeviceService;
 import com.zhongshu.iot.server.core.service.iot.IotThingService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -38,7 +41,6 @@ public class IotThingOpenAPIController {
     @Autowired
     private IotThing2DeviceService iotThing2DeviceService;
 
-
     @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "物模型列表-分页查询")
     @RequestMapping(value = {"page"}, method = {RequestMethod.POST})
@@ -65,19 +67,4 @@ public class IotThingOpenAPIController {
             @Parameter(required = false) IotThing2DeviceSearch param) {
         return iotThing2DeviceService.page(pageable, param);
     }
-
-    @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "删除物模型下的设备")
-    @RequestMapping(value = {"deleteDevice"}, method = {RequestMethod.POST})
-    public ResultContent deleteDevice(@RequestBody IDParam param) {
-        return iotThing2DeviceService.delete(param.getId());
-    }
-
-    @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "物模型绑定设备(手动创建的才行)")
-    @RequestMapping(value = {"bindDevices"}, method = {RequestMethod.POST})
-    public ResultContent bindDevices(@RequestBody IotThing2DeviceBind param) {
-        return iotThing2DeviceService.bindDevices(param);
-    }
-
 }

+ 0 - 120
OneCardIotServer/src/main/java/com/zhongshu/iot/server/core/util/result/ResultContent.java

@@ -1,120 +0,0 @@
-package com.zhongshu.iot.server.core.util.result;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.zhongshu.iot.client.type.ResultState;
-import lombok.*;
-
-import java.util.Optional;
-import java.util.function.Consumer;
-
-/**
- * 结果
- *
- * @param <T>
- */
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-@ToString(callSuper = true)
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class ResultContent<T> {
-
-    //内容
-    @Getter
-    @Setter
-    private T content;
-
-    //状态
-    @Getter
-    @Setter
-    private ResultState state;
-
-    //文本
-    @Getter
-    @Setter
-    private String msg;
-
-    @Getter
-    @Setter
-    private Integer code = 200;
-
-
-    /**
-     * 获取内容
-     *
-     * @return
-     */
-    public Optional<T> optionalContent() {
-        return Optional.ofNullable(this.content);
-    }
-
-    public static <T> ResultContent build(ResultState state, T content) {
-        return ResultContent.builder().state(state).content(content).msg(state.getRemark()).build();
-    }
-
-    public static <T> ResultContent build(ResultState state, T content, String msg) {
-        return ResultContent.builder().state(state).content(content).msg(msg).build();
-    }
-
-    public static <T> ResultContent build(ResultState state, String msg) {
-        return ResultContent.builder().state(state).msg(msg).build();
-    }
-
-    public static <T> ResultContent build(boolean bool) {
-        return build(bool ? ResultState.Success : ResultState.Fail, null);
-    }
-
-    public static <T> ResultContent buildFail(String msg) {
-        return ResultContent.builder().state(ResultState.Fail).code(500).msg(msg).build();
-    }
-
-    public static <T> ResultContent buildFail(String msg, Integer code) {
-        return ResultContent.builder().state(ResultState.Fail).code(code).msg(msg).build();
-    }
-
-    public static <T> ResultContent buildSuccess(String msg) {
-        return build(ResultState.Success, msg);
-    }
-
-    public static <T> ResultContent buildSuccess(T content) {
-        return build(ResultState.Success, content);
-    }
-
-    public static <T> ResultContent buildSuccess() {
-        return build(ResultState.Success, ResultState.Success.getRemark());
-    }
-
-    public static <T> ResultContent build(ResultState state) {
-        return build(state, state.getRemark());
-    }
-
-    public static <T> ResultContent buildContent(T content) {
-        return build(content == null ? ResultState.Fail : ResultState.Success, content);
-    }
-
-    public void ifSuccess(Consumer<? super T> action) {
-        if (isSuccess() && content != null) {
-            action.accept(content);
-        }
-    }
-
-    public void ifSucessOrElse(Consumer<? super T> action, Runnable emptyAction) {
-        if (isSuccess() && content != null) {
-            action.accept(content);
-        } else {
-            emptyAction.run();
-        }
-    }
-
-    private Boolean isSuccess = false;
-
-    public Boolean isSuccess() {
-        return ResultState.Success.equals(this.state);
-    }
-
-    private boolean isFailed = false;
-
-    public boolean isFailed() {
-        return !ResultState.Success.equals(this.state);
-    }
-}