|
@@ -13537,10 +13537,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
User targetUser = userMapper.selectById(request.getHeader("token"));
|
|
|
List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "全部部门FTE报表");
|
|
|
List<SysRichFunction> functionDeptList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "负责部门FTE报表");
|
|
|
+ List<SysRichFunction> functionProjectList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "负责项目FTE报表");
|
|
|
+
|
|
|
List<Integer> deptIds=null;
|
|
|
List<Department> allDepartmentList=departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",targetUser.getCompanyId()));
|
|
|
List<Department> userDepartmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", targetUser.getId()).eq("company_id",targetUser.getCompanyId()));
|
|
|
List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", targetUser.getId()));
|
|
|
+ boolean onlyInchargeProject = false;
|
|
|
//判断查看权限
|
|
|
if(functionAllList.size()==0){
|
|
|
deptIds=new ArrayList<>();
|
|
@@ -13554,9 +13557,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<Integer> branchDepartment = getBranchDepartment(integer, allDepartmentList);
|
|
|
deptIds.addAll(branchDepartment);
|
|
|
}
|
|
|
+ } else if (functionProjectList.size() > 0){
|
|
|
+ //无任何权限,按项目经理的权限查看
|
|
|
+ onlyInchargeProject = true;
|
|
|
+ deptIds = null;
|
|
|
+ System.out.println("无任何权限,按项目经理的权限查看");
|
|
|
}
|
|
|
}
|
|
|
- if(departmentId!=null){
|
|
|
+ if(departmentId!=null && !onlyInchargeProject){
|
|
|
deptIds=new ArrayList<>();
|
|
|
List<Integer> branchDepartment = getBranchDepartment(departmentId, allDepartmentList);
|
|
|
deptIds.addAll(branchDepartment);
|
|
@@ -13575,10 +13583,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if(pageIndex!=null&&pageSize!=null){
|
|
|
Integer size=pageSize;
|
|
|
Integer start=(pageIndex-1)*size;
|
|
|
- resultList=projectMapper.getFTEData(targetUser.getCompanyId(),startDate,endDate,start,size,area,userId,sortProp,sortOrder,null,deptIds,departmentId);
|
|
|
- total=projectMapper.getFTEData(targetUser.getCompanyId(),startDate,endDate,null,null,area,userId,sortProp,sortOrder,null,deptIds,departmentId).size();
|
|
|
+ System.out.println("开始查询数据======"+start);
|
|
|
+ resultList=projectMapper.getFTEData(targetUser.getCompanyId(),startDate,endDate,start,size,area,userId,sortProp,sortOrder,null,deptIds,departmentId, onlyInchargeProject, targetUser.getId());
|
|
|
+ total=projectMapper.getFTEDataCount(targetUser.getCompanyId(),startDate,endDate,null,null,area,userId,sortProp,sortOrder,null,deptIds,departmentId, onlyInchargeProject, targetUser.getId());
|
|
|
}else{
|
|
|
- resultList=projectMapper.getFTEData(targetUser.getCompanyId(),startDate,endDate,null,null,area,userId,sortProp,sortOrder,null,deptIds,departmentId);
|
|
|
+ resultList=projectMapper.getFTEData(targetUser.getCompanyId(),startDate,endDate,null,null,area,userId,sortProp,sortOrder,null,deptIds,departmentId, onlyInchargeProject, targetUser.getId());
|
|
|
}
|
|
|
//固定月工时数 163.125
|
|
|
double regularMonthTime=163.125;
|
|
@@ -13760,12 +13769,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
titleList.add("审核状态");
|
|
|
dataList.add(titleList);
|
|
|
|
|
|
+ String lastUserId = null;
|
|
|
+ int lastUserDays = 0;
|
|
|
+ String lastUserName = null;
|
|
|
+ String lastUserDeptName = null;
|
|
|
+ String lastUserPosition = null;
|
|
|
+ double planHoursSum = 0.0;
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
List<String> item=new ArrayList<>();
|
|
|
item.add((i+1)+"");
|
|
|
Map<String, Object> map = list.get(i);
|
|
|
- Integer taskId= (Integer) map.get("id");
|
|
|
+ Integer taskId = (Integer) map.get("id");
|
|
|
String userIdStr= (String) map.get("userId");
|
|
|
+
|
|
|
Integer departmentIdStr= Math.toIntExact((Long) map.get("departmentId"));
|
|
|
Optional<Department> deptFirst = allDepartmentList.stream().filter(f -> f.getDepartmentId().equals(departmentIdStr)).findFirst();
|
|
|
String dateStr=map.get("startDate")+"-"+map.get("endDate");
|
|
@@ -13773,37 +13789,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
double planHours = (double)map.get("planHours");
|
|
|
int dayCount = (int)(planHours/7.5) + (planHours%7.5>0?1:0);
|
|
|
item.add(dayCount+"天");//天数
|
|
|
-
|
|
|
//所属部门
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
- if(!deptFirst.isPresent()){
|
|
|
- item.add("未分配");
|
|
|
- }else {
|
|
|
- item.add(departmentService.exportWxDepartment(deptFirst.get(),allDepartmentList));
|
|
|
- }
|
|
|
- }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
- if(!deptFirst.isPresent()){
|
|
|
- item.add("未分配");
|
|
|
- }else {
|
|
|
- item.add(departmentService.exportDdDepartment(deptFirst.get(),allDepartmentList));
|
|
|
- }
|
|
|
- }else {
|
|
|
- item.add(departmentService.getSupDepartment(deptFirst.get(),allDepartmentList));
|
|
|
- }
|
|
|
-
|
|
|
+ String departmentName = departmentService.getSupDepartment(deptFirst.get(),allDepartmentList);
|
|
|
+ item.add(departmentName);
|
|
|
//岗位
|
|
|
- item.add(list.get(i).get("roleName")==null?"":list.get(i).get("roleName").toString());
|
|
|
+ String position = list.get(i).get("roleName")==null?"":list.get(i).get("roleName").toString();
|
|
|
+ item.add(position);
|
|
|
//姓名
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
- item.add((String)("$userName="+map.get("corpwxUserId")+"$"));
|
|
|
-
|
|
|
- }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
- item.add((String)("$userName="+map.get("userName")+"$"));
|
|
|
-
|
|
|
- }else {
|
|
|
- item.add((String)map.get("userName"));
|
|
|
- }
|
|
|
-
|
|
|
+ String userName = (String)map.get("userName");
|
|
|
+ item.add(userName);
|
|
|
Integer taskPlanType= (Integer) map.get("taskPlanType");
|
|
|
Optional<TaskType> typeOptional = taskTypeList.stream().filter(t -> t.getId().equals(taskPlanType)).findFirst();
|
|
|
item.add(typeOptional.isPresent()?typeOptional.get().getName():""); //工作计划类型
|
|
@@ -13891,6 +13885,50 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
}
|
|
|
dataList.add(item);
|
|
|
+ if (i == 0 || !userIdStr.equals(lastUserId)) {
|
|
|
+ //重置数据
|
|
|
+ lastUserId = userIdStr;
|
|
|
+ lastUserDays = dayCount;
|
|
|
+ planHoursSum = planHours;
|
|
|
+ lastUserName = userName;
|
|
|
+ lastUserDeptName = departmentName;
|
|
|
+ lastUserPosition = position;
|
|
|
+ } else {
|
|
|
+ //累加
|
|
|
+ lastUserDays += dayCount;
|
|
|
+ planHoursSum += planHours;
|
|
|
+ }
|
|
|
+ //判断是否要加上合计的数据
|
|
|
+ if (i == list.size() - 1 || !((String)list.get(i + 1).get("userId")).equals(userIdStr)) {
|
|
|
+ List<String> itemSum = new ArrayList<>();
|
|
|
+ itemSum.add("合计");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add(lastUserDays + "天");
|
|
|
+ itemSum.add(lastUserDeptName);
|
|
|
+ itemSum.add(lastUserPosition);
|
|
|
+ itemSum.add(lastUserName);
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add("");
|
|
|
+ itemSum.add(new BigDecimal(planHoursSum).setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
+ itemSum.add(new BigDecimal(planHoursSum)
|
|
|
+ .divide(
|
|
|
+ BigDecimal.valueOf(monthTime),
|
|
|
+ 2, // 保留2位小数
|
|
|
+ RoundingMode.HALF_UP // 四舍五入
|
|
|
+ )
|
|
|
+ .toString());
|
|
|
+ itemSum.add("");
|
|
|
+ dataList.add(itemSum);
|
|
|
+ }
|
|
|
}
|
|
|
String fileName = "FTE计划报表"+System.currentTimeMillis();
|
|
|
try {
|