|
@@ -201,6 +201,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部项目");
|
|
|
//判断用户的角色,如果是管理员和负责人,查看全部的。如果是普通员工,只能是看到参与的项目
|
|
|
QueryWrapper<Project> queryWrapper = null;
|
|
|
+ List<Department> allDepartmentList=departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",companyId));
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", user.getId()).eq("company_id", companyId));
|
|
|
+ List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
|
|
|
+ List<Integer> deptIds=new ArrayList<>();
|
|
|
+ List<Integer> theCollect = departmentList.stream().distinct().map(dm -> dm.getDepartmentId()).collect(Collectors.toList());
|
|
|
+ List<Integer> otherCollect = departmentOtherManagerList.stream().distinct().map(dom -> dom.getDepartmentId()).collect(Collectors.toList());
|
|
|
+ theCollect.addAll(otherCollect);
|
|
|
+ for (Integer integer : theCollect) {
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDepartmentList);
|
|
|
+ deptIds.addAll(branchDepartment);
|
|
|
+ }
|
|
|
+ //本人所在部门
|
|
|
+ deptIds.add(user.getDepartmentId());
|
|
|
if (functionList.size() == 0) {
|
|
|
//普通员工
|
|
|
List<Participation> pList = participationMapper.selectList(new QueryWrapper<Participation>().eq("user_id", user.getId()));
|
|
@@ -212,7 +225,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
final List<Integer> ids = projectIds;
|
|
|
queryWrapper = new QueryWrapper<Project>();
|
|
|
- queryWrapper.and(wrapper->wrapper.in("id", ids).or().eq("creator_id", user.getId()).or().eq("is_public", 1).eq("company_id", companyId));
|
|
|
+ if(deptIds.isEmpty()||deptIds.size()==0){
|
|
|
+ deptIds.add(-1);
|
|
|
+ }
|
|
|
+ queryWrapper.and(wrapper->wrapper.in("id",ids).or().in("dept_id",deptIds).or().eq("creator_id", user.getId()).or().eq("is_public", 1).eq("company_id", companyId));
|
|
|
} else {
|
|
|
queryWrapper = new QueryWrapper<Project>().eq("company_id", companyId);
|
|
|
}
|
|
@@ -279,6 +295,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
}
|
|
|
BeanUtils.copyProperties(project, projectVO);
|
|
|
+ Optional<Department> optional = allDepartmentList.stream().filter(ad -> ad.getDepartmentId().equals(projectVO.getDeptId())).findFirst();
|
|
|
+ if(optional.isPresent()){
|
|
|
+ projectVO.setDepartmentName(optional.get().getDepartmentName());
|
|
|
+ }
|
|
|
projectVO.setParticipator(participationMapper.getParticipator(projectVO.getId()));
|
|
|
Optional<User> first = userList.stream().filter(u -> u.getId().equals(project.getInchargerId())).findFirst();
|
|
|
if (first.isPresent()) {
|
|
@@ -370,7 +390,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
String providerIds,
|
|
|
String providerNames,
|
|
|
HttpServletRequest request,
|
|
|
- ProjectSeparate projectSeparate,Double outputValue,boolean onlyChangeParticipate) {
|
|
|
+ ProjectSeparate projectSeparate,Double outputValue,Integer deptId,boolean onlyChangeParticipate) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId = user.getCompanyId();
|
|
@@ -427,6 +447,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
.setProjectMainId(projectMainId)
|
|
|
.setTaskGpIncharge(taskGpIncharge)
|
|
|
.setProviderIds(providerIds)
|
|
|
+ .setDeptId(deptId)
|
|
|
.setProviderNames(providerNames);
|
|
|
if(timeType.getOutputValueStatus()==1){
|
|
|
project.setOutputValue(outputValue==null?0.00:outputValue);
|
|
@@ -509,6 +530,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
.setProjectMainId(projectMainId)
|
|
|
.setTaskGpIncharge(taskGpIncharge)
|
|
|
.setProviderIds(providerIds)
|
|
|
+ .setDeptId(deptId)
|
|
|
.setProviderNames(providerNames);
|
|
|
if(timeType.getOutputValueStatus()==1){
|
|
|
p.setOutputValue(outputValue==null?0.00:outputValue);
|
|
@@ -1175,14 +1197,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
@Override
|
|
|
public HttpRespMsg detail(Integer id, HttpServletRequest request) {
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
Project project = projectMapper.selectById(id);
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
if (project.getInchargerId() != null) {
|
|
|
User incharger = userMapper.selectById(project.getInchargerId());
|
|
|
if (incharger != null) {
|
|
|
project.setInchargerName(incharger.getName());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ Optional<Department> first = departmentList.stream().filter(dt -> dt.getDepartmentId().equals(project.getDeptId())).findFirst();
|
|
|
+ if(first.isPresent()){
|
|
|
+ project.setDepartmentName(first.get().getDepartmentName());
|
|
|
+ }
|
|
|
//项目参与人
|
|
|
List<Map<String, Object>> participator = participationMapper.getParticipator(id);
|
|
|
project.setParticipationList(participator);
|
|
@@ -4584,8 +4611,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
size=null;
|
|
|
start=null;
|
|
|
}
|
|
|
- List<Map<String,Object>> list=projectMapper.getWaitingReviewList(user.getCompanyId(),userId,start,size,startDate,endDate,departmentId);
|
|
|
- long total=projectMapper.findCount(user.getCompanyId(),userId,null,null,startDate,endDate,departmentId);
|
|
|
+ List<Map<String,Object>> list=projectMapper.getWaitingReviewList(stateKey,user.getCompanyId(),userId,start,size,startDate,endDate,departmentId);
|
|
|
+ long total=projectMapper.findCount(stateKey,user.getCompanyId(),userId,null,null,startDate,endDate,departmentId);
|
|
|
HashMap map=new HashMap();
|
|
|
map.put("total",total);
|
|
|
map.put("result",list);
|