| | |
| | | import org.springframework.stereotype.Repository |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.text.SimpleDateFormat |
| | | import java.util.* |
| | | |
| | | /** |
| | | * @author riku |
| | |
| | | } |
| | | |
| | | override fun getDataStreamCount(deviceCode: String, startTime: String?, endTime: String?): Int { |
| | | val sf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss") |
| | | val sf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA) |
| | | val example = Example(DataStream::class.java).apply { |
| | | createCriteria().andEqualTo("obdDeviceCode", deviceCode).run { |
| | | startTime?.let { |
| | |
| | | } |
| | | |
| | | return dataStreamMapper.selectCountByExample(example) |
| | | } |
| | | |
| | | override fun getCoordinate(deviceCode: String): LatLngVo { |
| | | val example = Example(DataStream::class.java).apply { |
| | | createCriteria().andEqualTo("obdDeviceCode", deviceCode).run { |
| | | orderBy("obdDataTime").desc() |
| | | } |
| | | } |
| | | |
| | | //获取最新的一个 |
| | | PageHelper.offsetPage<DataStream>(0, 1) |
| | | val result = dataStreamMapper.selectByExample(example) |
| | | |
| | | val latLngVo = LatLngVo() |
| | | if (result.isNotEmpty()) { |
| | | result[0].let { |
| | | latLngVo.apply { |
| | | this.deviceCode = it.obdDeviceCode |
| | | obdDataTime = it.obdDataTime |
| | | lat = it.obdLat |
| | | lng = it.obdLong |
| | | } |
| | | } |
| | | } |
| | | |
| | | return latLngVo |
| | | } |
| | | |
| | | override fun getLatestDataStream(deviceCode: String): DataStream? { |