package cn.flightfeather.supervision.lightshare.service.Impl
|
|
import cn.flightfeather.supervision.domain.mapper.OverallEvaluationMapper
|
import cn.flightfeather.supervision.lightshare.service.EvaluationService
|
import org.junit.Test
|
|
import org.junit.Assert.*
|
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.runner.RunWith
|
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.boot.test.context.SpringBootTest
|
import org.springframework.test.context.junit.jupiter.SpringExtension
|
import org.springframework.test.context.junit4.SpringRunner
|
import java.time.Instant
|
import java.time.LocalDate
|
import java.time.LocalDateTime
|
import java.time.ZoneId
|
import java.util.*
|
|
@RunWith(SpringRunner::class)
|
@ExtendWith(SpringExtension::class)
|
@SpringBootTest
|
class EvaluationServiceImplTest {
|
|
@Autowired
|
lateinit var evaluationService: EvaluationService
|
|
@Autowired
|
lateinit var overallEvaluationMapper: OverallEvaluationMapper
|
|
@Test
|
fun getTotalPoints() {
|
val r = evaluationService.getTotalPoints("xB32EtpuxU5bOzq5", 2, "2021-01-01", "2021-04-01",7,"3mbioCjN6XAAHveR",null)
|
println(r)
|
}
|
|
@Test
|
fun getCreditInfo() {
|
val r = evaluationService.getCreditInfo("UwTaWXneBoTby6bH", "2022/10-12")
|
println(r)
|
}
|
|
@Test
|
fun refreshCreditCodeTime() {
|
overallEvaluationMapper.selectAll().forEach {
|
val period = it.oePeriod
|
if (period != null && period.isNotBlank()) {
|
val list1 = period.split("/")
|
val year = list1[0].toInt()
|
val list2 = list1[1].split("-")
|
val sMonth = list2[0].toInt()
|
val eMonth = list2[1].toInt()
|
|
val sTime = LocalDate.of(year, sMonth, 1)
|
val eTime = LocalDate.of(year, eMonth, 1).plusMonths(1).minusDays(1)
|
|
if (it.oeStartTime == null && it.oeEndTime == null) {
|
it.oeStartTime = Date.from(sTime.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())
|
it.oeEndTime = Date.from(eTime.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())
|
overallEvaluationMapper.updateByPrimaryKeySelective(it)
|
}
|
}
|
}
|
}
|
}
|