Commit 538f3d36 authored by 赵啸非's avatar 赵啸非

添加前端页面

parent 01b30c54
...@@ -116,6 +116,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -116,6 +116,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if (ObjectUtils.isEmpty(deviceEntity)) throw new AppException("当前设备不存在!"); if (ObjectUtils.isEmpty(deviceEntity)) throw new AppException("当前设备不存在!");
if (deviceEntity.getDeviceStatus() != DeviceStatusEnum.未激活.getValue()) throw new AppException("当前设备已激活!"); if (deviceEntity.getDeviceStatus() != DeviceStatusEnum.未激活.getValue()) throw new AppException("当前设备已激活!");
deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue()); deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue());
deviceEntity.setEnabled(EnabledEnum.启用.getValue());
this.update(deviceEntity, context); this.update(deviceEntity, context);
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); ProductEntity productEntity = productService.get(deviceEntity.getProductId());
...@@ -308,12 +309,19 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -308,12 +309,19 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
throw new AppException("设备编码重复!"); throw new AppException("设备编码重复!");
} }
if (!ObjectUtils.isEmpty(entity.getProductId())) {
if (!ObjectUtils.isEmpty(entity.getPlatformCode())) { ProductEntity productEntity = productService.get(entity.getProductId());
PlatformEntity platformEntity = platformService.selectOne(new PlatformQuery().platformSn(entity.getPlatformCode())); if (!ObjectUtils.isEmpty(productEntity)) {
if (!ObjectUtils.isEmpty(platformEntity)) { entity.setProductId(productEntity.getId());
entity.setPlatformId(platformEntity.getId()); entity.setProductCode(productEntity.getProductCode());
entity.setPlatformName(platformEntity.getPlatformName()); entity.setProductName(productEntity.getProductName());
//根据产品查询平台
if(!ObjectUtils.isEmpty(productEntity.getPlatformId())){
PlatformEntity platformEntity = platformService.get(productEntity.getPlatformId());
entity.setPlatformId(platformEntity.getId());
entity.setPlatformCode(platformEntity.getPlatformSn());
entity.setPlatformName(platformEntity.getPlatformName());
}
} }
} }
...@@ -322,10 +330,28 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -322,10 +330,28 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if (!ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(productEntity)) {
entity.setProductId(productEntity.getId()); entity.setProductId(productEntity.getId());
entity.setProductName(productEntity.getProductName()); entity.setProductName(productEntity.getProductName());
//根据产品查询平台
if(!ObjectUtils.isEmpty(productEntity.getPlatformId())){
PlatformEntity platformEntity = platformService.get(productEntity.getPlatformId());
entity.setPlatformId(platformEntity.getId());
entity.setPlatformCode(platformEntity.getPlatformSn());
entity.setPlatformName(platformEntity.getPlatformName());
}
}
}
if (!ObjectUtils.isEmpty(entity.getPlatformCode())) {
PlatformEntity platformEntity = platformService.selectOne(new PlatformQuery().platformSn(entity.getPlatformCode()));
if (!ObjectUtils.isEmpty(platformEntity)) {
entity.setPlatformId(platformEntity.getId());
entity.setPlatformName(platformEntity.getPlatformName());
} }
} }
super.saveBefore(entity, context); super.saveBefore(entity, context);
} }
} }
\ No newline at end of file
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