customer information aspect

This commit is contained in:
Bossanyi Tibor
2020-06-01 09:49:12 +02:00
parent 7ef6f50c3b
commit 070acf4e47
4 changed files with 43 additions and 2 deletions
@@ -12,7 +12,10 @@ import java.time.LocalDateTime
class CustomerInformationController( private val customerInformationRepository: CustomerInformationRepository ) {
@GetMapping("/customer_information")
fun getCustomerInformation(dateTime: String): List<CustomerInformation> =
customerInformationRepository.findByDisplayBeginLessThanAndDisplayEndGreaterThan(dateTime, dateTime )
fun getCustomerInformation(): List<CustomerInformation> {
val dateTime: String = LocalDateTime.now().toString()
return customerInformationRepository.findByDisplayBeginLessThanAndDisplayEndGreaterThan(dateTime, dateTime )
}
}
@@ -0,0 +1,35 @@
package com.aitrainer.api.controller
import com.aitrainer.api.ApiApplication
import com.aitrainer.api.repository.ConfigurationRepository
import org.aspectj.lang.annotation.Aspect
import org.aspectj.lang.annotation.Before
import org.aspectj.lang.annotation.Pointcut
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
@Aspect
@Component
@Suppress("unused")
class CustomerInformationControllerAspect {
private val logger = LoggerFactory.getLogger(ApiApplication::class.simpleName)
@Autowired
private lateinit var configurationRepository: ConfigurationRepository
@Autowired
private lateinit var properties: ApplicationProperties
@Suppress("unused")
@Pointcut("execution(* com.aitrainer.api.controller.CustomerInformationController.*())")
fun customerInformationAspect() {
}
@Suppress("unused")
@Before("customerInformationAspect()")
fun dbCheckAop() {
Singleton.checkDBUpdate(configurationRepository, properties)
}
}