用Set判断List集合的字段是否重复,并去重统计
List<BsWplanForm> bswplanList = this.sqlQueryUtils.queryAll(sqlWplan, new Object[] { partnerCode }, BsWplanForm.class);
if (bswplanList.size() > 0) {
Set<String> orgSetList = new HashSet<String>();
for (BsWplanForm bsWplanForms1 : bswplanList) {
orgSetList.add(bsWplanForms1.getOrgId());
}
long orgcounts = orgSetList.stream().distinct().count();
if (orgcounts > 1L) {
String message = this.messageSource.getMessage("common.orgdifferent", new Object[0], paramUtils.getLocale());
checkUtil.throwException(message, new BaseException());
}