forked from dyf/fys-Multi-tenant
Merge branch 'dyf-device'
This commit is contained in:
@ -105,7 +105,6 @@ public class Device extends TenantEntity {
|
||||
@Schema(name = "设备状态")
|
||||
private Integer deviceStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 绑定状态
|
||||
* 0 未绑定
|
||||
@ -127,4 +126,17 @@ public class Device extends TenantEntity {
|
||||
private Date bindingTime;
|
||||
|
||||
private String sendMsg;
|
||||
|
||||
/**
|
||||
* 发布主题(格式:A/{device_id})
|
||||
* pub_topic
|
||||
*/
|
||||
private String pubTopic;
|
||||
|
||||
/**
|
||||
* 订阅主题(格式:B/{device_id})
|
||||
* sub_topic
|
||||
*/
|
||||
private String subTopic;
|
||||
|
||||
}
|
||||
|
@ -186,6 +186,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
device.setCreateByName(loginUser.getNickname());
|
||||
device.setTypeName(deviceTypes.getTypeName());
|
||||
device.setDeviceType(deviceTypes.getId());
|
||||
if (device.getDeviceImei() != null) {
|
||||
device.setPubTopic("A/" + device.getDeviceImei());
|
||||
device.setSubTopic("B/" + device.getDeviceImei());
|
||||
}
|
||||
|
||||
deviceMapper.insert(device);
|
||||
|
||||
@ -293,14 +297,18 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||
|
||||
for (Long id : ids) {
|
||||
DeviceAssignments deviceAssignment = deviceAssignmentsMapper.selectById(id);
|
||||
Device deviceType = deviceMapper.selectById(deviceAssignment.getDeviceId());
|
||||
Device device = deviceMapper.selectById(deviceAssignment.getDeviceId());
|
||||
|
||||
if (StringUtils.isNotEmpty(deviceAssignment.getAssigneeName())) {
|
||||
throw new BadRequestException(deviceType.getDeviceName() + ":设备已分配,请先解绑设备!!!");
|
||||
throw new BadRequestException(device.getDeviceName() + ":设备已分配,请先解绑设备!!!");
|
||||
}
|
||||
|
||||
if (device.getBindingStatus().equals(1)){
|
||||
throw new BadRequestException(device.getDeviceName() + ":设备已绑定,请先解绑设备!!!");
|
||||
}
|
||||
|
||||
// 接收者
|
||||
if (Objects.equals(deviceAssignment.getAssigneeId(), deviceType.getOriginalOwnerId())) {
|
||||
if (Objects.equals(deviceAssignment.getAssigneeId(), device.getOriginalOwnerId())) {
|
||||
invalidIds.add(deviceAssignment.getDeviceId());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user