|
@@ -39,7 +39,8 @@ open class MailReminderService( |
|
|
val teamRepository: TeamRepository |
|
|
val teamRepository: TeamRepository |
|
|
) { |
|
|
) { |
|
|
protected val logger: Log = LogFactory.getLog(javaClass) |
|
|
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 val dateFormat: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") |
|
|
|
|
|
|
|
|
private fun isSettingsConfigValid(): Boolean { |
|
|
private fun isSettingsConfigValid(): Boolean { |
|
@@ -118,7 +119,7 @@ open class MailReminderService( |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
val timesheet = timesheetRepository.findByDeletedFalseAndRecordDateBetweenOrderByRecordDate(filteredLastMonthDays.first(),filteredLastMonthDays.last()) |
|
|
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 } |
|
|
val teams = teamRepository.findAll().filter { team -> team.deleted == false } |
|
|
|
|
|
|
|
|
for (team in teams) { |
|
|
for (team in teams) { |
|
@@ -176,7 +177,7 @@ open class MailReminderService( |
|
|
|
|
|
|
|
|
//get data |
|
|
//get data |
|
|
val timesheet = timesheetRepository.findByDeletedFalseAndRecordDateBetweenOrderByRecordDate(firstDay, today) |
|
|
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 teams = teamRepository.findAll().filter { team -> team.deleted == false } |
|
|
|
|
|
|
|
|
val dateList = generateSequence(firstDay) { it.plusDays(1) } |
|
|
val dateList = generateSequence(firstDay) { it.plusDays(1) } |
|
@@ -267,7 +268,7 @@ open class MailReminderService( |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
val timesheet = timesheetRepository.findByDeletedFalseAndRecordDateBetweenOrderByRecordDate(sevenDaysBefore, fourDaysBefore) |
|
|
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 staffIds: List<Long> = staffs.map { it.id as Long } |
|
|
|
|
|
|
|
|
val timesheetByIdAndRecord = timesheet.groupBy { it.staff?.id to it.recordDate } |
|
|
val timesheetByIdAndRecord = timesheet.groupBy { it.staff?.id to it.recordDate } |
|
@@ -337,7 +338,7 @@ open class MailReminderService( |
|
|
val timesheet = timesheetRepository.findByDeletedFalseAndRecordDateBetweenOrderByRecordDate(sevenDaysBefore,fourDaysBefore) |
|
|
val timesheet = timesheetRepository.findByDeletedFalseAndRecordDateBetweenOrderByRecordDate(sevenDaysBefore,fourDaysBefore) |
|
|
// just getting my own staff record |
|
|
// just getting my own staff record |
|
|
// change it back later |
|
|
// 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 staffIds: List<Long> = staffs.map { it.id as Long } |
|
|
|
|
|
|
|
|
val timesheetByIdAndRecord = timesheet.groupBy { it.staff?.id to it.recordDate } |
|
|
val timesheetByIdAndRecord = timesheet.groupBy { it.staff?.id to it.recordDate } |
|
@@ -392,7 +393,7 @@ open class MailReminderService( |
|
|
) |
|
|
) |
|
|
) |
|
|
) |
|
|
// .addTo(InternetAddress(emailAddress)) |
|
|
// .addTo(InternetAddress(emailAddress)) |
|
|
.addTo(InternetAddress("[email protected]")) |
|
|
|
|
|
|
|
|
.addTo(InternetAddress("")) |
|
|
// .addTo(toList) |
|
|
// .addTo(toList) |
|
|
.addCc(cc) |
|
|
.addCc(cc) |
|
|
.addBcc(bcc) |
|
|
.addBcc(bcc) |
|
|