|
@@ -181,7 +181,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
List<Long> reportIds = reportList.stream().map(ReportRespVO::getId).collect(Collectors.toList());
|
|
|
Set<String> userIdList = reportList.stream().map(ReportRespVO::getUserId).collect(Collectors.toSet());
|
|
|
|
|
|
- List<ReportWorkloadRespVO> workloadDetailList = reportWorkloadService.getReportWorkloadByRIds(reportIds,userIdList);
|
|
|
+ List<ReportWorkloadRespVO> workloadDetailList = reportWorkloadService.getReportWorkloadByRIds(reportIds, userIdList);
|
|
|
|
|
|
reportList.forEach(report -> {
|
|
|
report.setWorkload(workloadDetailList.stream().filter(load -> load.getReportId().equals(report.getId())).collect(Collectors.toList()));
|
|
@@ -201,19 +201,17 @@ public class ReportServiceImpl implements ReportService {
|
|
|
queryWrapperX.eqIfPresent(ReportDO::getReportType, reqVO.getReportType());
|
|
|
queryWrapperX.eqIfPresent(ReportDO::getUserId, reqVO.getUserId());
|
|
|
if ("daily".equals(reqVO.getReportType())) {
|
|
|
- queryWrapperX.betweenIfPresent(ReportDO::getReportStartDate, DateUtil.getStartDateTime(reqVO.getReportYear(), reqVO.getReportMonth()),
|
|
|
- DateUtil.getEndDateTime(reqVO.getReportYear(), reqVO.getReportMonth()));
|
|
|
+ queryWrapperX.betweenIfPresent(ReportDO::getReportStartDate, DateUtil.getStartDateTime(reqVO.getReportYear(), reqVO.getReportMonth()), DateUtil.getEndDateTime(reqVO.getReportYear(), reqVO.getReportMonth()));
|
|
|
} else {
|
|
|
- queryWrapperX.eqIfPresent(ReportDO::getReportYear, reqVO.getReportYear())
|
|
|
- .eqIfPresent(ReportDO::getReportMonth, reqVO.getReportMonth());
|
|
|
+ queryWrapperX.eqIfPresent(ReportDO::getReportYear, reqVO.getReportYear()).eqIfPresent(ReportDO::getReportMonth, reqVO.getReportMonth());
|
|
|
}
|
|
|
List<ReportRespVO> reportList = ReportConvert.INSTANCE.convertList(reportMapper.selectList(queryWrapperX));
|
|
|
- if(CollectionUtil.isEmpty(reportList)){
|
|
|
+ if (CollectionUtil.isEmpty(reportList)) {
|
|
|
return reportList;
|
|
|
}
|
|
|
List<Long> reportIds = reportList.stream().map(ReportRespVO::getId).collect(Collectors.toList());
|
|
|
Set<String> userIdList = reportList.stream().map(ReportRespVO::getUserId).collect(Collectors.toSet());
|
|
|
- List<ReportWorkloadRespVO> workloadDetailList = reportWorkloadService.getReportWorkloadByRIds(reportIds,userIdList);
|
|
|
+ List<ReportWorkloadRespVO> workloadDetailList = reportWorkloadService.getReportWorkloadByRIds(reportIds, userIdList);
|
|
|
List<ReportCommentRespVO> reportCommentList = reportCommentService.getReportCommentListByRIds(reportIds);
|
|
|
List<ReportReceiveRespVO> reportReceiveList = reportReceiveService.getReportReceiveList(reportIds);
|
|
|
List<AdminUserRespDTO> userInfoList = adminUserApi.getUsers(reportReceiveList.stream().map(ReportReceiveBaseVO::getReceiveUserId).distinct().collect(Collectors.toList())).getData();
|
|
@@ -327,7 +325,6 @@ public class ReportServiceImpl implements ReportService {
|
|
|
queryWrapper.eq(ReportDO::getIsTemp, false);
|
|
|
queryWrapper.in(CollectionUtils.isNotEmpty(deptId), ReportDO::getDeptId, deptId);
|
|
|
queryWrapper.eq(StrUtil.isNotBlank(userId), ReportDO::getUserId, userId);
|
|
|
-
|
|
|
if (StrUtil.isNotBlank(reportType)) {
|
|
|
queryWrapper.eq(ReportDO::getReportType, reportType);
|
|
|
if ("daily".equals(reportType)) {
|
|
@@ -338,62 +335,94 @@ public class ReportServiceImpl implements ReportService {
|
|
|
queryWrapper.eq(month != null, ReportDO::getReportMonth, month);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
List<ReportDO> reportList = reportMapper.selectList(queryWrapper);
|
|
|
- Map<String, List<ReportDO>> reportMap = reportList.stream()
|
|
|
- .collect(Collectors.groupingBy(ReportDO::getUserId));
|
|
|
+ Map<String, List<ReportDO>> reportMap = reportList.stream().collect(Collectors.groupingBy(ReportDO::getUserId));
|
|
|
return reportMap;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 工作报告统计
|
|
|
+ * 工作报告统计分页
|
|
|
*
|
|
|
* @param reportStatisticReqDTO
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public PageResult<ReportStatisticRespVO> getReportStatistics(ReportStatisticReqDTO reportStatisticReqDTO) {
|
|
|
+ reportStatisticReqDTO.setIsUseDeptAuth(true);
|
|
|
List<ReportStatisticRespVO> respList = this.getReportStatisticsList(reportStatisticReqDTO);
|
|
|
PageResult<ReportStatisticRespVO> pages = PageUtil.getPages(reportStatisticReqDTO.getPageNo(), reportStatisticReqDTO.getPageSize(), respList);
|
|
|
pages.setTotal(Long.valueOf(respList.size()));
|
|
|
return pages;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 工作报告统计列表
|
|
|
+ *
|
|
|
+ * @param reportStatisticReqDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public List<ReportStatisticRespVO> getReportStatisticsList(ReportStatisticReqDTO reportStatisticReqDTO) {
|
|
|
Short year = reportStatisticReqDTO.getYear();
|
|
|
Short month = reportStatisticReqDTO.getMonth();
|
|
|
- //获取部门及关联部门的用户
|
|
|
- DeptDataPermissionRespDTO dto = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()).getCheckedData();
|
|
|
- Set<String> deptIds = dto.getDeptIds();
|
|
|
- if (CollectionUtils.isEmpty(deptIds)) {
|
|
|
+ String reportType = reportStatisticReqDTO.getReportType();
|
|
|
+ String deptId = reportStatisticReqDTO.getDeptId();
|
|
|
+ String userId = reportStatisticReqDTO.getUserId();
|
|
|
+ Boolean isUseDeptAuth = reportStatisticReqDTO.getIsUseDeptAuth();
|
|
|
+
|
|
|
+ Set<String> deptIds = new HashSet<>();
|
|
|
+ List<AdminUserRespDTO> userList = new ArrayList<>();
|
|
|
+ //使用数据权限
|
|
|
+ if (isUseDeptAuth != null && isUseDeptAuth) {
|
|
|
+ //获取当前用户部门及关联部门的用户
|
|
|
+ DeptDataPermissionRespDTO dto = permissionApi.getDeptDataPermission(SecurityFrameworkUtils.getLoginUserId()).getCheckedData();
|
|
|
+ deptIds = dto.getDeptIds();
|
|
|
+ userList = adminUserApi.getUserListByDeptIds(deptIds).getData();
|
|
|
+ } else {
|
|
|
+ //不使用数据权限
|
|
|
+ if (StrUtil.isNotBlank(deptId)) {
|
|
|
+ deptIds = convertSet(deptApi.getChildDeptList(reportStatisticReqDTO.getDeptId()).getCheckedData(), DeptRespDTO::getId);
|
|
|
+ //添加自身部门
|
|
|
+ deptIds.add(reportStatisticReqDTO.getDeptId());
|
|
|
+ userList = adminUserApi.getUserListByDeptIds(deptIds).getData();
|
|
|
+ } else {
|
|
|
+ userList = adminUserApi.getUserList().getData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtil.isEmpty(userList)) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
- List<AdminUserRespDTO> records = adminUserApi.getUserListByDeptIds(deptIds).getData();
|
|
|
- if (StrUtil.isNotBlank(reportStatisticReqDTO.getUserId())) {
|
|
|
- records = records.stream().filter(user -> reportStatisticReqDTO.getUserId().equals(user.getId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //userId筛选
|
|
|
+ if (StrUtil.isNotBlank(userId)) {
|
|
|
+ userList = userList.stream().filter(user -> userId.equals(user.getId())).collect(Collectors.toList());
|
|
|
}
|
|
|
- //获取工作报告
|
|
|
- Map<String, List<ReportDO>> staffReportMap = this.getReport(reportStatisticReqDTO.getReportType(), year, month, deptIds, reportStatisticReqDTO.getUserId());
|
|
|
|
|
|
- //获取工作日或工作周数量
|
|
|
+ //获取人员工作报告Map
|
|
|
+ Map<String, List<ReportDO>> staffReportMap = this.getReport(reportType, year, month, deptIds, userId);
|
|
|
+
|
|
|
+ //计算应填数量 = 工作日或工作周数量
|
|
|
Integer shouldFillCount = 0;
|
|
|
- if ("daily".equals(reportStatisticReqDTO.getReportType())) {
|
|
|
+ if ("daily".equals(reportType)) {
|
|
|
shouldFillCount = workdayService.getMonthWorkDayNum(year, month);
|
|
|
} else {
|
|
|
shouldFillCount = workdayService.getMonthWorkWeekNum(year, month);
|
|
|
}
|
|
|
|
|
|
List<ReportStatisticRespVO> respList = new ArrayList<>();
|
|
|
- for (AdminUserRespDTO staff : records) {
|
|
|
+ for (AdminUserRespDTO staff : userList) {
|
|
|
ReportStatisticRespVO statisticRespVO = new ReportStatisticRespVO();
|
|
|
statisticRespVO.setReportYear(year);
|
|
|
statisticRespVO.setReportMonth(month);
|
|
|
+ statisticRespVO.setReportType(reportType);
|
|
|
|
|
|
statisticRespVO.setUserId(staff.getId());
|
|
|
statisticRespVO.setNickName(staff.getNickname());
|
|
|
statisticRespVO.setDeptId(staff.getDeptId());
|
|
|
statisticRespVO.setDeptName(staff.getDeptName());
|
|
|
|
|
|
- statisticRespVO.setReportType(reportStatisticReqDTO.getReportType());
|
|
|
+
|
|
|
statisticRespVO.setShouldFilledCount(shouldFillCount);
|
|
|
List<ReportDO> staffReportList = staffReportMap.get(staff.getId());
|
|
|
statisticRespVO.setFilledCount(staffReportList == null ? 0 : staffReportList.size());
|
|
@@ -408,8 +437,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
|
|
|
public String sendFillRemind(ReportStatisticReqDTO reportStatisticReqDTO) {
|
|
|
List<ReportStatisticRespVO> reportStatisticsList = this.getReportStatisticsList(reportStatisticReqDTO);
|
|
|
- List<String> userIdList = reportStatisticsList.stream().filter(c -> c.getFillRate() == null || new BigDecimal(c.getFillRate()).compareTo(BigDecimal.ZERO) == 0)
|
|
|
- .map(ReportStatisticRespVO::getUserId).collect(Collectors.toList());
|
|
|
+ List<String> userIdList = reportStatisticsList.stream().filter(c -> c.getFillRate() == null || new BigDecimal(c.getFillRate()).compareTo(BigDecimal.ZERO) == 0).map(ReportStatisticRespVO::getUserId).collect(Collectors.toList());
|
|
|
reportDingService.sendFillRemind(userIdList, reportStatisticReqDTO.getReportType(), reportStatisticReqDTO.getYear(), reportStatisticReqDTO.getMonth());
|
|
|
|
|
|
return "发送成功";
|
|
@@ -425,45 +453,42 @@ public class ReportServiceImpl implements ReportService {
|
|
|
@Override
|
|
|
public List<DeptReportStatisticRespVO> getDeptReportStatistics(Short year, Short month) {
|
|
|
ReportStatisticReqDTO reportStatisticReqDTO = new ReportStatisticReqDTO();
|
|
|
- reportStatisticReqDTO.setPageNo(1);
|
|
|
- reportStatisticReqDTO.setPageSize(9999);
|
|
|
reportStatisticReqDTO.setYear(year);
|
|
|
reportStatisticReqDTO.setMonth(month);
|
|
|
|
|
|
- //获取部门列表
|
|
|
+ //获取部门列表,并在部门列表中手动加入职能部门(自定义id parentId name)
|
|
|
List<DeptRespDTO> deptList = deptApi.getDeptList().getData();
|
|
|
-
|
|
|
- //获取职能部门
|
|
|
- List<DictDataRespDTO> functionalDeptList = dictApi.getDictDataList("functional_dept").getData();
|
|
|
- List<String> functionalDeptIdList = functionalDeptList.stream().map(DictDataRespDTO::getValue).collect(Collectors.toList());
|
|
|
- //职能部门层级关系手动赋值
|
|
|
DeptRespDTO functionalDept = new DeptRespDTO();
|
|
|
functionalDept.setId("001");
|
|
|
functionalDept.setParentId("0");
|
|
|
functionalDept.setName("职能部门");
|
|
|
deptList.add(functionalDept);
|
|
|
+
|
|
|
+ //获取职能部门下属部门,并将职能部门下属部门parentId设置为父部门为001
|
|
|
+ List<DictDataRespDTO> functionalDeptList = dictApi.getDictDataList("functional_dept").getData();
|
|
|
+ List<String> functionalDeptIdList = functionalDeptList.stream().map(DictDataRespDTO::getValue).collect(Collectors.toList());
|
|
|
for (DeptRespDTO dept : deptList) {
|
|
|
if (functionalDeptIdList.contains(dept.getId())) {
|
|
|
dept.setParentId("001");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//获取统计日报的部门(市场部门)
|
|
|
List<DictDataRespDTO> dailyReportDeptList = dictApi.getDictDataList("statistic_daily_dept").getData();
|
|
|
List<String> dailyReportDeptIdList = dailyReportDeptList.stream().map(DictDataRespDTO::getValue).collect(Collectors.toList());
|
|
|
|
|
|
//获取每个用户周报统计结果
|
|
|
- List<ReportStatisticRespVO> weekReportStatistics = this.getReportStatistics(reportStatisticReqDTO.setReportType("weekly")).getList();
|
|
|
+ List<ReportStatisticRespVO> userWeekReportStatistics = this.getReportStatisticsList(reportStatisticReqDTO.setReportType("weekly"));
|
|
|
//获取每个部门周报统计结果
|
|
|
- Map<String, DeptReportStatisticRespVO> weekReportStatisticsGroup = this.aggregateDeptReportStatistics(weekReportStatistics, deptList, year, month, dailyReportDeptIdList);
|
|
|
+ Map<String, DeptReportStatisticRespVO> weekReportStatisticsGroup = this.aggregateDeptReportStatistics(userWeekReportStatistics, deptList, year, month, dailyReportDeptIdList);
|
|
|
|
|
|
//获取每个用户日报统计结果
|
|
|
- List<ReportStatisticRespVO> dailyReportStatistics = this.getReportStatistics(reportStatisticReqDTO.setReportType("daily")).getList();
|
|
|
+ List<ReportStatisticRespVO> userDailyReportStatistics = this.getReportStatisticsList(reportStatisticReqDTO.setReportType("daily"));
|
|
|
//获取每个部门日报统计结果
|
|
|
- Map<String, DeptReportStatisticRespVO> dailyReportStatisticsGroup = this.aggregateDeptReportStatistics(dailyReportStatistics, deptList, year, month, dailyReportDeptIdList);
|
|
|
+ Map<String, DeptReportStatisticRespVO> dailyReportStatisticsGroup = this.aggregateDeptReportStatistics(userDailyReportStatistics, deptList, year, month, dailyReportDeptIdList);
|
|
|
+
|
|
|
//统计每个部门的周日报完成率
|
|
|
List<DeptReportStatisticRespVO> voList = new ArrayList<>();
|
|
|
-
|
|
|
-
|
|
|
for (DeptRespDTO dept : deptList) {
|
|
|
DeptReportStatisticRespVO vo = new DeptReportStatisticRespVO();
|
|
|
vo.setReportYear(year);
|
|
@@ -490,7 +515,6 @@ public class ReportServiceImpl implements ReportService {
|
|
|
voList.add(vo);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return voList;
|
|
|
}
|
|
|
|
|
@@ -498,22 +522,23 @@ public class ReportServiceImpl implements ReportService {
|
|
|
/**
|
|
|
* 工作报告聚合统计
|
|
|
*
|
|
|
- * @param dailyReportStatistics
|
|
|
- * @param deptList
|
|
|
- * @param year
|
|
|
- * @param month
|
|
|
- * @param dailyReportDeptIdList
|
|
|
+ * @param userReportStatistics 用户报告统计结果
|
|
|
+ * @param deptList 部门列表
|
|
|
+ * @param year 年份
|
|
|
+ * @param month 月份
|
|
|
+ * @param dailyReportDeptIdList 填写日报的部门列表
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, DeptReportStatisticRespVO> aggregateDeptReportStatistics(List<ReportStatisticRespVO> dailyReportStatistics, List<DeptRespDTO> deptList, Short year, Short month, List<String> dailyReportDeptIdList) {
|
|
|
- // 第一步:合并用户统计到部门统计
|
|
|
+ public Map<String, DeptReportStatisticRespVO> aggregateDeptReportStatistics(List<ReportStatisticRespVO> userReportStatistics, List<DeptRespDTO> deptList, Short year, Short month, List<String> dailyReportDeptIdList) {
|
|
|
+ //第一步:合并用户统计到部门统计(只能统计到直属部门)
|
|
|
Map<String, DeptReportStatisticRespVO> deptStatisticMap = new HashMap<>();
|
|
|
- for (ReportStatisticRespVO vo : dailyReportStatistics) {
|
|
|
+ for (ReportStatisticRespVO vo : userReportStatistics) {
|
|
|
String deptId = vo.getDeptId();
|
|
|
DeptReportStatisticRespVO deptStat = deptStatisticMap.computeIfAbsent(deptId, k -> new DeptReportStatisticRespVO(deptId, 0, 0));
|
|
|
deptStat.setDeptId(deptId);
|
|
|
deptStat.setReportYear(year);
|
|
|
deptStat.setReportMonth(month);
|
|
|
+ //应填、未填、已填累加
|
|
|
deptStat.setShouldFilledCount(deptStat.getShouldFilledCount() + vo.getShouldFilledCount());
|
|
|
deptStat.setNotFilledCount(deptStat.getNotFilledCount() + vo.getNotFilledCount());
|
|
|
deptStat.setFilledCount(deptStat.getFilledCount() + vo.getFilledCount());
|
|
@@ -521,36 +546,27 @@ public class ReportServiceImpl implements ReportService {
|
|
|
}
|
|
|
List<DeptReportStatisticRespVO> deptStatisticValue = deptStatisticMap.values().stream().collect(Collectors.toList());
|
|
|
|
|
|
- Map<String, List<String>> deptIdMap = collectSubtreeIds(deptList);
|
|
|
-
|
|
|
-
|
|
|
- // 遍历部门id,找到有子节点的部门,并计算其子节点的统计值
|
|
|
+ //第二步:合并部门统计到部门统计(可以统计到子部门)
|
|
|
+ //获取每个部门的子部门id(包含自己)列表
|
|
|
+ Map<String, List<String>> deptIdMap = this.collectSubtreeIds(deptList);
|
|
|
+ //遍历部门id,找到有子节点的部门,并计算其子节点的统计值
|
|
|
for (String deptId : deptIdMap.keySet()) {
|
|
|
-
|
|
|
List<String> childDeptIdList = deptIdMap.get(deptId);
|
|
|
if (childDeptIdList.size() <= 1) {
|
|
|
+ //如果没有子部门或子部门列表中只有自己,不再重新计算,直接使用第一步结果
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
+ //TODO 需求 板块统计去除市场部门,如“空间信息研究院”完成率中要去掉“空间信息浙江市场部”
|
|
|
//子级去除市场部门
|
|
|
- List<String> removeMarketChildDeptIdList = childDeptIdList.stream()
|
|
|
- .filter(item -> !dailyReportDeptIdList.contains(item))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ List<String> removeMarketChildDeptIdList = childDeptIdList.stream().filter(item -> !dailyReportDeptIdList.contains(item)).collect(Collectors.toList());
|
|
|
|
|
|
List<DeptReportStatisticRespVO> childDeptList = deptStatisticValue.stream().filter(c -> removeMarketChildDeptIdList.contains(c.getDeptId())).collect(Collectors.toList());
|
|
|
- // 使用Stream进行统计
|
|
|
- int shouldFilledCount = (int) childDeptList.stream()
|
|
|
- .mapToLong(DeptReportStatisticRespVO::getShouldFilledCount)
|
|
|
- .sum();
|
|
|
-
|
|
|
- int filledCount = (int) childDeptList.stream()
|
|
|
- .mapToLong(DeptReportStatisticRespVO::getFilledCount)
|
|
|
- .sum();
|
|
|
+ // 使用Stream进行统计 应填和已填
|
|
|
+ int shouldFilledCount = (int) childDeptList.stream().mapToLong(DeptReportStatisticRespVO::getShouldFilledCount).sum();
|
|
|
+ int filledCount = (int) childDeptList.stream().mapToLong(DeptReportStatisticRespVO::getFilledCount).sum();
|
|
|
DeptReportStatisticRespVO vo = new DeptReportStatisticRespVO(deptId, shouldFilledCount, filledCount);
|
|
|
deptStatisticMap.put(deptId, vo);
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
return deptStatisticMap;
|
|
|
}
|
|
|
|
|
@@ -558,33 +574,32 @@ public class ReportServiceImpl implements ReportService {
|
|
|
/**
|
|
|
* 获取部门及子部门id
|
|
|
*
|
|
|
- * @param deptTree
|
|
|
- * @return key是部门id,value是所有子集节点id列表
|
|
|
+ * @param deptList 部门列表
|
|
|
+ * @return key是部门id,value是所有子集节点id(包含自己)列表
|
|
|
*/
|
|
|
- public static Map<String, List<String>> collectSubtreeIds(List<DeptRespDTO> deptTree) {
|
|
|
- // 创建一个映射,用于快速查找部门对象
|
|
|
+ public static Map<String, List<String>> collectSubtreeIds(List<DeptRespDTO> deptList) {
|
|
|
+ // 创建一个部门id和部门的映射,用于快速查找部门对象
|
|
|
Map<String, DeptRespDTO> idToDeptMap = new HashMap<>();
|
|
|
- for (DeptRespDTO dept : deptTree) {
|
|
|
+ for (DeptRespDTO dept : deptList) {
|
|
|
idToDeptMap.put(dept.getId(), dept);
|
|
|
}
|
|
|
|
|
|
- // 最终的映射,key是部门id,value是所有子集节点id列表
|
|
|
+ // 结果集,key是部门id,value是所有子集节点id列表
|
|
|
Map<String, List<String>> result = new HashMap<>();
|
|
|
|
|
|
// 遍历每个部门,并递归地收集子集节点
|
|
|
- for (DeptRespDTO dept : deptTree) {
|
|
|
+ for (DeptRespDTO dept : deptList) {
|
|
|
collectSubtreeIdsRecursive(dept, idToDeptMap, result);
|
|
|
}
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 递归地收集子集节点
|
|
|
*
|
|
|
- * @param dept
|
|
|
- * @param idToDeptMap
|
|
|
- * @param result
|
|
|
+ * @param dept 部门
|
|
|
+ * @param idToDeptMap 部门id和部门映射Map
|
|
|
+ * @param result 结果集
|
|
|
*/
|
|
|
private static void collectSubtreeIdsRecursive(DeptRespDTO dept, Map<String, DeptRespDTO> idToDeptMap, Map<String, List<String>> result) {
|
|
|
// 获取当前部门的ID,并添加到结果映射中(如果尚未添加)
|
|
@@ -648,9 +663,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
List<String> projectIdList = projectList.stream().map(ProjectVO::getId).collect(Collectors.toList());
|
|
|
// 每1000个元素分一个List (oracle的in最多接收1000)
|
|
|
int chunkSize = 1000;
|
|
|
- List<List<String>> chunkedProjectIdList = IntStream.range(0, (projectIdList.size() + chunkSize - 1) / chunkSize)
|
|
|
- .mapToObj(i -> projectIdList.subList(i * chunkSize, Math.min((i + 1) * chunkSize, projectIdList.size())))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ List<List<String>> chunkedProjectIdList = IntStream.range(0, (projectIdList.size() + chunkSize - 1) / chunkSize).mapToObj(i -> projectIdList.subList(i * chunkSize, Math.min((i + 1) * chunkSize, projectIdList.size()))).collect(Collectors.toList());
|
|
|
int lastIndex = chunkedProjectIdList.size() - 1;
|
|
|
queryWrapper.and(qw -> {
|
|
|
for (int i = 0; i <= lastIndex; i++) {
|
|
@@ -667,14 +680,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
List<ReportRelationWorkloadVO> reportWorkloadRelationList = reportWorkloadMapper.getReportWrokloadList(queryWrapper);
|
|
|
|
|
|
|
|
|
- Map<String, BigDecimal> workloadStatisticMap = reportWorkloadRelationList.stream()
|
|
|
- .collect(Collectors.groupingBy(
|
|
|
- item -> item.getUserId() + "_" + item.getProjectId(),
|
|
|
- Collectors.mapping(
|
|
|
- ReportWorkloadDO::getWorkTime,
|
|
|
- Collectors.reducing(BigDecimal.ZERO, BigDecimal::add)
|
|
|
- )
|
|
|
- ));
|
|
|
+ Map<String, BigDecimal> workloadStatisticMap = reportWorkloadRelationList.stream().collect(Collectors.groupingBy(item -> item.getUserId() + "_" + item.getProjectId(), Collectors.mapping(ReportWorkloadDO::getWorkTime, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
|
|
|
|
|
Map<String, AdminUserRespDTO> userMap = adminUserApi.getUserMap();
|
|
|
Map<String, String> contractMap = getContractMap();
|
|
@@ -700,9 +706,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
}
|
|
|
resultList.add(result);
|
|
|
}
|
|
|
- resultList = resultList.stream()
|
|
|
- .sorted(Comparator.comparing(c -> PinyinUtil.toFirstLetter(c.getNickName())))
|
|
|
- .collect(Collectors.toList());
|
|
|
+ resultList = resultList.stream().sorted(Comparator.comparing(c -> PinyinUtil.toFirstLetter(c.getNickName()))).collect(Collectors.toList());
|
|
|
|
|
|
if (reportWorkloadStatisticReqDTO.getIsPage()) {
|
|
|
PageResult<ReportWorkloadStatisticVO> pageResult = PageUtil.getPages(reportWorkloadStatisticReqDTO.getPageNo(), reportWorkloadStatisticReqDTO.getPageSize(), resultList);
|
|
@@ -767,8 +771,8 @@ public class ReportServiceImpl implements ReportService {
|
|
|
queryWrapper.eq("REPORT.IS_TEMP", 0);
|
|
|
if (StrUtil.isNotBlank(rep.getStartDate()) && StrUtil.isNotBlank(rep.getEndDate())) {
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- LocalDateTime startDateTime = LocalDate.parse(rep.getStartDate(),formatter).atStartOfDay();
|
|
|
- LocalDateTime endDateTime = LocalDate.parse(rep.getEndDate(),formatter).plusDays(1).atStartOfDay().minusSeconds(1);
|
|
|
+ LocalDateTime startDateTime = LocalDate.parse(rep.getStartDate(), formatter).atStartOfDay();
|
|
|
+ LocalDateTime endDateTime = LocalDate.parse(rep.getEndDate(), formatter).plusDays(1).atStartOfDay().minusSeconds(1);
|
|
|
|
|
|
LocalDateTime currentDate = startDateTime;
|
|
|
List<Integer> monthList = new ArrayList<>();
|