|
@@ -174,6 +174,12 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
IotDeviceDO iotDevice = BeanUtils.toBean(createReqVO, IotDeviceDO.class);
|
|
IotDeviceDO iotDevice = BeanUtils.toBean(createReqVO, IotDeviceDO.class);
|
|
iotDevice.setSortColumn(NumberUtils.extractNumber(iotDevice.getDeviceCode()));
|
|
iotDevice.setSortColumn(NumberUtils.extractNumber(iotDevice.getDeviceCode()));
|
|
iotDevice.setDeleted(false);
|
|
iotDevice.setDeleted(false);
|
|
|
|
+ if (Objects.nonNull(createReqVO.getBrand())) {
|
|
|
|
+ DictDataDO dictData = dictDataService.getDictData(createReqVO.getBrand());
|
|
|
|
+ if (Objects.nonNull(dictData)) {
|
|
|
|
+ iotDevice.setBrandName(dictData.getLabel());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
iotDeviceMapper.insert(iotDevice);
|
|
iotDeviceMapper.insert(iotDevice);
|
|
//插入资料
|
|
//插入资料
|
|
IotInfoClassifyDO infoClassifyDO = new IotInfoClassifyDO();
|
|
IotInfoClassifyDO infoClassifyDO = new IotInfoClassifyDO();
|
|
@@ -218,6 +224,12 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
validateIotDeviceExists(updateReqVO.getId());
|
|
validateIotDeviceExists(updateReqVO.getId());
|
|
// 更新
|
|
// 更新
|
|
IotDeviceDO updateObj = BeanUtils.toBean(updateReqVO, IotDeviceDO.class);
|
|
IotDeviceDO updateObj = BeanUtils.toBean(updateReqVO, IotDeviceDO.class);
|
|
|
|
+ if (Objects.nonNull(updateReqVO.getBrand())) {
|
|
|
|
+ DictDataDO dictData = dictDataService.getDictData(updateReqVO.getBrand());
|
|
|
|
+ if (Objects.nonNull(dictData)) {
|
|
|
|
+ updateObj.setBrandName(dictData.getLabel());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
iotDeviceMapper.updateById(updateObj);
|
|
iotDeviceMapper.updateById(updateObj);
|
|
//更新pms树
|
|
//更新pms树
|
|
List<IotTreeDO> iotTreeDOS = iotTreeMapper.selectListByOriginId(updateObj.getId(), "device");
|
|
List<IotTreeDO> iotTreeDOS = iotTreeMapper.selectListByOriginId(updateObj.getId(), "device");
|
|
@@ -284,6 +296,18 @@ public class IotDeviceServiceImpl implements IotDeviceService {
|
|
iotDeviceMapper.updateBatch(deviceDOS);
|
|
iotDeviceMapper.updateBatch(deviceDOS);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void updateBrandName() {
|
|
|
|
+ List<IotDeviceDO> deviceDOS = iotDeviceMapper.selectList();
|
|
|
|
+ deviceDOS.forEach(deviceDO -> {
|
|
|
|
+ DictDataDO dictData = dictDataService.getDictData(deviceDO.getBrand());
|
|
|
|
+ if (Objects.nonNull(dictData)) {
|
|
|
|
+ deviceDO.setBrandName(dictData.getLabel());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ iotDeviceMapper.updateBatch(deviceDOS);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<IotDeviceDO> getSimpleDeviceList(IotDevicePageReqVO reqVO) {
|
|
public List<IotDeviceDO> getSimpleDeviceList(IotDevicePageReqVO reqVO) {
|
|
Set<Long> ids = new HashSet<>();
|
|
Set<Long> ids = new HashSet<>();
|