package com.flightfeather.uav.model.epw
|
|
import com.flightfeather.uav.lightshare.bean.CompanySOP
|
import com.flightfeather.uav.lightshare.bean.DataVo
|
import com.flightfeather.uav.model.BaseEffect
|
import com.flightfeather.uav.model.BaseSection
|
import com.flightfeather.uav.model.BaseTag
|
import com.flightfeather.uav.model.TimeTag
|
|
/**
|
* 时段分类统计
|
* [6,9,12,14,17,20]; [6,9)为早上,之后依次为上午,中午,下午,傍晚和晚上
|
*/
|
class TimeSection : BaseSection<DataVo, CompanySOP>() {
|
|
override val sectionValues: List<Double> = listOf(6.0, 9.0, 12.0, 14.0, 17.0, 20.0)
|
|
override val sectionType: List<String> = listOf("凌晨", "早上", "上午", "中午", "下午", "傍晚", "夜间")
|
|
override val tagClz: Class<out BaseTag> = TimeTag::class.java
|
|
override val constType: List<String> = listOf("综合")
|
|
override fun onSectionValue(mData: DataVo, sop: CompanySOP, effect: BaseEffect): Double {
|
return getHour(mData.time!!)
|
}
|
|
private fun getHour(time: String): Double {
|
return if (time.length >= 13) {
|
time.substring(11, 13).toDoubleOrNull() ?: 0.0
|
} else {
|
0.0
|
}
|
}
|
}
|