|
@@ -2737,7 +2737,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg getOvertimeList(String userId, Integer projectId, String startDate, String endDate, HttpServletRequest request,Integer departmentId) {
|
|
|
+ public HttpRespMsg getOvertimeList(OvertimeListVO overtimeListVO) {
|
|
|
+ Integer projectId = overtimeListVO.getProjectId();
|
|
|
+ String startDate = overtimeListVO.getStartDate();
|
|
|
+ String endDate = overtimeListVO.getEndDate();
|
|
|
+ String userId = overtimeListVO.getUserId();
|
|
|
+ Integer[] deptId = overtimeListVO.getDepartmentId();
|
|
|
+ ArrayList<Integer> departmentId = null;
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
User user = userMapper.selectById(token);
|
|
@@ -2762,8 +2768,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
}
|
|
|
List<Integer> branchDepartment =null;
|
|
|
- if(departmentId!=null){
|
|
|
- branchDepartment = getBranchDepartment(departmentId, allDepartmentList);
|
|
|
+ if(deptId!=null){
|
|
|
+ departmentId = new ArrayList<>(Arrays.asList(deptId));
|
|
|
+ branchDepartment = new ArrayList<>();
|
|
|
+ for (Integer dept : departmentId) {
|
|
|
+ branchDepartment.addAll(getBranchDepartment(dept, allDepartmentList));
|
|
|
+ }
|
|
|
}
|
|
|
List<Map<String, Object>> list = projectMapper.getOvertimeDetail(userId, user.getCompanyId(), startDate, endDate, projectId,branchDepartment,deptIds);
|
|
|
boolean hasViewSalary = sysFunctionService.hasPriviledge(user.getRoleId(), "查看加班成本");
|
|
@@ -2780,8 +2790,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg exportOvertimeList(String userId, Integer projectId, String startDate, String endDate, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg exportOvertimeList(OvertimeListVO overtimeListVO, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ String userId = overtimeListVO.getUserId();
|
|
|
+ String startDate = overtimeListVO.getStartDate();
|
|
|
+ String endDate = overtimeListVO.getEndDate();
|
|
|
+ Integer projectId = overtimeListVO.getProjectId();
|
|
|
+ Integer[] deptId = overtimeListVO.getDepartmentId();
|
|
|
try {
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
User user = userMapper.selectById(token);
|
|
@@ -2807,7 +2822,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<Map<String, Object>> list = projectMapper.getOvertimeDetail(userId, user.getCompanyId(), startDate, endDate, projectId,null,deptIds);
|
|
|
+ List<Integer> branchDepartment =null;
|
|
|
+ if(deptId!=null){
|
|
|
+ ArrayList<Integer> departmentId = new ArrayList<>(Arrays.asList(deptId));
|
|
|
+ branchDepartment = new ArrayList<>();
|
|
|
+ for (Integer dept : departmentId) {
|
|
|
+ branchDepartment.addAll(getBranchDepartment(dept, allDepartmentList));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> list = projectMapper.getOvertimeDetail(userId, user.getCompanyId(), startDate, endDate, projectId,branchDepartment,deptIds);
|
|
|
boolean hasViewSalary = sysFunctionService.hasPriviledge(user.getRoleId(), "查看加班成本");
|
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
|
List<String> headList = new ArrayList<String>();
|
|
@@ -7543,6 +7566,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", targetUser.getCompanyId()));
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ for (Map<String, Object> map : resultList) {
|
|
|
+ map.put("name","$userName="+(map.get("corwxUserId")==null?"":map.get("corwxUserId"))+"$");
|
|
|
+ }
|
|
|
+ }
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
map.put("result",resultList);
|
|
|
map.put("total",total);
|
|
@@ -7580,7 +7609,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
for (Map<String, Object> map : resultList) {
|
|
|
List<String> item=new ArrayList<>();
|
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
- item.add("$userName="+(map.get("corwxUserId")==null?"":map.get("corwxUserId"))+"$");
|
|
|
+ item.add((String) map.get("name"));
|
|
|
item.add("$deprtmentName="+(map.get("corpwxDeptId")==null?"":map.get("corpwxDeptId"))+"$");
|
|
|
}else {
|
|
|
item.add((String) map.get("name"));
|
|
@@ -7614,7 +7643,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
//递归获取所有子部门
|
|
|
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());
|
|
|
List<Department> allList = new ArrayList<>();
|
|
|
allList.addAll(collect);
|
|
|
if (collect.size() > 0) {
|
|
@@ -7718,10 +7747,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
int dayCount = Integer.parseInt(businessTrip.get("dayCount").toString());
|
|
|
businessTrip.put("dayCount",dayCount-day);
|
|
|
}
|
|
|
- System.err.println(stringObjectMap.get("deptId"));
|
|
|
- System.err.print(tripStart);
|
|
|
- System.err.println(tripEnd);
|
|
|
- System.err.println(businessTrip.get("dayCount"));
|
|
|
}
|
|
|
Integer dayCount = businessTrips.stream().collect(Collectors.summingInt((b) -> Integer.parseInt(b.get("dayCount").toString())));
|
|
|
stringObjectMap.put("tripCount",dayCount==null?0:dayCount);
|
|
@@ -7742,7 +7767,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
- //导出员工月度工时表
|
|
|
+ //导出部门参与项目情况表
|
|
|
@Override
|
|
|
public HttpRespMsg exportDeptPartInProjects(String month, Integer departmentId, HttpServletRequest request){
|
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
@@ -7796,6 +7821,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
String startDate=null;
|
|
|
String endDate=null;
|
|
@@ -7828,40 +7854,76 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
break;
|
|
|
}
|
|
|
HttpRespMsg msg = getUserReportTimelinessRate(request, startDate, endDate, null, null, null, null);
|
|
|
+ List<Map<String,Object>> dataDetailList=new ArrayList<>();
|
|
|
try {
|
|
|
List<String> monthList = SplitDateUtil.doDateByStatisticsType("month", startDate, endDate);
|
|
|
for (int i = 0; i < monthList.size(); i++) {
|
|
|
String sDate = monthList.get(i);
|
|
|
String eDate = monthList.get(i + 1);
|
|
|
i++;
|
|
|
+ Map<String,Object> itemMap=new HashMap<>();
|
|
|
List<String> weekList = SplitDateUtil.doDateByStatisticsType("week", sDate, eDate);
|
|
|
+ List<Map<String,Object>> itemList=new ArrayList<>();
|
|
|
+ int a=1;
|
|
|
for (int i1 = 0; i1 < weekList.size(); i1++) {
|
|
|
String sDate1 = weekList.get(i1);
|
|
|
String eDate1 = weekList.get(i1 + 1);
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ map.put("startDate",sDate1);
|
|
|
+ map.put("endDate",eDate1);
|
|
|
+ map.put("week",a);
|
|
|
i1++;
|
|
|
+ a++;
|
|
|
+ itemList.add(map);
|
|
|
System.out.println(sDate1+"-----"+eDate1);
|
|
|
}
|
|
|
+ itemMap.put("month",LocalDate.parse(sDate,df).getMonthValue());
|
|
|
+ itemMap.put("data",itemList);
|
|
|
+ dataDetailList.add(itemMap);
|
|
|
}
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ System.out.println(dataDetailList);
|
|
|
HashMap map= (HashMap) msg.data;
|
|
|
List<TimelinessRateVO> list = (List<TimelinessRateVO>) map.get("list");
|
|
|
//String[] s={"人员","工号","部门","填报及时率"};
|
|
|
String[] s={MessageUtils.message("entry.personnel"),MessageUtils.message("entry.No"),MessageUtils.message("excel.department"),MessageUtils.message("excel.timeFill")};
|
|
|
- List<String> titleString = Arrays.asList(s);
|
|
|
+ List<String> titleString = new ArrayList<>(Arrays.asList(s));
|
|
|
+ for (Map<String, Object> objectMap : dataDetailList) {
|
|
|
+ List<Map<String,Object>> data = (List<Map<String, Object>>) objectMap.get("data");
|
|
|
+ Integer month = Integer.valueOf(String.valueOf(objectMap.get("month")));
|
|
|
+ for (Map<String, Object> datum : data) {
|
|
|
+ Integer week =Integer.valueOf(String.valueOf( datum.get("week")));
|
|
|
+ titleString.add(month+"月份第"+week+"周及时率");
|
|
|
+ }
|
|
|
+ }
|
|
|
List<List<String>> dataList=new ArrayList<>();
|
|
|
dataList.add(titleString);
|
|
|
for (TimelinessRateVO timelinessRateVO : list) {
|
|
|
List<String> item=new ArrayList<>();
|
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
- item.add(timelinessRateVO.getCorpwxUserId()==null?"":timelinessRateVO.getCorpwxUserId());
|
|
|
+ item.add("$userName="+(timelinessRateVO.getCorpwxUserId()==null?"":timelinessRateVO.getCorpwxUserId())+"$");
|
|
|
}else {
|
|
|
item.add(timelinessRateVO.getUserName());
|
|
|
}
|
|
|
item.add(timelinessRateVO.getJobNumber());
|
|
|
item.add(timelinessRateVO.getDepartmentName());
|
|
|
item.add(timelinessRateVO.getTimelinessRate());
|
|
|
+ for (Map<String, Object> objectMap : dataDetailList) {
|
|
|
+ List<Map<String,Object>> data = (List<Map<String, Object>>) objectMap.get("data");
|
|
|
+ for (Map<String, Object> datum : data) {
|
|
|
+ Optional<User> first = userList.stream().filter(ul ->(ul.getJobNumber()!=null&&ul.getJobNumber().equals(timelinessRateVO.getJobNumber()))||ul.getName().equals(timelinessRateVO.getUserName())).findFirst();
|
|
|
+ String startDate1 =String.valueOf( datum.get("startDate"));
|
|
|
+ String endDate1 =String.valueOf( datum.get("endDate"));
|
|
|
+ HttpRespMsg itemMsg = getUserReportTimelinessRate(request, startDate1, endDate1, null, first.get().getId(), null, null);
|
|
|
+ HashMap itemMap= (HashMap) itemMsg.data;
|
|
|
+ List<TimelinessRateVO> itemList = (List<TimelinessRateVO>) itemMap.get("list");
|
|
|
+ for (TimelinessRateVO rateVO : itemList) {
|
|
|
+ item.add(rateVO.getTimelinessRate());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
dataList.add(item);
|
|
|
}
|
|
|
//生成excel文件导出
|