From 8c15c9cc0d6474ed77e313258f9b09f7f2d6366e Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 17 九月 2025 17:29:47 +0800 Subject: [PATCH] 2025.9.17 1. 新增数据产品接口 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPEvaluateInfo.kt | 16 + src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdMiddleService.kt | 35 ++ src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPInspectionSummary.kt | 34 ++ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdFinalService.kt | 9 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPMonitorDataInfo.kt | 12 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPSceneInfo.kt | 26 + src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPProblemTypeCount.kt | 28 + src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdBaseController.kt | 42 ++ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProdMiddleServiceImpl.kt | 153 ++++++++++ src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdMiddleController.kt | 48 +++ src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt | 12 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDbMapper.kt | 3 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPInspectionInfo.kt | 15 + src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProdBaseServiceImpl.kt | 209 +++++++++++++ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdBaseService.kt | 31 ++ src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt | 4 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPEvaluationByArea.kt | 59 +++ src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdFinalController.kt | 16 + src/main/kotlin/cn/flightfeather/supervision/common/utils/QueryByCache.kt | 26 + src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/QueryOpt.kt | 41 ++ src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPProblemCountByArea.kt | 38 ++ 21 files changed, 844 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDbMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDbMapper.kt index 4586daa..8208268 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDbMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDbMapper.kt @@ -28,5 +28,6 @@ val userMapMapper: UserMapMapper, val townMapper: TownMapper, val restaurantBaseInfoMapper: RestaurantBaseInfoMapper, - val vehicleBaseInfoMapper: VehicleBaseInfoMapper + val vehicleBaseInfoMapper: VehicleBaseInfoMapper, + val dustDataResultMapper: DustDataResultMapper ) \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt index bece96e..a240500 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt @@ -24,6 +24,10 @@ enum class RuleType(val value: Byte, val text: String){ STANDARD(1,"瑙勮寖鎬�"), SCORE(2,"璇勫垎") } + //瑙勮寖鎬х瓑绾� + enum class EvaluationLevel(val value: Byte, val text: String){ + A(1,"瑙勮寖"), B(2,"鍩烘湰瑙勮寖"), C(3,"涓嶈鑼�"), D(4,"涓ラ噸涓嶈鑼�") + } //浠诲姟鐘舵�� enum class TaskProgress(val value: String, val text: String){ RUNINGSTATUS1("1","鏈墽琛�"), diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/QueryByCache.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/QueryByCache.kt new file mode 100644 index 0000000..a024094 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/QueryByCache.kt @@ -0,0 +1,26 @@ +package cn.flightfeather.supervision.common.utils + +/** + * 缂撳瓨鏌ヨ宸ュ叿绫� + * @date 2025/9/15 + * @author feiyu02 + */ +object QueryByCache { + + /** + * 缂撳瓨鏌ヨ + * @param cache 缂撳瓨鑾峰彇鏂规硶 + * @param calculate 璁$畻鏂规硶 + * @param save 缂撳瓨淇濆瓨鏂规硶 + * @return + */ + fun <T> queryCache(cache: () -> T?, calculate: () -> T, save: (t: T) -> Unit): T { + val cacheData = cache.invoke() + if (cacheData != null) { + return cacheData + } + val calculateData = calculate.invoke() + save.invoke(calculateData) + return calculateData + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdBaseService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdBaseService.kt new file mode 100644 index 0000000..4da47e1 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdBaseService.kt @@ -0,0 +1,31 @@ +package cn.flightfeather.supervision.lightshare.service + +import cn.flightfeather.supervision.lightshare.vo.dataprod.* + +/** + * 鍩虹鏁版嵁浜у搧鏈嶅姟鎺ュ彛 + * @date 2025/9/15 + * @author feiyu02 + */ +interface DataProdBaseService { + + /** + * 鑾峰彇鏁版嵁浜у搧鍦烘櫙淇℃伅 + */ + fun getSceneInfo(queryOpt: QueryOpt): List<DPSceneInfo> + + /** + * 鑾峰彇鏁版嵁浜у搧瑙勮寖璇勪及淇℃伅 + */ + fun getEvaluateInfo(queryOpt: QueryOpt): List<DPEvaluateInfo> + + /** + * 鑾峰彇鏁版嵁浜у搧宸℃煡淇℃伅 + */ + fun getInspectionInfo(queryOpt: QueryOpt): List<DPInspectionInfo> + + /** + * 鑾峰彇鏁版嵁浜у搧鐩戞祴鏁版嵁淇℃伅 + */ + fun getMonitorDataInfo(queryOpt: QueryOpt): List<DPMonitorDataInfo> +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdFinalService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdFinalService.kt new file mode 100644 index 0000000..6917fd1 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdFinalService.kt @@ -0,0 +1,9 @@ +package cn.flightfeather.supervision.lightshare.service + +/** + * 鏈�缁堟暟鎹骇鍝佹湇鍔℃帴鍙� + * @date 2025/9/15 + * @author feiyu02 + */ +interface DataProdFinalService { +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdMiddleService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdMiddleService.kt new file mode 100644 index 0000000..11904b5 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProdMiddleService.kt @@ -0,0 +1,35 @@ +package cn.flightfeather.supervision.lightshare.service + +import cn.flightfeather.supervision.lightshare.vo.dataprod.middle.DPInspectionSummary +import cn.flightfeather.supervision.lightshare.vo.dataprod.QueryOpt +import cn.flightfeather.supervision.lightshare.vo.dataprod.middle.DPEvaluationByArea +import cn.flightfeather.supervision.lightshare.vo.dataprod.middle.DPProblemCountByArea +import cn.flightfeather.supervision.lightshare.vo.dataprod.middle.DPProblemTypeCount + +/** + * 涓棿鏁版嵁浜у搧鏈嶅姟鎺ュ彛 + * @date 2025/9/15 + * @author feiyu02 + */ +interface DataProdMiddleService { + + /** + * 宸℃煡瀹屾垚鎯呭喌姹囨�� + */ + fun getInspectionSummary(queryOpt: QueryOpt): DPInspectionSummary + + /** + * 闂鍒嗙被姹囨�� + */ + fun getProblemTypeSummary(queryOpt: QueryOpt): List<DPProblemTypeCount> + + /** + * 鍒嗗尯鍩熷崟鍦烘櫙闂鏁伴噺 + */ + fun getProblemCountByArea(queryOpt: QueryOpt): List<DPProblemCountByArea> + + /** + * 鍒嗗尯鍩熻鑼冩�ф儏鍐� + */ + fun getEvaluationByArea(queryOpt: QueryOpt): List<DPEvaluationByArea> +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProdBaseServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProdBaseServiceImpl.kt new file mode 100644 index 0000000..4fd0203 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProdBaseServiceImpl.kt @@ -0,0 +1,209 @@ +package cn.flightfeather.supervision.lightshare.service.impl + +import cn.flightfeather.supervision.business.autooutput.datasource.AopDbMapper +import cn.flightfeather.supervision.common.utils.Constant +import cn.flightfeather.supervision.common.utils.QueryByCache +import cn.flightfeather.supervision.domain.ds1.entity.* +import cn.flightfeather.supervision.lightshare.service.DataProdBaseService +import cn.flightfeather.supervision.lightshare.vo.ProblemListVo +import cn.flightfeather.supervision.lightshare.vo.dataprod.* +import org.springframework.beans.BeanUtils +import org.springframework.stereotype.Service +import tk.mybatis.mapper.entity.Example + +/** + * + * @date 2025/9/15 + * @author feiyu02 + */ +@Service +class DataProdBaseServiceImpl(private val aopDbMapper: AopDbMapper) : DataProdBaseService { + + override fun getSceneInfo(queryOpt: QueryOpt): List<DPSceneInfo> { + return QueryByCache.queryCache( + cache = { return@queryCache null }, + calculate = { + val res = mutableListOf<DPSceneInfo>() + val objList = aopDbMapper.monitorobjectversionMapper.selectByExample(Example(Monitorobjectversion::class.java).apply { + createCriteria().andEqualTo("tid", queryOpt.topTaskId) + }) + if (objList.isEmpty()) return@queryCache emptyList<DPSceneInfo>() + + val guidList = objList.map { it.sguid } + val baseScene = aopDbMapper.scenseMapper.selectByExample(Example(Scense::class.java).apply { + createCriteria().andIn("guid", guidList) + .andEqualTo("typeid", queryOpt.sceneTypeId) + orderBy("typeid").orderBy("index") + }) + baseScene.groupBy { it.typeid }.forEach { (typeid, sceneList) -> + when (typeid.toString()) { + Constant.SceneType.TYPE1.value -> { + val subScene = aopDbMapper.sceneConstructionSiteMapper.selectByExample(Example(SceneConstructionSite::class.java).apply { + createCriteria().andIn("sGuid", sceneList.map { it.guid }) + }) + sceneList.forEach { + val sub = subScene.find { sub-> sub.getsGuid() == it.guid } + res.add(DPSceneInfo().apply { + this.scene = it + this.subScene = sub + this.status = sub?.csStatus + this.statusBool = sub?.csStatus == "寤鸿涓�" + this.stage = sub?.siExtension1 + }) + } + } + Constant.SceneType.TYPE2.value -> { + val subScene = aopDbMapper.sceneWharfMapper.selectByExample(Example(SceneWharf::class.java).apply { + createCriteria().andIn("sGuid", sceneList.map { it.guid }) + }) + sceneList.forEach { + val sub = subScene.find { sub-> sub.getsGuid() == it.guid } + res.add(DPSceneInfo().apply { + this.scene = it + this.subScene = sub + this.status = sub?.getwStatus() + this.statusBool = sub?.getwStatus() == "钀ヨ繍涓�" + }) + } + } + Constant.SceneType.TYPE3.value -> { + val subScene = aopDbMapper.sceneMixingPlantMapper.selectByExample(Example(SceneMixingPlant::class.java).apply { + createCriteria().andIn("sGuid", sceneList.map { it.guid }) + }) + sceneList.forEach { + val sub = subScene.find { sub-> sub.getsGuid() == it.guid } + res.add(DPSceneInfo().apply { + this.scene = it + this.subScene = sub + this.status = sub?.mpStatus + this.statusBool = sub?.mpStatus == "钀ヨ繍涓�" + }) + } + } + Constant.SceneType.TYPE14.value -> { + val subScene = aopDbMapper.sceneStorageYardMapper.selectByExample(Example + (SceneStorageYard::class.java).apply { + createCriteria().andIn("sGuid", sceneList.map { it.guid }) + }) + sceneList.forEach { + val sub = subScene.find { sub-> sub.getsGuid() == it.guid } + res.add(DPSceneInfo().apply { + this.scene = it + this.subScene = sub + this.status = sub?.syStatus + this.statusBool = sub?.syStatus == "钀ヨ繍涓�" + }) + } + } + else -> { + sceneList.forEach { + res.add(DPSceneInfo().apply { + this.scene = it + }) + } + } + } + } + return@queryCache res + }, + save = { } + ) + } + + override fun getEvaluateInfo(queryOpt: QueryOpt): List<DPEvaluateInfo> { + return QueryByCache.queryCache( + cache = { return@queryCache null }, + calculate = { + val res = mutableListOf<DPEvaluateInfo>() + val subtaskList = aopDbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply { + createCriteria().andEqualTo("tguid", queryOpt.topTaskId) + }) + if (subtaskList.isEmpty()) return@queryCache emptyList<DPEvaluateInfo>() + + aopDbMapper.evaluationMapper.selectByExample(Example(Evaluation::class.java).apply { + createCriteria().andIn("stguid", subtaskList.map { it.stguid }) + }).forEach { + res.add(DPEvaluateInfo().apply { + subTask = subtaskList.find { sub-> sub.stguid == it.stguid } + evaluate = it + val score = it.resultscorebef?.toIntOrNull() ?: -1 + scoreLevel = when { + score in 0..39 -> Constant.EvaluationLevel.D.text + score in 40..89 -> Constant.EvaluationLevel.C.text + score in 90..99 -> Constant.EvaluationLevel.B.text + score >= 100 -> Constant.EvaluationLevel.A.text + else -> "" + } + }) + } + return@queryCache res + }, + save = { } + ) + } + + override fun getInspectionInfo(queryOpt: QueryOpt): List<DPInspectionInfo> { + return QueryByCache.queryCache( + cache = { return@queryCache null }, + calculate = { + val res = mutableListOf<DPInspectionInfo>() + val subtaskList = aopDbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply { + createCriteria().andEqualTo("tguid", queryOpt.topTaskId) + }) + if (subtaskList.isEmpty()) return@queryCache emptyList<DPInspectionInfo>() + + val problemList = aopDbMapper.problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { + createCriteria().andIn("stguid", subtaskList.map { it.stguid }) + }) + + val problemTypeList = aopDbMapper.problemtypeMapper.selectByExample(Example(Problemtype::class.java) + .apply { createCriteria().andIn("guid", problemList.map { it.ptguid }) }) + + subtaskList.forEach { + res.add(DPInspectionInfo().apply { + subTask = it + problems = problemList.filter { problem-> problem.stguid == it.stguid }.map { problem-> + val problemListVo = ProblemListVo() + BeanUtils.copyProperties(problem, problemListVo) + problemListVo.apply { + problemTypeList.find { type-> type.guid == problem.ptguid }?.let { + typeid = it.typeid + typename = it.typename + } + } + // TODO 濯掍綋鏂囦欢 + } + }) + } + + return@queryCache res + }, + save = { } + ) + } + + override fun getMonitorDataInfo(queryOpt: QueryOpt): List<DPMonitorDataInfo> { + return QueryByCache.queryCache( + cache = { return@queryCache null }, + calculate = { + val res = mutableListOf<DPMonitorDataInfo>() + val objList = aopDbMapper.monitorobjectversionMapper.selectByExample(Example(Monitorobjectversion::class.java).apply { + createCriteria().andEqualTo("tid", queryOpt.topTaskId) + }) + if (objList.isEmpty()) return@queryCache res + + aopDbMapper.dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply { + createCriteria().andBetween("drTime", queryOpt.startTime, queryOpt.endTime) + .andIn("objectId", objList.map { it.sguid }) + }).forEach { + res.add(DPMonitorDataInfo().apply { + data = it + }) + } + + return@queryCache res + }, + save = { } + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProdMiddleServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProdMiddleServiceImpl.kt new file mode 100644 index 0000000..b6e4029 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProdMiddleServiceImpl.kt @@ -0,0 +1,153 @@ +package cn.flightfeather.supervision.lightshare.service.impl + +import cn.flightfeather.supervision.common.utils.Constant +import cn.flightfeather.supervision.common.utils.QueryByCache +import cn.flightfeather.supervision.domain.ds1.entity.SceneConstructionSite +import cn.flightfeather.supervision.lightshare.service.DataProdBaseService +import cn.flightfeather.supervision.lightshare.service.DataProdMiddleService +import cn.flightfeather.supervision.lightshare.vo.dataprod.QueryOpt +import cn.flightfeather.supervision.lightshare.vo.dataprod.middle.DPEvaluationByArea +import cn.flightfeather.supervision.lightshare.vo.dataprod.middle.DPInspectionSummary +import cn.flightfeather.supervision.lightshare.vo.dataprod.middle.DPProblemCountByArea +import cn.flightfeather.supervision.lightshare.vo.dataprod.middle.DPProblemTypeCount +import org.springframework.stereotype.Service + +/** + * + * @date 2025/9/15 + * @author feiyu02 + */ +@Service +class DataProdMiddleServiceImpl(private val dataProdBaseService: DataProdBaseService) : DataProdMiddleService { + + override fun getInspectionSummary(queryOpt: QueryOpt): DPInspectionSummary { + return QueryByCache.queryCache( + cache = { return@queryCache null }, + calculate = { + val res = DPInspectionSummary() + val inspectionInfo = dataProdBaseService.getInspectionInfo(queryOpt) + val sceneInfo = dataProdBaseService.getSceneInfo(queryOpt) + res.sceneCount = sceneInfo.size + res.pointCount = inspectionInfo.size + res.reviewPointCount = inspectionInfo.size - inspectionInfo.distinctBy { it.subTask?.scenseid }.size + sceneInfo.forEach { + when (it.scene?.typeid.toString()) { + // 瀵逛簬寤虹瓚宸ュ湴绫诲瀷锛屾牴鎹叾csStatus鍒ゆ柇鏄惁鍋滃伐鎴栧畬宸� + Constant.SceneType.TYPE1.value -> { + when ((it.subScene as SceneConstructionSite).csStatus) { + "鍋滃伐" -> { + res.stopSceneCount++ + } + + "瀹屽伐" -> { + res.completeSceneCount++ + } + } + } + // 瀵逛簬鍏朵粬绫诲瀷锛屾牴鎹叾extension1锛堜唬琛ㄦ槸鍚︿笂绾匡級鍒ゆ柇鏄惁瀹屽伐 + else -> { + if (it.scene?.extension1 != "1") { + res.completeSceneCount++ + } + } + } + } + return@queryCache res + }, + save = {} + ) + } + + override fun getProblemTypeSummary(queryOpt: QueryOpt): List<DPProblemTypeCount> { + return QueryByCache.queryCache( + cache = { return@queryCache null }, + calculate = { + val res = mutableListOf<DPProblemTypeCount>() + val inspectionInfo = dataProdBaseService.getInspectionInfo(queryOpt) + val allProblemList = inspectionInfo.flatMap { it.problems ?: emptyList() } + allProblemList.groupBy { it.typeid }.forEach { (typeid, problemList) -> + res.add(DPProblemTypeCount().apply { + this.typeId = typeid + this.typeName = problemList.firstOrNull()?.typename + this.count = problemList.size + this.ratio = problemList.size.toDouble() / allProblemList.size + }) + } + return@queryCache res + }, + save = {} + ) + } + + override fun getProblemCountByArea(queryOpt: QueryOpt): List<DPProblemCountByArea> { + return QueryByCache.queryCache( + cache = { return@queryCache null }, + calculate = { + val res = mutableListOf<DPProblemCountByArea>() + val inspectionInfo = dataProdBaseService.getInspectionInfo(queryOpt) + inspectionInfo + .groupBy { it.subTask?.provincecode + it.subTask?.citycode + it.subTask?.districtcode + it.subTask?.towncode } + .forEach { (areaName, ins) -> + val firstSubtask = ins.first().subTask + val allProblemList = ins.flatMap { it.problems ?: emptyList() } + res.add(DPProblemCountByArea().apply { + this.provinceCode = firstSubtask?.provincecode + this.provinceName = firstSubtask?.provincename + this.cityCode = firstSubtask?.citycode + this.cityName = firstSubtask?.cityname + this.districtCode = firstSubtask?.districtcode + this.districtName = firstSubtask?.districtname + this.townCode = firstSubtask?.towncode + this.townName = firstSubtask?.townname + this.sceneCount = ins.distinctBy { it.subTask?.scenseid }.size + this.problemCount = allProblemList.size + this.ratio = problemCount.toDouble() / sceneCount + }) + } + + return@queryCache res + }, + save = {} + ) + } + + override fun getEvaluationByArea(queryOpt: QueryOpt): List<DPEvaluationByArea> { + return QueryByCache.queryCache( + cache = { return@queryCache null }, + calculate = { + val res = mutableListOf<DPEvaluationByArea>() + val sceneInfo = dataProdBaseService.getSceneInfo(queryOpt) + val evaluation = dataProdBaseService.getEvaluateInfo(queryOpt) + evaluation + .groupBy { it.subTask?.provincecode + it.subTask?.citycode + it.subTask?.districtcode + it.subTask?.towncode } + .forEach { (areaName, evals) -> + val firstSubtask = evals.first().subTask + res.add(DPEvaluationByArea().apply { + this.provinceCode = firstSubtask?.provincecode + this.provinceName = firstSubtask?.provincename + this.cityCode = firstSubtask?.citycode + this.cityName = firstSubtask?.cityname + this.districtCode = firstSubtask?.districtcode + this.districtName = firstSubtask?.districtname + this.townCode = firstSubtask?.towncode + this.townName = firstSubtask?.townname + this.validSceneCount = sceneInfo + .filter { + it.scene?.provincecode + it.scene?.citycode + it.scene?.districtcode + it.scene?.towncode == areaName + && it.statusBool + }.size + this.evaluationCount = evals.size + this.evalLevelACount = evals.count { it.scoreLevel == Constant.EvaluationLevel.A.text } + this.evalLevelBCount = evals.count { it.scoreLevel == Constant.EvaluationLevel.B.text } + this.evalLevelCCount = evals.count { it.scoreLevel == Constant.EvaluationLevel.C.text } + this.evalLevelDCount = evals.count { it.scoreLevel == Constant.EvaluationLevel.D.text } + this.evalLevelRatioAB = (this.evalLevelACount + this.evalLevelBCount).toDouble() / this.evaluationCount + }) + } + + return@queryCache res + }, + save = {} + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt index 45e3a5b..103a3a6 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt @@ -74,16 +74,4 @@ var monitorNum: Int = 0 var inspectedNum: Int = 0 -} - -/** - * 鏍规嵁鍦烘櫙id鎵惧埌鍦烘櫙 - */ -fun List<Scense?>.findByGuid(guid: String?): Scense? { - this.forEach { - if (it?.guid == guid) { - return it - } - } - return null } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPEvaluateInfo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPEvaluateInfo.kt new file mode 100644 index 0000000..2ec2707 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPEvaluateInfo.kt @@ -0,0 +1,16 @@ +package cn.flightfeather.supervision.lightshare.vo.dataprod + +import cn.flightfeather.supervision.domain.ds1.entity.Evaluation +import cn.flightfeather.supervision.domain.ds1.entity.Subtask + +/** + * 鏁版嵁浜у搧瑙勮寖璇勪及淇℃伅绫� + * 鐢ㄤ簬灏佽鍦烘櫙鐨勮鑼冭瘎浼版暟鎹紝鍖呮嫭鍦烘櫙鍩烘湰淇℃伅鍜岃瘎浼扮粨鏋� + * @date 2025/9/15 + * @author feiyu02 + */ +class DPEvaluateInfo { + var subTask:Subtask? = null + var evaluate: Evaluation? = null + var scoreLevel: String? = null +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPInspectionInfo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPInspectionInfo.kt new file mode 100644 index 0000000..3b79a72 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPInspectionInfo.kt @@ -0,0 +1,15 @@ +package cn.flightfeather.supervision.lightshare.vo.dataprod + +import cn.flightfeather.supervision.domain.ds1.entity.Problemlist +import cn.flightfeather.supervision.domain.ds1.entity.Subtask +import cn.flightfeather.supervision.lightshare.vo.ProblemListVo + +/** + * 鏁版嵁浜у搧鐜板満宸℃煡淇℃伅 + * @date 2025/9/15 + * @author feiyu02 + */ +class DPInspectionInfo { + var subTask: Subtask? = null + var problems: List<ProblemListVo>? = null +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPMonitorDataInfo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPMonitorDataInfo.kt new file mode 100644 index 0000000..7a50c06 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPMonitorDataInfo.kt @@ -0,0 +1,12 @@ +package cn.flightfeather.supervision.lightshare.vo.dataprod + +import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult + +/** + * 鏁版嵁浜у搧鐩戞祴鏁版嵁淇℃伅 + * @date 2025/9/15 + * @author feiyu02 + */ +class DPMonitorDataInfo { + var data: DustDataResult? = null +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPSceneInfo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPSceneInfo.kt new file mode 100644 index 0000000..91a8a81 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/DPSceneInfo.kt @@ -0,0 +1,26 @@ +package cn.flightfeather.supervision.lightshare.vo.dataprod + +import cn.flightfeather.supervision.domain.ds1.entity.BaseScene +import cn.flightfeather.supervision.domain.ds1.entity.Scense + +/** + * 鏁版嵁浜у搧鍦烘櫙淇℃伅 + * @date 2025/9/15 + * @author feiyu02 + */ +class DPSceneInfo { + + // 鍦烘櫙鍩烘湰淇℃伅 + var scene: Scense? = null + + // 鍦烘櫙鐗规湁淇℃伅 + var subScene: BaseScene? = null + + + // 鐘舵�侊紝鏍规嵁鍦烘櫙绫诲瀷涓嶅悓锛屾弿杩颁笉鍚岋紙渚嬪宸ュ湴锛氬缓璁句腑銆佸畬宸ャ�佸仠宸ワ紱鐮佸ご锛氬仠杩愩�佽惀杩愪腑锛� + var status: String? = null + var statusBool: Boolean = false + + // 闃舵锛屾牴鎹満鏅被鍨嬩笉鍚岋紝鎻忚堪涓嶅悓锛堜緥濡傚伐鍦帮細鍩虹銆佺粨鏋勩�佸澶栨�讳綋绛夛級 + var stage: String? = null +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/QueryOpt.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/QueryOpt.kt new file mode 100644 index 0000000..18b3716 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/QueryOpt.kt @@ -0,0 +1,41 @@ +package cn.flightfeather.supervision.lightshare.vo.dataprod + +import com.fasterxml.jackson.annotation.JsonFormat +import io.swagger.annotations.ApiModelProperty +import java.time.LocalDateTime + +/** + * 鏌ヨ鍙傛暟 + * @date 2025/9/15 + * @author feiyu02 + */ +class QueryOpt { + @ApiModelProperty("鎬讳换鍔d") + var topTaskId: String? = null + + @ApiModelProperty("鐪佷唤缂栫爜") + var provinceCode: String? = null + + @ApiModelProperty("鍩庡競缂栫爜") + var cityCode: String? = null + + @ApiModelProperty("鍖哄幙缂栫爜") + var districtCode: String? = null + + @ApiModelProperty("琛楅晣缂栫爜") + var townCode: String? = null + + @ApiModelProperty("璧峰鏃堕棿锛屾牸寮� yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + var startTime: LocalDateTime? = null + + @ApiModelProperty("缁撴潫鏃堕棿锛屾牸寮� yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + var endTime: LocalDateTime? = null + + @ApiModelProperty("鍦烘櫙绫诲瀷id") + var sceneTypeId: String? = null + + @ApiModelProperty("鏄惁闇�瑕佺紦瀛�") + var needCache: Boolean = true +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPEvaluationByArea.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPEvaluationByArea.kt new file mode 100644 index 0000000..8407aa6 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPEvaluationByArea.kt @@ -0,0 +1,59 @@ +package cn.flightfeather.supervision.lightshare.vo.dataprod.middle + +/** + * 鍒嗗尯鍩熻鑼冩�ф儏鍐� + * @date 2025/9/15 + * @author feiyu02 + */ +class DPEvaluationByArea { + var provinceCode: String? = null + + var provinceName: String? = null + + var cityCode: String? = null + + var cityName: String? = null + + var districtCode: String? = null + + var districtName: String? = null + + var townCode: String? = null + + var townName: String? = null + + /** + * 鏈夋晥鍦烘櫙鏁伴噺锛堝缓璁句腑鐨勫伐鍦帮紝钀ヨ繍涓殑鐮佸ご绛夛級 + */ + var validSceneCount: Int = 0 + + /** + * 璇勪及鐐规 + */ + var evaluationCount: Int = 0 + + /** + * 瑙勮寖绛夌骇A锛堣鑼冿級鏁伴噺 + */ + var evalLevelACount: Int = 0 + + /** + * 瑙勮寖绛夌骇B锛堝熀鏈鑼冿級鏁伴噺 + */ + var evalLevelBCount: Int = 0 + + /** + * 瑙勮寖绛夌骇C锛堜笉瑙勮寖锛夋暟閲� + */ + var evalLevelCCount: Int = 0 + + /** + * 瑙勮寖绛夌骇D锛堜弗閲嶄笉瑙勮寖锛夋暟閲� + */ + var evalLevelDCount: Int = 0 + + /** + * 瑙勮寖绛夌骇A锛堣鑼冿級涓嶣锛堝熀鏈鑼冿級鍗犳瘮 + */ + var evalLevelRatioAB: Double = 0.0 +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPInspectionSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPInspectionSummary.kt new file mode 100644 index 0000000..4bf44ac --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPInspectionSummary.kt @@ -0,0 +1,34 @@ +package cn.flightfeather.supervision.lightshare.vo.dataprod.middle + +/** + * 鏁版嵁浜у搧宸℃煡姹囨�讳俊鎭� + * @date 2025/9/15 + * @author feiyu02 + */ +class DPInspectionSummary { + + /** + * 宸℃煡鍦烘櫙鎬绘暟 + */ + var sceneCount: Int = 0 + + /** + * 宸℃煡鐐规鎬绘暟 + */ + var pointCount: Int = 0 + + /** + * 宸℃煡澶嶆牳鐐规鎬绘暟 + */ + var reviewPointCount: Int = 0 + + /** + * 鍋滃伐鍦烘櫙鏁� + */ + var stopSceneCount: Int = 0 + + /** + * 瀹屽伐鍦烘櫙鏁� + */ + var completeSceneCount: Int = 0 +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPProblemCountByArea.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPProblemCountByArea.kt new file mode 100644 index 0000000..a9be50c --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPProblemCountByArea.kt @@ -0,0 +1,38 @@ +package cn.flightfeather.supervision.lightshare.vo.dataprod.middle + +import io.swagger.annotations.ApiModelProperty + +/** + * + * @date 2025/9/15 + * @author feiyu02 + */ +class DPProblemCountByArea { + var provinceCode: String? = null + + var provinceName: String? = null + + var cityCode: String? = null + + var cityName: String? = null + + var districtCode: String? = null + + var districtName: String? = null + + var townCode: String? = null + + var townName: String? = null + /** + * 鍦烘櫙鏁伴噺 + */ + var sceneCount: Int = 0 + /** + * 闂鏁伴噺 + */ + var problemCount: Int = 0 + /** + * 闂鏁伴噺鍗犳瘮 + */ + var ratio: Double = 0.0 +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPProblemTypeCount.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPProblemTypeCount.kt new file mode 100644 index 0000000..c647157 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/dataprod/middle/DPProblemTypeCount.kt @@ -0,0 +1,28 @@ +package cn.flightfeather.supervision.lightshare.vo.dataprod.middle + +/** + * 鏁版嵁浜у搧闂鍒嗙被姹囨�讳俊鎭� + * @date 2025/9/15 + * @author feiyu02 + */ +class DPProblemTypeCount { + /** + * 闂鍒嗙被ID + */ + var typeId: Byte? = null + + /** + * 闂鍒嗙被鍚嶇О + */ + var typeName: String? = null + + /** + * 闂鏁伴噺 + */ + var count: Int = 0 + + /** + * 闂鏁伴噺鍗犳瘮 + */ + var ratio: Double = 0.0 +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdBaseController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdBaseController.kt new file mode 100644 index 0000000..b079252 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdBaseController.kt @@ -0,0 +1,42 @@ +package cn.flightfeather.supervision.lightshare.web + +import cn.flightfeather.supervision.lightshare.service.DataProdBaseService +import cn.flightfeather.supervision.lightshare.vo.dataprod.QueryOpt +import io.swagger.annotations.Api +import org.springframework.web.bind.annotation.* + +/** + * 鍩虹鏁版嵁浜у搧鎺у埗鍣� + * @date 2025/9/15 + * @author feiyu02 + */ +@Api(tags = ["DataProdBaseController"], description = "鍩虹鏁版嵁浜у搧鐩稿叧API鎺ュ彛") +@RestController +@RequestMapping("/dataProd/base") +class DataProdBaseController(private val dataProdBaseService: DataProdBaseService) { + + /** + * 鍦烘櫙鍒楄〃 + */ + @PostMapping("/scene/get") + fun getSceneInfo(@RequestBody queryOpt: QueryOpt) = resPack { dataProdBaseService.getSceneInfo(queryOpt) } + + /** + * 瑙勮寖璇勪及鍒楄〃 + */ + @PostMapping("/evaluate/get") + fun getEvaluateInfo(@RequestBody queryOpt: QueryOpt) = resPack { dataProdBaseService.getEvaluateInfo(queryOpt) } + + /** + * 宸℃煡鍒楄〃 + */ + @PostMapping("/inspection/get") + fun getInspectionInfo(@RequestBody queryOpt: QueryOpt) = resPack { dataProdBaseService.getInspectionInfo(queryOpt) } + + + /** + * 鐩戞祴鏁版嵁鍒楄〃 + */ + @PostMapping("/monitorData/get") + fun getMonitorDataInfo(@RequestBody queryOpt: QueryOpt) = resPack { dataProdBaseService.getMonitorDataInfo(queryOpt) } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdFinalController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdFinalController.kt new file mode 100644 index 0000000..c41733b --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdFinalController.kt @@ -0,0 +1,16 @@ +package cn.flightfeather.supervision.lightshare.web + +import io.swagger.annotations.Api +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +/** + * 鏈�缁堟暟鎹骇鍝佹帶鍒跺櫒 + * @date 2025/9/15 + * @author feiyu02 + */ +@Api(tags = ["DataProdFinalController"], description = "鏈�缁堟暟鎹骇鍝佺浉鍏矨PI鎺ュ彛") +@RestController +@RequestMapping("/dataProd/final") +class DataProdFinalController { +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdMiddleController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdMiddleController.kt new file mode 100644 index 0000000..04cfa85 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProdMiddleController.kt @@ -0,0 +1,48 @@ +package cn.flightfeather.supervision.lightshare.web + +import cn.flightfeather.supervision.lightshare.service.DataProdMiddleService +import cn.flightfeather.supervision.lightshare.vo.dataprod.QueryOpt +import io.swagger.annotations.Api +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController + +/** + * 涓棿鏁版嵁浜у搧鎺у埗鍣� + * @date 2025/9/15 + * @author feiyu02 + */ +@Api(tags = ["DataProdMiddleController"], description = "涓棿鏁版嵁浜у搧鐩稿叧API鎺ュ彛") +@RestController +@RequestMapping("/dataProd/middle") +class DataProdMiddleController(private val dataProdMiddleService: DataProdMiddleService) { + + /** + * 宸℃煡瀹屾垚鎯呭喌姹囨�� + */ + @PostMapping("/inspection/summary/get") + fun getInspectionSummary(@RequestBody queryOpt: QueryOpt) = + resPack { dataProdMiddleService.getInspectionSummary(queryOpt) } + + /** + * 闂鍒嗙被姹囨�� + */ + @PostMapping("/problemType/summary/get") + fun getProblemTypeSummary(@RequestBody queryOpt: QueryOpt) = + resPack { dataProdMiddleService.getProblemTypeSummary(queryOpt) } + + /** + * 鍒嗗尯鍩熷崟鍦烘櫙闂鏁伴噺 + */ + @PostMapping("/problemCount/area/get") + fun getProblemCountByArea(@RequestBody queryOpt: QueryOpt) = + resPack { dataProdMiddleService.getProblemCountByArea(queryOpt) } + + /** + * 鍒嗗尯鍩熻鑼冩�ф儏鍐� + */ + @PostMapping("/evaluation/area/get") + fun getEvaluationByArea(@RequestBody queryOpt: QueryOpt) = + resPack { dataProdMiddleService.getEvaluationByArea(queryOpt) } +} \ No newline at end of file -- Gitblit v1.9.3