//查询当前全部数据与拉取数据比对取差集
List<Company> list = companyService.list();
//StringEscapeUtils.unescapeJava()去除转义斜杠
String get = StringEscapeUtils.unescapeJava(HttpRequestUtil.sendGet(""));
List<Company> companies = JSON.parseArray(JSON.toJSONString(JSONObject.parseObject(get).get("Data")), Company.class);
//获得差集(比较字段 organizationCode enterPriseName)
List<Company> collect = list.stream().filter(
a -> !companies.stream().map(
b -> b.getOrganizationCode() + "&" + b.getEnterPriseName()).collect(Collectors.toList())
.contains(a.getOrganizationCode() + "&" + a.getEnterPriseName())).collect(Collectors.toList());
List<T>比较字段求差集
最新推荐文章于 2023-06-26 20:19:20 发布