|
@@ -2581,7 +2581,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
//获取查询者所在公司每个项目的工时成本
|
|
|
@Override
|
|
|
- public HttpRespMsg getTimeCost(String startDate, String endDate, String userIds,Integer projectId, Integer type,HttpServletRequest request) {
|
|
|
+ public HttpRespMsg getTimeCost(String startDate, String endDate, String userIds,Integer projectId, Integer type,Integer status,HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
//根据系统配置的员工成本计算方式,按固定时薪还是固定月薪,分情况计算。
|
|
@@ -2642,111 +2642,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
String[] split = userIds.split(",");
|
|
|
userIdList = Arrays.asList(split);
|
|
|
}
|
|
|
- List<Map<String, Object>> list = projectMapper.getTimeCost(companyId, startDate, endDate, projectId, userIdList,deptIds,null, deptRelatedProjectIds, projectIds, inchargeUserIds,null);
|
|
|
- BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
|
- for (Map<String, Object> map : list) {
|
|
|
- if (!map.containsKey("cost")) {
|
|
|
- map.put("cost", 0);
|
|
|
- }
|
|
|
- if (!map.containsKey("costMoney")) {
|
|
|
- map.put("costMoney", 0);
|
|
|
- } else {
|
|
|
- totalMoneyCost = totalMoneyCost.add((BigDecimal)map.get("costMoney"));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (type.equals(0)){
|
|
|
- list = list.stream().sorted(Comparator.comparing(l -> -Double.parseDouble(l.get("costMoney").toString()))).collect(Collectors.toList());
|
|
|
- }else {
|
|
|
- list = list.stream().sorted(Comparator.comparing(l -> -Double.parseDouble(l.get("cost").toString()))).collect(Collectors.toList());
|
|
|
- }
|
|
|
- resultMap.put("costList", list);
|
|
|
- resultMap.put("totalMoneyCost", totalMoneyCost);
|
|
|
- if(functionCostList.size()==0){
|
|
|
- resultMap.put("totalCostMoney",new BigDecimal(0));
|
|
|
- list.forEach(li->{
|
|
|
- li.put("costMoney",new BigDecimal(0));
|
|
|
- });
|
|
|
- }
|
|
|
- if(functionTimeList.size()==0){
|
|
|
- list.forEach(li->{
|
|
|
- li.put("cost",0.0);
|
|
|
- });
|
|
|
- }
|
|
|
- httpRespMsg.data = resultMap;
|
|
|
- } catch (NullPointerException e) {
|
|
|
- e.printStackTrace();
|
|
|
- //httpRespMsg.setError("验证失败");
|
|
|
- httpRespMsg.setError(MessageUtils.message("access.verificationError"));
|
|
|
- return httpRespMsg;
|
|
|
- }
|
|
|
-
|
|
|
- return httpRespMsg;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public HttpRespMsg getTimeCostByStatus(String startDate, String endDate, String userIds,Integer status, Integer type,HttpServletRequest request) {
|
|
|
- HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- try {
|
|
|
- //根据系统配置的员工成本计算方式,按固定时薪还是固定月薪,分情况计算。
|
|
|
- User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
|
- Integer companyId = targetUser.getCompanyId();
|
|
|
- Map<String, Object> resultMap = new HashMap<>();
|
|
|
- //当前用户管理部门
|
|
|
- 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(), "查看负责部门");
|
|
|
- List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
|
- List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
|
- List<Integer> deptRelatedProjectIds = new ArrayList<>();
|
|
|
- List<Integer> projectIds = null;
|
|
|
- //针对威派格,部门的主要和其他负责人需要查看部门下人员负责的项目或者项目下的任务分组的工时
|
|
|
- boolean containDeptMembInchargeProjects = targetUser.getCompanyId() == 936;
|
|
|
- List<String> inchargeUserIds = null;
|
|
|
- //判断查看权限
|
|
|
- if(functionAllList.size()==0){
|
|
|
- deptIds=new ArrayList<>();
|
|
|
- deptIds.add(-1);
|
|
|
-
|
|
|
- //获取负责的部门的相关的项目,对于这些项目是有查看全部参与人的权限的
|
|
|
- List<Integer> allMyManagedDeptIds = new ArrayList<>();
|
|
|
- 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);
|
|
|
- allMyManagedDeptIds.addAll(branchDepartment);
|
|
|
- }
|
|
|
- if (allMyManagedDeptIds.size() > 0) {
|
|
|
- List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().select("id").in("dept_id", allMyManagedDeptIds));
|
|
|
- deptRelatedProjectIds = projectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
- }
|
|
|
-
|
|
|
- //有限匹配项目经理的数据视角
|
|
|
- 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());
|
|
|
- deptIds = null;
|
|
|
- } else {
|
|
|
- if(functionDpartList.size()>0){
|
|
|
- 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());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- List<String> userIdList=new ArrayList<>();
|
|
|
- if(userIds!=null&&userIds.length()>0){
|
|
|
- String[] split = userIds.split(",");
|
|
|
- userIdList = Arrays.asList(split);
|
|
|
- }
|
|
|
- List<Map<String, Object>> list = projectMapper.getTimeCostByStatus(companyId, startDate, endDate, status, userIdList,deptIds,null, deptRelatedProjectIds, projectIds, inchargeUserIds,null);
|
|
|
+ List<Map<String, Object>> list = projectMapper.getTimeCost(companyId, startDate, endDate, projectId, userIdList,deptIds,null, deptRelatedProjectIds, projectIds, inchargeUserIds,null,status);
|
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
if (!map.containsKey("cost")) {
|
|
@@ -2938,7 +2834,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//导出查询者所在公司每个项目的工时成本,包括项目人员明细统计
|
|
|
@Override
|
|
|
public HttpRespMsg exportTimeCost(Integer withMainProject, String exportContent,String startDate, String endDate,Integer projectId, String userIds,
|
|
|
- Boolean projectSum,Integer type,Integer deptId, Integer stateKey, Integer withPercent,Integer projectCategoryId, HttpServletRequest request) {
|
|
|
+ Boolean projectSum,Integer type,Integer deptId, Integer stateKey, Integer withPercent,Integer projectCategoryId,Integer status, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
@@ -3019,7 +2915,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
String[] split = userIds.split(",");
|
|
|
userIdList = Arrays.asList(split);
|
|
|
}
|
|
|
- List<Map<String, Object>> list = projectMapper.getTimeCost(companyId, startDate, endDate, projectId, userIdList,deptIds,filterDeptIds,deptRelatedProjectIds, manProjectIds, inchargeUserIds,projectCategoryId);
|
|
|
+ List<Map<String, Object>> list = projectMapper.getTimeCost(companyId, startDate, endDate, projectId, userIdList,deptIds,filterDeptIds,deptRelatedProjectIds, manProjectIds, inchargeUserIds,projectCategoryId,status);
|
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
|
List<List<String>> allList=null ;
|
|
|
List<String> sumRow = null;
|