|
@@ -1707,8 +1707,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<Project> projectList = projectMapper.selectList(queryWrapper);
|
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
List<ProjectVO> list = new ArrayList<>();
|
|
|
- //String[] statusNames = {"-","进行中","已完成","已撤销"};
|
|
|
- String[] statusNames = {"-",MessageUtils.message("excel.onGoing"),MessageUtils.message("excel.complete"),MessageUtils.message("excel.revoke")};
|
|
|
+ //String[] statusNames = {"-","进行中","已完成","已撤销","暂停"};
|
|
|
+ String[] statusNames = {"-",MessageUtils.message("excel.onGoing"),MessageUtils.message("excel.complete"),MessageUtils.message("excel.revoke"),MessageUtils.message("excel.pause")};
|
|
|
List<List<String>> exportList = new ArrayList<>();
|
|
|
//String[] titles = {"项目编号", "项目名称", "负责人", "项目金额(元)", "状态","计划开始时间", "计划结束时间", "完成度"};
|
|
|
String[] titles = {MessageUtils.message("entry.projectId"), MessageUtils.message("entry.projectName"), MessageUtils.message("excel.charge"), MessageUtils.message("excel.projectAmount")+"(元)", MessageUtils.message("leave.status"),MessageUtils.message("excel.planStart"), MessageUtils.message("excel.planEnd"), MessageUtils.message("excel.degree")};
|
|
@@ -7502,4 +7502,119 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ //部门参与项目情况表
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg deptPartInProjects(Integer pageIndex, Integer pageSize, String startDate,String endDate, Integer departmentId, HttpServletRequest request){
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
+ List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(),"全部部门参与项目情况表");
|
|
|
+ List<SysRichFunction> functionDeptList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "负责部门参与项目情况表");
|
|
|
+ List<Integer> deptIds=null;
|
|
|
+ //查询公司所有部门
|
|
|
+ List<Department> allDepartmentList=departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",user.getCompanyId()));
|
|
|
+ //查询所管理的部门
|
|
|
+ List<Department> userDepartmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", user.getId()).eq("company_id",user.getCompanyId()));
|
|
|
+ List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
|
|
|
+ //判断查看权限
|
|
|
+ if(functionAllList.size()==0){
|
|
|
+ deptIds=new ArrayList<>();
|
|
|
+ deptIds.add(-1);
|
|
|
+ if(functionDeptList.size()>0){
|
|
|
+ //获取管理的部门id
|
|
|
+ List<Integer> collect = userDepartmentList.stream().distinct().map(dm -> dm.getDepartmentId()).collect(Collectors.toList());
|
|
|
+ List<Integer> otherCollect = departmentOtherManagerList.stream().distinct().map(dom -> dom.getDepartmentId()).collect(Collectors.toList());
|
|
|
+ collect.addAll(otherCollect);
|
|
|
+ //将该用户管理的所有部门以及部门的子部门id添加到deptIds集合中
|
|
|
+ for (Integer integer : collect) {
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDepartmentList);
|
|
|
+ deptIds.addAll(branchDepartment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ long total = 0;
|
|
|
+ List<Map<String,Object>> resultList = null;
|
|
|
+ List<Integer> branchDepartment =null;
|
|
|
+ //若用户传入departmentId参数,则查询该部门所有子部门,添加到branchDepartment集合中
|
|
|
+ if(departmentId!=null){
|
|
|
+ branchDepartment = getBranchDepartment(departmentId, allDepartmentList);
|
|
|
+ }
|
|
|
+ //分页查询数据
|
|
|
+ if(pageIndex!=null&&pageSize!=null){
|
|
|
+ Integer size=pageSize;
|
|
|
+ Integer start=(pageIndex-1)*size;
|
|
|
+ resultList = projectMapper.selectDeptPartInProjects(size, start, startDate, endDate, user.getCompanyId(), branchDepartment, deptIds);
|
|
|
+ List<Map<String, Object>> maps = projectMapper.selectDeptPartInProjects(null, null, startDate, endDate, user.getCompanyId(), branchDepartment, deptIds);
|
|
|
+ total = maps.size();
|
|
|
+ }else{
|
|
|
+ resultList = projectMapper.selectDeptPartInProjects(null, null, startDate, endDate, user.getCompanyId(), branchDepartment, deptIds);
|
|
|
+ List<Map<String, Object>> maps = projectMapper.selectDeptPartInProjects(null,null,startDate,endDate,user.getCompanyId(),branchDepartment,deptIds);
|
|
|
+ total = maps.size();
|
|
|
+ }
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
+ if (resultList.size() > 0){
|
|
|
+ for (Map<String, Object> stringObjectMap : resultList) {
|
|
|
+ Department department = departmentMapper.selectById(stringObjectMap.get("departmentId").toString());
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ stringObjectMap.put("deptName",getWxDepartment(department));
|
|
|
+ }else {
|
|
|
+ stringObjectMap.put("deptName",getSupDepartment(department));
|
|
|
+ }
|
|
|
+ if (stringObjectMap.get("projectCount")==null){
|
|
|
+ stringObjectMap.put("projectCount",0);
|
|
|
+ }
|
|
|
+ if (stringObjectMap.get("tripCount")==null){
|
|
|
+ stringObjectMap.put("tripCount",0);
|
|
|
+ }
|
|
|
+ if (stringObjectMap.get("peopleCount")==null){
|
|
|
+ stringObjectMap.put("peopleCount",0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ HashMap<String, Object> result = new HashMap<>();
|
|
|
+ result.put("resultList",resultList);
|
|
|
+ result.put("total",total);
|
|
|
+ httpRespMsg.data = result;
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
+
|
|
|
+ //导出员工月度工时表
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg exportDeptPartInProjects(String startDate,String endDate, Integer departmentId, HttpServletRequest request){
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
+ String token = request.getHeader("token");
|
|
|
+ User user = userMapper.selectById(token);
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
+ HttpRespMsg httpRespMsg = deptPartInProjects(null, null, startDate, endDate, departmentId, request);
|
|
|
+ Map<String, Object> data = (Map<String, Object>) (Map<String, Object>) httpRespMsg.data;
|
|
|
+ List<Map<String, Object>> resultList = (List<Map<String, Object>>) data.get("resultList");
|
|
|
+ List<String> titleList=new ArrayList<>();
|
|
|
+ List<List<String>> dataList = new ArrayList<>();
|
|
|
+// titleList.add("部门名称");
|
|
|
+// titleList.add("参与的项目的数量");
|
|
|
+// titleList.add("参与人次");
|
|
|
+// titleList.add("出差的天数");
|
|
|
+ titleList.add(MessageUtils.message("excel.deptName"));
|
|
|
+ titleList.add(MessageUtils.message("excel.joinProCount"));
|
|
|
+ titleList.add(MessageUtils.message("excel.joinPeopleCount"));
|
|
|
+ titleList.add(MessageUtils.message("excel.tripDays"));
|
|
|
+ dataList.add(titleList);
|
|
|
+ for (Map<String, Object> map : resultList) {
|
|
|
+ List<String> item=new ArrayList<>();
|
|
|
+ item.add(map.get("deptName").toString());
|
|
|
+ item.add(map.get("projectCount").toString());
|
|
|
+ item.add(map.get("peopleCount").toString());
|
|
|
+ item.add(map.get("tripCount").toString());
|
|
|
+ dataList.add(item);
|
|
|
+ }
|
|
|
+ //生成excel文件导出
|
|
|
+ //String fileName = "部门参与项目情况表"+System.currentTimeMillis();
|
|
|
+ String fileName = MessageUtils.message("fileName.deptJoinPro")+System.currentTimeMillis();
|
|
|
+ try {
|
|
|
+ return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
}
|