From 306ca22e966c0dc25841dcb7bd3db9db7c013bd9 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 17 十一月 2021 14:34:39 +0800 Subject: [PATCH] 1. 网格化数据优化 --- src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt | 40 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 39 insertions(+), 1 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt index 301ccbe..30e9a0b 100644 --- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt +++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt @@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream import java.text.SimpleDateFormat import java.time.LocalDateTime +import java.time.ZoneId import java.time.format.DateTimeFormatter import java.util.* import javax.servlet.http.HttpServletResponse @@ -319,6 +320,43 @@ } override fun dataCalibration(): BaseResponse<String> { - return BaseResponse(true) + var page = 1 + var total = -1 + var count = 0 + + println("------鏁版嵁浼樺寲start------") + while (total == -1 || page <= total) { + val p = PageHelper.startPage<RealTimeDataGrid>(page, 50000) + val dataList1 = realTimeDataGridMapper.selectByExample(Example(RealTimeDataGrid::class.java).apply { + createCriteria().andBetween("dataTime", "2021-06-19 00:00:00", "2021-10-21 00:00:00") + }) + val res = getOriginData("0d0000000001", "2021-06-19 00:00:00", "2021-10-21 00:00:00", page, 50000) + val dataList2 = res.data ?: emptyList() + + total = p.pages + + if (page == 1) { + println("鎬婚〉鏁帮細$total") + } + println("褰撳墠椤垫暟锛�$page") + + for (i in dataList1.indices) { + if (i >= dataList2.size) break + val d1 = dataList1[i] + val d2 = dataList2[i] + // 鍒ゆ柇灏忔椂 + val h = LocalDateTime.ofInstant(d1.dataTime?.toInstant(), ZoneId.systemDefault()).hour + val scale = + // 鍚勯澶勭悊鍚庣殑鍥犲瓙锛堥櫎H2S锛変箻绯绘暟 + // 鍗曠嫭鎶婂師濮嬬殑H2S涔樹互绯绘暟 + // 鏇存柊绉掔骇鍊� + } +// val result = epwDataPrep.mDataPrep2(dataList) +// count += airDataRepository.savePrepData2(result) + + page++ + } + + return BaseResponse(count > 0, data = "鎻掑叆鏁版嵁: ${count}鏉�") } } \ No newline at end of file -- Gitblit v1.9.3