|
@@ -146,12 +146,12 @@ public class ReportServiceImpl implements ReportService {
|
|
|
@Override
|
|
|
public Long createReport(ReportCreateReqVO createReqVO) {
|
|
|
String loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
- AdminUserRespDTO user = adminUserApi.getUser(loginUserId).getData();
|
|
|
+// AdminUserRespDTO user = adminUserApi.getUser(loginUserId).getData();
|
|
|
|
|
|
ReportDO report = ReportConvert.INSTANCE.convert(createReqVO);
|
|
|
report.setFillingDate(LocalDateTime.now());
|
|
|
report.setUserId(loginUserId);
|
|
|
- report.setDeptId(user.getDeptId());
|
|
|
+// report.setDeptId(user.getDeptId());
|
|
|
if (createReqVO.getReportId() == null) {
|
|
|
// 执行新增操作
|
|
|
reportMapper.insert(report);
|
|
@@ -188,17 +188,7 @@ public class ReportServiceImpl implements ReportService {
|
|
|
LocalDateTime[] dateTimeRange = new LocalDateTime[]{getStartDateTime(reportStatisticReqDTO.getYear(), reportStatisticReqDTO.getMonth()), getEndDateTime(reportStatisticReqDTO.getYear(), reportStatisticReqDTO.getMonth())};
|
|
|
attendanceSheetListReq.setAttendanceDate(dateTimeRange);
|
|
|
List<StatisticAttendanceSheetData> statisticAttendanceSheetData = attendanceSheetService.statisticAttendanceData(attendanceSheetListReq, reportStatisticReqDTO.getReportType());
|
|
|
- Map<String, Map<String, List<StatisticAttendanceSheetData>>> allAttendanceStatisticMap = new HashMap<>();
|
|
|
- if("daily".equals(reportStatisticReqDTO.getReportType())){
|
|
|
- allAttendanceStatisticMap = statisticAttendanceSheetData.stream().collect(
|
|
|
- Collectors.groupingBy(c -> c.getUserId() + "/" + c.getAttendanceDate().getYear() + "/" + c.getAttendanceDate().getMonthValue(),
|
|
|
- Collectors.groupingBy(c->c.getAttendanceDate().toLocalDate().toString()))); //考勤统计map 111/2024/2 -> value
|
|
|
|
|
|
- }else{
|
|
|
- allAttendanceStatisticMap = statisticAttendanceSheetData.stream().collect(
|
|
|
- Collectors.groupingBy(c -> c.getUserId() + "/" + c.getYear() + "/" + c.getMonth(),
|
|
|
- Collectors.groupingBy(c->c.getWeek().toString()))); //考勤统计map 111/2024/2 -> value
|
|
|
- }
|
|
|
|
|
|
//获取工作报告
|
|
|
ReportReqDTO reportReqDTO = new ReportReqDTO();
|
|
@@ -207,20 +197,30 @@ public class ReportServiceImpl implements ReportService {
|
|
|
reportReqDTO.setReportMonth(reportStatisticReqDTO.getMonth());
|
|
|
reportReqDTO.setUserId(reportStatisticReqDTO.getUserId());
|
|
|
List<ReportDO> reportList = reportMapper.selectList(reportReqDTO, deptIds);
|
|
|
+
|
|
|
+ List<String> userIds = reportList.stream().map(ReportDO::getUserId).distinct().collect(Collectors.toList());
|
|
|
+ Map<String, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
|
|
+ Set<String> deptIdSet = reportList.stream().map(ReportDO::getDeptId).collect(Collectors.toSet());
|
|
|
+ Map<String, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIdSet);
|
|
|
+
|
|
|
+
|
|
|
Map<String, Map<String, List<ReportDO>>> allReportMap = new HashMap<>();
|
|
|
+ Map<String, Map<String, List<StatisticAttendanceSheetData>>> allAttendanceStatisticMap = new HashMap<>();
|
|
|
if("daily".equals(reportStatisticReqDTO.getReportType())){
|
|
|
allReportMap = reportList.stream().collect(Collectors.groupingBy(c -> c.getReportStartDate().getYear() + "/" +c.getReportStartDate().getMonthValue() + "/" + c.getDeptId() + "/" + c.getUserId(),
|
|
|
Collectors.groupingBy(c-> c.getReportStartDate().toLocalDate().toString(),Collectors.toList())));
|
|
|
+
|
|
|
+ allAttendanceStatisticMap = statisticAttendanceSheetData.stream().collect(
|
|
|
+ Collectors.groupingBy(c -> c.getUserId() + "/" + c.getAttendanceDate().getYear() + "/" + c.getAttendanceDate().getMonthValue(),
|
|
|
+ Collectors.groupingBy(c->c.getAttendanceDate().toLocalDate().toString()))); //考勤统计map 111/2024/2 -> value
|
|
|
}else{
|
|
|
allReportMap = reportList.stream().collect(Collectors.groupingBy(c -> c.getReportYear() + "/" + c.getReportMonth() + "/" + c.getDeptId() + "/" + c.getUserId(),
|
|
|
Collectors.groupingBy(c-> c.getReportWeek().toString(),Collectors.toList())));
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- List<String> userIds = reportList.stream().map(ReportDO::getUserId).distinct().collect(Collectors.toList());
|
|
|
- Map<String, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds);
|
|
|
- Set<String> deptIdSet = reportList.stream().map(ReportDO::getDeptId).collect(Collectors.toSet());
|
|
|
- Map<String, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIdSet);
|
|
|
+ allAttendanceStatisticMap = statisticAttendanceSheetData.stream().collect(
|
|
|
+ Collectors.groupingBy(c -> c.getUserId() + "/" + c.getYear() + "/" + c.getMonth(),
|
|
|
+ Collectors.groupingBy(c->c.getWeek().toString()))); //考勤统计map 111/2024/2 -> value
|
|
|
+ }
|
|
|
|
|
|
//返回结果
|
|
|
List<ReportStatisticRespVO> resultList = new ArrayList<>();
|