Commit 4b85f56f by 吕明尚

解决开门报错的问题

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