1-21 ------
This commit is contained in:
@@ -34,4 +34,5 @@ public class DeviceStatusBo {
|
|||||||
private String mqttAccount;
|
private String mqttAccount;
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public class DeviceStatusConsumer {
|
|||||||
device.setStatus(1);
|
device.setStatus(1);
|
||||||
device.setTenantId(1L);
|
device.setTenantId(1L);
|
||||||
device.setTenantName("admin");
|
device.setTenantName("admin");
|
||||||
|
device.setGroupId(0L);
|
||||||
|
|
||||||
deviceService.insertDeviceTest(device);
|
deviceService.insertDeviceTest(device);
|
||||||
device = deviceService.selectDeviceBySerialNumber(bo.getSerialNumber());
|
device = deviceService.selectDeviceBySerialNumber(bo.getSerialNumber());
|
||||||
}
|
}
|
||||||
@@ -84,12 +86,22 @@ public class DeviceStatusConsumer {
|
|||||||
if (containsKey && !isOnline) {
|
if (containsKey && !isOnline) {
|
||||||
//如果session存在,但数据库状态不在线,则以session为准
|
//如果session存在,但数据库状态不在线,则以session为准
|
||||||
bo.setStatus(DeviceStatus.ONLINE);
|
bo.setStatus(DeviceStatus.ONLINE);
|
||||||
|
device.setDelFlag("0");
|
||||||
}
|
}
|
||||||
if (!containsKey && isOnline) {
|
if (!containsKey && isOnline) {
|
||||||
bo.setStatus(DeviceStatus.OFFLINE);
|
bo.setStatus(DeviceStatus.OFFLINE);
|
||||||
|
|
||||||
|
// 判断下 项目id
|
||||||
|
if (device.getGroupId().equals(0L) || device.getGroupId() == null) {
|
||||||
|
//设置删除状态 todo
|
||||||
|
device.setDelFlag("2");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*更新设备状态*/
|
/*更新设备状态*/
|
||||||
|
|
||||||
deviceCache.updateDeviceStatusCache(bo, device);
|
deviceCache.updateDeviceStatusCache(bo, device);
|
||||||
//处理影子模式值
|
//处理影子模式值
|
||||||
this.handlerShadow(device, bo.getStatus());
|
this.handlerShadow(device, bo.getStatus());
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.xinda.data.controller;
|
|||||||
|
|
||||||
import com.xinda.common.core.controller.BaseController;
|
import com.xinda.common.core.controller.BaseController;
|
||||||
import com.xinda.common.core.domain.AjaxResult;
|
import com.xinda.common.core.domain.AjaxResult;
|
||||||
|
import com.xinda.common.core.domain.R;
|
||||||
import com.xinda.common.core.page.TableDataInfo;
|
import com.xinda.common.core.page.TableDataInfo;
|
||||||
import com.xinda.common.utils.poi.ExcelUtil;
|
import com.xinda.common.utils.poi.ExcelUtil;
|
||||||
import com.xinda.iot.domain.DeviceModel;
|
import com.xinda.iot.domain.DeviceModel;
|
||||||
@@ -25,19 +26,30 @@ import java.util.List;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/iot/deviceModel")
|
@RequestMapping("/iot/deviceModel")
|
||||||
@Api(tags = "产品型号")
|
@Api(tags = "产品型号")
|
||||||
public class DeviceModelController extends BaseController
|
public class DeviceModelController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceModelService deviceModelService;
|
private IDeviceModelService deviceModelService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部产品下拉框
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/getAllModel")
|
||||||
|
public R getAllModel()
|
||||||
|
{
|
||||||
|
return R.ok(deviceModelService.selectDeviceModelList(new DeviceModel()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询产品型号列表
|
* 查询产品型号列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('iot:model:list')")
|
@PreAuthorize("@ss.hasPermi('iot:model:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperation("查询产品型号列表")
|
@ApiOperation("查询产品型号列表")
|
||||||
public TableDataInfo list(DeviceModel deviceModel)
|
public TableDataInfo list(DeviceModel deviceModel) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<DeviceModel> list = deviceModelService.selectDeviceModelList(deviceModel);
|
List<DeviceModel> list = deviceModelService.selectDeviceModelList(deviceModel);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
@@ -49,8 +61,7 @@ public class DeviceModelController extends BaseController
|
|||||||
@ApiOperation("导出产品型号列表")
|
@ApiOperation("导出产品型号列表")
|
||||||
@PreAuthorize("@ss.hasPermi('iot:model:export')")
|
@PreAuthorize("@ss.hasPermi('iot:model:export')")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, DeviceModel deviceModel)
|
public void export(HttpServletResponse response, DeviceModel deviceModel) {
|
||||||
{
|
|
||||||
List<DeviceModel> list = deviceModelService.selectDeviceModelList(deviceModel);
|
List<DeviceModel> list = deviceModelService.selectDeviceModelList(deviceModel);
|
||||||
ExcelUtil<DeviceModel> util = new ExcelUtil<DeviceModel>(DeviceModel.class);
|
ExcelUtil<DeviceModel> util = new ExcelUtil<DeviceModel>(DeviceModel.class);
|
||||||
util.exportExcel(response, list, "产品型号数据");
|
util.exportExcel(response, list, "产品型号数据");
|
||||||
@@ -62,8 +73,7 @@ public class DeviceModelController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:model:query')")
|
@PreAuthorize("@ss.hasPermi('iot:model:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
@ApiOperation("获取产品型号详细信息")
|
@ApiOperation("获取产品型号详细信息")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
{
|
|
||||||
return success(deviceModelService.selectDeviceModelById(id));
|
return success(deviceModelService.selectDeviceModelById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +83,7 @@ public class DeviceModelController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:model:add')")
|
@PreAuthorize("@ss.hasPermi('iot:model:add')")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("新增产品型号")
|
@ApiOperation("新增产品型号")
|
||||||
public AjaxResult add(@RequestBody DeviceModel deviceModel)
|
public AjaxResult add(@RequestBody DeviceModel deviceModel) {
|
||||||
{
|
|
||||||
deviceModel.setCreateTime(new Date());
|
deviceModel.setCreateTime(new Date());
|
||||||
return toAjax(deviceModelService.insertDeviceModel(deviceModel));
|
return toAjax(deviceModelService.insertDeviceModel(deviceModel));
|
||||||
}
|
}
|
||||||
@@ -85,8 +94,7 @@ public class DeviceModelController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:model:edit')")
|
@PreAuthorize("@ss.hasPermi('iot:model:edit')")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改产品型号")
|
@ApiOperation("修改产品型号")
|
||||||
public AjaxResult edit(@RequestBody DeviceModel deviceModel)
|
public AjaxResult edit(@RequestBody DeviceModel deviceModel) {
|
||||||
{
|
|
||||||
return toAjax(deviceModelService.updateDeviceModel(deviceModel));
|
return toAjax(deviceModelService.updateDeviceModel(deviceModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +104,7 @@ public class DeviceModelController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('iot:model:remove')")
|
@PreAuthorize("@ss.hasPermi('iot:model:remove')")
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
@ApiOperation("删除产品型号")
|
@ApiOperation("删除产品型号")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
{
|
|
||||||
return toAjax(deviceModelService.deleteDeviceModelByIds(ids));
|
return toAjax(deviceModelService.deleteDeviceModelByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.xinda.common.core.domain.R;
|
||||||
import com.xinda.iot.domain.DeviceGroup;
|
import com.xinda.iot.domain.DeviceGroup;
|
||||||
import com.xinda.iot.model.DeviceGroupInput;
|
import com.xinda.iot.model.DeviceGroupInput;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -41,6 +42,16 @@ public class GroupController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IGroupService groupService;
|
private IGroupService groupService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属项目下拉框数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/getAllGroupList")
|
||||||
|
public R getAllGroupList()
|
||||||
|
{
|
||||||
|
return R.ok(groupService.selectGroupList(new Group()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备分组列表
|
* 查询设备分组列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -58,16 +58,31 @@ public class MqttPublish implements MqttHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handler(ChannelHandlerContext ctx, MqttMessage message) {
|
public void handler(ChannelHandlerContext ctx, MqttMessage message) {
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSON.parseObject((String) message.payload());
|
||||||
|
|
||||||
|
System.out.println(jsonObject);
|
||||||
|
|
||||||
|
// 查看消息
|
||||||
MqttPublishMessage publishMessage = (MqttPublishMessage) message;
|
MqttPublishMessage publishMessage = (MqttPublishMessage) message;
|
||||||
/*获取客户端id*/
|
/*获取客户端id*/
|
||||||
String clientId = AttributeUtils.getClientId(ctx.channel());
|
String clientId = AttributeUtils.getClientId(ctx.channel());
|
||||||
String topicName = publishMessage.variableHeader().topicName();
|
String topicName = publishMessage.variableHeader().topicName();
|
||||||
log.debug("=>***客户端[{}],主题[{}],推送消息[{}]", clientId, topicName,
|
log.debug("=>***客户端[{}],主题[{}],推送消息[{}]", clientId, topicName,
|
||||||
ByteBufUtil.hexDump(publishMessage.content()));
|
ByteBufUtil.hexDump(publishMessage.content()));
|
||||||
|
|
||||||
// 以get结尾是模拟客户端数据,只转发消息
|
// 以get结尾是模拟客户端数据,只转发消息
|
||||||
if (topicName.endsWith(XinDaConstant.MQTT.PROPERTY_GET_SIMULATE)) {
|
if (topicName.endsWith(XinDaConstant.MQTT.PROPERTY_GET_SIMULATE)) {
|
||||||
sendTestToMQ(publishMessage);
|
sendTestToMQ(publishMessage);
|
||||||
} else {
|
}
|
||||||
|
// else if (topicName.contains("/function/get/")) {
|
||||||
|
//// 改成订阅主题 进行保存
|
||||||
|
// System.out.println("改成订阅主题");
|
||||||
|
// } else if (topicName.contains("/info/get/")) {
|
||||||
|
// //发布主题 推送的消息进行保存
|
||||||
|
// System.out.println("发布主题");
|
||||||
|
// }
|
||||||
|
else {
|
||||||
/*获取客户端session*/
|
/*获取客户端session*/
|
||||||
Session session = AttributeUtils.getSession(ctx.channel());
|
Session session = AttributeUtils.getSession(ctx.channel());
|
||||||
//平台检测session是否同步
|
//平台检测session是否同步
|
||||||
|
|||||||
@@ -26,133 +26,191 @@ import java.util.List;
|
|||||||
@ApiModel(value = "Device", description = "设备对象 iot_device")
|
@ApiModel(value = "Device", description = "设备对象 iot_device")
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@Data
|
@Data
|
||||||
public class Device extends BaseEntity
|
public class Device extends BaseEntity {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 设备ID */
|
/**
|
||||||
|
* 设备ID
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备ID")
|
@ApiModelProperty("设备ID")
|
||||||
private Long deviceId;
|
private Long deviceId;
|
||||||
|
|
||||||
/** 设备名称 */
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备名称")
|
@ApiModelProperty("设备名称")
|
||||||
@Excel(name = "设备名称")
|
@Excel(name = "设备名称")
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
|
|
||||||
/** 产品ID */
|
/**
|
||||||
|
* 产品ID
|
||||||
|
*/
|
||||||
@ApiModelProperty("产品ID")
|
@ApiModelProperty("产品ID")
|
||||||
@Excel(name = "产品ID")
|
@Excel(name = "产品ID")
|
||||||
private Long productId;
|
private Long productId;
|
||||||
|
|
||||||
/** 产品名称 */
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
@ApiModelProperty("产品名称")
|
@ApiModelProperty("产品名称")
|
||||||
@Excel(name = "产品名称")
|
@Excel(name = "产品名称")
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
||||||
|
|
||||||
/** 租户ID */
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
@ApiModelProperty("租户ID")
|
@ApiModelProperty("租户ID")
|
||||||
@Excel(name = "租户ID")
|
@Excel(name = "租户ID")
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
|
|
||||||
/** 租户名称 */
|
/**
|
||||||
|
* 租户名称
|
||||||
|
*/
|
||||||
@ApiModelProperty("租户名称")
|
@ApiModelProperty("租户名称")
|
||||||
@Excel(name = "租户名称")
|
@Excel(name = "租户名称")
|
||||||
private String tenantName;
|
private String tenantName;
|
||||||
|
|
||||||
/** 设备编号 */
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备编号")
|
@ApiModelProperty("设备编号")
|
||||||
@Excel(name = "设备编号")
|
@Excel(name = "设备编号")
|
||||||
private String serialNumber;
|
private String serialNumber;
|
||||||
|
|
||||||
/** 固件版本 */
|
/**
|
||||||
|
* 固件版本
|
||||||
|
*/
|
||||||
@ApiModelProperty("固件版本")
|
@ApiModelProperty("固件版本")
|
||||||
@Excel(name = "固件版本")
|
@Excel(name = "固件版本")
|
||||||
private BigDecimal firmwareVersion;
|
private BigDecimal firmwareVersion;
|
||||||
|
|
||||||
/** 设备类型(1-直连设备、2-网关设备、3-监控设备) */
|
/**
|
||||||
|
* 设备类型(1-直连设备、2-网关设备、3-监控设备)
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备类型(1-直连设备、2-网关设备、3-监控设备 4-网关子设备)")
|
@ApiModelProperty("设备类型(1-直连设备、2-网关设备、3-监控设备 4-网关子设备)")
|
||||||
private Integer deviceType;
|
private Integer deviceType;
|
||||||
|
|
||||||
/** 设备状态(1-未激活,2-禁用,3-在线,4-离线) */
|
/**
|
||||||
|
* 设备状态(1-未激活,2-禁用,3-在线,4-离线)
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备状态(1-未激活,2-禁用,3-在线,4-离线)")
|
@ApiModelProperty("设备状态(1-未激活,2-禁用,3-在线,4-离线)")
|
||||||
@Excel(name = "设备状态")
|
@Excel(name = "设备状态")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/** wifi信号强度(信号极好4格[-55— 0],信号好3格[-70— -55],信号一般2格[-85— -70],信号差1格[-100— -85]) */
|
/**
|
||||||
|
* wifi信号强度(信号极好4格[-55— 0],信号好3格[-70— -55],信号一般2格[-85— -70],信号差1格[-100— -85])
|
||||||
|
*/
|
||||||
@ApiModelProperty("wifi信号强度(信号极好4格[-55— 0],信号好3格[-70— -55],信号一般2格[-85— -70],信号差1格[-100— -85])")
|
@ApiModelProperty("wifi信号强度(信号极好4格[-55— 0],信号好3格[-70— -55],信号一般2格[-85— -70],信号差1格[-100— -85])")
|
||||||
@Excel(name = "wifi信号强度")
|
@Excel(name = "wifi信号强度")
|
||||||
private Integer rssi;
|
private Integer rssi;
|
||||||
|
|
||||||
/** 设备影子 */
|
/**
|
||||||
|
* 设备影子
|
||||||
|
*/
|
||||||
@ApiModelProperty("是否启用设备影子(0=禁用,1=启用)")
|
@ApiModelProperty("是否启用设备影子(0=禁用,1=启用)")
|
||||||
private Integer isShadow;
|
private Integer isShadow;
|
||||||
|
|
||||||
/** 设备所在地址 */
|
/**
|
||||||
|
* 设备所在地址
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备所在地址")
|
@ApiModelProperty("设备所在地址")
|
||||||
@Excel(name = "设备所在地址")
|
@Excel(name = "设备所在地址")
|
||||||
private String networkAddress;
|
private String networkAddress;
|
||||||
|
|
||||||
/** 设备入网IP */
|
/**
|
||||||
|
* 设备入网IP
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备入网IP")
|
@ApiModelProperty("设备入网IP")
|
||||||
@Excel(name = "设备入网IP")
|
@Excel(name = "设备入网IP")
|
||||||
private String networkIp;
|
private String networkIp;
|
||||||
|
|
||||||
/** 设备经度 */
|
/**
|
||||||
|
* 设备经度
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备经度")
|
@ApiModelProperty("设备经度")
|
||||||
@Excel(name = "设备经度")
|
@Excel(name = "设备经度")
|
||||||
private BigDecimal longitude;
|
private BigDecimal longitude;
|
||||||
|
|
||||||
/** 设备纬度 */
|
/**
|
||||||
|
* 设备纬度
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备纬度")
|
@ApiModelProperty("设备纬度")
|
||||||
@Excel(name = "设备纬度")
|
@Excel(name = "设备纬度")
|
||||||
private BigDecimal latitude;
|
private BigDecimal latitude;
|
||||||
|
|
||||||
/** 激活时间 */
|
/**
|
||||||
|
* 激活时间
|
||||||
|
*/
|
||||||
@ApiModelProperty("激活时间")
|
@ApiModelProperty("激活时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "激活时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "激活时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date activeTime;
|
private Date activeTime;
|
||||||
|
|
||||||
/** 子设备网关编号 */
|
/**
|
||||||
|
* 子设备网关编号
|
||||||
|
*/
|
||||||
@ApiModelProperty("子设备网关编号")
|
@ApiModelProperty("子设备网关编号")
|
||||||
@Excel(name = "网关设备编号(子设备使用)")
|
@Excel(name = "网关设备编号(子设备使用)")
|
||||||
private String gwDevCode;
|
private String gwDevCode;
|
||||||
|
|
||||||
/** 物模型值 */
|
/**
|
||||||
|
* 物模型值
|
||||||
|
*/
|
||||||
@ApiModelProperty("物模型值")
|
@ApiModelProperty("物模型值")
|
||||||
@Excel(name = "物模型")
|
@Excel(name = "物模型")
|
||||||
private String thingsModelValue;
|
private String thingsModelValue;
|
||||||
|
|
||||||
/** 图片地址 */
|
/**
|
||||||
|
* 图片地址
|
||||||
|
*/
|
||||||
@ApiModelProperty("图片地址")
|
@ApiModelProperty("图片地址")
|
||||||
private String imgUrl;
|
private String imgUrl;
|
||||||
|
|
||||||
/** 是否自定义位置 **/
|
/**
|
||||||
|
* 是否自定义位置
|
||||||
|
**/
|
||||||
@ApiModelProperty("定位方式(1=ip自动定位,2=设备定位,3=自定义)")
|
@ApiModelProperty("定位方式(1=ip自动定位,2=设备定位,3=自定义)")
|
||||||
private Integer locationWay;
|
private Integer locationWay;
|
||||||
|
|
||||||
/** 设备摘要 **/
|
/**
|
||||||
|
* 设备摘要
|
||||||
|
**/
|
||||||
@ApiModelProperty("设备摘要")
|
@ApiModelProperty("设备摘要")
|
||||||
private String summary;
|
private String summary;
|
||||||
|
|
||||||
/** 分组ID,用于分组查询 **/
|
/**
|
||||||
|
* 分组ID,用于分组查询
|
||||||
|
**/
|
||||||
@ApiModelProperty("分组ID,用于分组查询")
|
@ApiModelProperty("分组ID,用于分组查询")
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
/** 是否设备所有者,用于查询 **/
|
// 需要排除分分组id 排除0
|
||||||
|
private String groupIdExclude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否设备所有者,用于查询
|
||||||
|
**/
|
||||||
@ApiModelProperty("是否设备所有者,用于查询")
|
@ApiModelProperty("是否设备所有者,用于查询")
|
||||||
private Integer isOwner;
|
private Integer isOwner;
|
||||||
/**子设备数量*/
|
/**
|
||||||
|
* 子设备数量
|
||||||
|
*/
|
||||||
@ApiModelProperty("子设备数量")
|
@ApiModelProperty("子设备数量")
|
||||||
private Integer subDeviceCount;
|
private Integer subDeviceCount;
|
||||||
/**是否是模拟设备*/
|
/**
|
||||||
|
* 是否是模拟设备
|
||||||
|
*/
|
||||||
@ApiModelProperty("是否是模拟设备")
|
@ApiModelProperty("是否是模拟设备")
|
||||||
private Integer isSimulate;
|
private Integer isSimulate;
|
||||||
/**子设备地址*/
|
/**
|
||||||
|
* 子设备地址
|
||||||
|
*/
|
||||||
@ApiModelProperty("子设备地址")
|
@ApiModelProperty("子设备地址")
|
||||||
private Integer slaveId;
|
private Integer slaveId;
|
||||||
/**设备传输协议*/
|
/**
|
||||||
|
* 设备传输协议
|
||||||
|
*/
|
||||||
@ApiModelProperty("设备传输协议")
|
@ApiModelProperty("设备传输协议")
|
||||||
private String transport;
|
private String transport;
|
||||||
|
|
||||||
@@ -166,7 +224,9 @@ public class Device extends BaseEntity
|
|||||||
|
|
||||||
private List<Device> subDeviceList;
|
private List<Device> subDeviceList;
|
||||||
|
|
||||||
/** 删除标志(0代表存在 2代表删除) */
|
/**
|
||||||
|
* 删除标志(0代表存在 2代表删除)
|
||||||
|
*/
|
||||||
@ApiModelProperty("删除标志")
|
@ApiModelProperty("删除标志")
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
@@ -174,6 +234,11 @@ public class Device extends BaseEntity
|
|||||||
* 关联组态,来源产品
|
* 关联组态,来源产品
|
||||||
*/
|
*/
|
||||||
private String guid;
|
private String guid;
|
||||||
|
// todo
|
||||||
|
private Long agenciesId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<SipRelation> sipRelationList;
|
private List<SipRelation> sipRelationList;
|
||||||
|
|
||||||
|
|||||||
@@ -17,58 +17,83 @@ import org.springframework.data.annotation.Transient;
|
|||||||
*/
|
*/
|
||||||
@ApiModel(value = "Product", description = "产品对象 iot_product")
|
@ApiModel(value = "Product", description = "产品对象 iot_product")
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class Product extends BaseEntity
|
public class Product extends BaseEntity {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 产品ID */
|
/**
|
||||||
|
* 产品ID
|
||||||
|
*/
|
||||||
@ApiModelProperty("产品ID")
|
@ApiModelProperty("产品ID")
|
||||||
private Long productId;
|
private Long productId;
|
||||||
|
|
||||||
/** 产品名称 */
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
@ApiModelProperty("产品名称")
|
@ApiModelProperty("产品名称")
|
||||||
@Excel(name = "产品名称")
|
@Excel(name = "产品名称")
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
||||||
/** 产品分类ID */
|
// 判断的未分类
|
||||||
|
private String productNameExclude;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品分类ID
|
||||||
|
*/
|
||||||
@ApiModelProperty("产品分类ID")
|
@ApiModelProperty("产品分类ID")
|
||||||
@Excel(name = "产品分类ID")
|
@Excel(name = "产品分类ID")
|
||||||
private Long categoryId;
|
private Long categoryId;
|
||||||
|
|
||||||
/** 产品分类名称 */
|
/**
|
||||||
|
* 产品分类名称
|
||||||
|
*/
|
||||||
@ApiModelProperty("产品分类名称")
|
@ApiModelProperty("产品分类名称")
|
||||||
@Excel(name = "产品分类名称")
|
@Excel(name = "产品分类名称")
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
/** 租户ID */
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
@ApiModelProperty("租户ID")
|
@ApiModelProperty("租户ID")
|
||||||
@Excel(name = "租户ID")
|
@Excel(name = "租户ID")
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
|
|
||||||
/** 租户名称 */
|
/**
|
||||||
|
* 租户名称
|
||||||
|
*/
|
||||||
@ApiModelProperty("租户名称")
|
@ApiModelProperty("租户名称")
|
||||||
@Excel(name = "租户名称")
|
@Excel(name = "租户名称")
|
||||||
private String tenantName;
|
private String tenantName;
|
||||||
|
|
||||||
/** 是否私有产品(0-否,1-是)私有下级不能共享 */
|
/**
|
||||||
|
* 是否私有产品(0-否,1-是)私有下级不能共享
|
||||||
|
*/
|
||||||
@ApiModelProperty(value = "是否私有产品", notes = "(0-否,1-是)")
|
@ApiModelProperty(value = "是否私有产品", notes = "(0-否,1-是)")
|
||||||
@Excel(name = "是否私有产品", readConverterExp = "0-否,1-是")
|
@Excel(name = "是否私有产品", readConverterExp = "0-否,1-是")
|
||||||
private Integer isSys;
|
private Integer isSys;
|
||||||
|
|
||||||
/** 是否启用授权码(0-否,1-是) */
|
/**
|
||||||
|
* 是否启用授权码(0-否,1-是)
|
||||||
|
*/
|
||||||
@ApiModelProperty(value = "是否启用授权码", notes = "(0-否,1-是)")
|
@ApiModelProperty(value = "是否启用授权码", notes = "(0-否,1-是)")
|
||||||
@Excel(name = "是否启用授权码", readConverterExp = "0=-否,1-是")
|
@Excel(name = "是否启用授权码", readConverterExp = "0=-否,1-是")
|
||||||
private Integer isAuthorize;
|
private Integer isAuthorize;
|
||||||
|
|
||||||
/** mqtt账号 */
|
/**
|
||||||
|
* mqtt账号
|
||||||
|
*/
|
||||||
@ApiModelProperty("mqtt账号")
|
@ApiModelProperty("mqtt账号")
|
||||||
private String mqttAccount;
|
private String mqttAccount;
|
||||||
|
|
||||||
/** mqtt密码 */
|
/**
|
||||||
|
* mqtt密码
|
||||||
|
*/
|
||||||
@ApiModelProperty("mqtt密码")
|
@ApiModelProperty("mqtt密码")
|
||||||
private String mqttPassword;
|
private String mqttPassword;
|
||||||
|
|
||||||
/** 产品秘钥 */
|
/**
|
||||||
|
* 产品秘钥
|
||||||
|
*/
|
||||||
@ApiModelProperty("产品秘钥")
|
@ApiModelProperty("产品秘钥")
|
||||||
private String mqttSecret;
|
private String mqttSecret;
|
||||||
|
|
||||||
@@ -80,10 +105,14 @@ public class Product extends BaseEntity
|
|||||||
@ApiModelProperty("产品支持的传输协议,多个的选一个即可")
|
@ApiModelProperty("产品支持的传输协议,多个的选一个即可")
|
||||||
private String transport;
|
private String transport;
|
||||||
|
|
||||||
/** 是否自定义位置 **/
|
/**
|
||||||
|
* 是否自定义位置
|
||||||
|
**/
|
||||||
@ApiModelProperty("定位方式(1=ip自动定位,2=设备定位,3=自定义)")
|
@ApiModelProperty("定位方式(1=ip自动定位,2=设备定位,3=自定义)")
|
||||||
private Integer locationWay;
|
private Integer locationWay;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getTransport() {
|
public String getTransport() {
|
||||||
return transport;
|
return transport;
|
||||||
}
|
}
|
||||||
@@ -108,39 +137,55 @@ public class Product extends BaseEntity
|
|||||||
this.mqttSecret = mqttSecret;
|
this.mqttSecret = mqttSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 状态(1-未发布,2-已发布,不能修改) */
|
/**
|
||||||
|
* 状态(1-未发布,2-已发布,不能修改)
|
||||||
|
*/
|
||||||
@ApiModelProperty(value = "状态", notes = "(1-未发布,2-已发布,不能修改)")
|
@ApiModelProperty(value = "状态", notes = "(1-未发布,2-已发布,不能修改)")
|
||||||
@Excel(name = "状态", readConverterExp = "1==未发布,2=已发布,不能修改")
|
@Excel(name = "状态", readConverterExp = "1==未发布,2=已发布,不能修改")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/** 设备类型(1-直连设备、2-网关子设备、3-网关设备) */
|
/**
|
||||||
|
* 设备类型(1-直连设备、2-网关子设备、3-网关设备)
|
||||||
|
*/
|
||||||
@ApiModelProperty(value = "设备类型", notes = "(1-直连设备、2-网关子设备、3-网关设备、4-网关子设备)")
|
@ApiModelProperty(value = "设备类型", notes = "(1-直连设备、2-网关子设备、3-网关设备、4-网关子设备)")
|
||||||
@Excel(name = "设备类型", readConverterExp = "1=直连设备、2=网关设备、3=监控设备、4-网关子设备")
|
@Excel(name = "设备类型", readConverterExp = "1=直连设备、2=网关设备、3=监控设备、4-网关子设备")
|
||||||
private Integer deviceType;
|
private Integer deviceType;
|
||||||
|
|
||||||
/** 联网方式(1=-wifi、2-蜂窝(2G/3G/4G/5G)、3-以太网、4-其他) */
|
/**
|
||||||
|
* 联网方式(1=-wifi、2-蜂窝(2G/3G/4G/5G)、3-以太网、4-其他)
|
||||||
|
*/
|
||||||
@ApiModelProperty(value = "联网方式", notes = "(1=-wifi、2-蜂窝(2G/3G/4G/5G)、3-以太网、4-其他)")
|
@ApiModelProperty(value = "联网方式", notes = "(1=-wifi、2-蜂窝(2G/3G/4G/5G)、3-以太网、4-其他)")
|
||||||
@Excel(name = "联网方式", readConverterExp = "1=-wifi、2=蜂窝(2G/3G/4G/5G)、3=以太网、4=其他")
|
@Excel(name = "联网方式", readConverterExp = "1=-wifi、2=蜂窝(2G/3G/4G/5G)、3=以太网、4=其他")
|
||||||
private Integer networkMethod;
|
private Integer networkMethod;
|
||||||
|
|
||||||
/** 认证方式(1-账号密码、2-证书、3-Http) */
|
/**
|
||||||
|
* 认证方式(1-账号密码、2-证书、3-Http)
|
||||||
|
*/
|
||||||
@ApiModelProperty(value = "认证方式", notes = "(1-账号密码、2-证书、3-Http)")
|
@ApiModelProperty(value = "认证方式", notes = "(1-账号密码、2-证书、3-Http)")
|
||||||
@Excel(name = "认证方式", readConverterExp = "1=账号密码、2=证书、3=Http")
|
@Excel(name = "认证方式", readConverterExp = "1=账号密码、2=证书、3=Http")
|
||||||
private Integer vertificateMethod;
|
private Integer vertificateMethod;
|
||||||
|
|
||||||
/** 图片地址 */
|
/**
|
||||||
|
* 图片地址
|
||||||
|
*/
|
||||||
@ApiModelProperty("图片地址")
|
@ApiModelProperty("图片地址")
|
||||||
private String imgUrl;
|
private String imgUrl;
|
||||||
|
|
||||||
/** 删除标志(0代表存在 2代表删除) */
|
/**
|
||||||
|
* 删除标志(0代表存在 2代表删除)
|
||||||
|
*/
|
||||||
@ApiModelProperty(value = "删除标志", notes = "(0代表存在 2代表删除)")
|
@ApiModelProperty(value = "删除标志", notes = "(0代表存在 2代表删除)")
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/** 物模型Json **/
|
/**
|
||||||
|
* 物模型Json
|
||||||
|
**/
|
||||||
@ApiModelProperty("物模型Json")
|
@ApiModelProperty("物模型Json")
|
||||||
private String thingsModelsJson;
|
private String thingsModelsJson;
|
||||||
|
|
||||||
/**采集点模板id*/
|
/**
|
||||||
|
* 采集点模板id
|
||||||
|
*/
|
||||||
@ApiModelProperty("采集点模板id")
|
@ApiModelProperty("采集点模板id")
|
||||||
private Long templateId;
|
private Long templateId;
|
||||||
|
|
||||||
@@ -248,137 +293,134 @@ public class Product extends BaseEntity
|
|||||||
this.imgUrl = imgUrl;
|
this.imgUrl = imgUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProductId(Long productId)
|
public void setProductId(Long productId) {
|
||||||
{
|
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getProductId()
|
public Long getProductId() {
|
||||||
{
|
|
||||||
return productId;
|
return productId;
|
||||||
}
|
}
|
||||||
public void setProductName(String productName)
|
|
||||||
{
|
public void setProductName(String productName) {
|
||||||
this.productName = productName;
|
this.productName = productName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductName()
|
public String getProductName() {
|
||||||
{
|
|
||||||
return productName;
|
return productName;
|
||||||
}
|
}
|
||||||
public void setCategoryId(Long categoryId)
|
|
||||||
{
|
public void setCategoryId(Long categoryId) {
|
||||||
this.categoryId = categoryId;
|
this.categoryId = categoryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getCategoryId()
|
public Long getCategoryId() {
|
||||||
{
|
|
||||||
return categoryId;
|
return categoryId;
|
||||||
}
|
}
|
||||||
public void setCategoryName(String categoryName)
|
|
||||||
{
|
public void setCategoryName(String categoryName) {
|
||||||
this.categoryName = categoryName;
|
this.categoryName = categoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCategoryName()
|
public String getCategoryName() {
|
||||||
{
|
|
||||||
return categoryName;
|
return categoryName;
|
||||||
}
|
}
|
||||||
public void setTenantId(Long tenantId)
|
|
||||||
{
|
public void setTenantId(Long tenantId) {
|
||||||
this.tenantId = tenantId;
|
this.tenantId = tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getTenantId()
|
public Long getTenantId() {
|
||||||
{
|
|
||||||
return tenantId;
|
return tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTenantName(String tenantName)
|
public void setTenantName(String tenantName) {
|
||||||
{
|
|
||||||
this.tenantName = tenantName;
|
this.tenantName = tenantName;
|
||||||
}
|
}
|
||||||
public String getTenantName()
|
|
||||||
{
|
public String getTenantName() {
|
||||||
return tenantName;
|
return tenantName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsSys(Integer isSys)
|
public void setIsSys(Integer isSys) {
|
||||||
{
|
|
||||||
this.isSys = isSys;
|
this.isSys = isSys;
|
||||||
}
|
}
|
||||||
public Integer getIsSys()
|
|
||||||
{
|
public Integer getIsSys() {
|
||||||
return isSys;
|
return isSys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsAuthorize(Integer isAuthorize) {this.isAuthorize = isAuthorize;}
|
public void setIsAuthorize(Integer isAuthorize) {
|
||||||
public Integer getIsAuthorize() {return isAuthorize;}
|
this.isAuthorize = isAuthorize;
|
||||||
|
}
|
||||||
|
|
||||||
public void setMqttAccount(String mqttAccount)
|
public Integer getIsAuthorize() {
|
||||||
{
|
return isAuthorize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMqttAccount(String mqttAccount) {
|
||||||
this.mqttAccount = mqttAccount;
|
this.mqttAccount = mqttAccount;
|
||||||
}
|
}
|
||||||
public String getMqttAccount()
|
|
||||||
{
|
public String getMqttAccount() {
|
||||||
return mqttAccount;
|
return mqttAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMqttPassword(String mqttPassword)
|
public void setMqttPassword(String mqttPassword) {
|
||||||
{
|
|
||||||
this.mqttPassword = mqttPassword;
|
this.mqttPassword = mqttPassword;
|
||||||
}
|
}
|
||||||
public String getMqttPassword()
|
|
||||||
{
|
public String getMqttPassword() {
|
||||||
return mqttPassword;
|
return mqttPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(Integer status)
|
public void setStatus(Integer status) {
|
||||||
{
|
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getStatus()
|
public Integer getStatus() {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
public void setDeviceType(Integer deviceType)
|
|
||||||
{
|
public void setDeviceType(Integer deviceType) {
|
||||||
this.deviceType = deviceType;
|
this.deviceType = deviceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getDeviceType()
|
public Integer getDeviceType() {
|
||||||
{
|
|
||||||
return deviceType;
|
return deviceType;
|
||||||
}
|
}
|
||||||
public void setNetworkMethod(Integer networkMethod)
|
|
||||||
{
|
public void setNetworkMethod(Integer networkMethod) {
|
||||||
this.networkMethod = networkMethod;
|
this.networkMethod = networkMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getNetworkMethod()
|
public Integer getNetworkMethod() {
|
||||||
{
|
|
||||||
return networkMethod;
|
return networkMethod;
|
||||||
}
|
}
|
||||||
public void setVertificateMethod(Integer vertificateMethod)
|
|
||||||
{
|
public void setVertificateMethod(Integer vertificateMethod) {
|
||||||
this.vertificateMethod = vertificateMethod;
|
this.vertificateMethod = vertificateMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getVertificateMethod()
|
public Integer getVertificateMethod() {
|
||||||
{
|
|
||||||
return vertificateMethod;
|
return vertificateMethod;
|
||||||
}
|
}
|
||||||
public void setDelFlag(String delFlag)
|
|
||||||
{
|
public void setDelFlag(String delFlag) {
|
||||||
this.delFlag = delFlag;
|
this.delFlag = delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDelFlag()
|
public String getDelFlag() {
|
||||||
{
|
|
||||||
return delFlag;
|
return delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getProductNameExclude() {
|
||||||
|
return productNameExclude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductNameExclude(String productNameExclude) {
|
||||||
|
this.productNameExclude = productNameExclude;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|||||||
@@ -363,4 +363,5 @@ public interface DeviceMapper
|
|||||||
*/
|
*/
|
||||||
List<DeviceGroup> listDeviceGroupByGroupIds(List<Long> groupIds);
|
List<DeviceGroup> listDeviceGroupByGroupIds(List<Long> groupIds);
|
||||||
|
|
||||||
|
void deleteDeviceBygroupId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.xinda.iot.model.ThingsModels.ThingsModelValueItem;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.xinda.common.annotation.Excel;
|
import com.xinda.common.annotation.Excel;
|
||||||
import com.xinda.iot.model.ThingsModelItem.*;
|
import com.xinda.iot.model.ThingsModelItem.*;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -16,6 +17,7 @@ import java.util.List;
|
|||||||
* @author kerwincui
|
* @author kerwincui
|
||||||
* @date 2021-12-16
|
* @date 2021-12-16
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class DeviceShortOutput
|
public class DeviceShortOutput
|
||||||
{
|
{
|
||||||
public DeviceShortOutput(){
|
public DeviceShortOutput(){
|
||||||
@@ -127,6 +129,18 @@ public class DeviceShortOutput
|
|||||||
*/
|
*/
|
||||||
private String guid;
|
private String guid;
|
||||||
|
|
||||||
|
|
||||||
|
private Long groupId;
|
||||||
|
private Long agenciesId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属机构
|
||||||
|
* agenciesName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String agenciesName;
|
||||||
|
|
||||||
|
|
||||||
public String getGuid() {
|
public String getGuid() {
|
||||||
return guid;
|
return guid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.xinda.iot.cache.IDeviceCache;
|
|||||||
import com.xinda.iot.cache.ITSLValueCache;
|
import com.xinda.iot.cache.ITSLValueCache;
|
||||||
import com.xinda.iot.tdengine.service.ILogService;
|
import com.xinda.iot.tdengine.service.ILogService;
|
||||||
import com.xinda.system.mapper.SysDeptMapper;
|
import com.xinda.system.mapper.SysDeptMapper;
|
||||||
|
import com.xinda.system.service.ISysDeptService;
|
||||||
import com.xinda.system.service.ISysUserService;
|
import com.xinda.system.service.ISysUserService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -123,6 +124,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
private SubGatewayMapper subGatewayMapper;
|
private SubGatewayMapper subGatewayMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private IOrderControlService orderControlService;
|
private IOrderControlService orderControlService;
|
||||||
|
@Resource
|
||||||
|
private IGroupService groupService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -467,6 +470,9 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
return deviceMapper.selectAllDeviceShortList(device);
|
return deviceMapper.selectAllDeviceShortList(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备分页简短列表
|
* 查询设备分页简短列表
|
||||||
*
|
*
|
||||||
@@ -475,6 +481,13 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DeviceShortOutput> selectDeviceShortList(Device device) {
|
public List<DeviceShortOutput> selectDeviceShortList(Device device) {
|
||||||
|
// 清空离线并且 group_id = 0 的数据
|
||||||
|
|
||||||
|
// deviceMapper.deleteDeviceBygroupId();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<DeviceShortOutput> list = deviceMapper.selectDeviceShortList(device);
|
List<DeviceShortOutput> list = deviceMapper.selectDeviceShortList(device);
|
||||||
List<DeviceAlertCount> alist = alertLogService.selectDeviceAlertCount();
|
List<DeviceAlertCount> alist = alertLogService.selectDeviceAlertCount();
|
||||||
for (DeviceAlertCount item : alist) {
|
for (DeviceAlertCount item : alist) {
|
||||||
@@ -482,6 +495,18 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
.filter(it -> Objects.equals(it.getSerialNumber(), item.getSerialNumber()))
|
.filter(it -> Objects.equals(it.getSerialNumber(), item.getSerialNumber()))
|
||||||
.forEach(it -> it.setAlertCount(item));
|
.forEach(it -> it.setAlertCount(item));
|
||||||
}
|
}
|
||||||
|
for (DeviceShortOutput deviceShortOutput : list) {
|
||||||
|
if(deviceShortOutput.getAgenciesId()!=null){
|
||||||
|
SysDept sysDept = deptService.selectDeptById(deviceShortOutput.getAgenciesId());
|
||||||
|
deviceShortOutput.setAgenciesName(sysDept.getDeptName());
|
||||||
|
}else{
|
||||||
|
deviceShortOutput.setAgenciesName("未分配");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,10 +711,17 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
// 设置图片
|
// 设置图片
|
||||||
Product product = productService.selectProductByProductId(device.getProductId());
|
Product product = productService.selectProductByProductId(device.getProductId());
|
||||||
device.setImgUrl(product.getImgUrl());
|
device.setImgUrl(product.getImgUrl());
|
||||||
|
|
||||||
|
|
||||||
// 随机经纬度和地址
|
// 随机经纬度和地址
|
||||||
SysUser user = getLoginUser().getUser();
|
SysUser user = getLoginUser().getUser();
|
||||||
device.setNetworkIp(user.getLoginIp());
|
device.setNetworkIp(user.getLoginIp());
|
||||||
|
|
||||||
|
|
||||||
|
// 连接MQTTX todo
|
||||||
setLocation(user.getLoginIp(), device);
|
setLocation(user.getLoginIp(), device);
|
||||||
|
|
||||||
|
|
||||||
deviceMapper.insertDevice(device);
|
deviceMapper.insertDevice(device);
|
||||||
|
|
||||||
// redis缓存设备默认状态(物模型值)
|
// redis缓存设备默认状态(物模型值)
|
||||||
@@ -855,6 +887,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改设备
|
* 修改设备
|
||||||
*
|
*
|
||||||
@@ -888,6 +921,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
device.setProductName(null);
|
device.setProductName(null);
|
||||||
}
|
}
|
||||||
deviceMapper.updateDevice(device);
|
deviceMapper.updateDevice(device);
|
||||||
|
|
||||||
return AjaxResult.success("修改成功", 1);
|
return AjaxResult.success("修改成功", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="slaveId" column="slave_id"/>
|
<result property="slaveId" column="slave_id"/>
|
||||||
<result property="transport" column="transport"/>
|
<result property="transport" column="transport"/>
|
||||||
<result property="guid" column="guid"/>
|
<result property="guid" column="guid"/>
|
||||||
|
<result property="groupId" column="group_id"/>
|
||||||
|
<result property="agenciesId" column="agencies_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="com.xinda.iot.model.DeviceShortOutput" id="DeviceShortResult">
|
<resultMap type="com.xinda.iot.model.DeviceShortOutput" id="DeviceShortResult">
|
||||||
@@ -63,6 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="protocolCode" column="protocol_code"/>
|
<result property="protocolCode" column="protocol_code"/>
|
||||||
<result property="transport" column="transport"/>
|
<result property="transport" column="transport"/>
|
||||||
<result property="guid" column="guid"/>
|
<result property="guid" column="guid"/>
|
||||||
|
<result property="groupId" column="group_id"/>
|
||||||
|
<result property="agenciesId" column="agencies_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="com.xinda.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
|
<resultMap type="com.xinda.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
|
||||||
@@ -160,30 +164,94 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="tenantId" column="tenant_id"/>
|
<result property="tenantId" column="tenant_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<sql id="selectDeviceVo">
|
<sql id="selectDeviceVo">
|
||||||
select device_id, device_name, product_id, product_name, tenant_id, tenant_name, serial_number,gw_dev_code, firmware_version, status, rssi,is_shadow ,is_simulate,location_way,things_model_value,network_address, network_ip, longitude, latitude, active_time, create_time, update_time, img_url,summary,remark,slave_id from iot_device
|
select device_id,
|
||||||
|
device_name,
|
||||||
|
product_id,
|
||||||
|
product_name,
|
||||||
|
tenant_id,
|
||||||
|
tenant_name,
|
||||||
|
serial_number,
|
||||||
|
gw_dev_code,
|
||||||
|
firmware_version,
|
||||||
|
status,
|
||||||
|
rssi,
|
||||||
|
is_shadow,
|
||||||
|
is_simulate,
|
||||||
|
location_way,
|
||||||
|
things_model_value,
|
||||||
|
network_address,
|
||||||
|
network_ip,
|
||||||
|
longitude,
|
||||||
|
latitude,
|
||||||
|
active_time,
|
||||||
|
create_time,
|
||||||
|
update_time,
|
||||||
|
img_url,
|
||||||
|
summary,
|
||||||
|
remark,
|
||||||
|
slave_id,group_id,agencies_id
|
||||||
|
from iot_device
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="selectDeviceShortVo">
|
<sql id="selectDeviceShortVo">
|
||||||
select device_id, device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, status,rssi,is_shadow ,is_simulate,location_way,things_model_value, active_time,img_url,slave_id from iot_device
|
select device_id,
|
||||||
|
device_name,
|
||||||
|
product_id,
|
||||||
|
product_name,
|
||||||
|
tenant_id,
|
||||||
|
tenant_name,
|
||||||
|
serial_number,
|
||||||
|
firmware_version,
|
||||||
|
status,
|
||||||
|
rssi,
|
||||||
|
is_shadow,
|
||||||
|
is_simulate,
|
||||||
|
location_way,
|
||||||
|
things_model_value,
|
||||||
|
active_time,
|
||||||
|
img_url,
|
||||||
|
slave_id,group_id,agencies_id
|
||||||
|
from iot_device
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="selectWebhookDeviceVo">
|
<sql id="selectWebhookDeviceVo">
|
||||||
select device_id, device_name,product_id, serial_number,tenant_id, tenant_name, status,is_shadow,is_simulate, rssi ,location_way,things_model_value, active_time from iot_device
|
select device_id,
|
||||||
|
device_name,
|
||||||
|
product_id,
|
||||||
|
serial_number,
|
||||||
|
tenant_id,
|
||||||
|
tenant_name,
|
||||||
|
status,
|
||||||
|
is_shadow,
|
||||||
|
is_simulate,
|
||||||
|
rssi,
|
||||||
|
location_way,
|
||||||
|
things_model_value,
|
||||||
|
active_time,group_id,agencies_id
|
||||||
|
from iot_device
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectDeviceList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceResult">
|
<select id="selectDeviceList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceResult">
|
||||||
<include refid="selectDeviceVo"/>
|
<include refid="selectDeviceVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="gwDevCode != null and gwDevCode != ''">and gw_dev_code = #{gwDevCode}</if>
|
<if test="gwDevCode != null and gwDevCode != ''">and gw_dev_code = #{gwDevCode}</if>
|
||||||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
<if test="deviceName != null and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')
|
||||||
|
</if>
|
||||||
<if test="productId != null ">and product_id = #{productId}</if>
|
<if test="productId != null ">and product_id = #{productId}</if>
|
||||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
<if test="productName != null and productName != ''">and product_name like concat('%', #{productName},
|
||||||
|
'%')
|
||||||
|
</if>
|
||||||
<if test="tenantId != null ">and tenant_id = #{tenantId}</if>
|
<if test="tenantId != null ">and tenant_id = #{tenantId}</if>
|
||||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
<if test="tenantName != null and tenantName != ''">and tenant_name like concat('%', #{tenantName}, '%')
|
||||||
|
</if>
|
||||||
<if test="serialNumber != null and serialNumber != ''">and serial_number = #{serialNumber}</if>
|
<if test="serialNumber != null and serialNumber != ''">and serial_number = #{serialNumber}</if>
|
||||||
<if test="status != null ">and status = #{status}</if>
|
<if test="status != null ">and status = #{status}</if>
|
||||||
<if test="networkAddress != null and networkAddress != ''"> and network_address like concat('%', #{networkAddress}, '%')</if>
|
<if test="networkAddress != null and networkAddress != ''">and network_address like concat('%',
|
||||||
|
#{networkAddress}, '%')
|
||||||
|
</if>
|
||||||
<if test="deptId != null and deptId != 0 and showChild != null and showChild">
|
<if test="deptId != null and deptId != 0 and showChild != null and showChild">
|
||||||
and tenant_id in (SELECT u.user_id FROM sys_user u
|
and tenant_id in (SELECT u.user_id FROM sys_user u
|
||||||
join sys_dept de on u.dept_id = de.dept_id
|
join sys_dept de on u.dept_id = de.dept_id
|
||||||
@@ -192,23 +260,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="deptId != null and deptId != 0 and showChild != null and !showChild">
|
<if test="deptId != null and deptId != 0 and showChild != null and !showChild">
|
||||||
and tenant_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})
|
and tenant_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})
|
||||||
</if>
|
</if>
|
||||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''">
|
||||||
|
and active_time between #{params.beginActiveTime} and #{params.endActiveTime}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUnAuthDeviceList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceResult">
|
<select id="selectUnAuthDeviceList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceResult">
|
||||||
select d.device_id, d.device_name, d.product_id, d.product_name, d.tenant_id, d.tenant_name,
|
select d.device_id, d.device_name, d.product_id, d.product_name, d.tenant_id, d.tenant_name,
|
||||||
d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.is_shadow,d.is_simulate ,d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.is_shadow,d.is_simulate
|
||||||
|
,d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
||||||
from iot_device d
|
from iot_device d
|
||||||
left join iot_product_authorize a on a.device_id=d.device_id
|
left join iot_product_authorize a on a.device_id=d.device_id
|
||||||
<where>
|
<where>
|
||||||
<if test="1==1">and ISNULL(a.device_id)</if>
|
<if test="1==1">and ISNULL(a.device_id)</if>
|
||||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
||||||
|
</if>
|
||||||
<if test="productId != null ">and d.product_id = #{productId}</if>
|
<if test="productId != null ">and d.product_id = #{productId}</if>
|
||||||
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
<if test="productName != null and productName != ''">and d.product_name like concat('%', #{productName},
|
||||||
|
'%')
|
||||||
|
</if>
|
||||||
<if test="tenantId != null ">and d.tenant_id = #{tenantId}</if>
|
<if test="tenantId != null ">and d.tenant_id = #{tenantId}</if>
|
||||||
<if test="tenantName != null and tenantName != ''"> and d.tenant_name like concat('%', #{tenantName}, '%')</if>
|
<if test="tenantName != null and tenantName != ''">and d.tenant_name like concat('%', #{tenantName}, '%')
|
||||||
|
</if>
|
||||||
<if test="serialNumber != null and serialNumber != ''">and d.serial_number = #{serialNumber}</if>
|
<if test="serialNumber != null and serialNumber != ''">and d.serial_number = #{serialNumber}</if>
|
||||||
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode,jdbcType=VARCHAR}</if>
|
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode,jdbcType=VARCHAR}</if>
|
||||||
<if test="status != null ">and d.status = #{status}</if>
|
<if test="status != null ">and d.status = #{status}</if>
|
||||||
@@ -220,24 +295,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="deptId != null and deptId != 0 and showChild != null and !showChild">
|
<if test="deptId != null and deptId != 0 and showChild != null and !showChild">
|
||||||
and d.tenant_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})
|
and d.tenant_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})
|
||||||
</if>
|
</if>
|
||||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''">
|
||||||
|
and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by d.create_time desc
|
order by d.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceListByGroup" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceResult">
|
<select id="selectDeviceListByGroup" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceResult">
|
||||||
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version,
|
||||||
|
d.status,d.rssi,d.is_shadow ,
|
||||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||||
from iot_device d
|
from iot_device d
|
||||||
<where>
|
<where>
|
||||||
<if test="productId != null ">and d.product_id = #{productId}</if>
|
<if test="productId != null ">and d.product_id = #{productId}</if>
|
||||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
||||||
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
</if>
|
||||||
|
<if test="productName != null and productName != ''">and d.product_name like concat('%', #{productName},
|
||||||
|
'%')
|
||||||
|
</if>
|
||||||
<if test="serialNumber != null and serialNumber != ''">and d.serial_number = #{serialNumber}</if>
|
<if test="serialNumber != null and serialNumber != ''">and d.serial_number = #{serialNumber}</if>
|
||||||
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
|
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
|
||||||
<if test="status != null ">and d.status = #{status}</if>
|
<if test="status != null ">and d.status = #{status}</if>
|
||||||
<if test="networkAddress != null and networkAddress != ''"> and d.network_address like concat('%', #{networkAddress}, '%')</if>
|
<if test="networkAddress != null and networkAddress != ''">and d.network_address like concat('%',
|
||||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
#{networkAddress}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''">
|
||||||
|
and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}
|
||||||
|
</if>
|
||||||
<if test="deptId != null and deptId != 0 and showChild != null and showChild">
|
<if test="deptId != null and deptId != 0 and showChild != null and showChild">
|
||||||
and d.tenant_id in (SELECT u.user_id FROM sys_user u
|
and d.tenant_id in (SELECT u.user_id FROM sys_user u
|
||||||
join sys_dept de on u.dept_id = de.dept_id
|
join sys_dept de on u.dept_id = de.dept_id
|
||||||
@@ -253,11 +338,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceAllShortResult">
|
<select id="selectAllDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceAllShortResult">
|
||||||
select d.device_id, d.device_name, d.product_name,p.device_type, d.tenant_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
select d.device_id, d.device_name, d.product_name,p.device_type, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||||
|
d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||||
from iot_device d
|
from iot_device d
|
||||||
left join iot_product p on p.product_id=d.product_id
|
left join iot_product p on p.product_id=d.product_id
|
||||||
<where>
|
<where>
|
||||||
|
and del_flag = '0'
|
||||||
<if test="productId != null ">and d.product_id = #{productId}</if>
|
<if test="productId != null ">and d.product_id = #{productId}</if>
|
||||||
<if test="deptId != null and deptId != 0 and showChild != null and showChild">
|
<if test="deptId != null and deptId != 0 and showChild != null and showChild">
|
||||||
and d.tenant_id in (SELECT u.user_id FROM sys_user u
|
and d.tenant_id in (SELECT u.user_id FROM sys_user u
|
||||||
@@ -272,46 +359,75 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSerialNumberByProductId" parameterType="Long" resultType="String">
|
<select id="selectSerialNumberByProductId" parameterType="Long" resultType="String">
|
||||||
select serial_number from iot_device where product_id = #{productId}
|
select serial_number
|
||||||
|
from iot_device
|
||||||
|
where product_id = #{productId} and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceCountByProductId" parameterType="Long" resultType="Integer">
|
<select id="selectDeviceCountByProductId" parameterType="Long" resultType="Integer">
|
||||||
select count(device_id) from iot_device where product_id = #{productId}
|
select count(device_id)
|
||||||
|
from iot_device
|
||||||
|
where product_id = #{productId} and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceThingsModelValueBySerialNumber" parameterType="String" resultMap="DeviceThingsValueResult">
|
<select id="selectDeviceThingsModelValueBySerialNumber" parameterType="String" resultMap="DeviceThingsValueResult">
|
||||||
select product_id,product_name,device_id,device_name,serial_number,gw_dev_code,is_shadow,is_simulate,status,tenant_id, tenant_name,things_model_value from iot_device where serial_number = #{serialNumber}
|
select product_id,
|
||||||
|
product_name,
|
||||||
|
device_id,
|
||||||
|
device_name,
|
||||||
|
serial_number,
|
||||||
|
gw_dev_code,
|
||||||
|
is_shadow,
|
||||||
|
is_simulate,
|
||||||
|
status,
|
||||||
|
tenant_id,
|
||||||
|
tenant_name,
|
||||||
|
things_model_value
|
||||||
|
|
||||||
|
from iot_device
|
||||||
|
where serial_number = #{serialNumber} and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateDeviceThingsModelValue" parameterType="com.xinda.common.core.thingsModel.ThingsModelValuesInput">
|
<update id="updateDeviceThingsModelValue" parameterType="com.xinda.common.core.thingsModel.ThingsModelValuesInput">
|
||||||
update iot_device set things_model_value=#{stringValue} where device_id = #{deviceId}
|
update iot_device
|
||||||
|
set things_model_value=#{stringValue}
|
||||||
|
where device_id = #{deviceId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
|
<select id="selectDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
|
||||||
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
|
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
|
||||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url)
|
||||||
|
as img_url,
|
||||||
case
|
case
|
||||||
when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId}) then 0
|
when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId})
|
||||||
|
then 0
|
||||||
else 1
|
else 1
|
||||||
end as is_owner,
|
end as is_owner,
|
||||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||||
p.protocol_code,p.transport,p.guid
|
p.protocol_code,p.transport,p.guid,
|
||||||
|
d.group_id,d.agencies_id
|
||||||
from iot_device d
|
from iot_device d
|
||||||
left join iot_product p on p.product_id=d.product_id
|
left join iot_product p on p.product_id=d.product_id
|
||||||
<if test="groupId != null and groupId !=0 ">left join iot_device_group g on g.device_id=d.device_id</if>
|
<if test="groupId != null and groupId !=0 ">left join iot_device_group g on g.device_id=d.device_id</if>
|
||||||
<where>
|
<where>
|
||||||
and d.gw_dev_code is null
|
and d.gw_dev_code is null and d.del_flag = '0'
|
||||||
<if test="groupId != null and groupId !=0 "> and g.group_id = #{groupId}</if>
|
<if test="groupId != null and groupId !=0 ">and d.group_id = #{groupId}</if>
|
||||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
||||||
|
</if>
|
||||||
<if test="productId != null ">and d.product_id = #{productId}</if>
|
<if test="productId != null ">and d.product_id = #{productId}</if>
|
||||||
<if test="deviceType != null ">and p.device_type = #{deviceType}</if>
|
<if test="deviceType != null ">and p.device_type = #{deviceType}</if>
|
||||||
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
<if test="productName != null and productName != ''">and d.product_name like concat('%', #{productName},
|
||||||
|
'%')
|
||||||
|
</if>
|
||||||
<if test="serialNumber != null and serialNumber != ''">and d.serial_number = #{serialNumber}</if>
|
<if test="serialNumber != null and serialNumber != ''">and d.serial_number = #{serialNumber}</if>
|
||||||
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
|
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
|
||||||
<if test="status != null ">and d.status = #{status}</if>
|
<if test="status != null ">and d.status = #{status}</if>
|
||||||
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
|
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
|
||||||
|
|
||||||
|
<if test="groupIdExclude != null">and d.group_id != #{groupIdExclude}</if>
|
||||||
|
|
||||||
<if test="deptId != null and deptId != 0 and showChild != null and showChild">
|
<if test="deptId != null and deptId != 0 and showChild != null and showChild">
|
||||||
and
|
and
|
||||||
( d.tenant_id in (SELECT u.user_id FROM sys_user u
|
( d.tenant_id in (SELECT u.user_id FROM sys_user u
|
||||||
@@ -326,17 +442,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
or d.device_id in (select du.device_id from iot_device_share du where du.user_id = #{tenantId})
|
or d.device_id in (select du.device_id from iot_device_share du where du.user_id = #{tenantId})
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''">
|
||||||
|
and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
group by d.device_id,d.tenant_id
|
group by d.device_id,d.tenant_id
|
||||||
order by d.create_time desc
|
order by d.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
||||||
select d.device_id, d.device_name, d.product_id, p.product_name,p.device_type, d.tenant_id, d.tenant_name,
|
select d.device_id,
|
||||||
d.serial_number, d.firmware_version, d.status, d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.things_model_value,
|
d.device_name,
|
||||||
d.network_address, d.network_ip, d.longitude, d.latitude, d.active_time, d.create_time, d.update_time,
|
d.product_id,
|
||||||
d.img_url,d.summary,d.remark,p.guid from iot_device d
|
p.product_name,
|
||||||
|
p.device_type,
|
||||||
|
d.tenant_id,
|
||||||
|
d.tenant_name,
|
||||||
|
d.serial_number,
|
||||||
|
d.firmware_version,
|
||||||
|
d.status,
|
||||||
|
d.rssi,
|
||||||
|
d.is_shadow,
|
||||||
|
d.is_simulate,
|
||||||
|
d.location_way,
|
||||||
|
d.things_model_value,
|
||||||
|
d.network_address,
|
||||||
|
d.network_ip,
|
||||||
|
d.longitude,
|
||||||
|
d.latitude,
|
||||||
|
d.active_time,
|
||||||
|
d.create_time,
|
||||||
|
d.update_time,
|
||||||
|
d.img_url,
|
||||||
|
d.summary,
|
||||||
|
d.remark,
|
||||||
|
p.guid,
|
||||||
|
d.group_id,
|
||||||
|
d.agencies_id
|
||||||
|
|
||||||
|
from iot_device d
|
||||||
left join iot_product p on p.product_id = d.product_id
|
left join iot_product p on p.product_id = d.product_id
|
||||||
where device_id = #{deviceId}
|
where device_id = #{deviceId}
|
||||||
</select>
|
</select>
|
||||||
@@ -347,7 +491,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceCountBySerialNumber" parameterType="String" resultType="int">
|
<select id="selectDeviceCountBySerialNumber" parameterType="String" resultType="int">
|
||||||
select count(device_id) from iot_device
|
select count(device_id)
|
||||||
|
from iot_device
|
||||||
where serial_number = #{serialNumber}
|
where serial_number = #{serialNumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -448,14 +593,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
) as alertCount
|
) as alertCount
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectProductAuthenticate" parameterType="com.xinda.iot.model.AuthenticateInputModel" resultMap="DeviceAuthenticateResult">
|
<select id="selectProductAuthenticate" parameterType="com.xinda.iot.model.AuthenticateInputModel"
|
||||||
SELECT p.mqtt_password,p.mqtt_account, p.mqtt_secret,p.is_authorize,p.product_id,p.product_name,p.vertificate_method,p.STATUS as product_status,d.device_id,d.device_name,d.STATUS,d.serial_number
|
resultMap="DeviceAuthenticateResult">
|
||||||
|
SELECT p.mqtt_password,
|
||||||
|
p.mqtt_account,
|
||||||
|
p.mqtt_secret,
|
||||||
|
p.is_authorize,
|
||||||
|
p.product_id,
|
||||||
|
p.product_name,
|
||||||
|
p.vertificate_method,
|
||||||
|
p.STATUS as product_status,
|
||||||
|
d.device_id,
|
||||||
|
d.device_name,
|
||||||
|
d.STATUS,
|
||||||
|
d.serial_number
|
||||||
FROM iot_product p
|
FROM iot_product p
|
||||||
LEFT JOIN (SELECT device_id, device_name, STATUS, product_id, product_name, serial_number
|
LEFT JOIN (SELECT device_id, device_name, STATUS, product_id, product_name, serial_number
|
||||||
FROM iot_device
|
FROM iot_device
|
||||||
WHERE serial_number = #{serialNumber}) AS d ON d.product_id = p.product_id
|
WHERE serial_number = #{serialNumber}) AS d ON d.product_id = p.product_id
|
||||||
WHERE
|
WHERE p.product_id = #{productId}
|
||||||
p.product_id = #{productId}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectShortDeviceBySerialNumber" parameterType="String" resultMap="DeviceResult">
|
<select id="selectShortDeviceBySerialNumber" parameterType="String" resultMap="DeviceResult">
|
||||||
@@ -468,7 +624,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where device_id = #{deviceId}
|
where device_id = #{deviceId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertDevice" parameterType="com.xinda.iot.domain.Device" useGeneratedKeys="true" keyProperty="deviceId">
|
<insert id="insertDevice" parameterType="com.xinda.iot.domain.Device" useGeneratedKeys="true"
|
||||||
|
keyProperty="deviceId">
|
||||||
insert into iot_device
|
insert into iot_device
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="deviceName != null and deviceName != ''">device_name,</if>
|
<if test="deviceName != null and deviceName != ''">device_name,</if>
|
||||||
@@ -499,6 +656,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="gwDevCode != null">gw_dev_code,</if>
|
<if test="gwDevCode != null">gw_dev_code,</if>
|
||||||
<if test="isSimulate != null">is_simulate,</if>
|
<if test="isSimulate != null">is_simulate,</if>
|
||||||
<if test="slaveId != null">slave_id,</if>
|
<if test="slaveId != null">slave_id,</if>
|
||||||
|
<if test="groupId != null">group_id,</if>
|
||||||
|
<if test="agenciesId != null">agencies_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||||
@@ -529,11 +688,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="gwDevCode != null">#{gwDevCode},</if>
|
<if test="gwDevCode != null">#{gwDevCode},</if>
|
||||||
<if test="isSimulate != null">#{isSimulate},</if>
|
<if test="isSimulate != null">#{isSimulate},</if>
|
||||||
<if test="slaveId != null">#{slaveId},</if>
|
<if test="slaveId != null">#{slaveId},</if>
|
||||||
|
<if test="groupId != null">#{groupId},</if>
|
||||||
|
<if test="agenciesId != null">#{agenciesId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatchDevice" parameterType="com.xinda.iot.domain.Device" useGeneratedKeys="true" keyProperty="deviceId">
|
<insert id="insertBatchDevice" parameterType="com.xinda.iot.domain.Device" useGeneratedKeys="true"
|
||||||
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, rssi, is_shadow, location_way, create_by, create_time)
|
keyProperty="deviceId">
|
||||||
|
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number,
|
||||||
|
firmware_version, rssi, is_shadow, location_way, create_by, create_time)
|
||||||
values
|
values
|
||||||
<foreach collection="deviceList" item="device" separator=",">
|
<foreach collection="deviceList" item="device" separator=",">
|
||||||
(#{device.deviceName},
|
(#{device.deviceName},
|
||||||
@@ -582,6 +745,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
||||||
<if test="summary != null">summary = #{summary},</if>
|
<if test="summary != null">summary = #{summary},</if>
|
||||||
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
||||||
|
<if test="groupId != null">group_id = #{groupId},</if>
|
||||||
|
<if test="agenciesId != null">agencies_id = #{agenciesId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where device_id = #{deviceId}
|
where device_id = #{deviceId}
|
||||||
</update>
|
</update>
|
||||||
@@ -595,7 +760,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="longitude != null">longitude = #{longitude},</if>
|
<if test="longitude != null">longitude = #{longitude},</if>
|
||||||
<if test="latitude != null">latitude = #{latitude},</if>
|
<if test="latitude != null">latitude = #{latitude},</if>
|
||||||
<if test="activeTime != null">active_time = #{activeTime},</if>
|
<if test="activeTime != null">active_time = #{activeTime},</if>
|
||||||
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
<if test="updateTime !=null">update_time = #{updateTime,jdbcType=TIMESTAMP}</if>
|
<if test="updateTime !=null">update_time = #{updateTime,jdbcType=TIMESTAMP}</if>
|
||||||
|
|
||||||
</trim>
|
</trim>
|
||||||
where serial_number = #{serialNumber} or gw_dev_code = #{serialNumber}
|
where serial_number = #{serialNumber} or gw_dev_code = #{serialNumber}
|
||||||
</update>
|
</update>
|
||||||
@@ -608,8 +775,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<update id="resetDeviceStatus" parameterType="String">
|
<update id="resetDeviceStatus" parameterType="String">
|
||||||
-- 设备状态(1-未激活,2-禁用,3-在线,4-离线)
|
-- 设备状态(1-未激活,2-禁用,3-在线,4-离线)
|
||||||
update iot_device set status=4
|
update iot_device
|
||||||
where serial_number = #{serialNumber} and status = 3
|
set status=4
|
||||||
|
where serial_number = #{serialNumber}
|
||||||
|
and status = 3
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateDeviceBySerialNumber" parameterType="com.xinda.iot.domain.Device">
|
<update id="updateDeviceBySerialNumber" parameterType="com.xinda.iot.domain.Device">
|
||||||
@@ -642,12 +811,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
||||||
<if test="summary != null">summary = #{summary},</if>
|
<if test="summary != null">summary = #{summary},</if>
|
||||||
<if test="gwDevCode != null">gw_dev_code = #{gwDevCode},</if>
|
<if test="gwDevCode != null">gw_dev_code = #{gwDevCode},</if>
|
||||||
|
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
||||||
|
<if test="groupId != null">group_id = #{groupId},</if>
|
||||||
|
<if test="agenciesId != null">agencies_id = #{agenciesId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where serial_number = #{serialNumber}
|
where serial_number = #{serialNumber}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteDeviceByDeviceId" parameterType="Long">
|
<delete id="deleteDeviceByDeviceId" parameterType="Long">
|
||||||
delete from iot_device where device_id = #{deviceId}
|
delete
|
||||||
|
from iot_device
|
||||||
|
where device_id = #{deviceId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteDeviceByDeviceIds" parameterType="String">
|
<delete id="deleteDeviceByDeviceIds" parameterType="String">
|
||||||
@@ -658,7 +832,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="getDeviceNumCount" parameterType="String" resultType="int">
|
<select id="getDeviceNumCount" parameterType="String" resultType="int">
|
||||||
select count(*) from iot_device where serial_number = #{deviceNum}
|
select count(*)
|
||||||
|
from iot_device
|
||||||
|
where serial_number = #{deviceNum}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deleteDeviceGroupByDeviceId" parameterType="com.xinda.iot.model.UserIdDeviceIdModel">
|
<delete id="deleteDeviceGroupByDeviceId" parameterType="com.xinda.iot.model.UserIdDeviceIdModel">
|
||||||
@@ -742,7 +918,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
p.mqtt_secret,
|
p.mqtt_secret,
|
||||||
p.vertificate_method,
|
p.vertificate_method,
|
||||||
p.is_authorize
|
p.is_authorize
|
||||||
from iot_device d inner join iot_product p on d.product_id = p.product_id
|
from iot_device d
|
||||||
|
inner join iot_product p on d.product_id = p.product_id
|
||||||
where d.device_id = #{deviceId}
|
where d.device_id = #{deviceId}
|
||||||
and d.del_flag = 0
|
and d.del_flag = 0
|
||||||
and p.del_flag = 0
|
and p.del_flag = 0
|
||||||
@@ -756,15 +933,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{deviceNumber}
|
#{deviceNumber}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectRelateAlertLogBySerialNumber" parameterType="java.lang.String" resultMap="DeviceRelateAlertLogVOResult">
|
<select id="selectRelateAlertLogBySerialNumber" parameterType="java.lang.String"
|
||||||
|
resultMap="DeviceRelateAlertLogVOResult">
|
||||||
select device_id, serial_number, device_name
|
select device_id, serial_number, device_name
|
||||||
from iot_device
|
from iot_device
|
||||||
where serial_number = #{deviceNumber}
|
where serial_number = #{deviceNumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDeviceNumsByProductId" parameterType="Long" resultType="String">
|
<select id="getDeviceNumsByProductId" parameterType="Long" resultType="String">
|
||||||
select serial_number from iot_device
|
select serial_number
|
||||||
where product_id = #{productId} and gw_dev_code is NULL
|
from iot_device
|
||||||
|
where product_id = #{productId}
|
||||||
|
and gw_dev_code is NULL
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceStatusByNumbers" parameterType="String" resultMap="DeviceStatusResult">
|
<select id="selectDeviceStatusByNumbers" parameterType="String" resultMap="DeviceStatusResult">
|
||||||
@@ -808,20 +988,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<where>
|
<where>
|
||||||
and d.gw_dev_code is null
|
and d.gw_dev_code is null
|
||||||
<if test="groupId != null and groupId !=0 ">and g.group_id = #{groupId}</if>
|
<if test="groupId != null and groupId !=0 ">and g.group_id = #{groupId}</if>
|
||||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
||||||
|
</if>
|
||||||
<if test="productId != null ">and d.product_id = #{productId}</if>
|
<if test="productId != null ">and d.product_id = #{productId}</if>
|
||||||
<if test="deviceType != null ">and p.device_type = #{deviceType}</if>
|
<if test="deviceType != null ">and p.device_type = #{deviceType}</if>
|
||||||
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
|
<if test="productName != null and productName != ''">and d.product_name like concat('%', #{productName},
|
||||||
|
'%')
|
||||||
|
</if>
|
||||||
<if test="serialNumber != null and serialNumber != ''">and d.serial_number = #{serialNumber}</if>
|
<if test="serialNumber != null and serialNumber != ''">and d.serial_number = #{serialNumber}</if>
|
||||||
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
|
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
|
||||||
<if test="status != null ">and d.status = #{status}</if>
|
<if test="status != null ">and d.status = #{status}</if>
|
||||||
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
|
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
|
||||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''">
|
||||||
|
and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by u.is_owner desc, d.create_time desc
|
order by u.is_owner desc, d.create_time desc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- select d.device_id, d.device_name, d.product_id, d.product_name,p.device_type,-->
|
<!-- select d.device_id, d.device_name, d.product_id, d.product_name,p.device_type,-->
|
||||||
<!-- d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,-->
|
<!-- d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,-->
|
||||||
<!-- d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,-->
|
<!-- d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,-->
|
||||||
@@ -856,7 +1040,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="listTerminalUserByGroup" resultType="com.xinda.iot.domain.Device">
|
<select id="listTerminalUserByGroup" resultType="com.xinda.iot.domain.Device">
|
||||||
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version,
|
||||||
|
d.status,d.rssi,d.is_shadow ,
|
||||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||||
from (
|
from (
|
||||||
select device_id, 1 AS is_owner
|
select device_id, 1 AS is_owner
|
||||||
@@ -871,19 +1056,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
inner join iot_product p on d.product_id = p.product_id
|
inner join iot_product p on d.product_id = p.product_id
|
||||||
<where>
|
<where>
|
||||||
and d.gw_dev_code is null
|
and d.gw_dev_code is null
|
||||||
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
|
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by u.is_owner desc, d.create_time desc
|
order by u.is_owner desc, d.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="reSetDeviceStatus">
|
<update id="reSetDeviceStatus">
|
||||||
update iot_device set status = 4 where status = 3
|
update iot_device
|
||||||
|
set status = 4
|
||||||
|
where status = 3
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectDeviceActive" resultType="com.xinda.iot.model.DeviceStatusVO">
|
<select id="selectDeviceActive" resultType="com.xinda.iot.model.DeviceStatusVO">
|
||||||
select d.status, d.serial_number as serialNumber
|
select d.status, d.serial_number as serialNumber
|
||||||
from iot_device d inner join iot_product p on d.product_id = p.product_id
|
from iot_device d
|
||||||
where d.status in (3,4) and p.transport not in ('GB28181')
|
inner join iot_product p on d.product_id = p.product_id
|
||||||
|
where d.status in (3, 4)
|
||||||
|
and p.transport not in ('GB28181')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="countByTenantId" resultType="java.lang.Integer">
|
<select id="countByTenantId" resultType="java.lang.Integer">
|
||||||
@@ -913,19 +1103,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectDeviceByChannelId" resultMap="DeviceResult">
|
<select id="selectDeviceByChannelId" resultMap="DeviceResult">
|
||||||
select device_name,device_id from iot_device
|
select device_name, device_id
|
||||||
|
from iot_device
|
||||||
where channel_id = #{channelId}
|
where channel_id = #{channelId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceStatusAndTransportStatus" resultType="com.xinda.iot.model.DeviceStatusVO">
|
<select id="selectDeviceStatusAndTransportStatus" resultType="com.xinda.iot.model.DeviceStatusVO">
|
||||||
SELECT
|
SELECT d.status,
|
||||||
d.status,
|
|
||||||
d.serial_number,
|
d.serial_number,
|
||||||
p.transport,
|
p.transport,
|
||||||
p.product_id,
|
p.product_id,
|
||||||
p.device_type
|
p.device_type
|
||||||
FROM
|
FROM iot_device d
|
||||||
iot_device d inner join iot_product p on d.product_id = p.product_id
|
inner join iot_product p on d.product_id = p.product_id
|
||||||
WHERE d.serial_number = #{serialNumber,jdbcType=VARCHAR}
|
WHERE d.serial_number = #{serialNumber,jdbcType=VARCHAR}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -941,5 +1131,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<!-- 删除没有 离线并且 没有分配项目 设备-->
|
||||||
|
<update id="deleteDeviceBygroupId">
|
||||||
|
update iot_device
|
||||||
|
set del_flag = '2'
|
||||||
|
where status = 4
|
||||||
|
and group_id = '0'
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
<if test="createdAt != null "> and created_at = #{createdAt}</if>
|
||||||
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
|
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by display_order asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceModelById" parameterType="Long" resultMap="DeviceModelResult">
|
<select id="selectDeviceModelById" parameterType="Long" resultMap="DeviceModelResult">
|
||||||
|
|||||||
@@ -133,4 +133,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
order by group_order
|
order by group_order
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -71,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and p.tenant_id = #{tenantId}
|
and p.tenant_id = #{tenantId}
|
||||||
</if>
|
</if>
|
||||||
<if test="productName != null and productName != ''"> and p.product_name like concat('%', #{productName}, '%')</if>
|
<if test="productName != null and productName != ''"> and p.product_name like concat('%', #{productName}, '%')</if>
|
||||||
|
<if test="productNameExclude != null and productNameExclude != ''"> and p.product_name != #{productNameExclude}</if>
|
||||||
<if test="categoryName != null and categoryName != ''"> and p.category_name like concat('%', #{categoryName}, '%')</if>
|
<if test="categoryName != null and categoryName != ''"> and p.category_name like concat('%', #{categoryName}, '%')</if>
|
||||||
<if test="status != null "> and p.status = #{status}</if>
|
<if test="status != null "> and p.status = #{status}</if>
|
||||||
<if test="deviceType != null "> and device_type = #{deviceType}</if>
|
<if test="deviceType != null "> and device_type = #{deviceType}</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user