|
@@ -238,8 +238,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
} else {
|
|
} else {
|
|
if (!sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部项目")) {
|
|
if (!sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部项目")) {
|
|
//只能看本人相关的项目
|
|
//只能看本人相关的项目
|
|
|
|
+ System.out.println("只看本人相关的项目");
|
|
httpRespMsg.data = projectMapper.getParticipatedProject(user.getId(), user.getCompanyId());
|
|
httpRespMsg.data = projectMapper.getParticipatedProject(user.getId(), user.getCompanyId());
|
|
} else {
|
|
} else {
|
|
|
|
+ System.out.println("查看全部项目");
|
|
//有权限的看全部的
|
|
//有权限的看全部的
|
|
httpRespMsg.data = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()).orderByDesc("is_public").orderByAsc("id"));
|
|
httpRespMsg.data = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()).orderByDesc("is_public").orderByAsc("id"));
|
|
}
|
|
}
|
|
@@ -682,28 +684,28 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
operationRecord.setContent(MessageUtils.message("Template.creatProject"));
|
|
operationRecord.setContent(MessageUtils.message("Template.creatProject"));
|
|
operationRecord.setCompanyId(user.getCompanyId());
|
|
operationRecord.setCompanyId(user.getCompanyId());
|
|
operationRecordService.save(operationRecord);
|
|
operationRecordService.save(operationRecord);
|
|
- //随着存在随着项目创建而创建的文件中心模板
|
|
|
|
- List<ProjectDocumentTemplate> templateList = projectDocumentTemplateMapper.selectList(new QueryWrapper<ProjectDocumentTemplate>().eq("company_id", companyId).eq("cre_with_pro", 1));
|
|
|
|
- List<Integer> collect = templateList.stream().map(ProjectDocumentTemplate::getId).distinct().collect(Collectors.toList());
|
|
|
|
- collect.add(-1);
|
|
|
|
- List<ProDocumentTemDetail> proDocumentTemDetailList = proDocumentTemDetailMapper.selectList(new QueryWrapper<ProDocumentTemDetail>().in("template_id", collect));
|
|
|
|
- List<ProDocumentTemDetail> details = proDocumentTemDetailList.stream().filter(p -> p.getParentId() == null).collect(Collectors.toList());
|
|
|
|
- List<ProjectDocument> list=new ArrayList<>();
|
|
|
|
- details.forEach(dl->{
|
|
|
|
- ProjectDocument projectDocument=new ProjectDocument();
|
|
|
|
- projectDocument.setDocumentName(dl.getName());
|
|
|
|
- projectDocument.setLabel(dl.getName());
|
|
|
|
- projectDocument.setIsFolder(1);
|
|
|
|
- projectDocument.setIndate(LocalDateTime.now());
|
|
|
|
- projectDocument.setProjectId(project.getId());
|
|
|
|
- projectDocument.setIsDeleted(0);
|
|
|
|
- projectDocument.setCreatorId(project.getCreatorId());
|
|
|
|
- projectDocument.setCreatorName(user.getName());
|
|
|
|
- projectDocument.setProDocumentTemDetailId(dl.getId());
|
|
|
|
- list.add(projectDocument);
|
|
|
|
- });
|
|
|
|
- projectDocumentService.saveBatch(list);
|
|
|
|
- getParentFolders(list,proDocumentTemDetailList,project,user);
|
|
|
|
|
|
+ //随着存在随着项目创建而创建的文件中心模板:暂时注释掉,等设计好了再打开
|
|
|
|
+// List<ProjectDocumentTemplate> templateList = projectDocumentTemplateMapper.selectList(new QueryWrapper<ProjectDocumentTemplate>().eq("company_id", companyId).eq("cre_with_pro", 1));
|
|
|
|
+// List<Integer> collect = templateList.stream().map(ProjectDocumentTemplate::getId).distinct().collect(Collectors.toList());
|
|
|
|
+// collect.add(-1);
|
|
|
|
+// List<ProDocumentTemDetail> proDocumentTemDetailList = proDocumentTemDetailMapper.selectList(new QueryWrapper<ProDocumentTemDetail>().in("template_id", collect));
|
|
|
|
+// List<ProDocumentTemDetail> details = proDocumentTemDetailList.stream().filter(p -> p.getParentId() == null).collect(Collectors.toList());
|
|
|
|
+// List<ProjectDocument> list=new ArrayList<>();
|
|
|
|
+// details.forEach(dl->{
|
|
|
|
+// ProjectDocument projectDocument=new ProjectDocument();
|
|
|
|
+// projectDocument.setDocumentName(dl.getName());
|
|
|
|
+// projectDocument.setLabel(dl.getName());
|
|
|
|
+// projectDocument.setIsFolder(1);
|
|
|
|
+// projectDocument.setIndate(LocalDateTime.now());
|
|
|
|
+// projectDocument.setProjectId(project.getId());
|
|
|
|
+// projectDocument.setIsDeleted(0);
|
|
|
|
+// projectDocument.setCreatorId(project.getCreatorId());
|
|
|
|
+// projectDocument.setCreatorName(user.getName());
|
|
|
|
+// projectDocument.setProDocumentTemDetailId(dl.getId());
|
|
|
|
+// list.add(projectDocument);
|
|
|
|
+// });
|
|
|
|
+// projectDocumentService.saveBatch(list);
|
|
|
|
+// getParentFolders(list,proDocumentTemDetailList,project,user);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -1176,6 +1178,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
List<Integer> deptRelatedProjectIds = new ArrayList<>();
|
|
List<Integer> deptRelatedProjectIds = new ArrayList<>();
|
|
|
|
+ List<Integer> projectIds = null;
|
|
//判断查看权限
|
|
//判断查看权限
|
|
if(functionAllList.size()==0){
|
|
if(functionAllList.size()==0){
|
|
deptIds=new ArrayList<>();
|
|
deptIds=new ArrayList<>();
|
|
@@ -1199,15 +1202,24 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
if(functionTimeList.size()>0||functionCostList.size()>0){
|
|
if(functionTimeList.size()>0||functionCostList.size()>0){
|
|
deptIds.addAll(allMyManagedDeptIds);
|
|
deptIds.addAll(allMyManagedDeptIds);
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ //担任项目经理的项目
|
|
|
|
+ List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().select("id").eq("incharger_id", targetUser.getId()));
|
|
|
|
+ if (projectList.size() > 0) {
|
|
|
|
+ projectIds = projectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
|
+ } else {
|
|
|
|
+ projectIds = new ArrayList<>();
|
|
|
|
+ projectIds.add(-1);
|
|
|
|
+ }
|
|
|
|
+ deptIds = null;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
List<String> userIdList=new ArrayList<>();
|
|
List<String> userIdList=new ArrayList<>();
|
|
if(userIds!=null&&userIds.length()>0){
|
|
if(userIds!=null&&userIds.length()>0){
|
|
String[] split = userIds.split(",");
|
|
String[] split = userIds.split(",");
|
|
userIdList = Arrays.asList(split);
|
|
userIdList = Arrays.asList(split);
|
|
}
|
|
}
|
|
- List<Map<String, Object>> list = projectMapper.getTimeCost(companyId, startDate, endDate, projectId, userIdList,deptIds,null, deptRelatedProjectIds);
|
|
|
|
|
|
+ List<Map<String, Object>> list = projectMapper.getTimeCost(companyId, startDate, endDate, projectId, userIdList,deptIds,null, deptRelatedProjectIds, projectIds);
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
for (Map<String, Object> map : list) {
|
|
for (Map<String, Object> map : list) {
|
|
if (!map.containsKey("cost")) {
|
|
if (!map.containsKey("cost")) {
|
|
@@ -1268,7 +1280,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
List<Integer> deptRelatedProjectIds = new ArrayList<>();
|
|
List<Integer> deptRelatedProjectIds = new ArrayList<>();
|
|
-
|
|
|
|
|
|
+ List<Integer> manProjectIds = null;
|
|
//判断查看权限
|
|
//判断查看权限
|
|
List<Integer> filterDeptIds=null;
|
|
List<Integer> filterDeptIds=null;
|
|
if(deptId!=null){
|
|
if(deptId!=null){
|
|
@@ -1294,9 +1306,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
if(functionTimeList.size()>0||functionCostList.size()>0){
|
|
if(functionTimeList.size()>0||functionCostList.size()>0){
|
|
deptIds.addAll(allMyManagedDeptIds);
|
|
deptIds.addAll(allMyManagedDeptIds);
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ //担任项目经理的项目
|
|
|
|
+ List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().select("id").eq("incharger_id", targetUser.getId()));
|
|
|
|
+ if (projectList.size() > 0) {
|
|
|
|
+ manProjectIds = projectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
|
+ } else {
|
|
|
|
+ manProjectIds = new ArrayList<>();
|
|
|
|
+ manProjectIds.add(-1);
|
|
|
|
+ }
|
|
|
|
+ deptIds = null;
|
|
}
|
|
}
|
|
//没有查看全公司的权限 只能先判断当前部门/父级别是否在负责部门才能获取数据
|
|
//没有查看全公司的权限 只能先判断当前部门/父级别是否在负责部门才能获取数据
|
|
- if(deptId!=null){
|
|
|
|
|
|
+ if(deptId != null){
|
|
Optional<Department> first = allDepartmentList.stream().filter(ad -> ad.getDepartmentId().equals(deptId)).findFirst();
|
|
Optional<Department> first = allDepartmentList.stream().filter(ad -> ad.getDepartmentId().equals(deptId)).findFirst();
|
|
if(first.isPresent()){
|
|
if(first.isPresent()){
|
|
if(deptIds.contains(first.get().getSuperiorId())||deptIds.contains(deptId)){
|
|
if(deptIds.contains(first.get().getSuperiorId())||deptIds.contains(deptId)){
|
|
@@ -1308,13 +1330,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- System.out.println(filterDeptIds);
|
|
|
|
List<String> userIdList=new ArrayList<>();
|
|
List<String> userIdList=new ArrayList<>();
|
|
if(userIds!=null&&userIds.length()>0){
|
|
if(userIds!=null&&userIds.length()>0){
|
|
String[] split = userIds.split(",");
|
|
String[] split = userIds.split(",");
|
|
userIdList = Arrays.asList(split);
|
|
userIdList = Arrays.asList(split);
|
|
}
|
|
}
|
|
- List<Map<String, Object>> list = projectMapper.getTimeCost(companyId, startDate, endDate, projectId, userIdList,deptIds,filterDeptIds,deptRelatedProjectIds);
|
|
|
|
|
|
+ List<Map<String, Object>> list = projectMapper.getTimeCost(companyId, startDate, endDate, projectId, userIdList,deptIds,filterDeptIds,deptRelatedProjectIds, manProjectIds);
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
List<List<String>> allList=null ;
|
|
List<List<String>> allList=null ;
|
|
List<String> sumRow = null;
|
|
List<String> sumRow = null;
|
|
@@ -6189,6 +6210,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
|
|
List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
|
|
List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
|
|
+ List<Integer> projectIds = null;
|
|
//判断查看权限
|
|
//判断查看权限
|
|
if(functionAllList.size()==0){
|
|
if(functionAllList.size()==0){
|
|
deptIds=new ArrayList<>();
|
|
deptIds=new ArrayList<>();
|
|
@@ -6203,6 +6225,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
deptIds.addAll(branchDepartment);
|
|
deptIds.addAll(branchDepartment);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ //担任项目经理的项目
|
|
|
|
+ List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().select("id").eq("incharger_id", targetUser.getId()));
|
|
|
|
+ if (projectList.size() > 0) {
|
|
|
|
+ projectIds = projectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
|
+ } else {
|
|
|
|
+ projectIds = new ArrayList<>();
|
|
|
|
+ projectIds.add(-1);
|
|
|
|
+ }
|
|
|
|
+ deptIds = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
@@ -6211,7 +6243,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
String[] split = userIds.split(",");
|
|
String[] split = userIds.split(",");
|
|
userIdList = Arrays.asList(split);
|
|
userIdList = Arrays.asList(split);
|
|
}
|
|
}
|
|
- List<Map<String, Object>> list = projectMapper.getTimeCostByCategory(companyId, startDate, endDate, null,userIdList,deptIds);
|
|
|
|
|
|
+ List<Map<String, Object>> list = projectMapper.getTimeCostByCategory(companyId, startDate, endDate, null,userIdList,deptIds, projectIds);
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
for (Map<String, Object> map : list) {
|
|
for (Map<String, Object> map : list) {
|
|
if (!map.containsKey("cost")) {
|
|
if (!map.containsKey("cost")) {
|
|
@@ -6264,6 +6296,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
|
|
List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
|
|
List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
|
|
+ List<Integer> projectIds = null;
|
|
//判断查看权限
|
|
//判断查看权限
|
|
if(functionAllList.size()==0){
|
|
if(functionAllList.size()==0){
|
|
deptIds=new ArrayList<>();
|
|
deptIds=new ArrayList<>();
|
|
@@ -6278,6 +6311,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
deptIds.addAll(branchDepartment);
|
|
deptIds.addAll(branchDepartment);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ //担任项目经理的项目
|
|
|
|
+ List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().select("id").eq("incharger_id", targetUser.getId()));
|
|
|
|
+ if (projectList.size() > 0) {
|
|
|
|
+ projectIds = projectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
|
+ } else {
|
|
|
|
+ projectIds = new ArrayList<>();
|
|
|
|
+ projectIds.add(-1);
|
|
|
|
+ }
|
|
|
|
+ deptIds = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<String> userIdList=new ArrayList<>();
|
|
List<String> userIdList=new ArrayList<>();
|
|
@@ -6285,7 +6328,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
String[] split = userIds.split(",");
|
|
String[] split = userIds.split(",");
|
|
userIdList = Arrays.asList(split);
|
|
userIdList = Arrays.asList(split);
|
|
}
|
|
}
|
|
- List<Map<String, Object>> list = projectMapper.getTimeCostByCategory(companyId, startDate, endDate, projectCategoryId, userIdList,deptIds);
|
|
|
|
|
|
+ List<Map<String, Object>> list = projectMapper.getTimeCostByCategory(companyId, startDate, endDate, projectCategoryId, userIdList,deptIds, projectIds);
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
List<List<String>> allList=null ;
|
|
List<List<String>> allList=null ;
|
|
List<String> sumRow = null;
|
|
List<String> sumRow = null;
|