From 3a7da032ec18b2d5d36afb3fd9622c7d763257b7 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期三, 17 十一月 2021 13:05:06 +0800 Subject: [PATCH] 1. 将用电量接口返回的参数动态化 --- src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt | 30 +++++++++++++++++++++++------- 1 files changed, 23 insertions(+), 7 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 0336692..301ccbe 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 @@ -40,7 +40,7 @@ private var dateFormatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm") private val fileExchange = FileExchange() - override fun getSecondData(deviceCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<List<DataVo>> { + override fun getSecondData(deviceCode: String?, startTime: String?, endTime: String?, type: Int?, page: Int?, perPage: Int?): BaseResponse<List<DataVo>> { val _perPage = perPage ?: 60 val _page = page ?: 1 val sTime = startTime?.let { dateFormatter.parse(it) } @@ -68,12 +68,24 @@ pages = pageInfo.pages } UWDeviceType.GRID -> { - val pageInfo = PageHelper.startPage<RealTimeDataGrid>(_page, _perPage) - realTimeDataGridMapper.selectByExample(Example(RealTimeDataGrid::class.java).apply { - getSecondDataExample(this, deviceCode, sTime, eTime) - }).forEach { result.add(it.toDataVo()) } - pageNum = pageInfo.pageNum - pages = pageInfo.pages + // 缃戞牸鍖栫洃娴嬬绾у�� + if (type == null || type == 0) { + val pageInfo = PageHelper.startPage<RealTimeDataGrid>(_page, _perPage) + realTimeDataGridMapper.selectByExample(Example(RealTimeDataGrid::class.java).apply { + getSecondDataExample(this, deviceCode, sTime, eTime) + }).forEach { result.add(it.toDataVo()) } + pageNum = pageInfo.pageNum + pages = pageInfo.pages + } + // 缃戞牸鍖栫洃娴嬪垎閽熷�� + else if (type == 1) { + val pageInfo = PageHelper.startPage<RealTimeDataGridMin>(_page, _perPage) + realTimeDataGridMinMapper.selectByExample(Example(RealTimeDataGridMin::class.java).apply { + getSecondDataExample(this, deviceCode, sTime, eTime) + }).forEach { result.add(it.toDataVo()) } + pageNum = pageInfo.pageNum + pages = pageInfo.pages + } } else -> { // 浠庡師濮嬫暟鎹〃涓幏鍙栨暟鎹� @@ -305,4 +317,8 @@ return BaseResponse(count > 0, data = "鎻掑叆鏁版嵁: ${count}鏉�") } + + override fun dataCalibration(): BaseResponse<String> { + return BaseResponse(true) + } } \ No newline at end of file -- Gitblit v1.9.3