mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
发布v1.1版本
This commit is contained in:
80
springboot/wumei-iot/pom.xml
Normal file
80
springboot/wumei-iot/pom.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>wumei</artifactId>
|
||||
<groupId>com.wumei</groupId>
|
||||
<version>3.8.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wumei-iot</artifactId>
|
||||
|
||||
<description>
|
||||
物美智能-开源生活物联网平台
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.wumei</groupId>
|
||||
<artifactId>wumei-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wumei</groupId>
|
||||
<artifactId>wumei-framework</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wumei</groupId>
|
||||
<artifactId>wumei-quartz</artifactId>
|
||||
</dependency>
|
||||
<!-- oauth2-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth</groupId>
|
||||
<artifactId>spring-security-oauth2</artifactId>
|
||||
<version>2.5.1.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<!-- mqtt-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
<!--AES-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>5.2.3.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.wumei</groupId>
|
||||
<artifactId>wumei-quartz</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.Alert;
|
||||
import com.ruoyi.iot.service.IAlertService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备告警Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/alert")
|
||||
public class AlertController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAlertService alertService;
|
||||
|
||||
/**
|
||||
* 查询设备告警列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Alert alert)
|
||||
{
|
||||
startPage();
|
||||
List<Alert> list = alertService.selectAlertList(alert);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备告警列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:export')")
|
||||
@Log(title = "设备告警", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Alert alert)
|
||||
{
|
||||
List<Alert> list = alertService.selectAlertList(alert);
|
||||
ExcelUtil<Alert> util = new ExcelUtil<Alert>(Alert.class);
|
||||
util.exportExcel(response, list, "设备告警数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备告警详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||
@GetMapping(value = "/{alertId}")
|
||||
public AjaxResult getInfo(@PathVariable("alertId") Long alertId)
|
||||
{
|
||||
return AjaxResult.success(alertService.selectAlertByAlertId(alertId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备告警
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||
@Log(title = "设备告警", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Alert alert)
|
||||
{
|
||||
return toAjax(alertService.insertAlert(alert));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备告警
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@Log(title = "设备告警", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Alert alert)
|
||||
{
|
||||
return toAjax(alertService.updateAlert(alert));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备告警
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
||||
@Log(title = "设备告警", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{alertIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] alertIds)
|
||||
{
|
||||
return toAjax(alertService.deleteAlertByAlertIds(alertIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.AlertLog;
|
||||
import com.ruoyi.iot.service.IAlertLogService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备告警Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/alertLog")
|
||||
public class AlertLogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAlertLogService alertLogService;
|
||||
|
||||
/**
|
||||
* 查询设备告警列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:alertLog:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AlertLog alertLog)
|
||||
{
|
||||
startPage();
|
||||
List<AlertLog> list = alertLogService.selectAlertLogList(alertLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备告警列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:alertLog:export')")
|
||||
@Log(title = "设备告警", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AlertLog alertLog)
|
||||
{
|
||||
List<AlertLog> list = alertLogService.selectAlertLogList(alertLog);
|
||||
ExcelUtil<AlertLog> util = new ExcelUtil<AlertLog>(AlertLog.class);
|
||||
util.exportExcel(response, list, "设备告警数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备告警详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:alertLog:query')")
|
||||
@GetMapping(value = "/{alertLogId}")
|
||||
public AjaxResult getInfo(@PathVariable("alertLogId") Long alertLogId)
|
||||
{
|
||||
return AjaxResult.success(alertLogService.selectAlertLogByAlertLogId(alertLogId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备告警
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:alertLog:add')")
|
||||
@Log(title = "设备告警", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AlertLog alertLog)
|
||||
{
|
||||
return toAjax(alertLogService.insertAlertLog(alertLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备告警
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:alertLog:edit')")
|
||||
@Log(title = "设备告警", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AlertLog alertLog)
|
||||
{
|
||||
return toAjax(alertLogService.updateAlertLog(alertLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备告警
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:alertLog:remove')")
|
||||
@Log(title = "设备告警", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{alertLogIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] alertLogIds)
|
||||
{
|
||||
return toAjax(alertLogService.deleteAlertLogByAlertLogIds(alertLogIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.iot.domain.Alert;
|
||||
import com.ruoyi.iot.service.IAlertService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备告警Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/oauth/resource")
|
||||
public class AuthResourceController extends BaseController
|
||||
{
|
||||
/**
|
||||
* 查询设备告警列表
|
||||
*/
|
||||
@GetMapping("/product")
|
||||
public String findAll() {
|
||||
return "查询产品列表成功!";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.Category;
|
||||
import com.ruoyi.iot.service.ICategoryService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 产品分类Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Api(tags = "产品分类")
|
||||
@RestController
|
||||
@RequestMapping("/iot/category")
|
||||
public class CategoryController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ICategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 查询产品分类列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:category:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("分类分页列表")
|
||||
public TableDataInfo list(Category category)
|
||||
{
|
||||
startPage();
|
||||
List<Category> list = categoryService.selectCategoryList(category);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品简短分类列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:category:list')")
|
||||
@GetMapping("/shortlist")
|
||||
@ApiOperation("分类简短列表")
|
||||
public AjaxResult shortlist()
|
||||
{
|
||||
List<IdAndName> list = categoryService.selectCategoryShortList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品分类列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:category:export')")
|
||||
@Log(title = "产品分类", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出分类")
|
||||
public void export(HttpServletResponse response, Category category)
|
||||
{
|
||||
List<Category> list = categoryService.selectCategoryList(category);
|
||||
ExcelUtil<Category> util = new ExcelUtil<Category>(Category.class);
|
||||
util.exportExcel(response, list, "产品分类数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品分类详细信息
|
||||
*/
|
||||
@ApiOperation("获取分类详情")
|
||||
@PreAuthorize("@ss.hasPermi('iot:category:query')")
|
||||
@GetMapping(value = "/{categoryId}")
|
||||
public AjaxResult getInfo(@PathVariable("categoryId") Long categoryId)
|
||||
{
|
||||
return AjaxResult.success(categoryService.selectCategoryByCategoryId(categoryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:category:add')")
|
||||
@Log(title = "产品分类", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加分类")
|
||||
public AjaxResult add(@RequestBody Category category)
|
||||
{
|
||||
return toAjax(categoryService.insertCategory(category));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:category:edit')")
|
||||
@Log(title = "产品分类", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改分类")
|
||||
public AjaxResult edit(@RequestBody Category category)
|
||||
{
|
||||
return toAjax(categoryService.updateCategory(category));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品分类
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:category:remove')")
|
||||
@Log(title = "产品分类", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{categoryIds}")
|
||||
@ApiOperation("批量删除分类")
|
||||
public AjaxResult remove(@PathVariable Long[] categoryIds)
|
||||
{
|
||||
return categoryService.deleteCategoryByCategoryIds(categoryIds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.iot.domain.Device;
|
||||
import com.ruoyi.iot.model.DeviceAllShortOutput;
|
||||
import com.ruoyi.iot.model.DeviceShortOutput;
|
||||
import com.ruoyi.iot.service.IDeviceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Api(tags = "设备管理")
|
||||
@RestController
|
||||
@RequestMapping("/iot/device")
|
||||
public class DeviceController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDeviceService deviceService;
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("设备分页列表")
|
||||
public TableDataInfo list(Device device)
|
||||
{
|
||||
startPage();
|
||||
List<Device> list = deviceService.selectDeviceList(device);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备简短列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/shortList")
|
||||
@ApiOperation("设备分页简短列表")
|
||||
public TableDataInfo shortList(Device device)
|
||||
{
|
||||
startPage();
|
||||
List<DeviceShortOutput> list = deviceService.selectDeviceShortList(device);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有设备简短列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/all")
|
||||
@ApiOperation("查询所有设备简短列表")
|
||||
public TableDataInfo allShortList()
|
||||
{
|
||||
List<DeviceAllShortOutput> list = deviceService.selectAllDeviceShortList();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:export')")
|
||||
@Log(title = "设备", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出设备")
|
||||
public void export(HttpServletResponse response, Device device)
|
||||
{
|
||||
List<Device> list = deviceService.selectDeviceList(device);
|
||||
ExcelUtil<Device> util = new ExcelUtil<Device>(Device.class);
|
||||
util.exportExcel(response, list, "设备数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||
@GetMapping(value = "/{deviceId}")
|
||||
@ApiOperation("获取设备详情")
|
||||
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId)
|
||||
{
|
||||
return AjaxResult.success(deviceService.selectDeviceByDeviceId(deviceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||
@GetMapping(value = "/runningStatus/{deviceId}")
|
||||
@ApiOperation("获取设备详情和运行状态")
|
||||
public AjaxResult getRunningStatusInfo(@PathVariable("deviceId") Long deviceId)
|
||||
{
|
||||
return AjaxResult.success(deviceService.selectDeviceRunningStatusByDeviceId(deviceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||
@Log(title = "设备", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加设备")
|
||||
public AjaxResult add(@RequestBody Device device)
|
||||
{
|
||||
return AjaxResult.success(deviceService.insertDevice(device));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@Log(title = "设备", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改设备")
|
||||
public AjaxResult edit(@RequestBody Device device)
|
||||
{
|
||||
return toAjax(deviceService.updateDevice(device));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
||||
@Log(title = "设备", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deviceIds}")
|
||||
@ApiOperation("批量删除设备")
|
||||
public AjaxResult remove(@PathVariable Long[] deviceIds) throws SchedulerException {
|
||||
return toAjax(deviceService.deleteDeviceByDeviceIds(deviceIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@GetMapping("/generator")
|
||||
@ApiOperation("生成设备编号")
|
||||
public AjaxResult generatorDeviceNum(){
|
||||
return AjaxResult.success("操作成功",deviceService.generationDeviceNum());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.exception.job.TaskException;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.iot.domain.DeviceJob;
|
||||
import com.ruoyi.iot.service.IDeviceJobService;
|
||||
import com.ruoyi.quartz.util.CronUtils;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调度任务信息操作处理
|
||||
*
|
||||
* @author kerwincui
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/job")
|
||||
public class DeviceJobController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDeviceJobService jobService;
|
||||
|
||||
/**
|
||||
* 查询定时任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeviceJob deviceJob)
|
||||
{
|
||||
startPage();
|
||||
List<DeviceJob> list = jobService.selectJobList(deviceJob);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出定时任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:export')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DeviceJob deviceJob)
|
||||
{
|
||||
List<DeviceJob> list = jobService.selectJobList(deviceJob);
|
||||
ExcelUtil<DeviceJob> util = new ExcelUtil<DeviceJob>(DeviceJob.class);
|
||||
util.exportExcel(response, list, "定时任务");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取定时任务详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||
@GetMapping(value = "/{jobId}")
|
||||
public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
|
||||
{
|
||||
return AjaxResult.success(jobService.selectJobById(jobId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增定时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DeviceJob job) throws SchedulerException, TaskException
|
||||
{
|
||||
if (!CronUtils.isValid(job.getCronExpression()))
|
||||
{
|
||||
return error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
||||
}
|
||||
job.setCreateBy(getUsername());
|
||||
return toAjax(jobService.insertJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改定时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DeviceJob job) throws SchedulerException, TaskException
|
||||
{
|
||||
if (!CronUtils.isValid(job.getCronExpression()))
|
||||
{
|
||||
return error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
||||
}
|
||||
job.setUpdateBy(getUsername());
|
||||
return toAjax(jobService.updateJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody DeviceJob job) throws SchedulerException
|
||||
{
|
||||
DeviceJob newJob = jobService.selectJobById(job.getJobId());
|
||||
newJob.setStatus(job.getStatus());
|
||||
return toAjax(jobService.changeStatus(newJob));
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务立即执行一次
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/run")
|
||||
public AjaxResult run(@RequestBody DeviceJob job) throws SchedulerException
|
||||
{
|
||||
jobService.run(job);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{jobIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException
|
||||
{
|
||||
jobService.deleteJobByIds(jobIds);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.iot.domain.DeviceLog;
|
||||
import com.ruoyi.iot.model.MonitorModel;
|
||||
import com.ruoyi.iot.service.IDeviceLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备日志Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/deviceLog")
|
||||
public class DeviceLogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDeviceLogService deviceLogService;
|
||||
|
||||
/**
|
||||
* 查询设备日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeviceLog deviceLog)
|
||||
{
|
||||
startPage();
|
||||
List<DeviceLog> list = deviceLogService.selectDeviceLogList(deviceLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备的监测数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/monitor")
|
||||
public TableDataInfo monitorList(DeviceLog deviceLog)
|
||||
{
|
||||
List<MonitorModel> list = deviceLogService.selectMonitorList(deviceLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:export')")
|
||||
@Log(title = "设备日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DeviceLog deviceLog)
|
||||
{
|
||||
List<DeviceLog> list = deviceLogService.selectDeviceLogList(deviceLog);
|
||||
ExcelUtil<DeviceLog> util = new ExcelUtil<DeviceLog>(DeviceLog.class);
|
||||
util.exportExcel(response, list, "设备日志数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备日志详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||
@GetMapping(value = "/{logId}")
|
||||
public AjaxResult getInfo(@PathVariable("logId") Long logId)
|
||||
{
|
||||
return AjaxResult.success(deviceLogService.selectDeviceLogByLogId(logId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||
@Log(title = "设备日志", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DeviceLog deviceLog)
|
||||
{
|
||||
return toAjax(deviceLogService.insertDeviceLog(deviceLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@Log(title = "设备日志", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DeviceLog deviceLog)
|
||||
{
|
||||
return toAjax(deviceLogService.updateDeviceLog(deviceLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
||||
@Log(title = "设备日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{logIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] logIds)
|
||||
{
|
||||
return toAjax(deviceLogService.deleteDeviceLogByLogIds(logIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.iot.domain.Firmware;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.DeviceUser;
|
||||
import com.ruoyi.iot.service.IDeviceUserService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备用户Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Api(tags = "设备用户")
|
||||
@RestController
|
||||
@RequestMapping("/iot/deviceUser")
|
||||
public class DeviceUserController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDeviceUserService deviceUserService;
|
||||
|
||||
/**
|
||||
* 查询设备用户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("设备用户分页列表")
|
||||
public TableDataInfo list(DeviceUser deviceUser)
|
||||
{
|
||||
startPage();
|
||||
List<DeviceUser> list = deviceUserService.selectDeviceUserList(deviceUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备用户详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||
@GetMapping(value = "/{deviceId}")
|
||||
@ApiOperation("获取设备用户详情")
|
||||
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId)
|
||||
{
|
||||
return AjaxResult.success(deviceUserService.selectDeviceUserByDeviceId(deviceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||
@Log(title = "设备用户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加设备用户")
|
||||
public AjaxResult add(@RequestBody DeviceUser deviceUser)
|
||||
{
|
||||
return toAjax(deviceUserService.insertDeviceUser(deviceUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备用户
|
||||
*/
|
||||
@ApiOperation("修改设备用户")
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@Log(title = "设备用户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DeviceUser deviceUser)
|
||||
{
|
||||
return toAjax(deviceUserService.updateDeviceUser(deviceUser));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除设备用户
|
||||
*/
|
||||
@ApiOperation("批量删除设备用户")
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
||||
@Log(title = "设备用户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deviceIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] deviceIds)
|
||||
{
|
||||
int count=deviceUserService.deleteDeviceUserByDeviceIds(deviceIds);
|
||||
if(count==0){
|
||||
return AjaxResult.error("设备所有者不能删除");
|
||||
}else{
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.Firmware;
|
||||
import com.ruoyi.iot.service.IFirmwareService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 产品固件Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Api(tags = "产品固件")
|
||||
@RestController
|
||||
@RequestMapping("/iot/firmware")
|
||||
public class FirmwareController extends BaseController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(FirmwareController.class);
|
||||
|
||||
@Autowired
|
||||
private IFirmwareService firmwareService;
|
||||
|
||||
/**
|
||||
* 查询产品固件列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:firmware:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("产品固件分页列表")
|
||||
public TableDataInfo list(Firmware firmware)
|
||||
{
|
||||
startPage();
|
||||
List<Firmware> list = firmwareService.selectFirmwareList(firmware);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品固件列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:firmware:export')")
|
||||
@Log(title = "产品固件", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出固件")
|
||||
public void export(HttpServletResponse response, Firmware firmware)
|
||||
{
|
||||
List<Firmware> list = firmwareService.selectFirmwareList(firmware);
|
||||
ExcelUtil<Firmware> util = new ExcelUtil<Firmware>(Firmware.class);
|
||||
util.exportExcel(response, list, "产品固件数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品固件详细信息
|
||||
*/
|
||||
@ApiOperation("获取固件详情")
|
||||
@PreAuthorize("@ss.hasPermi('iot:firmware:query')")
|
||||
@GetMapping(value = "/{firmwareId}")
|
||||
public AjaxResult getInfo(@PathVariable("firmwareId") Long firmwareId)
|
||||
{
|
||||
return AjaxResult.success(firmwareService.selectFirmwareByFirmwareId(firmwareId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品固件
|
||||
*/
|
||||
@ApiOperation("添加产品固件")
|
||||
@PreAuthorize("@ss.hasPermi('iot:firmware:add')")
|
||||
@Log(title = "产品固件", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Firmware firmware)
|
||||
{
|
||||
return toAjax(firmwareService.insertFirmware(firmware));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品固件
|
||||
*/
|
||||
@ApiOperation("修改产品固件")
|
||||
@PreAuthorize("@ss.hasPermi('iot:firmware:edit')")
|
||||
@Log(title = "产品固件", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Firmware firmware)
|
||||
{
|
||||
return toAjax(firmwareService.updateFirmware(firmware));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品固件
|
||||
*/
|
||||
@ApiOperation("批量删除产品固件")
|
||||
@PreAuthorize("@ss.hasPermi('iot:firmware:remove')")
|
||||
@Log(title = "产品固件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{firmwareIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] firmwareIds)
|
||||
{
|
||||
return toAjax(firmwareService.deleteFirmwareByFirmwareIds(firmwareIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.iot.domain.DeviceGroup;
|
||||
import com.ruoyi.iot.model.DeviceGroupInput;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.Group;
|
||||
import com.ruoyi.iot.service.IGroupService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备分组Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Api(tags = "设备分组")
|
||||
@RestController
|
||||
@RequestMapping("/iot/group")
|
||||
public class GroupController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IGroupService groupService;
|
||||
|
||||
/**
|
||||
* 查询设备分组列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:group:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("分组分页列表")
|
||||
public TableDataInfo list(Group group)
|
||||
{
|
||||
startPage();
|
||||
List<Group> list = groupService.selectGroupList(group);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备分组列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:group:export')")
|
||||
@Log(title = "分组", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出分组")
|
||||
public void export(HttpServletResponse response, Group group)
|
||||
{
|
||||
List<Group> list = groupService.selectGroupList(group);
|
||||
ExcelUtil<Group> util = new ExcelUtil<Group>(Group.class);
|
||||
util.exportExcel(response, list, "设备分组数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备分组详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:group:query')")
|
||||
@GetMapping(value = "/{groupId}")
|
||||
@ApiOperation("获取分组详情")
|
||||
public AjaxResult getInfo(@PathVariable("groupId") Long groupId)
|
||||
{
|
||||
return AjaxResult.success(groupService.selectGroupByGroupId(groupId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分组下的所有关联设备ID数组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:group:query')")
|
||||
@GetMapping(value = "/getDeviceIds/{groupId}")
|
||||
@ApiOperation("获取分组下的所有关联设备ID数组")
|
||||
public AjaxResult getDeviceIds(@PathVariable("groupId") Long groupId)
|
||||
{
|
||||
return AjaxResult.success(groupService.selectDeviceIdsByGroupId(groupId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备分组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:group:add')")
|
||||
@Log(title = "分组", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加分组")
|
||||
public AjaxResult add(@RequestBody Group group)
|
||||
{
|
||||
return toAjax(groupService.insertGroup(group));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分组下的关联设备
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:group:edit')")
|
||||
@Log(title = "设备分组", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updateDeviceGroups")
|
||||
@ApiOperation("更新分组下的关联设备")
|
||||
public AjaxResult updateDeviceGroups(@RequestBody DeviceGroupInput input){
|
||||
return toAjax(groupService.updateDeviceGroups(input));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备分组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:group:edit')")
|
||||
@Log(title = "分组", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改分组")
|
||||
public AjaxResult edit(@RequestBody Group group)
|
||||
{
|
||||
return toAjax(groupService.updateGroup(group));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备分组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:group:remove')")
|
||||
@Log(title = "分组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{groupIds}")
|
||||
@ApiOperation("批量删除设备分组")
|
||||
public AjaxResult remove(@PathVariable Long[] groupIds)
|
||||
{
|
||||
return toAjax(groupService.deleteGroupByGroupIds(groupIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.OauthClientDetails;
|
||||
import com.ruoyi.iot.service.IOauthClientDetailsService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 云云对接Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-02-07
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/clientDetails")
|
||||
public class OauthClientDetailsController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IOauthClientDetailsService oauthClientDetailsService;
|
||||
|
||||
/**
|
||||
* 查询云云对接列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:clientDetails:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(OauthClientDetails oauthClientDetails)
|
||||
{
|
||||
startPage();
|
||||
List<OauthClientDetails> list = oauthClientDetailsService.selectOauthClientDetailsList(oauthClientDetails);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出云云对接列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:clientDetails:export')")
|
||||
@Log(title = "云云对接", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, OauthClientDetails oauthClientDetails)
|
||||
{
|
||||
List<OauthClientDetails> list = oauthClientDetailsService.selectOauthClientDetailsList(oauthClientDetails);
|
||||
ExcelUtil<OauthClientDetails> util = new ExcelUtil<OauthClientDetails>(OauthClientDetails.class);
|
||||
util.exportExcel(response, list, "云云对接数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取云云对接详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:clientDetails:query')")
|
||||
@GetMapping(value = "/{clientId}")
|
||||
public AjaxResult getInfo(@PathVariable("clientId") String clientId)
|
||||
{
|
||||
return AjaxResult.success(oauthClientDetailsService.selectOauthClientDetailsByClientId(clientId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增云云对接
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:clientDetails:add')")
|
||||
@Log(title = "云云对接", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody OauthClientDetails oauthClientDetails)
|
||||
{
|
||||
return toAjax(oauthClientDetailsService.insertOauthClientDetails(oauthClientDetails));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改云云对接
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:clientDetails:edit')")
|
||||
@Log(title = "云云对接", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody OauthClientDetails oauthClientDetails)
|
||||
{
|
||||
return toAjax(oauthClientDetailsService.updateOauthClientDetails(oauthClientDetails));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除云云对接
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:clientDetails:remove')")
|
||||
@Log(title = "云云对接", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{clientIds}")
|
||||
public AjaxResult remove(@PathVariable String[] clientIds)
|
||||
{
|
||||
return toAjax(oauthClientDetailsService.deleteOauthClientDetailsByClientIds(clientIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.iot.domain.Product;
|
||||
import com.ruoyi.iot.model.ChangeProductStatusModel;
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
import com.ruoyi.iot.service.IProductService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Api(tags = "产品管理")
|
||||
@RestController
|
||||
@RequestMapping("/iot/product")
|
||||
public class ProductController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IProductService productService;
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("产品分页列表")
|
||||
public TableDataInfo list(Product product)
|
||||
{
|
||||
startPage();
|
||||
List<Product> list = productService.selectProductList(product);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询产品简短列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:list')")
|
||||
@GetMapping("/shortList")
|
||||
@ApiOperation("产品简短列表")
|
||||
public AjaxResult shortList()
|
||||
{
|
||||
List<IdAndName> list = productService.selectProductShortList();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出产品列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:export')")
|
||||
@Log(title = "产品", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出产品")
|
||||
public void export(HttpServletResponse response, Product product)
|
||||
{
|
||||
List<Product> list = productService.selectProductList(product);
|
||||
ExcelUtil<Product> util = new ExcelUtil<Product>(Product.class);
|
||||
util.exportExcel(response, list, "产品数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:query')")
|
||||
@GetMapping(value = "/{productId}")
|
||||
@ApiOperation("获取产品详情")
|
||||
public AjaxResult getInfo(@PathVariable("productId") Long productId)
|
||||
{
|
||||
return AjaxResult.success(productService.selectProductByProductId(productId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:add')")
|
||||
@Log(title = "产品", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加产品")
|
||||
public AjaxResult add(@RequestBody Product product)
|
||||
{
|
||||
return AjaxResult.success(productService.insertProduct(product));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:edit')")
|
||||
@Log(title = "产品", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改产品")
|
||||
public AjaxResult edit(@RequestBody Product product)
|
||||
{
|
||||
return toAjax(productService.updateProduct(product));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布产品
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:edit')")
|
||||
@Log(title = "更新产品状态", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/status")
|
||||
@ApiOperation("更新产品状态")
|
||||
public AjaxResult changeProductStatus(@RequestBody ChangeProductStatusModel model)
|
||||
{
|
||||
return productService.changeProductStatus(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:remove')")
|
||||
@Log(title = "产品", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{productIds}")
|
||||
@ApiOperation("批量删除产品")
|
||||
public AjaxResult remove(@PathVariable Long[] productIds)
|
||||
{
|
||||
return productService.deleteProductByProductIds(productIds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.Scene;
|
||||
import com.ruoyi.iot.service.ISceneService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 场景联动Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/scene")
|
||||
public class SceneController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISceneService sceneService;
|
||||
|
||||
/**
|
||||
* 查询场景联动列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:scene:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Scene scene)
|
||||
{
|
||||
startPage();
|
||||
List<Scene> list = sceneService.selectSceneList(scene);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出场景联动列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:scene:export')")
|
||||
@Log(title = "场景联动", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Scene scene)
|
||||
{
|
||||
List<Scene> list = sceneService.selectSceneList(scene);
|
||||
ExcelUtil<Scene> util = new ExcelUtil<Scene>(Scene.class);
|
||||
util.exportExcel(response, list, "场景联动数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取场景联动详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:scene:query')")
|
||||
@GetMapping(value = "/{sceneId}")
|
||||
public AjaxResult getInfo(@PathVariable("sceneId") Long sceneId)
|
||||
{
|
||||
return AjaxResult.success(sceneService.selectSceneBySceneId(sceneId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增场景联动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:scene:add')")
|
||||
@Log(title = "场景联动", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Scene scene)
|
||||
{
|
||||
return toAjax(sceneService.insertScene(scene));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改场景联动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:scene:edit')")
|
||||
@Log(title = "场景联动", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Scene scene)
|
||||
{
|
||||
return toAjax(sceneService.updateScene(scene));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除场景联动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:scene:remove')")
|
||||
@Log(title = "场景联动", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{sceneIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] sceneIds)
|
||||
{
|
||||
return toAjax(sceneService.deleteSceneBySceneIds(sceneIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.iot.model.ImportThingsModelInput;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.ThingsModel;
|
||||
import com.ruoyi.iot.service.IThingsModelService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 物模型Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/model")
|
||||
@Api(tags="产品物模型")
|
||||
public class ThingsModelController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IThingsModelService thingsModelService;
|
||||
|
||||
/**
|
||||
* 查询物模型列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("产品物模型分页列表")
|
||||
public TableDataInfo list(ThingsModel thingsModel)
|
||||
{
|
||||
startPage();
|
||||
List<ThingsModel> list = thingsModelService.selectThingsModelList(thingsModel);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物模型详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||
@GetMapping(value = "/{modelId}")
|
||||
@ApiOperation("获取产品物模型详情")
|
||||
public AjaxResult getInfo(@PathVariable("modelId") Long modelId)
|
||||
{
|
||||
return AjaxResult.success(thingsModelService.selectThingsModelByModelId(modelId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||
@Log(title = "物模型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加产品物模型")
|
||||
public AjaxResult add(@RequestBody ThingsModel thingsModel)
|
||||
{
|
||||
int result=thingsModelService.insertThingsModel(thingsModel);
|
||||
if(result==1){
|
||||
return AjaxResult.success();
|
||||
}else if(result==2){
|
||||
return AjaxResult.error("产品下的标识符不能重复");
|
||||
}else{
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "导入物模型",businessType = BusinessType.INSERT)
|
||||
@PostMapping("/import")
|
||||
@ApiOperation("导入通用物模型")
|
||||
public AjaxResult ImportByTemplateIds(@RequestBody ImportThingsModelInput input){
|
||||
int repeatCount=thingsModelService.importByTemplateIds(input);
|
||||
if(repeatCount==0){
|
||||
return AjaxResult.success("数据导入成功");
|
||||
}else{
|
||||
return AjaxResult.success(repeatCount+"条数据未导入,标识符重复");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改物模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:edit')")
|
||||
@Log(title = "物模型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改产品物模型")
|
||||
public AjaxResult edit(@RequestBody ThingsModel thingsModel)
|
||||
{
|
||||
int result=thingsModelService.updateThingsModel(thingsModel);
|
||||
if(result==1){
|
||||
return AjaxResult.success();
|
||||
}else if(result==2){
|
||||
return AjaxResult.error("产品下的标识符不能重复");
|
||||
}else{
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除物模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:remove')")
|
||||
@Log(title = "物模型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{modelIds}")
|
||||
@ApiOperation("批量删除产品物模型")
|
||||
public AjaxResult remove(@PathVariable Long[] modelIds)
|
||||
{
|
||||
return toAjax(thingsModelService.deleteThingsModelByModelIds(modelIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存的JSON物模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:query')")
|
||||
@GetMapping(value = "/cache/{productId}")
|
||||
@ApiOperation("获取缓存的JSON物模型")
|
||||
public AjaxResult getCacheThingsModelByProductId(@PathVariable("productId") Long productId)
|
||||
{
|
||||
return AjaxResult.success("操作成功",thingsModelService.getCacheThingsModelByProductId(productId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.iot.domain.ThingsModelTemplate;
|
||||
import com.ruoyi.iot.service.IThingsModelTemplateService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 通用物模型Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/template")
|
||||
@Api(tags = "通用物模型")
|
||||
public class ThingsModelTemplateController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IThingsModelTemplateService thingsModelTemplateService;
|
||||
|
||||
/**
|
||||
* 查询通用物模型列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:template:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("通用物模型分页列表")
|
||||
public TableDataInfo list(ThingsModelTemplate thingsModelTemplate)
|
||||
{
|
||||
startPage();
|
||||
List<ThingsModelTemplate> list = thingsModelTemplateService.selectThingsModelTemplateList(thingsModelTemplate);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出通用物模型列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:template:export')")
|
||||
@Log(title = "通用物模型", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出通用物模型")
|
||||
public void export(HttpServletResponse response, ThingsModelTemplate thingsModelTemplate)
|
||||
{
|
||||
List<ThingsModelTemplate> list = thingsModelTemplateService.selectThingsModelTemplateList(thingsModelTemplate);
|
||||
ExcelUtil<ThingsModelTemplate> util = new ExcelUtil<ThingsModelTemplate>(ThingsModelTemplate.class);
|
||||
util.exportExcel(response, list, "通用物模型数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通用物模型详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:template:query')")
|
||||
@GetMapping(value = "/{templateId}")
|
||||
@ApiOperation("获取通用物模型详情")
|
||||
public AjaxResult getInfo(@PathVariable("templateId") Long templateId)
|
||||
{
|
||||
return AjaxResult.success(thingsModelTemplateService.selectThingsModelTemplateByTemplateId(templateId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通用物模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:template:add')")
|
||||
@Log(title = "通用物模型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加通用物模型")
|
||||
public AjaxResult add(@RequestBody ThingsModelTemplate thingsModelTemplate)
|
||||
{
|
||||
return toAjax(thingsModelTemplateService.insertThingsModelTemplate(thingsModelTemplate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通用物模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:template:edit')")
|
||||
@Log(title = "通用物模型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改通用物模型")
|
||||
public AjaxResult edit(@RequestBody ThingsModelTemplate thingsModelTemplate)
|
||||
{
|
||||
return toAjax(thingsModelTemplateService.updateThingsModelTemplate(thingsModelTemplate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除通用物模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:template:remove')")
|
||||
@Log(title = "通用物模型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{templateIds}")
|
||||
@ApiOperation("批量删除通用物模型")
|
||||
public AjaxResult remove(@PathVariable Long[] templateIds)
|
||||
{
|
||||
return toAjax(thingsModelTemplateService.deleteThingsModelTemplateByTemplateIds(templateIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
package com.ruoyi.iot.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.iot.domain.Device;
|
||||
import com.ruoyi.iot.model.AuthenticateInputModel;
|
||||
import com.ruoyi.iot.model.DeviceAuthenticateModel;
|
||||
import com.ruoyi.iot.model.MqttClientConnectModel;
|
||||
import com.ruoyi.iot.model.RegisterUserInput;
|
||||
import com.ruoyi.iot.model.ThingsModels.IdentityAndName;
|
||||
import com.ruoyi.iot.model.ThingsModels.ThingsModelValueItem;
|
||||
import com.ruoyi.iot.model.ThingsModels.ThingsModelShadow;
|
||||
import com.ruoyi.iot.mqtt.EmqxService;
|
||||
import com.ruoyi.iot.mqtt.MqttConfig;
|
||||
import com.ruoyi.iot.service.IDeviceService;
|
||||
import com.ruoyi.iot.service.IToolService;
|
||||
import com.ruoyi.iot.service.impl.ThingsModelServiceImpl;
|
||||
import com.ruoyi.iot.util.AESUtils;
|
||||
import com.ruoyi.iot.util.VelocityInitializer;
|
||||
import com.ruoyi.iot.util.VelocityUtils;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static com.ruoyi.common.utils.file.FileUploadUtils.getExtension;
|
||||
|
||||
/**
|
||||
* 产品分类Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Api(tags = "工具相关")
|
||||
@RestController
|
||||
@RequestMapping("/iot/tool")
|
||||
public class ToolController extends BaseController {
|
||||
private static final Logger log = LoggerFactory.getLogger(ToolController.class);
|
||||
|
||||
@Autowired
|
||||
private IDeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
private ThingsModelServiceImpl thingsModelService;
|
||||
|
||||
@Autowired
|
||||
private EmqxService emqxService;
|
||||
|
||||
@Autowired
|
||||
private MqttConfig mqttConfig;
|
||||
|
||||
@Autowired
|
||||
private IToolService toolService;
|
||||
|
||||
// 令牌秘钥
|
||||
@Value("${token.secret}")
|
||||
private String secret;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
*/
|
||||
@ApiOperation("用户注册")
|
||||
@PostMapping("/register")
|
||||
public AjaxResult register(@RequestBody RegisterUserInput user) {
|
||||
String msg = toolService.register(user);
|
||||
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||
}
|
||||
|
||||
@ApiOperation("mqtt认证")
|
||||
@PostMapping("/mqtt/auth")
|
||||
public ResponseEntity mqttAuth(@RequestParam String clientid, @RequestParam String username, @RequestParam String password) throws Exception {
|
||||
try {
|
||||
if (clientid.startsWith("server")) {
|
||||
// 服务端配置账号认证
|
||||
if (mqttConfig.getusername().equals(username) && mqttConfig.getpassword().equals(password)) {
|
||||
System.out.println("-----------认证成功,clientId:" + clientid + "---------------");
|
||||
return ResponseEntity.ok().body("ok");
|
||||
}
|
||||
} else if (clientid.startsWith("web") || clientid.startsWith("phone")) {
|
||||
// web端和手机端token认证
|
||||
String token = password;
|
||||
if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) {
|
||||
token = token.replace(Constants.TOKEN_PREFIX, "");
|
||||
}
|
||||
try {
|
||||
Claims claims = Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
|
||||
System.out.println("-----------认证成功,clientId:" + clientid + "---------------");
|
||||
return ResponseEntity.ok().body("ok");
|
||||
} catch (Exception ex) {
|
||||
return returnUnauthorized(clientid, username, password, ex.getMessage());
|
||||
}
|
||||
} else {
|
||||
// 设备端
|
||||
String[] clientInfo = clientid.split("&");
|
||||
if (clientInfo.length != 2) {
|
||||
// 设备未加密认证
|
||||
if (mqttConfig.getusername().equals(username) && mqttConfig.getpassword().equals(password)) {
|
||||
System.out.println("-----------认证成功,clientId:" + clientid + "---------------");
|
||||
return ResponseEntity.ok().body("ok");
|
||||
}
|
||||
return returnUnauthorized(clientid, username, password, "认证信息有误");
|
||||
}
|
||||
// 设备加密认证
|
||||
String deviceNum = clientInfo[0];
|
||||
Long productId = Long.valueOf(clientInfo[1]);
|
||||
AuthenticateInputModel authenticateInputModel = new AuthenticateInputModel(deviceNum, productId);
|
||||
DeviceAuthenticateModel model = deviceService.selectDeviceAuthenticate(authenticateInputModel);
|
||||
if (model == null) {
|
||||
return returnUnauthorized(clientid, username, password, "认证信息有误");
|
||||
}
|
||||
// 密码解密,密码加密格式 password & productId & userId & expireTime
|
||||
String decryptPassword = AESUtils.decrypt(password, model.getMqttSecret());
|
||||
if (decryptPassword == null || decryptPassword == "") {
|
||||
return returnUnauthorized(clientid, username, password, "认证信息有误");
|
||||
}
|
||||
String[] infos = decryptPassword.split("&");
|
||||
if (infos.length != 3) {
|
||||
return returnUnauthorized(clientid, username, password, "认证信息有误");
|
||||
}
|
||||
String mqttPassword = infos[0];
|
||||
Long userId = Long.valueOf(infos[1]);
|
||||
Long expireTime = Long.valueOf(infos[2]);
|
||||
// 账号密码验证,产品必须为发布状态:1-未发布,2-已发布
|
||||
if (mqttPassword.equals(model.getMqttPassword())
|
||||
&& username.equals(model.getMqttAccount())
|
||||
&& expireTime > System.currentTimeMillis()
|
||||
&& model.getProductStatus() == 2) {
|
||||
|
||||
// 设备状态验证 (1-未激活,2-禁用,3-在线,4-离线)
|
||||
if (model.getDeviceId() != null && model.getDeviceId() != 0 && model.getStatus() != 2) {
|
||||
System.out.println("-----------认证成功,clientId:" + clientid + "---------------");
|
||||
return ResponseEntity.ok().body("ok");
|
||||
} else {
|
||||
// 自动添加设备
|
||||
int result = deviceService.insertDeviceAuto(deviceNum, userId, productId);
|
||||
if (result == 1) {
|
||||
System.out.println("-----------认证成功,clientId:" + clientid + "---------------");
|
||||
return ResponseEntity.ok().body("ok");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
return returnUnauthorized(clientid, username, password, ex.getMessage());
|
||||
}
|
||||
return returnUnauthorized(clientid, username, password, "认证信息有误");
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回认证信息
|
||||
*/
|
||||
private ResponseEntity returnUnauthorized(String clientid, String username, String password, String message) {
|
||||
System.out.println("认证失败:" + message
|
||||
+ "\nclientid:" + clientid
|
||||
+ "\nusername:" + username
|
||||
+ "\npassword:" + password);
|
||||
log.error("认证失败:" + message
|
||||
+ "\nclientid:" + clientid
|
||||
+ "\nusername:" + username
|
||||
+ "\npassword:" + password);
|
||||
return ResponseEntity.status(401).body("Unauthorized");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("mqtt钩子处理")
|
||||
@PostMapping("/mqtt/webhook")
|
||||
public AjaxResult webHookProcess(@RequestBody MqttClientConnectModel model) {
|
||||
try {
|
||||
System.out.println("webhook:" + model.getAction());
|
||||
// 过滤服务端、web端和手机端
|
||||
if (model.getClientid().startsWith("server") || model.getClientid().startsWith("web") || model.getClientid().startsWith("phone")) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
String[] clientInfo = model.getClientid().split("&");
|
||||
String deviceNum = clientInfo[0];
|
||||
Device device = deviceService.selectShortDeviceBySerialNumber(deviceNum);
|
||||
// 设备状态(1-未激活,2-禁用,3-在线,4-离线)
|
||||
if (model.getAction().equals("client_disconnected")) {
|
||||
device.setStatus(4);
|
||||
deviceService.updateDeviceStatusAndLocation(device, "");
|
||||
// 发布设备状态
|
||||
emqxService.publishStatus(device.getProductId(), device.getSerialNumber(), 4, device.getIsShadow());
|
||||
// 清空保留消息,上线后发布新的属性功能保留消息
|
||||
emqxService.publishProperty(device.getProductId(), device.getSerialNumber(), null);
|
||||
emqxService.publishFunction(device.getProductId(), device.getSerialNumber(), null);
|
||||
} else if (model.getAction().equals("client_connected")) {
|
||||
device.setStatus(3);
|
||||
deviceService.updateDeviceStatusAndLocation(device, model.getIpaddress());
|
||||
// 发布设备状态
|
||||
emqxService.publishStatus(device.getProductId(), device.getSerialNumber(), 3, device.getIsShadow());
|
||||
// 影子模式,发布属性和功能
|
||||
if (device.getIsShadow() == 1) {
|
||||
ThingsModelShadow shadow = deviceService.getDeviceShadowThingsModel(device);
|
||||
if (shadow.getProperties().size() > 0) {
|
||||
emqxService.publishProperty(device.getProductId(), device.getSerialNumber(), shadow.getProperties());
|
||||
}
|
||||
if (shadow.getFunctions().size() > 0) {
|
||||
emqxService.publishFunction(device.getProductId(), device.getSerialNumber(), shadow.getFunctions());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
log.error("发生错误:" + ex.getMessage());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取NTP时间")
|
||||
@GetMapping("/ntp")
|
||||
public JSONObject ntp(@RequestParam Long deviceSendTime) {
|
||||
JSONObject ntpJson = new JSONObject();
|
||||
ntpJson.put("deviceSendTime", deviceSendTime);
|
||||
ntpJson.put("serverRecvTime", System.currentTimeMillis());
|
||||
ntpJson.put("serverSendTime", System.currentTimeMillis());
|
||||
return ntpJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
@ApiOperation("文件上传")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||
try {
|
||||
String filePath = RuoYiConfig.getProfile();
|
||||
// 文件名长度限制
|
||||
int fileNamelength = file.getOriginalFilename().length();
|
||||
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
|
||||
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
|
||||
}
|
||||
// 文件类型限制
|
||||
// assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||
|
||||
// 获取文件名和文件类型
|
||||
String fileName = file.getOriginalFilename();
|
||||
String extension = getExtension(file);
|
||||
//设置日期格式
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MMdd-HHmmss");
|
||||
fileName = "/iot/" + getLoginUser().getUserId().toString() + "/" + df.format(new Date()) + "." + extension;
|
||||
//创建目录
|
||||
File desc = new File(filePath + File.separator + fileName);
|
||||
if (!desc.exists()) {
|
||||
if (!desc.getParentFile().exists()) {
|
||||
desc.getParentFile().mkdirs();
|
||||
}
|
||||
}
|
||||
// 存储文件
|
||||
file.transferTo(desc);
|
||||
|
||||
String url = "/profile" + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", url);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
@ApiOperation("文件下载")
|
||||
@GetMapping("/download")
|
||||
public void download(String fileName, HttpServletResponse response, HttpServletRequest request) {
|
||||
try {
|
||||
// if (!FileUtils.checkAllowDownload(fileName)) {
|
||||
// throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
// }
|
||||
String filePath = RuoYiConfig.getProfile();
|
||||
// 资源地址
|
||||
String downloadPath = filePath + fileName.replace("/profile", "");
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量生成代码
|
||||
*/
|
||||
@Log(title = "SDK生成", businessType = BusinessType.GENCODE)
|
||||
@GetMapping("/genSdk")
|
||||
@ApiOperation("生成SDK")
|
||||
public void genSdk(HttpServletResponse response, int deviceChip) throws IOException {
|
||||
byte[] data = downloadCode(deviceChip);
|
||||
genSdk(response, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成zip文件
|
||||
*/
|
||||
private void genSdk(HttpServletResponse response, byte[] data) throws IOException {
|
||||
response.reset();
|
||||
response.addHeader("Access-Control-Allow-Origin", "*");
|
||||
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
|
||||
response.addHeader("Content-Length", "" + data.length);
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
IOUtils.write(data, response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量生成代码(下载方式)
|
||||
*
|
||||
* @param deviceChip
|
||||
* @return 数据
|
||||
*/
|
||||
public byte[] downloadCode(int deviceChip) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
// generatorCode(deviceChip, zip);
|
||||
IOUtils.closeQuietly(zip);
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询表信息并生成代码
|
||||
*/
|
||||
private void generatorCode(int deviceChip, ZipOutputStream zip) {
|
||||
VelocityInitializer.initVelocity();
|
||||
|
||||
VelocityContext context = VelocityUtils.prepareContext(deviceChip);
|
||||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList("");
|
||||
for (String template : templates) {
|
||||
// 渲染模板
|
||||
StringWriter sw = new StringWriter();
|
||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||
tpl.merge(context, sw);
|
||||
try {
|
||||
// 添加到zip
|
||||
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template)));
|
||||
IOUtils.write(sw.toString(), zip, Constants.UTF8);
|
||||
IOUtils.closeQuietly(sw);
|
||||
zip.flush();
|
||||
zip.closeEntry();
|
||||
} catch (IOException e) {
|
||||
System.out.println("渲染模板失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备告警对象 iot_alert
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
public class Alert extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 告警ID */
|
||||
private Long alertId;
|
||||
|
||||
/** 告警名称 */
|
||||
@Excel(name = "告警名称")
|
||||
private String alertName;
|
||||
|
||||
/** 告警级别(1=提醒通知,2=轻微问题,3=严重警告) */
|
||||
@Excel(name = "告警级别", readConverterExp = "1==提醒通知,2=轻微问题,3=严重警告")
|
||||
private Long alertLevel;
|
||||
|
||||
/** 产品ID */
|
||||
@Excel(name = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
@Excel(name = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 触发器 */
|
||||
@Excel(name = "触发器")
|
||||
private String triggers;
|
||||
|
||||
/** 执行动作 */
|
||||
@Excel(name = "执行动作")
|
||||
private String actions;
|
||||
|
||||
/** 告警状态 (1-启动,2-停止)**/
|
||||
private Integer status;
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setAlertId(Long alertId)
|
||||
{
|
||||
this.alertId = alertId;
|
||||
}
|
||||
|
||||
public Long getAlertId()
|
||||
{
|
||||
return alertId;
|
||||
}
|
||||
public void setAlertName(String alertName)
|
||||
{
|
||||
this.alertName = alertName;
|
||||
}
|
||||
|
||||
public String getAlertName()
|
||||
{
|
||||
return alertName;
|
||||
}
|
||||
public void setAlertLevel(Long alertLevel)
|
||||
{
|
||||
this.alertLevel = alertLevel;
|
||||
}
|
||||
|
||||
public Long getAlertLevel()
|
||||
{
|
||||
return alertLevel;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
public void setTriggers(String triggers)
|
||||
{
|
||||
this.triggers = triggers;
|
||||
}
|
||||
|
||||
public String getTriggers()
|
||||
{
|
||||
return triggers;
|
||||
}
|
||||
public void setActions(String actions)
|
||||
{
|
||||
this.actions = actions;
|
||||
}
|
||||
|
||||
public String getActions()
|
||||
{
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("alertId", getAlertId())
|
||||
.append("alertName", getAlertName())
|
||||
.append("alertLevel", getAlertLevel())
|
||||
.append("productId", getProductId())
|
||||
.append("productName", getProductName())
|
||||
.append("triggers", getTriggers())
|
||||
.append("actions", getActions())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备告警对象 iot_alert_log
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
public class AlertLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 告警ID */
|
||||
private Long alertLogId;
|
||||
|
||||
/** 告警名称 */
|
||||
@Excel(name = "告警名称")
|
||||
private String alertName;
|
||||
|
||||
/** 告警级别(1=提醒通知,2=轻微问题,3=严重警告,4=场景联动) */
|
||||
@Excel(name = "告警级别", readConverterExp = "1==提醒通知,2=轻微问题,3=严重警告,4=场景联动")
|
||||
private Long alertLevel;
|
||||
|
||||
/** 处理状态(0=不需要处理,1=未处理,2=已处理) */
|
||||
@Excel(name = "处理状态(0=不需要处理,1=未处理,2=已处理)")
|
||||
private Long status;
|
||||
|
||||
/** 产品ID */
|
||||
@Excel(name = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
@Excel(name = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 设备ID */
|
||||
@Excel(name = "设备ID")
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
public void setAlertLogId(Long alertLogId)
|
||||
{
|
||||
this.alertLogId = alertLogId;
|
||||
}
|
||||
|
||||
public Long getAlertLogId()
|
||||
{
|
||||
return alertLogId;
|
||||
}
|
||||
public void setAlertName(String alertLogName)
|
||||
{
|
||||
this.alertName = alertLogName;
|
||||
}
|
||||
|
||||
public String getAlertName()
|
||||
{
|
||||
return alertName;
|
||||
}
|
||||
public void setAlertLevel(Long alertLevel)
|
||||
{
|
||||
this.alertLevel = alertLevel;
|
||||
}
|
||||
|
||||
public Long getAlertLevel()
|
||||
{
|
||||
return alertLevel;
|
||||
}
|
||||
public void setStatus(Long status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("alertLogId", getAlertLogId())
|
||||
.append("alertName", getAlertName())
|
||||
.append("alertLevel", getAlertLevel())
|
||||
.append("status", getStatus())
|
||||
.append("productId", getProductId())
|
||||
.append("productName", getProductName())
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("deviceName", getDeviceName())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
||||
/**
|
||||
* 产品分类对象 iot_category
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class Category extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 产品分类ID */
|
||||
private Long categoryId;
|
||||
|
||||
/** 产品分类名称 */
|
||||
@Excel(name = "产品分类名称")
|
||||
private String categoryName;
|
||||
|
||||
/** 租户ID */
|
||||
@Excel(name = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 是否系统通用(0-否,1-是) */
|
||||
@Excel(name = "是否系统通用", readConverterExp = "0=-否,1-是")
|
||||
private Integer isSys;
|
||||
|
||||
/** 显示顺序 */
|
||||
@Excel(name = "显示顺序")
|
||||
private Integer orderNum;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public void setCategoryId(Long categoryId)
|
||||
{
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Long getCategoryId()
|
||||
{
|
||||
return categoryId;
|
||||
}
|
||||
public void setCategoryName(String categoryName)
|
||||
{
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public String getCategoryName()
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setIsSys(Integer isSys)
|
||||
{
|
||||
this.isSys = isSys;
|
||||
}
|
||||
public Integer getIsSys()
|
||||
{
|
||||
return isSys;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("categoryId", getCategoryId())
|
||||
.append("categoryName", getCategoryName())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("isSys", getIsSys())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 设备对象 iot_device
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class Device extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 产品分类ID */
|
||||
private Long deviceId;
|
||||
|
||||
/** 产品分类名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/** 产品ID */
|
||||
@Excel(name = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
@Excel(name = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 用户昵称 */
|
||||
@Excel(name = "用户昵称")
|
||||
private String userName;
|
||||
|
||||
/** 租户ID */
|
||||
@Excel(name = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String serialNumber;
|
||||
|
||||
/** 固件版本 */
|
||||
@Excel(name = "固件版本")
|
||||
private BigDecimal firmwareVersion;
|
||||
|
||||
/** 设备状态(1-未激活,2-禁用,3-在线,4-离线) */
|
||||
@Excel(name = "设备状态")
|
||||
private Integer status;
|
||||
|
||||
/** wifi信号强度(信号极好4格[-55— 0],信号好3格[-70— -55],信号一般2格[-85— -70],信号差1格[-100— -85]) */
|
||||
@Excel(name = "wifi信号强度")
|
||||
private Integer rssi;
|
||||
|
||||
/** 设备影子 */
|
||||
private Integer isShadow;
|
||||
|
||||
/** 设备所在地址 */
|
||||
@Excel(name = "设备所在地址")
|
||||
private String networkAddress;
|
||||
|
||||
/** 设备入网IP */
|
||||
@Excel(name = "设备入网IP")
|
||||
private String networkIp;
|
||||
|
||||
/** 设备经度 */
|
||||
@Excel(name = "设备经度")
|
||||
private BigDecimal longitude;
|
||||
|
||||
/** 设备纬度 */
|
||||
@Excel(name = "设备纬度")
|
||||
private BigDecimal latitude;
|
||||
|
||||
/** 激活时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "激活时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date activeTime;
|
||||
|
||||
@Excel(name = "物模型")
|
||||
private String thingsModelValue;
|
||||
|
||||
/** 图片地址 */
|
||||
private String imgUrl;
|
||||
|
||||
/** 是否自定义位置 **/
|
||||
private Integer isCustomLocation;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public Integer getIsCustomLocation() {
|
||||
return isCustomLocation;
|
||||
}
|
||||
|
||||
public void setIsCustomLocation(Integer isCustomLocation) {
|
||||
this.isCustomLocation = isCustomLocation;
|
||||
}
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public Integer getIsShadow() {
|
||||
return isShadow;
|
||||
}
|
||||
|
||||
public void setIsShadow(Integer isShadow) {
|
||||
this.isShadow = isShadow;
|
||||
}
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setSerialNumber(String serialNumber)
|
||||
{
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public String getSerialNumber()
|
||||
{
|
||||
return serialNumber;
|
||||
}
|
||||
public void setFirmwareVersion(BigDecimal firmwareVersion)
|
||||
{
|
||||
this.firmwareVersion = firmwareVersion;
|
||||
}
|
||||
|
||||
public BigDecimal getFirmwareVersion()
|
||||
{
|
||||
return firmwareVersion;
|
||||
}
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setRssi(Integer rssi)
|
||||
{
|
||||
this.rssi = rssi;
|
||||
}
|
||||
|
||||
public Integer getRssi()
|
||||
{
|
||||
return rssi;
|
||||
}
|
||||
public void setThingsModelValue(String thingsModelValue)
|
||||
{
|
||||
this.thingsModelValue = thingsModelValue;
|
||||
}
|
||||
|
||||
public String getThingsModelValue()
|
||||
{
|
||||
return thingsModelValue;
|
||||
}
|
||||
public void setNetworkAddress(String networkAddress)
|
||||
{
|
||||
this.networkAddress = networkAddress;
|
||||
}
|
||||
|
||||
public String getNetworkAddress()
|
||||
{
|
||||
return networkAddress;
|
||||
}
|
||||
public void setNetworkIp(String networkIp)
|
||||
{
|
||||
this.networkIp = networkIp;
|
||||
}
|
||||
|
||||
public String getNetworkIp()
|
||||
{
|
||||
return networkIp;
|
||||
}
|
||||
public void setLongitude(BigDecimal longitude)
|
||||
{
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public BigDecimal getLongitude()
|
||||
{
|
||||
return longitude;
|
||||
}
|
||||
public void setLatitude(BigDecimal latitude)
|
||||
{
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public BigDecimal getLatitude()
|
||||
{
|
||||
return latitude;
|
||||
}
|
||||
public void setActiveTime(Date activeTime)
|
||||
{
|
||||
this.activeTime = activeTime;
|
||||
}
|
||||
|
||||
public Date getActiveTime()
|
||||
{
|
||||
return activeTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("deviceName", getDeviceName())
|
||||
.append("productId", getProductId())
|
||||
.append("productName", getProductName())
|
||||
.append("userId", getUserId())
|
||||
.append("userName", getUserName())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("serialNumber", getSerialNumber())
|
||||
.append("firmwareVersion", getFirmwareVersion())
|
||||
.append("status", getStatus())
|
||||
.append("rssi", getRssi())
|
||||
.append("networkAddress", getNetworkAddress())
|
||||
.append("networkIp", getNetworkIp())
|
||||
.append("longitude", getLongitude())
|
||||
.append("latitude", getLatitude())
|
||||
.append("activeTime", getActiveTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 设备分组对象 iot_device_group
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class DeviceGroup
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 分组ID */
|
||||
private Long groupId;
|
||||
|
||||
/** 设备ID */
|
||||
private Long deviceId;
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||
import com.ruoyi.common.constant.ScheduleConstants;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.quartz.util.CronUtils;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 设备定时任务
|
||||
*
|
||||
* @author kerwincui
|
||||
*/
|
||||
public class DeviceJob extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 任务ID */
|
||||
@Excel(name = "任务序号", cellType = ColumnType.NUMERIC)
|
||||
private Long jobId;
|
||||
|
||||
/** 任务名称 */
|
||||
@Excel(name = "任务名称")
|
||||
private String jobName;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String serialNumber;
|
||||
|
||||
/** 设备id */
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备名称 */
|
||||
private String deviceName;
|
||||
|
||||
/** 执行动作 */
|
||||
private String actions;
|
||||
|
||||
/** 任务组名 */
|
||||
@Excel(name = "任务组名")
|
||||
private String jobGroup;
|
||||
|
||||
/** cron执行表达式 */
|
||||
@Excel(name = "执行表达式 ")
|
||||
private String cronExpression;
|
||||
|
||||
/** cron计划策略 */
|
||||
@Excel(name = "计划策略 ", readConverterExp = "0=默认,1=立即触发执行,2=触发一次执行,3=不触发立即执行")
|
||||
private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT;
|
||||
|
||||
/** 是否并发执行(0允许 1禁止) */
|
||||
@Excel(name = "并发执行", readConverterExp = "0=允许,1=禁止")
|
||||
private String concurrent;
|
||||
|
||||
/** 任务状态(0正常 1暂停) */
|
||||
@Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停")
|
||||
private String status;
|
||||
|
||||
/** 是否详细corn表达式 */
|
||||
private Integer isAdvance;
|
||||
|
||||
/** 定时类型(1=设备定时,2=设备告警,3=场景联动) */
|
||||
@Excel(name = "定时类型", readConverterExp = "1==设备定时,2=设备告警,3=场景联动")
|
||||
private Integer jobType;
|
||||
|
||||
/** 产品ID */
|
||||
@Excel(name = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
@Excel(name = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 场景联动ID */
|
||||
@Excel(name = "场景联动ID")
|
||||
private Long sceneId;
|
||||
|
||||
/** 告警ID */
|
||||
@Excel(name = "告警ID")
|
||||
private Long alertId;
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
public void setSerialNumber(String serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public Integer getIsAdvance() {
|
||||
return isAdvance;
|
||||
}
|
||||
|
||||
public void setIsAdvance(Integer isAdvance) {
|
||||
this.isAdvance = isAdvance;
|
||||
}
|
||||
|
||||
public Integer getJobType() {
|
||||
return jobType;
|
||||
}
|
||||
|
||||
public void setJobType(Integer jobType) {
|
||||
this.jobType = jobType;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public Long getSceneId() {
|
||||
return sceneId;
|
||||
}
|
||||
|
||||
public void setSceneId(Long sceneId) {
|
||||
this.sceneId = sceneId;
|
||||
}
|
||||
|
||||
public Long getAlertId() {
|
||||
return alertId;
|
||||
}
|
||||
|
||||
public void setAlertId(Long alertId) {
|
||||
this.alertId = alertId;
|
||||
}
|
||||
|
||||
public Long getJobId()
|
||||
{
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public void setJobId(Long jobId)
|
||||
{
|
||||
this.jobId = jobId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "任务名称不能为空")
|
||||
@Size(min = 0, max = 64, message = "任务名称不能超过64个字符")
|
||||
public String getJobName()
|
||||
{
|
||||
return jobName;
|
||||
}
|
||||
|
||||
public void setJobName(String jobName)
|
||||
{
|
||||
this.jobName = jobName;
|
||||
}
|
||||
|
||||
public String getJobGroup()
|
||||
{
|
||||
return jobGroup;
|
||||
}
|
||||
|
||||
public void setJobGroup(String jobGroup)
|
||||
{
|
||||
this.jobGroup = jobGroup;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getActions() {
|
||||
return actions;
|
||||
}
|
||||
|
||||
public void setActions(String actions) {
|
||||
this.actions = actions;
|
||||
}
|
||||
|
||||
@NotBlank(message = "Cron执行表达式不能为空")
|
||||
@Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符")
|
||||
public String getCronExpression()
|
||||
{
|
||||
return cronExpression;
|
||||
}
|
||||
|
||||
public void setCronExpression(String cronExpression)
|
||||
{
|
||||
this.cronExpression = cronExpression;
|
||||
}
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
public Date getNextValidTime()
|
||||
{
|
||||
if (StringUtils.isNotEmpty(cronExpression))
|
||||
{
|
||||
return CronUtils.getNextExecution(cronExpression);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMisfirePolicy()
|
||||
{
|
||||
return misfirePolicy;
|
||||
}
|
||||
|
||||
public void setMisfirePolicy(String misfirePolicy)
|
||||
{
|
||||
this.misfirePolicy = misfirePolicy;
|
||||
}
|
||||
|
||||
public String getConcurrent()
|
||||
{
|
||||
return concurrent;
|
||||
}
|
||||
|
||||
public void setConcurrent(String concurrent)
|
||||
{
|
||||
this.concurrent = concurrent;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("jobId", getJobId())
|
||||
.append("jobName", getJobName())
|
||||
.append("jobGroup", getJobGroup())
|
||||
.append("cronExpression", getCronExpression())
|
||||
.append("nextValidTime", getNextValidTime())
|
||||
.append("misfirePolicy", getMisfirePolicy())
|
||||
.append("concurrent", getConcurrent())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备日志对象 iot_device_log
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
public class DeviceLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 设备日志ID */
|
||||
private Long logId;
|
||||
|
||||
/** 类型(1=属性上报,2=事件上报,3=调用功能,4=设备升级,5=设备上线,6=设备离线) */
|
||||
@Excel(name = "类型", readConverterExp = "1==属性上报,2=事件上报,3=调用功能,4=设备升级,5=设备上线,6=设备离线")
|
||||
private Integer logType;
|
||||
|
||||
/** 日志值 */
|
||||
@Excel(name = "日志值")
|
||||
private String logValue;
|
||||
|
||||
/** 设备ID */
|
||||
@Excel(name = "设备ID")
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String serialNumber;
|
||||
|
||||
/** 标识符 */
|
||||
@Excel(name = "标识符")
|
||||
private String identity;
|
||||
|
||||
/** 是否监测数据(1=是,0=否) */
|
||||
@Excel(name = "是否监测数据", readConverterExp = "1==是,0=否")
|
||||
private Integer isMonitor;
|
||||
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
public void setSerialNumber(String serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public void setLogId(Long logId)
|
||||
{
|
||||
this.logId = logId;
|
||||
}
|
||||
|
||||
public Long getLogId()
|
||||
{
|
||||
return logId;
|
||||
}
|
||||
|
||||
public void setLogType(Integer logType)
|
||||
{
|
||||
this.logType = logType;
|
||||
}
|
||||
|
||||
public Integer getLogType()
|
||||
{
|
||||
return logType;
|
||||
}
|
||||
public void setLogValue(String logValue)
|
||||
{
|
||||
this.logValue = logValue;
|
||||
}
|
||||
|
||||
public String getLogValue()
|
||||
{
|
||||
return logValue;
|
||||
}
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
public void setIdentity(String identity)
|
||||
{
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
public String getIdentity()
|
||||
{
|
||||
return identity;
|
||||
}
|
||||
public void setIsMonitor(Integer isMonitor)
|
||||
{
|
||||
this.isMonitor = isMonitor;
|
||||
}
|
||||
|
||||
public Integer getIsMonitor()
|
||||
{
|
||||
return isMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("logId", getLogId())
|
||||
.append("logType", getLogType())
|
||||
.append("logValue", getLogValue())
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("deviceName", getDeviceName())
|
||||
.append("identity", getIdentity())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("isMonitor", getIsMonitor())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备用户对象 iot_device_user
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class DeviceUser extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 固件ID */
|
||||
private Long deviceId;
|
||||
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 设备名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/** 用户昵称 */
|
||||
@Excel(name = "用户昵称")
|
||||
private String userName;
|
||||
|
||||
/** 是否为设备所有者 */
|
||||
@Excel(name = "是否为设备所有者")
|
||||
private Integer isOwner;
|
||||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
private String tenantName;
|
||||
|
||||
/** 手机号码 */
|
||||
private String phonenumber;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public String getPhonenumber() {
|
||||
return phonenumber;
|
||||
}
|
||||
|
||||
public void setPhonenumber(String phonenumber) {
|
||||
this.phonenumber = phonenumber;
|
||||
}
|
||||
|
||||
public Long getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Long tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getTenantName() {
|
||||
return tenantName;
|
||||
}
|
||||
|
||||
public void setTenantName(String tenantName) {
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
public void setIsOwner(Integer isOwner)
|
||||
{
|
||||
this.isOwner = isOwner;
|
||||
}
|
||||
|
||||
public Integer getIsOwner()
|
||||
{
|
||||
return isOwner;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("userId", getUserId())
|
||||
.append("deviceName", getDeviceName())
|
||||
.append("userName", getUserName())
|
||||
.append("isOwner", getIsOwner())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 产品固件对象 iot_firmware
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class Firmware extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 固件ID */
|
||||
private Long firmwareId;
|
||||
|
||||
/** 固件名称 */
|
||||
@Excel(name = "固件名称")
|
||||
private String firmwareName;
|
||||
|
||||
/** 产品ID */
|
||||
@Excel(name = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
@Excel(name = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 租户ID */
|
||||
@Excel(name = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 是否系统通用(0-否,1-是) */
|
||||
@Excel(name = "是否系统通用", readConverterExp = "0=-否,1-是")
|
||||
private Integer isSys;
|
||||
|
||||
/** 固件版本 */
|
||||
@Excel(name = "固件版本")
|
||||
private BigDecimal version;
|
||||
|
||||
/** 文件路径 */
|
||||
@Excel(name = "文件路径")
|
||||
private String filePath;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public void setFirmwareId(Long firmwareId)
|
||||
{
|
||||
this.firmwareId = firmwareId;
|
||||
}
|
||||
|
||||
public Long getFirmwareId()
|
||||
{
|
||||
return firmwareId;
|
||||
}
|
||||
public void setFirmwareName(String firmwareName)
|
||||
{
|
||||
this.firmwareName = firmwareName;
|
||||
}
|
||||
|
||||
public String getFirmwareName()
|
||||
{
|
||||
return firmwareName;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setIsSys(Integer isSys)
|
||||
{
|
||||
this.isSys = isSys;
|
||||
}
|
||||
|
||||
public Integer getIsSys()
|
||||
{
|
||||
return isSys;
|
||||
}
|
||||
public void setVersion(BigDecimal version)
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public BigDecimal getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
public void setFilePath(String filePath)
|
||||
{
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public String getFilePath()
|
||||
{
|
||||
return filePath;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("firmwareId", getFirmwareId())
|
||||
.append("firmwareName", getFirmwareName())
|
||||
.append("productId", getProductId())
|
||||
.append("productName", getProductName())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("isSys", getIsSys())
|
||||
.append("version", getVersion())
|
||||
.append("filePath", getFilePath())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备分组对象 iot_group
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class Group extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 分组ID */
|
||||
private Long groupId;
|
||||
|
||||
/** 分组名称 */
|
||||
@Excel(name = "分组名称")
|
||||
private String groupName;
|
||||
|
||||
/** 分组排序 */
|
||||
@Excel(name = "分组排序")
|
||||
private Long groupOrder;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 用户昵称 */
|
||||
@Excel(name = "用户昵称")
|
||||
private String userName;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public void setGroupId(Long groupId)
|
||||
{
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public Long getGroupId()
|
||||
{
|
||||
return groupId;
|
||||
}
|
||||
public void setGroupName(String groupName)
|
||||
{
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public String getGroupName()
|
||||
{
|
||||
return groupName;
|
||||
}
|
||||
public void setGroupOrder(Long groupOrder)
|
||||
{
|
||||
this.groupOrder = groupOrder;
|
||||
}
|
||||
|
||||
public Long getGroupOrder()
|
||||
{
|
||||
return groupOrder;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("groupId", getGroupId())
|
||||
.append("groupName", getGroupName())
|
||||
.append("groupOrder", getGroupOrder())
|
||||
.append("userId", getUserId())
|
||||
.append("userName", getUserName())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 云云对接对象 oauth_client_details
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-02-07
|
||||
*/
|
||||
public class OauthClientDetails extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
/** 资源 */
|
||||
@Excel(name = "资源")
|
||||
private String resourceIds;
|
||||
|
||||
/** 客户端秘钥 */
|
||||
private String clientSecret;
|
||||
|
||||
/** 权限范围 */
|
||||
@Excel(name = "权限范围")
|
||||
private String scope;
|
||||
|
||||
/** 授权模式 */
|
||||
@Excel(name = "授权模式")
|
||||
private String authorizedGrantTypes;
|
||||
|
||||
/** 回调地址 */
|
||||
@Excel(name = "回调地址")
|
||||
private String webServerRedirectUri;
|
||||
|
||||
/** 权限 */
|
||||
@Excel(name = "权限")
|
||||
private String authorities;
|
||||
|
||||
/** access token有效时间 */
|
||||
@Excel(name = "access token有效时间")
|
||||
private Long accessTokenValidity;
|
||||
|
||||
/** refresh token有效时间 */
|
||||
@Excel(name = "refresh token有效时间")
|
||||
private Long refreshTokenValidity;
|
||||
|
||||
/** 预留的字段 */
|
||||
@Excel(name = "预留的字段")
|
||||
private String additionalInformation;
|
||||
|
||||
/** 自动授权 */
|
||||
@Excel(name = "自动授权")
|
||||
private String autoapprove;
|
||||
|
||||
/** 平台 */
|
||||
@Excel(name = "平台")
|
||||
private Integer type;
|
||||
|
||||
public void setClientId(String clientId)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientId()
|
||||
{
|
||||
return clientId;
|
||||
}
|
||||
public void setResourceIds(String resourceIds)
|
||||
{
|
||||
this.resourceIds = resourceIds;
|
||||
}
|
||||
|
||||
public String getResourceIds()
|
||||
{
|
||||
return resourceIds;
|
||||
}
|
||||
public void setClientSecret(String clientSecret)
|
||||
{
|
||||
this.clientSecret = clientSecret;
|
||||
}
|
||||
|
||||
public String getClientSecret()
|
||||
{
|
||||
return clientSecret;
|
||||
}
|
||||
public void setScope(String scope)
|
||||
{
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getScope()
|
||||
{
|
||||
return scope;
|
||||
}
|
||||
public void setAuthorizedGrantTypes(String authorizedGrantTypes)
|
||||
{
|
||||
this.authorizedGrantTypes = authorizedGrantTypes;
|
||||
}
|
||||
|
||||
public String getAuthorizedGrantTypes()
|
||||
{
|
||||
return authorizedGrantTypes;
|
||||
}
|
||||
public void setWebServerRedirectUri(String webServerRedirectUri)
|
||||
{
|
||||
this.webServerRedirectUri = webServerRedirectUri;
|
||||
}
|
||||
|
||||
public String getWebServerRedirectUri()
|
||||
{
|
||||
return webServerRedirectUri;
|
||||
}
|
||||
public void setAuthorities(String authorities)
|
||||
{
|
||||
this.authorities = authorities;
|
||||
}
|
||||
|
||||
public String getAuthorities()
|
||||
{
|
||||
return authorities;
|
||||
}
|
||||
public void setAccessTokenValidity(Long accessTokenValidity)
|
||||
{
|
||||
this.accessTokenValidity = accessTokenValidity;
|
||||
}
|
||||
|
||||
public Long getAccessTokenValidity()
|
||||
{
|
||||
return accessTokenValidity;
|
||||
}
|
||||
public void setRefreshTokenValidity(Long refreshTokenValidity)
|
||||
{
|
||||
this.refreshTokenValidity = refreshTokenValidity;
|
||||
}
|
||||
|
||||
public Long getRefreshTokenValidity()
|
||||
{
|
||||
return refreshTokenValidity;
|
||||
}
|
||||
public void setAdditionalInformation(String additionalInformation)
|
||||
{
|
||||
this.additionalInformation = additionalInformation;
|
||||
}
|
||||
|
||||
public String getAdditionalInformation()
|
||||
{
|
||||
return additionalInformation;
|
||||
}
|
||||
public void setAutoapprove(String autoapprove)
|
||||
{
|
||||
this.autoapprove = autoapprove;
|
||||
}
|
||||
|
||||
public String getAutoapprove()
|
||||
{
|
||||
return autoapprove;
|
||||
}
|
||||
public void setType(Integer type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("clientId", getClientId())
|
||||
.append("resourceIds", getResourceIds())
|
||||
.append("clientSecret", getClientSecret())
|
||||
.append("scope", getScope())
|
||||
.append("authorizedGrantTypes", getAuthorizedGrantTypes())
|
||||
.append("webServerRedirectUri", getWebServerRedirectUri())
|
||||
.append("authorities", getAuthorities())
|
||||
.append("accessTokenValidity", getAccessTokenValidity())
|
||||
.append("refreshTokenValidity", getRefreshTokenValidity())
|
||||
.append("additionalInformation", getAdditionalInformation())
|
||||
.append("autoapprove", getAutoapprove())
|
||||
.append("type", getType())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 产品对象 iot_product
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class Product extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
@Excel(name = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 产品分类ID */
|
||||
@Excel(name = "产品分类ID")
|
||||
private Long categoryId;
|
||||
|
||||
/** 产品分类名称 */
|
||||
@Excel(name = "产品分类名称")
|
||||
private String categoryName;
|
||||
|
||||
/** 租户ID */
|
||||
@Excel(name = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 是否系统通用(0-否,1-是) */
|
||||
@Excel(name = "是否系统通用", readConverterExp = "0=-否,1-是")
|
||||
private Integer isSys;
|
||||
|
||||
/** mqtt账号 */
|
||||
private String mqttAccount;
|
||||
|
||||
/** mqtt密码 */
|
||||
private String mqttPassword;
|
||||
|
||||
/** 产品秘钥 */
|
||||
private String mqttSecret;
|
||||
|
||||
public String getMqttSecret() {
|
||||
return mqttSecret;
|
||||
}
|
||||
|
||||
public void setMqttSecret(String mqttSecret) {
|
||||
this.mqttSecret = mqttSecret;
|
||||
}
|
||||
|
||||
/** 状态(1-未发布,2-已发布,不能修改) */
|
||||
@Excel(name = "状态", readConverterExp = "1=-未发布,2-已发布,不能修改")
|
||||
private Integer status;
|
||||
|
||||
/** 设备类型(1-直连设备、2-网关子设备、3-网关设备) */
|
||||
@Excel(name = "设备类型", readConverterExp = "1=-直连设备、2-网关子设备、3-网关设备")
|
||||
private Integer deviceType;
|
||||
|
||||
/** 联网方式(1-wifi、2-蓝牙、3-wifi+蓝牙) */
|
||||
@Excel(name = "联网方式", readConverterExp = "1=-wifi、2-蓝牙、3-wifi+蓝牙")
|
||||
private Integer networkMethod;
|
||||
|
||||
/** 认证方式(1-账号密码、2-证书、3-Http) */
|
||||
@Excel(name = "认证方式", readConverterExp = "1=-账号密码、2-证书、3-Http")
|
||||
private Integer vertificateMethod;
|
||||
|
||||
/** 图片地址 */
|
||||
private String imgUrl;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 物模型Json **/
|
||||
private String thingsModelsJson;
|
||||
|
||||
public String getThingsModelsJson() {
|
||||
return thingsModelsJson;
|
||||
}
|
||||
|
||||
public void setThingsModelsJson(String thingsModelsJson) {
|
||||
this.thingsModelsJson = thingsModelsJson;
|
||||
}
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
public void setCategoryId(Long categoryId)
|
||||
{
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Long getCategoryId()
|
||||
{
|
||||
return categoryId;
|
||||
}
|
||||
public void setCategoryName(String categoryName)
|
||||
{
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public String getCategoryName()
|
||||
{
|
||||
return categoryName;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
|
||||
public void setIsSys(Integer isSys)
|
||||
{
|
||||
this.isSys = isSys;
|
||||
}
|
||||
public Integer getIsSys()
|
||||
{
|
||||
return isSys;
|
||||
}
|
||||
|
||||
public void setMqttAccount(String mqttAccount)
|
||||
{
|
||||
this.mqttAccount = mqttAccount;
|
||||
}
|
||||
public String getMqttAccount()
|
||||
{
|
||||
return mqttAccount;
|
||||
}
|
||||
|
||||
public void setMqttPassword(String mqttPassword)
|
||||
{
|
||||
this.mqttPassword = mqttPassword;
|
||||
}
|
||||
public String getMqttPassword()
|
||||
{
|
||||
return mqttPassword;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setDeviceType(Integer deviceType)
|
||||
{
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
|
||||
public Integer getDeviceType()
|
||||
{
|
||||
return deviceType;
|
||||
}
|
||||
public void setNetworkMethod(Integer networkMethod)
|
||||
{
|
||||
this.networkMethod = networkMethod;
|
||||
}
|
||||
|
||||
public Integer getNetworkMethod()
|
||||
{
|
||||
return networkMethod;
|
||||
}
|
||||
public void setVertificateMethod(Integer vertificateMethod)
|
||||
{
|
||||
this.vertificateMethod = vertificateMethod;
|
||||
}
|
||||
|
||||
public Integer getVertificateMethod()
|
||||
{
|
||||
return vertificateMethod;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("productId", getProductId())
|
||||
.append("productName", getProductName())
|
||||
.append("categoryId", getCategoryId())
|
||||
.append("categoryName", getCategoryName())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("isSys", getIsSys())
|
||||
.append("status", getStatus())
|
||||
.append("deviceType", getDeviceType())
|
||||
.append("networkMethod", getNetworkMethod())
|
||||
.append("vertificateMethod", getVertificateMethod())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 场景联动对象 iot_scene
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
public class Scene extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 场景ID */
|
||||
private Long sceneId;
|
||||
|
||||
/** 场景名称 */
|
||||
@Excel(name = "场景名称")
|
||||
private String sceneName;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 用户名称 */
|
||||
@Excel(name = "用户名称")
|
||||
private String userName;
|
||||
|
||||
/** 触发器 */
|
||||
@Excel(name = "触发器")
|
||||
private String triggers;
|
||||
|
||||
/** 执行动作 */
|
||||
@Excel(name = "执行动作")
|
||||
private String actions;
|
||||
|
||||
public void setSceneId(Long sceneId)
|
||||
{
|
||||
this.sceneId = sceneId;
|
||||
}
|
||||
|
||||
public Long getSceneId()
|
||||
{
|
||||
return sceneId;
|
||||
}
|
||||
public void setSceneName(String sceneName)
|
||||
{
|
||||
this.sceneName = sceneName;
|
||||
}
|
||||
|
||||
public String getSceneName()
|
||||
{
|
||||
return sceneName;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
public void setTriggers(String triggers)
|
||||
{
|
||||
this.triggers = triggers;
|
||||
}
|
||||
|
||||
public String getTriggers()
|
||||
{
|
||||
return triggers;
|
||||
}
|
||||
public void setActions(String actions)
|
||||
{
|
||||
this.actions = actions;
|
||||
}
|
||||
|
||||
public String getActions()
|
||||
{
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("sceneId", getSceneId())
|
||||
.append("sceneName", getSceneName())
|
||||
.append("userId", getUserId())
|
||||
.append("userName", getUserName())
|
||||
.append("triggers", getTriggers())
|
||||
.append("actions", getActions())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 物模型对象 iot_things_model
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ThingsModel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 物模型ID */
|
||||
private Long modelId;
|
||||
|
||||
/** 物模型名称 */
|
||||
@Excel(name = "物模型名称")
|
||||
private String modelName;
|
||||
|
||||
/** 产品ID */
|
||||
@Excel(name = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
@Excel(name = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 租户ID */
|
||||
@Excel(name = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 标识符,产品下唯一 */
|
||||
@Excel(name = "标识符,产品下唯一")
|
||||
private String identifier;
|
||||
|
||||
/** 模型类别(1-属性,2-功能,3-事件) */
|
||||
@Excel(name = "模型类别", readConverterExp = "1=-属性,2-功能,3-事件,4-属性和功能")
|
||||
private Integer type;
|
||||
|
||||
/** 数据类型(integer、decimal、string、bool、array、enum) */
|
||||
@Excel(name = "数据类型", readConverterExp = "i=nteger、decimal、string、bool、array、enum")
|
||||
private String datatype;
|
||||
|
||||
/** 数据定义 */
|
||||
@Excel(name = "数据定义")
|
||||
private String specs;
|
||||
|
||||
/** 是否首页显示(0-否,1-是) */
|
||||
@Excel(name = "是否首页显示", readConverterExp = "0=-否,1-是")
|
||||
private Integer isTop;
|
||||
|
||||
/** 是否实时监测(0-否,1-是) */
|
||||
@Excel(name = "是否实时监测", readConverterExp = "0=-否,1-是")
|
||||
private Integer isMonitor;
|
||||
|
||||
public void setModelId(Long modelId)
|
||||
{
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public Long getModelId()
|
||||
{
|
||||
return modelId;
|
||||
}
|
||||
public void setModelName(String modelName)
|
||||
{
|
||||
this.modelName = modelName;
|
||||
}
|
||||
|
||||
public String getModelName()
|
||||
{
|
||||
return modelName;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setIdentifier(String identifier)
|
||||
{
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
public String getIdentifier()
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
public void setType(Integer type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setDatatype(String datatype)
|
||||
{
|
||||
this.datatype = datatype;
|
||||
}
|
||||
|
||||
public String getDatatype()
|
||||
{
|
||||
return datatype;
|
||||
}
|
||||
public void setSpecs(String specs)
|
||||
{
|
||||
this.specs = specs;
|
||||
}
|
||||
|
||||
public String getSpecs()
|
||||
{
|
||||
return specs;
|
||||
}
|
||||
public void setIsTop(Integer isTop)
|
||||
{
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public Integer getIsTop()
|
||||
{
|
||||
return isTop;
|
||||
}
|
||||
public void setIsMonitor(Integer isMonitor)
|
||||
{
|
||||
this.isMonitor = isMonitor;
|
||||
}
|
||||
|
||||
public Integer getIsMonitor()
|
||||
{
|
||||
return isMonitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("modelId", getModelId())
|
||||
.append("modelName", getModelName())
|
||||
.append("productId", getProductId())
|
||||
.append("productName", getProductName())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("identifier", getIdentifier())
|
||||
.append("type", getType())
|
||||
.append("datatype", getDatatype())
|
||||
.append("specs", getSpecs())
|
||||
.append("isTop", getIsTop())
|
||||
.append("isMonitor", getIsMonitor())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package com.ruoyi.iot.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 通用物模型对象 iot_things_model_template
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ThingsModelTemplate extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 物模型ID */
|
||||
private Long templateId;
|
||||
|
||||
/** 物模型名称 */
|
||||
@Excel(name = "物模型名称")
|
||||
private String templateName;
|
||||
|
||||
/** 租户ID */
|
||||
@Excel(name = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 标识符,产品下唯一 */
|
||||
@Excel(name = "标识符")
|
||||
private String identifier;
|
||||
|
||||
/** 模型类别(1-属性,2-功能,3-事件) */
|
||||
@Excel(name = "模型类别", dictType = "iot_things_type")
|
||||
private Integer type;
|
||||
|
||||
/** 数据类型(integer、decimal、string、bool、array、enum) */
|
||||
@Excel(name = "数据类型")
|
||||
private String datatype;
|
||||
|
||||
/** 数据定义 */
|
||||
@Excel(name = "数据定义")
|
||||
private String specs;
|
||||
|
||||
/** 是否系统通用(0-否,1-是) */
|
||||
@Excel(name = "是否系统通用", dictType = "iot_yes_no")
|
||||
private Integer isSys;
|
||||
|
||||
/** 是否首页显示(0-否,1-是) */
|
||||
@Excel(name = "是否首页显示", dictType = "iot_yes_no")
|
||||
private Integer isTop;
|
||||
|
||||
/** 是否实时监测(0-否,1-是) */
|
||||
@Excel(name = "是否实时监测", dictType = "iot_yes_no")
|
||||
private Integer isMonitor;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public void setTemplateId(Long templateId)
|
||||
{
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public Long getTemplateId()
|
||||
{
|
||||
return templateId;
|
||||
}
|
||||
public void setTemplateName(String templateName)
|
||||
{
|
||||
this.templateName = templateName;
|
||||
}
|
||||
|
||||
public String getTemplateName()
|
||||
{
|
||||
return templateName;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setIdentifier(String identifier)
|
||||
{
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
public String getIdentifier()
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
public void setType(Integer type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setDatatype(String datatype)
|
||||
{
|
||||
this.datatype = datatype;
|
||||
}
|
||||
|
||||
public String getDatatype()
|
||||
{
|
||||
return datatype;
|
||||
}
|
||||
public void setSpecs(String specs)
|
||||
{
|
||||
this.specs = specs;
|
||||
}
|
||||
|
||||
public String getSpecs()
|
||||
{
|
||||
return specs;
|
||||
}
|
||||
public void setIsSys(Integer isSys)
|
||||
{
|
||||
this.isSys = isSys;
|
||||
}
|
||||
|
||||
public Integer getIsSys()
|
||||
{
|
||||
return isSys;
|
||||
}
|
||||
public void setIsTop(Integer isTop)
|
||||
{
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public Integer getIsTop()
|
||||
{
|
||||
return isTop;
|
||||
}
|
||||
public void setIsMonitor(Integer isMonitor)
|
||||
{
|
||||
this.isMonitor = isMonitor;
|
||||
}
|
||||
|
||||
public Integer getIsMonitor()
|
||||
{
|
||||
return isMonitor;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("templateId", getTemplateId())
|
||||
.append("templateName", getTemplateName())
|
||||
.append("tenantId", getTenantId())
|
||||
.append("tenantName", getTenantName())
|
||||
.append("identifier", getIdentifier())
|
||||
.append("type", getType())
|
||||
.append("datatype", getDatatype())
|
||||
.append("specs", getSpecs())
|
||||
.append("isSys", getIsSys())
|
||||
.append("isTop", getIsTop())
|
||||
.append("isMonitor", getIsMonitor())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import com.ruoyi.iot.domain.AlertLog;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备告警Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@Repository
|
||||
public interface AlertLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备告警
|
||||
*
|
||||
* @param alertLogId 设备告警主键
|
||||
* @return 设备告警
|
||||
*/
|
||||
public AlertLog selectAlertLogByAlertLogId(Long alertLogId);
|
||||
|
||||
/**
|
||||
* 查询设备告警列表
|
||||
*
|
||||
* @param alertLog 设备告警
|
||||
* @return 设备告警集合
|
||||
*/
|
||||
public List<AlertLog> selectAlertLogList(AlertLog alertLog);
|
||||
|
||||
/**
|
||||
* 新增设备告警
|
||||
*
|
||||
* @param alertLog 设备告警
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAlertLog(AlertLog alertLog);
|
||||
|
||||
/**
|
||||
* 修改设备告警
|
||||
*
|
||||
* @param alertLog 设备告警
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAlertLog(AlertLog alertLog);
|
||||
|
||||
/**
|
||||
* 删除设备告警
|
||||
*
|
||||
* @param alertLogId 设备告警主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlertLogByAlertLogId(Long alertLogId);
|
||||
|
||||
/**
|
||||
* 批量删除设备告警
|
||||
*
|
||||
* @param alertLogIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlertLogByAlertLogIds(Long[] alertLogIds);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.Alert;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 设备告警Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@Repository
|
||||
public interface AlertMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备告警
|
||||
*
|
||||
* @param alertId 设备告警主键
|
||||
* @return 设备告警
|
||||
*/
|
||||
public Alert selectAlertByAlertId(Long alertId);
|
||||
|
||||
/**
|
||||
* 查询设备告警列表
|
||||
*
|
||||
* @param alert 设备告警
|
||||
* @return 设备告警集合
|
||||
*/
|
||||
public List<Alert> selectAlertList(Alert alert);
|
||||
|
||||
/**
|
||||
* 新增设备告警
|
||||
*
|
||||
* @param alert 设备告警
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAlert(Alert alert);
|
||||
|
||||
/**
|
||||
* 修改设备告警
|
||||
*
|
||||
* @param alert 设备告警
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAlert(Alert alert);
|
||||
|
||||
/**
|
||||
* 删除设备告警
|
||||
*
|
||||
* @param alertId 设备告警主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlertByAlertId(Long alertId);
|
||||
|
||||
/**
|
||||
* 批量删除设备告警
|
||||
*
|
||||
* @param alertIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlertByAlertIds(Long[] alertIds);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import com.ruoyi.iot.domain.Category;
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface CategoryMapper
|
||||
{
|
||||
/**
|
||||
* 查询产品分类
|
||||
*
|
||||
* @param categoryId 产品分类主键
|
||||
* @return 产品分类
|
||||
*/
|
||||
public Category selectCategoryByCategoryId(Long categoryId);
|
||||
|
||||
/**
|
||||
* 查询产品分类列表
|
||||
*
|
||||
* @param category 产品分类
|
||||
* @return 产品分类集合
|
||||
*/
|
||||
public List<Category> selectCategoryList(Category category);
|
||||
|
||||
/**
|
||||
* 查询产品简短分类列表
|
||||
*
|
||||
* @return 产品分类集合
|
||||
*/
|
||||
public List<IdAndName> selectCategoryShortList();
|
||||
|
||||
/**
|
||||
* 新增产品分类
|
||||
*
|
||||
* @param category 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCategory(Category category);
|
||||
|
||||
/**
|
||||
* 修改产品分类
|
||||
*
|
||||
* @param category 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCategory(Category category);
|
||||
|
||||
/**
|
||||
* 删除产品分类
|
||||
*
|
||||
* @param categoryId 产品分类主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCategoryByCategoryId(Long categoryId);
|
||||
|
||||
/**
|
||||
* 批量删除产品分类
|
||||
*
|
||||
* @param categoryIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCategoryByCategoryIds(Long[] categoryIds);
|
||||
|
||||
/**
|
||||
* 分类下的产品数量
|
||||
*
|
||||
* @param categoryIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int productCountInCategorys(Long[] categoryIds);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import com.ruoyi.iot.domain.DeviceJob;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调度任务信息 数据层
|
||||
*
|
||||
* @author kerwincui
|
||||
*/
|
||||
@Repository
|
||||
public interface DeviceJobMapper
|
||||
{
|
||||
/**
|
||||
* 查询调度任务日志集合
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
public List<DeviceJob> selectJobList(DeviceJob job);
|
||||
|
||||
/**
|
||||
* 根据设备Ids查询调度任务日志集合
|
||||
*
|
||||
* @param deviceIds 设备ID数组
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
public List<DeviceJob> selectShortJobListByDeviceIds(Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 查询所有调度任务
|
||||
*
|
||||
* @return 调度任务列表
|
||||
*/
|
||||
public List<DeviceJob> selectJobAll();
|
||||
|
||||
/**
|
||||
* 通过调度ID查询调度任务信息
|
||||
*
|
||||
* @param jobId 调度ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
public DeviceJob selectJobById(Long jobId);
|
||||
|
||||
/**
|
||||
* 通过调度ID删除调度任务信息
|
||||
*
|
||||
* @param jobId 调度ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobById(Long jobId);
|
||||
|
||||
/**
|
||||
* 批量删除调度任务信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据设备Ids批量删除调度任务信息
|
||||
*
|
||||
* @param deviceIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobByDeviceIds(Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 修改调度任务信息
|
||||
*
|
||||
* @param job 调度任务信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJob(DeviceJob job);
|
||||
|
||||
/**
|
||||
* 新增调度任务信息
|
||||
*
|
||||
* @param job 调度任务信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJob(DeviceJob job);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import com.ruoyi.iot.domain.DeviceLog;
|
||||
import com.ruoyi.iot.model.MonitorModel;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备日志Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@Repository
|
||||
public interface DeviceLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备日志
|
||||
*
|
||||
* @param logId 设备日志主键
|
||||
* @return 设备日志
|
||||
*/
|
||||
public DeviceLog selectDeviceLogByLogId(Long logId);
|
||||
|
||||
/**
|
||||
* 查询设备日志列表
|
||||
*
|
||||
* @param deviceLog 设备日志
|
||||
* @return 设备日志集合
|
||||
*/
|
||||
public List<DeviceLog> selectDeviceLogList(DeviceLog deviceLog);
|
||||
|
||||
/**
|
||||
* 查询设备监测数据
|
||||
*
|
||||
* @param deviceLog 设备日志
|
||||
* @return 设备日志集合
|
||||
*/
|
||||
public List<MonitorModel> selectMonitorList(DeviceLog deviceLog);
|
||||
|
||||
/**
|
||||
* 新增设备日志
|
||||
*
|
||||
* @param deviceLog 设备日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceLog(DeviceLog deviceLog);
|
||||
|
||||
/**
|
||||
* 修改设备日志
|
||||
*
|
||||
* @param deviceLog 设备日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceLog(DeviceLog deviceLog);
|
||||
|
||||
/**
|
||||
* 删除设备日志
|
||||
*
|
||||
* @param logId 设备日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceLogByLogId(Long logId);
|
||||
|
||||
/**
|
||||
* 批量删除设备日志
|
||||
*
|
||||
* @param logIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceLogByLogIds(Long[] logIds);
|
||||
|
||||
/**
|
||||
* 根据设备Ids批量删除设备日志
|
||||
*
|
||||
* @param deviceIds 需要删除的数据设备Ids
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceLogByDeviceIds(Long[] deviceIds);
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import com.ruoyi.iot.domain.Device;
|
||||
import com.ruoyi.iot.model.AuthenticateInputModel;
|
||||
import com.ruoyi.iot.model.DeviceAllShortOutput;
|
||||
import com.ruoyi.iot.model.DeviceAuthenticateModel;
|
||||
import com.ruoyi.iot.model.DeviceShortOutput;
|
||||
import com.ruoyi.iot.model.ThingsModels.ThingsModelValuesInput;
|
||||
import com.ruoyi.iot.model.ThingsModels.ThingsModelValuesOutput;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface DeviceMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备
|
||||
*
|
||||
* @param deviceId 设备主键
|
||||
* @return 设备
|
||||
*/
|
||||
public Device selectDeviceByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 根据设备编号查询设备
|
||||
*
|
||||
* @param serialNumber 设备主键
|
||||
* @return 设备
|
||||
*/
|
||||
public Device selectDeviceBySerialNumber(String serialNumber);
|
||||
|
||||
/**
|
||||
* 根据设备编号查询简介设备
|
||||
*
|
||||
* @param serialNumber 设备主键
|
||||
* @return 设备
|
||||
*/
|
||||
public Device selectShortDeviceBySerialNumber(String serialNumber);
|
||||
|
||||
/**
|
||||
* 根据设备编号查询设备认证信息
|
||||
*
|
||||
* @param model 设备编号和产品ID
|
||||
* @return 设备
|
||||
*/
|
||||
public DeviceAuthenticateModel selectDeviceAuthenticate(AuthenticateInputModel model);
|
||||
|
||||
/**
|
||||
* 查询设备和运行状态
|
||||
*
|
||||
* @param deviceId 设备主键
|
||||
* @return 设备
|
||||
*/
|
||||
public DeviceShortOutput selectDeviceRunningStatusByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 查询设备的物模型值
|
||||
*
|
||||
* @param serialNumber 设备编号
|
||||
* @return 设备
|
||||
*/
|
||||
public ThingsModelValuesOutput selectDeviceThingsModelValueBySerialNumber(String serialNumber);
|
||||
|
||||
/**
|
||||
* 修改设备的物模型值
|
||||
*
|
||||
* @param input 设备ID和物模型值
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceThingsModelValue(ThingsModelValuesInput input);
|
||||
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 设备集合
|
||||
*/
|
||||
public List<Device> selectDeviceList(Device device);
|
||||
|
||||
/**
|
||||
* 查询设备简短列表
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 设备集合
|
||||
*/
|
||||
public List<DeviceShortOutput> selectDeviceShortList(Device device);
|
||||
|
||||
/**
|
||||
* 查询所有设备简短列表
|
||||
*
|
||||
* @return 设备集合
|
||||
*/
|
||||
public List<DeviceAllShortOutput> selectAllDeviceShortList();
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDevice(Device device);
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDevice(Device device);
|
||||
|
||||
/**
|
||||
* 更新设备状态
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceStatus(Device device);
|
||||
|
||||
/**
|
||||
* 通过设备编号修改设备
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceBySerialNumber(Device device);
|
||||
|
||||
/**
|
||||
* 删除设备
|
||||
*
|
||||
* @param deviceId 设备主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 批量删除设备
|
||||
*
|
||||
* @param deviceIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceByDeviceIds(Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 查询设备序列号的数量
|
||||
* @param deviceNum
|
||||
* @return
|
||||
*/
|
||||
public int getDeviceNumCount(String deviceNum);
|
||||
|
||||
/**
|
||||
* 根据设备IDS删除设备分组
|
||||
* @param deviceIds
|
||||
* @return
|
||||
*/
|
||||
public int deleteDeviceGroupByDeviceIds(Long[] deviceIds);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.DeviceUser;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 设备用户Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface DeviceUserMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备用户
|
||||
*
|
||||
* @param deviceId 设备用户主键
|
||||
* @return 设备用户
|
||||
*/
|
||||
public DeviceUser selectDeviceUserByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 查询设备用户列表
|
||||
*
|
||||
* @param deviceUser 设备用户
|
||||
* @return 设备用户集合
|
||||
*/
|
||||
public List<DeviceUser> selectDeviceUserList(DeviceUser deviceUser);
|
||||
|
||||
/**
|
||||
* 新增设备用户
|
||||
*
|
||||
* @param deviceUser 设备用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceUser(DeviceUser deviceUser);
|
||||
|
||||
/**
|
||||
* 修改设备用户
|
||||
*
|
||||
* @param deviceUser 设备用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceUser(DeviceUser deviceUser);
|
||||
|
||||
/**
|
||||
* 删除设备用户
|
||||
*
|
||||
* @param deviceId 设备用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceUserByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 批量删除设备用户
|
||||
*
|
||||
* @param deviceIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceUserByDeviceIds(Long[] deviceIds);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.Firmware;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 产品固件Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface FirmwareMapper
|
||||
{
|
||||
/**
|
||||
* 查询产品固件
|
||||
*
|
||||
* @param firmwareId 产品固件主键
|
||||
* @return 产品固件
|
||||
*/
|
||||
public Firmware selectFirmwareByFirmwareId(Long firmwareId);
|
||||
|
||||
/**
|
||||
* 查询产品固件列表
|
||||
*
|
||||
* @param firmware 产品固件
|
||||
* @return 产品固件集合
|
||||
*/
|
||||
public List<Firmware> selectFirmwareList(Firmware firmware);
|
||||
|
||||
/**
|
||||
* 新增产品固件
|
||||
*
|
||||
* @param firmware 产品固件
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFirmware(Firmware firmware);
|
||||
|
||||
/**
|
||||
* 修改产品固件
|
||||
*
|
||||
* @param firmware 产品固件
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFirmware(Firmware firmware);
|
||||
|
||||
/**
|
||||
* 删除产品固件
|
||||
*
|
||||
* @param firmwareId 产品固件主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFirmwareByFirmwareId(Long firmwareId);
|
||||
|
||||
/**
|
||||
* 批量删除产品固件
|
||||
*
|
||||
* @param firmwareIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFirmwareByFirmwareIds(Long[] firmwareIds);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.Group;
|
||||
import com.ruoyi.iot.model.DeviceGroupInput;
|
||||
import com.ruoyi.iot.model.IdOutput;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 设备分组Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface GroupMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备分组
|
||||
*
|
||||
* @param groupId 设备分组主键
|
||||
* @return 设备分组
|
||||
*/
|
||||
public Group selectGroupByGroupId(Long groupId);
|
||||
|
||||
/**
|
||||
* 通过分组ID查询关联的设备ID数组
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
public List<IdOutput> selectDeviceIdsByGroupId(Long groupId);
|
||||
|
||||
/**
|
||||
* 查询设备分组列表
|
||||
*
|
||||
* @param group 设备分组
|
||||
* @return 设备分组集合
|
||||
*/
|
||||
public List<Group> selectGroupList(Group group);
|
||||
|
||||
/**
|
||||
* 新增设备分组
|
||||
*
|
||||
* @param group 设备分组
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertGroup(Group group);
|
||||
|
||||
/**
|
||||
* 分组下批量增加设备分组
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public int insertDeviceGroups(DeviceGroupInput input);
|
||||
|
||||
/**
|
||||
* 修改设备分组
|
||||
*
|
||||
* @param group 设备分组
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateGroup(Group group);
|
||||
|
||||
/**
|
||||
* 删除设备分组
|
||||
*
|
||||
* @param groupId 设备分组主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGroupByGroupId(Long groupId);
|
||||
|
||||
/**
|
||||
* 批量删除分组
|
||||
*
|
||||
* @param groupIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGroupByGroupIds(Long[] groupIds);
|
||||
|
||||
/**
|
||||
* 批量删除设备分组
|
||||
* @param groupIds
|
||||
* @return
|
||||
*/
|
||||
public int deleteDeviceGroupByGroupIds(Long[] groupIds);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.OauthClientDetails;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 云云对接Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-02-07
|
||||
*/
|
||||
@Repository
|
||||
public interface OauthClientDetailsMapper
|
||||
{
|
||||
/**
|
||||
* 查询云云对接
|
||||
*
|
||||
* @param clientId 云云对接主键
|
||||
* @return 云云对接
|
||||
*/
|
||||
public OauthClientDetails selectOauthClientDetailsByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 查询云云对接列表
|
||||
*
|
||||
* @param oauthClientDetails 云云对接
|
||||
* @return 云云对接集合
|
||||
*/
|
||||
public List<OauthClientDetails> selectOauthClientDetailsList(OauthClientDetails oauthClientDetails);
|
||||
|
||||
/**
|
||||
* 新增云云对接
|
||||
*
|
||||
* @param oauthClientDetails 云云对接
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertOauthClientDetails(OauthClientDetails oauthClientDetails);
|
||||
|
||||
/**
|
||||
* 修改云云对接
|
||||
*
|
||||
* @param oauthClientDetails 云云对接
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateOauthClientDetails(OauthClientDetails oauthClientDetails);
|
||||
|
||||
/**
|
||||
* 删除云云对接
|
||||
*
|
||||
* @param clientId 云云对接主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOauthClientDetailsByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 批量删除云云对接
|
||||
*
|
||||
* @param clientIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOauthClientDetailsByClientIds(String[] clientIds);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import com.ruoyi.iot.domain.Product;
|
||||
import com.ruoyi.iot.model.ChangeProductStatusModel;
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface ProductMapper
|
||||
{
|
||||
/**
|
||||
* 查询产品
|
||||
*
|
||||
* @param productId 产品主键
|
||||
* @return 产品
|
||||
*/
|
||||
public Product selectProductByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 查询产品列表
|
||||
*
|
||||
* @param product 产品
|
||||
* @return 产品集合
|
||||
*/
|
||||
public List<Product> selectProductList(Product product);
|
||||
|
||||
/**
|
||||
* 查询产品简短列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 产品集合
|
||||
*/
|
||||
public List<IdAndName> selectProductShortList(Long userId);
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
*
|
||||
* @param product 产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProduct(Product product);
|
||||
|
||||
/**
|
||||
* 修改产品
|
||||
*
|
||||
* @param product 产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProduct(Product product);
|
||||
|
||||
/**
|
||||
* 更新产品状态,1-未发布,2-已发布
|
||||
*
|
||||
* @param model
|
||||
* @return 结果
|
||||
*/
|
||||
public int changeProductStatus(ChangeProductStatusModel model);
|
||||
|
||||
/**
|
||||
* 修改物模型JSON
|
||||
*
|
||||
* @param product 产品
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateThingsModelJson(Product product);
|
||||
|
||||
/**
|
||||
* 删除产品
|
||||
*
|
||||
* @param productId 产品主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductByProductId(Long productId);
|
||||
|
||||
/**
|
||||
* 批量删除产品
|
||||
*
|
||||
* @param productIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductByProductIds(Long[] productIds);
|
||||
|
||||
/**
|
||||
* 批量删除产品物模型
|
||||
*
|
||||
* @param productIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductThingsModelByProductIds(Long[] productIds);
|
||||
|
||||
/**
|
||||
* 产品下的固件数量
|
||||
* @param productIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int firmwareCountInProducts(Long[] productIds);
|
||||
|
||||
/**
|
||||
* 产品下的设备数量
|
||||
* @param productIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deviceCountInProducts(Long[] productIds);
|
||||
|
||||
/**
|
||||
* 产品下的物模型数量
|
||||
* @param productId 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int thingsCountInProduct(Long productId);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.Scene;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 场景联动Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
@Repository
|
||||
public interface SceneMapper
|
||||
{
|
||||
/**
|
||||
* 查询场景联动
|
||||
*
|
||||
* @param sceneId 场景联动主键
|
||||
* @return 场景联动
|
||||
*/
|
||||
public Scene selectSceneBySceneId(Long sceneId);
|
||||
|
||||
/**
|
||||
* 查询场景联动列表
|
||||
*
|
||||
* @param scene 场景联动
|
||||
* @return 场景联动集合
|
||||
*/
|
||||
public List<Scene> selectSceneList(Scene scene);
|
||||
|
||||
/**
|
||||
* 新增场景联动
|
||||
*
|
||||
* @param scene 场景联动
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScene(Scene scene);
|
||||
|
||||
/**
|
||||
* 修改场景联动
|
||||
*
|
||||
* @param scene 场景联动
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScene(Scene scene);
|
||||
|
||||
/**
|
||||
* 删除场景联动
|
||||
*
|
||||
* @param sceneId 场景联动主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSceneBySceneId(Long sceneId);
|
||||
|
||||
/**
|
||||
* 批量删除场景联动
|
||||
*
|
||||
* @param sceneIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSceneBySceneIds(Long[] sceneIds);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import com.ruoyi.iot.domain.ThingsModel;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物模型Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface ThingsModelMapper
|
||||
{
|
||||
/**
|
||||
* 查询物模型
|
||||
*
|
||||
* @param modelId 物模型主键
|
||||
* @return 物模型
|
||||
*/
|
||||
public ThingsModel selectThingsModelByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 查询物模型列表
|
||||
*
|
||||
* @param thingsModel 物模型
|
||||
* @return 物模型集合
|
||||
*/
|
||||
public List<ThingsModel> selectThingsModelList(ThingsModel thingsModel);
|
||||
|
||||
/**
|
||||
* 根据产品ID数组获取物模型列表
|
||||
* @param modelIds
|
||||
* @return
|
||||
*/
|
||||
public List<ThingsModel> selectThingsModelListByProductIds(Long[] modelIds);
|
||||
|
||||
/**
|
||||
* 新增物模型
|
||||
*
|
||||
* @param thingsModel 物模型
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertThingsModel(ThingsModel thingsModel);
|
||||
|
||||
/**
|
||||
* 批量新增物模型
|
||||
* @param thingsModels
|
||||
* @return
|
||||
*/
|
||||
public int insertBatchThingsModel(List<ThingsModel> thingsModels);
|
||||
|
||||
/**
|
||||
* 修改物模型
|
||||
*
|
||||
* @param thingsModel 物模型
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateThingsModel(ThingsModel thingsModel);
|
||||
|
||||
/**
|
||||
* 删除物模型
|
||||
*
|
||||
* @param modelId 物模型主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteThingsModelByModelId(Long modelId);
|
||||
|
||||
/**
|
||||
* 批量删除物模型
|
||||
*
|
||||
* @param modelIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteThingsModelByModelIds(Long[] modelIds);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.ruoyi.iot.mapper;
|
||||
|
||||
import com.ruoyi.iot.domain.ThingsModelTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用物模型Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
@Repository
|
||||
public interface ThingsModelTemplateMapper
|
||||
{
|
||||
/**
|
||||
* 查询通用物模型
|
||||
*
|
||||
* @param templateId 通用物模型主键
|
||||
* @return 通用物模型
|
||||
*/
|
||||
public ThingsModelTemplate selectThingsModelTemplateByTemplateId(Long templateId);
|
||||
|
||||
/**
|
||||
* 根据id数组查询通用物模型集合
|
||||
* @param templateIds
|
||||
* @return
|
||||
*/
|
||||
public List<ThingsModelTemplate> selectThingsModelTemplateByTemplateIds (Long[] templateIds);
|
||||
|
||||
/**
|
||||
* 查询通用物模型列表
|
||||
*
|
||||
* @param thingsModelTemplate 通用物模型
|
||||
* @return 通用物模型集合
|
||||
*/
|
||||
public List<ThingsModelTemplate> selectThingsModelTemplateList(ThingsModelTemplate thingsModelTemplate);
|
||||
|
||||
/**
|
||||
* 新增通用物模型
|
||||
*
|
||||
* @param thingsModelTemplate 通用物模型
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertThingsModelTemplate(ThingsModelTemplate thingsModelTemplate);
|
||||
|
||||
/**
|
||||
* 修改通用物模型
|
||||
*
|
||||
* @param thingsModelTemplate 通用物模型
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateThingsModelTemplate(ThingsModelTemplate thingsModelTemplate);
|
||||
|
||||
/**
|
||||
* 删除通用物模型
|
||||
*
|
||||
* @param templateId 通用物模型主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteThingsModelTemplateByTemplateId(Long templateId);
|
||||
|
||||
/**
|
||||
* 批量删除通用物模型
|
||||
*
|
||||
* @param templateIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteThingsModelTemplateByTemplateIds(Long[] templateIds);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
/**
|
||||
* 动作
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class Action
|
||||
{
|
||||
/** 标识符 */
|
||||
private String id;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 值 */
|
||||
private String value;
|
||||
|
||||
/** 类型:1=属性,2=功能,3=事件,5=设备上线,6=设备下线 */
|
||||
private int type;
|
||||
|
||||
/** 源:1=设备,2=定时,3=告警输出 */
|
||||
private int source;
|
||||
|
||||
/** 设备ID */
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备名称 */
|
||||
private String deviceName;
|
||||
|
||||
/** 告警名称 */
|
||||
private String alertName;
|
||||
|
||||
/** 告警级别 */
|
||||
private int alertLevel;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(int source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getAlertName() {
|
||||
return alertName;
|
||||
}
|
||||
|
||||
public void setAlertName(String alertName) {
|
||||
this.alertName = alertName;
|
||||
}
|
||||
|
||||
public int getAlertLevel() {
|
||||
return alertLevel;
|
||||
}
|
||||
|
||||
public void setAlertLevel(int alertLevel) {
|
||||
this.alertLevel = alertLevel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
/**
|
||||
* 动作
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class AuthenticateInputModel
|
||||
{
|
||||
/** 设备编号 */
|
||||
private String serialNumber;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
public AuthenticateInputModel(String serialNumber,Long productId){
|
||||
this.serialNumber=serialNumber;
|
||||
this.productId=productId;
|
||||
}
|
||||
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
public void setSerialNumber(String serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
/**
|
||||
* id和name
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ChangeProductStatusModel
|
||||
{
|
||||
private Long productId;
|
||||
|
||||
private Integer status;
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 设备对象 iot_device
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class DeviceAllShortOutput
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 产品分类ID */
|
||||
private Long deviceId;
|
||||
|
||||
/** 产品分类名称 */
|
||||
private String deviceName;
|
||||
|
||||
/** 产品名称 */
|
||||
private String productName;
|
||||
|
||||
/** 用户昵称 */
|
||||
private String userName;
|
||||
|
||||
/** 设备编号 */
|
||||
private String serialNumber;
|
||||
|
||||
/** 固件版本 */
|
||||
private BigDecimal firmwareVersion;
|
||||
|
||||
/** 设备状态(1-未激活,2-禁用,3-在线,4-离线) */
|
||||
private Integer status;
|
||||
|
||||
/** 设备影子 */
|
||||
private Integer isShadow;
|
||||
|
||||
/** wifi信号强度(信号极好4格[-55— 0],信号好3格[-70— -55],信号一般2格[-85— -70],信号差1格[-100— -85]) */
|
||||
private Integer rssi;
|
||||
|
||||
/** 激活时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date activeTime;
|
||||
|
||||
/** 是否自定义位置 **/
|
||||
private Integer isCustomLocation;
|
||||
|
||||
/** 设备地址 */
|
||||
private String networkAddress;
|
||||
|
||||
/** 经度 */
|
||||
private BigDecimal longitude;
|
||||
|
||||
/** 纬度 */
|
||||
private BigDecimal latitude;
|
||||
|
||||
public String getNetworkAddress() {
|
||||
return networkAddress;
|
||||
}
|
||||
|
||||
public void setNetworkAddress(String networkAddress) {
|
||||
this.networkAddress = networkAddress;
|
||||
}
|
||||
|
||||
public BigDecimal getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(BigDecimal longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public BigDecimal getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(BigDecimal latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public Integer getIsCustomLocation() {
|
||||
return isCustomLocation;
|
||||
}
|
||||
|
||||
public void setIsCustomLocation(Integer isCustomLocation) {
|
||||
this.isCustomLocation = isCustomLocation;
|
||||
}
|
||||
|
||||
public Integer getIsShadow() {
|
||||
return isShadow;
|
||||
}
|
||||
|
||||
public void setIsShadow(Integer isShadow) {
|
||||
this.isShadow = isShadow;
|
||||
}
|
||||
|
||||
public void setRssi(Integer rssi)
|
||||
{
|
||||
this.rssi = rssi;
|
||||
}
|
||||
|
||||
public Integer getRssi()
|
||||
{
|
||||
return rssi;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setSerialNumber(String serialNumber)
|
||||
{
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public String getSerialNumber()
|
||||
{
|
||||
return serialNumber;
|
||||
}
|
||||
public void setFirmwareVersion(BigDecimal firmwareVersion)
|
||||
{
|
||||
this.firmwareVersion = firmwareVersion;
|
||||
}
|
||||
|
||||
public BigDecimal getFirmwareVersion()
|
||||
{
|
||||
return firmwareVersion;
|
||||
}
|
||||
|
||||
public void setActiveTime(Date activeTime)
|
||||
{
|
||||
this.activeTime = activeTime;
|
||||
}
|
||||
|
||||
public Date getActiveTime()
|
||||
{
|
||||
return activeTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
|
||||
public class DeviceAuthenticateModel {
|
||||
/** 产品分类ID */
|
||||
private Long deviceId;
|
||||
|
||||
/** 产品分类名称 */
|
||||
private String deviceName;
|
||||
|
||||
/**设备状态(1-未激活,2-禁用,3-在线,4-离线)**/
|
||||
private int status;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
private String productName;
|
||||
|
||||
/** 产品状态 1-未发布,2-已发布 */
|
||||
private int productStatus;
|
||||
|
||||
/** 设备编号 */
|
||||
private String serialNumber;
|
||||
|
||||
/** mqtt账号 */
|
||||
private String mqttAccount;
|
||||
|
||||
/** mqtt密码 */
|
||||
private String mqttPassword;
|
||||
|
||||
/** 产品秘钥 */
|
||||
private String mqttSecret;
|
||||
|
||||
public int getProductStatus() {
|
||||
return productStatus;
|
||||
}
|
||||
|
||||
public void setProductStatus(int productStatus) {
|
||||
this.productStatus = productStatus;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
public void setSerialNumber(String serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public String getMqttAccount() {
|
||||
return mqttAccount;
|
||||
}
|
||||
|
||||
public void setMqttAccount(String mqttAccount) {
|
||||
this.mqttAccount = mqttAccount;
|
||||
}
|
||||
|
||||
public String getMqttPassword() {
|
||||
return mqttPassword;
|
||||
}
|
||||
|
||||
public void setMqttPassword(String mqttPassword) {
|
||||
this.mqttPassword = mqttPassword;
|
||||
}
|
||||
|
||||
public String getMqttSecret() {
|
||||
return mqttSecret;
|
||||
}
|
||||
|
||||
public void setMqttSecret(String mqttSecret) {
|
||||
this.mqttSecret = mqttSecret;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
/**
|
||||
* 设备分组对象 iot_device_group
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class DeviceGroupInput
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 分组ID */
|
||||
private Long groupId;
|
||||
|
||||
/** 设备ID */
|
||||
private Long[] deviceIds;
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public Long[] getDeviceIds() {
|
||||
return deviceIds;
|
||||
}
|
||||
|
||||
public void setDeviceIds(Long[] deviceIds) {
|
||||
this.deviceIds = deviceIds;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.iot.model.ThingsModelItem.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备对象 iot_device
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class DeviceShortOutput
|
||||
{
|
||||
public DeviceShortOutput(){
|
||||
this.stringList=new ArrayList<>();
|
||||
this.integerList=new ArrayList<>();
|
||||
this.decimalList=new ArrayList<>();
|
||||
this.enumList=new ArrayList<>();
|
||||
this.arrayList=new ArrayList<>();
|
||||
this.readOnlyList =new ArrayList<>();
|
||||
this.boolList=new ArrayList<>();
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 产品分类ID */
|
||||
private Long deviceId;
|
||||
|
||||
/** 产品分类名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/** 产品ID */
|
||||
@Excel(name = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
@Excel(name = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 用户昵称 */
|
||||
@Excel(name = "用户昵称")
|
||||
private String userName;
|
||||
|
||||
/** 租户ID */
|
||||
@Excel(name = "租户ID")
|
||||
private Long tenantId;
|
||||
|
||||
/** 租户名称 */
|
||||
@Excel(name = "租户名称")
|
||||
private String tenantName;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
private String serialNumber;
|
||||
|
||||
/** 固件版本 */
|
||||
@Excel(name = "固件版本")
|
||||
private BigDecimal firmwareVersion;
|
||||
|
||||
/** 设备状态(1-未激活,2-禁用,3-在线,4-离线) */
|
||||
@Excel(name = "设备状态")
|
||||
private Integer status;
|
||||
|
||||
/** 设备影子 */
|
||||
private Integer isShadow;
|
||||
|
||||
/** wifi信号强度(信号极好4格[-55— 0],信号好3格[-70— -55],信号一般2格[-85— -70],信号差1格[-100— -85]) */
|
||||
@Excel(name = "wifi信号强度")
|
||||
private Integer rssi;
|
||||
|
||||
@Excel(name = "物模型")
|
||||
private String thingsModelValue;
|
||||
|
||||
/** 激活时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "激活时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date activeTime;
|
||||
|
||||
/** 是否自定义位置 **/
|
||||
private Integer isCustomLocation;
|
||||
|
||||
/** 图片地址 */
|
||||
private String imgUrl;
|
||||
|
||||
private List<StringModelOutput> stringList;
|
||||
private List<IntegerModelOutput> integerList;
|
||||
private List<DecimalModelOutput> decimalList;
|
||||
private List<EnumModelOutput> enumList;
|
||||
private List<ArrayModelOutput> arrayList;
|
||||
private List<BoolModelOutput> boolList;
|
||||
private List<ReadOnlyModelOutput> readOnlyList;
|
||||
|
||||
public Integer getIsCustomLocation() {
|
||||
return isCustomLocation;
|
||||
}
|
||||
|
||||
public void setIsCustomLocation(Integer isCustomLocation) {
|
||||
this.isCustomLocation = isCustomLocation;
|
||||
}
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public Integer getIsShadow() {
|
||||
return isShadow;
|
||||
}
|
||||
|
||||
public void setIsShadow(Integer isShadow) {
|
||||
this.isShadow = isShadow;
|
||||
}
|
||||
|
||||
public List<BoolModelOutput> getBoolList() {
|
||||
return boolList;
|
||||
}
|
||||
|
||||
public void setBoolList(List<BoolModelOutput> boolList) {
|
||||
this.boolList = boolList;
|
||||
}
|
||||
|
||||
public List<ReadOnlyModelOutput> getReadOnlyList() {
|
||||
return readOnlyList;
|
||||
}
|
||||
|
||||
public void setReadOnlyList(List<ReadOnlyModelOutput> readOnlyList) {
|
||||
this.readOnlyList = readOnlyList;
|
||||
}
|
||||
|
||||
public List<StringModelOutput> getStringList() {
|
||||
return stringList;
|
||||
}
|
||||
|
||||
public void setStringList(List<StringModelOutput> stringList) {
|
||||
this.stringList = stringList;
|
||||
}
|
||||
|
||||
public List<IntegerModelOutput> getIntegerList() {
|
||||
return integerList;
|
||||
}
|
||||
|
||||
public void setIntegerList(List<IntegerModelOutput> integerList) {
|
||||
this.integerList = integerList;
|
||||
}
|
||||
|
||||
public List<DecimalModelOutput> getDecimalList() {
|
||||
return decimalList;
|
||||
}
|
||||
|
||||
public void setDecimalList(List<DecimalModelOutput> decimalList) {
|
||||
this.decimalList = decimalList;
|
||||
}
|
||||
|
||||
public List<EnumModelOutput> getEnumList() {
|
||||
return enumList;
|
||||
}
|
||||
|
||||
public void setEnumList(List<EnumModelOutput> enumList) {
|
||||
this.enumList = enumList;
|
||||
}
|
||||
|
||||
public List<ArrayModelOutput> getArrayList() {
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public void setArrayList(List<ArrayModelOutput> arrayList) {
|
||||
this.arrayList = arrayList;
|
||||
}
|
||||
public void setRssi(Integer rssi)
|
||||
{
|
||||
this.rssi = rssi;
|
||||
}
|
||||
|
||||
public Integer getRssi()
|
||||
{
|
||||
return rssi;
|
||||
}
|
||||
public void setThingsModelValue(String thingsModelValue)
|
||||
{
|
||||
this.thingsModelValue = thingsModelValue;
|
||||
}
|
||||
|
||||
public String getThingsModelValue()
|
||||
{
|
||||
return thingsModelValue;
|
||||
}
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
public void setTenantId(Long tenantId)
|
||||
{
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public Long getTenantId()
|
||||
{
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantName(String tenantName)
|
||||
{
|
||||
this.tenantName = tenantName;
|
||||
}
|
||||
|
||||
public String getTenantName()
|
||||
{
|
||||
return tenantName;
|
||||
}
|
||||
public void setSerialNumber(String serialNumber)
|
||||
{
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public String getSerialNumber()
|
||||
{
|
||||
return serialNumber;
|
||||
}
|
||||
public void setFirmwareVersion(BigDecimal firmwareVersion)
|
||||
{
|
||||
this.firmwareVersion = firmwareVersion;
|
||||
}
|
||||
|
||||
public BigDecimal getFirmwareVersion()
|
||||
{
|
||||
return firmwareVersion;
|
||||
}
|
||||
|
||||
public void setActiveTime(Date activeTime)
|
||||
{
|
||||
this.activeTime = activeTime;
|
||||
}
|
||||
|
||||
public Date getActiveTime()
|
||||
{
|
||||
return activeTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* id和name
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class IdAndName
|
||||
{
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("categoryId", getId())
|
||||
.append("categoryName", getName())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 产品分类的Id和名称输出
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class IdOutput
|
||||
{
|
||||
private Long id;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 导入产品物模型的输入对象
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ImportThingsModelInput
|
||||
{
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
private String ProductName;
|
||||
|
||||
/** 通用物模型ID集合 */
|
||||
private Long[] templateIds;
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return ProductName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
ProductName = productName;
|
||||
}
|
||||
|
||||
public Long[] getTemplateIds() {
|
||||
return templateIds;
|
||||
}
|
||||
|
||||
public void setTemplateIds(Long[] templateIds) {
|
||||
this.templateIds = templateIds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 动作
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class MonitorModel
|
||||
{
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date time;
|
||||
|
||||
private String value;
|
||||
|
||||
public Date getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Date time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* id和name
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class MqttAuthModel
|
||||
{
|
||||
private String clientid;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
public String getClientid() {
|
||||
return clientid;
|
||||
}
|
||||
|
||||
public void setClientid(String clientid) {
|
||||
this.clientid = clientid;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
/**
|
||||
* 客户端连接模型
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class MqttClientConnectModel
|
||||
{
|
||||
/** 事件名称(固定为:"client_connected" "client_disconnected") **/
|
||||
private String action;
|
||||
|
||||
/** 客户端 ClientId **/
|
||||
private String clientid;
|
||||
|
||||
/** 客户端 Username,不存在时该值为 "undefined" **/
|
||||
private String username;
|
||||
|
||||
/** 客户端源 IP 地址 **/
|
||||
private String ipaddress;
|
||||
|
||||
/** 客户端申请的心跳保活时间 **/
|
||||
private Integer keepalive;
|
||||
|
||||
/** 协议版本号 **/
|
||||
private Integer proto_ver;
|
||||
|
||||
/** 时间戳(秒) **/
|
||||
private Integer connected_at;
|
||||
|
||||
/** 错误原因 **/
|
||||
private String reason;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getClientid() {
|
||||
return clientid;
|
||||
}
|
||||
|
||||
public void setClientid(String clientid) {
|
||||
this.clientid = clientid;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getIpaddress() {
|
||||
return ipaddress;
|
||||
}
|
||||
|
||||
public void setIpaddress(String ipaddress) {
|
||||
this.ipaddress = ipaddress;
|
||||
}
|
||||
|
||||
public Integer getKeepalive() {
|
||||
return keepalive;
|
||||
}
|
||||
|
||||
public void setKeepalive(Integer keepalive) {
|
||||
this.keepalive = keepalive;
|
||||
}
|
||||
|
||||
public Integer getProto_ver() {
|
||||
return proto_ver;
|
||||
}
|
||||
|
||||
public void setProto_ver(Integer proto_ver) {
|
||||
this.proto_ver = proto_ver;
|
||||
}
|
||||
|
||||
public Integer getConnected_at() {
|
||||
return connected_at;
|
||||
}
|
||||
|
||||
public void setConnected_at(Integer connected_at) {
|
||||
this.connected_at = connected_at;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
/**
|
||||
* 产品分类的Id和名称输出
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class NtpModel
|
||||
{
|
||||
private Long deviceSendTime;
|
||||
|
||||
private Long serverRecvTime;
|
||||
|
||||
private Long serverSendTime;
|
||||
|
||||
public Long getDeviceSendTime() {
|
||||
return deviceSendTime;
|
||||
}
|
||||
|
||||
public void setDeviceSendTime(Long deviceSendTime) {
|
||||
this.deviceSendTime = deviceSendTime;
|
||||
}
|
||||
|
||||
public Long getServerRecvTime() {
|
||||
return serverRecvTime;
|
||||
}
|
||||
|
||||
public void setServerRecvTime(Long serverRecvTime) {
|
||||
this.serverRecvTime = serverRecvTime;
|
||||
}
|
||||
|
||||
public Long getServerSendTime() {
|
||||
return serverSendTime;
|
||||
}
|
||||
|
||||
public void setServerSendTime(Long serverSendTime) {
|
||||
this.serverSendTime = serverSendTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.ruoyi.iot.model;
|
||||
|
||||
public class RegisterUserInput {
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid = "";
|
||||
|
||||
public String getPhonenumber() {
|
||||
return phonenumber;
|
||||
}
|
||||
|
||||
public void setPhonenumber(String phonenumber) {
|
||||
this.phonenumber = phonenumber;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getUuid()
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.iot.model.ThingsModelItem;
|
||||
|
||||
public class ArrayModelOutput extends ThingsModelItemBase
|
||||
{
|
||||
private String arrayType;
|
||||
|
||||
public String getArrayType() {
|
||||
return arrayType;
|
||||
}
|
||||
|
||||
public void setArrayType(String arrayType) {
|
||||
this.arrayType = arrayType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.iot.model.ThingsModelItem;
|
||||
|
||||
public class BoolModelOutput extends ThingsModelItemBase
|
||||
{
|
||||
private String falseText;
|
||||
private String trueText;
|
||||
|
||||
public String getFalseText() {
|
||||
return falseText;
|
||||
}
|
||||
|
||||
public void setFalseText(String falseText) {
|
||||
this.falseText = falseText;
|
||||
}
|
||||
|
||||
public String getTrueText() {
|
||||
return trueText;
|
||||
}
|
||||
|
||||
public void setTrueText(String trueText) {
|
||||
this.trueText = trueText;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.iot.model.ThingsModelItem;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class DecimalModelOutput extends ThingsModelItemBase
|
||||
{
|
||||
private BigDecimal min;
|
||||
private BigDecimal max;
|
||||
private BigDecimal step;
|
||||
private String unit;
|
||||
|
||||
public BigDecimal getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(BigDecimal min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public BigDecimal getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(BigDecimal max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public BigDecimal getStep() {
|
||||
return step;
|
||||
}
|
||||
|
||||
public void setStep(BigDecimal step) {
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.iot.model.ThingsModelItem;
|
||||
|
||||
public class EnumItemOutput
|
||||
{
|
||||
private String text;
|
||||
private String value;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.iot.model.ThingsModelItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EnumModelOutput extends ThingsModelItemBase
|
||||
{
|
||||
private List<EnumItemOutput> enumList;
|
||||
|
||||
public List<EnumItemOutput> getEnumList() {
|
||||
return enumList;
|
||||
}
|
||||
|
||||
public void setEnumList(List<EnumItemOutput> enumList) {
|
||||
this.enumList = enumList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.iot.model.ThingsModelItem;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class IntegerModelOutput extends ThingsModelItemBase
|
||||
{
|
||||
private BigDecimal min;
|
||||
private BigDecimal max;
|
||||
private BigDecimal step;
|
||||
private String unit;
|
||||
|
||||
public BigDecimal getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(BigDecimal min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public BigDecimal getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(BigDecimal max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public BigDecimal getStep() {
|
||||
return step;
|
||||
}
|
||||
|
||||
public void setStep(BigDecimal step) {
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.ruoyi.iot.model.ThingsModelItem;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public class ReadOnlyModelOutput extends ThingsModelItemBase
|
||||
{
|
||||
private BigDecimal min;
|
||||
private BigDecimal max;
|
||||
private BigDecimal step;
|
||||
private String unit;
|
||||
private String arrayType;
|
||||
private String falseText;
|
||||
private String trueText;
|
||||
private int maxLength;
|
||||
private List<EnumItemOutput> enumList;
|
||||
|
||||
public List<EnumItemOutput> getEnumList() {
|
||||
return enumList;
|
||||
}
|
||||
|
||||
public void setEnumList(List<EnumItemOutput> enumList) {
|
||||
this.enumList = enumList;
|
||||
}
|
||||
|
||||
public int getMaxLength() {
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
public void setMaxLength(int maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
|
||||
public String getFalseText() {
|
||||
return falseText;
|
||||
}
|
||||
|
||||
public void setFalseText(String falseText) {
|
||||
this.falseText = falseText;
|
||||
}
|
||||
|
||||
public String getTrueText() {
|
||||
return trueText;
|
||||
}
|
||||
|
||||
public void setTrueText(String trueText) {
|
||||
this.trueText = trueText;
|
||||
}
|
||||
|
||||
public String getArrayType() {
|
||||
return arrayType;
|
||||
}
|
||||
|
||||
public void setArrayType(String arrayType) {
|
||||
this.arrayType = arrayType;
|
||||
}
|
||||
|
||||
public BigDecimal getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(BigDecimal min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public BigDecimal getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(BigDecimal max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public BigDecimal getStep() {
|
||||
return step;
|
||||
}
|
||||
|
||||
public void setStep(BigDecimal step) {
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.iot.model.ThingsModelItem;
|
||||
|
||||
public class StringModelOutput extends ThingsModelItemBase
|
||||
{
|
||||
private int maxLength;
|
||||
|
||||
public int getMaxLength() {
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
public void setMaxLength(int maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.ruoyi.iot.model.ThingsModelItem;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
||||
public class ThingsModelItemBase
|
||||
{
|
||||
/** 物模型唯一标识符 */
|
||||
private String id;
|
||||
/** 物模型名称 */
|
||||
private String name;
|
||||
/** 物模型值 */
|
||||
private String value;
|
||||
/** 是否首页显示(0-否,1-是) */
|
||||
private Integer isTop;
|
||||
/** 是否实时监测(0-否,1-是) */
|
||||
private Integer isMonitor;
|
||||
/** 数据类型 */
|
||||
private String type;
|
||||
/** 影子值 */
|
||||
private String shadow;
|
||||
|
||||
public String getShadow() {
|
||||
return shadow;
|
||||
}
|
||||
|
||||
public void setShadow(String shadow) {
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getIsTop() {
|
||||
return isTop;
|
||||
}
|
||||
|
||||
public void setIsTop(Integer isTop) {
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public Integer getIsMonitor() {
|
||||
return isMonitor;
|
||||
}
|
||||
|
||||
public void setIsMonitor(Integer isMonitor) {
|
||||
this.isMonitor = isMonitor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类的Id和名称输出
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class EventDto
|
||||
{
|
||||
/** 物模型唯一标识符 */
|
||||
private String id;
|
||||
/** 物模型名称 */
|
||||
private String name;
|
||||
/** 数据定义 */
|
||||
private JSONObject datatype;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public JSONObject getDatatype() {
|
||||
return datatype;
|
||||
}
|
||||
|
||||
public void setDatatype(JSONObject datatype) {
|
||||
this.datatype = datatype;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类的Id和名称输出
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class FunctionDto
|
||||
{
|
||||
/** 物模型唯一标识符 */
|
||||
private String id;
|
||||
/** 物模型名称 */
|
||||
private String name;
|
||||
/** 是否首页显示(0-否,1-是) */
|
||||
private Integer isTop;
|
||||
/** 数据定义 */
|
||||
private JSONObject datatype;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getIsTop() {
|
||||
return isTop;
|
||||
}
|
||||
|
||||
public void setIsTop(Integer isTop) {
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public JSONObject getDatatype() {
|
||||
return datatype;
|
||||
}
|
||||
|
||||
public void setDatatype(JSONObject datatype) {
|
||||
this.datatype = datatype;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
import org.apache.commons.math3.analysis.function.Identity;
|
||||
|
||||
/**
|
||||
* 物模型值的项
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class IdentityAndName
|
||||
{
|
||||
public IdentityAndName(){
|
||||
|
||||
}
|
||||
|
||||
public IdentityAndName(String id,String value){
|
||||
this.id=id;
|
||||
this.value=value;
|
||||
}
|
||||
|
||||
/** 物模型唯一标识符 */
|
||||
private String id;
|
||||
|
||||
/** 物模型值 */
|
||||
private String value;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类的Id和名称输出
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class PropertyDto
|
||||
{
|
||||
/** 物模型唯一标识符 */
|
||||
private String id;
|
||||
/** 物模型名称 */
|
||||
private String name;
|
||||
/** 是否首页显示(0-否,1-是) */
|
||||
private Integer isTop;
|
||||
/** 是否实时监测(0-否,1-是) */
|
||||
private Integer isMonitor;
|
||||
/** 数据定义 */
|
||||
private JSONObject datatype;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getIsTop() {
|
||||
return isTop;
|
||||
}
|
||||
|
||||
public void setIsTop(Integer isTop) {
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public Integer getIsMonitor() {
|
||||
return isMonitor;
|
||||
}
|
||||
|
||||
public void setIsMonitor(Integer isMonitor) {
|
||||
this.isMonitor = isMonitor;
|
||||
}
|
||||
|
||||
public JSONObject getDatatype() {
|
||||
return datatype;
|
||||
}
|
||||
|
||||
public void setDatatype(JSONObject datatype) {
|
||||
this.datatype = datatype;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类的Id和名称输出
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ThingsModelShadow
|
||||
{
|
||||
public ThingsModelShadow(){
|
||||
this.properties=new ArrayList<>();
|
||||
this.functions=new ArrayList<>();
|
||||
}
|
||||
|
||||
public ThingsModelShadow(List<IdentityAndName> properties, List<IdentityAndName> functions){
|
||||
this.properties=properties;
|
||||
this.functions=functions;
|
||||
}
|
||||
|
||||
/** 属性 */
|
||||
List<IdentityAndName> properties;
|
||||
|
||||
/** 功能 */
|
||||
List<IdentityAndName> functions;
|
||||
|
||||
public List<IdentityAndName> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<IdentityAndName> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public List<IdentityAndName> getFunctions() {
|
||||
return functions;
|
||||
}
|
||||
|
||||
public void setFunctions(List<IdentityAndName> functions) {
|
||||
this.functions = functions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
/**
|
||||
* 物模型值的项
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ThingsModelValueItem
|
||||
{
|
||||
/** 物模型唯一标识符 */
|
||||
private String id;
|
||||
|
||||
/** 物模型值 */
|
||||
private String value;
|
||||
|
||||
/** 影子值 **/
|
||||
private String shadow;
|
||||
|
||||
public String getShadow() {
|
||||
return shadow;
|
||||
}
|
||||
|
||||
public void setShadow(String shadow) {
|
||||
this.shadow = shadow;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
import org.springframework.data.redis.connection.DataType;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物模型
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ThingsModelValueItemDto
|
||||
{
|
||||
/** 物模型唯一标识符 */
|
||||
private String id;
|
||||
|
||||
/** 物模型名称 */
|
||||
private String name;
|
||||
|
||||
/** 物模型值 */
|
||||
private String value;
|
||||
|
||||
/** 是否首页显示(0-否,1-是) */
|
||||
private Integer isTop;
|
||||
|
||||
/** 是否实时监测(0-否,1-是) */
|
||||
private Integer isMonitor;
|
||||
|
||||
private DataType dataType;
|
||||
|
||||
public Integer getIsTop() {
|
||||
return isTop;
|
||||
}
|
||||
|
||||
public void setIsTop(Integer isTop) {
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public Integer getIsMonitor() {
|
||||
return isMonitor;
|
||||
}
|
||||
|
||||
public void setIsMonitor(Integer isMonitor) {
|
||||
this.isMonitor = isMonitor;
|
||||
}
|
||||
|
||||
public DataType getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(DataType dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static class DataType{
|
||||
private String type;
|
||||
private String falseText;
|
||||
private String trueText;
|
||||
private Integer maxLength;
|
||||
private String arrayType;
|
||||
private String unit;
|
||||
private BigDecimal min;
|
||||
private BigDecimal max;
|
||||
private BigDecimal step;
|
||||
private List<EnumItem> enumList;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getFalseText() {
|
||||
return falseText;
|
||||
}
|
||||
|
||||
public void setFalseText(String falseText) {
|
||||
this.falseText = falseText;
|
||||
}
|
||||
|
||||
public String getTrueText() {
|
||||
return trueText;
|
||||
}
|
||||
|
||||
public void setTrueText(String trueText) {
|
||||
this.trueText = trueText;
|
||||
}
|
||||
|
||||
public Integer getMaxLength() {
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
public void setMaxLength(Integer maxLength) {
|
||||
this.maxLength = maxLength;
|
||||
}
|
||||
|
||||
public String getArrayType() {
|
||||
return arrayType;
|
||||
}
|
||||
|
||||
public void setArrayType(String arrayType) {
|
||||
this.arrayType = arrayType;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
public BigDecimal getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public void setMin(BigDecimal min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
public BigDecimal getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public void setMax(BigDecimal max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public BigDecimal getStep() {
|
||||
return step;
|
||||
}
|
||||
|
||||
public void setStep(BigDecimal step) {
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public List<EnumItem> getEnumList() {
|
||||
return enumList;
|
||||
}
|
||||
|
||||
public void setEnumList(List<EnumItem> enumList) {
|
||||
this.enumList = enumList;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EnumItem
|
||||
{
|
||||
private String text;
|
||||
private String value;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 物模型值的项
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ThingsModelValueRemarkItem
|
||||
{
|
||||
/** 物模型唯一标识符 */
|
||||
private String id;
|
||||
|
||||
/** 物模型值 */
|
||||
private String value;
|
||||
|
||||
/** 备注 **/
|
||||
private String remark;
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备输入物模型值参数
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ThingsModelValuesInput
|
||||
{
|
||||
/** 产品ID **/
|
||||
private Long productId;
|
||||
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备ID **/
|
||||
private String deviceNumber;
|
||||
|
||||
/** 设备物模型值的字符串格式 **/
|
||||
private String stringValue;
|
||||
|
||||
/** 设备物模型值的集合 **/
|
||||
private List<ThingsModelValueRemarkItem> thingsModelValueRemarkItem;
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getStringValue() {
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
public void setStringValue(String stringValue) {
|
||||
this.stringValue = stringValue;
|
||||
}
|
||||
|
||||
public String getDeviceNumber() {
|
||||
return deviceNumber;
|
||||
}
|
||||
|
||||
public void setDeviceNumber(String deviceNumber) {
|
||||
this.deviceNumber = deviceNumber;
|
||||
}
|
||||
|
||||
public List<ThingsModelValueRemarkItem> getThingsModelValueRemarkItem() {
|
||||
return thingsModelValueRemarkItem;
|
||||
}
|
||||
|
||||
public void setThingsModelValueRemarkItem(List<ThingsModelValueRemarkItem> thingsModelValueRemarkItem) {
|
||||
this.thingsModelValueRemarkItem = thingsModelValueRemarkItem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
/**
|
||||
* 设备输入物模型值参数
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ThingsModelValuesOutput
|
||||
{
|
||||
/** 产品ID **/
|
||||
private Long productId;
|
||||
|
||||
private String productName;
|
||||
|
||||
private Long deviceId;
|
||||
|
||||
private String deviceName;
|
||||
|
||||
private int status;
|
||||
|
||||
private int isShadow;
|
||||
|
||||
/** 设备ID **/
|
||||
private String serialNumber;
|
||||
|
||||
/** 设备物模型值 **/
|
||||
private String thingsModelValue;
|
||||
|
||||
public int getIsShadow() {
|
||||
return isShadow;
|
||||
}
|
||||
|
||||
public void setIsShadow(int isShadow) {
|
||||
this.isShadow = isShadow;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
public void setSerialNumber(String serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public String getThingsModelValue() {
|
||||
return thingsModelValue;
|
||||
}
|
||||
|
||||
public void setThingsModelValue(String thingsModelValue) {
|
||||
this.thingsModelValue = thingsModelValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.ruoyi.iot.model.ThingsModels;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类的Id和名称输出
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public class ThingsModelsDto
|
||||
{
|
||||
public ThingsModelsDto(){
|
||||
properties=new ArrayList<>();
|
||||
functions=new ArrayList<>();
|
||||
events=new ArrayList<>();
|
||||
}
|
||||
|
||||
/** 属性 */
|
||||
private List<PropertyDto> properties;
|
||||
/** 功能 */
|
||||
private List<FunctionDto> functions;
|
||||
/** 事件 */
|
||||
private List<EventDto> events;
|
||||
|
||||
public List<PropertyDto> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(List<PropertyDto> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public List<FunctionDto> getFunctions() {
|
||||
return functions;
|
||||
}
|
||||
|
||||
public void setFunctions(List<FunctionDto> functions) {
|
||||
this.functions = functions;
|
||||
}
|
||||
|
||||
public List<EventDto> getEvents() {
|
||||
return events;
|
||||
}
|
||||
|
||||
public void setEvents(List<EventDto> events) {
|
||||
this.events = events;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.iot.mqtt;
|
||||
|
||||
import com.ruoyi.framework.web.domain.server.Sys;
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Classname MqttCallback
|
||||
* @Description 消费监听类
|
||||
*/
|
||||
@Component
|
||||
public class EmqxCallback implements MqttCallback {
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmqxCallback.class);
|
||||
|
||||
@Autowired
|
||||
private MqttConfig mqttConfig;
|
||||
|
||||
@Autowired
|
||||
private EmqxService emqxService;
|
||||
|
||||
@Override
|
||||
public void connectionLost(Throwable throwable) {
|
||||
try {
|
||||
// 重连mqtt
|
||||
while(true) {
|
||||
logger.info("mqtt连接断开,重新连接中...");
|
||||
EmqxClient.client.reconnect();
|
||||
Thread.sleep(10000);
|
||||
if(EmqxClient.client.isConnected()){
|
||||
logger.info("mqtt已经重新连接");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (MqttException | InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
logger.error("发生错误:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
|
||||
emqxService.subscribeCallback(topic,mqttMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||
// 消息到达 MQTT 代理时触发的事件
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.ruoyi.iot.mqtt;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Classname EmqxClient
|
||||
* @Description mqtt推送客户端
|
||||
*/
|
||||
@Component
|
||||
public class EmqxClient {
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmqxClient.class);
|
||||
|
||||
@Autowired
|
||||
private EmqxCallback emqxCallback;
|
||||
|
||||
@Autowired
|
||||
private EmqxService emqxService;
|
||||
|
||||
public static MqttClient client;
|
||||
|
||||
/**
|
||||
* 客户端连接
|
||||
*
|
||||
* @param host ip+端口
|
||||
* @param clientID 客户端Id
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @param timeout 超时时间
|
||||
* @param keepalive 保留数
|
||||
*/
|
||||
public void connect(String host, String clientID, String username, String password, int timeout, int keepalive) {
|
||||
MqttClient client;
|
||||
try {
|
||||
client = new MqttClient(host, clientID, new MemoryPersistence());
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setCleanSession(true);
|
||||
options.setUserName(username);
|
||||
options.setPassword(password.toCharArray());
|
||||
options.setConnectionTimeout(timeout);
|
||||
options.setKeepAliveInterval(keepalive);
|
||||
EmqxClient.client=client;
|
||||
client.setCallback(emqxCallback);
|
||||
clientConnect(options,client);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 10秒重连一次
|
||||
* @param options
|
||||
* @param client
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void clientConnect(MqttConnectOptions options, MqttClient client) throws InterruptedException {
|
||||
try {
|
||||
client.connect(options);
|
||||
logger.info("mqtt连接成功");
|
||||
// 订阅主题
|
||||
emqxService.subscribe(client);
|
||||
} catch (Exception e) {
|
||||
logger.error("mqtt连接失败,"+e.getMessage());
|
||||
//发生错误后重新连接
|
||||
Thread.sleep(10000);
|
||||
clientConnect(options,client);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布
|
||||
* @param qos 连接方式
|
||||
* @param retained 是否保留
|
||||
* @param topic 主题
|
||||
* @param pushMessage 消息体
|
||||
*/
|
||||
public void publish(int qos, boolean retained, String topic, String pushMessage) {
|
||||
logger.info("发布主题" + topic);
|
||||
MqttMessage message = new MqttMessage();
|
||||
message.setQos(qos);
|
||||
message.setRetained(retained);
|
||||
message.setPayload(pushMessage.getBytes());
|
||||
MqttTopic mTopic = EmqxClient.client.getTopic(topic);
|
||||
if (null == mTopic) {
|
||||
logger.error("topic not exist");
|
||||
}
|
||||
MqttDeliveryToken token;
|
||||
try {
|
||||
token = mTopic.publish(message);
|
||||
token.waitForCompletion();
|
||||
} catch (MqttPersistenceException e) {
|
||||
e.printStackTrace();
|
||||
} catch (MqttException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订阅某个主题
|
||||
* @param topic 主题
|
||||
* @param qos 连接方式
|
||||
*/
|
||||
public void subscribe(String topic, int qos) {
|
||||
logger.info("订阅主题" + topic);
|
||||
try {
|
||||
EmqxClient.client.subscribe(topic, qos);
|
||||
} catch (MqttException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.ruoyi.iot.mqtt;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.iot.domain.Device;
|
||||
import com.ruoyi.iot.domain.DeviceLog;
|
||||
import com.ruoyi.iot.model.NtpModel;
|
||||
import com.ruoyi.iot.model.ThingsModels.IdentityAndName;
|
||||
import com.ruoyi.iot.model.ThingsModels.ThingsModelValueItem;
|
||||
import com.ruoyi.iot.model.ThingsModels.ThingsModelValueRemarkItem;
|
||||
import com.ruoyi.iot.model.ThingsModels.ThingsModelValuesInput;
|
||||
import com.ruoyi.iot.service.IDeviceLogService;
|
||||
import com.ruoyi.iot.service.IDeviceService;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class EmqxService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmqxService.class);
|
||||
|
||||
@Autowired
|
||||
private EmqxClient emqxClient;
|
||||
|
||||
@Autowired
|
||||
private IDeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceLogService deviceLogService;
|
||||
|
||||
/** 订阅的主题 */
|
||||
private static final String prefix="/+/+/";
|
||||
String sInfoTopic = prefix + "info/post";
|
||||
String sNtpTopic = prefix + "ntp/post";
|
||||
String sPropertyTopic = prefix + "property/post";
|
||||
String sFunctionTopic = prefix + "function/post";
|
||||
String sEventTopic = prefix + "event/post";
|
||||
String sShadowPropertyTopic = prefix + "property-offline/post";
|
||||
String sShadowFunctionTopic = prefix + "function-offline/post";
|
||||
|
||||
/** 发布的主题 */
|
||||
String pStatusTopic = "/status/post";
|
||||
String pNtpTopic = "/ntp/get";
|
||||
String pPropertyTopic = "/property/get";
|
||||
String pFunctionTopic = "/function/get";
|
||||
|
||||
public void subscribe(MqttClient client) throws MqttException {
|
||||
// 订阅设备信息
|
||||
client.subscribe(sInfoTopic, 1);
|
||||
// 订阅时钟同步
|
||||
client.subscribe(sNtpTopic, 1);
|
||||
// 订阅设备属性
|
||||
client.subscribe(sPropertyTopic,1);
|
||||
// 订阅设备功能
|
||||
client.subscribe(sFunctionTopic,1);
|
||||
// 订阅设备事件
|
||||
client.subscribe(sEventTopic,1);
|
||||
// 订阅属性(影子模式)
|
||||
client.subscribe(sShadowPropertyTopic,1);
|
||||
// 订阅功能(影子模式)
|
||||
client.subscribe(sShadowFunctionTopic,1);
|
||||
logger.info("mqtt订阅了设备信息和物模型主题");
|
||||
}
|
||||
|
||||
public void subscribeCallback(String topic, MqttMessage mqttMessage){
|
||||
// subscribe后得到的消息会执行到这里面
|
||||
String message=new String(mqttMessage.getPayload());
|
||||
logger.info("接收消息主题 : " + topic);
|
||||
logger.info("接收消息Qos : " + mqttMessage.getQos());
|
||||
logger.info("接收消息内容 : " + message);
|
||||
|
||||
String[] topicItem=topic.substring(1).split("/");
|
||||
Long productId= Long.valueOf(topicItem[0]);
|
||||
String deviceNum=topicItem[1];
|
||||
String name=topicItem[2];
|
||||
switch (name){
|
||||
case "info":
|
||||
reportDevice(productId,deviceNum,message);
|
||||
break;
|
||||
case "ntp":
|
||||
publishNtp(productId,deviceNum,message);
|
||||
break;
|
||||
case "property":
|
||||
reportProperty(productId,deviceNum,message,false);
|
||||
break;
|
||||
case "function":
|
||||
reportFunction(productId,deviceNum,message,false);
|
||||
break;
|
||||
case "event":
|
||||
reportEvent(productId,deviceNum,message);
|
||||
break;
|
||||
case "property-offline":
|
||||
reportProperty(productId,deviceNum,message,true);
|
||||
break;
|
||||
case "function-offline":
|
||||
reportFunction(productId,deviceNum,message,true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报设备信息
|
||||
*/
|
||||
private void reportDevice(Long productId,String deviceNum,String message){
|
||||
Device device=JSON.parseObject(message,Device.class);
|
||||
device.setProductId(productId);
|
||||
device.setSerialNumber(deviceNum);
|
||||
deviceService.reportDevice(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报属性
|
||||
* @param message
|
||||
*/
|
||||
private void reportProperty(Long productId,String deviceNum,String message,boolean isShadow){
|
||||
List<ThingsModelValueRemarkItem> thingsModelValueRemarkItems=JSON.parseArray(message, ThingsModelValueRemarkItem.class);
|
||||
ThingsModelValuesInput input=new ThingsModelValuesInput();
|
||||
input.setProductId(productId);
|
||||
input.setDeviceNumber(deviceNum);
|
||||
input.setThingsModelValueRemarkItem(thingsModelValueRemarkItems);
|
||||
deviceService.reportDeviceThingsModelValue(input,1,isShadow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报功能
|
||||
* @param message
|
||||
*/
|
||||
private void reportFunction(Long productId,String deviceNum,String message,boolean isShadow){
|
||||
List<ThingsModelValueRemarkItem> thingsModelValueRemarkItems=JSON.parseArray(message, ThingsModelValueRemarkItem.class);
|
||||
ThingsModelValuesInput input=new ThingsModelValuesInput();
|
||||
input.setProductId(productId);
|
||||
input.setDeviceNumber(deviceNum);
|
||||
input.setThingsModelValueRemarkItem(thingsModelValueRemarkItems);
|
||||
deviceService.reportDeviceThingsModelValue(input,2,isShadow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报事件
|
||||
* @param message
|
||||
*/
|
||||
private void reportEvent(Long productId,String deviceNum,String message){
|
||||
List<ThingsModelValueRemarkItem> thingsModelValueRemarkItems=JSON.parseArray(message, ThingsModelValueRemarkItem.class);
|
||||
Device device =deviceService.selectDeviceBySerialNumber(deviceNum);
|
||||
for(int i=0;i<thingsModelValueRemarkItems.size();i++) {
|
||||
// 添加到设备日志
|
||||
DeviceLog deviceLog = new DeviceLog();
|
||||
deviceLog.setDeviceId(device.getDeviceId());
|
||||
deviceLog.setDeviceName(device.getDeviceName());
|
||||
deviceLog.setLogValue(thingsModelValueRemarkItems.get(i).getValue());
|
||||
deviceLog.setRemark(thingsModelValueRemarkItems.get(i).getRemark());
|
||||
deviceLog.setSerialNumber(device.getSerialNumber());
|
||||
deviceLog.setIdentity(thingsModelValueRemarkItems.get(i).getId());
|
||||
deviceLog.setLogType(3);
|
||||
deviceLog.setIsMonitor(0);
|
||||
deviceLogService.insertDeviceLog(deviceLog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 1.发布设备状态
|
||||
*/
|
||||
public void publishStatus(Long productId,String deviceNum,int deviceStatus,int isShadow){
|
||||
String message="{\"status\":"+deviceStatus+",\"isShadow\":"+isShadow+"}";
|
||||
emqxClient.publish(1,false,"/"+productId+"/"+deviceNum+pStatusTopic, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.发布时钟同步信息
|
||||
* @param message
|
||||
*/
|
||||
private void publishNtp(Long productId,String deviceNum,String message){
|
||||
NtpModel ntpModel=JSON.parseObject(message,NtpModel.class);
|
||||
ntpModel.setServerRecvTime(System.currentTimeMillis());
|
||||
ntpModel.setServerSendTime(System.currentTimeMillis());
|
||||
emqxClient.publish(1, false, "/"+productId+"/"+deviceNum+pNtpTopic, JSON.toJSONString(ntpModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.发布属性
|
||||
*/
|
||||
public void publishProperty(Long productId,String deviceNum,List<IdentityAndName> thingsList){
|
||||
if(thingsList==null){
|
||||
emqxClient.publish(1,true,"/"+productId+"/"+deviceNum+pPropertyTopic, "");
|
||||
}else{
|
||||
emqxClient.publish(1,true,"/"+productId+"/"+deviceNum+pPropertyTopic, JSON.toJSONString(thingsList));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.发布功能
|
||||
*/
|
||||
public void publishFunction(Long productId,String deviceNum,List<IdentityAndName> thingsList){
|
||||
if(thingsList==null){
|
||||
emqxClient.publish(1,true,"/"+productId+"/"+deviceNum+pFunctionTopic, "");
|
||||
}else{
|
||||
emqxClient.publish(1,true,"/"+productId+"/"+deviceNum+pFunctionTopic, JSON.toJSONString(thingsList));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.iot.mqtt;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
*项目启动执行
|
||||
*/
|
||||
@Component
|
||||
@Order(value = 1) //执行顺序控制
|
||||
public class EmqxStart implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
private MqttConfig mqttConfig;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments applicationArguments){
|
||||
mqttConfig.EmqxClientStart();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.ruoyi.iot.mqtt;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Classname MqttConfig
|
||||
* @Description mqtt配置信息
|
||||
* @author kerwincui
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties("spring.mqtt")
|
||||
public class MqttConfig {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MqttConfig.class);
|
||||
|
||||
@Autowired
|
||||
private EmqxClient emqxClient;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 连接地址
|
||||
*/
|
||||
private String hostUrl;
|
||||
/**
|
||||
* 客户Id
|
||||
*/
|
||||
private String clientId;
|
||||
/**
|
||||
* 默认连接话题
|
||||
*/
|
||||
private String defaultTopic;
|
||||
/**
|
||||
* 超时时间
|
||||
*/
|
||||
private int timeout;
|
||||
/**
|
||||
* 保持连接数
|
||||
*/
|
||||
private int keepalive;
|
||||
|
||||
|
||||
public String getusername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
public void setusername(String username) {this.username = username;}
|
||||
|
||||
public String getpassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
public void setpassword(String password) {this.password = password;}
|
||||
|
||||
public String gethostUrl()
|
||||
{
|
||||
return hostUrl;
|
||||
}
|
||||
public void sethostUrl(String hostUrl) {this.hostUrl = hostUrl;}
|
||||
|
||||
public String getclientId()
|
||||
{
|
||||
return "server-"+clientId;
|
||||
}
|
||||
public void setclientId(String clientId) {this.clientId = clientId;}
|
||||
|
||||
public String getdefaultTopic()
|
||||
{
|
||||
return defaultTopic;
|
||||
}
|
||||
public void setdefaultTopic(String defaultTopic) {this.defaultTopic = defaultTopic;}
|
||||
|
||||
public int gettimeout()
|
||||
{
|
||||
return timeout;
|
||||
}
|
||||
public void settimeout(int timeout) {this.timeout = timeout;}
|
||||
|
||||
public int getkeepalive()
|
||||
{
|
||||
return keepalive;
|
||||
}
|
||||
public void setkeepalive(int keepalive) {this.keepalive = keepalive;}
|
||||
|
||||
// @Bean
|
||||
public void EmqxClientStart() {
|
||||
logger.info("mqtt启动中...");
|
||||
emqxClient.connect(gethostUrl(), getclientId(), getusername(), getpassword(), gettimeout(), getkeepalive());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.ruoyi.iot.oauth;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
|
||||
import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
|
||||
import org.springframework.security.oauth2.provider.approval.ApprovalStore;
|
||||
import org.springframework.security.oauth2.provider.approval.JdbcApprovalStore;
|
||||
import org.springframework.security.oauth2.provider.approval.UserApprovalHandler;
|
||||
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
|
||||
import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices;
|
||||
import org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint;
|
||||
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory;
|
||||
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* 授权服务器配置,配置客户端id,密钥和令牌的过期时间
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAuthorizationServer
|
||||
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Autowired
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
/**
|
||||
* 用来配置令牌端点(Token Endpoint)的安全约束
|
||||
* @param security
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
|
||||
security.allowFormAuthenticationForClients()
|
||||
.authenticationEntryPoint(new OAuth2AuthenticationEntryPoint());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来配置客户端详情服务
|
||||
* @param clients
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
|
||||
|
||||
clients.withClientDetails(getClientDetailsService());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来配置授权(authorization)以及令牌(token)的访问端点和令牌服务(token services)。
|
||||
* @param endpoints
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
|
||||
// 查询用户、授权、分组,可以被重写
|
||||
endpoints.userDetailsService(userDetailsService)
|
||||
// 审批客户端的授权
|
||||
.userApprovalHandler(userApprovalHandler())
|
||||
// 授权审批
|
||||
.approvalStore(approvalStore())
|
||||
// 获取授权码
|
||||
.authorizationCodeServices(new JdbcAuthorizationCodeServices(dataSource))
|
||||
// 验证token
|
||||
.authenticationManager(authenticationManager)
|
||||
// 查询、保存、刷新token
|
||||
.tokenStore(this.getJdbcTokenStore());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ApprovalStore approvalStore() {
|
||||
return new JdbcApprovalStore(dataSource);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public UserApprovalHandler userApprovalHandler() {
|
||||
return new SpeakerApprovalHandler(getClientDetailsService(), approvalStore(), oAuth2RequestFactory());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JdbcClientDetailsService getClientDetailsService() {
|
||||
JdbcClientDetailsService jdbcClientDetailsService = new JdbcClientDetailsService(dataSource);
|
||||
jdbcClientDetailsService.setPasswordEncoder(passwordEncoder());
|
||||
return jdbcClientDetailsService;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public OAuth2RequestFactory oAuth2RequestFactory() {
|
||||
return new DefaultOAuth2RequestFactory(getClientDetailsService());
|
||||
}
|
||||
@Bean
|
||||
public TokenStore getJdbcTokenStore(){
|
||||
TokenStore tokenStore = new JdbcTokenStore(dataSource);
|
||||
return tokenStore;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public BCryptPasswordEncoder passwordEncoder(){
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.ruoyi.iot.oauth;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
|
||||
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager;
|
||||
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@EnableResourceServer
|
||||
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Override
|
||||
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
|
||||
TokenStore tokenStore = jdbcTokenStore();
|
||||
OAuth2AuthenticationManager auth2AuthenticationManager= new OAuth2AuthenticationManager();
|
||||
resources.authenticationManager(auth2AuthenticationManager);
|
||||
resources.resourceId("speaker-service").tokenStore(tokenStore).stateless(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(HttpSecurity http) throws Exception {
|
||||
// 限制资源服务器只接管匹配的资源
|
||||
http.requestMatchers().antMatchers("/oauth/speaker/**")
|
||||
.and()
|
||||
//授权的请求
|
||||
.authorizeRequests()
|
||||
.anyRequest().authenticated()
|
||||
//关闭跨站请求防护
|
||||
.and()
|
||||
.csrf().disable();
|
||||
}
|
||||
|
||||
public TokenStore jdbcTokenStore(){
|
||||
TokenStore tokenStore = new JdbcTokenStore(dataSource);
|
||||
return tokenStore;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.ruoyi.iot.oauth;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.oauth2.common.util.OAuth2Utils;
|
||||
import org.springframework.security.oauth2.provider.AuthorizationRequest;
|
||||
import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
|
||||
import org.springframework.security.oauth2.provider.approval.Approval;
|
||||
import org.springframework.security.oauth2.provider.approval.ApprovalStore;
|
||||
import org.springframework.security.oauth2.provider.approval.ApprovalStoreUserApprovalHandler;
|
||||
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* kerwincui
|
||||
*/
|
||||
public class SpeakerApprovalHandler extends ApprovalStoreUserApprovalHandler {
|
||||
|
||||
private int approvalExpirySeconds = -1;
|
||||
|
||||
@Autowired
|
||||
private ApprovalStore approvalStore;
|
||||
|
||||
public SpeakerApprovalHandler(JdbcClientDetailsService clientDetailsService, ApprovalStore approvalStore, OAuth2RequestFactory oAuth2RequestFactory) {
|
||||
this.setApprovalStore(approvalStore);
|
||||
this.setClientDetailsService(clientDetailsService);
|
||||
this.setRequestFactory(oAuth2RequestFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthorizationRequest updateAfterApproval(AuthorizationRequest authorizationRequest, Authentication userAuthentication) {
|
||||
// 获取授权过的范围
|
||||
Set<String> requestedScopes = authorizationRequest.getScope();
|
||||
Set<String> approvedScopes = new HashSet<String>();
|
||||
Set<Approval> approvals = new HashSet<Approval>();
|
||||
Date expiry = computeExpiry();
|
||||
|
||||
// 存储授权或拒绝的范围
|
||||
Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters();
|
||||
for (String requestedScope : requestedScopes) {
|
||||
String approvalParameter = OAuth2Utils.SCOPE_PREFIX + requestedScope;
|
||||
String value = approvalParameters.get(approvalParameter);
|
||||
value = value == null ? "" : value.toLowerCase();
|
||||
if ("true".equals(value) || value.startsWith("approve")||value.equals("on")) {
|
||||
approvedScopes.add(requestedScope);
|
||||
approvals.add(new Approval(userAuthentication.getName(), authorizationRequest.getClientId(),
|
||||
requestedScope, expiry, Approval.ApprovalStatus.APPROVED));
|
||||
}
|
||||
else {
|
||||
approvals.add(new Approval(userAuthentication.getName(), authorizationRequest.getClientId(),
|
||||
requestedScope, expiry, Approval.ApprovalStatus.DENIED));
|
||||
}
|
||||
}
|
||||
approvalStore.addApprovals(approvals);
|
||||
|
||||
boolean approved;
|
||||
authorizationRequest.setScope(approvedScopes);
|
||||
if (approvedScopes.isEmpty() && !requestedScopes.isEmpty()) {
|
||||
approved = false;
|
||||
}
|
||||
else {
|
||||
approved = true;
|
||||
}
|
||||
authorizationRequest.setApproved(approved);
|
||||
return authorizationRequest;
|
||||
}
|
||||
|
||||
private Date computeExpiry() {
|
||||
Calendar expiresAt = Calendar.getInstance();
|
||||
// 默认一个月
|
||||
if (approvalExpirySeconds == -1) {
|
||||
expiresAt.add(Calendar.MONTH, 1);
|
||||
}
|
||||
else {
|
||||
expiresAt.add(Calendar.SECOND, approvalExpirySeconds);
|
||||
}
|
||||
return expiresAt.getTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.ruoyi.iot.oauth.api;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.oauth2.common.util.OAuth2Utils;
|
||||
import org.springframework.security.oauth2.provider.AuthorizationRequest;
|
||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||
import org.springframework.security.oauth2.provider.approval.Approval;
|
||||
import org.springframework.security.oauth2.provider.approval.ApprovalStore;
|
||||
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* kerwincui
|
||||
*/
|
||||
@Controller
|
||||
@SessionAttributes("authorizationRequest")
|
||||
public class ConfirmAccessController {
|
||||
@Autowired
|
||||
private JdbcClientDetailsService clientDetailsService;
|
||||
@Autowired
|
||||
private ApprovalStore approvalStore;
|
||||
|
||||
@RequestMapping("/oauth/confirm_access")
|
||||
public String getAccessConfirmation(Map<String, Object> model, Principal principal ) {
|
||||
AuthorizationRequest clientAuth = (AuthorizationRequest) model.remove("authorizationRequest");
|
||||
ClientDetails client = clientDetailsService.loadClientByClientId(clientAuth.getClientId());
|
||||
|
||||
Map<String, String> scopes = new LinkedHashMap<String, String>();
|
||||
for (String scope : clientAuth.getScope()) {
|
||||
scopes.put(OAuth2Utils.SCOPE_PREFIX + scope, "false");
|
||||
}
|
||||
for (Approval approval : approvalStore.getApprovals(principal.getName(), client.getClientId())) {
|
||||
if (clientAuth.getScope().contains(approval.getScope())) {
|
||||
scopes.put(OAuth2Utils.SCOPE_PREFIX + approval.getScope(),
|
||||
approval.getStatus() == Approval.ApprovalStatus.APPROVED ? "true" : "false");
|
||||
}
|
||||
}
|
||||
model.put("auth_request", clientAuth);
|
||||
model.put("client", client);
|
||||
model.put("scopes", scopes);
|
||||
return "oauth/access_confirmation";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.ruoyi.iot.oauth.api;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.oauth2.common.OAuth2AccessToken;
|
||||
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
@Autowired
|
||||
private TokenStore tokenStore;
|
||||
|
||||
@RequestMapping("/oauth/login")
|
||||
public String login() {
|
||||
return "oauth/login";
|
||||
}
|
||||
|
||||
@RequestMapping("/oauth/index")
|
||||
public String index() {
|
||||
return "oauth/index";
|
||||
}
|
||||
|
||||
@GetMapping("/oauth/logout")
|
||||
@ResponseBody
|
||||
public String logout(@RequestHeader String Authorization) {
|
||||
if (!Authorization.isEmpty()){
|
||||
String token=Authorization.split(" ")[1];
|
||||
OAuth2AccessToken auth2AccessToken = tokenStore.readAccessToken(token);
|
||||
tokenStore.removeAccessToken(auth2AccessToken);
|
||||
return "SUCCESS";
|
||||
}else{
|
||||
return "FAIL";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.iot.oauth.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* kerwincui
|
||||
*/
|
||||
@RestController
|
||||
public class SpeakerController {
|
||||
@GetMapping("/oauth/speaker/get")
|
||||
public JSONObject getSpeaker() {
|
||||
// Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
JSONObject Json = new JSONObject();
|
||||
Json.put("1", "1");
|
||||
Json.put("2", "2");
|
||||
Json.put("3", "3");
|
||||
System.out.println("调用了接口get");
|
||||
return Json;
|
||||
}
|
||||
@PostMapping("/oauth/speaker/post")
|
||||
public JSONObject postSpeaker() {
|
||||
// Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
JSONObject bookJson = new JSONObject();
|
||||
bookJson.put("1", "1");
|
||||
System.out.println("调用了接口post");
|
||||
return bookJson;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import com.ruoyi.iot.domain.AlertLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备告警Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
public interface IAlertLogService
|
||||
{
|
||||
/**
|
||||
* 查询设备告警
|
||||
*
|
||||
* @param alertLogId 设备告警主键
|
||||
* @return 设备告警
|
||||
*/
|
||||
public AlertLog selectAlertLogByAlertLogId(Long alertLogId);
|
||||
|
||||
/**
|
||||
* 查询设备告警列表
|
||||
*
|
||||
* @param alertLog 设备告警
|
||||
* @return 设备告警集合
|
||||
*/
|
||||
public List<AlertLog> selectAlertLogList(AlertLog alertLog);
|
||||
|
||||
/**
|
||||
* 新增设备告警
|
||||
*
|
||||
* @param alertLog 设备告警
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAlertLog(AlertLog alertLog);
|
||||
|
||||
/**
|
||||
* 修改设备告警
|
||||
*
|
||||
* @param alertLog 设备告警
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAlertLog(AlertLog alertLog);
|
||||
|
||||
/**
|
||||
* 批量删除设备告警
|
||||
*
|
||||
* @param alertLogIds 需要删除的设备告警主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlertLogByAlertLogIds(Long[] alertLogIds);
|
||||
|
||||
/**
|
||||
* 删除设备告警信息
|
||||
*
|
||||
* @param alertLogId 设备告警主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlertLogByAlertLogId(Long alertLogId);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.Alert;
|
||||
|
||||
/**
|
||||
* 设备告警Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
public interface IAlertService
|
||||
{
|
||||
/**
|
||||
* 查询设备告警
|
||||
*
|
||||
* @param alertId 设备告警主键
|
||||
* @return 设备告警
|
||||
*/
|
||||
public Alert selectAlertByAlertId(Long alertId);
|
||||
|
||||
/**
|
||||
* 查询设备告警列表
|
||||
*
|
||||
* @param alert 设备告警
|
||||
* @return 设备告警集合
|
||||
*/
|
||||
public List<Alert> selectAlertList(Alert alert);
|
||||
|
||||
/**
|
||||
* 新增设备告警
|
||||
*
|
||||
* @param alert 设备告警
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAlert(Alert alert);
|
||||
|
||||
/**
|
||||
* 修改设备告警
|
||||
*
|
||||
* @param alert 设备告警
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAlert(Alert alert);
|
||||
|
||||
/**
|
||||
* 批量删除设备告警
|
||||
*
|
||||
* @param alertIds 需要删除的设备告警主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlertByAlertIds(Long[] alertIds);
|
||||
|
||||
/**
|
||||
* 删除设备告警信息
|
||||
*
|
||||
* @param alertId 设备告警主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAlertByAlertId(Long alertId);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.iot.domain.Category;
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public interface ICategoryService
|
||||
{
|
||||
/**
|
||||
* 查询产品分类
|
||||
*
|
||||
* @param categoryId 产品分类主键
|
||||
* @return 产品分类
|
||||
*/
|
||||
public Category selectCategoryByCategoryId(Long categoryId);
|
||||
|
||||
/**
|
||||
* 查询产品分类列表
|
||||
*
|
||||
* @param category 产品分类
|
||||
* @return 产品分类集合
|
||||
*/
|
||||
public List<Category> selectCategoryList(Category category);
|
||||
|
||||
/**
|
||||
* 查询产品简短分类列表
|
||||
*
|
||||
* @return 产品分类集合
|
||||
*/
|
||||
public List<IdAndName> selectCategoryShortList();
|
||||
|
||||
/**
|
||||
* 新增产品分类
|
||||
*
|
||||
* @param category 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCategory(Category category);
|
||||
|
||||
/**
|
||||
* 修改产品分类
|
||||
*
|
||||
* @param category 产品分类
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCategory(Category category);
|
||||
|
||||
/**
|
||||
* 批量删除产品分类
|
||||
*
|
||||
* @param categoryIds 需要删除的产品分类主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public AjaxResult deleteCategoryByCategoryIds(Long[] categoryIds);
|
||||
|
||||
/**
|
||||
* 删除产品分类信息
|
||||
*
|
||||
* @param categoryId 产品分类主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCategoryByCategoryId(Long categoryId);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import com.ruoyi.common.exception.job.TaskException;
|
||||
import com.ruoyi.iot.domain.DeviceJob;
|
||||
import org.quartz.SchedulerException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务调度信息信息 服务层
|
||||
*
|
||||
* @author kerwincui
|
||||
*/
|
||||
public interface IDeviceJobService
|
||||
{
|
||||
/**
|
||||
* 获取quartz调度器的计划任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 调度任务集合
|
||||
*/
|
||||
public List<DeviceJob> selectJobList(DeviceJob job);
|
||||
|
||||
/**
|
||||
* 通过调度任务ID查询调度信息
|
||||
*
|
||||
* @param jobId 调度任务ID
|
||||
* @return 调度任务对象信息
|
||||
*/
|
||||
public DeviceJob selectJobById(Long jobId);
|
||||
|
||||
/**
|
||||
* 暂停任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int pauseJob(DeviceJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 恢复任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int resumeJob(DeviceJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 删除任务后,所对应的trigger也将被删除
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJob(DeviceJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 批量删除调度信息
|
||||
*
|
||||
* @param jobIds 需要删除的任务ID
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteJobByIds(Long[] jobIds) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 根据设备Ids批量删除调度信息
|
||||
*
|
||||
* @param deviceIds 需要删除数据的设备Ids
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteJobByDeviceIds(Long[] deviceIds) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int changeStatus(DeviceJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 立即运行任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public void run(DeviceJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 新增任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJob(DeviceJob job) throws SchedulerException, TaskException;
|
||||
|
||||
/**
|
||||
* 更新任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJob(DeviceJob job) throws SchedulerException, TaskException;
|
||||
|
||||
/**
|
||||
* 校验cron表达式是否有效
|
||||
*
|
||||
* @param cronExpression 表达式
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkCronExpressionIsValid(String cronExpression);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import com.ruoyi.iot.domain.DeviceLog;
|
||||
import com.ruoyi.iot.model.MonitorModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备日志Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2022-01-13
|
||||
*/
|
||||
public interface IDeviceLogService
|
||||
{
|
||||
/**
|
||||
* 查询设备日志
|
||||
*
|
||||
* @param logId 设备日志主键
|
||||
* @return 设备日志
|
||||
*/
|
||||
public DeviceLog selectDeviceLogByLogId(Long logId);
|
||||
|
||||
/**
|
||||
* 查询设备日志列表
|
||||
*
|
||||
* @param deviceLog 设备日志
|
||||
* @return 设备日志集合
|
||||
*/
|
||||
public List<DeviceLog> selectDeviceLogList(DeviceLog deviceLog);
|
||||
|
||||
/**
|
||||
* 查询设备监测数据
|
||||
*
|
||||
* @param deviceLog 设备日志
|
||||
* @return 设备日志集合
|
||||
*/
|
||||
public List<MonitorModel> selectMonitorList(DeviceLog deviceLog);
|
||||
|
||||
/**
|
||||
* 新增设备日志
|
||||
*
|
||||
* @param deviceLog 设备日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceLog(DeviceLog deviceLog);
|
||||
|
||||
/**
|
||||
* 修改设备日志
|
||||
*
|
||||
* @param deviceLog 设备日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceLog(DeviceLog deviceLog);
|
||||
|
||||
/**
|
||||
* 批量删除设备日志
|
||||
*
|
||||
* @param logIds 需要删除的设备日志主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceLogByLogIds(Long[] logIds);
|
||||
|
||||
/**
|
||||
* 删除设备日志信息
|
||||
*
|
||||
* @param logId 设备日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceLogByLogId(Long logId);
|
||||
|
||||
/**
|
||||
* 根据设备IDs批量删除设备日志
|
||||
*
|
||||
* @param deviceIds 需要删除的设备日志IDs
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceLogByDeviceIds(Long[] deviceIds);
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import com.ruoyi.iot.domain.Device;
|
||||
import com.ruoyi.iot.model.*;
|
||||
import com.ruoyi.iot.model.ThingsModels.ThingsModelShadow;
|
||||
import com.ruoyi.iot.model.ThingsModels.ThingsModelValuesInput;
|
||||
import org.quartz.SchedulerException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public interface IDeviceService
|
||||
{
|
||||
/**
|
||||
* 查询设备
|
||||
*
|
||||
* @param deviceId 设备主键
|
||||
* @return 设备
|
||||
*/
|
||||
public Device selectDeviceByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 根据设备编号查询设备
|
||||
*
|
||||
* @param serialNumber 设备主键
|
||||
* @return 设备
|
||||
*/
|
||||
public Device selectDeviceBySerialNumber(String serialNumber);
|
||||
|
||||
/**
|
||||
* 根据设备编号查询简介设备
|
||||
*
|
||||
* @param serialNumber 设备主键
|
||||
* @return 设备
|
||||
*/
|
||||
public Device selectShortDeviceBySerialNumber(String serialNumber);
|
||||
|
||||
/**
|
||||
* 根据设备编号查询设备认证信息
|
||||
*
|
||||
* @param model 设备编号和产品ID
|
||||
* @return 设备
|
||||
*/
|
||||
public DeviceAuthenticateModel selectDeviceAuthenticate(AuthenticateInputModel model);
|
||||
|
||||
/**
|
||||
* 查询设备和运行状态
|
||||
*
|
||||
* @param deviceId 设备主键
|
||||
* @return 设备
|
||||
*/
|
||||
public DeviceShortOutput selectDeviceRunningStatusByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 上报设备的物模型
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public int reportDeviceThingsModelValue(ThingsModelValuesInput input,int type,boolean isShadow);
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 设备集合
|
||||
*/
|
||||
public List<Device> selectDeviceList(Device device);
|
||||
|
||||
/**
|
||||
* 查询所有设备简短列表
|
||||
*
|
||||
* @return 设备
|
||||
*/
|
||||
public List<DeviceAllShortOutput> selectAllDeviceShortList();
|
||||
|
||||
/**
|
||||
* 查询设备简短列表
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 设备集合
|
||||
*/
|
||||
public List<DeviceShortOutput> selectDeviceShortList(Device device);
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public Device insertDevice(Device device);
|
||||
|
||||
/**
|
||||
* 设备认证后自动添加设备
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceAuto(String serialNumber,Long userId,Long productId);
|
||||
|
||||
/**
|
||||
* 获取设备设置的影子
|
||||
* @param device
|
||||
* @return
|
||||
*/
|
||||
public ThingsModelShadow getDeviceShadowThingsModel(Device device);
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*
|
||||
* @param device 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDevice(Device device);
|
||||
|
||||
/**
|
||||
* 更新设备状态
|
||||
* @param device 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceStatusAndLocation(Device device,String ipAddress);
|
||||
|
||||
/**
|
||||
* 上报设备信息
|
||||
* @param device 设备
|
||||
* @return 结果
|
||||
*/
|
||||
public int reportDevice(Device device);
|
||||
|
||||
/**
|
||||
* 批量删除设备
|
||||
*
|
||||
* @param deviceIds 需要删除的设备主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceByDeviceIds(Long[] deviceIds) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 删除设备信息
|
||||
*
|
||||
* @param deviceId 设备主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 生成设备唯一编号
|
||||
* @return 结果
|
||||
*/
|
||||
public String generationDeviceNum();
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.DeviceUser;
|
||||
|
||||
/**
|
||||
* 设备用户Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public interface IDeviceUserService
|
||||
{
|
||||
/**
|
||||
* 查询设备用户
|
||||
*
|
||||
* @param deviceId 设备用户主键
|
||||
* @return 设备用户
|
||||
*/
|
||||
public DeviceUser selectDeviceUserByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 查询设备用户列表
|
||||
*
|
||||
* @param deviceUser 设备用户
|
||||
* @return 设备用户集合
|
||||
*/
|
||||
public List<DeviceUser> selectDeviceUserList(DeviceUser deviceUser);
|
||||
|
||||
/**
|
||||
* 新增设备用户
|
||||
*
|
||||
* @param deviceUser 设备用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceUser(DeviceUser deviceUser);
|
||||
|
||||
/**
|
||||
* 修改设备用户
|
||||
*
|
||||
* @param deviceUser 设备用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceUser(DeviceUser deviceUser);
|
||||
|
||||
/**
|
||||
* 批量删除设备用户
|
||||
*
|
||||
* @param deviceIds 需要删除的设备用户主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceUserByDeviceIds(Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 删除设备用户信息
|
||||
*
|
||||
* @param deviceId 设备用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceUserByDeviceId(Long deviceId);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.iot.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.iot.domain.Firmware;
|
||||
|
||||
/**
|
||||
* 产品固件Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2021-12-16
|
||||
*/
|
||||
public interface IFirmwareService
|
||||
{
|
||||
/**
|
||||
* 查询产品固件
|
||||
*
|
||||
* @param firmwareId 产品固件主键
|
||||
* @return 产品固件
|
||||
*/
|
||||
public Firmware selectFirmwareByFirmwareId(Long firmwareId);
|
||||
|
||||
/**
|
||||
* 查询产品固件列表
|
||||
*
|
||||
* @param firmware 产品固件
|
||||
* @return 产品固件集合
|
||||
*/
|
||||
public List<Firmware> selectFirmwareList(Firmware firmware);
|
||||
|
||||
/**
|
||||
* 新增产品固件
|
||||
*
|
||||
* @param firmware 产品固件
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFirmware(Firmware firmware);
|
||||
|
||||
/**
|
||||
* 修改产品固件
|
||||
*
|
||||
* @param firmware 产品固件
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFirmware(Firmware firmware);
|
||||
|
||||
/**
|
||||
* 批量删除产品固件
|
||||
*
|
||||
* @param firmwareIds 需要删除的产品固件主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFirmwareByFirmwareIds(Long[] firmwareIds);
|
||||
|
||||
/**
|
||||
* 删除产品固件信息
|
||||
*
|
||||
* @param firmwareId 产品固件主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFirmwareByFirmwareId(Long firmwareId);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user