Commit 4b85f56f by 吕明尚

解决开门报错的问题

parent 0af9a2db
......@@ -65,7 +65,7 @@ public class DeviceController extends BaseController
@PreAuthorize("@ss.hasPermi('system:device:export')")
@Log(title = "设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Device device)
public void export(HttpServletResponse response, DeviceDto device)
{
List<Device> list = deviceService.selectDeviceList(device);
ExcelUtil<Device> util = new ExcelUtil<Device>(Device.class);
......@@ -138,7 +138,7 @@ public class DeviceController extends BaseController
* 已绑定房间的设备
*/
@GetMapping("/listByRoom")
public TableDataInfo listByRoom(Device device)
public TableDataInfo listByRoom(DeviceDto device)
{
startPage();
List<Device> list = deviceService.selectDeviceList(device);
......
......@@ -3,6 +3,7 @@ package share.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.DeviceGateway;
import share.system.domain.DeviceGatewayDto;
/**
* 设备网关信息Mapper接口
......@@ -26,7 +27,7 @@ public interface DeviceGatewayMapper extends BaseMapper<DeviceGateway>
* @param deviceGateway 设备网关信息
* @return 设备网关信息集合
*/
public List<DeviceGateway> selectDeviceGatewayList(DeviceGateway deviceGateway);
public List<DeviceGateway> selectDeviceGatewayList(DeviceGatewayDto deviceGateway);
/**
* 新增设备网关信息
......
......@@ -3,6 +3,7 @@ package share.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.Device;
import share.system.domain.DeviceDto;
/**
* 设备信息Mapper接口
......@@ -26,7 +27,7 @@ public interface DeviceMapper extends BaseMapper<Device>
* @param device 设备信息
* @return 设备信息集合
*/
public List<Device> selectDeviceList(Device device);
public List<Device> selectDeviceList(DeviceDto device);
/**
* 新增设备信息
......
......@@ -3,6 +3,7 @@ package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.DeviceGateway;
import share.system.domain.DeviceGatewayDto;
/**
* 设备网关信息Service接口
......@@ -26,7 +27,7 @@ public interface DeviceGatewayService extends IService<DeviceGateway>
* @param deviceGateway 设备网关信息
* @return 设备网关信息集合
*/
public List<DeviceGateway> selectDeviceGatewayList(DeviceGateway deviceGateway);
public List<DeviceGateway> selectDeviceGatewayList(DeviceGatewayDto deviceGateway);
/**
* 新增设备网关信息
......
......@@ -3,6 +3,7 @@ package share.system.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.Device;
import share.system.domain.DeviceDto;
/**
* 设备信息Service接口
......@@ -26,7 +27,7 @@ public interface DeviceService extends IService<Device>
* @param device 设备信息
* @return 设备信息集合
*/
public List<Device> selectDeviceList(Device device);
public List<Device> selectDeviceList(DeviceDto device);
/**
* 新增设备信息
......
......@@ -11,6 +11,7 @@ import share.common.enums.DeviceStatusEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.system.domain.DeviceGatewayDto;
import share.system.mapper.DeviceGatewayMapper;
import share.system.domain.DeviceGateway;
import share.system.service.DeviceGatewayService;
......@@ -49,7 +50,7 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
* @return 设备网关信息
*/
@Override
public List<DeviceGateway> selectDeviceGatewayList(DeviceGateway deviceGateway)
public List<DeviceGateway> selectDeviceGatewayList(DeviceGatewayDto deviceGateway)
{
return deviceGatewayMapper.selectDeviceGatewayList(deviceGateway);
}
......@@ -110,7 +111,7 @@ public class DeviceGatewayServiceImpl extends ServiceImpl<DeviceGatewayMapper, D
*/
@Override
public boolean deviceGatewayStatusMonitor() {
List<DeviceGateway> list = deviceGatewayMapper.selectDeviceGatewayList(new DeviceGateway());
List<DeviceGateway> list = deviceGatewayMapper.selectDeviceGatewayList(new DeviceGatewayDto());
list.stream().forEach(gateway -> {
Date lastReportDate = gateway.getLastReportDate();
// 网关上报(最近10分钟内没有上报数据,网关设备离线)
......
......@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import share.common.enums.DeviceType;
import share.common.enums.OpTypeEnum;
import share.common.utils.SecurityUtils;
import share.system.domain.DeviceDto;
import share.system.mqtt.MqttGatewayComponent;
import share.system.domain.Device;
import share.system.domain.SRoom;
......@@ -51,7 +52,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
public void openDoor(DeviceParamVo deviceParam) {
SRoom room = roomMapper.selectSRoomById(deviceParam.getRoomId());
if (room != null) {
Device param = new Device();
DeviceDto param = new DeviceDto();
param.setRoomId(room.getId());
List<Device> list = deviceMapper.selectDeviceList(param);
for (Device device : list) {
......@@ -76,7 +77,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
public void openDoor(Long roomId, String phone) {
SRoom room = roomMapper.selectSRoomById(roomId);
if (room != null) {
Device param = new Device();
DeviceDto param = new DeviceDto();
param.setRoomId(room.getId());
List<Device> list = deviceMapper.selectDeviceList(param);
for (Device device : list) {
......@@ -167,7 +168,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
String startTime, String endTime, String number) {
SRoom room = roomMapper.selectSRoomById(roomId);
if (room != null) {
Device param = new Device();
DeviceDto param = new DeviceDto();
param.setRoomId(room.getId());
param.setDevType(DeviceType.DEVICE_0001.getCode());
List<Device> list = deviceMapper.selectDeviceList(param);
......@@ -203,7 +204,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
// 延时执行操作
try {
Thread.sleep(m * 1000);
Device param = new Device();
DeviceDto param = new DeviceDto();
param.setRoomId(room.getId());
param.setDevType(DeviceType.DEVICE_0001.getCode());
List<Device> list = deviceMapper.selectDeviceList(param);
......@@ -291,7 +292,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
String phone, String opType) {
SRoom room = roomMapper.selectSRoomById(roomId);
if (room != null) {
Device queryParams = new Device();
DeviceDto queryParams = new DeviceDto();
queryParams.setRoomId(room.getId());
queryParams.setDevType(DeviceType.DEVICE_CCEE.getCode());
List<Device> list = deviceMapper.selectDeviceList(queryParams);
......@@ -318,7 +319,7 @@ public class DeviceOpServiceImpl implements DeviceOpService {
public void deleteDevicePassword(Long roomId, String param, String phone, String opType) {
SRoom room = roomMapper.selectSRoomById(roomId);
if (room != null) {
Device queryParams = new Device();
DeviceDto queryParams = new DeviceDto();
queryParams.setRoomId(room.getId());
queryParams.setDevType(DeviceType.DEVICE_CCEE.getCode());
List<Device> list = deviceMapper.selectDeviceList(queryParams);
......
......@@ -9,11 +9,8 @@ import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.SecurityUtils;
import share.system.domain.SPack;
import share.system.domain.SRoom;
import share.system.domain.SStore;
import share.system.domain.*;
import share.system.mapper.DeviceMapper;
import share.system.domain.Device;
import share.system.mapper.SRoomMapper;
import share.system.mapper.SStoreMapper;
import share.system.service.DeviceService;
......@@ -51,7 +48,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
* @return 设备信息
*/
@Override
public List<Device> selectDeviceList(Device device) {
public List<Device> selectDeviceList(DeviceDto device) {
return deviceMapper.selectDeviceList(device);
}
......
......@@ -13,10 +13,7 @@ import org.springframework.stereotype.Service;
import share.common.constant.MqttConstants;
import share.common.enums.*;
import share.common.utils.DateUtils;
import share.system.domain.Device;
import share.system.domain.DeviceGateway;
import share.system.domain.DeviceLog;
import share.system.domain.DeviceStatusLog;
import share.system.domain.*;
import share.system.domain.vo.MqttxVo;
import share.system.mapper.DeviceGatewayMapper;
import share.system.mapper.DeviceLogMapper;
......@@ -97,7 +94,7 @@ public class MqttxServiceImpl implements MqttxService {
public MqttxVo addGatewayDevice(String devId) {
DeviceGateway deviceGateway = deviceGatewayMapper.selectDeviceGatewayByDevId(devId);
if (deviceGateway != null) {
Device device = new Device();
DeviceDto device = new DeviceDto();
device.setGroup(deviceGateway.getGroup());
List<Device> deviceList = deviceMapper.selectDeviceList(device);
if (deviceList.size() > 0) {
......@@ -195,7 +192,7 @@ public class MqttxServiceImpl implements MqttxService {
private MqttxVo openOrCloseDeviceInit(String devId, String phone, String openType, String mqttDescribe) {
Device device = deviceMapper.selectDeviceByDevId(devId);
if (device != null) {
DeviceGateway gatewayParam = new DeviceGateway();
DeviceGatewayDto gatewayParam = new DeviceGatewayDto();
gatewayParam.setGroup(device.getGroup());
List<DeviceGateway> deviceGateways = deviceGatewayMapper.selectDeviceGatewayList(gatewayParam);
if (deviceGateways.size() > 0) {
......@@ -275,7 +272,7 @@ public class MqttxServiceImpl implements MqttxService {
String phone, String opType, String mqttDescribe) {
Device device = deviceMapper.selectDeviceByDevId(devId);
if (device != null) {
DeviceGateway gatewayParam = new DeviceGateway();
DeviceGatewayDto gatewayParam = new DeviceGatewayDto();
gatewayParam.setGroup(device.getGroup());
List<DeviceGateway> deviceGateways = deviceGatewayMapper.selectDeviceGatewayList(gatewayParam);
if (deviceGateways.size() > 0) {
......@@ -355,7 +352,7 @@ public class MqttxServiceImpl implements MqttxService {
String phone, String opType, String mqttDescribe) {
Device device = deviceMapper.selectDeviceByDevId(devId);
if (device != null) {
DeviceGateway gatewayParam = new DeviceGateway();
DeviceGatewayDto gatewayParam = new DeviceGatewayDto();
gatewayParam.setGroup(device.getGroup());
List<DeviceGateway> deviceGateways = deviceGatewayMapper.selectDeviceGatewayList(gatewayParam);
if (deviceGateways.size() > 0) {
......@@ -429,7 +426,7 @@ public class MqttxServiceImpl implements MqttxService {
String mqttDescribe) {
Device device = deviceMapper.selectDeviceByDevId(devId);
if (device != null) {
DeviceGateway gatewayParam = new DeviceGateway();
DeviceGatewayDto gatewayParam = new DeviceGatewayDto();
gatewayParam.setGroup(device.getGroup());
List<DeviceGateway> deviceGateways = deviceGatewayMapper.selectDeviceGatewayList(gatewayParam);
if (deviceGateways.size() > 0) {
......@@ -482,7 +479,7 @@ public class MqttxServiceImpl implements MqttxService {
String startTime, String endTime, String number) {
Device device = deviceMapper.selectDeviceByDevId(devId);
if (device != null) {
DeviceGateway gatewayParam = new DeviceGateway();
DeviceGatewayDto gatewayParam = new DeviceGatewayDto();
gatewayParam.setGroup(device.getGroup());
List<DeviceGateway> deviceGateways = deviceGatewayMapper.selectDeviceGatewayList(gatewayParam);
if (deviceGateways.size() > 0) {
......
......@@ -295,7 +295,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
if (Objects.isNull(room)) {
throw new RuntimeException("房间不存在");
}
Device device = new Device();
DeviceDto device = new DeviceDto();
device.setRoomId(id);
device.setDevType(DeviceType.DEVICE_CCEE.getCode());
List<Device> deviceList = deviceService.selectDeviceList(device);
......
......@@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from s_device_gateway
</sql>
<select id="selectDeviceGatewayList" parameterType="DeviceGateway" resultMap="DeviceGatewayResult">
<select id="selectDeviceGatewayList" parameterType="DeviceGatewayDto" resultMap="DeviceGatewayResult">
select
t1.id,
t1.dev_name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment