diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java index 166eafc..4267005 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java @@ -162,6 +162,7 @@ public class StationEntity extends TenantEntity implements Serializable { private Integer sort; @ApiModelProperty("实时画面绑定账号秘钥") + @TableField(updateStrategy = FieldStrategy.IGNORED) private String secretKey; diff --git a/hzims-service/operational/pom.xml b/hzims-service/operational/pom.xml index 03d3536..ea3b0b7 100644 --- a/hzims-service/operational/pom.xml +++ b/hzims-service/operational/pom.xml @@ -139,7 +139,6 @@ org.springblade blade-user-api - 5.0.1.RELEASE diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainWorkBenchController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainWorkBenchController.java index baa7595..9f5cf5a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainWorkBenchController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainWorkBenchController.java @@ -87,12 +87,19 @@ public class MainWorkBenchController extends BladeController { * 根据用户权限获取路由 * * @return - */ @ApiLog @ApiOperationSupport(order = 50) @ApiOperation("获取路由") @PostMapping("/getHomePageWorkBench") public R getHomePageWorkBench(@Valid @RequestBody RoutingParamVo vo) { return R.data(workBenchService.getHomePageWorkBench(vo)); + }*/ + + @ApiLog + @ApiOperationSupport(order = 60) + @ApiOperation("首页工作台路由") + @PostMapping("/getHomePageWorkBench") + public R homeStagingRoute(@Valid @RequestBody RoutingParamVo vo) { + return R.data(workBenchService.route(vo)); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.java index 173a0cc..76449c6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.java @@ -26,4 +26,6 @@ public interface MainWorkBenchMapper extends UserDataScopeBaseMapper stationTypes,List deptList,@Param("excludeDept") Long excludeDept,@Param("ascriptionUser") Long ascriptionUser); List selectMainWorkBenchByTypes(@Param(value = "type") String type,@Param(value = "refDomains") List refDomains,@Param("refTerminal") String refTerminal,@Param("stationTypes") List stationTypes); + + List stagingRoute(@Param("terminal") String terminal,@Param("types") List types,@Param("category") int category); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml index b5b700f..9d43528 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml @@ -94,5 +94,15 @@ order by ord - + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java index cc9e0cd..f52a203 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java @@ -38,4 +38,5 @@ public interface IMainWorkBenchService extends BaseService InDustryVo getHomePageWorkBench(RoutingParamVo vo); + InDustryVo route(RoutingParamVo vo); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java index f64551f..3ff6723 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java @@ -26,6 +26,7 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.system.entity.Dept; import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.cache.UserCache; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -176,7 +177,7 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl list = this.baseMapper.selectMainWorkBenchByType(deptCategory.toString(), null, vo.getRefTerminal(), stations.stream().map(StationEntity::getType).collect(Collectors.toList()), deptList,dept.getId(),user.getUserId()); + List 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())); if(isDesign){ @@ -187,4 +188,76 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl stations = stationService.list(); + if(CollectionUtil.isEmpty(stations)){ + return new InDustryVo(); + } + List types = stations.stream().map(StationEntity::getType).distinct().collect(Collectors.toList()); + // 用户权限机构 + R> result = sysClient.getDeptByCurrentUser(); + if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ + return new InDustryVo(); + } + // 首页分类 + int category = this.userCategory(result.getData()); + List routes = this.baseMapper.stagingRoute(terminal,types,category); + if(CollectionUtil.isEmpty(routes)){ + return new InDustryVo(); + } + // 所属机构 + List 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 depts) { + Dept dept = depts.stream().min(Comparator.comparing(Dept::getDeptCategory)).get(); + if(ObjectUtil.isEmpty(dept)){ + return HomePageConstant.STATION; + } + return dept.getDeptCategory(); + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index df67928..37d83d0 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -450,7 +450,6 @@ public class StationServiceImpl extends BaseServiceImpl getStationType(Integer serveType, List typeList, List departIdList,boolean make) { return this.list(new LambdaQueryWrapper() {{ - eq(StationEntity::getIsDeleted, 0); if (ObjectUtil.isNotEmpty(serveType)) { eq(StationEntity::getServeType, serveType); }