Commit f56f3ed36d99c6c7ca1106026c21009426e41362

Authored by chenjunyu_1481036421
1 parent df55c83d

fix:1.产品批量更新规则链报错bug 2.产品展示为列表时展示创建时间

... ... @@ -99,6 +99,11 @@ public class DeviceProfileDTO extends BaseDTO {
99 99
100 100 public DeviceProfileDTO() {}
101 101
  102 +
  103 + public DeviceProfileDTO(
  104 + Long time) {
  105 + setCreateTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneOffset.of("+8")));
  106 + }
102 107 public DeviceProfileDTO(
103 108 UUID id,
104 109 String name,
... ...
... ... @@ -217,7 +217,8 @@ public class TkDeviceProfileServiceImpl
217 217 .map(entity->entity.getDefaultRuleChainId().toString()).collect(Collectors.toList()));
218 218 if(!ruleChainIds.isEmpty()){
219 219 //按规则链进行分类,找到具体的产品
220   - Map<UUID,List<TkDeviceProfileEntity>> classification = entities.stream().collect(Collectors.groupingBy(TkDeviceProfileEntity::getDefaultRuleChainId));
  220 + Map<UUID,List<TkDeviceProfileEntity>> classification = entities.stream().filter(entity -> entity.getDefaultRuleChainId() != null)
  221 + .collect(Collectors.groupingBy(TkDeviceProfileEntity::getDefaultRuleChainId));
221 222 //判断数据流转是否使用该规则链
222 223 checkDataConvertUsedDeviceProfile(tenantId.getId().toString(),new ArrayList<>(ruleChainIds),classification);
223 224 // 判断选中的产品是否被场景联动使用
... ... @@ -362,7 +363,11 @@ public class TkDeviceProfileServiceImpl
362 363 }
363 364 IPage<TkDeviceProfileEntity> currentPage = getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME, false);
364 365 result = baseMapper.getProfilePage(currentPage, tenantId, profileName, transportType, deviceProfileIds);
365   - return getPageData(result, DeviceProfileDTO.class);
  366 + List<DeviceProfileDTO> list = result.getRecords().stream().map(entity -> {
  367 + return CopyUtils.copyAndReturn(entity, new DeviceProfileDTO(entity.getCreateTime()));
  368 + }
  369 + ).collect(Collectors.toList());
  370 + return new TkPageData<>(list, result.getTotal());
366 371 }
367 372
368 373 @Override
... ...