|
|
@ -26,6 +26,7 @@ import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
@ -176,7 +177,7 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl<MainWorkBenchMappe |
|
|
|
// 当前用户
|
|
|
|
// 当前用户
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
// 查询路由列表
|
|
|
|
// 查询路由列表
|
|
|
|
List<MainWorkBenchEntity> list = this.baseMapper.selectMainWorkBenchByType(deptCategory.toString(), null, vo.getRefTerminal(), stations.stream().map(StationEntity::getType).collect(Collectors.toList()), deptList,dept.getId(),user.getUserId()); |
|
|
|
List<MainWorkBenchEntity> list = this.baseMapper.selectMainWorkBenchByType(deptCategory.toString(), null, vo.getRefTerminal(), stations.stream().map(StationEntity::getType).distinct().collect(Collectors.toList()), deptList,dept.getId(),user.getUserId()); |
|
|
|
// 路由列表包含指定用户,过滤非指定用户数据
|
|
|
|
// 路由列表包含指定用户,过滤非指定用户数据
|
|
|
|
boolean isDesign = CollectionUtil.isNotEmpty(list.stream().filter(o->StringUtils.isNotEmpty(o.getAscriptionUser())).collect(Collectors.toList())); |
|
|
|
boolean isDesign = CollectionUtil.isNotEmpty(list.stream().filter(o->StringUtils.isNotEmpty(o.getAscriptionUser())).collect(Collectors.toList())); |
|
|
|
if(isDesign){ |
|
|
|
if(isDesign){ |
|
|
@ -187,4 +188,76 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl<MainWorkBenchMappe |
|
|
|
inDustryVo.setMainWorkBenchExtendVo(mainWorkBenchExtendVo); |
|
|
|
inDustryVo.setMainWorkBenchExtendVo(mainWorkBenchExtendVo); |
|
|
|
return inDustryVo; |
|
|
|
return inDustryVo; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 首页工作台 |
|
|
|
|
|
|
|
* 过滤台条件 : 终端: WEB/APP 、站点类型、首页分类: 集团/区域/站点 、所属机构、指定用户 |
|
|
|
|
|
|
|
* 后续考虑 : 排除机构 |
|
|
|
|
|
|
|
* @param param |
|
|
|
|
|
|
|
* @return InDustryVo |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public InDustryVo route(RoutingParamVo param) { |
|
|
|
|
|
|
|
// 终端
|
|
|
|
|
|
|
|
String terminal = param.getRefTerminal(); |
|
|
|
|
|
|
|
// 站点分类
|
|
|
|
|
|
|
|
List<StationEntity> stations = stationService.list(); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
|
|
|
|
return new InDustryVo(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<Integer> types = stations.stream().map(StationEntity::getType).distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 用户权限机构
|
|
|
|
|
|
|
|
R<List<Dept>> result = sysClient.getDeptByCurrentUser(); |
|
|
|
|
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
|
|
|
|
return new InDustryVo(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 首页分类
|
|
|
|
|
|
|
|
int category = this.userCategory(result.getData()); |
|
|
|
|
|
|
|
List<MainWorkBenchEntity> routes = this.baseMapper.stagingRoute(terminal,types,category); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(routes)){ |
|
|
|
|
|
|
|
return new InDustryVo(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 所属机构
|
|
|
|
|
|
|
|
List<String> depts = result.getData().stream().map(o->o.getId().toString()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 所属用户
|
|
|
|
|
|
|
|
String user = AuthUtil.getUserId().toString(); |
|
|
|
|
|
|
|
InDustryVo dustry = new InDustryVo(); |
|
|
|
|
|
|
|
MainWorkBenchExtendVo workBench = new MainWorkBenchExtendVo(); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(routes.stream().filter(o->StringUtils.isNotEmpty(o.getRefDept())).collect(Collectors.toList())) && |
|
|
|
|
|
|
|
CollectionUtil.isEmpty(routes.stream().filter(o->StringUtils.isNotEmpty(o.getAscriptionUser())).collect(Collectors.toList()))){ |
|
|
|
|
|
|
|
// 设置结果集
|
|
|
|
|
|
|
|
workBench.setMainWorkBenchEntityList(routes); |
|
|
|
|
|
|
|
}else if(CollectionUtil.isEmpty(routes.stream().filter(o->StringUtils.isNotEmpty(o.getRefDept())).collect(Collectors.toList()))){ |
|
|
|
|
|
|
|
// 设置结果集
|
|
|
|
|
|
|
|
workBench.setMainWorkBenchEntityList(routes.stream().filter(o->o.getAscriptionUser().contains(user)).collect(Collectors.toList())); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
// 设置结果集
|
|
|
|
|
|
|
|
workBench.setMainWorkBenchEntityList(routes.stream().filter(o->{ |
|
|
|
|
|
|
|
for(String deptId: depts) { |
|
|
|
|
|
|
|
if (o.getRefDept().contains(deptId)) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(workBench.getMainWorkBenchEntityList())){ |
|
|
|
|
|
|
|
workBench.setMainWorkBenchEntityList(routes.stream().filter(o-> StringUtils.isEmpty(o.getAscriptionUser()) && StringUtils.isEmpty(o.getRefDept())).collect(Collectors.toList())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
dustry.setMainWorkBenchExtendVo(workBench); |
|
|
|
|
|
|
|
return dustry; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 用户所属机构分类 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private int userCategory(List<Dept> depts) { |
|
|
|
|
|
|
|
Dept dept = depts.stream().min(Comparator.comparing(Dept::getDeptCategory)).get(); |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(dept)){ |
|
|
|
|
|
|
|
return HomePageConstant.STATION; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return dept.getDeptCategory(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|