Commit ff112b8f by 罗志长

feat: 设备配网前校验

parent 7ab531ac
package com.makeit.module.controller.wechat.device;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.makeit.common.dto.BaseIdDTO;
import com.makeit.common.page.PageReqDTO;
......@@ -14,6 +15,7 @@ import com.makeit.dto.wechat.device.PlatDeviceNetAttrWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.entity.platform.auth.PlatOrg;
import com.makeit.entity.platform.auth.PlatRole;
import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.enums.HeaderConst;
import com.makeit.global.annotation.AuthIgnore;
import com.makeit.module.iot.vo.DeviceProperties;
......@@ -29,10 +31,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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 java.util.List;
import java.util.stream.Collectors;
......@@ -80,6 +79,15 @@ public class PlatDeviceWechatController {
return ApiResponseUtils.success(platDeviceService.viewByDeviceId(baseIdDTO.getId()));
}
@ApiOperation("配网前校验")
@PostMapping("setUpCheck")
public ApiResponseEntity<?> setUpCheck(@RequestParam String oriDeviceId) {
PlatDevice platDevice = platDeviceService.getOne(new QueryWrapper<PlatDevice>().lambda()
.eq(PlatDevice::getOriDeviceId, oriDeviceId)
.last("limit 1"));
return ApiResponseUtils.success(platDevice != null);
}
@ApiOperation("配网")
@PostMapping("setUp")
public ApiResponseEntity<?> setup(@Validated @RequestBody PlatDeviceSetupDTO dto) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment