|
@@ -1,6 +1,12 @@
|
|
|
package com.jpsoft.railroad.modules.base.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.railroad.modules.base.entity.OaFileRegUserInfo;
|
|
|
+import com.jpsoft.railroad.modules.base.entity.Organization;
|
|
|
+import com.jpsoft.railroad.modules.base.entity.RegUser;
|
|
|
+import com.jpsoft.railroad.modules.base.service.OaFileRegUserInfoService;
|
|
|
+import com.jpsoft.railroad.modules.base.service.OrganizationService;
|
|
|
+import com.jpsoft.railroad.modules.base.service.RegUserService;
|
|
|
import com.jpsoft.railroad.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.railroad.modules.common.dto.Sort;
|
|
|
import com.jpsoft.railroad.modules.common.dto.MessageResult;
|
|
@@ -30,9 +36,18 @@ public class OaFileInfoController {
|
|
|
@Autowired
|
|
|
private OaFileInfoService oaFileInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OaFileRegUserInfoService oaFileRegUserInfoService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RegUserService regUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OrganizationService organizationService;
|
|
|
+
|
|
|
|
|
|
@ApiOperation(value = "创建空记录")
|
|
|
@GetMapping("create")
|
|
@@ -262,17 +277,51 @@ public class OaFileInfoController {
|
|
|
//当前用户ID
|
|
|
System.out.println(subject);
|
|
|
|
|
|
+ User curUser = userService.get(subject);
|
|
|
+
|
|
|
MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
Map<String, Object> searchParams = new HashMap<>();
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("create_time", "desc"));
|
|
|
+ sortList.add(new Sort("upload_time", "desc"));
|
|
|
|
|
|
if (StringUtils.isNotEmpty(name)) {
|
|
|
searchParams.put("name", "%" + name + "%");
|
|
|
}
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(subject)) {
|
|
|
+ searchParams.put("createBy", subject);
|
|
|
+
|
|
|
+ if (curUser != null) {
|
|
|
+ if (StringUtils.isNotEmpty(curUser.getPhone())) {
|
|
|
+ RegUser regUser = regUserService.findByPhone(curUser.getPhone());
|
|
|
+ if (regUser != null) {
|
|
|
+ //个人查看文件
|
|
|
+ List<OaFileRegUserInfo> oaFileRegUserInfoList = oaFileRegUserInfoService.findRelationByRegId(regUser.getId(), "2");
|
|
|
+ searchParams.put("oaFileRegUserInfoList", oaFileRegUserInfoList);
|
|
|
+
|
|
|
+ //部门查看文件
|
|
|
+ List<String> orgIdList = new ArrayList<>();
|
|
|
+ String orgId = regUser.getOrgId();
|
|
|
+ orgIdList.add(orgId);
|
|
|
+ Organization organization = organizationService.get(orgId);
|
|
|
+ while (StringUtils.isNotEmpty(organization.getParentId())) {
|
|
|
+ Organization parentItem = organizationService.get(organization.getParentId());
|
|
|
+ if (parentItem != null) {
|
|
|
+ orgIdList.add(parentItem.getId());
|
|
|
+ }
|
|
|
+ organization = parentItem;
|
|
|
+ }
|
|
|
+ List<OaFileRegUserInfo> oaFileOrgList = oaFileRegUserInfoService.findRelationByOrgs(orgIdList, "1");
|
|
|
+ if (oaFileRegUserInfoList.size() > 0) {
|
|
|
+ searchParams.put("oaFileOrgList", oaFileOrgList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
Page<OaFileInfo> page = oaFileInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
|
|
@@ -298,6 +347,12 @@ public class OaFileInfoController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ boolean isSelf = false;
|
|
|
+ if (oaFileInfo.getCreateBy().equals(subject)) {
|
|
|
+ isSelf = true;
|
|
|
+ }
|
|
|
+ oaFileInfo.setIsSelf(isSelf);
|
|
|
}
|
|
|
|
|
|
|