feiyu02
2024-01-26 01eae19a4870033e879a3faa6749eece92926cab
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
@@ -28,6 +28,7 @@
import java.util.*
import javax.servlet.http.HttpServletResponse
import javax.swing.text.DateFormatter
import kotlin.math.sqrt
@Service
class RealTimeDataServiceImpl(
@@ -172,6 +173,10 @@
        return BaseResponse(true, data = DataImportResult(""))
    }
    override fun importJinanData(file: MultipartFile): BaseResponse<DataImportResult> {
        TODO("Not yet implemented")
    }
    override fun outToWorkbook(deviceCode: String, startTime: String, endTime: String): SXSSFWorkbook {
        val sTime = dateFormatter.parse(startTime)
        val eTime = dateFormatter.parse(endTime)
@@ -231,7 +236,7 @@
        return contents
    }
    private fun getOriginData(deviceCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<List<DataVo>> {
    override fun getOriginData(deviceCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<List<DataVo>> {
        val _perPage = perPage ?: 60
        val _page = page ?: 1
        val sTime = startTime?.let { dateFormatter.parse(it) }
@@ -291,7 +296,7 @@
        var count = 0
        val minFormatter = SimpleDateFormat("yyyy-MM-dd HH:mm")
        val averageUtil = AverageUtil<RealTimeDataGrid, RealTimeDataGridMin>({d ->
        val averageUtil = AverageUtil<RealTimeDataGridOpt, RealTimeDataGridMin>({d ->
            minFormatter.format(d.dataTime)
        },{list ->
            list.avg()
@@ -300,8 +305,8 @@
        while (total == -1 || page <= total) {
            println("------均值计算start------")
            val p = PageHelper.startPage<RealTimeDataGrid>(page, 50000)
            val res = realTimeDataGridMapper.selectByExample(Example(RealTimeDataGrid::class.java).apply {
            val p = PageHelper.startPage<RealTimeDataGridOpt>(page, 50000)
            val res = realTimeDataGridOptMapper.selectByExample(Example(RealTimeDataGridOpt::class.java).apply {
                createCriteria().andBetween("dataTime", "2021-06-01 00:00:00", "2021-11-05 00:00:00")
            })
@@ -364,6 +369,7 @@
                    // 单独把原始的H2S乘以系数
                    h2s = d2.values?.get(2)?.factorData?.toFloat()?.times(scaleList[2])
                    h2s = h2s?.let { sqrt(it) * 2 }
                }
                // 更新秒级值