修复双重循环中间定义的变量未正确聚合的BUG
This commit is contained in:
parent
942f87d800
commit
9d629edba3
@ -168,7 +168,7 @@ public class Spider {
|
||||
if(executor instanceof LoopExecutor){
|
||||
variables.put(LoopExecutor.LOOP_NODE_KEY + node.getNodeId(), treeNode);
|
||||
variables.put(LoopExecutor.LOOP_NODE_KEY, treeNode);
|
||||
variables.put(LoopExecutor.BEFORE_LOOP_VARIABLE, variables);
|
||||
variables.put(LoopExecutor.BEFORE_LOOP_VARIABLE + node.getNodeId(), variables);
|
||||
variables.put(LoopJoinExecutor.VARIABLE_CONTEXT + node.getNodeId(), new LinkedBlockingQueue<>());
|
||||
}
|
||||
List<Runnable> runnables = new ArrayList<>();
|
||||
|
@ -17,7 +17,7 @@ public class LoopExecutor implements ShapeExecutor{
|
||||
|
||||
public static final String LOOP_NODE_KEY = "__loop_node_";
|
||||
|
||||
public static final String BEFORE_LOOP_VARIABLE = "__loop_before_variable";
|
||||
public static final String BEFORE_LOOP_VARIABLE = "__loop_before_variable_";
|
||||
|
||||
@Override
|
||||
public void execute(SpiderNode node, SpiderContext context, Map<String,Object> variables) {
|
||||
|
@ -42,7 +42,7 @@ public class LoopJoinExecutor implements ShapeExecutor {
|
||||
if(treeNode != null){
|
||||
boolean isDone = treeNode.isDone();
|
||||
if(isDone){
|
||||
Map<String, Object> beforeLoopVariable = (Map<String, Object>) variables.get(LoopExecutor.BEFORE_LOOP_VARIABLE);
|
||||
Map<String, Object> beforeLoopVariable = (Map<String, Object>) variables.get(LoopExecutor.BEFORE_LOOP_VARIABLE + joinNodeId);
|
||||
variableCollection.stream()
|
||||
.flatMap(map -> map.entrySet().stream())
|
||||
.collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())))
|
||||
|
Loading…
Reference in New Issue
Block a user