|
|
@@ -52,19 +52,12 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
|
|
|
private RemoteOrgService remoteOrgService;
|
|
|
|
|
|
@Override
|
|
|
- public TableDataInfo selectPage(SysLearningMaterialsPageDto sysLearningMaterials) {
|
|
|
- Page<SysLearningMaterialsPageVo> page;
|
|
|
- //分页
|
|
|
- if (ObjectUtil.isAllNotEmpty(sysLearningMaterials.getPageNum(), sysLearningMaterials.getPageSize())) {
|
|
|
- page = new Page<>(sysLearningMaterials.getPageNum(), sysLearningMaterials.getPageSize());
|
|
|
- } else {
|
|
|
- page = new Page<>();
|
|
|
- }
|
|
|
- final List<Long> list = dealParentOrgId(sysLearningMaterials.getOrgId(), true);
|
|
|
- sysLearningMaterials.setOrgIdList(list);
|
|
|
- sysLearningMaterials.setUserId(SecurityUtils.getUserId());
|
|
|
- //获取数据
|
|
|
- page = sysLearningMaterialsMapper.selectPageData(page, sysLearningMaterials);
|
|
|
+ public TableDataInfo selectPage(SysLearningMaterialsPageDto request) {
|
|
|
+ final List<Long> list = dealParentOrgId(request, request.getOrgId());
|
|
|
+ request.setOrgIdList(list);
|
|
|
+ request.setUserId(SecurityUtils.getUserId());
|
|
|
+ //获取数据 默认查询当前及上级机构公开,当前用户创建的的数据
|
|
|
+ Page<SysLearningMaterialsPageVo> page = sysLearningMaterialsMapper.selectPageData(request.getPageRequest(), request);
|
|
|
for (SysLearningMaterialsPageVo record : page.getRecords()) {
|
|
|
extractStringFromUrl(record);
|
|
|
}
|
|
|
@@ -77,7 +70,7 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
|
|
|
return tableDataInfo;
|
|
|
}
|
|
|
|
|
|
- private List<Long> dealParentOrgId(Long orgId, Boolean isNeedRemoveSelf) {
|
|
|
+ private List<Long> dealParentOrgId(SysLearningMaterialsPageDto request, Long orgId) {
|
|
|
SysOrg sysOrg = remoteOrgService.selectSysOrgById(orgId, SecurityConstants.INNER);
|
|
|
if (sysOrg == null || ObjectUtil.isEmpty(sysOrg.getPath())) {
|
|
|
throw new RuntimeException("机构不存在或机构信息缺失!");
|
|
|
@@ -85,9 +78,18 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
|
|
|
String[] split = sysOrg.getPath().split("-");
|
|
|
List<Long> list = new ArrayList<>();
|
|
|
Stream.of(split).forEach(s -> list.add(Long.valueOf(s)));
|
|
|
- if (isNeedRemoveSelf) {
|
|
|
- list.remove(orgId);
|
|
|
+ request.setOrgPath(sysOrg.getPath());
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Long> dealParentOrgId(Long orgId) {
|
|
|
+ SysOrg sysOrg = remoteOrgService.selectSysOrgById(orgId, SecurityConstants.INNER);
|
|
|
+ if (sysOrg == null || ObjectUtil.isEmpty(sysOrg.getPath())) {
|
|
|
+ throw new RuntimeException("机构不存在或机构信息缺失!");
|
|
|
}
|
|
|
+ String[] split = sysOrg.getPath().split("-");
|
|
|
+ List<Long> list = new ArrayList<>();
|
|
|
+ Stream.of(split).forEach(s -> list.add(Long.valueOf(s)));
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
@@ -159,7 +161,7 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
|
|
|
/**
|
|
|
* 修改学习资料
|
|
|
*
|
|
|
- * @param sysLearningMaterials 学习资料
|
|
|
+ * @param request 学习资料
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -208,7 +210,7 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
|
|
|
|
|
|
@Override
|
|
|
public TableDataInfo filePageList(SysLearningMaterialsFileListPageDto request) {
|
|
|
- final List<Long> list = dealParentOrgId(request.getOrgId(), false);
|
|
|
+ final List<Long> list = dealParentOrgId(request.getOrgId());
|
|
|
request.setOrgIdList(list);
|
|
|
final IPage<SysLearningMaterialsFileListVo> page = sysLearningMaterialsMapper.selectFilePageList(request.getPageRequest(), request);
|
|
|
final List<SysLearningMaterialsFileListVo> records = page.getRecords();
|
|
|
@@ -226,7 +228,7 @@ public class SysLearningMaterialsServiceImpl extends ServiceImpl<SysLearningMate
|
|
|
IOException {
|
|
|
SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> remoteOrgService.selectOrgById(sysLearningMaterials.getOrgId(), SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
|
|
|
|
|
|
- sysLearningMaterials.setPageSize((long) Integer.MAX_VALUE);
|
|
|
+ sysLearningMaterials.setPageSize(Integer.MAX_VALUE);
|
|
|
final TableDataInfo tableDataInfo = this.selectPage(sysLearningMaterials);
|
|
|
if (ObjectUtil.isEmpty(tableDataInfo.getRows())) {
|
|
|
throw new RuntimeException("导出数据为空!");
|