Skip to content

Commit

Permalink
[INLONG-9995][Manager] Fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
fuweng11 committed Apr 16, 2024
1 parent 513bfad commit 1d9021e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ public class ProcessResponse {
private List<TaskResponse> currentTasks;

@ApiModelProperty(value = "Extra information shown in the list")
private Map<String, Object> showInList;
private List<Map<String, Object>> showInList;

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ public class TaskResponse {
private Object extParams;

@ApiModelProperty(value = "Extra information shown in the list")
private Map<String, Object> showInList;
private List<Map<String, Object>> showInList;

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -56,12 +58,14 @@ public String getInlongGroupId() {
}

@Override
public Map<String, Object> showInList() {
public List<Map<String, Object>> showInList() {
List<Map<String, Object>> showInList = new ArrayList<>();
Map<String, Object> show = Maps.newHashMap();
if (consumeInfo != null) {
show.put("inlongGroupId", consumeInfo.getInlongGroupId());
show.put("consumerGroup", consumeInfo.getConsumerGroup());
}
return show;
showInList.add(show);
return showInList;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,24 @@ public String getInlongGroupId() {
}

@Override
public Map<String, Object> showInList() {
Map<String, Object> show = Maps.newHashMap();
public List<Map<String, Object>> showInList() {
List<Map<String, Object>> showList = new ArrayList<>();
if (groupInfo != null) {
show.put("inlongGroupId", groupInfo.getInlongGroupId());
show.put("inlongGroupMode", groupInfo.getInlongGroupMode());
} else {
List<String> groupIdList = new ArrayList<>();
List<Integer> groupModeList = new ArrayList<>();
groupFullInfoList.forEach(v -> {
InlongGroupInfo groupInfo = v.getGroupInfo();
groupIdList.add(groupInfo.getInlongGroupId());
groupModeList.add(groupInfo.getInlongGroupMode());
addShowInfo(groupInfo, showList);
}
if (CollectionUtils.isNotEmpty(groupFullInfoList)) {
groupFullInfoList.forEach(groupFullInfo -> {
addShowInfo(groupFullInfo.getGroupInfo(), showList);
});
show.put("inlongGroupId", Joiner.on(",").join(groupIdList));
show.put("inlongGroupMode", Joiner.on(",").join(groupModeList));
}
return show;
return showList;
}

private void addShowInfo(InlongGroupInfo groupInfo, List<Map<String, Object>> showList) {
Map<String, Object> show = Maps.newHashMap();
show.put("inlongGroupId", groupInfo.getInlongGroupId());
show.put("inlongGroupMode", groupInfo.getInlongGroupMode());
showList.add(show);
}

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -61,11 +62,13 @@ public String getInlongGroupId() {
}

@Override
public Map<String, Object> showInList() {
public List<Map<String, Object>> showInList() {
List<Map<String, Object>> showInList = new ArrayList<>();
Map<String, Object> show = new HashMap<>();
show.put("inlongGroupId", groupInfo.getInlongGroupId());
show.put("groupOperateType", this.groupOperateType);
return show;
showInList.add(show);
return showInList;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.List;
import java.util.Map;

/**
Expand All @@ -47,7 +48,7 @@ default String getTitle() {
/**
* Field data displayed in the process list.
*/
default Map<String, Object> showInList() {
default List<Map<String, Object>> showInList() {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ private Consumer<ProcessResponse> addCurrentTask(TaskRequest query) {
};
}

private Map<String, Object> getShowInList(WorkflowProcessEntity processEntity) {
private List<Map<String, Object>> getShowInList(WorkflowProcessEntity processEntity) {
WorkflowProcess process = processDefService.getByName(processEntity.getName());
if (process == null || process.getFormClass() == null) {
return null;
Expand All @@ -270,7 +270,7 @@ private void addShowInListForEachTask(List<TaskResponse> taskList) {
query.setIdList(list);

List<WorkflowProcessEntity> processEntities = queryService.listProcessEntity(query);
Map<Integer, Map<String, Object>> processShowInListMap = Maps.newHashMap();
Map<Integer, List<Map<String, Object>>> processShowInListMap = Maps.newHashMap();
processEntities.forEach(entity -> processShowInListMap.put(entity.getId(), getShowInList(entity)));
taskList.forEach(task -> task.setShowInList(processShowInListMap.get(task.getProcessId())));
}
Expand Down

0 comments on commit 1d9021e

Please sign in to comment.