|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
import com.management.platform.entity.*;
|
|
|
+import com.management.platform.entity.Task;
|
|
|
import com.management.platform.entity.vo.*;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.*;
|
|
@@ -1359,6 +1360,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<Integer> manProjectIds = null;
|
|
|
//判断查看权限
|
|
|
List<Integer> filterDeptIds=null;
|
|
|
+ //针对威派格,部门的主要和其他负责人需要查看部门下人员负责的项目或者项目下的任务分组的工时
|
|
|
+ boolean containDeptMembInchargeProjects = targetUser.getCompanyId() == 936;
|
|
|
+ List<String> inchargeUserIds = null;
|
|
|
if(deptId!=null){
|
|
|
filterDeptIds= getBranchDepartment(deptId, allDepartmentList);
|
|
|
}
|
|
@@ -1382,6 +1386,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if(functionTimeList.size()>0||functionCostList.size()>0){
|
|
|
deptIds.addAll(allMyManagedDeptIds);
|
|
|
}
|
|
|
+ if (containDeptMembInchargeProjects && deptIds.size() > 1) {
|
|
|
+ inchargeUserIds = userMapper.selectList(new QueryWrapper<User>().select("id").in("department_id", deptIds)).stream().map(User::getId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
} else {
|
|
|
//担任项目经理的项目
|
|
|
List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().select("id").eq("incharger_id", targetUser.getId()));
|
|
@@ -8211,14 +8218,64 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
public HttpRespMsg getCostByGroup(String startDate, String endDate, Integer projectId, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
- Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
|
+ User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
|
+ Integer companyId = targetUser.getCompanyId();
|
|
|
//首先查看有无浏览权限
|
|
|
- if (!projectMapper.selectById(projectId).getCompanyId().equals(companyId)) {
|
|
|
+ Project project = projectMapper.selectById(projectId);
|
|
|
+ if (!project.getCompanyId().equals(companyId)) {
|
|
|
//httpRespMsg.setError("无权查看其他公司的项目详情");
|
|
|
httpRespMsg.setError(MessageUtils.message("access.otherCompanyProject"));
|
|
|
} else {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
- List<Map<String, Object>> list = projectMapper.getCostByGroup(startDate, endDate, projectId);
|
|
|
+ List<Integer> gpIds = null;
|
|
|
+ if (companyId == 936) {
|
|
|
+ //威派格的工时查看可能是看分组负责人的分组工时,需要过滤筛选
|
|
|
+ //当前用户管理部门
|
|
|
+ List<Integer> deptIds=null;
|
|
|
+ List<Department> allDepartmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",companyId));
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", targetUser.getId()).eq("company_id", companyId));
|
|
|
+ List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", targetUser.getId()));
|
|
|
+ List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看全公司");
|
|
|
+ List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
|
|
|
+ //无查看全公司的权限
|
|
|
+ if (functionAllList.size() == 0) {
|
|
|
+ deptIds = new ArrayList<>();
|
|
|
+ deptIds.add(-1);
|
|
|
+ //有查看负责部门的权限
|
|
|
+ if (functionDpartList.size() > 0) {
|
|
|
+ List<Integer> collect = departmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
+ List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
+ collect.addAll(otherCollect);
|
|
|
+ for (Integer integer : collect) {
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDepartmentList);
|
|
|
+ deptIds.addAll(branchDepartment);
|
|
|
+ }
|
|
|
+ //查找当前项目的负责人
|
|
|
+ if (project.getInchargerId() != null) {
|
|
|
+ Integer departmentId = userMapper.selectById(project.getInchargerId()).getDepartmentId();
|
|
|
+ if (deptIds.contains(departmentId)) {
|
|
|
+ //项目经理是管理的部门下面的人,查看全部分组
|
|
|
+ } else {
|
|
|
+ //检查是否是分组负责人,查看部分分组
|
|
|
+ List<Integer> fDeptIds = deptIds;
|
|
|
+ List<TaskGroup> groupList = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().eq("project_id", project.getId()));
|
|
|
+ gpIds = new ArrayList<>();
|
|
|
+ gpIds.add(-1);
|
|
|
+ for (TaskGroup g : groupList) {
|
|
|
+ if (g.getInchargerId() != null) {
|
|
|
+ Integer departmentId1 = userMapper.selectById(g.getInchargerId()).getDepartmentId();
|
|
|
+ if (fDeptIds.contains(departmentId1)) {
|
|
|
+ //是分组负责人,查看全部
|
|
|
+ gpIds.add(g.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> list = projectMapper.getCostByGroup(startDate, endDate, projectId, gpIds);
|
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
if (!map.containsKey("costMoney")) {
|