Commit 4935dfe7 authored by alex yao's avatar alex yao

fix: 修复应用更新其他信息时,导致【变量】更新

parent fd0c55a7
...@@ -101,12 +101,27 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ ...@@ -101,12 +101,27 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
@Override @Override
public BizAgentApplicationInfoEntity saveOrUpdate(BizAgentApplicationInfoEntity entity) throws Exception { public BizAgentApplicationInfoEntity saveOrUpdate(BizAgentApplicationInfoEntity entity) throws Exception {
// 如果存在agentId,则判断变量结构是否有变化,如果有变化,则删除redis中的数据 // 如果存在agentId,则判断变量结构是否有变化,如果有变化,则删除redis中的数据
boolean needClean = false;
if (StringUtils.isNotBlank(entity.getAgentId())) { if (StringUtils.isNotBlank(entity.getAgentId())) {
BizAgentApplicationInfoEntity infoEntity = bizAgentApplicationInfoService.getByAgentId(entity.getAgentId());
if (CollectionUtils.isEmpty(entity.getVariableStructure()) || CollectionUtils.isEmpty(infoEntity.getVariableStructure())) {
needClean = true;
} else if (infoEntity.getVariableStructure().size() != entity.getVariableStructure().size()) {
needClean = true;
} else {
String sourceVariable = JsonUtils.serialize(infoEntity.getVariableStructure());
String targetVariable = JsonUtils.serialize(entity.getVariableStructure());
needClean = !StringUtils.equals(sourceVariable, targetVariable);
}
}
if (needClean) {
String contentKey = SetValueMemoryConstants.REDIS_PREFIX + entity.getAgentId() + ":" + entity.getMemberId(); String contentKey = SetValueMemoryConstants.REDIS_PREFIX + entity.getAgentId() + ":" + entity.getMemberId();
redisService.del(contentKey); redisService.del(contentKey);
} }
// 保存或更新 // 保存或更新
return StringUtils.isEmpty(entity.getAgentId()) ? return StringUtils.isEmpty(entity.getAgentId()) ?
bizAgentApplicationInfoService.save(entity) : bizAgentApplicationInfoService.update(entity); bizAgentApplicationInfoService.save(entity) : bizAgentApplicationInfoService.update(entity);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment