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/SupervisionApplicationTests.kt | 92 ++++++++++++++++++++++++++++++++-------------- 1 files changed, 64 insertions(+), 28 deletions(-) diff --git a/src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt b/src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt index 234d137..d2f2bcc 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt @@ -1,8 +1,15 @@ package cn.flightfeather.supervision -import cn.flightfeather.supervision.domain.mapper.ParticipantMapper +import cn.flightfeather.supervision.domain.entity.Evaluation +import cn.flightfeather.supervision.domain.entity.Userinfo +import cn.flightfeather.supervision.domain.enumeration.UserType +import cn.flightfeather.supervision.domain.mapper.* import cn.flightfeather.supervision.lightshare.service.DeviceService +import cn.flightfeather.supervision.lightshare.service.EvaluationService +import cn.flightfeather.supervision.lightshare.service.LedgerService +import cn.flightfeather.supervision.lightshare.service.NotificationService +import cn.flightfeather.supervision.lightshare.vo.NoticeReadStateVo import org.junit.Test import org.junit.jupiter.api.extension.ExtendWith import org.junit.runner.RunWith @@ -10,6 +17,7 @@ import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.junit.jupiter.SpringExtension import org.springframework.test.context.junit4.SpringRunner +import tk.mybatis.mapper.entity.Example @RunWith(SpringRunner::class) @ExtendWith(SpringExtension::class) @@ -22,42 +30,70 @@ @Autowired private lateinit var deviceService: DeviceService + @Autowired + private lateinit var ledgerRecordMapper: LedgerRecordMapper + @Autowired + private lateinit var ledgerService: LedgerService + @Autowired + private lateinit var evaluationMapper: EvaluationMapper + @Autowired + private lateinit var evaluService: EvaluationService + @Autowired + private lateinit var userinfoMapper: UserinfoMapper + @Autowired + private lateinit var notificationService: NotificationService + @Test fun contextLoads() { } -// @Test -// @Throws(Exception::class) -// fun test1() { -// //manager.startServer(args[0]); -// val uuid = UUIDGenerator.generateUUID(4) -// print(uuid) -// } -// -// @Test -// fun foo1() { -// val json = "{\"msgType\": 1, \"msgVoList\": [{\"time\": 2019-11-12}, {\"time\": 2019-11-13}]}" -// val m = GsonJsonParser().parseMap(json) -// } -// -// @Test -// fun foo2() { -// val r = participantMapper.selectAsUserInfo("qwDEAdhNPvQh0yEp", "BfKQclliGvfKc91i") -// println(r) -// } -// -// @org.junit.Test -// fun fetchData() { -// fetchController.run() -//// val read = BufferedReader(InputStreamReader(System.`in`)) -//// val s = read.readLine() -// } - @Test fun foo3() { val l = deviceService.getLatestHourValue("nVMiV6i1UvLqahOc") println(l) } + @Test + fun foo4() { + val timeList = listOf("2023-06-01","2023-07-01","2023-08-01") + val lList = listOf("ziYYMBiyZiKCj3Kw","bAdaVtgd8HF6NLAc","b9qhmvqYgXIVsGZS") + val timeList2 = listOf("2023/6-6","2023/7-7 ","2023/8-8") + val lList2 = listOf("h3s6FvnHoEizF0xp","WpZnJupKfZ8ovw1P","uUddc0pOrkaFgRFq") + userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { + createCriteria().andEqualTo("usertypeid", UserType.Enterprise.value) + .andIsNotNull("uiLoginTime") + and(createCriteria().orIsNull("workno").orNotEqualTo("workno", "test")) + }).forEach { + it ?: return@forEach + it.guid ?: return@forEach + it.extension2 ?: return@forEach + for (y in timeList.indices) { + val t = timeList[y] + val l1 = ledgerService.getUserLedgerSummary(it.guid!!, it.extension2!!.toInt(), t) + for (i in l1.indices) { + if (l1[i].upLoad && l1[i].involved) { + notificationService.updateReadState(it.guid!!, listOf(NoticeReadStateVo(lList[y], + hasRead = true, + hasSigned = true))) + break + } + } + } + for (y in timeList2.indices) { + val t = timeList2[y] + val l = evaluationMapper.selectByExample(Example(Evaluation::class.java).apply { + createCriteria().andEqualTo("evaluatorguid", it.guid) + .andEqualTo("scensename", t) + }) + if (l.isNotEmpty()) { + notificationService.updateReadState(it.guid!!, listOf(NoticeReadStateVo(lList2[y], + hasRead = true, + hasSigned = true))) + } + } + println("") + } + } + } -- Gitblit v1.9.3