|
@@ -55,7 +55,7 @@ public class MailTemplateController {
|
|
|
|
|
|
@Scheduled(cron = "0 30 22 * * ?") // 每天晚上 22:30
|
|
@Scheduled(cron = "0 30 22 * * ?") // 每天晚上 22:30
|
|
@Operation(summary = "定时发送邮件给导师")
|
|
@Operation(summary = "定时发送邮件给导师")
|
|
- public void sendMailToFamilyScheduled() {
|
|
|
|
|
|
+ public void sendMailToTeacherScheduled() {
|
|
// 创建结果对象并设置属性
|
|
// 创建结果对象并设置属性
|
|
UserPageReqVO reqVO = new UserPageReqVO();
|
|
UserPageReqVO reqVO = new UserPageReqVO();
|
|
reqVO.setUserType("3");//找导师
|
|
reqVO.setUserType("3");//找导师
|
|
@@ -75,13 +75,16 @@ public class MailTemplateController {
|
|
studentAttendanceService.getStudentAttendanceErrorListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
studentAttendanceService.getStudentAttendanceErrorListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
StudentAttendanceEmailVO.class
|
|
StudentAttendanceEmailVO.class
|
|
);
|
|
);
|
|
|
|
+ List<StudentAttendanceEmailVO> excusedList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceExcusedListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
|
|
StringBuilder normalListBuilder = new StringBuilder();
|
|
StringBuilder normalListBuilder = new StringBuilder();
|
|
for (StudentAttendanceEmailVO attendance : normalList) {
|
|
for (StudentAttendanceEmailVO attendance : normalList) {
|
|
normalListBuilder
|
|
normalListBuilder
|
|
.append(", 学生姓名: ").append(attendance.getStudentName())
|
|
.append(", 学生姓名: ").append(attendance.getStudentName())
|
|
.append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
.append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
-// .append(", 工作间名称: ").append(deptService.getDept(Long.valueOf(attendance.getDeptId())).getName()) // 这里需要映射为实际工作间名称
|
|
|
|
.append(", 日期: ").append(attendance.getDate())
|
|
.append(", 日期: ").append(attendance.getDate())
|
|
.append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
.append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
.append("<br/>");
|
|
.append("<br/>");
|
|
@@ -92,14 +95,24 @@ public class MailTemplateController {
|
|
errorListBuilder
|
|
errorListBuilder
|
|
.append(", 学生姓名: ").append(attendance.getStudentName())
|
|
.append(", 学生姓名: ").append(attendance.getStudentName())
|
|
.append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
.append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
-// .append(", 工作间名称: ").append(deptService.getDept(Long.valueOf(attendance.getDeptId())).getName())
|
|
|
|
.append(", 日期: ").append(attendance.getDate())
|
|
.append(", 日期: ").append(attendance.getDate())
|
|
.append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
.append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
.append("<br/>");
|
|
.append("<br/>");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ StringBuilder excusedListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : excusedList) {
|
|
|
|
+ excusedListBuilder
|
|
|
|
+ .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("normalList", normalListBuilder.toString());
|
|
templateParams.put("errorList", errorListBuilder.toString());
|
|
templateParams.put("errorList", errorListBuilder.toString());
|
|
|
|
+ templateParams.put("excusedList", excusedListBuilder.toString());
|
|
if (teacher.getEmail() != null) {
|
|
if (teacher.getEmail() != null) {
|
|
mailSendService.sendSingleMailToMember(teacher.getEmail(), null, "attendance-list", templateParams);
|
|
mailSendService.sendSingleMailToMember(teacher.getEmail(), null, "attendance-list", templateParams);
|
|
}
|
|
}
|
|
@@ -108,6 +121,78 @@ public class MailTemplateController {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Scheduled(cron = "0 30 22 * * ?") // 每天晚上 22:30
|
|
|
|
+ @Operation(summary = "定时发送邮件给学院")
|
|
|
|
+ public void sendMailToCollegeScheduled() {
|
|
|
|
+ UserPageReqVO reqVO = new UserPageReqVO();
|
|
|
|
+ reqVO.setUserType("4");//找学院
|
|
|
|
+ List<AdminUserDO> collegeList = adminUserService.getUserList(reqVO);
|
|
|
|
+ StudentAttendancePageReqVO attendanceReqVO =new StudentAttendancePageReqVO();
|
|
|
|
+ Map<String, Object> templateParams =new HashMap<>();//模板参数设置
|
|
|
|
+ // 获取当前这天
|
|
|
|
+ LocalDate today = LocalDate.now();
|
|
|
|
+ if ( collegeList!=null&& !collegeList.isEmpty()) {
|
|
|
|
+ for (AdminUserDO college : collegeList) {
|
|
|
|
+ attendanceReqVO.setDate(today);
|
|
|
|
+ List<StudentAttendanceEmailVO> normalList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceListForTeacher(attendanceReqVO),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+ List<StudentAttendanceEmailVO> errorList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceErrorListForTeacher(attendanceReqVO),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+ List<StudentAttendanceEmailVO> excusedList = BeanUtils.toBean(//请假
|
|
|
|
+ studentAttendanceService.getStudentAttendanceExcusedListForTeacher(attendanceReqVO),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ StringBuilder normalListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : normalList) {
|
|
|
|
+ normalListBuilder
|
|
|
|
+ .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
+ .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
+ .append(", 工作间名称: ").append(attendance.getDeptName()!=null?attendance.getDeptName():"无")
|
|
|
|
+ .append(",导师名称:").append(attendance.getSupervisor()!=null ? attendance.getSupervisor():"无" )
|
|
|
|
+ .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.getDeptName()!=null?attendance.getDeptName():"无")
|
|
|
|
+ .append(",导师名称:").append(attendance.getSupervisor()!=null ? attendance.getSupervisor():"无" )
|
|
|
|
+ .append(", 日期: ").append(attendance.getDate())
|
|
|
|
+ .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
+ .append("<br/>");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StringBuilder excusedListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : excusedList) {
|
|
|
|
+ excusedListBuilder
|
|
|
|
+ .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
+ .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
+ .append(", 工作间名称: ").append(attendance.getDeptName()!=null?attendance.getDeptName():"无")
|
|
|
|
+ .append(",导师名称:").append(attendance.getSupervisor()!=null ? attendance.getSupervisor():"无" )
|
|
|
|
+ .append(", 日期: ").append(attendance.getDate())
|
|
|
|
+ .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "请假")
|
|
|
|
+ .append("<br/>");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ templateParams.put("normalList", normalListBuilder.toString());
|
|
|
|
+ templateParams.put("errorList", errorListBuilder.toString());
|
|
|
|
+ templateParams.put("excusedList", excusedListBuilder.toString());
|
|
|
|
+ if (college.getEmail() != null) {
|
|
|
|
+ mailSendService.sendSingleMailToMember(college.getEmail(), null, "attendance-list", templateParams);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
@@ -167,18 +252,18 @@ public class MailTemplateController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @PostMapping("/test")
|
|
|
|
- @Operation(summary = "发送邮件给导师测试")
|
|
|
|
- public void test() {
|
|
|
|
|
|
+ @PostMapping("/testTeacher")
|
|
|
|
+ @Operation(summary = "定时发送邮件给导师")
|
|
|
|
+ public void testTeacher() {
|
|
// 创建结果对象并设置属性
|
|
// 创建结果对象并设置属性
|
|
UserPageReqVO reqVO = new UserPageReqVO();
|
|
UserPageReqVO reqVO = new UserPageReqVO();
|
|
- reqVO.setUserType("3");
|
|
|
|
- List<AdminUserDO> TeacherList = adminUserService.getUserPage(reqVO).getList();//所有老师
|
|
|
|
- StudentAttendancePageReqVO pageReqVO = new StudentAttendancePageReqVO();
|
|
|
|
|
|
+ reqVO.setUserType("3");//找导师
|
|
|
|
+ List<AdminUserDO> TeacherList = adminUserService.getUserList(reqVO);
|
|
|
|
+ StudentAttendancePageReqVO pageReqVO =new StudentAttendancePageReqVO();
|
|
|
|
+ Map<String, Object> templateParams =new HashMap<>();//模板参数设置
|
|
// 获取当前这天
|
|
// 获取当前这天
|
|
LocalDate today = LocalDate.now();
|
|
LocalDate today = LocalDate.now();
|
|
- Map<String, Object> templateParams = new HashMap<>();//模板参数设置
|
|
|
|
- if (TeacherList != null && !TeacherList.isEmpty()) {
|
|
|
|
|
|
+ if ( TeacherList!=null&& !TeacherList.isEmpty()) {
|
|
for (AdminUserDO teacher : TeacherList) {
|
|
for (AdminUserDO teacher : TeacherList) {
|
|
pageReqVO.setDate(today);
|
|
pageReqVO.setDate(today);
|
|
List<StudentAttendanceEmailVO> normalList = BeanUtils.toBean(
|
|
List<StudentAttendanceEmailVO> normalList = BeanUtils.toBean(
|
|
@@ -189,10 +274,14 @@ public class MailTemplateController {
|
|
studentAttendanceService.getStudentAttendanceErrorListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
studentAttendanceService.getStudentAttendanceErrorListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
StudentAttendanceEmailVO.class
|
|
StudentAttendanceEmailVO.class
|
|
);
|
|
);
|
|
|
|
+ List<StudentAttendanceEmailVO> excusedList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceExcusedListForTeacher(pageReqVO.setDeptId(String.valueOf(teacher.getDeptId()))),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
|
|
StringBuilder normalListBuilder = new StringBuilder();
|
|
StringBuilder normalListBuilder = new StringBuilder();
|
|
for (StudentAttendanceEmailVO attendance : normalList) {
|
|
for (StudentAttendanceEmailVO attendance : normalList) {
|
|
- normalListBuilder.append("学生id: ").append(attendance.getId())
|
|
|
|
|
|
+ normalListBuilder
|
|
.append(", 学生姓名: ").append(attendance.getStudentName())
|
|
.append(", 学生姓名: ").append(attendance.getStudentName())
|
|
.append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
.append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
.append(", 日期: ").append(attendance.getDate())
|
|
.append(", 日期: ").append(attendance.getDate())
|
|
@@ -210,13 +299,98 @@ public class MailTemplateController {
|
|
.append("<br/>");
|
|
.append("<br/>");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ StringBuilder excusedListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : excusedList) {
|
|
|
|
+ excusedListBuilder
|
|
|
|
+ .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("normalList", normalListBuilder.toString());
|
|
templateParams.put("errorList", errorListBuilder.toString());
|
|
templateParams.put("errorList", errorListBuilder.toString());
|
|
|
|
+ templateParams.put("excusedList", excusedListBuilder.toString());
|
|
if (teacher.getEmail() != null) {
|
|
if (teacher.getEmail() != null) {
|
|
- mailSendService.sendSingleMailToMember(teacher.getEmail(), teacher.getId(), "attendance-list", templateParams);
|
|
|
|
|
|
+ mailSendService.sendSingleMailToMember(teacher.getEmail(), null, "attendance-list", templateParams);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("/testCollege")
|
|
|
|
+ @Operation(summary = "定时发送邮件给学院")
|
|
|
|
+ public void testCollege() {
|
|
|
|
+ UserPageReqVO reqVO = new UserPageReqVO();
|
|
|
|
+ reqVO.setUserType("4");//找学院
|
|
|
|
+ List<AdminUserDO> collegeList = adminUserService.getUserList(reqVO);
|
|
|
|
+ StudentAttendancePageReqVO attendanceReqVO =new StudentAttendancePageReqVO();
|
|
|
|
+ Map<String, Object> templateParams =new HashMap<>();//模板参数设置
|
|
|
|
+ // 获取当前这天
|
|
|
|
+ LocalDate today = LocalDate.now();
|
|
|
|
+ if ( collegeList!=null&& !collegeList.isEmpty()) {
|
|
|
|
+ for (AdminUserDO college : collegeList) {
|
|
|
|
+ attendanceReqVO.setDate(today);
|
|
|
|
+ List<StudentAttendanceEmailVO> normalList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceListForTeacher(attendanceReqVO),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+ List<StudentAttendanceEmailVO> errorList = BeanUtils.toBean(
|
|
|
|
+ studentAttendanceService.getStudentAttendanceErrorListForTeacher(attendanceReqVO),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+ List<StudentAttendanceEmailVO> excusedList = BeanUtils.toBean(//请假
|
|
|
|
+ studentAttendanceService.getStudentAttendanceExcusedListForTeacher(attendanceReqVO),
|
|
|
|
+ StudentAttendanceEmailVO.class
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ StringBuilder normalListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : normalList) {
|
|
|
|
+ normalListBuilder
|
|
|
|
+ .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
+ .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
+ .append(", 工作间名称: ").append(attendance.getDeptName()!=null?attendance.getDeptName():"无")
|
|
|
|
+ .append(", 导师名称:").append(attendance.getSupervisor()!=null ? attendance.getSupervisor():"无" )
|
|
|
|
+ .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.getDeptName()!=null?attendance.getDeptName():"无")
|
|
|
|
+ .append(", 导师名称:").append(attendance.getSupervisor()!=null ? attendance.getSupervisor():"无" )
|
|
|
|
+ .append(", 日期: ").append(attendance.getDate())
|
|
|
|
+ .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "未打卡")
|
|
|
|
+ .append("<br/>");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StringBuilder excusedListBuilder = new StringBuilder();
|
|
|
|
+ for (StudentAttendanceEmailVO attendance : excusedList) {
|
|
|
|
+ excusedListBuilder
|
|
|
|
+ .append(", 学生姓名: ").append(attendance.getStudentName())
|
|
|
|
+ .append(", 学生学号: ").append(attendance.getUserNumber() != null ? attendance.getUserNumber() : "无")
|
|
|
|
+ .append(", 工作间名称: ").append(attendance.getDeptName()!=null?attendance.getDeptName():"无")
|
|
|
|
+ .append(", 导师名称:").append(attendance.getSupervisor()!=null ? attendance.getSupervisor():"无" )
|
|
|
|
+ .append(", 日期: ").append(attendance.getDate())
|
|
|
|
+ .append(", 打卡时间: ").append(attendance.getClockInTime() != null ? attendance.getClockInTime() : "请假")
|
|
|
|
+ .append("<br/>");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ templateParams.put("normalList", normalListBuilder.toString());
|
|
|
|
+ templateParams.put("errorList", errorListBuilder.toString());
|
|
|
|
+ templateParams.put("excusedList", excusedListBuilder.toString());
|
|
|
|
+ if (college.getEmail() != null) {
|
|
|
|
+ mailSendService.sendSingleMailToMember(college.getEmail(), null, "attendance-list", templateParams);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|