Browse Source

#首页工作台接口优化

zhongwei
yang_shj 1 year ago
parent
commit
8802450ec9
  1. 1
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationEntity.java
  2. 1
      hzims-service/operational/pom.xml
  3. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainWorkBenchController.java
  4. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.java
  5. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml
  6. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java
  7. 75
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java
  8. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

1
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; private Integer sort;
@ApiModelProperty("实时画面绑定账号秘钥") @ApiModelProperty("实时画面绑定账号秘钥")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private String secretKey; private String secretKey;

1
hzims-service/operational/pom.xml

@ -139,7 +139,6 @@
<dependency> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-user-api</artifactId> <artifactId>blade-user-api</artifactId>
<version>5.0.1.RELEASE</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 --> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency> <dependency>

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/MainWorkBenchController.java

@ -87,12 +87,19 @@ public class MainWorkBenchController extends BladeController {
* 根据用户权限获取路由 * 根据用户权限获取路由
* *
* @return * @return
*/
@ApiLog @ApiLog
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation("获取路由") @ApiOperation("获取路由")
@PostMapping("/getHomePageWorkBench") @PostMapping("/getHomePageWorkBench")
public R<InDustryVo> getHomePageWorkBench(@Valid @RequestBody RoutingParamVo vo) { public R<InDustryVo> getHomePageWorkBench(@Valid @RequestBody RoutingParamVo vo) {
return R.data(workBenchService.getHomePageWorkBench(vo)); return R.data(workBenchService.getHomePageWorkBench(vo));
}*/
@ApiLog
@ApiOperationSupport(order = 60)
@ApiOperation("首页工作台路由")
@PostMapping("/getHomePageWorkBench")
public R<InDustryVo> homeStagingRoute(@Valid @RequestBody RoutingParamVo vo) {
return R.data(workBenchService.route(vo));
} }
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.java

@ -26,4 +26,6 @@ public interface MainWorkBenchMapper extends UserDataScopeBaseMapper<MainWorkBen
@Param("stationTypes") List<Integer> stationTypes,List<Long> deptList,@Param("excludeDept") Long excludeDept,@Param("ascriptionUser") Long ascriptionUser); @Param("stationTypes") List<Integer> stationTypes,List<Long> deptList,@Param("excludeDept") Long excludeDept,@Param("ascriptionUser") Long ascriptionUser);
List<MainWorkBenchEntity> selectMainWorkBenchByTypes(@Param(value = "type") String type,@Param(value = "refDomains") List<Integer> refDomains,@Param("refTerminal") String refTerminal,@Param("stationTypes") List<Integer> stationTypes); List<MainWorkBenchEntity> selectMainWorkBenchByTypes(@Param(value = "type") String type,@Param(value = "refDomains") List<Integer> refDomains,@Param("refTerminal") String refTerminal,@Param("stationTypes") List<Integer> stationTypes);
List<MainWorkBenchEntity> stagingRoute(@Param("terminal") String terminal,@Param("types") List<Integer> types,@Param("category") int category);
} }

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/MainWorkBenchMapper.xml

@ -94,5 +94,15 @@
order by ord order by ord
</select> </select>
<select id="stagingRoute" resultType="com.hnac.hzims.operational.main.entity.MainWorkBenchEntity">
SELECT * FROM HZIMS_MAIN_WORK_BENCH
WHERE IS_DELETED = 0
AND REF_TERMINAL = #{terminal}
AND TYPE = #{category}
AND ENABLE_FLAG = 1
AND STATION_TYPE IN
<foreach collection="types" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper> </mapper>

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainWorkBenchService.java

@ -38,4 +38,5 @@ public interface IMainWorkBenchService extends BaseService<MainWorkBenchEntity>
InDustryVo getHomePageWorkBench(RoutingParamVo vo); InDustryVo getHomePageWorkBench(RoutingParamVo vo);
InDustryVo route(RoutingParamVo vo);
} }

75
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.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();
}
} }

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -450,7 +450,6 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
@Override @Override
public List<StationEntity> getStationType(Integer serveType, List<Integer> typeList, List<Long> departIdList,boolean make) { public List<StationEntity> getStationType(Integer serveType, List<Integer> typeList, List<Long> departIdList,boolean make) {
return this.list(new LambdaQueryWrapper<StationEntity>() {{ return this.list(new LambdaQueryWrapper<StationEntity>() {{
eq(StationEntity::getIsDeleted, 0);
if (ObjectUtil.isNotEmpty(serveType)) { if (ObjectUtil.isNotEmpty(serveType)) {
eq(StationEntity::getServeType, serveType); eq(StationEntity::getServeType, serveType);
} }

Loading…
Cancel
Save