加入離開成員篩選
This commit is contained in:
parent
21eac9a417
commit
85e0c18115
@ -32,6 +32,8 @@ fun Application.configureMemberRecordRouting() {
|
||||
}
|
||||
post("/{id}") {
|
||||
val id = call.parameters.getOrFail<String>("id")
|
||||
val now = Calendar.getInstance()
|
||||
|
||||
val record = call.receive<MemberRecord>()
|
||||
val member = MemberService.findById(id) ?: run {
|
||||
call.respond(HttpStatusCode.NotFound)
|
||||
@ -86,26 +88,37 @@ fun Application.configureMemberRecordRouting() {
|
||||
}
|
||||
}
|
||||
|
||||
fun getData(year: Int, month: Int, day: Int): List<RecordData> {
|
||||
fun getDayStartLong(year: Int, month: Int, day: Int): Long {
|
||||
val calendar = Calendar.getInstance().apply {
|
||||
set(Calendar.YEAR, year)
|
||||
set(Calendar.MONTH, month)
|
||||
set(Calendar.DAY_OF_MONTH, day)
|
||||
}
|
||||
val startTime = calendar.apply {
|
||||
return calendar.apply {
|
||||
set(Calendar.HOUR_OF_DAY, 5)
|
||||
set(Calendar.MINUTE, 0)
|
||||
set(Calendar.SECOND, 0)
|
||||
set(Calendar.MILLISECOND, 0)
|
||||
}.timeInMillis
|
||||
val endTime = startTime + 86399000L
|
||||
}
|
||||
|
||||
fun getDayEndLong(year: Int, month: Int, day: Int): Long {
|
||||
val startTime = getDayStartLong(year, month, day)
|
||||
return startTime + 86399000L
|
||||
}
|
||||
|
||||
fun getData(year: Int, month: Int, day: Int): List<RecordData> {
|
||||
val startTime = getDayStartLong(year, month, day)
|
||||
val endTime = getDayEndLong(year, month, day)
|
||||
// Show a list of articles
|
||||
val records = ArrayList<RecordData>()
|
||||
val memberList = MemberService.findAll()
|
||||
memberList.forEach { member ->
|
||||
records.add(
|
||||
RecordData(member = member, MemberRecord())
|
||||
)
|
||||
if (member.createAt!! < startTime && !member.leave) {
|
||||
records.add(
|
||||
RecordData(member = member, MemberRecord())
|
||||
)
|
||||
}
|
||||
}
|
||||
val recordList = MemberRecordService.findByTimeBetween(startTime, endTime)
|
||||
recordList.forEach { record ->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user