Commit add1c34d by 谢春璐

按照导入数据天数导出考勤数据,而不是自然月

parent 48ff4fe4
......@@ -34,6 +34,7 @@ public class FileServiceImpl implements FileService {
//1. 拿到数据后根据id和日期分组
Map<String, Map<String, List<String[]>>> map = data.getDatas().stream()
.sorted(Comparator.comparing(strings -> DateUtils.parseDate(strings[3])))
.collect(Collectors.groupingBy(d -> d[2], Collectors.groupingBy(
d -> {
String date;
......@@ -111,21 +112,24 @@ public class FileServiceImpl implements FileService {
});
staff.getWorkCheckList().sort(Comparator.comparing(WorkCheck::getDate));
staffList.add(staff);
});
staffList.sort(Comparator.comparing(Staff::getId));
return checkExport(staffList, DateUtils.parseDate(staffList.get(0).getWorkCheckList().get(0).getDate()));
return checkExport(staffList);
}
private ResponseEntity<byte[]> checkExport(List<Staff> staffList, Date month) throws Exception {
private ResponseEntity<byte[]> checkExport(List<Staff> staffList) throws Exception {
ExcelData data = new ExcelData();
ArrayList<String> titleList = new ArrayList<>();
titleList.add("姓名");
titleList.addAll(DateUtils.getAllDatesOfMonth(month).stream().map(date ->
DateUtils.format(date, DateUtils.yyyyMMdd1).concat("(").concat(DateUtils.getWeekday(date))
titleList.addAll(staffList.stream().max(Comparator.comparing(staff -> staff.getWorkCheckList().size())).get()
.getWorkCheckList().stream().map(workCheck ->
DateUtils.format(DateUtils.parseDate(workCheck.getDate()), DateUtils.yyyyMMdd1).concat("(")
.concat(DateUtils.getWeekday(DateUtils.parseDate(workCheck.getDate())))
.concat(")")
).collect(Collectors.toList()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment