Bläddra i källkod

for testing email functions

add_swagger
MSI\derek 11 månader sedan
förälder
incheckning
531c778c13
2 ändrade filer med 18 tillägg och 9 borttagningar
  1. +7
    -6
      src/main/java/com/ffii/tsms/modules/common/mail/service/MailReminderService.kt
  2. +11
    -3
      src/main/java/com/ffii/tsms/modules/common/mail/web/MailController.kt

+ 7
- 6
src/main/java/com/ffii/tsms/modules/common/mail/service/MailReminderService.kt Visa fil

@@ -39,7 +39,8 @@ open class MailReminderService(
val teamRepository: TeamRepository
) {
protected val logger: Log = LogFactory.getLog(javaClass)

private val FULLTIME = "FT"
private val PARTTIME = "PT"
private val dateFormat: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")

private fun isSettingsConfigValid(): Boolean {
@@ -118,7 +119,7 @@ open class MailReminderService(
}

val timesheet = timesheetRepository.findByDeletedFalseAndRecordDateBetweenOrderByRecordDate(filteredLastMonthDays.first(),filteredLastMonthDays.last())
val staffs = staffRepository.findAllByEmployTypeAndDeletedFalse("Full Time")
val staffs = staffRepository.findAllByEmployTypeAndDeletedFalse(FULLTIME)
val teams = teamRepository.findAll().filter { team -> team.deleted == false }

for (team in teams) {
@@ -176,7 +177,7 @@ open class MailReminderService(

//get data
val timesheet = timesheetRepository.findByDeletedFalseAndRecordDateBetweenOrderByRecordDate(firstDay, today)
val staffs = staffRepository.findAllByEmployTypeAndDeletedFalse("Full Time")
val staffs = staffRepository.findAllByEmployTypeAndDeletedFalse(FULLTIME)
val teams = teamRepository.findAll().filter { team -> team.deleted == false }

val dateList = generateSequence(firstDay) { it.plusDays(1) }
@@ -267,7 +268,7 @@ open class MailReminderService(
}

val timesheet = timesheetRepository.findByDeletedFalseAndRecordDateBetweenOrderByRecordDate(sevenDaysBefore, fourDaysBefore)
val staffs = staffRepository.findAllByEmployTypeAndDeletedFalse("Full Times") // Full Time? FT? etc
val staffs = staffRepository.findAllByEmployTypeAndDeletedFalse(FULLTIME) // FT? FT? etc
val staffIds: List<Long> = staffs.map { it.id as Long }

val timesheetByIdAndRecord = timesheet.groupBy { it.staff?.id to it.recordDate }
@@ -337,7 +338,7 @@ open class MailReminderService(
val timesheet = timesheetRepository.findByDeletedFalseAndRecordDateBetweenOrderByRecordDate(sevenDaysBefore,fourDaysBefore)
// just getting my own staff record
// change it back later
val staffs = staffRepository.findAllByEmployTypeAndDeletedFalse("Full Times")
val staffs = staffRepository.findAllByEmployTypeAndDeletedFalse(FULLTIME)
val staffIds: List<Long> = staffs.map { it.id as Long }

val timesheetByIdAndRecord = timesheet.groupBy { it.staff?.id to it.recordDate }
@@ -392,7 +393,7 @@ open class MailReminderService(
)
)
// .addTo(InternetAddress(emailAddress))
.addTo(InternetAddress("[email protected]"))
.addTo(InternetAddress(""))
// .addTo(toList)
.addCc(cc)
.addBcc(bcc)


+ 11
- 3
src/main/java/com/ffii/tsms/modules/common/mail/web/MailController.kt Visa fil

@@ -31,8 +31,16 @@ class MailController(
return mailService.saveMail(mailSave)
}

@GetMapping("/test")
fun testMail() {
mailReminderService.sendTimesheetReminderTest()
@GetMapping("/testEveryone")
fun testEveryone() {
mailReminderService.sendTimesheetReminder()
}
@GetMapping("/test7th")
fun test7th() {
mailReminderService.sendTimesheetToTeamLead7TH()
}
@GetMapping("/test15th")
fun test15th() {
mailReminderService.sendTimesheetToTeamLead15TH()
}
}

Laddar…
Avbryt
Spara