|
|
@@ -37,14 +37,14 @@ open class EscalationLogService( |
|
|
|
|
|
|
|
open fun getLogsByUser(): List<EscalationLogInfo> { |
|
|
|
val user = SecurityUtils.getUser().orElseThrow() |
|
|
|
val logs = user.id?.let { escalationLogRepository.findAllInfoByDeletedFalseAndPersonInChargeIdIs(it) } ?: listOf() |
|
|
|
val logs = user.id?.let { escalationLogRepository.findAllInfoByDeletedFalseAndHandlerIdIs(it) } ?: listOf() |
|
|
|
return logs |
|
|
|
} |
|
|
|
|
|
|
|
open fun saveEscalationLog(request: SaveEscalationLogRequest): SaveEscalationLogResponse{ |
|
|
|
val escalationLog = request.id?.let { escalationLogRepository.findById(it).getOrNull() } ?: EscalationLog() |
|
|
|
val personInCharge = request.personInChargeId.let { userService.getUserById(it) } |
|
|
|
if (personInCharge == null && escalationLog.personInCharge == null) { |
|
|
|
val handler = request.handlerId.let { userService.getUserById(it) } |
|
|
|
if (handler == null && escalationLog.handler == null) { |
|
|
|
throw NoSuchElementException("Person In Charge is null."); |
|
|
|
} |
|
|
|
|
|
|
@@ -57,7 +57,7 @@ open class EscalationLogService( |
|
|
|
val status = request.status.let { status -> EscalationLogStatus.entries.find{ it.value == status} } |
|
|
|
|
|
|
|
escalationLog.apply { |
|
|
|
this.personInCharge = personInCharge |
|
|
|
this.handler = handler |
|
|
|
type = request.type |
|
|
|
this.stockInLine = stockInLine |
|
|
|
this.stockOutLine = stockOutLine |
|
|
@@ -73,10 +73,10 @@ open class EscalationLogService( |
|
|
|
id = it.id, |
|
|
|
stockInLineId = it.stockInLine?.id, |
|
|
|
stockOutLineId = it.stockOutLine?.id, |
|
|
|
personInChargeId = it.personInCharge?.id, |
|
|
|
personInChargeName = it.personInCharge?.name, |
|
|
|
personInChargeTitle = it.personInCharge?.title, |
|
|
|
personInChargeDepartment = it.personInCharge?.department, |
|
|
|
handlerId = it.handler?.id, |
|
|
|
handlerName = it.handler?.name, |
|
|
|
handlerTitle = it.handler?.title, |
|
|
|
handlerDepartment = it.handler?.department, |
|
|
|
recordDate = it.recordDate, |
|
|
|
status = it.status?.value, |
|
|
|
reason = it.reason, |
|
|
|