java8多个list对象用lambda求差集

@RequiresPermissions("system:statistical:list")
@PostMapping("/getStuListNotClockIn/{orgIndexCode}/{accessTime}")
@ResponseBody
public TableDataInfo getStuListNotClockIn(@PathVariable String orgIndexCode,@PathVariable String accessTime)
{
    AttPrimary attPrimary = new AttPrimary();
    attPrimary.setOrgIndexCode(orgIndexCode);
    attPrimary.setAccessTime(accessTime);
    List attPrimaries = attPrimaryService.selectAttPrimaryList(attPrimary);
    Map stuList = HkApiPerson.getStuListByOrg("1","1000",orgIndexCode);
    JSONObject jsonObject = JSON.parseObject(JSONUtils.toJSONString(stuList));;
    List stuListHk = JSON.parseArray(jsonObject.getString("list"), AttPrimaryHk.class);
    System.err.println(stuListHk);
    List distinctByUniqueList = stuListHk.stream()
            .filter(item -> !attPrimaries.stream()
                    .map(e -> e.getStuId())
                    .collect(Collectors.toList())
                    .contains(item.getPersonId()))
            .collect(Collectors.toList());
    return getDataTable(distinctByUniqueList);
}

你可能感兴趣的:(java8多个list对象用lambda求差集)