fix:
设备激活接口未保存设备名称bug ws协议连接mqtt代理一直断线重连问题 add: mqtt消息转发接口 展连流量计设备实时数据接口 update: 设备在线状态逻辑 设备上电审核接口
This commit is contained in:
@ -145,6 +145,16 @@ public class DeviceReportInfo extends BaseEntity
|
||||
@ApiModelProperty("上电时间")
|
||||
private Date powersTime;
|
||||
|
||||
/** 经度 */
|
||||
@Excel(name = "经度")
|
||||
@ApiModelProperty("经度")
|
||||
private String longitude;
|
||||
|
||||
/** 纬度 */
|
||||
@Excel(name = "纬度")
|
||||
@ApiModelProperty("纬度")
|
||||
private String latitude;
|
||||
|
||||
//----------------------------------------------------------业务字段-----------------------------------------------------------
|
||||
/** 是否自动审核 */
|
||||
private Boolean autoReview ;
|
||||
@ -156,4 +166,6 @@ public class DeviceReportInfo extends BaseEntity
|
||||
|
||||
private Integer onLine;//0离线,1在线
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ import cn.hutool.core.date.DateTime;
|
||||
*/
|
||||
public interface IDeviceActivationService
|
||||
{
|
||||
public int selectDevice(String serialNumber,Long tenantId,String tenantName,double longitude,double latitude,String imgUrl);
|
||||
public int selectDevice(String serialNumber,Long tenantId,String tenantName,double longitude,double latitude,String imgUrl,String name);
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
package com.fastbee.iot.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.fastbee.iot.domain.DeviceReportInfo;
|
||||
import com.fastbee.iot.mapper.DeviceMapper;
|
||||
import com.fastbee.iot.mapper.DeviceReportInfoMapper;
|
||||
import com.fastbee.iot.service.IDeviceActivationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -14,12 +17,21 @@ public class DeviceActivationServiceImpl implements IDeviceActivationService
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
@Autowired
|
||||
private DeviceReportInfoMapper deviceReportInfoMapper;
|
||||
|
||||
@Override
|
||||
public int selectDevice(String serialNumber,Long tenantId,String tenantName,double longitude,double latitude,String imgUrl)
|
||||
public int selectDevice(String serialNumber,Long tenantId,String tenantName,double longitude,double latitude,String imgUrl,String name)
|
||||
{
|
||||
//获取激活时间/更新时间
|
||||
DateTime activationTime=DateTime.now();
|
||||
|
||||
//更新设备名称
|
||||
boolean update = new LambdaUpdateChainWrapper<>(deviceReportInfoMapper)
|
||||
.set(DeviceReportInfo::getName, name)
|
||||
.set(DeviceReportInfo::getLatitude,latitude)
|
||||
.set(DeviceReportInfo::getLongitude,longitude)
|
||||
.eq(DeviceReportInfo::getSerialNumber, serialNumber)
|
||||
.update();
|
||||
return deviceMapper.updateDeviceActivationStatus(serialNumber,activationTime,tenantId,tenantName,longitude,latitude,imgUrl);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||
import com.fastbee.common.exception.ServiceException;
|
||||
import com.fastbee.iot.domain.Device;
|
||||
import com.fastbee.iot.mapper.DeviceMapper;
|
||||
@ -54,13 +55,11 @@ public class DeviceReportInfoServiceImpl implements IDeviceReportInfoService
|
||||
List<DeviceReportInfo> deviceReportInfos = deviceReportInfoMapper.selectDeviceReportInfoList(deviceReportInfo);
|
||||
//按照时间由近到远进行排序
|
||||
deviceReportInfos.sort((o1, o2) -> o2.getPowersTime().compareTo(o1.getPowersTime()));
|
||||
|
||||
return deviceReportInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备上电审核前上报的基础信息
|
||||
*
|
||||
* @param deviceReportInfo 设备上电审核前上报的基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -123,7 +122,6 @@ public class DeviceReportInfoServiceImpl implements IDeviceReportInfoService
|
||||
|
||||
/**
|
||||
* 批量删除设备上电审核前上报的基础信息
|
||||
*
|
||||
* @param ids 需要删除的设备上电审核前上报的基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -147,6 +145,7 @@ public class DeviceReportInfoServiceImpl implements IDeviceReportInfoService
|
||||
|
||||
@Override
|
||||
public boolean updateDeviceReportStatus(List<DeviceReportInfo> deviceReportInfo) {
|
||||
new LambdaUpdateChainWrapper<>(deviceReportInfoMapper).set(DeviceReportInfo::getStatus, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -910,17 +910,17 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateDeviceStatusAndLocation(Device device, String ipAddress) {
|
||||
// 设置自动定位和状态
|
||||
if (ipAddress != null && !Objects.equals(ipAddress, "")) {
|
||||
if (device.getActiveTime() == null) {
|
||||
device.setActiveTime(DateUtils.getNowDate());
|
||||
}
|
||||
// 定位方式(1=ip自动定位,2=设备定位,3=自定义)
|
||||
if (device.getLocationWay() == 1) {
|
||||
device.setNetworkIp(ipAddress);
|
||||
setLocation(ipAddress, device);
|
||||
}
|
||||
}
|
||||
// // 设置自动定位和状态
|
||||
// if (ipAddress != null && !Objects.equals(ipAddress, "")) {
|
||||
// if (device.getActiveTime() == null) {
|
||||
// device.setActiveTime(DateUtils.getNowDate());
|
||||
// }
|
||||
// // 定位方式(1=ip自动定位,2=设备定位,3=自定义)
|
||||
// if (device.getLocationWay() == 1) {
|
||||
// device.setNetworkIp(ipAddress);
|
||||
// setLocation(ipAddress, device);
|
||||
// }
|
||||
// }
|
||||
int result = deviceMapper.updateDeviceStatus(device);
|
||||
// 添加到设备日志
|
||||
EventLog event = new EventLog();
|
||||
|
Reference in New Issue
Block a user