|
@@ -4795,8 +4795,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
String token = request.getHeader("TOKEN");
|
|
String token = request.getHeader("TOKEN");
|
|
User user = userMapper.selectById(token);
|
|
User user = userMapper.selectById(token);
|
|
Integer companyId = user.getCompanyId();
|
|
Integer companyId = user.getCompanyId();
|
|
- Integer startIndex = (pageIndex-1)*pageSize;
|
|
|
|
- Integer endIndex = pageSize*pageIndex;
|
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全部任务分组工时");
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全部任务分组工时");
|
|
@@ -4818,6 +4816,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<Map<String,Object>> record;
|
|
List<Map<String,Object>> record;
|
|
long total;
|
|
long total;
|
|
if(pageIndex!=null&&pageSize!=null){
|
|
if(pageIndex!=null&&pageSize!=null){
|
|
|
|
+ Integer startIndex = (pageIndex-1)*pageSize;
|
|
|
|
+ Integer endIndex = pageSize*pageIndex;
|
|
record = projectMapper.selectWithGroup(companyId,startDate,endDate, startIndex, endIndex, projectId,inchagerIds,groupId);
|
|
record = projectMapper.selectWithGroup(companyId,startDate,endDate, startIndex, endIndex, projectId,inchagerIds,groupId);
|
|
}else {
|
|
}else {
|
|
record=projectMapper.selectWithGroup(companyId,startDate,endDate, null, null, projectId,inchagerIds,groupId);
|
|
record=projectMapper.selectWithGroup(companyId,startDate,endDate, null, null, projectId,inchagerIds,groupId);
|
|
@@ -4830,6 +4830,82 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg getTimeCostByGroupProject(String startDate, String endDate, Integer pageIndex, Integer pageSize, Integer groupId, Integer projectId, HttpServletRequest request) {
|
|
|
|
+ String token = request.getHeader("TOKEN");
|
|
|
|
+ User user = userMapper.selectById(token);
|
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
|
+ List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全部任务分组工时");
|
|
|
|
+ List<SysRichFunction> functionInchargeList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "负责项目任务分组工时");
|
|
|
|
+ //判断查看权限
|
|
|
|
+ List<Integer> inchagerIds=null;
|
|
|
|
+ if(functionAllList.size()==0){
|
|
|
|
+ inchagerIds=new ArrayList<>();
|
|
|
|
+ if(functionInchargeList.size()>0){
|
|
|
|
+ List<Project> list = projectList.stream().filter(pl -> (pl.getInchargerId()==null?0:pl.getInchargerId()).equals(user.getId())).collect(Collectors.toList());
|
|
|
|
+ if(list!=null){
|
|
|
|
+ List<Integer> collect = list.stream().map(li -> li.getId()).collect(Collectors.toList());
|
|
|
|
+ inchagerIds.addAll(collect);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ inchagerIds.add(-1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<Map<String,Object>> record;
|
|
|
|
+ long total;
|
|
|
|
+ if(pageIndex!=null&&pageSize!=null){
|
|
|
|
+ Integer startIndex = (pageIndex-1)*pageSize;
|
|
|
|
+ Integer endIndex = pageSize*pageIndex;
|
|
|
|
+ record = projectMapper.selectWithGroupProject(companyId,startDate,endDate, startIndex, endIndex, projectId,inchagerIds,groupId);
|
|
|
|
+ }else {
|
|
|
|
+ record=projectMapper.selectWithGroupProject(companyId,startDate,endDate, null, null, projectId,inchagerIds,groupId);
|
|
|
|
+ }
|
|
|
|
+ total =projectMapper.selectCountWithGroupProject(companyId,startDate,endDate, null, null, projectId,inchagerIds,groupId);
|
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("records", record);
|
|
|
|
+ map.put("total", total);
|
|
|
|
+ msg.data = map;
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg exportGroupWithProjectTimeCost(String startDate, String endDate, Integer pageIndex, Integer pageSize, Integer groupId, Integer projectId, HttpServletRequest request) {
|
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
|
+ HttpRespMsg timeCostByGroup = getTimeCostByGroup(startDate, endDate, null, null, groupId, projectId, request);
|
|
|
|
+ HttpRespMsg timeCostByGroupProject = getTimeCostByGroupProject(startDate, endDate, null, null, groupId, projectId, request);
|
|
|
|
+ HashMap<String,Object> timeCostByGroupData = (HashMap<String, Object>) timeCostByGroup.data;
|
|
|
|
+ HashMap<String,Object> timeCostByGroupProjectData = (HashMap<String, Object>) timeCostByGroupProject.data;
|
|
|
|
+ List<Map<String,Object>> timeCostByGroupList= (List<Map<String, Object>>) timeCostByGroupData.get("records");
|
|
|
|
+ List<Map<String,Object>> timeCostByGroupProjectList= (List<Map<String, Object>>) timeCostByGroupProjectData.get("records");
|
|
|
|
+ List<List<String>> sheetOneList = new ArrayList<>();
|
|
|
|
+ List<List<String>> sheetTwoList=new ArrayList<>();
|
|
|
|
+ String[] sheetOneTitles = {"分组名称", "工时"};
|
|
|
|
+ String[] sheetTwoTitles={"项目编号","项目名称","分组名称","工时"};
|
|
|
|
+ sheetOneList.add(Lists.list(sheetOneTitles));
|
|
|
|
+ sheetTwoList.add(Lists.list(sheetTwoTitles));
|
|
|
|
+ for (Map<String, Object> map : timeCostByGroupList) {
|
|
|
|
+ List<String> item=new ArrayList<>();
|
|
|
|
+ item.add(String.valueOf(map.get("groupName")));
|
|
|
|
+ item.add(String.valueOf(map.get("workingTime")));
|
|
|
|
+ sheetOneList.add(item);
|
|
|
|
+ }
|
|
|
|
+ for (Map<String, Object> map : timeCostByGroupProjectList) {
|
|
|
|
+ List<String> item=new ArrayList<>();
|
|
|
|
+ item.add(String.valueOf(map.get("projectCode")));
|
|
|
|
+ item.add(String.valueOf(map.get("projectName")));
|
|
|
|
+ item.add(String.valueOf(map.get("groupName")));
|
|
|
|
+ item.add(String.valueOf(map.get("workingTime")));
|
|
|
|
+ sheetTwoList.add(item);
|
|
|
|
+ }
|
|
|
|
+ String fileName = "任务分组工时统计_"+System.currentTimeMillis();
|
|
|
|
+ /*ExcelUtil.exportGeneralExcelByTitleAndList(fileName, sheetOneList, path);*/
|
|
|
|
+ ExcelUtil.exportTwoSheetGeneralExcelByTitleAndList(fileName,sheetOneList,sheetTwoList,path);
|
|
|
|
+ httpRespMsg.data = pathPrefix + fileName+".xls";
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
private List<Department> getSubDepts(Department dp, List<Department> list) {
|
|
private List<Department> getSubDepts(Department dp, List<Department> list) {
|
|
List<Department> collect = list.stream().filter(l -> dp.getDepartmentId().equals(l.getSuperiorId())).collect(Collectors.toList());
|
|
List<Department> collect = list.stream().filter(l -> dp.getDepartmentId().equals(l.getSuperiorId())).collect(Collectors.toList());
|