|
|
@@ -541,10 +541,6 @@ public class DmpDeviceInfoServiceImpl extends AbstractCrudService<DmpDeviceInfoM
|
|
|
throw new BusinessException("新增设备信息'" + dmpDeviceInfo.getDeviceId() + "'失败,设备信息已存在");
|
|
|
}
|
|
|
List<DmpProductInfo> list = baseMapper.getProductInfo(dmpDeviceInfo.getProductCode());
|
|
|
- int count = 0;
|
|
|
- if(dmpDeviceInfo.getTenantId() != null){
|
|
|
- count = baseMapper.sysTenantCount(dmpDeviceInfo.getTenantId());
|
|
|
- }
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
dmpDeviceInfo.setDeviceType(list.get(0).getDeviceType());
|
|
|
dmpDeviceInfo.setProductId(list.get(0).getId());
|
|
|
@@ -570,24 +566,8 @@ public class DmpDeviceInfoServiceImpl extends AbstractCrudService<DmpDeviceInfoM
|
|
|
dmpDeviceStatus.setProductCode(dmpDeviceInfo.getProductCode());
|
|
|
dmpDeviceStatus.setDeviceUuid(dmpDeviceInfo.getDeviceUuid());
|
|
|
dmpDeviceStatusService.save(dmpDeviceStatus);
|
|
|
- } else if(count > 0){ //子系统同步到平台
|
|
|
- dmpDeviceInfo.setDeviceType(Integer.valueOf(""));
|
|
|
- dmpDeviceInfo.setProductId(Integer.valueOf(""));
|
|
|
- dmpDeviceInfo.setCreatedBy(SecurityUtils.getUsername());
|
|
|
- dmpDeviceInfo.setCreatedTime(LocalDateTime.now());
|
|
|
- dmpDeviceInfo.setServiceStatus(1);
|
|
|
- this.save(dmpDeviceInfo);
|
|
|
-
|
|
|
- DmpDeviceStatus dmpDeviceStatus = new DmpDeviceStatus();
|
|
|
- dmpDeviceStatus.setDeviceId(dmpDeviceInfo.getDeviceId());
|
|
|
- dmpDeviceStatus.setProductId(Integer.valueOf(""));
|
|
|
- dmpDeviceStatus.setDeviceStatus(2);
|
|
|
- dmpDeviceStatus.setLastOfflineTime(LocalDateTime.now());
|
|
|
- dmpDeviceStatus.setProductCode("");
|
|
|
- dmpDeviceStatus.setDeviceUuid(dmpDeviceInfo.getDeviceUuid());
|
|
|
- dmpDeviceStatusService.save(dmpDeviceStatus);
|
|
|
} else {
|
|
|
- throw new BusinessException("新增设备信息'" + dmpDeviceInfo.getDeviceId() + "'失败,无对应产品信息或租户Id");
|
|
|
+ throw new BusinessException("新增设备信息'" + dmpDeviceInfo.getDeviceId() + "'失败,无对应产品信息");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -602,22 +582,6 @@ public class DmpDeviceInfoServiceImpl extends AbstractCrudService<DmpDeviceInfoM
|
|
|
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void bindSubsystemDevice(DmpDeviceInfo dmpDeviceInfo) {
|
|
|
- dmpDeviceInfo.setUpdatedBy(SecurityUtils.getUsername());
|
|
|
- dmpDeviceInfo.setUpdatedTime(LocalDateTime.now());
|
|
|
- if (checkNameUnique(dmpDeviceInfo)) {
|
|
|
- throw new BusinessException("修改设备信息'" + dmpDeviceInfo.getDeviceId() + "'失败,设备信息已存在");
|
|
|
- }
|
|
|
- this.updateById(dmpDeviceInfo);
|
|
|
-
|
|
|
- LambdaUpdateWrapper<DmpDeviceStatus> updateWrapper = Wrappers.lambdaUpdate();
|
|
|
- updateWrapper.set(DmpDeviceStatus::getProductId,dmpDeviceInfo.getProductId())
|
|
|
- .set(DmpDeviceStatus::getProductCode,dmpDeviceInfo.getProductCode())
|
|
|
- .eq(DmpDeviceStatus::getDeviceUuid, dmpDeviceInfo.getDeviceUuid());
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public boolean checkNameUnique(DmpDeviceInfo dmpDeviceInfo) {
|
|
|
Integer id = null == dmpDeviceInfo.getId() ? -1 : dmpDeviceInfo.getId();
|