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

添加前端页面

parent 01b30c54
......@@ -116,6 +116,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if (ObjectUtils.isEmpty(deviceEntity)) throw new AppException("当前设备不存在!");
if (deviceEntity.getDeviceStatus() != DeviceStatusEnum.未激活.getValue()) throw new AppException("当前设备已激活!");
deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue());
deviceEntity.setEnabled(EnabledEnum.启用.getValue());
this.update(deviceEntity, context);
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
ProductEntity productEntity = productService.get(deviceEntity.getProductId());
......@@ -308,12 +309,19 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
throw new AppException("设备编码重复!");
}
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());
if (!ObjectUtils.isEmpty(entity.getProductId())) {
ProductEntity productEntity = productService.get(entity.getProductId());
if (!ObjectUtils.isEmpty(productEntity)) {
entity.setProductId(productEntity.getId());
entity.setProductCode(productEntity.getProductCode());
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
if (!ObjectUtils.isEmpty(productEntity)) {
entity.setProductId(productEntity.getId());
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);
}
}
\ 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