fix: 获取当前循环对象和下标
This commit is contained in:
parent
264eb3e5ad
commit
596d8ceb29
@ -19,16 +19,17 @@ public class FlowGetCurrentObjNodeHandler implements FlowNodeTypeHandler {
|
||||
public TaskNodeExecuteResult handle(TaskNodeExecuteMessage message) {
|
||||
try {
|
||||
JSONObject inputParams = message.getInputParams();
|
||||
|
||||
JSONArray jsonArray = inputParams.getJSONArray("array");
|
||||
|
||||
List<Integer> iterations = message.getIterations();
|
||||
int last = CollUtil.getLast(iterations) - 1;
|
||||
Object o = jsonArray.get(last);
|
||||
|
||||
JSONObject output = new JSONObject();
|
||||
output.put("index", last);
|
||||
output.put("object", o);
|
||||
|
||||
if (CollUtil.isNotEmpty(jsonArray) && last >= 0) {
|
||||
output.put("object", jsonArray.get(last));
|
||||
}
|
||||
|
||||
return TaskNodeExecuteResult.success(output);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user