|
@@ -64,43 +64,45 @@ public class MailTemplateController {
|
|
Map<String, Object> templateParams =new HashMap<>();//模板参数设置
|
|
Map<String, Object> templateParams =new HashMap<>();//模板参数设置
|
|
// 获取当前这天
|
|
// 获取当前这天
|
|
LocalDate today = LocalDate.now();
|
|
LocalDate today = LocalDate.now();
|
|
- for (AdminUserDO teacher : TeacherList) {
|
|
|
|
- pageReqVO.setDate(today);
|
|
|
|
- List<StudentAttendanceEmailVO> normalList = BeanUtils.toBean(
|
|
|
|
- studentAttendanceService.getStudentAttendanceListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
- StudentAttendanceEmailVO.class
|
|
|
|
- );
|
|
|
|
- List<StudentAttendanceEmailVO> errorList = BeanUtils.toBean(
|
|
|
|
- studentAttendanceService.getStudentAttendanceErrorListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
- StudentAttendanceEmailVO.class
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- StringBuilder normalListBuilder = new StringBuilder();
|
|
|
|
- for (StudentAttendanceEmailVO attendance : normalList) {
|
|
|
|
- normalListBuilder
|
|
|
|
- .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
- .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
|
|
+ if ( TeacherList!=null&& !TeacherList.isEmpty()) {
|
|
|
|
+ for (AdminUserDO teacher : TeacherList) {
|
|
|
|
+ pageReqVO.setDate(today);
|
|
|
|
+ List<StudentAttendanceEmailVO> normalList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+ List<StudentAttendanceEmailVO> errorList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceErrorListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ StringBuilder normalListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : normalList) {
|
|
|
|
+ normalListBuilder
|
|
|
|
+ .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
+ .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
// .append(", 工作间名称: ").append(deptService.getDept(Long.valueOf(attendance.getDeptId())).getName()) // 这里需要映射为实际工作间名称
|
|
// .append(", 工作间名称: ").append(deptService.getDept(Long.valueOf(attendance.getDeptId())).getName()) // 这里需要映射为实际工作间名称
|
|
- .append(", 日期: ").append(attendance.getDate())
|
|
|
|
- .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
- .append("<br/>");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- StringBuilder errorListBuilder = new StringBuilder();
|
|
|
|
- for (StudentAttendanceEmailVO attendance : errorList) {
|
|
|
|
- errorListBuilder
|
|
|
|
- .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
- .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
|
|
+ .append(", 日期: ").append(attendance.getDate())
|
|
|
|
+ .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
+ .append("<br/>");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StringBuilder errorListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : errorList) {
|
|
|
|
+ errorListBuilder
|
|
|
|
+ .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
+ .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
// .append(", 工作间名称: ").append(deptService.getDept(Long.valueOf(attendance.getDeptId())).getName())
|
|
// .append(", 工作间名称: ").append(deptService.getDept(Long.valueOf(attendance.getDeptId())).getName())
|
|
- .append(", 日期: ").append(attendance.getDate())
|
|
|
|
- .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
- .append("<br/>");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- templateParams.put("normalList", normalListBuilder.toString());
|
|
|
|
- templateParams.put("errorList", errorListBuilder.toString());
|
|
|
|
- if (teacher.getEmail()!=null) {
|
|
|
|
- mailSendService.sendSingleMailToMember(teacher.getEmail(),null, "attendance-list", templateParams);
|
|
|
|
|
|
+ .append(", 日期: ").append(attendance.getDate())
|
|
|
|
+ .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
+ .append("<br/>");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ templateParams.put("normalList", normalListBuilder.toString());
|
|
|
|
+ templateParams.put("errorList", errorListBuilder.toString());
|
|
|
|
+ if (teacher.getEmail() != null) {
|
|
|
|
+ mailSendService.sendSingleMailToMember(teacher.getEmail(), null, "attendance-list", templateParams);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -172,45 +174,47 @@ public class MailTemplateController {
|
|
UserPageReqVO reqVO = new UserPageReqVO();
|
|
UserPageReqVO reqVO = new UserPageReqVO();
|
|
reqVO.setUserType("3");
|
|
reqVO.setUserType("3");
|
|
List<AdminUserDO> TeacherList = adminUserService.getUserPage(reqVO).getList();//所有老师
|
|
List<AdminUserDO> TeacherList = adminUserService.getUserPage(reqVO).getList();//所有老师
|
|
- StudentAttendancePageReqVO pageReqVO =new StudentAttendancePageReqVO();
|
|
|
|
|
|
+ StudentAttendancePageReqVO pageReqVO = new StudentAttendancePageReqVO();
|
|
// 获取当前这天
|
|
// 获取当前这天
|
|
LocalDate today = LocalDate.now();
|
|
LocalDate today = LocalDate.now();
|
|
- Map<String, Object> templateParams =new HashMap<>();//模板参数设置
|
|
|
|
- for (AdminUserDO teacher : TeacherList) {
|
|
|
|
- pageReqVO.setDate(today);
|
|
|
|
- List<StudentAttendanceEmailVO> normalList = BeanUtils.toBean(
|
|
|
|
- studentAttendanceService.getStudentAttendanceListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
- StudentAttendanceEmailVO.class
|
|
|
|
- );
|
|
|
|
- List<StudentAttendanceEmailVO> errorList = BeanUtils.toBean(
|
|
|
|
- studentAttendanceService.getStudentAttendanceErrorListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
- StudentAttendanceEmailVO.class
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- StringBuilder normalListBuilder = new StringBuilder();
|
|
|
|
- for (StudentAttendanceEmailVO attendance : normalList) {
|
|
|
|
- normalListBuilder.append("学生id: ").append(attendance.getId())
|
|
|
|
- .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
- .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
- .append(", 日期: ").append(attendance.getDate())
|
|
|
|
- .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
- .append("<br/>");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- StringBuilder errorListBuilder = new StringBuilder();
|
|
|
|
- for (StudentAttendanceEmailVO attendance : errorList) {
|
|
|
|
- errorListBuilder
|
|
|
|
- .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
- .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
- .append(", 日期: ").append(attendance.getDate())
|
|
|
|
- .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
- .append("<br/>");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- templateParams.put("normalList", normalListBuilder.toString());
|
|
|
|
- templateParams.put("errorList", errorListBuilder.toString());
|
|
|
|
- if (teacher.getEmail()!=null) {
|
|
|
|
- mailSendService.sendSingleMailToMember(teacher.getEmail(), teacher.getId(), "attendance-list", templateParams);
|
|
|
|
|
|
+ Map<String, Object> templateParams = new HashMap<>();//模板参数设置
|
|
|
|
+ if (TeacherList != null && !TeacherList.isEmpty()) {
|
|
|
|
+ for (AdminUserDO teacher : TeacherList) {
|
|
|
|
+ pageReqVO.setDate(today);
|
|
|
|
+ List<StudentAttendanceEmailVO> normalList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+ List<StudentAttendanceEmailVO> errorList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceErrorListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ StringBuilder normalListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : normalList) {
|
|
|
|
+ normalListBuilder.append("学生id: ").append(attendance.getId())
|
|
|
|
+ .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
+ .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
+ .append(", 日期: ").append(attendance.getDate())
|
|
|
|
+ .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
+ .append("<br/>");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StringBuilder errorListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : errorList) {
|
|
|
|
+ errorListBuilder
|
|
|
|
+ .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
+ .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
+ .append(", 日期: ").append(attendance.getDate())
|
|
|
|
+ .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
+ .append("<br/>");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ templateParams.put("normalList", normalListBuilder.toString());
|
|
|
|
+ templateParams.put("errorList", errorListBuilder.toString());
|
|
|
|
+ if (teacher.getEmail() != null) {
|
|
|
|
+ mailSendService.sendSingleMailToMember(teacher.getEmail(), teacher.getId(), "attendance-list", templateParams);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|