feiyu02
2024-08-15 196bb14112448857a885e32dc4149e308e00b01a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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)
                }
            }
        }
    }
}