|
@@ -70,6 +70,8 @@ public class IotDeviceService {
|
|
|
Optional.ofNullable(userApi.queryUser(a.getCreateBy())).ifPresent(userCache -> a.setCreateByLabel(userCache.getName()));
|
|
Optional.ofNullable(userApi.queryUser(a.getCreateBy())).ifPresent(userCache -> a.setCreateByLabel(userCache.getName()));
|
|
|
Optional.ofNullable(userApi.queryUser(a.getUpdateBy())).ifPresent(userCache -> a.setUpdateByLabel(userCache.getName()));
|
|
Optional.ofNullable(userApi.queryUser(a.getUpdateBy())).ifPresent(userCache -> a.setUpdateByLabel(userCache.getName()));
|
|
|
Optional.ofNullable(dictApi.query(DictType.NODE_TYPE, String.valueOf(a.getNodeType()))).ifPresent(dictCache -> a.setNodeTypeLabel(dictCache.getLabel()));
|
|
Optional.ofNullable(dictApi.query(DictType.NODE_TYPE, String.valueOf(a.getNodeType()))).ifPresent(dictCache -> a.setNodeTypeLabel(dictCache.getLabel()));
|
|
|
|
|
+ Optional.ofNullable(dictApi.query(DictType.STATUS_TYPE, String.valueOf(a.getStatus()))).ifPresent(dictCache -> a.setStatusName(dictCache.getLabel()));
|
|
|
|
|
+ Optional.ofNullable(dictApi.query(DictType.ENABLE_TYPE, String.valueOf(a.getEnableFlag()))).ifPresent(dictCache -> a.setEnableFlagName(dictCache.getLabel()));
|
|
|
Optional.ofNullable(cacheService.getKey(String.format(CacheConstant.ONLINE_CACHE, a.getGuid()))).ifPresent(t -> {
|
|
Optional.ofNullable(cacheService.getKey(String.format(CacheConstant.ONLINE_CACHE, a.getGuid()))).ifPresent(t -> {
|
|
|
a.setOnlineTime(t);
|
|
a.setOnlineTime(t);
|
|
|
a.setStatus(1);
|
|
a.setStatus(1);
|
|
@@ -115,7 +117,10 @@ public class IotDeviceService {
|
|
|
throw new BusinessException("id不能为空");
|
|
throw new BusinessException("id不能为空");
|
|
|
}
|
|
}
|
|
|
//校验sn
|
|
//校验sn
|
|
|
- checkDeviceSn(iotDevicePara.getSn());
|
|
|
|
|
|
|
+ IotDevice iotDeviceC = iotDeviceMapper.selectOne(new LambdaQueryWrapper<IotDevice>().eq(IotDevice::getSn, iotDevicePara.getSn()).eq(IotDevice::getDelFlag, Global.UN_DEL).last("limit 1"));
|
|
|
|
|
+ if (Objects.nonNull(iotDeviceC) && !Objects.equals(iotDeviceC.getId(), iotDevicePara.getId())) {
|
|
|
|
|
+ throw new BusinessException("当前设备【" + iotDeviceC.getSn() + "】已存在");
|
|
|
|
|
+ }
|
|
|
//校验产品
|
|
//校验产品
|
|
|
checkProduct(iotDevicePara.getProductId());
|
|
checkProduct(iotDevicePara.getProductId());
|
|
|
|
|
|
|
@@ -189,6 +194,8 @@ public class IotDeviceService {
|
|
|
Optional.ofNullable(userApi.queryUser(detail.getUpdateBy())).ifPresent(userCache -> detail.setUpdateByLabel(userCache.getName()));
|
|
Optional.ofNullable(userApi.queryUser(detail.getUpdateBy())).ifPresent(userCache -> detail.setUpdateByLabel(userCache.getName()));
|
|
|
Optional.ofNullable(dictApi.query(DictType.AUTH_TYPE, String.valueOf(detail.getAuthType()))).ifPresent(cache -> detail.setAuthTypeLabel(cache.getLabel()));
|
|
Optional.ofNullable(dictApi.query(DictType.AUTH_TYPE, String.valueOf(detail.getAuthType()))).ifPresent(cache -> detail.setAuthTypeLabel(cache.getLabel()));
|
|
|
Optional.ofNullable(dictApi.query(DictType.NODE_TYPE, String.valueOf(detail.getNodeType()))).ifPresent(cache -> detail.setNodeTypeLabel(cache.getLabel()));
|
|
Optional.ofNullable(dictApi.query(DictType.NODE_TYPE, String.valueOf(detail.getNodeType()))).ifPresent(cache -> detail.setNodeTypeLabel(cache.getLabel()));
|
|
|
|
|
+ Optional.ofNullable(dictApi.query(DictType.STATUS_TYPE, String.valueOf(detail.getStatus()))).ifPresent(cache -> detail.setStatusLabel(cache.getLabel()));
|
|
|
|
|
+ Optional.ofNullable(dictApi.query(DictType.ENABLE_TYPE, String.valueOf(detail.getEnableFlag()))).ifPresent(cache -> detail.setEnableFlagLabel(cache.getLabel()));
|
|
|
Optional.ofNullable(dictApi.query(DictType.NETWORK_TYPE, String.valueOf(detail.getNetworkType()))).ifPresent(cache -> detail.setNetworkTypeLabel(cache.getLabel()));
|
|
Optional.ofNullable(dictApi.query(DictType.NETWORK_TYPE, String.valueOf(detail.getNetworkType()))).ifPresent(cache -> detail.setNetworkTypeLabel(cache.getLabel()));
|
|
|
Optional.ofNullable(dictApi.query(DictType.REPORT_PROTOCOL_TYPE, String.valueOf(detail.getReportProtocol()))).ifPresent(cache -> detail.setReportProtocolLabel(cache.getLabel()));
|
|
Optional.ofNullable(dictApi.query(DictType.REPORT_PROTOCOL_TYPE, String.valueOf(detail.getReportProtocol()))).ifPresent(cache -> detail.setReportProtocolLabel(cache.getLabel()));
|
|
|
Optional.ofNullable(dictApi.query(DictType.VENDORS_TYPE, String.valueOf(detail.getVendors()))).ifPresent(cache -> detail.setVendorsLabel(cache.getLabel()));
|
|
Optional.ofNullable(dictApi.query(DictType.VENDORS_TYPE, String.valueOf(detail.getVendors()))).ifPresent(cache -> detail.setVendorsLabel(cache.getLabel()));
|
|
@@ -300,4 +307,7 @@ public class IotDeviceService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ public Object list(Long productId) {
|
|
|
|
|
+ return iotDeviceMapper.list(productId);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|