|
|
@ -200,11 +200,29 @@ public class IotThingRelationRootServiceImpl extends BaseServiceImpl<IotThingRel |
|
|
iotThingRelationRootInsert.getGroupName()+CacheInit.KEY+ iotThingRelationRootInsert.getName()+CacheInit.KEY+ iotThingRelationRootInsert.getId(),nodes); |
|
|
iotThingRelationRootInsert.getGroupName()+CacheInit.KEY+ iotThingRelationRootInsert.getName()+CacheInit.KEY+ iotThingRelationRootInsert.getId(),nodes); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void updateRootAndCacheAny(IotThingRelationRootEntity iotThingRelationRootInsert) { |
|
|
|
|
|
IotThingRelationRootDTO relationRootDTO = ConvertUtils.sourceToTarget(iotThingRelationRootInsert, IotThingRelationRootDTO.class); |
|
|
|
|
|
ObjectNode nodes = JsonConverter.convertToJsonObjectObjectNode(relationRootDTO); |
|
|
|
|
|
nodes.put("fromId", "0"); |
|
|
|
|
|
nodes.put("rootId", nodes.get("id").asText()); |
|
|
|
|
|
nodes.put("toId", nodes.get("id").asText()); |
|
|
|
|
|
nodes.put("toName", nodes.get("name").asText()); |
|
|
|
|
|
nodes.put("rootThingId", "0"); |
|
|
|
|
|
cache.updateAccurateKeyMap(CacheNameEnum.THING_ROOT_RELATION, |
|
|
|
|
|
iotThingRelationRootInsert.getGroupName()+CacheInit.KEY+ iotThingRelationRootInsert.getName()+CacheInit.KEY+ iotThingRelationRootInsert.getId(),nodes); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Override |
|
|
@Override |
|
|
public void update(IotThingRelationRootDTO dto) { |
|
|
public void update(IotThingRelationRootDTO dto) { |
|
|
Long id = dto.getId(); |
|
|
Long id = dto.getId(); |
|
|
IotThingRelationRootEntity iotThingRelationRootEntity = mapper.selectOneById(id); |
|
|
IotThingRelationRootEntity iotThingRelationRootEntity = mapper.selectOneById(id); |
|
|
|
|
|
|
|
|
|
|
|
String oldKey = iotThingRelationRootEntity.getGroupName() + CacheInit.KEY + iotThingRelationRootEntity.getName() + CacheInit.KEY + iotThingRelationRootEntity.getId(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iotThingRelationRootEntity.setName(dto.getName()); |
|
|
iotThingRelationRootEntity.setName(dto.getName()); |
|
|
String url = BizUtils.trimAll(dto.getUrl()); |
|
|
String url = BizUtils.trimAll(dto.getUrl()); |
|
|
if(StringUtils.isNotBlank(url)){ |
|
|
if(StringUtils.isNotBlank(url)){ |
|
|
@ -214,8 +232,9 @@ public class IotThingRelationRootServiceImpl extends BaseServiceImpl<IotThingRel |
|
|
iotThingRelationRootEntity.setUrl(url); |
|
|
iotThingRelationRootEntity.setUrl(url); |
|
|
iotThingRelationRootEntity.setRemark(dto.getRemark()); |
|
|
iotThingRelationRootEntity.setRemark(dto.getRemark()); |
|
|
iotThingRelationRootEntity.setGroupName(dto.getGroupName()); |
|
|
iotThingRelationRootEntity.setGroupName(dto.getGroupName()); |
|
|
mapper.insertOrUpdateSelective(iotThingRelationRootEntity); |
|
|
|
|
|
|
|
|
mapper.update(iotThingRelationRootEntity); |
|
|
//更新缓存 |
|
|
//更新缓存 |
|
|
|
|
|
cache.deleteKeyMap(CacheNameEnum.THING_ROOT_RELATION,oldKey); |
|
|
updateRootAndCache(iotThingRelationRootEntity); |
|
|
updateRootAndCache(iotThingRelationRootEntity); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|