Commit 08b68303 by zhiwj

去掉重复值

parent 3fa567f6
package com.gic.cloud.operation.web.controller; package com.gic.cloud.operation.web.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.authcenter.security.core.util.UserUtils; import com.gic.authcenter.security.core.util.UserUtils;
...@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -104,7 +106,16 @@ public class DataExplainController { ...@@ -104,7 +106,16 @@ public class DataExplainController {
public RestResponse moduleList() { public RestResponse moduleList() {
Object cache = RedisUtil.getCache("enterprise:datacloud:moduleList"); Object cache = RedisUtil.getCache("enterprise:datacloud:moduleList");
if (cache != null) { if (cache != null) {
return RestResponse.success(JSON.parseArray(cache.toString())); List<JSONObject> resultList = JSON.parseArray(cache.toString(), JSONObject.class);
Page<DataExplainDTO> page = dataExplainApiService.listDataExplain(new DataExplainQo()).getResult();
if (page != null) {
List<DataExplainDTO> result = page.getResult();
Set<String> usedList = result.stream().filter(e -> StringUtils.isNotBlank(e.getModuleId())).map(DataExplainDTO::getModuleId).collect(Collectors.toSet());
resultList = resultList.stream().filter(e -> !usedList.contains(e.getString("moduleId"))).collect(Collectors.toList());
}
return RestResponse.success(resultList);
} }
return RestResponse.success(); return RestResponse.success();
} }
......
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