|
@@ -115,7 +115,29 @@ open class MailReminderService( |
|
|
mailService.send(mailRequestList) |
|
|
mailService.send(mailRequestList) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// @Scheduled(cron = "0 0 6 7 * ?") // (SS/MM/HH/DD/MM/YY) |
|
|
|
|
|
|
|
|
private fun createEmailRequestWithAdditionalInfo(content: String, emailTo: List<String>, info: String) { |
|
|
|
|
|
val subject = settingsService.findByName(SettingNames.TIMESHEET_MAIL_SUBJECT).orElseThrow().value |
|
|
|
|
|
val template = settingsService.findByName(SettingNames.TIMESHEET_MAIL_TEMPLATE).orElseThrow().value |
|
|
|
|
|
val cc = settingsService.findByName(SettingNames.TIMESHEET_MAIL_CC).orElseThrow().value.split(",") |
|
|
|
|
|
val bcc = settingsService.findByName(SettingNames.TIMESHEET_MAIL_BCC).orElseThrow().value.split(",") |
|
|
|
|
|
val mailRequest = MailRequest.Builder() |
|
|
|
|
|
.subject("<$info> $subject") |
|
|
|
|
|
.templateContent(template) |
|
|
|
|
|
.args( |
|
|
|
|
|
mapOf( |
|
|
|
|
|
Pair("date", content), |
|
|
|
|
|
) |
|
|
|
|
|
) |
|
|
|
|
|
.addTo(emailTo) |
|
|
|
|
|
.addCc(cc) |
|
|
|
|
|
.addBcc(bcc) |
|
|
|
|
|
.build() |
|
|
|
|
|
val mailRequestList = mutableListOf<MailRequest>() |
|
|
|
|
|
mailRequestList += mailRequest |
|
|
|
|
|
mailService.send(mailRequestList) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 6 7 * ?") // (SS/MM/HH/DD/MM/YY) |
|
|
open fun sendTimesheetToTeamLead7TH() { |
|
|
open fun sendTimesheetToTeamLead7TH() { |
|
|
logger.info("-----------------------") |
|
|
logger.info("-----------------------") |
|
|
logger.info("Scheduled Start: 7th email reminder") |
|
|
logger.info("Scheduled Start: 7th email reminder") |
|
@@ -244,7 +266,8 @@ open class MailReminderService( |
|
|
.filter { it.missingDates.isNotEmpty() } |
|
|
.filter { it.missingDates.isNotEmpty() } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 6 7 * ?") // (SS/MM/HH/DD/MM/YY) |
|
|
|
|
|
|
|
|
// This function will send email to team lead with cumulative record, fallback to v1 |
|
|
|
|
|
// @Scheduled(cron = "0 0 6 7 * ?") // (SS/MM/HH/DD/MM/YY) |
|
|
open fun sendMissingTimesheetDateToTeamLead7th(){ |
|
|
open fun sendMissingTimesheetDateToTeamLead7th(){ |
|
|
logger.info("-----------------------") |
|
|
logger.info("-----------------------") |
|
|
logger.info("Scheduled Start: 7th email reminder V2") |
|
|
logger.info("Scheduled Start: 7th email reminder V2") |
|
@@ -733,6 +756,15 @@ open class MailReminderService( |
|
|
} |
|
|
} |
|
|
println(fullLog) |
|
|
println(fullLog) |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
open fun testEmail() { |
|
|
|
|
|
logger.info("-----------------------") |
|
|
|
|
|
logger.info("Test Email Reminder: Email name and cc") |
|
|
|
|
|
|
|
|
|
|
|
val intro = StringBuilder("Jason, Staffs Missing Timesheet in the Table Below: \n") |
|
|
|
|
|
val emailContent = intro |
|
|
|
|
|
val receiver = listOf("[email protected]") |
|
|
|
|
|
createEmailRequestWithAdditionalInfo(emailContent.toString(), receiver, "Group") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |