From 34961791ca6d802f7bb8055b16771c9d00057f67 Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期二, 10 十二月 2024 10:51:42 +0800 Subject: [PATCH] 1. 新增后台任务状态类的自定义序列化类 (解决解决BgTaskStatus类中计算属性runTime无法序列化的问题)2. 新增LocalDateTime类型的时间格式序列化和反序列化类 (解决BgTaskStatus类中LocalDateTime类型无法序列化为正确的时间格式问题) --- src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt | 62 ++++++++++++++++++++++++++++-- 1 files changed, 57 insertions(+), 5 deletions(-) diff --git a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt index 4c910ba..568eb3d 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt @@ -1,24 +1,34 @@ package cn.flightfeather.supervision.lightshare.service.impl import cn.flightfeather.supervision.SupervisionApplication +import cn.flightfeather.supervision.domain.ds1.entity.Subtask +import cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper import cn.flightfeather.supervision.lightshare.service.SearchService import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo import org.junit.Test +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.SpringJUnit4ClassRunner +import org.springframework.test.context.junit4.SpringRunner +import tk.mybatis.mapper.entity.Example import java.time.LocalDateTime import java.time.ZoneId import java.util.* -@RunWith(SpringJUnit4ClassRunner::class) -@SpringBootTest(classes = [SupervisionApplication::class]) +@RunWith(SpringRunner::class) +@ExtendWith(SpringExtension::class) +@SpringBootTest class SearchServiceImplTest { @Autowired lateinit var searchService: SearchService + + @Autowired + lateinit var subtaskMapper: SubtaskMapper @Test fun getExcel() { @@ -26,9 +36,51 @@ val localTimeE = LocalDateTime.of(2021, 3, 31, 23, 59, 59) val sD = Date.from(localTimeS.atZone(ZoneId.systemDefault()).toInstant()) val eD = Date.from(localTimeE.atZone(ZoneId.systemDefault()).toInstant()) + + val mode = 9 + //閲戝北2022骞�6鏈� searchService.writeToFile(ExcelConfigVo( - "EPnTo3hoOWZXAU33", - sD, eD, "31", "3100", "310104", null, 5, null, null, null - )) + "0kG5dblu1uPqo8qW", + districtCode = "310106", +// townCode = "310116113", + sceneType = 1), mode) + //閲戝北2021骞�3鏈� +// searchService.writeToFile(ExcelConfigVo("o7jdSzr79fe0NH3I", districtCode = "310116", sceneType = 1)) + } + + @Test + fun getDailyReport() { + val cal = Calendar.getInstance() + cal.set(2022, 10, 2, 0, 0, 0) + cal.set(Calendar.MILLISECOND, 0) + val sDate = cal.time + cal.add(Calendar.DAY_OF_MONTH, 1) + val eDate = cal.time + val r = searchService.getDailyReport(ExcelConfigVo(districtCode = "310116", startTime = sDate, endTime = eDate)) + println(r) + } + + @Test + fun foo1() { + val cal = Calendar.getInstance() + cal.set(2022, 10, 2, 0, 0, 0) + cal.set(Calendar.MILLISECOND, 0) + val sDate = cal.time + cal.add(Calendar.DAY_OF_MONTH, 1) + val eDate = cal.time + val config = ExcelConfigVo(districtCode = "310116", startTime = sDate, endTime = eDate) + + val r = subtaskMapper.selectByExample(Example(Subtask::class.java).apply { + createCriteria().apply { + if (config.subTaskIdList?.isNotEmpty() == true) { + andIn("stguid", config.subTaskIdList) + } + config.startTime?.let { andEqualTo("planstarttime", it) } +// config.endTime?.let { andLessThanOrEqualTo("planendtime", it) } + config.districtCode?.let { andEqualTo("districtcode", it) } +// andEqualTo("tguid", config.topTaskGuid) + } + }) + println(r) } } \ No newline at end of file -- Gitblit v1.9.3