This commit is contained in:
wangliwen 2022-06-10 09:14:09 +08:00
parent 87ac346c28
commit 18e27f3038
1 changed files with 3 additions and 3 deletions

View File

@ -43,11 +43,11 @@ public class InsertTaskListJob implements ITask {
Map<String, Object> key = (Map<String, Object>) index; Map<String, Object> key = (Map<String, Object>) index;
String eventType = (String) key.get("eventType"); String eventType = (String) key.get("eventType");
String eventCnName = (String) key.get("eventCnName"); String eventCnName = (String) key.get("eventCnName");
JSONObject taskListBody = shangTangService.tasklist(eventType); Optional<JSONObject> taskListBody = Optional.ofNullable(shangTangService.tasklist(eventType));
if (taskListBody.isEmpty()) { if (!taskListBody.isPresent() || taskListBody.get().isEmpty()) {
return; return;
} }
Optional<JSONObject> taskdatajobj = Optional.ofNullable(taskListBody.getJSONObject("data")); Optional<JSONObject> taskdatajobj = Optional.ofNullable(taskListBody.get().getJSONObject("data"));
taskdatajobj.ifPresent(task -> { taskdatajobj.ifPresent(task -> {
Optional<JSONArray> taskdatajobjJSONArray = Optional.ofNullable(task.getJSONArray("dataList")); Optional<JSONArray> taskdatajobjJSONArray = Optional.ofNullable(task.getJSONArray("dataList"));
taskdatajobjJSONArray.orElse(new JSONArray()).stream().forEach(index_ -> { taskdatajobjJSONArray.orElse(new JSONArray()).stream().forEach(index_ -> {