From 53ce8de426561e7a43847afda23b5e24e6f76c4e Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 19 一月 2026 17:29:55 +0800
Subject: [PATCH] 2026.1.19 1. 新增可配置的台账提交期限 2. 新增可配置的自巡查承诺
---
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/DeviceServiceImpl.kt | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 155 insertions(+), 5 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/DeviceServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/DeviceServiceImpl.kt
index 67a4645..defc570 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/DeviceServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/DeviceServiceImpl.kt
@@ -21,7 +21,11 @@
val baseInfoMapper: BaseInfoMapper,
val deviceInfoMapper: DeviceInfoMapper,
val vocHourValueMapper: VOCHourValueMapper,
- val userinfoMapper: UserinfoMapper
+ val userinfoMapper: UserinfoMapper,
+ val hourDustDataMapper: HourDustDataMapper,
+ val lampDeviceDataMapper: LampDeviceDataMapper,
+ val lampEnterBaseInfoMapper: LampEnterBaseInfoMapper,
+ val vocPurifyDeviceMapper: VocPurifyDeviceMapper
) : DeviceService {
override fun getPurifyDeviceInfo(userId: String): List<FumePurifyDevice> {
@@ -71,7 +75,7 @@
})?.takeIf { it.isNotEmpty() }?.get(0)?.let {
when (it.diSceneTypeId) {
SceneType.Restaurant.value -> {
- PageHelper.startPage<FumeMinuteValue>(1, 1)
+ PageHelper.startPage<FumeMinuteValue>(1, 15)
val latest = fumeMinuteValueMapper.selectByExample(Example(FumeMinuteValue::class.java).apply {
createCriteria().andEqualTo("mvStatCode", mn)
orderBy("mvDataTime").desc()
@@ -242,23 +246,169 @@
override fun getRealTimeData(page: Int, perPage: Int): BaseResponse<List<DataVo>> {
val deviceList = mutableListOf<String>()
+ val deviceMap = mutableMapOf<String, Pair<String?, String?>>()
+ val deviceInfoList = deviceInfoMapper.selectAll()
baseInfoMapper.selectByExample(Example(BaseInfo::class.java).apply {
createCriteria().andIsNotNull("biExtension2")
.andNotEqualTo("biExtension2", "")
orderBy("biExtension2")
}).forEach {
+ val device = deviceInfoList.find { d-> it.biExtension2 == d?.diCode }
deviceList.add(it.biExtension2)
+ deviceMap[it.biExtension2] = Pair(it.biName, device?.diSupplier)
}
val resultList = mutableListOf<DataVo>()
val p = PageHelper.startPage<FumeMinuteValue>(page, perPage)
fumeMinuteValueMapper.getRealTimeData().forEach {
resultList.add(DataVo(
- DateUtil.DateToString(it.mvDataTime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM),
- if (it.mvFumeConcentration < 0) it.mvFumeConcentration2 else it.mvFumeConcentration,
- it.mvStatCode
+ DateUtil.DateToString(it.mvDataTime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM),
+ if (it.mvFumeConcentration < 0) it.mvFumeConcentration2 else it.mvFumeConcentration,
+ it.mvStatCode,
+ deviceMap[it.mvStatCode]?.first,
+ deviceMap[it.mvStatCode]?.second,
))
}
return BaseResponse(true, head = DataHead(p.pageNum, p.pages), data = resultList)
}
+
+ override fun getJingAnDustHourValue(userId: String, startTime: String?, endTime: String?): List<DataVo> {
+ val result = mutableListOf<DataVo>()
+ val baseInfo = baseInfoMapper.selectByPrimaryKey(userId)
+ val sT = startTime?.let { DateUtil.StringToDate(it) }
+ val eT = endTime?.let { DateUtil.StringToDate(it) }
+
+ if (baseInfo != null) {
+ val mn = baseInfo.biExtension2
+ if (!mn.isNullOrBlank()) {
+ if (sT == null || eT == null) {
+ PageHelper.startPage<HourDustData>(1, 60)
+ }
+ hourDustDataMapper.selectByExample(Example(HourDustData::class.java).apply {
+ createCriteria().andEqualTo("mncode", mn)
+ .apply {
+ sT?.let {
+ andGreaterThanOrEqualTo("lst", sT)
+ }
+ eT?.let {
+ andLessThanOrEqualTo("lst", eT)
+ }
+ }
+ orderBy("mvDataTime").desc()
+ }).map {
+ DataVo(DateUtil.DateToString(it?.lst, DateUtil.DateStyle.YYYY_MM_DD_HH_MM), it?.dustvalue ?: 0.0, it?.mncode)
+ }.also {
+ result.addAll(it.asReversed())
+ }
+ }
+ }
+
+ return result
+ }
+
+ override fun getJingAnFumeValue(userId: String, startTime: String?, endTime: String?): List<DataVo> {
+ val result = mutableListOf<DataVo>()
+ val baseInfo = baseInfoMapper.selectByPrimaryKey(userId)
+ val sT = startTime?.let { DateUtil.StringToDate(it) }
+ val eT = endTime?.let { DateUtil.StringToDate(it) }
+
+ if (baseInfo != null) {
+ val mn = baseInfo.biExtension2
+ if (!mn.isNullOrBlank()) {
+ if (sT == null || eT == null) {
+ PageHelper.startPage<LampDeviceData>(1, 60)
+ }
+ lampDeviceDataMapper.selectByExample(Example(LampDeviceData::class.java).apply {
+ createCriteria().andEqualTo("enterId", mn)
+ .apply {
+ sT?.let {
+ andGreaterThanOrEqualTo("monitorTime", sT)
+ }
+ eT?.let {
+ andLessThanOrEqualTo("monitorTime", eT)
+ }
+ }
+ orderBy("monitorTime").desc()
+ }).map {
+ DataVo(DateUtil.DateToString(it?.monitorTime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM), it?.lampblackValue ?: 0.0, it?.deviceCode)
+ }.also {
+ result.addAll(it.asReversed())
+ }
+ }
+ }
+
+ return result
+ }
+
+ override fun getDeviceInfo(userId: String) {
+ val userInfo = userinfoMapper.selectByPrimaryKey(userId)
+ val baseInfo = baseInfoMapper.selectByPrimaryKey(userId)
+ if (baseInfo?.biExtension2?.isNotBlank() == true) {
+ when (userInfo?.extension2) {
+ SceneType.Restaurant.value.toString() -> {
+ val lamp = lampEnterBaseInfoMapper.selectByPrimaryKey(baseInfo.biExtension2)
+ }
+ SceneType.Construction.value.toString(),
+ SceneType.Wharf.value.toString(),
+ SceneType.StorageYard.value.toString(),
+ SceneType.MixingPlant.value.toString(),
+ SceneType.Industrial.value.toString(),
+ SceneType.VehicleRepair.value.toString()->{
+
+ }
+ }
+ }
+ }
+
+ override fun saveFumePurifyDevice(info: FumePurifyDevice): Int {
+ // TODO: 2023/3/20 not yet implemented
+ return 0
+ }
+
+ override fun updateFumePurifyDevice(info: FumePurifyDevice): Int {
+ // TODO: 2023/3/20 not yet implemented
+ return 0
+ }
+
+ override fun saveMonitorDevice(info: MonitorDevice): Int {
+ // TODO: 2023/3/20 not yet implemented
+ return 0
+ }
+
+ override fun updateMonitorDevice(info: MonitorDevice): Int {
+ // TODO: 2023/3/20 not yet implemented
+ return 0
+ }
+
+ override fun saveVOCPurifyDevice(userId: String, infoList: List<VocPurifyDevice>): Int {
+ var res = 0
+ val infoList2 = mutableListOf<VocPurifyDevice>().apply { addAll(infoList) }
+ vocPurifyDeviceMapper.selectByExample(Example(VocPurifyDevice::class.java).apply {
+ createCriteria().andEqualTo("ibGuid", userId)
+ }).forEach { d ->
+ val info = infoList2.find { i-> i.vpId == d?.vpId }
+ if (info != null) {
+ info.ibGuid = userId
+ info.vpCreateTime = d?.vpCreateTime
+ res += vocPurifyDeviceMapper.updateByPrimaryKey(info)
+ infoList2.remove(info)
+ } else {
+ vocPurifyDeviceMapper.delete(d)
+// print("delete: ")
+// println(info)
+ }
+ }
+ infoList2.forEach {
+ it.ibGuid = userId
+ it.vpCreateTime = Date()
+ res += vocPurifyDeviceMapper.insert(it)
+ }
+ return res
+ }
+
+ override fun getVOCPurifyDevice(userId: String): List<VocPurifyDevice?> {
+ return vocPurifyDeviceMapper.selectByExample(Example(VocPurifyDevice::class.java).apply {
+ createCriteria().andEqualTo("ibGuid", userId)
+ })
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3