Commit 7822bb30 authored by 赵啸非's avatar 赵啸非

添加站点参数

parent 207499ab
...@@ -57,8 +57,8 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu ...@@ -57,8 +57,8 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
@Override @Override
protected SiteBusinessEntity findBefore(SiteBusinessEntity params, PageInfo pageInfo, Context context) throws AppException { protected SiteBusinessEntity findBefore(SiteBusinessEntity params, PageInfo pageInfo, Context context) throws AppException {
//查询所有 //查询所有
pageInfo.setCurrPage(1); // pageInfo.setCurrPage(1);
pageInfo.setPrePageResult(-1); //pageInfo.setPrePageResult(-1);
if (!ObjectUtils.isEmpty(params.getIdNotList())) { if (!ObjectUtils.isEmpty(params.getIdNotList())) {
Set<Long> notIdSet = params.getIdNotList().stream().collect(Collectors.toSet()); Set<Long> notIdSet = params.getIdNotList().stream().collect(Collectors.toSet());
...@@ -89,22 +89,49 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu ...@@ -89,22 +89,49 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
} }
/** /**
* @param entity * @param params
* @param pageInfo * @param pageInfo
* @param context * @param context
* @return * @return
* @throws AppException * @throws AppException
*/ */
@Override @Override
public Result<SiteBusinessEntity> find(SiteBusinessEntity entity, PageInfo pageInfo, Context context) throws AppException { public Result<SiteBusinessEntity> find(SiteBusinessEntity params, PageInfo pageInfo, Context context) throws AppException {
SiteBusinessEntity params = this.findBefore(entity, pageInfo, context);
if (!ObjectUtils.isEmpty(params.getIdNotList())) {
Set<Long> notIdSet = params.getIdNotList().stream().collect(Collectors.toSet());
//排除掉了父级,但是子集存在,需要吧父id排除到notlist外
SiteBusinessQuery siteBusinessQuery = new SiteBusinessQuery();
siteBusinessQuery.setIdList(params.getIdNotList());
List<SiteBusinessEntity> rootSiteBusiness = this.find(siteBusinessQuery).stream().filter(f -> f.getIsBusiness() == IsBusinessEnum.一级业务.getValue()).collect(Collectors.toList());
for (SiteBusinessEntity root : rootSiteBusiness) {
SiteBusinessQuery query = new SiteBusinessQuery();
query.setParentId(root.getId());
List<SiteBusinessEntity> childSiteBusiness = this.find(query, context);
//判断排除的id是否包含所有
Boolean bool = false;
for (SiteBusinessEntity child : childSiteBusiness) {
if (!notIdSet.contains(child.getId())) {
bool = true;
break;
}
}
if (bool) {
//排除掉父id
notIdSet.remove(root.getId());
}
}
params.setIdNotList(notIdSet.stream().collect(Collectors.toList()));
}
//SiteBusinessEntity params = this.findBefore(entity, pageInfo, context);
Result<SiteBusinessEntity> result = this.dao.getList(params, pageInfo); Result<SiteBusinessEntity> result = this.dao.getList(params, pageInfo);
List<SiteBusinessEntity> list = result.getList(); List<SiteBusinessEntity> list = result.getList();
if (!ObjectUtils.isEmpty(params.getIdNotList())) { if (!ObjectUtils.isEmpty(params.getIdNotList())) {
//重新内存分页 //重新内存分页
result.getPageInfo().setCurrPage(params.getPage()); // result.getPageInfo().setCurrPage(params.getPage());
result.getPageInfo().setPrePageResult(params.getSize()); // result.getPageInfo().setPrePageResult(params.getSize());
list = MemoryPagination.pagination(list, params.getSize() == -1 ? list.size() : params.getSize(), params.getPage()); list = MemoryPagination.pagination(list, params.getSize() == -1 ? list.size() : params.getSize(), params.getPage());
//排除掉已经存在的ids //排除掉已经存在的ids
log.info("idNotList:{}", JSON.toJSONString(params.getIdNotList())); log.info("idNotList:{}", JSON.toJSONString(params.getIdNotList()));
......
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