Commit c234a2dc authored by 赵啸非's avatar 赵啸非

修改根据业务查询部门逻辑

parent 9317ae8b
...@@ -45,14 +45,38 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu ...@@ -45,14 +45,38 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
@Override @Override
protected void findAfter(SiteBusinessEntity params, PageInfo pageInfo, Context context, List<SiteBusinessEntity> list) throws AppException { protected void findAfter(SiteBusinessEntity params, PageInfo pageInfo, Context context, List<SiteBusinessEntity> list) throws AppException {
SiteBusinessQuery siteBusinessQuery = new SiteBusinessQuery();
if (!ObjectUtils.isEmpty(params.getIdNotList())) {
//排除掉已经存在的ids
list = list.stream().map(item -> {
siteBusinessQuery.siteId(item.getSiteId());
siteBusinessQuery.setParentId(item.getBusinessId());
siteBusinessQuery.setIdNotList(params.getIdNotList());
List<SiteBusinessEntity> childs = this.find(siteBusinessQuery.siteId(item.getSiteId()).parentId(item.getBusinessId()));
if (ObjectUtils.isEmpty(childs)) {
//子节点已经全部选中,删除父节点
return null;
} else {
childs.stream().forEach(item1 -> {
buildChildBusiness(item1);
});
item.setChildren(childs);
buildChildBusiness(item);
return item;
}
}).filter(f -> f != null).collect(Collectors.toList());
} else {
list.stream().peek(item -> { list.stream().peek(item -> {
List<SiteBusinessEntity> childs = this.find(new SiteBusinessQuery().siteId(item.getSiteId()).parentId(item.getBusinessId())); List<SiteBusinessEntity> childs = this.find(siteBusinessQuery.siteId(item.getSiteId()).parentId(item.getBusinessId()));
childs.stream().forEach(item1 -> { childs.stream().forEach(item1 -> {
buildChildBusiness(item1); buildChildBusiness(item1);
}); });
item.setChildren(childs); item.setChildren(childs);
buildChildBusiness(item); buildChildBusiness(item);
}).count(); }).count();
}
super.findAfter(params, pageInfo, context, list); super.findAfter(params, pageInfo, context, list);
} }
...@@ -71,7 +95,7 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu ...@@ -71,7 +95,7 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
if (businessEntity.getIsBusiness() == IsBusinessEnum.一级业务.getValue()) { if (businessEntity.getIsBusiness() == IsBusinessEnum.一级业务.getValue()) {
//添加二级业务列表 //添加二级业务列表
List<BusinessEntity> businessEntities = businessService.find(new BusinessQuery().parentId(businessEntity.getId())); List<BusinessEntity> businessEntities = businessService.find(new BusinessQuery().parentId(businessEntity.getId()));
if(!ObjectUtils.isEmpty(businessEntities)){ if (!ObjectUtils.isEmpty(businessEntities)) {
item.setBusinessChildren(businessEntities); item.setBusinessChildren(businessEntities);
} }
} }
...@@ -98,12 +122,11 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu ...@@ -98,12 +122,11 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
.filter(item -> !item.getSiteBusinessName().equals(entity.getBusinessName())) .filter(item -> !item.getSiteBusinessName().equals(entity.getBusinessName()))
.peek(item -> item.setSiteBusinessName(entity.getBusinessName())) .peek(item -> item.setSiteBusinessName(entity.getBusinessName()))
.collect(Collectors.toList()); .collect(Collectors.toList());
if(!ObjectUtils.isEmpty(businessMatterEntities)){ if (!ObjectUtils.isEmpty(businessMatterEntities)) {
businessMatterService.update(businessMatterEntities,context); businessMatterService.update(businessMatterEntities, context);
} }
super.updateAfter(entity, context); super.updateAfter(entity, context);
} }
......
...@@ -7,7 +7,7 @@ Content-Type: application/json ...@@ -7,7 +7,7 @@ Content-Type: application/json
"idNotList": [11,12], "idNotList": [11,12],
"siteId": 1, "siteId": 1,
"page":1, "page":1,
"size":10 "size":-1
} }
###站点业务列表 ###站点业务列表
......
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