| | |
| | | import java.util.* |
| | | import javax.servlet.http.HttpServletResponse |
| | | import javax.swing.text.DateFormatter |
| | | import kotlin.math.sqrt |
| | | |
| | | @Service |
| | | class RealTimeDataServiceImpl( |
| | |
| | | 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) } |
| | |
| | | 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() |
| | |
| | | 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") |
| | | }) |
| | | |
| | |
| | | |
| | | // 单独把原始的H2S乘以系数 |
| | | h2s = d2.values?.get(2)?.factorData?.toFloat()?.times(scaleList[2]) |
| | | h2s = h2s?.let { sqrt(it) * 2 } |
| | | } |
| | | |
| | | // 更新秒级值 |