#update
This commit is contained in:
@@ -6,9 +6,11 @@ import com.maibu.core.business.dto.DeviceConfigDTO;
|
||||
import com.maibu.core.controller.BaseController;
|
||||
import com.maibu.core.domain.AjaxResult;
|
||||
import com.maibu.core.page.TableDataInfo;
|
||||
import com.maibu.domain.SysLogininfor;
|
||||
import com.maibu.memory.GlobalMemory;
|
||||
import com.maibu.service.impl.IotDeviceCommonService;
|
||||
import com.maibu.utils.ServletUtils;
|
||||
import com.maibu.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -29,6 +31,50 @@ public class SysIotCommDeviceController extends BaseController {
|
||||
@Autowired
|
||||
private IotDeviceCommonService deviceService;
|
||||
|
||||
|
||||
/**
|
||||
* 设备录入:连接测试成功后 → 放入未注册缓存
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("新增设备")
|
||||
public AjaxResult save(@RequestBody IoTCommonDevice deviceDTO) {
|
||||
if (StringUtils.isEmpty(deviceDTO.getSn())) {
|
||||
return AjaxResult.error("设备名称和 SN 不能为空");
|
||||
}
|
||||
try {
|
||||
deviceService.save(deviceDTO);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("设备连接失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备录入:连接测试成功后 → 放入未注册缓存
|
||||
*/
|
||||
@PostMapping("/unRegister")
|
||||
@ApiOperation("新增设备")
|
||||
public TableDataInfo unRegister() {
|
||||
startPage();
|
||||
List<IoTCommonDevice> list = deviceService.getUnRegisterDevices();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备录入:连接测试成功后 → 放入未注册缓存
|
||||
*/
|
||||
@PostMapping("/register")
|
||||
@ApiOperation("新增设备")
|
||||
public AjaxResult register(@RequestBody IoTCommonDevice deviceDTO) {
|
||||
try {
|
||||
deviceService.registerDevice(deviceDTO);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("设备连接失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设备录入:连接测试成功后 → 放入未注册缓存
|
||||
*/
|
||||
|
||||
@@ -23,8 +23,8 @@ spring:
|
||||
servlet:
|
||||
multipart:
|
||||
enabled: true
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
max-file-size: 50MB
|
||||
max-request-size: 50MB
|
||||
|
||||
|
||||
# mqtt 配置
|
||||
|
||||
Reference in New Issue
Block a user