From 196bb14112448857a885e32dc4149e308e00b01a Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 15 八月 2024 11:57:15 +0800
Subject: [PATCH] 2024.8.15 各项修正

---
 src/test/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationServiceImplTest.kt |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationServiceImplTest.kt b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationServiceImplTest.kt
index 5c82ec9..4b056e6 100644
--- a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationServiceImplTest.kt
+++ b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationServiceImplTest.kt
@@ -1,5 +1,6 @@
 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
 
@@ -10,6 +11,11 @@
 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)
@@ -19,6 +25,9 @@
     @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)
@@ -27,7 +36,30 @@
 
     @Test
     fun getCreditInfo() {
-        val r = evaluationService.getCreditInfo("UwTaWXneBoTby6bH")
+        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)
+                }
+            }
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3