From 0392c333ed3d987cb2ab3dac4e1a972cff405f21 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 25 四月 2024 17:42:08 +0800 Subject: [PATCH] 1. 新增后台任务关联模块 2. 新增自动评分后台任务; 3. 修复部分bug --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ScenseService.kt | 16 src/main/kotlin/cn/flightfeather/supervision/common/utils/CacheUtil.kt | 20 src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml | 45 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt | 2 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt | 1 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt | 6 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/InspectionService.kt | 7 src/main/resources/mapper/ds1/InspectionMapper.xml | 48 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt | 4 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt | 1 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt | 14 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt | 50 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/BaseInfo.java | 194 ++ src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteInfoMapper.kt | 8 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ScenseController.kt | 13 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt | 55 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt | 8 src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt | 40 src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt | 41 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/InspectionMapper.kt | 3 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt | 8 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt | 12 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt | 63 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt | 19 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt | 38 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/BaseInfoRep.kt | 36 src/main/resources/mapper/ds2/BaseInfoMapper.xml | 53 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt | 25 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionInfoVo.kt | 6 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneProblemSummary.kt | 24 src/main/resources/mapper/ds3/JSDustSiteInfoMapper.xml | 68 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt | 22 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt | 4 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt | 6 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt | 119 + src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt | 14 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt | 6 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceSiteVo.kt | 127 + src/main/kotlin/cn/flightfeather/supervision/business/import/SceneImport.kt | 93 + src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt | 66 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt | 15 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt | 6 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt | 5 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt | 8 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt | 94 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt | 6 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt | 6 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SubtaskService.kt | 5 src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt | 38 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt | 40 src/main/kotlin/cn/flightfeather/supervision/common/exception/BizException.kt | 4 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt | 12 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDetail.kt | 2 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt | 60 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MonitorobjectversionServiceImpl.kt | 2 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt | 3 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt | 22 pom.xml | 7 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt | 6 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt | 18 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt | 13 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt | 17 src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt | 7 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt | 20 src/test/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMapTest.kt | 57 src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt | 38 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt | 6 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt | 157 + src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt | 4 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt | 18 src/main/resources/mapper/ds1/ProblemlistMapper.xml | 347 ++-- src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt | 2 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDeviceVo.kt | 54 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt | 149 + src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt | 14 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ProblemlistMapper.kt | 35 src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt | 8 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt | 6 src/main/resources/mapper/ds1/SubtaskMapper.xml | 49 /dev/null | 26 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt | 76 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt | 43 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt | 11 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/RegionRep.kt | 67 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt | 39 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt | 6 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt | 9 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt | 7 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt | 4 src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt | 68 src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteInfo.java | 1102 +++++++++++++++ src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt | 8 92 files changed, 3,583 insertions(+), 628 deletions(-) diff --git a/pom.xml b/pom.xml index 0bb7353..531cf5e 100644 --- a/pom.xml +++ b/pom.xml @@ -283,6 +283,13 @@ <version>4.1.2</version> </dependency> + <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi-ooxml</artifactId> + <version>4.1.2</version> + </dependency> + <!-- https://mvnrepository.com/artifact/com.google.zxing/core --> <dependency> <groupId>com.google.zxing</groupId> diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt index 417ca2d..2e3e308 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt @@ -147,7 +147,13 @@ /** * 瓒呮湀鍧囧�肩櫨鍒嗘瘮 */ - abstract fun overAvgRate(avg: Double, dAvg: Double?): Double? + open fun overAvgRate(avg: Double, dAvg: Double?): Double? { + return if (dAvg != null && dAvg != .0) { + round(((avg - dAvg) / dAvg) * 1000) / 1000 + } else { + .0 + } + } /** * 鏁版嵁涓暟 diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt index 18706fb..bf7c41a 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt @@ -1,21 +1,32 @@ package cn.flightfeather.supervision.business.autooutput.dataanalysis +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.utils.Constant -import cn.flightfeather.supervision.domain.ds2.repository.JADustSiteMapRep -import cn.flightfeather.supervision.domain.ds3.repository.JSDustSiteMapRep +import cn.flightfeather.supervision.common.utils.ExcelUtil +import cn.flightfeather.supervision.domain.ds1.entity.Scense +import cn.flightfeather.supervision.domain.ds1.repository.SceneRep +import cn.flightfeather.supervision.domain.ds1.repository.TaskRep +import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep +import cn.flightfeather.supervision.domain.ds2.repository.JADustSiteRep +import cn.flightfeather.supervision.domain.ds3.repository.JSDustSiteRep import cn.flightfeather.supervision.domain.ds3.repository.XHFumeSiteMapRep -import cn.flightfeather.supervision.lightshare.vo.AreaVo -import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo +import cn.flightfeather.supervision.lightshare.vo.* +import org.apache.poi.hssf.usermodel.HSSFWorkbook import org.springframework.stereotype.Component +import java.io.FileOutputStream +import java.util.* /** * 鐩戞祴鏁版嵁鍜岀郴缁熺敤鎴风殑鏄犲皠绠$悊 */ @Component class AopDataDeviceMap( - private val jaDustSiteMapRep: JADustSiteMapRep, - private val jsDustSiteMapRep: JSDustSiteMapRep, + private val jaDustSiteRep: JADustSiteRep, + private val jsDustSiteRep: JSDustSiteRep, private val xhFumeSiteMapRep: XHFumeSiteMapRep, + private val taskRep: TaskRep, + private val sceneRep: SceneRep, + private val userInfoSVRep: UserInfoSVRep, ) { /** @@ -50,7 +61,7 @@ //闈欏畨鍖� "310106" -> when (areaVo.scensetypeid) { //宸ュ湴 - Constant.SceneType.TYPE1.value -> jaDustSiteMapRep.findBySVUserId(userIdList) + Constant.SceneType.TYPE1.value -> jaDustSiteRep.findMapBySVUserId(userIdList) else -> emptyList() } //閲戝北鍖� @@ -59,7 +70,7 @@ Constant.SceneType.TYPE1.value, Constant.SceneType.TYPE2.value, Constant.SceneType.TYPE3.value, - -> jsDustSiteMapRep.findBySVUserId(userIdList) + -> jsDustSiteRep.findMapBySVUserId(userIdList) else -> emptyList() } //寰愭眹鍖� @@ -72,4 +83,96 @@ } } + + /** + * 杈撳嚭鐩戞祴鐐逛綅鍜岀洃娴嬭澶囩殑瀵瑰簲鍖归厤鍏崇郴 + * @param areaVo 鍖哄煙鏉′欢 + */ + fun outputMapSet(areaVo: AreaVo) { + // 鐩戠鎬讳换鍔� + val task = taskRep.findOneTask(areaVo) ?: throw BizException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟") + // 鎬讳换鍔″寘鍚搴旂被鍨嬬殑鍦烘櫙 + val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) + val sceneIds = scenes.map { it?.guid } + val userIdList = userInfoSVRep.findUser(sceneIds).map { it?.guid } + // 鍦烘櫙鍜岀洃娴嬬偣鐨勫尮閰嶅叧绯� + val mapSet = this.findMapSet(areaVo, userIdList) + // 鐩戞祴璁惧淇℃伅 + val deviceSiteList = when (areaVo.districtcode) { + //闈欏畨鍖� + "310106" -> when (areaVo.scensetypeid) { + //宸ュ湴 + Constant.SceneType.TYPE1.value -> jaDustSiteRep.findSiteInfo() + else -> emptyList() + } + //閲戝北鍖� + "310116" -> when (areaVo.scensetypeid) { + //宸ュ湴,鐮佸ご姘存偿鎼呮媽绔� + Constant.SceneType.TYPE1.value, + Constant.SceneType.TYPE2.value, + Constant.SceneType.TYPE3.value, + -> jsDustSiteRep.findSiteInfo() + else -> emptyList() + } + //寰愭眹鍖� + "310104" -> when (areaVo.scensetypeid) { + //椁愰ギ + Constant.SceneType.TYPE5.value -> emptyList() + else -> emptyList() + } + else -> emptyList() + } + + outputMapSetToFile(areaVo, scenes, mapSet, deviceSiteList) + } + + /** + * 杈撳嚭鐩戞祴鐐逛綅鍜岀洃娴嬭澶囩殑瀵瑰簲鍖归厤鍏崇郴鍒版枃浠朵腑 + * @param scenes 鍦烘櫙淇℃伅鍒楄〃 + * @param mapSet 鍦烘櫙鍜岀洃娴嬬偣瀵瑰簲鍏崇郴 + * @param siteList 鐩戞祴鐐逛俊鎭垪琛� + */ + private fun outputMapSetToFile(areaVo: AreaVo, scenes: List<Scense?>, mapSet: List<DeviceMapVo>, siteList: + List<DeviceSiteVo>) { + val _scenes = mutableListOf<Scense?>().also { it.addAll(scenes) } + val _siteList = mutableListOf<DeviceSiteVo>().also { it.addAll(siteList) } + + val sceneDeviceList = mutableListOf<SceneDeviceVo>() + //琛ㄥご + val head = sceneDeviceList.tableHead() + scenes.forEach { + val sceneDeviceVo = SceneDeviceVo() + sceneDeviceVo.scene = it + val user = userInfoSVRep.findUser(it?.guid) + mapSet.findBySVUserId(user?.guid).forEach { map -> + val site = siteList.findByMNCode(map.deviceCode) + sceneDeviceVo.deviceList.add(site) + _siteList.remove(site) + } + sceneDeviceList.add(sceneDeviceVo) + } + //鍐呭 + val contents = sceneDeviceList.tableContent() + + + val workbook = HSSFWorkbook() + ExcelUtil.write(head, contents, workbook, sheetName = "鍦烘櫙璁惧鍖归厤") + + val head2 = sceneDeviceList.tableHeadDevice() + val contents2 = mutableListOf<Array<Any>>() + _siteList.forEach { + contents2.add(arrayOf(it.id ?: "", it.mnCode ?: "", it.name ?: "", it.address ?: "", it.beginDate ?: "", it + .dutyCompany ?: "", it.groupName ?: "")) + } + ExcelUtil.write(head2, contents2, workbook, sheetName = "鏈尮閰嶈澶�") + + val path = "target/" + val fileName = "${areaVo.districtname}-鍦烘櫙璁惧淇℃伅-${Date().time}.xls" + val out = FileOutputStream(path + fileName) + workbook.write(out) + workbook.close() + out.flush() + out.close() + } + } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt index 31e2109..7051a4b 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt @@ -117,11 +117,7 @@ } override fun overAvgRate(avg: Double, dAvg: Double?): Double? { - return if (dAvg != null) { - round(((avg - dAvg) / dAvg) * 1000) / 1000 - } else { - null - } + return super.overAvgRate(avg, dAvg) } override fun count(dataList: List<List<HourDustData?>>): Int { diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt index 83ab24d..28bbf0e 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt @@ -116,11 +116,7 @@ } override fun overAvgRate(avg: Double, dAvg: Double?): Double? { - return if (dAvg != null) { - round(((avg - dAvg) / dAvg) * 1000) / 1000 - } else { - null - } + return super.overAvgRate(avg, dAvg) } override fun effectiveRate( diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt index f557b32..ecc3eb2 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt @@ -1,6 +1,6 @@ package cn.flightfeather.supervision.business.autooutput.datasource -import cn.flightfeather.supervision.common.exception.ResponseErrorException +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.* import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord @@ -86,7 +86,7 @@ // 浠庣洃绠$郴缁熻幏鍙栧満鏅� private fun initSceneSource(config: AopDataConfig) { - config.topTaskGuid ?: throw ResponseErrorException("椤跺眰浠诲姟id涓嶈兘涓簄ull") + config.topTaskGuid ?: throw BizException("椤跺眰浠诲姟id涓嶈兘涓簄ull") this.config = config this.mode = 0 sceneSourceList.clear() diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt index 6bff41d..7d9819a 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt @@ -1,7 +1,7 @@ package cn.flightfeather.supervision.business.autooutput.score import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig -import cn.flightfeather.supervision.common.exception.ResponseErrorException +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ @@ -23,7 +23,7 @@ ) { fun execute(config: AopDataConfig) { - if (config.year == null || config.month == null) throw ResponseErrorException("鐜俊鐮佽瘎浼版椂蹇呴』浼犻�掓椂闂存潯浠�!") + if (config.year == null || config.month == null) throw BizException("鐜俊鐮佽瘎浼版椂蹇呴』浼犻�掓椂闂存潯浠�!") // 鎵惧埌椋炵窘鐜涓渶瑕佺敓鎴愮幆淇$爜鐨勬墍鏈夌珯鐐� val sceneType = Constant.SceneType.getByValue(config.sceneType.toString()) val userList = findUsers(config.districtName, sceneType) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt index bd04aa1..5592fae 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt @@ -4,7 +4,7 @@ import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig import cn.flightfeather.supervision.business.autooutput.score.AopCreditCode import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation -import cn.flightfeather.supervision.common.exception.ResponseErrorException +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl import cn.flightfeather.supervision.common.executor.BgTaskStatus import cn.flightfeather.supervision.common.executor.BgTaskType @@ -46,10 +46,10 @@ val districtCode = areaVo.districtcode val districtName = areaVo.districtname // val d = LocalDateTime.parse(areaVo.starttime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) - val d = areaVo.starttime ?: throw ResponseErrorException("鑷姩璇勪及浠诲姟蹇呴』璁惧畾鏃堕棿") + val d = areaVo.starttime ?: throw BizException("鑷姩璇勪及浠诲姟蹇呴』璁惧畾鏃堕棿") val year = d.year val month = d.monthValue - val sceneType = areaVo.scensetypeid?.toInt() ?: throw ResponseErrorException("鍦烘櫙绫诲瀷鏈缃紝鏃犳硶璇勪及") + val sceneType = areaVo.scensetypeid?.toInt() ?: throw BizException("鍦烘櫙绫诲瀷鏈缃紝鏃犳硶璇勪及") val id = "${BgTaskType.AUTO_SCORE.name}-${districtCode}-${sceneType}" val name = "${districtName}${Constant.SceneType.getDes(sceneType)}鑷姩璇勫垎" @@ -69,7 +69,7 @@ } return bgTask.taskStatus } else { - throw ResponseErrorException("宸℃煡鎬讳换鍔′笉瀛樺湪锛屾棤娉曡瘎浼�") + throw BizException("宸℃煡鎬讳换鍔′笉瀛樺湪锛屾棤娉曡瘎浼�") } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/import/SceneImport.kt b/src/main/kotlin/cn/flightfeather/supervision/business/import/SceneImport.kt new file mode 100644 index 0000000..71e8712 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/business/import/SceneImport.kt @@ -0,0 +1,93 @@ +package cn.flightfeather.supervision.business.import + +import cn.flightfeather.supervision.common.exception.BizException +import cn.flightfeather.supervision.common.utils.Constant +import cn.flightfeather.supervision.common.utils.ExcelUtil +import cn.flightfeather.supervision.domain.ds1.entity.Scense +import cn.flightfeather.supervision.domain.ds1.repository.RegionRep +import org.apache.poi.ss.usermodel.CellType +import org.springframework.stereotype.Component +import java.io.InputStream +import java.util.* + +/** + * 鍦烘櫙淇℃伅瀵煎叆宸ュ叿 + */ +@Component +class SceneImport( + private val regionRep: RegionRep, +) { + private val headers = + listOf( + ExcelUtil.MyHeader("缂栧彿锛堣嫢涓嶅~鍐欙紝鍒欐寜鐓ч『搴忚嚜鍔ㄦ坊鍔狅級", CellType.NUMERIC), + ExcelUtil.MyHeader("鍚嶇О", CellType.STRING), + ExcelUtil.MyHeader("绫诲瀷", CellType.STRING), + ExcelUtil.MyHeader("鍦板潃", CellType.STRING), + ExcelUtil.MyHeader("缁忓害锛堥珮寰凤級", CellType.NUMERIC), + ExcelUtil.MyHeader("绾害锛堥珮寰凤級", CellType.NUMERIC), + ExcelUtil.MyHeader("鐪�", CellType.STRING), + ExcelUtil.MyHeader("甯�", CellType.STRING), + ExcelUtil.MyHeader("鍖�", CellType.STRING), + ExcelUtil.MyHeader("琛楅晣", CellType.STRING), + ExcelUtil.MyHeader("鑱旂郴浜�", CellType.STRING), + ExcelUtil.MyHeader("鑱旂郴鐢佃瘽", CellType.STRING) + ) + + /** + * 閫氳繃鏂囦欢璇诲彇鍦烘櫙淇℃伅 + */ + fun readFromFile(file: InputStream): List<Scense> { + val result = mutableListOf<Scense>() + try { + ExcelUtil.readXLXS(file, headers) { + val data = Scense().apply { + guid = null + name = it.getCell(1)?.stringCellValue?.trim() + typeid = null + type = it.getCell(2)?.stringCellValue?.trim() + scensesubtypeid = null + scensesubtype = null + location = it.getCell(3)?.stringCellValue?.trim() + longitude = it.getCell(4)?.numericCellValue?.toBigDecimal() + latitude = it.getCell(5)?.numericCellValue?.toBigDecimal() + provincecode = null + provincename = it.getCell(6)?.stringCellValue?.trim() + citycode = null + cityname = it.getCell(7)?.stringCellValue?.trim() + districtcode = null + districtname = it.getCell(8)?.stringCellValue?.trim() + towncode = null + townname = it.getCell(9)?.stringCellValue?.trim() + contactst = it.getCell(11)?.stringCellValue?.trim() + contactswx = null + contacts = it.getCell(10)?.stringCellValue?.trim() + createdate = Date() + updatedate = Date() + extension1 = "1" + extension2 = null + index = it.getCell(5)?.stringCellValue?.trim()?.toInt() + remark = null + } + data.typeid = Constant.SceneType.getByName(data.type)?.value?.toByte() + ?: throw BizException(errorStr(it.rowNum + 1, 2, "鍦烘櫙绫诲瀷涓嶅瓨鍦�")) + data.provincecode = regionRep.findProvince(data.provincename)?.provincecode + ?: throw BizException(errorStr(it.rowNum + 1, 6, "鐪佷唤閿欒鎴栫郴缁熸湭鏇鹃厤缃�")) + data.citycode = regionRep.findCity(data.cityname)?.citycode + ?: throw BizException(errorStr(it.rowNum + 1, 7, "鍩庡競閿欒鎴栫郴缁熸湭鏇鹃厤缃�")) + data.districtcode = regionRep.findDistrict(data.districtname)?.districtcode + ?: throw BizException(errorStr(it.rowNum + 1, 8, "鍖哄幙閿欒鎴栫郴缁熸湭鏇鹃厤缃�")) + data.towncode = regionRep.findTown(data.townname)?.towncode + ?: throw BizException(errorStr(it.rowNum + 1, 9, "琛楅晣閿欒鎴栫郴缁熸湭鏇鹃厤缃�")) + + result.add(data) + } + } catch (e: IllegalStateException) { + throw BizException("excel鏂囦欢鍐呭閿欒锛屾暟鎹浆鎹㈠け璐ワ紒", e) + } + return result + } + + private fun errorStr(row: Int, col: Int, str: String): String { + return "绗�${row}琛岋紝绗�${col}鍒楀崟鍏冩牸閿欒锛�${str}" + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt index 6ac0c6a..7240490 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt @@ -1,12 +1,8 @@ package cn.flightfeather.supervision.business.report -import cn.flightfeather.supervision.common.exception.ResponseErrorException -import cn.flightfeather.supervision.common.utils.Constant -import cn.flightfeather.supervision.common.utils.DateUtil +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.utils.ExcelUtil -import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import org.apache.poi.hssf.usermodel.HSSFWorkbook -import tk.mybatis.mapper.entity.Example import java.io.FileOutputStream import java.io.OutputStream import java.util.* @@ -32,7 +28,7 @@ open fun execute() { - if (dataSourceList.isEmpty()) throw ResponseErrorException("${templateName}: 鏁版嵁婧愪负绌�") + if (dataSourceList.isEmpty()) throw BizException("${templateName}: 鏁版嵁婧愪负绌�") //鍚堟垚琛ㄥご cols.forEach { it.combineHead(head, dataSourceList[0]) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt index d334b56..2fd96af 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt @@ -182,19 +182,19 @@ private var _baseScene: BaseScene? = null //鍏蜂綋鐨勯棶棰� - val problems: MutableList<Problemlist> + val problems: List<Problemlist> get() { if (noRecord()) return mutableListOf() - if (_problems.isEmpty()) { + if (_problems == null) { val r = dbMapper.problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { createCriteria().andEqualTo("stguid", subTask?.stguid) }) - _problems.addAll(r) + _problems = r } - return _problems + return _problems ?: emptyList() } - private var _problems = mutableListOf<Problemlist>() + private var _problems: List<Problemlist>? = null //璇勪及鎬诲垎 val evaluation: Evaluation? @@ -211,38 +211,40 @@ private var _evaluation: Evaluation? = null //璇勪及缁嗗垯寰楀垎 - val itemevaluationList: MutableList<Itemevaluation> + val itemevaluationList: List<Itemevaluation> get() { - if (_itemevaluationList.isEmpty()) { + if (_itemevaluationList == null) { val r = dbMapper.itemevaluationMapper.selectByExample(Example(Itemevaluation::class.java).apply { createCriteria().andEqualTo("stguid", subTask?.stguid) }) - _itemevaluationList.addAll(r) + _itemevaluationList = r println("-------------------itemevaluationList--------------------------------") } - return _itemevaluationList + return _itemevaluationList ?: emptyList() } - private var _itemevaluationList = mutableListOf<Itemevaluation>() + private var _itemevaluationList: List<Itemevaluation>? = null //闂绫诲瀷 - val problemTypes: MutableList<Problemtype> + val problemTypes: List<Problemtype> get() { - if (_problemTypes.isEmpty()) { + if (_problemTypes == null) { val r = dbMapper.problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply { createCriteria().andEqualTo("scensetypeid", scene?.typeid) .andEqualTo("districtcode", scene?.districtcode) orderBy("extension1") }) - _problemTypes.addAll(r) + _problemTypes = r } - return _problemTypes + return _problemTypes ?: emptyList() } - private var _problemTypes = mutableListOf<Problemtype>() + private var _problemTypes: List<Problemtype>? = null //鑷姩璇勫垎瑙勫垯涓�绾у垎绫� - val topItems: MutableList<Evaluationsubrule2> + val topItems: List<Evaluationsubrule2> get() { - if (_topItems.isEmpty()) { + if (_topItems == null) { + val tempTopItems = mutableListOf<Evaluationsubrule2>() + val secRules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>() val rule = dbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { createCriteria() .andEqualTo("tasktypeid", 99) @@ -255,13 +257,13 @@ }) rules.forEach { if (it.ertype == 2) { - _topItems.add(it) + tempTopItems.add(it) } } - _topItems.sortBy { it.displayid } + tempTopItems.sortBy { it.displayid } var t = 0 - _topItems.forEach { + tempTopItems.forEach { t += it.maxscore ?: 0 val tempRules = mutableListOf<Evaluationsubrule2>() for (i in rules) { @@ -282,24 +284,26 @@ } } tempSubRules.sortBy { ts -> ts.displayid } - this._rules.add(Pair(temp, tempSubRules)) + secRules.add(Pair(temp, tempSubRules)) } } } + this._rules = secRules + _topItems = tempTopItems } - return _topItems + return _topItems ?: emptyList() } - private var _topItems = mutableListOf<Evaluationsubrule2>() + private var _topItems: List<Evaluationsubrule2>? = null //鑷姩璇勫垎瑙勫垯浜岀骇鍜屼笁绾у垎绫� - val rules: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>> + val rules: List<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>> get() { - if (_rules.isEmpty()) { + if (_rules == null) { this.topItems } - return _rules + return _rules ?: emptyList() } - private var _rules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>() + private var _rules: List<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>? = null //蹇呭~鍙拌处鏁伴噺 val ledgerCount: Int @@ -371,14 +375,14 @@ fun clear() { _scene = null _baseScene = null - _problems.clear() + _problems = null _evaluation = null - _itemevaluationList.clear() + _itemevaluationList = null _ledgerRecordNum = null if (lastScene != null && lastScene?.typeid != scene?.typeid) { - _problemTypes.clear() - _topItems.clear() - _rules.clear() + _problemTypes = null + _topItems = null + _rules = null _ledgerCount = -1 } recordLastScene() diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/exception/ResponseErrorException.kt b/src/main/kotlin/cn/flightfeather/supervision/common/exception/BizException.kt similarity index 83% rename from src/main/kotlin/cn/flightfeather/supervision/common/exception/ResponseErrorException.kt rename to src/main/kotlin/cn/flightfeather/supervision/common/exception/BizException.kt index e01d06e..2b21147 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/exception/ResponseErrorException.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/common/exception/BizException.kt @@ -1,9 +1,9 @@ package cn.flightfeather.supervision.common.exception /** - * 鍏佽鎺ュ彛杩斿洖鐨勪笟鍔″眰闈㈢殑閿欒 + * 鍏佽鎺ュ彛杩斿洖鐨勪笟鍔″眰闈㈤敊璇� */ -class ResponseErrorException : Exception { +class BizException : Exception { constructor():super() constructor(message: String) : super(message) constructor(message: String, cause: Throwable) : super(message, cause) diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt index a7c6250..c8f23f6 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt @@ -1,8 +1,7 @@ package cn.flightfeather.supervision.common.executor -import cn.flightfeather.supervision.common.exception.ResponseErrorException +import cn.flightfeather.supervision.common.exception.BizException import org.springframework.stereotype.Component -import java.time.LocalDateTime import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.Executors import kotlin.jvm.Throws @@ -21,13 +20,23 @@ /** * 鏂板浠诲姟 */ - @Throws(ResponseErrorException::class) + @Throws(BizException::class) fun newTask(type: BgTaskType, id: String, name: String, task: () -> Boolean): BgTask { if (!taskCollection.containsKey(type)) { taskCollection[type] = ConcurrentHashMap<String, BgTask>() } val taskSet = taskCollection[type]!! - if (taskSet.containsKey(id)) throw ResponseErrorException("鏃犳硶鍒涘缓浠诲姟锛� 浠诲姟[${name}]鐨刬d閲嶅") + // 鍒ゆ柇浠诲姟id鏄惁瀛樺湪 + if (taskSet.containsKey(id)) { + val oldTask = taskSet[id] + // 褰撲换鍔″凡缁忕粨鏉熸椂锛岀洿鎺ュ垹闄わ紝鏇挎崲涓烘柊浠诲姟 + if (oldTask?.taskStatus?.status != TaskStatus.WAITING || oldTask.taskStatus.status != TaskStatus.RUNNING) { + taskSet.remove(id) + } + else { + throw BizException("鏃犳硶閲嶅鍒涘缓浠诲姟") + } + } val t = BgTask(type, id, name, task) taskSet[id] = t return t @@ -36,20 +45,20 @@ /** * 寮�濮嬩换鍔� */ - @Throws(ResponseErrorException::class) + @Throws(BizException::class) fun startTask(type: BgTaskType, id: String): BgTask { - val taskSet = taskCollection[type] ?: throw throw ResponseErrorException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔$被鍨媅${type.des}]涓嶅瓨鍦�") - val t = taskSet[id] ?: throw ResponseErrorException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔${id}]涓嶅瓨鍦�") + val taskSet = taskCollection[type] ?: throw throw BizException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔$被鍨媅${type.des}]涓嶅瓨鍦�") + val t = taskSet[id] ?: throw BizException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔${id}]涓嶅瓨鍦�") return startTask(t) } - @Throws(ResponseErrorException::class) + @Throws(BizException::class) fun startTask(task: BgTask): BgTask { if (task.taskStatus.status != TaskStatus.WAITING) { if (task.taskStatus.status == TaskStatus.RUNNING) { - throw ResponseErrorException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]姝e湪鎵ц") + throw BizException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]姝e湪鎵ц") } else { - throw ResponseErrorException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]宸茬粨鏉�") + throw BizException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]宸茬粨鏉�") } } else { task.ready() @@ -61,7 +70,7 @@ /** * 鏂板骞跺紑濮嬩换鍔� */ - @Throws(ResponseErrorException::class) + @Throws(BizException::class) fun startNewTask(type: BgTaskType, id: String, name: String, task: () -> Boolean): BgTask { val t = newTask(type, id, name, task) return startTask(t) @@ -96,11 +105,11 @@ /** * 寮哄埗鍏抽棴浠诲姟 */ - @Throws(ResponseErrorException::class) + @Throws(BizException::class) fun shutDownTask(type: BgTaskType, id: String?): List<BgTaskStatus?> { - val taskMap = taskCollection[type] ?: throw ResponseErrorException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔$被鍨媅${type.des}]鏈垱寤�") + val taskMap = taskCollection[type] ?: throw BizException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔$被鍨媅${type.des}]鏈垱寤�") return if (id != null) { - val task = taskMap[id] ?: throw ResponseErrorException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔${id}]涓嶅瓨鍦�") + val task = taskMap[id] ?: throw BizException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔${id}]涓嶅瓨鍦�") task.shutdown() listOf(task.taskStatus) } else { @@ -113,11 +122,11 @@ } } - @Throws(ResponseErrorException::class) + @Throws(BizException::class) fun removeTask(type: BgTaskType, id: String): Boolean { val statusList = shutDownTask(type, id) if (statusList.isNotEmpty()) { - val s = statusList.first() ?: throw ResponseErrorException("鏃犳硶绉婚櫎浠诲姟锛屼换鍔′笉瀛樺湪") + val s = statusList.first() ?: throw BizException("鏃犳硶绉婚櫎浠诲姟锛屼换鍔′笉瀛樺湪") taskCollection[s.type]?.remove(s.id) return true } diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt index 953eac3..66a9315 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt @@ -1,6 +1,5 @@ package cn.flightfeather.supervision.common.executor -import org.springframework.scheduling.annotation.Async import java.time.LocalDateTime import java.util.concurrent.Future @@ -22,8 +21,13 @@ } fun execute() { - val res = task() - if (res) success() else fail() + try { + val res = task() + if (res) success() else fail() + } catch (e: Exception) { + fail() + taskStatus.extra = e.message + } } fun success() { @@ -39,9 +43,9 @@ fun shutdown() { if (future?.isCancelled == false && !future!!.isDone) { future!!.cancel(true) - taskStatus.status = TaskStatus.SHUTDOWN - complete() } + taskStatus.status = TaskStatus.SHUTDOWN + complete() } fun complete() { diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/CacheUtil.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/CacheUtil.kt new file mode 100644 index 0000000..e24f57b --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/CacheUtil.kt @@ -0,0 +1,20 @@ +package cn.flightfeather.supervision.common.utils + +import org.springframework.stereotype.Component + +/** + * 缂撳瓨鍙橀噺绠$悊宸ュ叿 + * 鍏佽鏁版嵁搴撳父鐢ㄧ殑鍙橀噺鍦ㄥ唴瀛樹腑缂撳瓨涓�娈垫椂闂达紝鎻愰珮璁块棶閫熷害 + * 鍚庣画搴旇浣跨敤redis绛塏OSQL鏁版嵁搴撴浛浠� + */ +@Component +class CacheUtil { + + /** + * 娣诲姞鍙橀噺 + * + */ + fun addParams(p:Any?) { + + } +} \ 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 3068925..8cf5bbb 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt @@ -45,23 +45,8 @@ else -> sceneTypeId } - fun getDes(value: Int?) = when (value.toString()) { - "1" -> TYPE1.text - "2" -> TYPE2.text - "3" -> TYPE3.text - "4" -> TYPE4.text - "5" -> TYPE5.text - "6" -> TYPE6.text - "7" -> TYPE7.text - "8" -> TYPE8.text - "9" -> TYPE9.text - "10" -> TYPE10.text - "11" -> TYPE11.text - "12" -> TYPE12.text - "13" -> TYPE13.text - "14" -> TYPE14.text - "99" -> TYPE99.text - else -> "" + fun getDes(value: Int?): String { + return getByValue(value?.toString()).text } fun getByValue(value: String?) = when (value.toString()) { @@ -82,6 +67,25 @@ "99" -> TYPE99 else -> TYPE99 } + + fun getByName(name: String?) = when (name) { + TYPE1.text -> TYPE1 + TYPE2.text -> TYPE2 + TYPE3.text -> TYPE3 + TYPE4.text -> TYPE4 + TYPE5.text -> TYPE5 + TYPE6.text -> TYPE6 + TYPE7.text -> TYPE7 + TYPE8.text -> TYPE8 + TYPE9.text -> TYPE9 + TYPE10.text -> TYPE10 + TYPE11.text -> TYPE11 + TYPE12.text -> TYPE12 + TYPE13.text -> TYPE13 + TYPE14.text -> TYPE14 + TYPE99.text -> TYPE99 + else -> null + } } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt index f69a607..7bd1347 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt @@ -1,7 +1,12 @@ package cn.flightfeather.supervision.common.utils +import cn.flightfeather.supervision.common.exception.BizException import org.apache.poi.hssf.usermodel.HSSFWorkbook +import org.apache.poi.ss.usermodel.CellType +import org.apache.poi.ss.usermodel.Row import org.apache.poi.ss.util.CellRangeAddress +import org.apache.poi.xssf.usermodel.XSSFWorkbook +import java.io.InputStream import java.io.OutputStream import java.time.LocalDate import java.util.* @@ -14,6 +19,9 @@ */ object ExcelUtil { + /** + * 鍗曞厓鏍� + */ class MyCell( var text: String, var rowSpan: Int = 1, @@ -23,9 +31,63 @@ ) /** + * 琛ㄥご瀹氫箟 + */ + class MyHeader( + var name: String, + val type: CellType, + ) + + private fun cellTypeName(type: CellType): String = when (type) { + CellType.NUMERIC -> "鏁板瓧" + CellType.STRING -> "鏂囨湰" + CellType.FORMULA -> "FORMULA" + CellType.BLANK -> "绌虹櫧" + CellType.BOOLEAN -> "甯冨皵鍊�" + else -> "鏈畾涔�" + } + + + /** + * 鍖呮嫭 .xlsx 鏂囦欢 + */ + fun readXLXS(input: InputStream, headers: List<MyHeader>, onRow: (row: Row) -> Unit) { + val workbook = XSSFWorkbook(input) + val sheet1 = workbook.getSheetAt(0) + val header = sheet1.getRow(sheet1.topRow.toInt()) + // 妫�鏌ヤ紶鍏ョ殑鏂囦欢琛ㄥご鏄惁绗﹀悎瑕佹眰 + val cellIterator = header.cellIterator() + val headIterator = headers.iterator() + while (headIterator.hasNext()) { + val head = headIterator.next() + if (cellIterator.hasNext()) { + val cellText = cellIterator.next().stringCellValue + if (!cellText.equals(head.name)) { + throw BizException("鏂囦欢鏍煎紡閿欒, 琛ㄥご[${head}]搴旇涓篬${cellText}]") + } + } else { + throw BizException("鏂囦欢鏍煎紡閿欒, 琛ㄥご[${head}]缂哄け") + } + } + // 鑾峰彇杩唬鍣ㄥ苟鍘婚櫎绗竴琛屾爣棰� + val iterator = sheet1.rowIterator().also { it.next() } + iterator.forEach { + // 妫�鏌ュ綋鍓嶈姣忎釜鍗曞厓鏍肩被鍨嬫槸鍚︿笌琛ㄥご瀹氫箟鍖归厤 + headers.forEachIndexed { i, h -> + val t = it.getCell(i + 1).cellType + if (t != CellType.BLANK || t != h.type) { + throw BizException("绗�${it.rowNum + 1}琛岋紝绗�${i + 1}鍒楀崟鍏冩牸鏍煎紡閿欒锛屽簲璇ヤ负${cellTypeName(h.type)}") + } + } + onRow(it) + } + } + + /** * 鑷姩澶勭悊琛屽悎骞舵暟鎹� */ - fun write(heads: List<Array<Any>>, contents: MutableList<Array<Any>>, workbook: HSSFWorkbook, sheetName: String = "sheet1") { + fun write(heads: List<Array<Any>>, contents: MutableList<Array<Any>>, workbook: HSSFWorkbook, sheetName: String + = "sheet1") { val sheet = workbook.createSheet(sheetName) @@ -226,7 +288,7 @@ out.close() } - private fun getMaxRows(rowArray: Array<Any>): Int { + private fun getMaxRows(rowArray: Array<out Any>): Int { var maxRows = 1 rowArray.forEach { if (it is Array<*>) { diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt index 7cdb09e..4aadb7c 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt @@ -6,6 +6,12 @@ import javax.persistence.Id import javax.persistence.Table +/** + * @date 2024.4.25 + * 鐢ㄤ簬鏆傛椂鏇夸唬[Evaluationsubrule]鐨勭被 + * 鍥犱负鍙傛暟[Evaluationsubrule.ertype]琚敊璇殑璁惧畾涓篬Boolean]绫诲瀷锛屽疄闄呭簲涓篬Int]绫诲瀷锛� + * 鐩墠涓昏褰卞搷浜嗗畨鍗揂PP绋嬪簭锛屽皢APP绋嬪簭瀵瑰簲鍙傛暟璋冩暣鍚庢湰绫诲彲瀹屽叏鏇挎崲[Evaluationsubrule] + */ @Table(name = "sm_t_evaluationsubrule") @JsonInclude(JsonInclude.Include.NON_NULL) public class Evaluationsubrule2 { diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/InspectionMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/InspectionMapper.kt index 7e9a05e..b9c227d 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/InspectionMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/InspectionMapper.kt @@ -2,6 +2,7 @@ import cn.flightfeather.supervision.domain.ds1.entity.Inspection import cn.flightfeather.supervision.domain.util.MyMapper +import cn.flightfeather.supervision.lightshare.vo.InspectionInfoVo import cn.flightfeather.supervision.lightshare.vo.InspectionStatisticVo import org.apache.ibatis.annotations.Mapper import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType @@ -10,7 +11,7 @@ interface InspectionMapper:MyMapper<Inspection> { //鑾峰彇姹℃煋鍦烘櫙鐗堟湰涓婚〉鐨勭洃绠℃儏鍐靛睍绀哄唴瀹� - fun getInspectionInfoByScene(sceneId: String, topTaskId: String): List<Map<String, JvmType.Object>> + fun getInspectionInfoByScene(sceneId: String, topTaskId: String): List<InspectionInfoVo?> //鑾峰彇鏈堜换鍔″贰鏌ョ粺璁′俊鎭� fun getStatistic(topTaskId: String, sceneTypeId: String): List<InspectionStatisticVo> diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt index 894e37c..c79c5ee 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt @@ -1,10 +1,11 @@ package cn.flightfeather.supervision.domain.ds1.mapper import cn.flightfeather.supervision.domain.ds1.entity.Monitorobjectversion -import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.util.MyMapper import org.apache.ibatis.annotations.Mapper -import org.apache.ibatis.annotations.Select @Mapper -interface MonitorobjectversionMapper:MyMapper<Monitorobjectversion> \ No newline at end of file +interface MonitorobjectversionMapper : MyMapper<Monitorobjectversion> { + + fun findMonitorListByScene(taskId: String, sceneTypeId: String?): List<Monitorobjectversion> +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ProblemlistMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ProblemlistMapper.kt index 9aee3a8..b0759ad 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ProblemlistMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ProblemlistMapper.kt @@ -2,22 +2,29 @@ import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import cn.flightfeather.supervision.domain.util.MyMapper +import cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary +import cn.flightfeather.supervision.lightshare.vo.StatisticsVo import cn.flightfeather.supervision.lightshare.vo.UnChangedPro import org.apache.ibatis.annotations.Mapper import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType @Mapper -interface ProblemlistMapper:MyMapper<Problemlist> { +interface ProblemlistMapper : MyMapper<Problemlist> { /** * 鑾峰彇鏌愭椂闂存鍐呫�佹煇涓尯鍘跨殑鏌愮鍦烘櫙涓嬶紝鍚勭被鍨嬬殑闂鏁伴噺缁熻 - * @param districtcode 鍖哄幙琛屾斂缂栫爜 - * @param starttime 寮�濮嬫椂闂� - * @param endtime 缁撴潫鏃堕棿 + * @param districtCode 鍖哄幙琛屾斂缂栫爜 + * @param startTime 寮�濮嬫椂闂� + * @param endTime 缁撴潫鏃堕棿 * @param sceneType 鍦烘櫙绫诲瀷 */ - fun getStatisticalResult(districtcode:String?, starttime:String?, endtime:String?, sceneType:String?): List<Map<String, JvmType.Object>> -// fun getStatisticalResult(): List<Map<String, JvmType.Object>> + fun getStatisticalResult( + districtCode: String?, + startTime: String?, + endTime: String?, + sceneType: String?, + sceneId: String?, + ): List<StatisticsVo> fun getStatisticalResultById(topTaskId: String?, sceneTypeId: String?): List<Map<String, JvmType.Object>> @@ -26,9 +33,9 @@ * @param topTaskId 椤跺眰浠诲姟涓婚敭id * @param sceneType 鍦烘櫙绫诲瀷id */ - fun getChangeResult(topTaskId:String?, sceneType:String?): List<Map<String, JvmType.Object>> + fun getChangeResult(topTaskId: String?, sceneType: String?): List<Map<String, JvmType.Object>> - fun getScoreResult(topTaskId:String?, sceneType:String?): List<Map<String, JvmType.Object>> + fun getScoreResult(topTaskId: String?, sceneType: String?): List<Map<String, JvmType.Object>> fun selectSE(sql: String): String @@ -39,7 +46,7 @@ /** * 閫氳繃ID鏌ユ壘 鏈堥棶棰樺垪琛� */ - fun findMonthProblemById(taskId: String,sceneType: Int?): List<Map<String, JvmType.Object?>> + fun findMonthProblemById(taskId: String, sceneType: Int?): List<Map<String, JvmType.Object?>> /** * 閫氳繃鏃ヤ换鍔d鏌ユ壘鏈暣鏀瑰畬鎴愮殑瀛愪换鍔℃暟,杩斿洖鐨勬槸姣忎釜瀛愪换鍔℃湭瀹屾垚鏁存敼鐨勯棶棰樻暟 @@ -50,4 +57,14 @@ * 鏌ユ壘闂鐢熸垚鏃堕棿鍦ㄧ粰瀹氭椂闂翠箣鍓嶇殑鎵�鏈夐棶棰� */ fun getUnChangedProblem(deadLine: String): List<UnChangedPro> + + /** + * 鑾峰彇鎬讳换鍔� + */ + fun getSceneProSummary( + topTaskId: String, + sceneTypeId: String?, + sort: String?, + sortBy: String, + ): List<SceneProblemSummary> } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt index 145fddb..7b3bb4b 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt @@ -1,5 +1,6 @@ package cn.flightfeather.supervision.domain.ds1.mapper +import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.ds1.entity.Subtask import cn.flightfeather.supervision.domain.util.MyMapper import cn.flightfeather.supervision.lightshare.vo.SubTaskSearchResultVo2 @@ -7,6 +8,7 @@ import cn.flightfeather.supervision.lightshare.vo.SubtaskSearchResultVo import cn.flightfeather.supervision.lightshare.vo.SubtaskVo import org.apache.ibatis.annotations.Mapper +import java.time.LocalDateTime import java.util.* @Mapper @@ -21,4 +23,8 @@ fun selectByTopTask2(topTaskId: String, sceneTypeId: Int? = null): List<Subtask> fun getSummary(topTaskId: String, sceneTypeId: Int?): List<SubTaskSummary> + + fun getSummaryByScene(sceneId: String, startTime: LocalDateTime?, endTime: LocalDateTime?): List<SubTaskSummary> + + fun findSubTasksByProType(topTaskId: String, sceneTypeId: String, proType: String): List<Subtask> } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt index 0d7eb94..b02ade6 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt @@ -1,6 +1,7 @@ package cn.flightfeather.supervision.domain.ds1.repository import cn.flightfeather.supervision.domain.ds1.entity.Evaluation +import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationMapper import cn.flightfeather.supervision.domain.ds1.mapper.ItemevaluationMapper import cn.flightfeather.supervision.lightshare.vo.AreaVo @@ -32,6 +33,7 @@ return if (res.isNotEmpty()) res[0] else null } + /** * 鏌ユ壘鑷姩璇勫垎缁撴灉 */ @@ -40,4 +42,13 @@ val task = taskRep.findOneTask(areaVo) ?: return null return evaluationMapper.findEvaluation(task.tguid!!, areaVo.scensetypeid!!) } + + /** + * 鏌ユ壘宸℃煡浠诲姟鐨勫叿浣撹瘎鍒� + */ + fun findItemEvaluation(subTaskId: String): List<Itemevaluation> { + return itemevaluationMapper.selectByExample(Example(Itemevaluation::class.java).apply { + createCriteria().andEqualTo("stguid", subTaskId) + }) + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt index 30fbccc..dd40759 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt @@ -1,5 +1,6 @@ package cn.flightfeather.supervision.domain.ds1.repository +import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper import cn.flightfeather.supervision.lightshare.vo.AreaEvaVo @@ -10,7 +11,10 @@ * 璇勪及瑙勫垯鏁版嵁搴撶浉鍏虫搷浣� */ @Repository -class EvaluationRuleRep(private val evaluationruleMapper: EvaluationruleMapper) { +class EvaluationRuleRep( + private val evaluationruleMapper: EvaluationruleMapper, + private val sceneRep: SceneRep, +) { /** * 鏍规嵁鍙傛暟鏌ヨ鎬昏鍒� @@ -27,4 +31,17 @@ and(createCriteria().orEqualTo("towncode", areaEvaVo.towncode).orIsNull("towncode")) }) } + + fun findAutoEvaluationRule(subTaskId:String): Evaluationrule? { + val scene = sceneRep.findBySubTask(subTaskId) + return findAutoEvaluationRule(Constant.SceneType.getByValue(scene?.typeid.toString())) + } + + fun findAutoEvaluationRule(sceneType: Constant.SceneType): Evaluationrule? { + return evaluationruleMapper.selectOne(Evaluationrule().apply { + scensetypeid = sceneType.value.toByteOrNull() + tasktypeid = 99 + }) + } + } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt new file mode 100644 index 0000000..2334562 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt @@ -0,0 +1,14 @@ +package cn.flightfeather.supervision.domain.ds1.repository + +import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper +import cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary +import org.springframework.stereotype.Repository + +@Repository +class ProblemRep(private val problemlistMapper: ProblemlistMapper) { + + fun getSceneProSummary(topTaskId: String, sceneTypeId: String?, sort: String?, sortBy: String): + List<SceneProblemSummary> { + return problemlistMapper.getSceneProSummary(topTaskId, sceneTypeId, sort, sortBy) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/RegionRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/RegionRep.kt new file mode 100644 index 0000000..fbe9e51 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/RegionRep.kt @@ -0,0 +1,67 @@ +package cn.flightfeather.supervision.domain.ds1.repository + +import cn.flightfeather.supervision.common.utils.CacheUtil +import cn.flightfeather.supervision.domain.ds1.entity.City +import cn.flightfeather.supervision.domain.ds1.entity.District +import cn.flightfeather.supervision.domain.ds1.entity.Province +import cn.flightfeather.supervision.domain.ds1.entity.Town +import cn.flightfeather.supervision.domain.ds1.mapper.CityMapper +import cn.flightfeather.supervision.domain.ds1.mapper.DistrictMapper +import cn.flightfeather.supervision.domain.ds1.mapper.ProvinceMapper +import cn.flightfeather.supervision.domain.ds1.mapper.TownMapper +import org.springframework.stereotype.Repository +import tk.mybatis.mapper.entity.Example + +/** + * 鍦板煙淇℃伅鐩稿叧鏁版嵁搴撴搷浣� + */ +@Repository +class RegionRep( + private val provinceMapper: ProvinceMapper, + private val cityMapper: CityMapper, + private val districtMapper: DistrictMapper, + private val townMapper: TownMapper, + private val cacheUtil: CacheUtil, +) { + private val cacheMap = mutableMapOf<String, Any?>() + + private fun<T : Any?> findCache(key: String?, findDb: () -> T?): T? { + key ?: return null + val s = cacheMap[key] + return if (s == null) { + val value = findDb() + cacheMap[key] = value + value + } else { + try { + s as T + } catch (e: Exception) { + null + } + } + } + + fun findProvince(name: String?): Province? { + return findCache(name) { + provinceMapper.selectOne(Province().apply { provincename = name }) + } + } + + fun findCity(name: String?): City? { + return findCache(name) { + cityMapper.selectOne(City().apply { cityname = name }) + } + } + + fun findDistrict(name: String?): District? { + return findCache(name) { + districtMapper.selectOne(District().apply { districtname = name }) + } + } + + fun findTown(name: String?): Town? { + return findCache(name) { + townMapper.selectOne(Town().apply { townname = name }) + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt index b47f19a..cec2e1a 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt @@ -1,8 +1,14 @@ package cn.flightfeather.supervision.domain.ds1.repository +import cn.flightfeather.supervision.common.exception.BizException +import cn.flightfeather.supervision.common.utils.UUIDGenerator import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper +import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper +import javafx.scene.Scene import org.springframework.stereotype.Repository +import tk.mybatis.mapper.entity.Example +import java.util.* /** * 鍦烘櫙淇℃伅鏁版嵁搴撶浉鍏虫搷浣� @@ -10,7 +16,16 @@ @Repository class SceneRep( private val scenseMapper: ScenseMapper, + private val userinfoMapper: UserinfoMapper, + private val subTaskRep: SubTaskRep, ) { + + fun insert(scense: Scense?):Int { + scense ?: return 0 + if (scense.guid == null) scense.guid = UUIDGenerator.generate16ShortUUID() + scense.createdate = Date() + return scenseMapper.insertSelective(scense) + } /** * 鏌ユ壘鍦烘櫙 @@ -18,4 +33,27 @@ fun findScene(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<Scense?> { return scenseMapper.getSceneByType(topTaskId, sceneTypeId, townCode) } + + fun findScene(userId: String?): Scense? { + val user = userinfoMapper.selectByPrimaryKey(userId) ?: throw BizException("鐢ㄦ埛id涓嶅瓨鍦�") + return scenseMapper.selectByPrimaryKey(user.dGuid) + } + + fun findScene(sceneId: String? = null, sceneName: String? = null): Scense? { + return scenseMapper.selectOne(Scense().apply { + guid = sceneId + name = sceneName + }) + } + + fun findScenes(nameList: List<String?>): List<Scense?> { + return scenseMapper.selectByExample(Example(Scense::class.java).apply { + createCriteria().andIn("name", nameList) + }) + } + + fun findBySubTask(subTaskId: String): Scense? { + val subtask = subTaskRep.find(subTaskId) + return scenseMapper.selectByPrimaryKey(subtask?.scenseid) + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt new file mode 100644 index 0000000..feb9778 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt @@ -0,0 +1,20 @@ +package cn.flightfeather.supervision.domain.ds1.repository + +import cn.flightfeather.supervision.domain.ds1.entity.Subtask +import cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper +import org.springframework.stereotype.Repository + +@Repository +class SubTaskRep(private val subtaskMapper: SubtaskMapper) { + + + fun find(id:String): Subtask? { + return subtaskMapper.selectByPrimaryKey(id) + } + /** + * 鏍规嵁鎬讳换鍔°�佸満鏅被鍨嬨�侀棶棰樼被鍨嬶紝鑾峰彇鍙戠幇璇ョ绫婚棶棰樼殑鍦烘櫙淇℃伅 + */ + fun findSubtasks(topTaskId: String, sceneTypeId:String, proType: String): List<Subtask?> { + return subtaskMapper.findSubTasksByProType(topTaskId, sceneTypeId, proType) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt index 14eccea..58db4df 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt @@ -1,17 +1,16 @@ package cn.flightfeather.supervision.domain.ds1.repository +import cn.flightfeather.supervision.domain.ds1.entity.Monitorobjectversion import cn.flightfeather.supervision.domain.ds1.entity.Task +import cn.flightfeather.supervision.domain.ds1.mapper.MonitorobjectversionMapper import cn.flightfeather.supervision.domain.ds1.mapper.TaskMapper import cn.flightfeather.supervision.lightshare.vo.AreaVo import org.springframework.stereotype.Repository -import java.time.LocalDate -import java.time.LocalDateTime import java.time.ZoneId -import java.time.format.DateTimeFormatter import java.util.* @Repository -class TaskRep(private val taskMapper: TaskMapper) { +class TaskRep(private val taskMapper: TaskMapper, private val monitorobjectversionMapper: MonitorobjectversionMapper) { private fun exampleTask(areaVo: AreaVo): Task?{ areaVo.starttime ?: return null @@ -37,4 +36,12 @@ val example = exampleTask(areaVo) ?: return emptyList() return taskMapper.select(example) } + + /** + * 鑾峰彇鎬讳换鍔″搴旂殑鐩戠鐗堟湰 + */ + fun findMonitorList(taskId: String, sceneTypeId:String?): List<Monitorobjectversion> { + val monitorList = monitorobjectversionMapper.findMonitorListByScene(taskId, sceneTypeId) + return monitorList.sortedBy { it.displayid } + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt index a3ea0a8..fba609a 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt @@ -15,7 +15,7 @@ ) { /** - * 鏌ユ壘鍦烘櫙 + * 鏌ユ壘鐢ㄦ埛 */ fun findUser(sceneIdList: List<String?>): List<Userinfo?> { return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { @@ -23,9 +23,11 @@ }) } - fun findUser(sceneId: String): List<Userinfo?> { - return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { - createCriteria().andEqualTo("dGuid", sceneId) - }) + fun findUser(sceneId: String?): Userinfo? { + return try { + userinfoMapper.selectOne(Userinfo().apply { dGuid = sceneId }) + } catch (e: Exception) { + null + } } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/BaseInfo.java b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/BaseInfo.java index 9b3a421..e29dfa6 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/BaseInfo.java +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/BaseInfo.java @@ -21,6 +21,12 @@ private String biName; /** + * 鐢ㄦ埛绠�绉� + */ + @Column(name = "BI_Nick_Name") + private String biNickName; + + /** * 鎵�灞炲叕鍙竔d */ @Column(name = "CI_GUID") @@ -31,6 +37,36 @@ */ @Column(name = "CI_Name") private String ciName; + + @Column(name = "BI_Province_Code") + private String biProvinceCode; + + @Column(name = "BI_Province_Name") + private String biProvinceName; + + @Column(name = "BI_City_Code") + private String biCityCode; + + @Column(name = "BI_City_Name") + private String biCityName; + + @Column(name = "BI_District_Code") + private String biDistrictCode; + + @Column(name = "BI_District_Name") + private String biDistrictName; + + @Column(name = "BI_Town_Code") + private String biTownCode; + + @Column(name = "BI_Town_Name") + private String biTownName; + + @Column(name = "BI_Area_Code") + private String biAreaCode; + + @Column(name = "BI_Area") + private String biArea; /** * 鎵�灞炵墿涓氬叕鍙稿悕绉癷d @@ -117,6 +153,24 @@ } /** + * 鑾峰彇鐢ㄦ埛绠�绉� + * + * @return BI_Nick_Name - 鐢ㄦ埛绠�绉� + */ + public String getBiNickName() { + return biNickName; + } + + /** + * 璁剧疆鐢ㄦ埛绠�绉� + * + * @param biNickName 鐢ㄦ埛绠�绉� + */ + public void setBiNickName(String biNickName) { + this.biNickName = biNickName == null ? null : biNickName.trim(); + } + + /** * 鑾峰彇鎵�灞炲叕鍙竔d * * @return CI_GUID - 鎵�灞炲叕鍙竔d @@ -153,6 +207,146 @@ } /** + * @return BI_Province_Code + */ + public String getBiProvinceCode() { + return biProvinceCode; + } + + /** + * @param biProvinceCode + */ + public void setBiProvinceCode(String biProvinceCode) { + this.biProvinceCode = biProvinceCode == null ? null : biProvinceCode.trim(); + } + + /** + * @return BI_Province_Name + */ + public String getBiProvinceName() { + return biProvinceName; + } + + /** + * @param biProvinceName + */ + public void setBiProvinceName(String biProvinceName) { + this.biProvinceName = biProvinceName == null ? null : biProvinceName.trim(); + } + + /** + * @return BI_City_Code + */ + public String getBiCityCode() { + return biCityCode; + } + + /** + * @param biCityCode + */ + public void setBiCityCode(String biCityCode) { + this.biCityCode = biCityCode == null ? null : biCityCode.trim(); + } + + /** + * @return BI_City_Name + */ + public String getBiCityName() { + return biCityName; + } + + /** + * @param biCityName + */ + public void setBiCityName(String biCityName) { + this.biCityName = biCityName == null ? null : biCityName.trim(); + } + + /** + * @return BI_District_Code + */ + public String getBiDistrictCode() { + return biDistrictCode; + } + + /** + * @param biDistrictCode + */ + public void setBiDistrictCode(String biDistrictCode) { + this.biDistrictCode = biDistrictCode == null ? null : biDistrictCode.trim(); + } + + /** + * @return BI_District_Name + */ + public String getBiDistrictName() { + return biDistrictName; + } + + /** + * @param biDistrictName + */ + public void setBiDistrictName(String biDistrictName) { + this.biDistrictName = biDistrictName == null ? null : biDistrictName.trim(); + } + + /** + * @return BI_Town_Code + */ + public String getBiTownCode() { + return biTownCode; + } + + /** + * @param biTownCode + */ + public void setBiTownCode(String biTownCode) { + this.biTownCode = biTownCode == null ? null : biTownCode.trim(); + } + + /** + * @return BI_Town_Name + */ + public String getBiTownName() { + return biTownName; + } + + /** + * @param biTownName + */ + public void setBiTownName(String biTownName) { + this.biTownName = biTownName == null ? null : biTownName.trim(); + } + + /** + * @return BI_Area_Code + */ + public String getBiAreaCode() { + return biAreaCode; + } + + /** + * @param biAreaCode + */ + public void setBiAreaCode(String biAreaCode) { + this.biAreaCode = biAreaCode == null ? null : biAreaCode.trim(); + } + + /** + * @return UC_Area + */ + public String getBiArea() { + return biArea; + } + + /** + * @param biArea + */ + public void setBiArea(String biArea) { + this.biArea = biArea == null ? null : biArea.trim(); + } + + /** * 鑾峰彇鎵�灞炵墿涓氬叕鍙稿悕绉癷d * * @return BI_Management_Company_Id - 鎵�灞炵墿涓氬叕鍙稿悕绉癷d diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/BaseInfoRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/BaseInfoRep.kt new file mode 100644 index 0000000..27ec303 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/BaseInfoRep.kt @@ -0,0 +1,36 @@ +package cn.flightfeather.supervision.domain.ds2.repository + +import cn.flightfeather.supervision.domain.ds1.entity.Scense +import cn.flightfeather.supervision.domain.ds2.entity.BaseInfo +import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ +import cn.flightfeather.supervision.domain.ds2.mapper.BaseInfoMapper +import org.springframework.stereotype.Repository +import java.util.* + +@Repository +class BaseInfoRep( + private val baseInfoMapper: BaseInfoMapper, +) { + + fun create(info: UserinfoTZ, scense: Scense): BaseInfo { + val baseInfo = BaseInfo().apply { + biGuid = info.guid + biName = info.realname + biProvinceCode = scense.provincecode + biProvinceName = scense.provincename + biCityCode = scense.citycode + biCityName = scense.cityname + biDistrictCode = scense.districtcode + biDistrictName = scense.districtname + biTownCode = scense.towncode + biTownName = scense.townname + biContact = scense.contacts + biTelephone = scense.contactst + biAddress = scense.location + biCreateTime = Date() + biExtension1 = info.acountname + } + baseInfoMapper.insert(baseInfo) + return baseInfo + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt index a5f7ef2..f6f0caa 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt @@ -11,7 +11,7 @@ import java.util.* /** - * 淇¤鎶曡瘔鍜岃鏀垮缃氭暟鎹簱鐩稿叧鎿嶄綔 + * 淇¤鎶曡瘔鍜岃鏀垮缃氭暟鎹簱鐩稿叧鎿嶄綔 */ @Repository class ComplaintAndPunishmentRep( diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteMapRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteMapRep.kt deleted file mode 100644 index 5169703..0000000 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteMapRep.kt +++ /dev/null @@ -1,26 +0,0 @@ -package cn.flightfeather.supervision.domain.ds2.repository - -import cn.flightfeather.supervision.domain.ds2.entity.DustSiteMap -import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteMapMapper -import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example - -/** - * 闈欏畨宸ュ湴鎵皹鐩戞祴鐐逛綅鍜岀郴缁熺敤鎴锋槧灏勫叧绯绘暟鎹簱鐩稿叧鎿嶄綔 - */ -@Repository -class JADustSiteMapRep( - private val dustSiteMapMapper: DustSiteMapMapper, -) { - - /** - * 鏍规嵁椋炵窘鐩戠鐢ㄦ埛id鏌ヨ - */ - fun findBySVUserId(idList: List<String?>): List<DeviceMapVo> { - val res = dustSiteMapMapper.selectByExample(Example(DustSiteMap::class.java).apply { - createCriteria().andIn("svUserId", idList) - }) - return DeviceMapVo.fromJADustSiteMap(res) - } -} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt new file mode 100644 index 0000000..4b3810b --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt @@ -0,0 +1,40 @@ +package cn.flightfeather.supervision.domain.ds2.repository + +import cn.flightfeather.supervision.domain.ds2.entity.DustSiteMap +import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteInfoMapper +import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteMapMapper +import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo +import cn.flightfeather.supervision.lightshare.vo.DeviceSiteVo +import org.springframework.stereotype.Repository +import tk.mybatis.mapper.entity.Example + +/** + * 闈欏畨宸ュ湴鎵皹鐩戞祴鐐逛綅鏁版嵁搴撶浉鍏虫搷浣� + */ +@Repository +class JADustSiteRep( + private val dustSiteMapMapper: DustSiteMapMapper, + private val dustSiteInfoMapper: DustSiteInfoMapper, +) { + + /** + * 鏍规嵁椋炵窘鐩戠鐢ㄦ埛id鏌ヨ鍦烘櫙鍜岀洃娴嬭澶囩殑鍖归厤鍏崇郴 + * @param idList 鐩戠鍦烘櫙瀵瑰簲鐨勭敤鎴穒d鍒楄〃 + * @return 鍖归厤鍏崇郴鍒楄〃 + */ + fun findMapBySVUserId(idList: List<String?>): List<DeviceMapVo> { + val res = dustSiteMapMapper.selectByExample(Example(DustSiteMap::class.java).apply { + createCriteria().andIn("svUserId", idList) + }) + return DeviceMapVo.fromJADustSiteMap(res) + } + + /** + * 鑾峰彇闈欏畨宸ュ湴鐐逛綅鍩烘湰淇℃伅 + * @return 鐩戞祴鐐逛俊鎭垪琛� + */ + fun findSiteInfo(): List<DeviceSiteVo> { + val res = dustSiteInfoMapper.selectAll() + return DeviceSiteVo.fromJADustSiteInfo(res) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt index f37bba9..0a030f9 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt @@ -1,10 +1,12 @@ package cn.flightfeather.supervision.domain.ds2.repository import cn.flightfeather.supervision.common.utils.Constant +import cn.flightfeather.supervision.common.utils.UUIDGenerator import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ import cn.flightfeather.supervision.domain.ds2.mapper.UserinfoTZMapper import org.springframework.stereotype.Repository import tk.mybatis.mapper.entity.Example +import java.util.* @Repository class UserInfoTZRep(private val userinfoTZMapper: UserinfoTZMapper) { @@ -33,4 +35,16 @@ and(createCriteria().orIsNull("workno").orNotEqualTo("workno", "test")) }) } + + fun findOne(userinfoTZ: UserinfoTZ): UserinfoTZ? { + return userinfoTZMapper.selectOne(userinfoTZ) + } + + fun insert(userinfoTZ: UserinfoTZ): Int { + if (userinfoTZ.guid == null) userinfoTZ.guid = UUIDGenerator.generate16ShortUUID() + if (userinfoTZ.headIconUrl == null) userinfoTZ.headIconUrl = "" + userinfoTZ.uiCreateTime = Date() + return userinfoTZMapper.insert(userinfoTZ) + } + } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt index 1ed3e11..c47165b 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt @@ -8,6 +8,7 @@ import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper import org.springframework.stereotype.Repository import tk.mybatis.mapper.entity.Example +import java.util.* @Repository class UserMapRep( @@ -22,15 +23,15 @@ * @return */ fun findFromSupervision(userinfoTZ: UserinfoTZ?): Scense? { + return findFromSupervision(userinfoTZ?.guid) + } + + fun findFromSupervision(guid: String?): Scense? { val userMap = UserMap().apply { - tzUserId = userinfoTZ?.guid + tzUserId = guid } // 鎵惧埌涓や釜绯荤粺鐢ㄦ埛鐨勫搴斿叧绯� - val uMap = userMapMapper.selectOne(userMap) - if (uMap == null) { - println("${userinfoTZ?.guid}, ${userinfoTZ?.realname}") - return null - } + val uMap = userMapMapper.selectOne(userMap) ?: return null // 鎵惧埌椋炵窘鐩戠涓殑鐢ㄦ埛淇℃伅 val userInfoSp = userinfoMapper.selectByPrimaryKey(uMap.svUserId) // 鎵惧埌椋炵窘鐩戠涓殑鍦烘櫙淇℃伅 @@ -45,4 +46,9 @@ createCriteria().andIn("svUserId", idList) }) } + + fun insert(userMap: UserMap): Int { + if (userMap.umCreateTime == null) userMap.umCreateTime = Date() + return userMapMapper.insert(userMap) + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteInfo.java b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteInfo.java new file mode 100644 index 0000000..3c5d26f --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteInfo.java @@ -0,0 +1,1102 @@ +package cn.flightfeather.supervision.domain.ds3.entity; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.Table; +import java.util.Date; + +@Table(name = "ja_t_dust_site_info") +public class JSDustSiteInfo { + @Id + private Integer id; + + /** + * 璁惧缂栫爜 + */ + @Column(name = "mn_code") + private String mnCode; + + /** + * 瀹夎鍦板潃 + */ + private String address; + + /** + * 绔欑偣鍚嶇О + */ + private String name; + + /** + * 绔欑偣缂栫爜 + */ + private String code; + + /** + * 寮�宸ユ椂闂� + */ + @Column(name = "begin_date") + private Date beginDate; + + /** + * 杩愮淮鍟� + */ + @Column(name = "duty_company") + private String dutyCompany; + + /** + * 杩愮淮鍟唅d + */ + @Column(name = "duty_company_id") + private String dutyCompanyId; + + /** + * 缁撴潫鏃堕棿 + */ + @Column(name = "end_date") + private Date endDate; + + /** + * 褰撳墠鏂藉伐闃舵 + */ + @Column(name = "engineering_stage") + private String engineeringStage; + + /** + * 鎵�灞炲尯鍘夸唬鐮� + */ + @Column(name = "group_id") + private String groupId; + + /** + * 鎵�灞炲尯鍘� + */ + @Column(name = "group_name") + private String groupName; + + /** + * 鏄惁鍦ㄧ嚎 + */ + @Column(name = "is_online") + private String isOnline; + + /** + * 璁惧鏄惁寮傚父 + */ + @Column(name = "is_trouble") + private String isTrouble; + + /** + * 鏇存柊鏃堕棿 + */ + @Column(name = "jhpt_update_time") + private String jhptUpdateTime; + + private String kindex; + + /** + * 绾害 + */ + private String latitude; + + /** + * 鑱旂郴浜� + */ + private String linkman; + + /** + * 缁忓害 + */ + private String longitude; + + /** + * 鑱旂郴浜虹數璇� + */ + private String phone; + + /** + * 鎵�灞炵渷浠� + */ + private String province; + + /** + * 鍐呬腑澶栫幆缂栫爜 + */ + @Column(name = "ring_id") + private String ringId; + + /** + * 鍐呬腑澶栫幆 + */ + @Column(name = "ring_name") + private String ringName; + + /** + * 绫诲瀷缂栫爜 + */ + @Column(name = "type_id") + private String typeId; + + /** + * 绫诲瀷鍚嶇О + */ + private String typename; + + /** + * 鍋滄鏃堕棿 + */ + @Column(name = "stop_time") + private Date stopTime; + + private String active; + + /** + * 鏁呴殰娆℃暟 + */ + @Column(name = "trouble_num") + private Integer troubleNum; + + /** + * 鏂板鏃堕棿 + */ + @Column(name = "insert_time") + private Date insertTime; + + /** + * 闃舵寮�濮嬫棩鏈� + */ + @Column(name = "stage_begin_date") + private Date stageBeginDate; + + /** + * tsp娴撳害 + */ + private Double tsp; + + /** + * 缁熻绫诲瀷缂栫爜 + */ + @Column(name = "union_type_id") + private String unionTypeId; + + /** + * 鍥村楂樺害 + */ + @Column(name = "wall_height") + private String wallHeight; + + /** + * 涓氬姟鏃堕棿 + */ + @Column(name = "ywsj_date") + private Date ywsjDate; + + /** + * 寤虹瓚闈㈢Н + */ + @Column(name = "build_area") + private String buildArea; + + /** + * 鏂藉伐鍗曚綅 + */ + @Column(name = "construction_unit") + private String constructionUnit; + + /** + * 鐐逛綅鎺у埗绾� + */ + @Column(name = "control_level") + private String controlLevel; + + /** + * 寮�鍙戝晢 + */ + private String developers; + + /** + * 鎵ц鏃堕棿 + */ + @Column(name = "do_time") + private Date doTime; + + /** + * 鏄惁鏈夌洃娴� + */ + @Column(name = "has_monitor") + private String hasMonitor; + + /** + * 閲囬泦鏃堕棿 + */ + @Column(name = "data_time") + private Date dataTime; + + /** + * 褰撳墠鏂藉伐闃舵缂栫爜 + */ + @Column(name = "engineering_stage_code") + private String engineeringStageCode; + + /** + * 璁惧缂栫爜 + */ + @Column(name = "equipment_code") + private String equipmentCode; + + /** + * 鍗犲湴闈㈢Н + */ + @Column(name = "floor_area") + private String floorArea; + + /** + * 鍒犻櫎鏍囧織浣� + */ + @Column(name = "jhpt_delete") + private String jhptDelete; + + /** + * 鍣0鍔熻兘鍖� + */ + @Column(name = "noise_region") + private String noiseRegion; + + /** + * 璐熻矗浜� + */ + private String responsible; + + /** + * @return id + */ + public Integer getId() { + return id; + } + + /** + * @param id + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * 鑾峰彇璁惧缂栫爜 + * + * @return mn_code - 璁惧缂栫爜 + */ + public String getMnCode() { + return mnCode; + } + + /** + * 璁剧疆璁惧缂栫爜 + * + * @param mnCode 璁惧缂栫爜 + */ + public void setMnCode(String mnCode) { + this.mnCode = mnCode == null ? null : mnCode.trim(); + } + + /** + * 鑾峰彇瀹夎鍦板潃 + * + * @return address - 瀹夎鍦板潃 + */ + public String getAddress() { + return address; + } + + /** + * 璁剧疆瀹夎鍦板潃 + * + * @param address 瀹夎鍦板潃 + */ + public void setAddress(String address) { + this.address = address == null ? null : address.trim(); + } + + /** + * 鑾峰彇绔欑偣鍚嶇О + * + * @return name - 绔欑偣鍚嶇О + */ + public String getName() { + return name; + } + + /** + * 璁剧疆绔欑偣鍚嶇О + * + * @param name 绔欑偣鍚嶇О + */ + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + /** + * 鑾峰彇绔欑偣缂栫爜 + * + * @return code - 绔欑偣缂栫爜 + */ + public String getCode() { + return code; + } + + /** + * 璁剧疆绔欑偣缂栫爜 + * + * @param code 绔欑偣缂栫爜 + */ + public void setCode(String code) { + this.code = code == null ? null : code.trim(); + } + + /** + * 鑾峰彇寮�宸ユ椂闂� + * + * @return begin_date - 寮�宸ユ椂闂� + */ + public Date getBeginDate() { + return beginDate; + } + + /** + * 璁剧疆寮�宸ユ椂闂� + * + * @param beginDate 寮�宸ユ椂闂� + */ + public void setBeginDate(Date beginDate) { + this.beginDate = beginDate; + } + + /** + * 鑾峰彇杩愮淮鍟� + * + * @return duty_company - 杩愮淮鍟� + */ + public String getDutyCompany() { + return dutyCompany; + } + + /** + * 璁剧疆杩愮淮鍟� + * + * @param dutyCompany 杩愮淮鍟� + */ + public void setDutyCompany(String dutyCompany) { + this.dutyCompany = dutyCompany == null ? null : dutyCompany.trim(); + } + + /** + * 鑾峰彇杩愮淮鍟唅d + * + * @return duty_company_id - 杩愮淮鍟唅d + */ + public String getDutyCompanyId() { + return dutyCompanyId; + } + + /** + * 璁剧疆杩愮淮鍟唅d + * + * @param dutyCompanyId 杩愮淮鍟唅d + */ + public void setDutyCompanyId(String dutyCompanyId) { + this.dutyCompanyId = dutyCompanyId == null ? null : dutyCompanyId.trim(); + } + + /** + * 鑾峰彇缁撴潫鏃堕棿 + * + * @return end_date - 缁撴潫鏃堕棿 + */ + public Date getEndDate() { + return endDate; + } + + /** + * 璁剧疆缁撴潫鏃堕棿 + * + * @param endDate 缁撴潫鏃堕棿 + */ + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + /** + * 鑾峰彇褰撳墠鏂藉伐闃舵 + * + * @return engineering_stage - 褰撳墠鏂藉伐闃舵 + */ + public String getEngineeringStage() { + return engineeringStage; + } + + /** + * 璁剧疆褰撳墠鏂藉伐闃舵 + * + * @param engineeringStage 褰撳墠鏂藉伐闃舵 + */ + public void setEngineeringStage(String engineeringStage) { + this.engineeringStage = engineeringStage == null ? null : engineeringStage.trim(); + } + + /** + * 鑾峰彇鎵�灞炲尯鍘夸唬鐮� + * + * @return group_id - 鎵�灞炲尯鍘夸唬鐮� + */ + public String getGroupId() { + return groupId; + } + + /** + * 璁剧疆鎵�灞炲尯鍘夸唬鐮� + * + * @param groupId 鎵�灞炲尯鍘夸唬鐮� + */ + public void setGroupId(String groupId) { + this.groupId = groupId == null ? null : groupId.trim(); + } + + /** + * 鑾峰彇鎵�灞炲尯鍘� + * + * @return group_name - 鎵�灞炲尯鍘� + */ + public String getGroupName() { + return groupName; + } + + /** + * 璁剧疆鎵�灞炲尯鍘� + * + * @param groupName 鎵�灞炲尯鍘� + */ + public void setGroupName(String groupName) { + this.groupName = groupName == null ? null : groupName.trim(); + } + + /** + * 鑾峰彇鏄惁鍦ㄧ嚎 + * + * @return is_online - 鏄惁鍦ㄧ嚎 + */ + public String getIsOnline() { + return isOnline; + } + + /** + * 璁剧疆鏄惁鍦ㄧ嚎 + * + * @param isOnline 鏄惁鍦ㄧ嚎 + */ + public void setIsOnline(String isOnline) { + this.isOnline = isOnline == null ? null : isOnline.trim(); + } + + /** + * 鑾峰彇璁惧鏄惁寮傚父 + * + * @return is_trouble - 璁惧鏄惁寮傚父 + */ + public String getIsTrouble() { + return isTrouble; + } + + /** + * 璁剧疆璁惧鏄惁寮傚父 + * + * @param isTrouble 璁惧鏄惁寮傚父 + */ + public void setIsTrouble(String isTrouble) { + this.isTrouble = isTrouble == null ? null : isTrouble.trim(); + } + + /** + * 鑾峰彇鏇存柊鏃堕棿 + * + * @return jhpt_update_time - 鏇存柊鏃堕棿 + */ + public String getJhptUpdateTime() { + return jhptUpdateTime; + } + + /** + * 璁剧疆鏇存柊鏃堕棿 + * + * @param jhptUpdateTime 鏇存柊鏃堕棿 + */ + public void setJhptUpdateTime(String jhptUpdateTime) { + this.jhptUpdateTime = jhptUpdateTime == null ? null : jhptUpdateTime.trim(); + } + + /** + * @return kindex + */ + public String getKindex() { + return kindex; + } + + /** + * @param kindex + */ + public void setKindex(String kindex) { + this.kindex = kindex == null ? null : kindex.trim(); + } + + /** + * 鑾峰彇绾害 + * + * @return latitude - 绾害 + */ + public String getLatitude() { + return latitude; + } + + /** + * 璁剧疆绾害 + * + * @param latitude 绾害 + */ + public void setLatitude(String latitude) { + this.latitude = latitude == null ? null : latitude.trim(); + } + + /** + * 鑾峰彇鑱旂郴浜� + * + * @return linkman - 鑱旂郴浜� + */ + public String getLinkman() { + return linkman; + } + + /** + * 璁剧疆鑱旂郴浜� + * + * @param linkman 鑱旂郴浜� + */ + public void setLinkman(String linkman) { + this.linkman = linkman == null ? null : linkman.trim(); + } + + /** + * 鑾峰彇缁忓害 + * + * @return longitude - 缁忓害 + */ + public String getLongitude() { + return longitude; + } + + /** + * 璁剧疆缁忓害 + * + * @param longitude 缁忓害 + */ + public void setLongitude(String longitude) { + this.longitude = longitude == null ? null : longitude.trim(); + } + + /** + * 鑾峰彇鑱旂郴浜虹數璇� + * + * @return phone - 鑱旂郴浜虹數璇� + */ + public String getPhone() { + return phone; + } + + /** + * 璁剧疆鑱旂郴浜虹數璇� + * + * @param phone 鑱旂郴浜虹數璇� + */ + public void setPhone(String phone) { + this.phone = phone == null ? null : phone.trim(); + } + + /** + * 鑾峰彇鎵�灞炵渷浠� + * + * @return province - 鎵�灞炵渷浠� + */ + public String getProvince() { + return province; + } + + /** + * 璁剧疆鎵�灞炵渷浠� + * + * @param province 鎵�灞炵渷浠� + */ + public void setProvince(String province) { + this.province = province == null ? null : province.trim(); + } + + /** + * 鑾峰彇鍐呬腑澶栫幆缂栫爜 + * + * @return ring_id - 鍐呬腑澶栫幆缂栫爜 + */ + public String getRingId() { + return ringId; + } + + /** + * 璁剧疆鍐呬腑澶栫幆缂栫爜 + * + * @param ringId 鍐呬腑澶栫幆缂栫爜 + */ + public void setRingId(String ringId) { + this.ringId = ringId == null ? null : ringId.trim(); + } + + /** + * 鑾峰彇鍐呬腑澶栫幆 + * + * @return ring_name - 鍐呬腑澶栫幆 + */ + public String getRingName() { + return ringName; + } + + /** + * 璁剧疆鍐呬腑澶栫幆 + * + * @param ringName 鍐呬腑澶栫幆 + */ + public void setRingName(String ringName) { + this.ringName = ringName == null ? null : ringName.trim(); + } + + /** + * 鑾峰彇绫诲瀷缂栫爜 + * + * @return type_id - 绫诲瀷缂栫爜 + */ + public String getTypeId() { + return typeId; + } + + /** + * 璁剧疆绫诲瀷缂栫爜 + * + * @param typeId 绫诲瀷缂栫爜 + */ + public void setTypeId(String typeId) { + this.typeId = typeId == null ? null : typeId.trim(); + } + + /** + * 鑾峰彇绫诲瀷鍚嶇О + * + * @return typename - 绫诲瀷鍚嶇О + */ + public String getTypename() { + return typename; + } + + /** + * 璁剧疆绫诲瀷鍚嶇О + * + * @param typename 绫诲瀷鍚嶇О + */ + public void setTypename(String typename) { + this.typename = typename == null ? null : typename.trim(); + } + + /** + * 鑾峰彇鍋滄鏃堕棿 + * + * @return stop_time - 鍋滄鏃堕棿 + */ + public Date getStopTime() { + return stopTime; + } + + /** + * 璁剧疆鍋滄鏃堕棿 + * + * @param stopTime 鍋滄鏃堕棿 + */ + public void setStopTime(Date stopTime) { + this.stopTime = stopTime; + } + + /** + * @return active + */ + public String getActive() { + return active; + } + + /** + * @param active + */ + public void setActive(String active) { + this.active = active == null ? null : active.trim(); + } + + /** + * 鑾峰彇鏁呴殰娆℃暟 + * + * @return trouble_num - 鏁呴殰娆℃暟 + */ + public Integer getTroubleNum() { + return troubleNum; + } + + /** + * 璁剧疆鏁呴殰娆℃暟 + * + * @param troubleNum 鏁呴殰娆℃暟 + */ + public void setTroubleNum(Integer troubleNum) { + this.troubleNum = troubleNum; + } + + /** + * 鑾峰彇鏂板鏃堕棿 + * + * @return insert_time - 鏂板鏃堕棿 + */ + public Date getInsertTime() { + return insertTime; + } + + /** + * 璁剧疆鏂板鏃堕棿 + * + * @param insertTime 鏂板鏃堕棿 + */ + public void setInsertTime(Date insertTime) { + this.insertTime = insertTime; + } + + /** + * 鑾峰彇闃舵寮�濮嬫棩鏈� + * + * @return stage_begin_date - 闃舵寮�濮嬫棩鏈� + */ + public Date getStageBeginDate() { + return stageBeginDate; + } + + /** + * 璁剧疆闃舵寮�濮嬫棩鏈� + * + * @param stageBeginDate 闃舵寮�濮嬫棩鏈� + */ + public void setStageBeginDate(Date stageBeginDate) { + this.stageBeginDate = stageBeginDate; + } + + /** + * 鑾峰彇tsp娴撳害 + * + * @return tsp - tsp娴撳害 + */ + public Double getTsp() { + return tsp; + } + + /** + * 璁剧疆tsp娴撳害 + * + * @param tsp tsp娴撳害 + */ + public void setTsp(Double tsp) { + this.tsp = tsp; + } + + /** + * 鑾峰彇缁熻绫诲瀷缂栫爜 + * + * @return union_type_id - 缁熻绫诲瀷缂栫爜 + */ + public String getUnionTypeId() { + return unionTypeId; + } + + /** + * 璁剧疆缁熻绫诲瀷缂栫爜 + * + * @param unionTypeId 缁熻绫诲瀷缂栫爜 + */ + public void setUnionTypeId(String unionTypeId) { + this.unionTypeId = unionTypeId == null ? null : unionTypeId.trim(); + } + + /** + * 鑾峰彇鍥村楂樺害 + * + * @return wall_height - 鍥村楂樺害 + */ + public String getWallHeight() { + return wallHeight; + } + + /** + * 璁剧疆鍥村楂樺害 + * + * @param wallHeight 鍥村楂樺害 + */ + public void setWallHeight(String wallHeight) { + this.wallHeight = wallHeight == null ? null : wallHeight.trim(); + } + + /** + * 鑾峰彇涓氬姟鏃堕棿 + * + * @return ywsj_date - 涓氬姟鏃堕棿 + */ + public Date getYwsjDate() { + return ywsjDate; + } + + /** + * 璁剧疆涓氬姟鏃堕棿 + * + * @param ywsjDate 涓氬姟鏃堕棿 + */ + public void setYwsjDate(Date ywsjDate) { + this.ywsjDate = ywsjDate; + } + + /** + * 鑾峰彇寤虹瓚闈㈢Н + * + * @return build_area - 寤虹瓚闈㈢Н + */ + public String getBuildArea() { + return buildArea; + } + + /** + * 璁剧疆寤虹瓚闈㈢Н + * + * @param buildArea 寤虹瓚闈㈢Н + */ + public void setBuildArea(String buildArea) { + this.buildArea = buildArea == null ? null : buildArea.trim(); + } + + /** + * 鑾峰彇鏂藉伐鍗曚綅 + * + * @return construction_unit - 鏂藉伐鍗曚綅 + */ + public String getConstructionUnit() { + return constructionUnit; + } + + /** + * 璁剧疆鏂藉伐鍗曚綅 + * + * @param constructionUnit 鏂藉伐鍗曚綅 + */ + public void setConstructionUnit(String constructionUnit) { + this.constructionUnit = constructionUnit == null ? null : constructionUnit.trim(); + } + + /** + * 鑾峰彇鐐逛綅鎺у埗绾� + * + * @return control_level - 鐐逛綅鎺у埗绾� + */ + public String getControlLevel() { + return controlLevel; + } + + /** + * 璁剧疆鐐逛綅鎺у埗绾� + * + * @param controlLevel 鐐逛綅鎺у埗绾� + */ + public void setControlLevel(String controlLevel) { + this.controlLevel = controlLevel == null ? null : controlLevel.trim(); + } + + /** + * 鑾峰彇寮�鍙戝晢 + * + * @return developers - 寮�鍙戝晢 + */ + public String getDevelopers() { + return developers; + } + + /** + * 璁剧疆寮�鍙戝晢 + * + * @param developers 寮�鍙戝晢 + */ + public void setDevelopers(String developers) { + this.developers = developers == null ? null : developers.trim(); + } + + /** + * 鑾峰彇鎵ц鏃堕棿 + * + * @return do_time - 鎵ц鏃堕棿 + */ + public Date getDoTime() { + return doTime; + } + + /** + * 璁剧疆鎵ц鏃堕棿 + * + * @param doTime 鎵ц鏃堕棿 + */ + public void setDoTime(Date doTime) { + this.doTime = doTime; + } + + /** + * 鑾峰彇鏄惁鏈夌洃娴� + * + * @return has_monitor - 鏄惁鏈夌洃娴� + */ + public String getHasMonitor() { + return hasMonitor; + } + + /** + * 璁剧疆鏄惁鏈夌洃娴� + * + * @param hasMonitor 鏄惁鏈夌洃娴� + */ + public void setHasMonitor(String hasMonitor) { + this.hasMonitor = hasMonitor == null ? null : hasMonitor.trim(); + } + + /** + * 鑾峰彇閲囬泦鏃堕棿 + * + * @return data_time - 閲囬泦鏃堕棿 + */ + public Date getDataTime() { + return dataTime; + } + + /** + * 璁剧疆閲囬泦鏃堕棿 + * + * @param dataTime 閲囬泦鏃堕棿 + */ + public void setDataTime(Date dataTime) { + this.dataTime = dataTime; + } + + /** + * 鑾峰彇褰撳墠鏂藉伐闃舵缂栫爜 + * + * @return engineering_stage_code - 褰撳墠鏂藉伐闃舵缂栫爜 + */ + public String getEngineeringStageCode() { + return engineeringStageCode; + } + + /** + * 璁剧疆褰撳墠鏂藉伐闃舵缂栫爜 + * + * @param engineeringStageCode 褰撳墠鏂藉伐闃舵缂栫爜 + */ + public void setEngineeringStageCode(String engineeringStageCode) { + this.engineeringStageCode = engineeringStageCode == null ? null : engineeringStageCode.trim(); + } + + /** + * 鑾峰彇璁惧缂栫爜 + * + * @return equipment_code - 璁惧缂栫爜 + */ + public String getEquipmentCode() { + return equipmentCode; + } + + /** + * 璁剧疆璁惧缂栫爜 + * + * @param equipmentCode 璁惧缂栫爜 + */ + public void setEquipmentCode(String equipmentCode) { + this.equipmentCode = equipmentCode == null ? null : equipmentCode.trim(); + } + + /** + * 鑾峰彇鍗犲湴闈㈢Н + * + * @return floor_area - 鍗犲湴闈㈢Н + */ + public String getFloorArea() { + return floorArea; + } + + /** + * 璁剧疆鍗犲湴闈㈢Н + * + * @param floorArea 鍗犲湴闈㈢Н + */ + public void setFloorArea(String floorArea) { + this.floorArea = floorArea == null ? null : floorArea.trim(); + } + + /** + * 鑾峰彇鍒犻櫎鏍囧織浣� + * + * @return jhpt_delete - 鍒犻櫎鏍囧織浣� + */ + public String getJhptDelete() { + return jhptDelete; + } + + /** + * 璁剧疆鍒犻櫎鏍囧織浣� + * + * @param jhptDelete 鍒犻櫎鏍囧織浣� + */ + public void setJhptDelete(String jhptDelete) { + this.jhptDelete = jhptDelete == null ? null : jhptDelete.trim(); + } + + /** + * 鑾峰彇鍣0鍔熻兘鍖� + * + * @return noise_region - 鍣0鍔熻兘鍖� + */ + public String getNoiseRegion() { + return noiseRegion; + } + + /** + * 璁剧疆鍣0鍔熻兘鍖� + * + * @param noiseRegion 鍣0鍔熻兘鍖� + */ + public void setNoiseRegion(String noiseRegion) { + this.noiseRegion = noiseRegion == null ? null : noiseRegion.trim(); + } + + /** + * 鑾峰彇璐熻矗浜� + * + * @return responsible - 璐熻矗浜� + */ + public String getResponsible() { + return responsible; + } + + /** + * 璁剧疆璐熻矗浜� + * + * @param responsible 璐熻矗浜� + */ + public void setResponsible(String responsible) { + this.responsible = responsible == null ? null : responsible.trim(); + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteInfoMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteInfoMapper.kt new file mode 100644 index 0000000..6316116 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteInfoMapper.kt @@ -0,0 +1,8 @@ +package cn.flightfeather.supervision.domain.ds3.mapper + +import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteInfo +import cn.flightfeather.supervision.domain.util.MyMapper +import org.apache.ibatis.annotations.Mapper + +@Mapper +interface JSDustSiteInfoMapper : MyMapper<JSDustSiteInfo?> \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteMapRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteMapRep.kt deleted file mode 100644 index 129364b..0000000 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteMapRep.kt +++ /dev/null @@ -1,26 +0,0 @@ -package cn.flightfeather.supervision.domain.ds3.repository - -import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap -import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper -import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo -import org.springframework.stereotype.Repository -import tk.mybatis.mapper.entity.Example - -/** - * 閲戝北鎵皹鐩戞祴鐐逛綅鍜岀郴缁熺敤鎴锋槧灏勫叧绯绘暟鎹簱鐩稿叧鎿嶄綔 - */ -@Repository -class JSDustSiteMapRep( - private val jsDustSiteMapMapper: JSDustSiteMapMapper, -) { - - /** - * 鏍规嵁椋炵窘鐩戠鐢ㄦ埛id鏌ヨ - */ - fun findBySVUserId(idList: List<String?>): List<DeviceMapVo> { - val res = jsDustSiteMapMapper.selectByExample(Example(JSDustSiteMap::class.java).apply { - createCriteria().andIn("svUserId", idList) - }) - return DeviceMapVo.fromJSDustSiteMap(res) - } -} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt new file mode 100644 index 0000000..13684fe --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt @@ -0,0 +1,40 @@ +package cn.flightfeather.supervision.domain.ds3.repository + +import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap +import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteInfoMapper +import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper +import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo +import cn.flightfeather.supervision.lightshare.vo.DeviceSiteVo +import org.springframework.stereotype.Repository +import tk.mybatis.mapper.entity.Example + +/** + * 閲戝北鎵皹鐩戞祴鐐逛綅鍜岀郴缁熺敤鎴锋槧灏勫叧绯绘暟鎹簱鐩稿叧鎿嶄綔 + */ +@Repository +class JSDustSiteRep( + private val jsDustSiteMapMapper: JSDustSiteMapMapper, + private val jsDustSiteInfoMapper: JSDustSiteInfoMapper, +) { + + /** + * 鏍规嵁椋炵窘鐩戠鐢ㄦ埛id鏌ヨ鍦烘櫙鍜岀洃娴嬭澶囩殑鍖归厤鍏崇郴 + * @param idList 鐩戠鍦烘櫙瀵瑰簲鐨勭敤鎴穒d鍒楄〃 + * @return 鍖归厤鍏崇郴鍒楄〃 + */ + fun findMapBySVUserId(idList: List<String?>): List<DeviceMapVo> { + val res = jsDustSiteMapMapper.selectByExample(Example(JSDustSiteMap::class.java).apply { + createCriteria().andIn("svUserId", idList) + }) + return DeviceMapVo.fromJSDustSiteMap(res) + } + + /** + * 鑾峰彇閲戝北鐩戞祴鐐逛綅鍩烘湰淇℃伅 + * @return 鐩戞祴鐐逛俊鎭垪琛� + */ + fun findSiteInfo(): List<DeviceSiteVo> { + val res = jsDustSiteInfoMapper.selectAll() + return DeviceSiteVo.fromJSDustSiteInfo(res) + } +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt index 4fc2723..90dca46 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt @@ -42,5 +42,5 @@ fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>? - fun downloadAutoEvaluation(areaVo: AreaVo, response: HttpServletResponse): Boolean + fun downloadAutoEvaluation(areaVo: AreaVo, forceUpdate: Boolean, response: HttpServletResponse): Boolean } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt index 9391780..a7cd514 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt @@ -1,6 +1,7 @@ package cn.flightfeather.supervision.lightshare.service import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule +import cn.flightfeather.supervision.lightshare.vo.EvaluationVo interface EvaluationsubruleService { @@ -18,4 +19,6 @@ fun search(districtCode: String, sceneTypeId: String, version: String? = null): List<Evaluationsubrule> + fun getAutoScore(subTaskId: String): List<EvaluationVo> + } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/InspectionService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/InspectionService.kt index 98d5744..ba3cb51 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/InspectionService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/InspectionService.kt @@ -24,8 +24,11 @@ fun findGitListById(id: String): List<GitlistVo> - fun getInspectionInfoByScene(sceneId: String, topTaskId: String): InspectionInfoVo + fun getInspectionInfoByScene(sceneId: String, topTaskId: String): InspectionInfoVo? //鑾峰彇鏈堜换鍔″贰鏌ョ粺璁′俊鎭� - fun getStatistic(topTaskId: String, sceneTypeId: String): BaseResponse<List<InspectionStatisticVo>> + fun getStatistic(topTaskId: String, sceneTypeId: String): List<InspectionStatisticVo> + + //鑾峰彇鏈堜换鍔″贰鏌ョ粺璁′俊鎭� + fun getStatistic(areaVo: AreaVo): List<InspectionStatisticVo> } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt index 9b989bd..5aff8f1 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt @@ -1,6 +1,7 @@ package cn.flightfeather.supervision.lightshare.service import cn.flightfeather.supervision.domain.ds1.entity.Problemlist +import cn.flightfeather.supervision.domain.ds1.entity.Subtask import cn.flightfeather.supervision.lightshare.vo.* import org.springframework.web.multipart.MultipartFile @@ -45,5 +46,10 @@ fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String> - fun getBySubTask(stGuid: String): List<ProblemlistVo> + fun getBySubTask(stGuid: String, all:Boolean?): List<ProblemlistVo> + + fun getSceneByProType(areaVo: AreaVo, pType:String):List<Subtask?> + + fun getSceneProSummary(areaVo: AreaVo, sortBy: String, page: Int, per_page: Int): Pair<DataHead?, + List<SceneProblemSummary>?> } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ScenseService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ScenseService.kt index 4a3e1e0..d1cbf61 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ScenseService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ScenseService.kt @@ -2,7 +2,9 @@ import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.ds1.entity.Task +import cn.flightfeather.supervision.domain.ds1.entity.Userinfo import cn.flightfeather.supervision.lightshare.vo.* +import org.springframework.web.multipart.MultipartFile interface ScenseService { @@ -43,4 +45,18 @@ fun searchScene(areaVo: AreaVo, page: Int?, perPage: Int?): BaseResponse<List<Scense>> fun searchByCoordinate(lng: Double, lat: Double, radius: Double): List<Scense> + + /** + * 閫氳繃鏂囦欢鎵归噺瀵煎叆鍦烘櫙淇℃伅 + */ + fun importSceneInfo(file: MultipartFile): Boolean + + /** + * 鍒涘缓鍦烘櫙淇℃伅 + */ + fun createScene(scense: Scense): Scense + + fun createOneScene(scense: Scense) + + fun createTZUserInfo(userInfo: Userinfo, scense: Scense) } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SubtaskService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SubtaskService.kt index 91d5446..b8da107 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SubtaskService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SubtaskService.kt @@ -2,6 +2,7 @@ import cn.flightfeather.supervision.domain.ds1.entity.Subtask import cn.flightfeather.supervision.lightshare.vo.* +import java.time.LocalDateTime interface SubtaskService { @@ -45,4 +46,8 @@ fun getByTopTaskAndDate(topTaskId: String, startTime: String?, endTime: String?, sceneTypeId: Int? = null): List<Subtask> fun getSummary(topTaskId: String, sceneTypeId: Int? = null): List<SubTaskSummary> + + fun getSummaryByArea(areaVo: AreaVo): List<TaskProgressVo> + + fun getByScene(sceneId: String, startTime: LocalDateTime?, endTime: LocalDateTime?): List<SubTaskSummary> } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt index 7228a57..1bcb613 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt @@ -52,4 +52,10 @@ fun findTask(areaVo: AreaVo):List<Task?> + /** + * 鏌ユ壘鎬讳换鍔″畬鎴愭儏鍐� + * @param areaVo 绛涢�夋潯浠� + */ + fun findTaskProgress(areaVo: AreaVo): List<TaskProgressVo?> + } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt index a1c810c..57b4cfd 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt @@ -1,5 +1,6 @@ package cn.flightfeather.supervision.lightshare.service +import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.ds2.entity.UserMap import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo @@ -11,6 +12,11 @@ */ fun getTZIdBySceneId(sceneId: String): UserMap + /** + * 鏍规嵁椋炵窘鐜绯荤粺涓殑鍦烘櫙id锛岃幏鍙栦笌椋炵窘鐩戠绯荤粺涓殑鍏宠仈鐢ㄦ埛 + */ + fun getSceneByTZId(tzUserId: String): Scense? + fun autoCreateMap() fun fetchDeviceMap(areaVo: AreaVo): List<DeviceMapVo?> diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt index 4ff4b70..df41591 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt @@ -1,6 +1,8 @@ package cn.flightfeather.supervision.lightshare.service +import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.ds1.entity.Userinfo +import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ interface UserinfoService { fun findOne(id: String): Userinfo? @@ -21,5 +23,11 @@ fun findByScene(sceneId: String): Userinfo? + fun getUName(sceneName: String): String + fun autoCreateAccount() + + fun createAccount(scence: Scense):Userinfo + + fun createAccountTZ(userinfo: Userinfo, scence: Scense): UserinfoTZ } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt index fedcdf2..99db03a 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt @@ -1,6 +1,6 @@ package cn.flightfeather.supervision.lightshare.service.impl -import cn.flightfeather.supervision.common.exception.ResponseErrorException +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl import cn.flightfeather.supervision.common.executor.BgTaskConditionVo import cn.flightfeather.supervision.common.executor.BgTaskStatus @@ -16,21 +16,21 @@ } override fun startTask(condition: BgTaskConditionVo): BgTaskStatus? { - condition.type ?: throw ResponseErrorException("浠诲姟绫诲瀷涓嶈兘涓虹┖") - condition.id ?: throw ResponseErrorException("浠诲姟id涓嶈兘涓虹┖") + condition.type ?: throw BizException("浠诲姟绫诲瀷涓嶈兘涓虹┖") + condition.id ?: throw BizException("浠诲姟id涓嶈兘涓虹┖") val task = backgroundTaskCtrl.startTask(condition.type!!, condition.id!!) return task.taskStatus } override fun shutDownTask(condition: BgTaskConditionVo): List<BgTaskStatus?> { - condition.type ?: throw ResponseErrorException("浠诲姟绫诲瀷涓嶈兘涓虹┖") + condition.type ?: throw BizException("浠诲姟绫诲瀷涓嶈兘涓虹┖") return backgroundTaskCtrl.shutDownTask(condition.type!!, condition.id) } override fun removeTask(condition: BgTaskConditionVo): Boolean { - condition.type ?: throw ResponseErrorException("浠诲姟绫诲瀷涓嶈兘涓虹┖") - condition.id ?: throw ResponseErrorException("浠诲姟id涓嶈兘涓虹┖") + condition.type ?: throw BizException("浠诲姟绫诲瀷涓嶈兘涓虹┖") + condition.id ?: throw BizException("浠诲姟id涓嶈兘涓虹┖") return backgroundTaskCtrl.removeTask(condition.type!!, condition.id!!) } diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt index 3c7a1bd..30e48da 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt @@ -1,18 +1,13 @@ package cn.flightfeather.supervision.lightshare.service.impl -import cn.flightfeather.supervision.common.exception.ResponseErrorException +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.domain.ds1.repository.SceneRep import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep -import cn.flightfeather.supervision.domain.ds2.entity.Complaint -import cn.flightfeather.supervision.domain.ds2.entity.Punishment -import cn.flightfeather.supervision.domain.ds2.mapper.ComplaintMapper -import cn.flightfeather.supervision.domain.ds2.mapper.PunishmentMapper import cn.flightfeather.supervision.domain.ds2.repository.ComplaintAndPunishmentRep import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep import cn.flightfeather.supervision.lightshare.service.ComplaintService -import cn.flightfeather.supervision.lightshare.service.UserinfoService import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.ComplaintVo import cn.flightfeather.supervision.lightshare.vo.PunishmentVo @@ -37,7 +32,7 @@ } //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋 2 -> { - val task = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟") + val task = taskRep.findOneTask(areaVo) ?: throw BizException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟") val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) .map { it?.guid } val idList = userInfoSVRep.findUser(scenes).map { it?.guid } diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt index 7549c48..e0a0cf8 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt @@ -6,10 +6,8 @@ import cn.flightfeather.supervision.business.bgtask.ReportTaskCtrl import cn.flightfeather.supervision.business.report.DataSource import cn.flightfeather.supervision.business.report.DbMapper -import cn.flightfeather.supervision.business.report.file.ReportOne -import cn.flightfeather.supervision.business.report.file.ReportThree import cn.flightfeather.supervision.business.report.file.ReportTwo -import cn.flightfeather.supervision.common.exception.ResponseErrorException +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.executor.BgTaskStatus import cn.flightfeather.supervision.domain.ds1.entity.Domainitem import cn.flightfeather.supervision.domain.ds1.entity.Evaluation @@ -31,7 +29,6 @@ import org.springframework.stereotype.Service import tk.mybatis.mapper.entity.Example import java.io.File -import java.net.URLEncoder import java.util.* import javax.servlet.http.HttpServletResponse import kotlin.Comparator @@ -290,9 +287,9 @@ return evaluationRep.findAutoScore(areaVo) } - override fun downloadAutoEvaluation(areaVo: AreaVo, response: HttpServletResponse): Boolean { - areaVo.scensetypeid ?: throw ResponseErrorException("蹇呴』閫夋嫨涓�涓満鏅被鍨�") - val topTask = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("鏈壘鍒扮鍚堟潯浠剁殑椤跺眰浠诲姟") + override fun downloadAutoEvaluation(areaVo: AreaVo, forceUpdate: Boolean, response: HttpServletResponse): Boolean { + areaVo.scensetypeid ?: throw BizException("蹇呴』閫夋嫨涓�涓満鏅被鍨�") + val topTask = taskRep.findOneTask(areaVo) ?: throw BizException("鏈壘鍒扮鍚堟潯浠剁殑椤跺眰浠诲姟") val config = ExcelConfigVo( topTask.tguid ?: "", topTask.starttime, @@ -301,7 +298,8 @@ topTask.citycode, topTask.districtcode, topTask.towncode, - areaVo.scensetypeid?.toInt() + areaVo.scensetypeid?.toInt(), + forceUpdate = forceUpdate ) val dataSource = DataSource(config, dbMapper) @@ -310,8 +308,8 @@ val p = "$filePath/autoscore/" val file = File(p + fileName) if (config.forceUpdate || !file.exists()) { -// val downloadUrl = "/autoscore/${fileName}" -// reportTaskCtrl.startTask(t, downloadUrl) + val downloadUrl = "/autoscore/${fileName}" + reportTaskCtrl.startTask(t, downloadUrl) return false } else { val fName = Base64.getEncoder().encodeToString(fileName.toByteArray()) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt index d104301..2326646 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt @@ -1,18 +1,24 @@ package cn.flightfeather.supervision.lightshare.service.impl -import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule -import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule +import cn.flightfeather.supervision.domain.ds1.entity.* import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper +import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep +import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRuleRep import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService +import cn.flightfeather.supervision.lightshare.vo.EvaluationVo +import cn.flightfeather.supervision.lightshare.vo.SubEvaluationVo +import cn.flightfeather.supervision.lightshare.vo.ThirdEvaluationVo import org.springframework.stereotype.Service import tk.mybatis.mapper.entity.Example @Service -class EvaluationsubruleServiceImpl ( - val evaluationsubruleMapper: EvaluationsubruleMapper, - val evaluationruleMapper: EvaluationruleMapper -):EvaluationsubruleService { +class EvaluationsubruleServiceImpl( + val evaluationsubruleMapper: EvaluationsubruleMapper, + val evaluationruleMapper: EvaluationruleMapper, + private val evaluationRep: EvaluationRep, + private val evaluationRuleRep: EvaluationRuleRep, +) : EvaluationsubruleService { override fun findOne(id: String): Evaluationsubrule = evaluationsubruleMapper.selectByPrimaryKey(id) @@ -20,7 +26,8 @@ override fun save(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.insert(evaluationsubrule) - override fun update(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule) + override fun update(evaluationsubrule: Evaluationsubrule): Int = + evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule) override fun delete(id: String): Int = evaluationsubruleMapper.deleteByPrimaryKey(id) @@ -36,8 +43,8 @@ val result = mutableListOf<Evaluationsubrule>() evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { createCriteria().andEqualTo("districtcode", districtCode) - .andEqualTo("scensetypeid", sceneTypeId) - }).takeIf { it.isNotEmpty() }?.get(0)?.let {rule -> + .andEqualTo("scensetypeid", sceneTypeId) + }).takeIf { it.isNotEmpty() }?.get(0)?.let { rule -> evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule::class.java).apply { createCriteria().andEqualTo("erguid", rule.guid) }) @@ -47,4 +54,128 @@ return result } + + override fun getAutoScore(subTaskId: String): List<EvaluationVo> { + //瀛愯鍒欓�愭潯寰楀垎 + val subRuleScores = evaluationRep.findItemEvaluation(subTaskId) + //鎬昏鍒檌d + val ruleId = mutableListOf<Evaluation>() + //璇勫垎鎬昏鍒� + val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId) + //鎬昏鍒欏搴旂殑璇勫垎瀛愯鍒� + val subRules = mutableListOf<Evaluationsubrule2>() + //鏌ヨ缁撴灉 + val resultList = mutableListOf<EvaluationVo>() + + var _group = 0 + subRules.forEach { + when (it.ertype) { + 2 -> resultList.add(EvaluationVo().apply { + id = it.guid + title1 = it.itemname + scoreMode = it.extension1 + gradeMode = it.extension2 + score = when (gradeMode) { + "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 + "add_mode" -> it.maxscore ?: 0 + else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 + } + selectMode = it.extension3 + + //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑 + for (s in subRuleScores) { + if (it.guid == s.esrguid) { + select = s.extension1 == "true" + break + } + } + }) + 3 -> { + for (r in resultList) { + if (it.fatherid == r.id) { + r.sub1.add(SubEvaluationVo().apply { + id = it.guid + title2 = it.itemname + gradeMode = it.extension2 + selectMode = it.extension3 + score = when (gradeMode) { + "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 + "add_mode" -> it.maxscore ?: 0 + else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 + } + group = _group++ + + //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑 + for (s in subRuleScores) { + if (it.guid == s.esrguid) { + select = s.extension1 == "true" + break + } + } + }) + break + } + } + } + 4 -> { + resultList.forEach{ r -> + //4绾х殑璇勪及椤圭洿鎺ラ檮灞炰簬2绾ц瘎浼伴」 + if (r.id == it.fatherid) { + if (r.sub1.isEmpty()) { + r.sub1.add(SubEvaluationVo().apply { + placeholder = true + id = it.guid + title2 = r.title1 + score = r.score + gradeMode = r.gradeMode + selectMode = r.selectMode + group = _group++ + }) + } + r.sub1[0].sub2.add(ThirdEvaluationVo().apply { + id = it.guid + content = it.itemname + score = when (r.sub1[0].gradeMode) { + "minus_mode" -> r.score.plus(it.maxscore ?: 0) + "add_mode" -> it.maxscore ?: 0 + else -> r.score.plus(it.maxscore ?: 0) + } + //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑 + for (s in subRuleScores) { + if (it.guid == s.esrguid) { + select = s.extension1 == "true" + break + } + } + }) + } else { + r.sub1.forEach { sr -> + if (sr.id == it.fatherid){ + sr.sub2.add(ThirdEvaluationVo().apply { + id = it.guid + content = it.itemname + score = when (sr.gradeMode) { + "minus_mode" -> sr.score.plus(it.maxscore ?: 0) + "add_mode" -> it.maxscore ?: 0 + else -> sr.score.plus(it.maxscore ?: 0) + } + //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑 + for (s in subRuleScores) { + if (it.guid == s.esrguid) { + select = s.extension1 == "true" + break + } + } + }) + } + } + } + } + } + } + } + + return resultList + + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt index 37be34c..2240ac3 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt @@ -1,9 +1,11 @@ package cn.flightfeather.supervision.lightshare.service.impl +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.domain.ds1.entity.Inspection import cn.flightfeather.supervision.domain.ds1.mapper.InspectionMapper import cn.flightfeather.supervision.common.utils.DateUtil import cn.flightfeather.supervision.common.utils.UUIDGenerator +import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.lightshare.service.* import cn.flightfeather.supervision.lightshare.vo.* import org.springframework.beans.BeanUtils @@ -12,7 +14,10 @@ import tk.mybatis.mapper.entity.Example @Service -class InspectionServiceImpl(val inspectionMapper: InspectionMapper) : InspectionService { +class InspectionServiceImpl( + val inspectionMapper: InspectionMapper, + private val taskRep: TaskRep, +) : InspectionService { @Autowired lateinit var problemlistService: ProblemlistService @@ -32,32 +37,9 @@ private val dateUtil = DateUtil() //鑾峰彇姹℃煋鍦烘櫙鐗堟湰涓婚〉鐨勭洃绠℃儏鍐靛睍绀哄唴瀹� - override fun getInspectionInfoByScene(sceneId: String, topTaskId: String): InspectionInfoVo { - val maps = inspectionMapper.getInspectionInfoByScene(sceneId, topTaskId) - val inspectionInfoVo = InspectionInfoVo() - if (maps.isNotEmpty()) { - val map = maps[0] - if (map.isNotEmpty()) { - inspectionInfoVo.topTaskid = map["topTaskId"].toString() - inspectionInfoVo.topTaskName = map["topTaskName"].toString() - inspectionInfoVo.sceneId = map["sceneId"].toString() - inspectionInfoVo.sceneName = map["sceneName"].toString() - inspectionInfoVo.inspectionId = map["inspectionId"].toString() - inspectionInfoVo.subtaskId = map["subtaskId"].toString() - inspectionInfoVo.inspected = map["isInspected"].toString().equals("1") - map["inspectionTime"]?.let { - val time = it.toString() - inspectionInfoVo.inspectionTime = dateUtil.StringToString(time, DateUtil.DateStyle.YYYY_MM_DD) - } - inspectionInfoVo.inspectionTimes = map["inspectionTimes"].toString().toInt() - inspectionInfoVo.promised = map["isPromised"].toString().equals("1") - inspectionInfoVo.changed = map["isChanged"].toString().equals("1") - inspectionInfoVo.unChangedCount = map["unChangedCount"].toString().toInt() - inspectionInfoVo.changedCount = map["changedCount"].toString().toInt() - inspectionInfoVo.promisedTime = map["promisedTime"].toString() - } - } - return inspectionInfoVo + override fun getInspectionInfoByScene(sceneId: String, topTaskId: String): InspectionInfoVo? { + val resList = inspectionMapper.getInspectionInfoByScene(sceneId, topTaskId) + return if (resList.isNotEmpty()) resList[0] else InspectionInfoVo() } //鏍规嵁宸℃煡ID鑾峰彇闂鍒楄〃 @@ -241,12 +223,14 @@ override fun delete(id: String): Int = inspectionMapper.deleteByPrimaryKey(id) - override fun getStatistic(topTaskId: String, sceneTypeId: String): BaseResponse<List<InspectionStatisticVo>> { + override fun getStatistic(topTaskId: String, sceneTypeId: String): List<InspectionStatisticVo> { val result = inspectionMapper.getStatistic(topTaskId, sceneTypeId) - return if (result.isNotEmpty()) { - BaseResponse(true, data = result) - } else { - BaseResponse(false) - } + return result.ifEmpty { throw BizException("鏃犲贰鏌ヨ褰�") } + } + + override fun getStatistic(areaVo: AreaVo): List<InspectionStatisticVo> { + areaVo.scensetypeid ?: throw BizException("璇锋眰鍙傛暟requestBody涓満鏅被鍨媠censetypeid涓嶈兘涓虹┖") + val topTask = taskRep.findOneTask(areaVo) ?: throw BizException("鏈壘鍒扮浉鍏冲贰鏌ユ�讳换鍔�") + return getStatistic(topTask.tguid!!, areaVo.scensetypeid!!) } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt index ce0ce30..4c1645c 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt @@ -16,7 +16,7 @@ override fun updatelist(itemevaluationlist: List<Itemevaluation>): Int { //寰幆淇敼 itemevaluationlist.forEach { - itemevaluationMapper.updateByPrimaryKey(it) + itemevaluationMapper.updateByPrimaryKeySelective(it) } return itemevaluationlist.size } @@ -51,7 +51,7 @@ override fun save(itemevaluation: Itemevaluation): Int = itemevaluationMapper.insert(itemevaluation) - override fun update(itemevaluation: Itemevaluation): Int = itemevaluationMapper.updateByPrimaryKey(itemevaluation) + override fun update(itemevaluation: Itemevaluation): Int = itemevaluationMapper.updateByPrimaryKeySelective(itemevaluation) override fun delete(id: String): Int = itemevaluationMapper.deleteByPrimaryKey(id) } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MonitorobjectversionServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MonitorobjectversionServiceImpl.kt index 48c72fe..b0fe633 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MonitorobjectversionServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MonitorobjectversionServiceImpl.kt @@ -1,5 +1,6 @@ package cn.flightfeather.supervision.lightshare.service.impl +import cn.flightfeather.supervision.common.utils.UUIDGenerator import cn.flightfeather.supervision.domain.ds1.entity.Monitorobjectversion import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.ds1.mapper.MonitorobjectversionMapper @@ -46,6 +47,7 @@ @Transactional override fun saveList(monitorobjectversionlist: List<Monitorobjectversion>): Int { monitorobjectversionlist.forEach { + if (it.movid == null) it.movid = UUIDGenerator.generate16ShortUUID() monitorobjectversionMapper.insert(it) } return monitorobjectversionlist.size diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt index eb2d02b..c2b9ac6 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt @@ -1,18 +1,24 @@ package cn.flightfeather.supervision.lightshare.service.impl +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.FileUtil import cn.flightfeather.supervision.common.utils.UUIDGenerator import cn.flightfeather.supervision.domain.ds1.entity.Mediafile +import cn.flightfeather.supervision.domain.ds1.entity.Subtask import cn.flightfeather.supervision.domain.ds1.mapper.* +import cn.flightfeather.supervision.domain.ds1.repository.ProblemRep +import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep +import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.lightshare.service.MediafileService import cn.flightfeather.supervision.lightshare.service.ProblemlistService import cn.flightfeather.supervision.lightshare.service.TaskService import cn.flightfeather.supervision.lightshare.vo.* import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.ObjectMapper +import com.github.pagehelper.PageHelper import org.springframework.beans.BeanUtils import org.springframework.stereotype.Service import org.springframework.web.multipart.MultipartFile @@ -32,17 +38,24 @@ class ProblemlistServiceImpl( val problemlistMapper: ProblemlistMapper, val inspectionMapper: InspectionMapper, - val mediafileMapper: MediafileMapper + val mediafileMapper: MediafileMapper, + private val taskRep: TaskRep, + private val subTaskRep: SubTaskRep, + private val problemRep: ProblemRep, ) : ProblemlistService { @Resource lateinit var scenseMapper: ScenseMapper + @Resource lateinit var problemtypeMapper: ProblemtypeMapper + @Resource lateinit var taskMapper: TaskMapper + @Resource lateinit var taskService: TaskService + @Resource lateinit var mediafileService: MediafileService @@ -118,24 +131,7 @@ val sceneType = areaVo.scensetypeid val startTime = areaVo.starttime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) val endTime = areaVo.endtime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) - val maps = problemlistMapper.getStatisticalResult(districtcode,startTime, endTime, sceneType) - val statisticsVos = mutableListOf<StatisticsVo>() - maps.forEach { - if (!it.isEmpty() && it.get("name") != null) { - val statisticsVo = StatisticsVo() - statisticsVo.name = it.get("name").toString() - try { - statisticsVo.count = it.get("count").toString().toInt() - } catch (e: Exception) { - } - try { - statisticsVo.changeCount = it.get("changeCount").toString().toInt() - } catch (e: Exception) { - } - statisticsVos.add(statisticsVo) - } - } - return statisticsVos + return problemlistMapper.getStatisticalResult(districtcode, startTime, endTime, sceneType, areaVo.sceneId) } override fun getChargeResult(areaVo: AreaVo): ChargeInfoVo { @@ -172,7 +168,7 @@ } catch (e: Exception) { } try { - sceneInfo.changeCount =it.get("changeCount").toString().toInt() + sceneInfo.changeCount = it.get("changeCount").toString().toInt() } catch (e: Exception) { } chargeInfoVo.sceneInfos.add(sceneInfo) @@ -191,16 +187,16 @@ var curScore = -1 if (it.get("scoreAft") != null) { curScore = it.get("scoreAft").toString().toInt() - }else if (it.get("scoreBef") != null) { + } else if (it.get("scoreBef") != null) { curScore = it.get("scoreBef").toString().toInt() } if (curScore >= 100) { scoreInfo1.count++ - }else if (curScore >= 78 && curScore < 100) { + } else if (curScore >= 78 && curScore < 100) { scoreInfo2.count++ - }else if (curScore >= 54 && curScore < 78) { + } else if (curScore >= 54 && curScore < 78) { scoreInfo3.count++ - }else if (curScore < 54 && curScore >= 0) { + } else if (curScore < 54 && curScore >= 0) { scoreInfo4.count++ } } @@ -214,7 +210,7 @@ } //鏍规嵁鍦板煙鑾峰彇闂 - override fun getByArea(areaVo: AreaVo):List<ProblemlistVo> { + override fun getByArea(areaVo: AreaVo): List<ProblemlistVo> { val problemlist = mutableListOf<ProblemlistVo>() // val tmpproblemlsit = mutableListOf<Problemlist>() val example = Example(Scense::class.java) @@ -230,8 +226,8 @@ criteria.andEqualTo("towncode", areaVo.towncode) criteria.andEqualTo("typeid", areaVo.scensetypeid) val result1 = scenseMapper.selectByExample(example) - if (result1.isNotEmpty()){ - result1.forEach{ + if (result1.isNotEmpty()) { + result1.forEach { val tmpexample = Example(Problemlist::class.java) val tmpcriteria = tmpexample.createCriteria() //瀵逛簬纭畾鐨勬瘡涓満鏅紝鏍规嵁鏃堕棿鏌ヨ闂 @@ -345,23 +341,35 @@ override fun findMonthProblemById(taskId: String, sceneId: Int?): List<MonthProblemVo> { val monthProblemlistVoList = mutableListOf<MonthProblemVo>() - var map = problemlistMapper.findMonthProblemById(taskId,sceneId) + var map = problemlistMapper.findMonthProblemById(taskId, sceneId) map.forEach { m -> val monthProblemVo = MonthProblemVo() - monthProblemVo.townCode =if(m.get("towncode")!= null) BigDecimal(m.get("towncode").toString()).toString() else null + monthProblemVo.townCode = + if (m.get("towncode") != null) BigDecimal(m.get("towncode").toString()).toString() else null monthProblemVo.townName = if (m.get("townname") != null) m.get("townname").toString() else null - monthProblemVo.scenetype =if (m.get("scenetype") != null) m.get("scenetype").toString().toInt()else null - monthProblemVo.scenetypename =if(m.get("scenetypename") != null)m.get("scenetypename").toString()else null - monthProblemVo.totalscenecount =if(m.get("totalscenecount") != null)m.get("totalscenecount").toString().toInt()else null - monthProblemVo.problemscenes =if(m.get("problemscenes") != null)m.get("problemscenes").toString().toInt()else null - monthProblemVo.totalproblems =if(m.get("totalproblems") != null)m.get("totalproblems").toString().toInt()else null - monthProblemVo.changedproblems =if(m.get("changedproblems") != null)m.get("changedproblems").toString().toInt()else null + monthProblemVo.scenetype = if (m.get("scenetype") != null) m.get("scenetype").toString().toInt() else null + monthProblemVo.scenetypename = + if (m.get("scenetypename") != null) m.get("scenetypename").toString() else null + monthProblemVo.totalscenecount = + if (m.get("totalscenecount") != null) m.get("totalscenecount").toString().toInt() else null + monthProblemVo.problemscenes = + if (m.get("problemscenes") != null) m.get("problemscenes").toString().toInt() else null + monthProblemVo.totalproblems = + if (m.get("totalproblems") != null) m.get("totalproblems").toString().toInt() else null + monthProblemVo.changedproblems = + if (m.get("changedproblems") != null) m.get("changedproblems").toString().toInt() else null monthProblemlistVoList.add(monthProblemVo) } return monthProblemlistVoList; } - override fun check(pId: String, action: Byte, remark: String, userId: String, userName: String): BaseResponse<String> { + override fun check( + pId: String, + action: Byte, + remark: String, + userId: String, + userName: String, + ): BaseResponse<String> { if (action !in 0..3) { return BaseResponse(false, "闈炴硶鐨勬搷浣滄寚浠�") } @@ -375,22 +383,24 @@ 0.toByte() -> extension3 = Constant.PROBLEM_CHECK_PASS 1.toByte() -> extension3 = Constant.PROBLEM_CHECK_FAIL 2.toByte(), - 3.toByte() -> { + 3.toByte(), + -> { response.success = false response.message = "闂鎻愪氦杩樻湭瀹℃牳锛屾棤娉曡繘琛屾暣鏀瑰鏍革紒" } } - }else if (extension3 == Constant.PROBLEM_CHECK_PASS || extension3 == Constant.PROBLEM_CHECK_FAIL) { + } else if (extension3 == Constant.PROBLEM_CHECK_PASS || extension3 == Constant.PROBLEM_CHECK_FAIL) { when (action) { 0.toByte() -> extension3 = Constant.PROBLEM_CHECK_PASS 1.toByte() -> extension3 = Constant.PROBLEM_CHECK_FAIL 2.toByte(), - 3.toByte() -> { + 3.toByte(), + -> { if (ischanged == true && extension3 == Constant.PROBLEM_CHECK_PASS) { response.success = true extension3 = if (action == 2.toByte()) { Constant.CHANGE_CHECK_PASS - }else{ + } else { Constant.CHANGE_CHECK_FAIL } } else { @@ -399,20 +409,22 @@ } } } - }else if (extension3 == Constant.CHANGE_UNCHECKED) { + } else if (extension3 == Constant.CHANGE_UNCHECKED) { when (action) { 0.toByte(), - 1.toByte() -> { + 1.toByte(), + -> { response.success = false response.message = "闂鎻愪氦宸插鏍革紝骞朵笖宸茶鏁存敼銆傛搷浣滄棤鏁�" } 2.toByte() -> extension3 = Constant.CHANGE_CHECK_PASS 3.toByte() -> extension3 = Constant.CHANGE_CHECK_FAIL } - }else if (extension3 == Constant.CHANGE_CHECK_PASS || extension3 == Constant.CHANGE_CHECK_FAIL) { + } else if (extension3 == Constant.CHANGE_CHECK_PASS || extension3 == Constant.CHANGE_CHECK_FAIL) { when (action) { 0.toByte(), - 1.toByte() -> { + 1.toByte(), + -> { response.success = false response.message = "闂鎻愪氦宸插鏍革紝骞朵笖宸茶鏁存敼銆傛搷浣滄棤鏁�" } @@ -476,11 +488,14 @@ filetype = 1 businesstype = "闂" businesstypeid = 1 - path = "FlightFeather/Photo/" + scene.districtname + "/" + now.year + "骞�" + now.monthValue + "鏈�/" + now.monthValue + "鏈�" + now.dayOfMonth + "鏃�/" + scene.name + "/" - description = problemlist.problemname + " " + problemlist.location + " " + UUIDGenerator.generateUUID(4) + ".jpg" + path = + "FlightFeather/Photo/" + scene.districtname + "/" + now.year + "骞�" + now.monthValue + "鏈�/" + now.monthValue + "鏈�" + now.dayOfMonth + "鏃�/" + scene.name + "/" + description = + problemlist.problemname + " " + problemlist.location + " " + UUIDGenerator.generateUUID(4) + ".jpg" savetime = Date() ischanged = false - extension1 = scene.citycode + "/" + scene.districtcode + "/" + now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "/" + scene.guid + "/" + extension1 = + scene.citycode + "/" + scene.districtcode + "/" + now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "/" + scene.guid + "/" remark = "宸蹭笂浼�" } mediafileMapper.insert(mediaFile) @@ -562,21 +577,47 @@ return BaseResponse(true) } - override fun getBySubTask(stGuid: String): List<ProblemlistVo> { + override fun getBySubTask(stGuid: String, all: Boolean?): List<ProblemlistVo> { //鏍规嵁瀛愪换鍔D鑾峰彇闂鍒楄〃 - val problemListVo = findBySubtaskId(stGuid) - //鍒ゆ柇鏄惁鏈夐棶棰樺垪琛� - if (!problemListVo.isEmpty()) { - //鏍规嵁姣忎釜闂,鑾峰彇濯掍綋鏂囦欢 - problemListVo.forEach { - val mediafileVo = mediafileService.findByBusinessGUID(it.guid!!) - //鍒ゆ柇鏄惁鏈夊獟浣撹祫鏂� - if (!mediafileVo.isEmpty()) { - //璧嬪�� - it.mediafileList = mediafileVo + val problemListVo = mutableListOf<ProblemlistVo>() + if (all == false) { + //鍘婚櫎鏈鏍镐互鍙婂鏍镐笉閫氳繃鐨勯棶棰� + findBySubtaskId(stGuid).forEach { + if (it.extension3 != Constant.PROBLEM_UNCHECKED && it.extension3 != Constant.PROBLEM_CHECK_FAIL) { + problemListVo.add(it) } + } + } else { + problemListVo.addAll(findBySubtaskId(stGuid)) + } + //鏍规嵁姣忎釜闂,鑾峰彇濯掍綋鏂囦欢 + problemListVo.forEach { + val mediafileVo = mediafileService.findByBusinessGUID(it.guid!!) + //鍒ゆ柇鏄惁鏈夊獟浣撹祫鏂� + if (mediafileVo.isNotEmpty()) { + //璧嬪�� + it.mediafileList = mediafileVo } } return problemListVo } + + override fun getSceneByProType(areaVo: AreaVo, pType: String): List<Subtask?> { + areaVo.scensetypeid ?: throw BizException("缂哄皯鍦烘櫙绫诲瀷鍙傛暟") + val task = taskRep.findOneTask(areaVo) ?: throw BizException("鏈壘鍒板搴旂殑宸℃煡鎬讳换鍔�") + return subTaskRep.findSubtasks(task.tguid!!, areaVo.scensetypeid!!, pType) + } + + override fun getSceneProSummary( + areaVo: AreaVo, + sortBy: String, + page: Int, + per_page: Int, + ): Pair<DataHead?, List<SceneProblemSummary>?> { + areaVo.scensetypeid ?: throw BizException("缂哄皯鍦烘櫙绫诲瀷鍙傛暟") + val task = taskRep.findOneTask(areaVo) ?: throw BizException("鏈壘鍒板搴旂殑宸℃煡鎬讳换鍔�") + val p = PageHelper.startPage<SceneProblemSummary>(page, per_page) + val res = problemRep.getSceneProSummary(task.tguid!!, areaVo.scensetypeid!!, areaVo.sort, sortBy) + return DataHead(p.pageNum, p.pages, p.total) to res + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt index ea2e3be..3322c91 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt @@ -1,19 +1,30 @@ package cn.flightfeather.supervision.lightshare.service.impl +import cn.flightfeather.supervision.business.import.SceneImport import cn.flightfeather.supervision.business.location.LocationRoadNearby +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.* import cn.flightfeather.supervision.domain.ds1.mapper.* +import cn.flightfeather.supervision.domain.ds1.repository.SceneRep +import cn.flightfeather.supervision.domain.ds2.entity.UserMap +import cn.flightfeather.supervision.domain.ds2.repository.BaseInfoRep +import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep import cn.flightfeather.supervision.lightshare.service.* import cn.flightfeather.supervision.lightshare.vo.* import com.github.pagehelper.PageHelper import com.google.gson.Gson +import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty import org.springframework.beans.BeanUtils import org.springframework.beans.factory.annotation.Autowired import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional +import org.springframework.web.multipart.MultipartFile import tk.mybatis.mapper.entity.Example import tk.mybatis.mapper.util.StringUtil +import java.io.ByteArrayInputStream +import java.util.* +import kotlin.collections.ArrayList @Service class ScenseServiceImpl( @@ -25,6 +36,10 @@ val sceneWharfMapper: SceneWharfMapper, val userinfoService: UserinfoService, private val locationRoadNearby: LocationRoadNearby, + private val sceneImport: SceneImport, + private val sceneRep: SceneRep, + private val baseInfoRep: BaseInfoRep, + private val userMapRep: UserMapRep, ) : ScenseService { @Autowired @@ -132,12 +147,13 @@ } override fun save(scense: Scense): Int { - // TODO: 2021/7/20 鏂板鍦烘櫙鐨勫悓鏃剁敓鎴愯处鎴� - val r = scenseMapper.insert(scense) - if (r == 1) { - scense.guid?.let { userinfoService.createAccount(it) } + return try { + createScene(scense) + 1 + } catch (e: BizException) { + println(e.message) + 0 } - return r } override fun update(scense: Scense): Int = scenseMapper.updateByPrimaryKeySelective(scense) @@ -371,7 +387,6 @@ areaVo.towncode?.let { andEqualTo("towncode", it) } areaVo.scensetypeid?.let { andEqualTo("typeid", it) } areaVo.sceneName?.let { andLike("name", "%${it}%") } - } areaVo.online?.let { and(createCriteria().apply { @@ -390,4 +405,53 @@ override fun searchByCoordinate(lng: Double, lat: Double, radius: Double): List<Scense> { return locationRoadNearby.searchByRadius(Pair(lng, lat), radius) } + + override fun importSceneInfo(file: MultipartFile): Boolean { + val f = ByteArrayInputStream(file.bytes) + val scenes = sceneImport.readFromFile(f) + // 鏌ユ壘鍦烘櫙鍚嶇О鏄惁閲嶅 + val names = scenes.map { it.name } + sceneRep.findScenes(names).map { it?.name }.ifNotEmpty { + val str = this.joinToString("锛�") + throw BizException("瀛樺湪閲嶅鍦烘櫙锛屽涓嬶細${str}") + } + scenes.forEach { + createOneScene(it) + } + return true + } + + override fun createScene(scense: Scense): Scense { + val names = listOf(scense.name) + sceneRep.findScenes(names).map { it?.name }.ifNotEmpty { + val str = this.joinToString("锛�") + throw BizException("瀛樺湪閲嶅鍦烘櫙锛屽涓嬶細${str}") + } + createOneScene(scense) + return scense + } + + + override fun createOneScene(scense: Scense) { + //1. 鎻掑叆鍦烘櫙琛� + sceneRep.insert(scense) + //2. 鐢熸垚瀵瑰簲璐︽埛淇℃伅 + val userInfo = userinfoService.createAccount(scense) + createTZUserInfo(userInfo, scense) + } + + override fun createTZUserInfo(userInfo: Userinfo, scense: Scense) { + //1. 鐢熸垚椋炵窘鐜绯荤粺瀵瑰簲璐︽埛鍜屽熀纭�淇℃伅 + val userInfoTZ = userinfoService.createAccountTZ(userInfo, scense) + val baseInfo = baseInfoRep.create(userInfoTZ, scense) + //2. 鐢熸垚鐢ㄦ埛鍖归厤淇℃伅 + userMapRep.insert(UserMap().apply { + tzUserId = userInfoTZ.guid + tzUserName = userInfoTZ.realname + svUserId = userInfo.guid + svUserName = userInfo.realname + umCreateTime = Date() + }) + } + } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt index 556871c..676a708 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt @@ -1,11 +1,13 @@ package cn.flightfeather.supervision.lightshare.service.impl import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.domain.ds1.entity.* import cn.flightfeather.supervision.domain.ds1.mapper.* import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.DateUtil import cn.flightfeather.supervision.common.utils.UUIDGenerator +import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.lightshare.service.SubtaskService import cn.flightfeather.supervision.lightshare.service.TaskService import cn.flightfeather.supervision.lightshare.vo.* @@ -16,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional import tk.mybatis.mapper.entity.Example import tk.mybatis.mapper.util.StringUtil +import java.time.LocalDateTime import java.util.* import kotlin.math.ceil @@ -23,6 +26,7 @@ class SubtaskServiceImpl( private val subtaskMapper: SubtaskMapper, private val aopEvaluation: AopEvaluation, + private val taskRep: TaskRep, ) : SubtaskService { val dateUtil = DateUtil() @@ -998,67 +1002,45 @@ return resultList } - override fun getByTopTaskAndDate(topTaskId: String, startTime: String?, endTime: String?, sceneTypeId: Int?): List<Subtask> { -// val startDate = dateUtil.StringToDate(startTime) -// val endDate = dateUtil.StringToDate(endTime) -// -// val cal = Calendar.getInstance().apply { time = startDate } -// val _startTime = dateUtil.DateToString(cal.time, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS) ?: startTime -// -// if (endDate == null) { -// cal.add(Calendar.MONTH, 1) -// cal.add(Calendar.DAY_OF_MONTH, -1) -// } else { -// cal.time = endDate -// } -// cal.set(Calendar.HOUR_OF_DAY, 23) -// cal.set(Calendar.MINUTE, 59) -// cal.set(Calendar.SECOND, 59) -// val _endTime = dateUtil.DateToString(cal.time, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS) ?: endTime + override fun getByTopTaskAndDate( + topTaskId: String, + startTime: String?, + endTime: String?, + sceneTypeId: Int? + ): List<Subtask> { - val resultList = subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId) - - return resultList + return subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId) } override fun getSummary(topTaskId: String, sceneTypeId: Int?): List<SubTaskSummary> { -// val result = mutableListOf<SubTaskSummary>() - -// subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId).forEach { -// val scene = scenseMapper.selectByPrimaryKey(it.scenseid) -// var p = 0 -// var c = 0 -// var pc = 0 -// var cc = 0 -// problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { -// createCriteria().andEqualTo("stguid", it.stguid) -// }).forEach {pro -> -// p++ -// if (pro.ischanged == true) c++ -// if (pro.extension3 != Constant.PROBLEM_UNCHECKED) pc++ -// if (pro.extension3 == Constant.CHANGE_CHECK_PASS || pro.extension3 == Constant.CHANGE_CHECK_FAIL) cc++ -// } -// val ins = inspectionMapper.selectByExample(Example(Inspection::class.java).apply { -// createCriteria().andEqualTo("stguid", it.stguid) -// }) -// result.add(SubTaskSummary().apply { -// stGuid = it.stguid -// stName = it.name -// if (ins.isNotEmpty()) insGuid = ins[0].guid -// sceneId = it.scenseid -// sceneName = scene.name -// sceneType = scene.type -// stPlanTime = it.planstarttime -// proNum = p -// changeNum = c -// proCheckedNum = pc -// changeCheckedNum = cc -// }) -// } - -// return result - return subtaskMapper.getSummary(topTaskId, sceneTypeId) + } + override fun getSummaryByArea(areaVo: AreaVo): List<TaskProgressVo> { + areaVo.scensetypeid ?: throw BizException("缂哄皯鍦烘櫙绫诲瀷鍙傛暟") + val res = mutableListOf<TaskProgressVo>() + taskRep.findTasks(areaVo).forEach {t-> + if (t?.tguid == null) return@forEach + val pro = TaskProgressVo().apply { + tguid = t.tguid + name = t.name + levelnum = t.levelnum + provinceCode = t.provincecode + provinceName = t.provincename + cityCode = t.citycode + cityName = t.cityname + districtCode = t.districtcode + districtName = t.districtname + townCode = t.towncode + townName = t.townname + subTaskSummary = subtaskMapper.getSummary(t.tguid!!, areaVo.scensetypeid?.toIntOrNull()) + } + res.add(pro) + } + return res + } + + override fun getByScene(sceneId: String, startTime: LocalDateTime?, endTime: LocalDateTime?): List<SubTaskSummary> { + return subtaskMapper.getSummaryByScene(sceneId, startTime, endTime) } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt index cb7885b..7853af7 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt @@ -9,10 +9,7 @@ import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.DateUtil import cn.flightfeather.supervision.domain.ds1.repository.TaskRep -import cn.flightfeather.supervision.lightshare.service.EvaluationService -import cn.flightfeather.supervision.lightshare.service.SubtaskService -import cn.flightfeather.supervision.lightshare.service.TaskService -import cn.flightfeather.supervision.lightshare.service.UserinfoService +import cn.flightfeather.supervision.lightshare.service.* import cn.flightfeather.supervision.lightshare.vo.* import org.springframework.beans.BeanUtils import org.springframework.beans.factory.annotation.Autowired @@ -22,7 +19,10 @@ import kotlin.collections.ArrayList @Service -class TaskServiceImpl(val taskMapper: TaskMapper, private val taskRep: TaskRep,) : TaskService { +class TaskServiceImpl( + val taskMapper: TaskMapper, + private val taskRep: TaskRep, +) : TaskService { @Autowired lateinit var subtaskService: SubtaskService @@ -729,4 +729,33 @@ override fun findTask(areaVo: AreaVo): List<Task?> { return taskRep.findTasks(areaVo) } + + override fun findTaskProgress(areaVo: AreaVo): List<TaskProgressVo?> { + val res = mutableListOf<TaskProgressVo?>() + taskRep.findTasks(areaVo).forEach {t-> + if (t?.tguid == null) return@forEach + val pro = TaskProgressVo().apply { + tguid = t.tguid + name = t.name + levelnum = t.levelnum + provinceCode = t.provincecode + provinceName = t.provincename + cityCode = t.citycode + cityName = t.cityname + districtCode = t.districtcode + districtName = t.districtname + townCode = t.towncode + townName = t.townname + var count = 0 + taskRep.findMonitorList(t.tguid!!, areaVo.scensetypeid).forEach { + val c = if (it.extension1 != null) it.extension1!!.toInt() else 1 + count += c + } + totaltask = count + completetask = subtaskService.getSummary(t.tguid!!, areaVo.scensetypeid?.toIntOrNull()).size + } + res.add(pro) + } + return res + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt index 6ef1a58..764f171 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt @@ -1,9 +1,9 @@ package cn.flightfeather.supervision.lightshare.service.impl import cn.flightfeather.supervision.business.autooutput.dataanalysis.AopDataDeviceMap -import cn.flightfeather.supervision.common.exception.ResponseErrorException -import cn.flightfeather.supervision.common.utils.Constant +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.utils.UUIDGenerator +import cn.flightfeather.supervision.domain.ds1.entity.Scense import cn.flightfeather.supervision.domain.ds1.entity.Userinfo import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper import cn.flightfeather.supervision.domain.ds1.repository.SceneRep @@ -14,12 +14,13 @@ import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper import cn.flightfeather.supervision.domain.ds2.mapper.UserinfoTZMapper import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep +import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep import cn.flightfeather.supervision.lightshare.service.UserMapService -import cn.flightfeather.supervision.lightshare.service.UserinfoService import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo import org.springframework.stereotype.Service import tk.mybatis.mapper.entity.Example +import java.util.* @Service class UserMapServiceImpl( @@ -30,23 +31,27 @@ private val taskRep: TaskRep, private val userInfoSVRep: UserInfoSVRep, private val userInfoTZRep: UserInfoTZRep, + private val userMapRep: UserMapRep, private val aopDataDeviceMap: AopDataDeviceMap, ) : UserMapService { override fun getTZIdBySceneId(sceneId: String): UserMap { - val list = userInfoSVRep.findUser(sceneId) - if (list.isEmpty()) return UserMap() - val userId = list[0]?.guid + val user = userInfoSVRep.findUser(sceneId) + val userId = user?.guid val result = userMapMapper.selectByExample(Example(UserMap::class.java).apply { createCriteria().andEqualTo("svUserId", userId) }) return if (result.isNotEmpty()) result[0] else UserMap() } + override fun getSceneByTZId(tzUserId: String): Scense? { + return userMapRep.findFromSupervision(tzUserId) + } + override fun autoCreateMap() { // 閫夋嫨闇�瑕佸鐞嗙殑璐︽埛 val userList = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { - createCriteria().andEqualTo("remark", "闈欏畨鍖�") + createCriteria().andEqualTo("remark", "寰愭眹鍖�") }) userList.forEach { // 鏌ユ壘鏄惁宸茬粡鏈夎处鎴峰尮閰嶈褰� @@ -81,6 +86,7 @@ tzUserName = id svUserId = it.guid svUserName = it.realname + umCreateTime = Date() }) } } @@ -98,7 +104,7 @@ } //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋 2 -> { - val task = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟") + val task = taskRep.findOneTask(areaVo) ?: throw BizException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟") val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) .map { it?.guid } userInfoSVRep.findUser(scenes).map { it?.guid } diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt index cb21ee7..2cb6d2f 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt @@ -1,5 +1,6 @@ package cn.flightfeather.supervision.lightshare.service.impl +import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.PinYin import cn.flightfeather.supervision.common.utils.UUIDGenerator import cn.flightfeather.supervision.domain.ds1.entity.Scense @@ -9,9 +10,11 @@ import cn.flightfeather.supervision.domain.ds1.repository.SceneRep import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep +import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep import cn.flightfeather.supervision.lightshare.service.UserinfoService import cn.flightfeather.supervision.lightshare.vo.AreaVo +import org.springframework.beans.BeanUtils import org.springframework.stereotype.Service import tk.mybatis.mapper.entity.Example import kotlin.random.Random @@ -21,6 +24,8 @@ class UserinfoServiceImpl( val userinfoMapper: UserinfoMapper, private val scenseMapper: ScenseMapper, + private val userInfoSVRep: UserInfoSVRep, + private val userInfoTZRep: UserInfoTZRep, ) : UserinfoService { //鏍规嵁userinfo鏉′欢鏌ヨ @@ -68,26 +73,7 @@ findByScene(sceneId)?.let { return it } scenseMapper.selectByPrimaryKey(sceneId)?.let { - val sceneName = it.name ?: return Userinfo() - val uName = getUName(sceneName) - - val userInfo = Userinfo().apply { - guid = UUIDGenerator.generate16ShortUUID() - acountname = uName - realname = sceneName - password = "123456" - usertypeid = 3 - usertype = "浼佷笟" - dGuid = it.guid - departmentname = sceneName - isenable = true - remark = it.districtname - } - - val r = userinfoMapper.insert(userInfo) - if (r == 1) { - return userInfo - } + createAccount(it) } return Userinfo() } @@ -99,7 +85,7 @@ return null } - private fun getUName(sceneName: String): String { + override fun getUName(sceneName: String): String { var uName = PinYin.getPinYinHeader(sceneName) var suffix = "" var repeated: Boolean @@ -126,11 +112,14 @@ } } - private fun createAccount(scence: Scense) { + override fun createAccount(scence: Scense):Userinfo { scence.let { - val sceneName = it.name ?: return - val uName = getUName(sceneName) + // 鍒ゆ柇璇ュ満鏅槸鍚﹀凡鏈夊搴旇处鎴� + val user = userInfoSVRep.findUser(it.guid) + if (user != null) return Userinfo() + val sceneName = it.name ?: return Userinfo() + val uName = getUName(sceneName) val userInfo = Userinfo().apply { guid = UUIDGenerator.generate16ShortUUID() acountname = uName @@ -146,8 +135,32 @@ val r = userinfoMapper.insert(userInfo) if (r == 1) { - println("${userInfo.guid}--${userInfo.acountname}--${userInfo.realname}") + return userInfo + } else { + return Userinfo() } } } + + override fun createAccountTZ(userinfo: Userinfo, scence: Scense): UserinfoTZ { + val userinfoTZ = UserinfoTZ() + BeanUtils.copyProperties(userinfo, userinfoTZ) + // 浣跨敤鏂扮殑id + userinfoTZ.guid = UUIDGenerator.generate16ShortUUID() + // 娣诲姞鍖哄幙鎻忚堪 + // FIXME: 2024/4/23 鐩墠鍦˙aseInfo鍩虹淇℃伅涓凡瀛樺偍瀹屾暣鐨勮鏀垮尯鍒掞紝鍚庣画搴斿皢姝ゅ璁板綍鍘婚櫎 + userinfoTZ.extension1 = userinfoTZ.remark + userinfoTZ.remark = null + // 鍦烘櫙绫诲瀷杞崲 + userinfoTZ.extension2 = Constant.SceneType.typeMap(scence.typeid)?.toString() + // 鏍规嵁acountname鍜宺ealname杩涜閲嶅鍒ゆ柇 + userInfoTZRep.findOne(UserinfoTZ().apply { + acountname = userinfoTZ.acountname + realname = userinfoTZ.realname + }).takeIf { it == null }.run { + // 褰撴病鏈夋煡璇㈢粨鏋滄椂锛屾彃鍏ユ柊璐︽埛淇℃伅 + userInfoTZRep.insert(userinfoTZ) + } + return userinfoTZ + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt index 9068058..972d163 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt @@ -25,6 +25,8 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") var endtime: LocalDateTime? = null + // 鍦烘櫙id + var sceneId: String? = null // 鍦烘櫙鍚嶇О var sceneName: String? = null // 鍦烘櫙绫诲瀷 @@ -35,4 +37,8 @@ // 涓绘暟鎹簮锛�1锛氫互椋炵窘鐜绯荤粺涓殑鐢ㄦ埛涓轰富浣擄紱2锛氫互椋炵窘鐩戠绯荤粺涓殑鐢ㄦ埛涓轰富浣� var sourceType:Int = 1 + + // 鏌ヨ鎺掑簭 + var sort:String? = "asc" + var sortBy: String? = null } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt index 8d8c370..23f9e6c 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt @@ -74,4 +74,29 @@ return res } } +} + +/** + * 鏍规嵁璁惧mn缂栫爜鎵惧埌瀵瑰簲鍏崇郴 + */ +fun List<DeviceMapVo>.findByDeviceCode(code: String?): DeviceMapVo? { + this.forEach { + if (it.deviceCode == code) { + return it + } + } + return null +} + +/** + * 鏍规嵁椋炵窘鐩戠绯荤粺鐢ㄦ埛id鎵惧埌瀵瑰簲鍏崇郴 + */ +fun List<DeviceMapVo>.findBySVUserId(svUserId: String?): List<DeviceMapVo> { + val res = mutableListOf<DeviceMapVo>() + this.forEach { + if (it.svUserId == svUserId) { + res.add(it) + } + } + return res } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceSiteVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceSiteVo.kt new file mode 100644 index 0000000..141fda3 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceSiteVo.kt @@ -0,0 +1,127 @@ +package cn.flightfeather.supervision.lightshare.vo + +import cn.flightfeather.supervision.domain.ds2.entity.DustSiteInfo +import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteInfo +import java.util.* + +/** + * 鐩戞祴璁惧淇℃伅 + */ +class DeviceSiteVo { + + var id: Int? = null + var mnCode: String? = null + var address: String? = null + var name: String? = null + var code: String? = null + var beginDate: Date? = null + var endDate: Date? = null + var dutyCompanyId: String? = null + var dutyCompany: String? = null + var engineeringStage: String? = null + var groupId: String? = null + var groupName: String? = null + var isOnline: Boolean? = null + var isTrouble: Boolean? = null + var kindex: Double? = null + var longitude: Double? = null + var latitude: Double? = null + var linkman: String? = null + var phone: String? = null + var province: String? = null + var ringId: String? = null + var ringName: String? = null + var typeId: String? = null + var typename: String? = null + var buildArea: String? = null + + companion object { + /** + * 閫氳繃闈欏畨鍖虹洃娴嬬偣浣嶄俊鎭浆鎹� + */ + fun fromJADustSiteInfo(list: List<DustSiteInfo?>): List<DeviceSiteVo> { + val res = mutableListOf<DeviceSiteVo>() + list.forEach { + it ?: return@forEach + res.add(DeviceSiteVo().apply { + id = it.id?.toIntOrNull() + mnCode = it.mnCode + address = it.address + name = it.name + code = it.code + beginDate = it.beginDate + endDate = it.endDate + dutyCompanyId = it.dutyCompanyId + dutyCompany = it.dutyCompany + engineeringStage = it.engineeringStage + groupId = it.groupId + groupName = it.groupName + isOnline = it.isOnline?.toBoolean() + isTrouble = it.isTrouble?.toBoolean() + kindex = it.kindex?.toDoubleOrNull() + longitude = it.longitude?.toDoubleOrNull() + latitude = it.latitude?.toDoubleOrNull() + linkman = it.linkman + phone = it.phone + province = it.province + ringId = it.ringId +// ringName = it.ringName + typeId = it.typeId + typename = it.typename + buildArea = it.buildArea + }) + } + return res + } + + /** + * 閫氳繃閲戝北鍖虹洃娴嬬偣浣嶄俊鎭浆鎹� + */ + fun fromJSDustSiteInfo(list: List<JSDustSiteInfo?>): List<DeviceSiteVo> { + val res = mutableListOf<DeviceSiteVo>() + list.forEach { + it ?: return@forEach + res.add(DeviceSiteVo().apply { + id = it.id + mnCode = it.mnCode + address = it.address + name = it.name + code = it.code + beginDate = it.beginDate + endDate = it.endDate + dutyCompanyId = it.dutyCompanyId + dutyCompany = it.dutyCompany + engineeringStage = it.engineeringStage + groupId = it.groupId + groupName = it.groupName + isOnline = it.isOnline?.toBoolean() + isTrouble = it.isTrouble?.toBoolean() + kindex = it.kindex?.toDoubleOrNull() + longitude = it.longitude?.toDoubleOrNull() + latitude = it.latitude?.toDoubleOrNull() + linkman = it.linkman + phone = it.phone + province = it.province + ringId = it.ringId + ringName = it.ringName + typeId = it.typeId + typename = it.typename + buildArea = it.buildArea + }) + } + return res + } + } +} + +/** + * 鏍规嵁璁惧mn缂栫爜鎵惧埌璁惧淇℃伅 + */ +fun List<DeviceSiteVo>.findByMNCode(mnCode: String?): DeviceSiteVo? { + this.forEach { + if (it.mnCode == mnCode) { + return it + } + } + return null +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt new file mode 100644 index 0000000..e3b006b --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt @@ -0,0 +1,55 @@ +package cn.flightfeather.supervision.lightshare.vo + +/** + * 璇勫垎瑙勫垯鍙婂緱鍒� + */ +class EvaluationVo { + //瑙勫垯id + var id: String? = null + //瑙勫垯鎻忚堪 + var title1: String? = null + //鍒嗗�� + var score: Int = 0 + //鏄惁閫変腑 + var select: Boolean = false + //basic_score: 鍩虹鍒嗭紝蹇呴�夛紱addition_score锛氶檮鍔犲垎锛屽彲閫夛紱null锛氶粯璁ゅ熀纭�鍒� + var scoreMode: String? = "basic_score" + //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 + var gradeMode: String? = "minus_mode" + //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 + var selectMode: String? = "single_mode" + //浜岀骇瀛愯鍒� + var sub1: MutableList<SubEvaluationVo> = mutableListOf() +} + +class SubEvaluationVo { + //鏈夋椂鍊欎竴绾х殑瑙勫垯涓嬮潰鐩存帴鏄笁绾ц鍒欙紝娌℃湁浜岀骇瑙勫垯锛屽洜姝ゆ鏃剁殑浜岀骇瑙勫垯鍙槸涓轰簡缁撴瀯瀹屾暣鎬ц�屽嚭鐜扮殑 + var placeholder: Boolean = false + //瑙勫垯id + var id: String? = null + //瑙勫垯鎻忚堪 + var title2: String? = null + //鍒嗗�� + var score: Int = 0 + //鏄惁閫変腑 + var select: Boolean = false + //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱 + var gradeMode: String? = "minus_mode" + //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱 + var selectMode: String? = "single_mode" + //浜岀骇瑙勫垯鍒嗙粍 + var group: Int? = null + //涓夌骇瀛愯鍒� + var sub2: MutableList<ThirdEvaluationVo> = mutableListOf() +} + +class ThirdEvaluationVo { + //瑙勫垯id + var id: String? = null + //瑙勫垯鎻忚堪 + var content: String? = null + //鍒嗗�� + var score: Int = 0 + //鏄惁閫変腑 + var select: Boolean = false +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionInfoVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionInfoVo.kt index 6f4a62a..8f363bd 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionInfoVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionInfoVo.kt @@ -1,7 +1,10 @@ package cn.flightfeather.supervision.lightshare.vo +import com.fasterxml.jackson.annotation.JsonFormat import com.fasterxml.jackson.annotation.JsonInclude import org.apache.xpath.operations.Bool +import java.time.LocalDateTime +import java.util.* @JsonInclude(JsonInclude.Include.NON_NULL) class InspectionInfoVo { @@ -21,7 +24,8 @@ //鏄惁宸茬洃绠� var inspected: Boolean? = null //鐩戠鏃堕棿 - var inspectionTime: String? = null + @JsonFormat(pattern = "yyyy-MM-dd") + var inspectionTime: Date? = null //鐩戠娆℃暟 var inspectionTimes: Int? = null //鏄惁鎵胯 diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDetail.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDetail.kt index 9f670e2..4a9371a 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDetail.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDetail.kt @@ -21,5 +21,5 @@ var subScene: BaseScene? = null, //鍦烘櫙鐩戞祴璁惧淇℃伅 @ApiModelProperty("鍦烘櫙鐩戞祴璁惧淇℃伅") - var sceneDevice: SceneDevice? = null + var sceneDevice: SceneDevice? = null, ) \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDeviceVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDeviceVo.kt new file mode 100644 index 0000000..e4df294 --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDeviceVo.kt @@ -0,0 +1,54 @@ +package cn.flightfeather.supervision.lightshare.vo + +import cn.flightfeather.supervision.domain.ds1.entity.Scense + +/** + * 鍦烘櫙鍜屽搴旂洃娴嬬偣浣嶄俊鎭� + */ +class SceneDeviceVo { + var scene: Scense? = null + var deviceList: MutableList<DeviceSiteVo?> = mutableListOf() +} + +fun List<SceneDeviceVo>.tableHeadScene(): List<Array<Any>> { + return listOf(arrayOf( + "鍦烘櫙缂栧彿", "鍚嶇О", "绫诲瀷", "鍦板潃", "鍖哄幙", "琛楅晣", "鑱旂郴浜�", "鐢佃瘽", "鍒涘缓鏃堕棿", + )) +} + +fun List<SceneDeviceVo>.tableHeadDevice(): List<Array<Any>> { + return listOf(arrayOf( + "鐩戞祴鐐圭紪鍙�", "MN缂栫爜", "鐐逛綅鍚嶇О", "鍦板潃", "寮�宸ユ椂闂�", "杩愮淮鍟�", "鍖哄幙", + )) +} + +fun List<SceneDeviceVo>.tableHead(): List<Array<Any>> { + val a = this.tableHeadScene()[0].toMutableList() + val b = this.tableHeadDevice()[0].toList() + a.addAll(b) + return listOf(a.toTypedArray()) +} + +fun List<SceneDeviceVo>.tableContent(): MutableList<Array<Any>> { + val contents = mutableListOf<Array<Any>>() + this.forEach { s -> + val deviceList = s.deviceList + val scene = s.scene + deviceList.forEach each@ { + it ?: return@each + val content = mutableListOf<Any>() + content.addAll(listOf(scene?.index ?: "", scene?.name ?: "", scene?.type ?: "", scene?.location ?: "", + scene?.districtname ?: "", scene?.townname ?: "", scene?.contacts ?: "", scene?.contactst ?: "", + scene?.createdate ?: "")) + content.addAll(listOf(it.id ?: "", it.mnCode ?: "", it.name ?: "", it.address ?: "", it.beginDate ?: "", it + .dutyCompany ?: "", it.groupName ?: "")) + contents.add(content.toTypedArray()) + } + if (contents.isEmpty()) { + contents.add(arrayOf(scene?.index ?: "", scene?.name ?: "", scene?.type ?: "", scene?.location ?: "", + scene?.districtname ?: "", scene?.townname ?: "", scene?.contacts ?: "", scene?.contactst ?: "", + scene?.createdate ?: "")) + } + } + return contents +} \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneProblemSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneProblemSummary.kt new file mode 100644 index 0000000..00f479c --- /dev/null +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneProblemSummary.kt @@ -0,0 +1,24 @@ +package cn.flightfeather.supervision.lightshare.vo + +import cn.flightfeather.supervision.domain.ds1.entity.Scense +import cn.flightfeather.supervision.domain.ds1.entity.Subtask + +/** + * 鍦烘櫙闂缁熻 + */ +class SceneProblemSummary { + var sceneId: String? = null + + // 鍦烘櫙淇℃伅 + var scene: Scense? = null + + var subtasks: List<Subtask>? = null + + // 闂鏁� + var proNum = 0 + + // 鏁存敼鏁� + var changeNum = 0 + + var changePer: Double = 0.0 +} \ 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 97a0a03..45e3a5b 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt @@ -1,5 +1,6 @@ package cn.flightfeather.supervision.lightshare.vo +import cn.flightfeather.supervision.domain.ds1.entity.Scense import com.fasterxml.jackson.annotation.JsonInclude import java.math.BigDecimal import java.util.* @@ -73,4 +74,16 @@ 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/SubTaskSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt index b8151aa..d45b1fa 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt @@ -10,6 +10,7 @@ var sceneName: String? = null var sceneType: String? = null var stPlanTime: Date? = null + var stStatus:String? = null var proNum = 0 var changeNum = 0 diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt index b94805a..78071e6 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt @@ -2,14 +2,26 @@ import com.fasterxml.jackson.annotation.JsonInclude +/** + * 浠诲姟瀹屾垚鎯呭喌缁熻 + */ @JsonInclude(JsonInclude.Include.NON_NULL) class TaskProgressVo{ - + // 浠诲姟id var tguid: String? = null - + // 浠诲姟鍚嶇О var name: String? = null - + // 浠诲姟绛夌骇(2:鎬讳换鍔★紱null锛氭棩浠诲姟鎴栧瓙浠诲姟) var levelnum: Int? = null + + 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 totaltask:Int? = null @@ -19,5 +31,7 @@ var mycompletetask:Int? = null - var subtaskprogressVo = mutableListOf<TaskProgressVo>() + var subtaskprogressVo: List<TaskProgressVo>? = null + + var subTaskSummary: List<SubTaskSummary>? = null } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt index 3cc30f6..2a6af5f 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt @@ -1,6 +1,6 @@ package cn.flightfeather.supervision.lightshare.web -import cn.flightfeather.supervision.common.exception.ResponseErrorException +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.lightshare.vo.BaseResponse import cn.flightfeather.supervision.lightshare.vo.DataHead @@ -20,7 +20,7 @@ } else { BaseResponse(true, data = res) } - } catch (e: ResponseErrorException) { + } catch (e: BizException) { BaseResponse(false, message = e.message ?: "") } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt index 5db3784..d4727e9 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt @@ -1,6 +1,7 @@ package cn.flightfeather.supervision.lightshare.web import cn.flightfeather.supervision.common.executor.BgTaskConditionVo +import cn.flightfeather.supervision.common.executor.BgTaskStatus import cn.flightfeather.supervision.lightshare.service.BgTaskService import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt index ce1b46e..00c861d 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt @@ -70,6 +70,8 @@ @ApiOperation(value = "涓嬭浇鑷姩璇勪及缁撴灉") @PostMapping("/auto/record/download") - fun downloadAutoEvaluation(@RequestBody areaVo: AreaVo, @ApiIgnore response: HttpServletResponse) = - resPack { evaluationService.downloadAutoEvaluation(areaVo, response) } + fun downloadAutoEvaluation( + @RequestBody areaVo: AreaVo, @RequestParam forceUpdate: Boolean, + @ApiIgnore response: HttpServletResponse, + ) = resPack { evaluationService.downloadAutoEvaluation(areaVo, forceUpdate, response) } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt index 668cd6d..c61a8b0 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt @@ -33,4 +33,10 @@ @ApiParam("鍦烘櫙绫诲瀷id") @RequestParam("sceneTypeId") sceneTypeId: String, @ApiParam(value = "璇勫垎琛ㄧ増鏈紝 鏍煎紡 yyyy-MM, 榛樿鑾峰彇鏈�鏂扮増鏈�") @RequestParam("version") version: String? ) = evaluationsubruleService.search(districtCode, sceneTypeId, version) + + @ApiOperation(value = "鏌ユ壘宸℃煡浠诲姟鑷姩璇勪及鐨勮瘎鍒嗙粏鑺�") + @GetMapping("/score") + fun getAutoScore( + @ApiParam(value = "宸℃煡浠诲姟id") @RequestParam subTaskId: String, + ) = resPack { evaluationsubruleService.getAutoScore(subTaskId) } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt index 1100ee4..464cb58 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt @@ -1,7 +1,10 @@ package cn.flightfeather.supervision.lightshare.web +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.domain.ds1.entity.Inspection import cn.flightfeather.supervision.lightshare.service.InspectionService +import cn.flightfeather.supervision.lightshare.vo.AreaVo +import cn.flightfeather.supervision.lightshare.vo.BaseResponse import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam @@ -10,7 +13,7 @@ @Api(tags = ["InspectionController"], description = "宸℃煡淇℃伅API鎺ュ彛") @RestController @RequestMapping("/inspection") -class InspectionController (val inspectionService: InspectionService){ +class InspectionController(val inspectionService: InspectionService) { @GetMapping fun getAll() = inspectionService.findAll() @@ -21,31 +24,45 @@ fun update(@RequestBody inspection: Inspection) = inspectionService.update(inspection) @GetMapping("/{id}") - fun getById(@PathVariable id:String) = inspectionService.findByID(id) + fun getById(@PathVariable id: String) = inspectionService.findByID(id) @GetMapping("/{id}/problemlist") - fun findProblemListById(@PathVariable id:String) = inspectionService.findProblemListById(id) + fun findProblemListById(@PathVariable id: String) = inspectionService.findProblemListById(id) @GetMapping("/{id}/gitlist") - fun findGitListById(@PathVariable id:String) = inspectionService.findGitListById(id) + fun findGitListById(@PathVariable id: String) = inspectionService.findGitListById(id) @GetMapping("/{id}/{date}/lastproblemlist") - fun findLastProblemListById(@PathVariable id:String,@PathVariable date:String) = inspectionService.findLastProblemListBySenceId(id,date) + fun findLastProblemListById(@PathVariable id: String, @PathVariable date: String) = + inspectionService.findLastProblemListBySenceId(id, date) @GetMapping("/find/{id}") - fun findBySubTaskID(@PathVariable id:String) = inspectionService.findBySubTaskID(id) + fun findBySubTaskID(@PathVariable id: String) = inspectionService.findBySubTaskID(id) @DeleteMapping("/{id}") - fun delete (@PathVariable id: String) = inspectionService.delete(id) + fun delete(@PathVariable id: String) = inspectionService.delete(id) @GetMapping("/getInspectionInfoByScene") - fun getInspectionInfoByScene(@RequestParam(value = "sceneId", required = true)sceneId:String, @RequestParam(value = "topTaskId", required = true)topTaskId:String) - = inspectionService.getInspectionInfoByScene(sceneId, topTaskId) + fun getInspectionInfoByScene( + @RequestParam(value = "sceneId", required = true) sceneId: String, + @RequestParam(value = "topTaskId", required = true) topTaskId: String, + ) = inspectionService.getInspectionInfoByScene(sceneId, topTaskId) @ApiOperation(value = "鑾峰彇鏌愪釜鎬讳换鍔′笅鏌愬満鏅殑缁熻淇℃伅", notes = "鍖呮嫭鍦烘櫙鍩烘湰淇℃伅銆佽瘎鍒嗐�佸叿浣撻棶棰樼瓑") - @GetMapping("/statistic") + @PostMapping("/statistic") fun getStatistic( - @ApiParam("鎬讳换鍔d") @RequestParam("topTaskId") topTaskId: String, - @ApiParam("鍦烘櫙绫诲瀷id") @RequestParam("sceneTypeId") sceneTypeId: String - ) = inspectionService.getStatistic(topTaskId, sceneTypeId) + @ApiParam("鎬讳换鍔d") @RequestParam(required = false) topTaskId: String?, + @ApiParam("鍦烘櫙绫诲瀷id") @RequestParam(required = false) sceneTypeId: String?, + @ApiParam("鍖哄煙鏉′欢") @RequestBody(required = false) areaVo: AreaVo?, + ): BaseResponse<Any> { + return resPack { + if (topTaskId != null && sceneTypeId != null) { + inspectionService.getStatistic(topTaskId, sceneTypeId) + } else if (areaVo != null) { + inspectionService.getStatistic(areaVo) + } else { + throw BizException("缂哄け鎬讳换鍔d鍜屽尯鍩熸潯浠讹紝璇烽�夋嫨浼犺緭鍏朵腑涓�绉嶅弬鏁�") + } + } + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt index c5d280a..de6e270 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt @@ -40,53 +40,79 @@ fun getByArea(@RequestBody areaVo: AreaVo): List<ProblemlistVo> = problemlistService.getByArea(areaVo) @GetMapping("/getbytoptask") - fun getByTopTask(@RequestParam(value = "tguid", required = true) tguid: String): List<ProblemlistVo> = problemlistService.getByTopTask(tguid) + fun getByTopTask(@RequestParam(value = "tguid", required = true) tguid: String): List<ProblemlistVo> = + problemlistService.getByTopTask(tguid) @PostMapping("/getStatisticalResult") - fun getStatisticalResult(@RequestBody areaVo: AreaVo): List<StatisticsVo> = problemlistService.getStatisticalResult(areaVo) + fun getStatisticalResult(@RequestBody areaVo: AreaVo): List<StatisticsVo> = + problemlistService.getStatisticalResult(areaVo) @PostMapping("/getStatisticalResultById") - fun getStatisticalResult(@RequestParam(value = "id", required = true) topTaskId: String, - @RequestParam(value = "curSceneTypeId", required = true) sceneTypeId: String): List<StatisticsVo> = problemlistService.getStatisticalResultById(topTaskId, sceneTypeId) + fun getStatisticalResult( + @RequestParam(value = "id", required = true) topTaskId: String, + @RequestParam(value = "curSceneTypeId", required = true) sceneTypeId: String, + ): List<StatisticsVo> = problemlistService.getStatisticalResultById(topTaskId, sceneTypeId) @PostMapping("/getChargeResult") fun getChargeResult(@RequestBody areaVo: AreaVo): ChargeInfoVo = problemlistService.getChargeResult(areaVo) @GetMapping("/getProblemsByScene") - fun getProblemsByScene(@RequestParam(value = "sceneId", required = true) sceneId: String, @RequestParam date: String): List<ProblemlistVo> - = problemlistService.getProblemByScene(sceneId, date) + fun getProblemsByScene( + @RequestParam(value = "sceneId", required = true) sceneId: String, + @RequestParam date: String, + ): List<ProblemlistVo> = problemlistService.getProblemByScene(sceneId, date) @GetMapping("/month_anlysis") - fun getMonthProblemsById(@RequestParam(value = "taskId", required = true) taskId: String, - @RequestParam(value = "sceneType", required = false) sceneType: Int?): List<MonthProblemVo> = problemlistService.findMonthProblemById(taskId, sceneType) + fun getMonthProblemsById( + @RequestParam(value = "taskId", required = true) taskId: String, + @RequestParam(value = "sceneType", required = false) sceneType: Int?, + ): List<MonthProblemVo> = problemlistService.findMonthProblemById(taskId, sceneType) @ApiOperation(value = "瀵归棶棰樿繘琛屽鏍告搷浣�", notes = "鍖呮嫭闂鐨勬彁浜ゅ鏍稿拰鏁存敼瀹℃牳涓ょ") @PostMapping("/check") fun checkProblem( - @ApiParam(value = "闂id涓婚敭") @RequestParam("pId") pId: String, - @ApiParam(value = "瀹℃牳鎿嶄綔, 0: 瀹℃牳閫氳繃锛�1: 瀹℃牳涓嶉�氳繃锛�2: 鏁存敼閫氳繃锛�3: 鏁存敼涓嶉�氳繃", allowableValues = "0,1,2,3") @RequestParam("action") action: Byte, - @ApiParam(value = "瀹℃牳澶囨敞") @RequestParam("remark") remark: String, - @ApiParam(value = "鐢ㄦ埛id") @RequestParam("userId") userId: String, - @ApiParam(value = "鐢ㄦ埛鍚�") @RequestParam("userName") userName: String + @ApiParam(value = "闂id涓婚敭") @RequestParam("pId") pId: String, + @ApiParam(value = "瀹℃牳鎿嶄綔, 0: 瀹℃牳閫氳繃锛�1: 瀹℃牳涓嶉�氳繃锛�2: 鏁存敼閫氳繃锛�3: 鏁存敼涓嶉�氳繃", + allowableValues = "0,1,2,3") @RequestParam("action") action: Byte, + @ApiParam(value = "瀹℃牳澶囨敞") @RequestParam("remark") remark: String, + @ApiParam(value = "鐢ㄦ埛id") @RequestParam("userId") userId: String, + @ApiParam(value = "鐢ㄦ埛鍚�") @RequestParam("userName") userName: String, ) = problemlistService.check(pId, action, remark, userId, userName) @ApiOperation(value = "鏂板涓�涓棶棰�", notes = "绠�鍖栦笂浼犳墍闇�闂淇℃伅锛屽皢澶ч儴鍒嗘搷浣滀氦鐢卞悗鍙板畬鎴�") @PostMapping("/newProblem") fun newProblem( @RequestParam("problemVo") problemVo: String, - @RequestPart("images") files: Array<MultipartFile> + @RequestPart("images") files: Array<MultipartFile>, ) = problemlistService.newProblem(problemVo, files) @ApiOperation(value = "鏁存敼涓�涓棶棰�", notes = "绠�鍖栦笂浼犳墍闇�闂淇℃伅锛屽皢澶ч儴鍒嗘搷浣滀氦鐢卞悗鍙板畬鎴�") @PostMapping("/changeProblem") fun changeProblem( @RequestParam("problemId") problemId: String, - @RequestPart("images") files: Array<MultipartFile> + @RequestPart("images") files: Array<MultipartFile>, ) = problemlistService.changeProblem(problemId, files) - @ApiOperation(value = "閫氳繃浠诲姟鏌ユ壘闂", notes = "绠�鍖栦笂浼犳墍闇�闂淇℃伅锛屽皢澶ч儴鍒嗘搷浣滀氦鐢卞悗鍙板畬鎴�") + @ApiOperation(value = "閫氳繃浠诲姟鏌ユ壘闂") @GetMapping("/subtask") fun getBySubTask( @RequestParam("stGuid") stGuid: String, - ) = problemlistService.getBySubTask(stGuid) + @ApiParam(value = "鏄惁鑾峰彇鏈鏍稿強瀹℃牳涓嶉�氳繃鐨勯棶棰�") @RequestParam(required = false) all:Boolean? + ) = problemlistService.getBySubTask(stGuid, all) + + @ApiOperation(value = "鏌ユ壘鍙戠幇浜嗘煇绉嶉棶棰樼被鍨嬬殑鎵�鏈夊贰鏌ュ瓙浠诲姟") + @PostMapping("/type/subtask") + fun getSceneByProType( + @RequestBody areaVo: AreaVo, + @RequestParam pType: String, + ) = resPack { problemlistService.getSceneByProType(areaVo, pType) } + + @ApiOperation(value = "鏌ヨ鏌愭�讳换鍔′笅鍚勫満鏅殑闂鏁伴噺缁熻") + @PostMapping("/summary/scene") + fun getSceneProSummary( + @RequestBody areaVo: AreaVo, + @ApiParam(value = "鎺掑簭瀛楁", allowableValues = "pro, changePer") @RequestParam sortBy: String, + @ApiParam(value = "椤电爜") @RequestParam(value = "page") page: Int, + @ApiParam(value = "鍗曢〉鏁版嵁閲�") @RequestParam(value = "per_page") perPage: Int, + ) = resPack { problemlistService.getSceneProSummary(areaVo, sortBy, page, perPage) } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ScenseController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ScenseController.kt index 138e9fe..90d5434 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ScenseController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ScenseController.kt @@ -10,6 +10,7 @@ import io.swagger.annotations.ApiImplicitParam import io.swagger.annotations.ApiOperation import org.springframework.web.bind.annotation.* +import org.springframework.web.multipart.MultipartFile @Api(tags = ["ScenseController"], description = "鐩戠鍦烘櫙API鎺ュ彛") @RestController @@ -88,4 +89,16 @@ @RequestParam("lat") lat: Double, @RequestParam("radius") radius: Double, ) = resPack { scenseService.searchByCoordinate(lng, lat, radius) } + + @ApiOperation(value = "閫氳繃鏂囦欢瀵煎叆鍦烘櫙淇℃伅") + @PostMapping("/import") + fun importSceneInfo( + @RequestPart("file") file: MultipartFile, + ) = resPack { scenseService.importSceneInfo(file) } + + @ApiOperation(value = "鍒涘缓鍦烘櫙淇℃伅") + @PutMapping("/create") + fun createScene( + @RequestBody scense: Scense + ) = resPack { scenseService.createScene(scense) } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt index 69d5aa6..8bb3c96 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt @@ -4,9 +4,12 @@ import cn.flightfeather.supervision.lightshare.service.SubtaskService import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.TaskVo +import com.fasterxml.jackson.annotation.JsonFormat import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation +import org.springframework.format.annotation.DateTimeFormat import org.springframework.web.bind.annotation.* +import java.time.LocalDateTime @Api(tags = ["SubtaskController"], description = "宸℃煡瀛愪换鍔PI鎺ュ彛") @RestController @@ -70,4 +73,18 @@ @RequestParam("topTaskId") topTaskId: String, @RequestParam(value = "sceneTypeId", required = false) sceneTypeId: Int? ) = subtaskService.getSummary(topTaskId, sceneTypeId) + + @ApiOperation("鑾峰彇鏌愮被鍦烘櫙鐨勫贰鏌ヤ换鍔$粺璁′俊鎭�") + @PostMapping("/summary/area") + fun getSummaryByArea( + @RequestBody areaVo: AreaVo, + ) = subtaskService.getSummaryByArea(areaVo) + + @ApiOperation("鑾峰彇鏌愪釜鍦烘櫙鐨勫贰鏌ヤ换鍔�") + @GetMapping("/byScene") + fun getByScene( + @RequestParam sceneId: String, + @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") startTime: LocalDateTime?, + @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") endTime: LocalDateTime?, + ) = subtaskService.getByScene(sceneId, startTime, endTime) } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt index fcc2943..41d6006 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt @@ -4,6 +4,7 @@ import cn.flightfeather.supervision.lightshare.service.TaskService import cn.flightfeather.supervision.lightshare.vo.AreaVo import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation import org.springframework.web.bind.annotation.* @Api(tags = ["TaskController"], description = "宸℃煡鎬讳换鍔″拰鏃ヤ换鍔PI鎺ュ彛") @@ -65,4 +66,8 @@ @PostMapping("/find") fun findTask(@RequestBody areaVo: AreaVo) = resPack { taskService.findTask(areaVo) } + + @ApiOperation(value = "鑾峰彇鎬讳换鍔$殑瀹屾垚鎯呭喌") + @PostMapping("/progress") + fun findTaskProgress(@RequestBody areaVo: AreaVo) = resPack { taskService.findTaskProgress(areaVo) } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt index 881841e..3d31eaf 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt @@ -13,7 +13,11 @@ @ApiOperation(value = "鏍规嵁椋炵窘鐩戠绯荤粺涓殑鍦烘櫙id锛岃幏鍙栦笌椋炵窘鐜绯荤粺涓殑鍏宠仈鐢ㄦ埛") @GetMapping - fun getTZId(@RequestParam("sceneId") sceneId: String) = userMapService.getTZIdBySceneId(sceneId) + fun getTZId(@RequestParam sceneId: String) = userMapService.getTZIdBySceneId(sceneId) + + @ApiOperation(value = "鏍规嵁椋炵窘鐜绯荤粺涓殑鐢ㄦ埛id锛岃幏鍙栦笌椋炵窘鐩戠绯荤粺涓殑鍏宠仈鐢ㄦ埛") + @GetMapping("/scene") + fun getSceneByTzId(@RequestParam tzUserId: String) = userMapService.getSceneByTZId(tzUserId) @ApiOperation(value = "鑾峰彇鍖哄煙鐢ㄦ埛鐨勭洃娴嬭澶囧拰椋炵窘鐩戠绯荤粺銆侀缇界幆澧冪郴缁熺殑鍖归厤璁板綍") @PostMapping("/device") diff --git a/src/main/resources/mapper/ds1/InspectionMapper.xml b/src/main/resources/mapper/ds1/InspectionMapper.xml index ca55298..66fdc3c 100644 --- a/src/main/resources/mapper/ds1/InspectionMapper.xml +++ b/src/main/resources/mapper/ds1/InspectionMapper.xml @@ -38,6 +38,18 @@ <result column="I_Remark" property="iRemark" jdbcType="VARCHAR" /> </resultMap> + <sql id="Base_Column_List" > + <!-- + WARNING - @mbg.generated + --> + I_GUID, ST_GUID, S_GUID, I_ScenseName, I_ScenseAddress, I_IsTogether, I_EntourageT, + I_EntourageWX, I_Entourage, I_ExecutionStartTime, I_ExecutionEndTime, I_ProblemCount, + I_IsRechecked, I_RecheckCount, I_PromissedNum, I_ChangedNum, I_IsChanged, I_IsRvaluated, + I_isPromissed, I_PromissedTime, I_PromissedUserGUID, I_PromissedUserName, I_PromissedUserRealName, + I_PromissedWay, I_PromissedDeadline, I_PromissBookPath, I_SignPath, I_Extension1, + I_Extension2, I_Extension3, I_Remark + </sql> + <resultMap id="InspectionStatisticVo" type="cn.flightfeather.supervision.lightshare.vo.InspectionStatisticVo" > <id column="MOV_DisplayID" property="index" jdbcType="INTEGER" /> <result column="S_GUID" property="sceneId" jdbcType="VARCHAR" /> @@ -52,19 +64,25 @@ <result column="problems" property="problem" jdbcType="VARCHAR" /> </resultMap> - <sql id="Base_Column_List" > - <!-- - WARNING - @mbg.generated - --> - I_GUID, ST_GUID, S_GUID, I_ScenseName, I_ScenseAddress, I_IsTogether, I_EntourageT, - I_EntourageWX, I_Entourage, I_ExecutionStartTime, I_ExecutionEndTime, I_ProblemCount, - I_IsRechecked, I_RecheckCount, I_PromissedNum, I_ChangedNum, I_IsChanged, I_IsRvaluated, - I_isPromissed, I_PromissedTime, I_PromissedUserGUID, I_PromissedUserName, I_PromissedUserRealName, - I_PromissedWay, I_PromissedDeadline, I_PromissBookPath, I_SignPath, I_Extension1, - I_Extension2, I_Extension3, I_Remark - </sql> + <resultMap id="InspectionInfoVo" type="cn.flightfeather.supervision.lightshare.vo.InspectionInfoVo" > + <id column="inspectionId" property="inspectionId" /> + <result column="topTaskid" property="topTaskid"/> + <result column="topTaskName" property="topTaskName"/> + <result column="sceneId" property="sceneId"/> + <result column="sceneName" property="sceneName"/> + <result column="subtaskId" property="subtaskId"/> + <result column="inspected" property="inspected"/> + <result column="inspectionTime" property="inspectionTime"/> + <result column="inspectionTimes" property="inspectionTimes"/> + <result column="promised" property="promised"/> + <result column="changed" property="changed"/> + <result column="unChangedCount" property="unChangedCount"/> + <result column="changedCount" property="changedCount"/> + <result column="inspectionTimes" property="inspectionTimes"/> + <result column="promisedTime" property="promisedTime"/> + </resultMap> - <select id="getInspectionInfoByScene" parameterType="String" resultType="map"> + <select id="getInspectionInfoByScene" resultMap="InspectionInfoVo"> SELECT a.T_GUID AS topTaskId, a.T_Name AS topTaskName, @@ -72,11 +90,11 @@ b.ST_ScenseName AS sceneName, c.I_GUID AS inspectionId, b.ST_GUID AS subtaskId, - (CASE WHEN COUNT(DISTINCT c.I_GUID) > 0 THEN TRUE ELSE FALSE END) AS isInspected, + (CASE WHEN COUNT(DISTINCT c.I_GUID) > 0 THEN TRUE ELSE FALSE END) AS inspected, c.I_ExecutionStartTime AS inspectionTime, COUNT(DISTINCT c.I_GUID) AS inspectionTimes, - (CASE WHEN (SUM(CASE WHEN d.PL_Extension1 IS NULL THEN 0 ELSE 1 END)) > 0 THEN TRUE ELSE FALSE END) AS isPromised, - CASE WHEN SUM(d.PL_IsChanged) = COUNT(d.PL_IsChanged) THEN TRUE ELSE FALSE END AS isChanged, + (CASE WHEN (SUM(CASE WHEN d.PL_Extension1 IS NULL THEN 0 ELSE 1 END)) > 0 THEN TRUE ELSE FALSE END) AS promised, + CASE WHEN SUM(d.PL_IsChanged) = COUNT(d.PL_IsChanged) THEN TRUE ELSE FALSE END AS changed, COUNT(CASE WHEN d.PL_IsChanged = 0 AND d.PL_Extension3 = 'pass' THEN 1 ELSE NULL END) AS unChangedCount, COUNT(CASE WHEN d.PL_IsChanged = 1 THEN 1 ELSE NULL END) AS changedCount, d.PL_Extension1 AS promisedTime diff --git a/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml b/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml index 4e67a07..0c2f041 100644 --- a/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml +++ b/src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml @@ -8,28 +8,39 @@ <id column="MOV_ID" property="movId" jdbcType="VARCHAR" /> <result column="T_ID" property="tId" jdbcType="VARCHAR" /> <result column="S_GUID" property="sGuid" jdbcType="VARCHAR" /> - <result column="MOV_SenseName" property="movSensename" jdbcType="VARCHAR" /> - <result column="MOV_TaskTypeID" property="movTasktypeid" jdbcType="TINYINT" /> - <result column="MOV_TaskType" property="movTasktype" jdbcType="VARCHAR" /> - <result column="MOV_MonitorNum" property="movMonitornum" jdbcType="INTEGER" /> - <result column="MOV_Suitable" property="movSuitable" jdbcType="BIT" /> - <result column="MOV_DisplayID" property="movDisplayid" jdbcType="INTEGER" /> - <result column="MOV_Year" property="movYear" jdbcType="INTEGER" /> - <result column="MOV_Month" property="movMonth" jdbcType="INTEGER" /> - <result column="MOV_Day" property="movDay" jdbcType="INTEGER" /> - <result column="MOV_ISCP" property="movIscp" jdbcType="BIT" /> - <result column="MOV_CustomPeriod" property="movCustomperiod" jdbcType="VARCHAR" /> - <result column="MOV_Extension1" property="movExtension1" jdbcType="VARCHAR" /> - <result column="MOV_Extension2" property="movExtension2" jdbcType="VARCHAR" /> - <result column="MOV_Extension3" property="movExtension3" jdbcType="VARCHAR" /> - <result column="MOV_Remark" property="movRemark" jdbcType="VARCHAR" /> + <result column="MOV_SenseName" property="sensename" jdbcType="VARCHAR" /> + <result column="MOV_TaskTypeID" property="tasktypeid" jdbcType="TINYINT" /> + <result column="MOV_TaskType" property="tasktype" jdbcType="VARCHAR" /> + <result column="MOV_MonitorNum" property="monitornum" jdbcType="INTEGER" /> + <result column="MOV_Suitable" property="suitable" jdbcType="BIT" /> + <result column="MOV_DisplayID" property="displayid" jdbcType="INTEGER" /> + <result column="MOV_Year" property="year" jdbcType="INTEGER" /> + <result column="MOV_Month" property="month" jdbcType="INTEGER" /> + <result column="MOV_Day" property="day" jdbcType="INTEGER" /> + <result column="MOV_ISCP" property="iscp" jdbcType="BIT" /> + <result column="MOV_CustomPeriod" property="customperiod" jdbcType="VARCHAR" /> + <result column="MOV_Extension1" property="extension1" jdbcType="VARCHAR" /> + <result column="MOV_Extension2" property="extension2" jdbcType="VARCHAR" /> + <result column="MOV_Extension3" property="extension3" jdbcType="VARCHAR" /> + <result column="MOV_Remark" property="remark" jdbcType="VARCHAR" /> </resultMap> <sql id="Base_Column_List" > <!-- WARNING - @mbg.generated --> - MOV_ID, T_ID, S_GUID, MOV_SenseName, MOV_TaskTypeID, MOV_TaskType, MOV_MonitorNum, - MOV_Suitable, MOV_DisplayID, MOV_Year, MOV_Month, MOV_Day, MOV_ISCP, MOV_CustomPeriod, + MOV_ID, T_ID, S_GUID, MOV_SenseName, MOV_TaskTypeID, MOV_TaskType, MOV_MonitorNum, + MOV_Suitable, MOV_DisplayID, MOV_Year, MOV_Month, MOV_Day, MOV_ISCP, MOV_CustomPeriod, MOV_Extension1, MOV_Extension2, MOV_Extension3, MOV_Remark </sql> + + <select id="findMonitorListByScene" resultMap="BaseResultMap"> + select + a.* + from sm_t_monitorobjectversion as a + left join sm_t_scense as b on a.S_GUID = b.S_GUID + where T_ID = #{taskId} + <if test="sceneTypeId != null"> + and b.S_TypeID = #{sceneTypeId} + </if> + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ds1/ProblemlistMapper.xml b/src/main/resources/mapper/ds1/ProblemlistMapper.xml index ae94736..857d461 100644 --- a/src/main/resources/mapper/ds1/ProblemlistMapper.xml +++ b/src/main/resources/mapper/ds1/ProblemlistMapper.xml @@ -1,197 +1,258 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > -<mapper namespace="cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper" > - <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Problemlist" > - <!-- - WARNING - @mbg.generated - --> - <id column="PL_GUID" property="guid" jdbcType="VARCHAR" /> - <result column="I_GUID" property="iguid" jdbcType="VARCHAR" /> - <result column="ST_GUID" property="stguid" jdbcType="VARCHAR" /> - <result column="S_GUID" property="sguid" jdbcType="VARCHAR" /> - <result column="PL_SenseName" property="sensename" jdbcType="VARCHAR" /> - <result column="PL_SenseAddress" property="senseaddress" jdbcType="VARCHAR" /> - <result column="PT_GUID" property="ptguid" jdbcType="VARCHAR" /> - <result column="PL_ProblemName" property="problemname" jdbcType="VARCHAR" /> - <result column="PL_Longitude" property="longitude" jdbcType="DECIMAL" /> - <result column="PL_Latitude" property="latitude" jdbcType="DECIMAL" /> - <result column="PL_LocationID" property="locationid" jdbcType="TINYINT" /> - <result column="PL_Location" property="location" jdbcType="VARCHAR" /> - <result column="PL_Time" property="time" jdbcType="TIMESTAMP" /> - <result column="PL_IsRechecked" property="isrechecked" jdbcType="BIT" /> - <result column="PL_RecheckTime" property="rechecktime" jdbcType="TIMESTAMP" /> - <result column="PL_RecheckUserGUID" property="recheckuserguid" jdbcType="VARCHAR" /> - <result column="PL_RecheckUserName" property="recheckusername" jdbcType="VARCHAR" /> - <result column="PL_RecheckUserRealName" property="recheckuserrealname" jdbcType="VARCHAR" /> - <result column="PL_RecheckDescription" property="recheckdescription" jdbcType="VARCHAR" /> - <result column="PL_RecheckResultID" property="recheckresultid" jdbcType="BIT" /> - <result column="PL_RecheckResult" property="recheckresult" jdbcType="VARCHAR" /> - <result column="PL_IsChanged" property="ischanged" jdbcType="BIT" /> - <result column="PL_ChangeCatalog" property="changecatalog" jdbcType="VARCHAR" /> - <result column="PL_ChangedTime" property="changedtime" jdbcType="TIMESTAMP" /> - <result column="PL_ChangedResult" property="changedresult" jdbcType="VARCHAR" /> - <result column="PL_Advise" property="advise" jdbcType="VARCHAR" /> - <result column="PL_Extension1" property="extension1" jdbcType="VARCHAR" /> - <result column="PL_Extension2" property="extension2" jdbcType="VARCHAR" /> - <result column="PL_Extension3" property="extension3" jdbcType="VARCHAR" /> - <result column="PL_Remark" property="remark" jdbcType="VARCHAR" /> - </resultMap> - - <resultMap id="StatisticsVoMap" type="cn.flightfeather.supervision.lightshare.vo.StatisticsVo"> - <id property="name" column="T_Name"/> - <result property="startTime" column="startTime"/> - <result property="endTime" column="endTime"/> - <result property="count" column="count1"/> - </resultMap> - <sql id="Base_Column_List" > - <!-- - WARNING - @mbg.generated - --> - PL_GUID, I_GUID, ST_GUID, S_GUID, PL_SenseName, PL_SenseAddress, PT_GUID, PL_ProblemName, - PL_Longitude, PL_Latitude, PL_LocationID, PL_Location, PL_Time, PL_IsRechecked, PL_RecheckTime, - PL_RecheckUserGUID, PL_RecheckUserName, PL_RecheckUserRealName, PL_RecheckDescription, - PL_RecheckResultID, PL_RecheckResult, PL_IsChanged, PL_ChangeCatalog, PL_ChangedTime, - PL_ChangedResult, PL_Advise, PL_Extension1, PL_Extension2, PL_Extension3, PL_Remark - </sql> +<mapper namespace="cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper"> + <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Problemlist"> + <!-- + WARNING - @mbg.generated + --> + <id column="PL_GUID" property="guid" jdbcType="VARCHAR"/> + <result column="I_GUID" property="iguid" jdbcType="VARCHAR"/> + <result column="ST_GUID" property="stguid" jdbcType="VARCHAR"/> + <result column="S_GUID" property="sguid" jdbcType="VARCHAR"/> + <result column="PL_SenseName" property="sensename" jdbcType="VARCHAR"/> + <result column="PL_SenseAddress" property="senseaddress" jdbcType="VARCHAR"/> + <result column="PT_GUID" property="ptguid" jdbcType="VARCHAR"/> + <result column="PL_ProblemName" property="problemname" jdbcType="VARCHAR"/> + <result column="PL_Longitude" property="longitude" jdbcType="DECIMAL"/> + <result column="PL_Latitude" property="latitude" jdbcType="DECIMAL"/> + <result column="PL_LocationID" property="locationid" jdbcType="TINYINT"/> + <result column="PL_Location" property="location" jdbcType="VARCHAR"/> + <result column="PL_Time" property="time" jdbcType="TIMESTAMP"/> + <result column="PL_IsRechecked" property="isrechecked" jdbcType="BIT"/> + <result column="PL_RecheckTime" property="rechecktime" jdbcType="TIMESTAMP"/> + <result column="PL_RecheckUserGUID" property="recheckuserguid" jdbcType="VARCHAR"/> + <result column="PL_RecheckUserName" property="recheckusername" jdbcType="VARCHAR"/> + <result column="PL_RecheckUserRealName" property="recheckuserrealname" jdbcType="VARCHAR"/> + <result column="PL_RecheckDescription" property="recheckdescription" jdbcType="VARCHAR"/> + <result column="PL_RecheckResultID" property="recheckresultid" jdbcType="BIT"/> + <result column="PL_RecheckResult" property="recheckresult" jdbcType="VARCHAR"/> + <result column="PL_IsChanged" property="ischanged" jdbcType="BIT"/> + <result column="PL_ChangeCatalog" property="changecatalog" jdbcType="VARCHAR"/> + <result column="PL_ChangedTime" property="changedtime" jdbcType="TIMESTAMP"/> + <result column="PL_ChangedResult" property="changedresult" jdbcType="VARCHAR"/> + <result column="PL_Advise" property="advise" jdbcType="VARCHAR"/> + <result column="PL_Extension1" property="extension1" jdbcType="VARCHAR"/> + <result column="PL_Extension2" property="extension2" jdbcType="VARCHAR"/> + <result column="PL_Extension3" property="extension3" jdbcType="VARCHAR"/> + <result column="PL_Remark" property="remark" jdbcType="VARCHAR"/> + </resultMap> + <sql id="Base_Column_List"> + <!-- + WARNING - @mbg.generated + --> + PL_GUID, I_GUID, ST_GUID, S_GUID, PL_SenseName, PL_SenseAddress, PT_GUID, PL_ProblemName, + PL_Longitude, PL_Latitude, PL_LocationID, PL_Location, PL_Time, PL_IsRechecked, PL_RecheckTime, + PL_RecheckUserGUID, PL_RecheckUserName, PL_RecheckUserRealName, PL_RecheckDescription, + PL_RecheckResultID, PL_RecheckResult, PL_IsChanged, PL_ChangeCatalog, PL_ChangedTime, + PL_ChangedResult, PL_Advise, PL_Extension1, PL_Extension2, PL_Extension3, PL_Remark + </sql> - <!--<select id="getStatisticalResult" parameterType="String" resultMap="StatisticsVoMap">--> - <select id="getStatisticalResult" parameterType="String" resultType="map"> - SELECT + <resultMap id="StatisticsVoMap" type="cn.flightfeather.supervision.lightshare.vo.StatisticsVo"> + <result property="name" column="name"/> + <result property="startTime" column="startTime"/> + <result property="endTime" column="endTime"/> + <result property="count" column="count"/> + <result property="changeCount" column="changeCount"/> + </resultMap> + <resultMap id="SceneProblemSummary" type="cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary"> + <id property="sceneId" column="sceneId"/> + <result property="proNum" column="proNum"/> + <result property="changeNum" column="changeNum"/> + <result property="changePer" column="changePer"/> + <association property="scene" resultMap="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.BaseResultMap" /> +<!-- <collection property="subtasks" ofType="cn.flightfeather.supervision.domain.ds1.entity.Subtask"--> +<!-- resultMap="cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper.BaseResultMap" />--> + </resultMap> + + <select id="getStatisticalResult" parameterType="String" resultMap="StatisticsVoMap"> + SELECT b.PT_TypeName as name, COUNT(b.PT_TypeName) as count, COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount - FROM + FROM im_t_problemlist AS a - LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID - LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID - WHERE - a.ST_GUID IN ( - SELECT - d.ST_GUID - FROM - tm_t_subtask AS d LEFT JOIN tm_t_task AS e ON d.T_GUID = e.T_GUID - WHERE - e.T_LevelNum = '2' - AND e.T_StartTime <= #{param2} - AND e.T_EndTime >= #{param3} - AND e.T_DistrictCode = #{param1} - ) - AND f.S_TypeID = #{param4} - GROUP BY + LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID + LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID + LEFT JOIN tm_t_subtask AS c ON a.ST_GUID = c.ST_GUID + <where> +<!-- a.ST_GUID IN (--> +<!-- SELECT--> +<!-- d.ST_GUID--> +<!-- FROM--> +<!-- tm_t_subtask AS d LEFT JOIN tm_t_task AS e ON d.T_GUID = e.T_GUID--> +<!-- WHERE--> +<!-- e.T_LevelNum = '2'--> +<!-- <if test="startTime != null">--> +<!-- AND e.T_StartTime <= #{startTime}--> +<!-- </if>--> +<!-- <if test="endTime != null">--> +<!-- AND e.T_EndTime >= #{endTime}--> +<!-- </if>--> +<!-- <if test="districtCode != null">--> +<!-- AND e.T_DistrictCode = #{districtCode}--> +<!-- </if>--> +<!-- )--> + <if test="startTime != null"> + AND c.ST_PlanStartTime >= #{startTime} + </if> + <if test="endTime != null"> + AND c.ST_PlanStartTime <= #{endTime} + </if> + <if test="districtCode != null"> + AND f.S_DistrictCode = #{districtCode} + </if> + <if test="sceneType != null"> + AND f.S_TypeID = #{sceneType} + </if> + <if test="sceneId != null"> + AND a.S_GUID = #{sceneId} + </if> + </where> + GROUP BY b.PT_TypeName - ORDER BY + ORDER BY COUNT(b.PT_TypeName) DESC - </select> - <!--select DISTINCT T_Name as name, count(*) as count from tm_t_task where T_LevelNum = 2--> + </select> <!--鏍规嵁椤跺眰浠诲姟id鍜屽満鏅被鍨媔d鑾峰彇闂鍒嗙被鎯呭喌锛岀粨鏋滃悓getStatisticalResult--> <select id="getStatisticalResultById" parameterType="String" resultType="map"> SELECT - b.PT_TypeName AS name, - COUNT(b.PT_TypeName) AS count, - COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount + b.PT_TypeName AS name, + COUNT(b.PT_TypeName) AS count, + COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount FROM - im_t_problemlist AS a + im_t_problemlist AS a LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID LEFT JOIN tm_t_subtask AS c ON a.ST_GUID = c.ST_GUID WHERE - c.T_GUID = #{param1} + c.T_GUID = #{param1} AND f.S_TypeID = #{param2} GROUP BY - b.PT_TypeName + b.PT_TypeName ORDER BY - COUNT(b.PT_TypeName) DESC + COUNT(b.PT_TypeName) DESC </select> - - <select id="getChangeResult" parameterType="String" resultType="map"> - SELECT - a.S_GUID as id, - a.PL_SenseName as name, - f.S_TypeID as type, - COUNT(a.PL_GUID) as problemCount, - COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount - FROM - im_t_problemlist AS a - LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID - LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID - LEFT JOIN sm_t_monitorobjectversion as g ON a.S_GUID = g.S_GUID - WHERE - a.ST_GUID IN ( - SELECT - ST_GUID - FROM - tm_t_subtask - WHERE - T_GUID = #{param1} - ) - AND f.S_TypeID = #{param2} - AND g.T_ID = #{param1} - GROUP BY - id - ORDER BY - problemCount DESC + SELECT + a.S_GUID as id, + a.PL_SenseName as name, + f.S_TypeID as type, + COUNT(a.PL_GUID) as problemCount, + COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount + FROM + im_t_problemlist AS a + LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID + LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID + LEFT JOIN sm_t_monitorobjectversion as g ON a.S_GUID = g.S_GUID + WHERE + a.ST_GUID IN ( + SELECT + ST_GUID + FROM + tm_t_subtask + WHERE + T_GUID = #{param1} + ) + AND f.S_TypeID = #{param2} + AND g.T_ID = #{param1} + GROUP BY + id + ORDER BY + problemCount DESC </select> <select id="getScoreResult" resultType="map" parameterType="String"> SELECT - b.ST_name as name, - E_ResultScoreBef as scoreBef, - E_ResultScoreAft as scoreAft + b.ST_name as name, + E_ResultScoreBef as scoreBef, + E_ResultScoreAft as scoreAft FROM - ea_t_evaluation AS a + ea_t_evaluation AS a RIGHT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID WHERE - b.T_GUID = #{param1} + b.T_GUID = #{param1} AND a.E_ScenseTypeID = #{param2} </select> - - <select id="selectSE" resultType="string" parameterType="String"> - ${_parameter} - </select> - <select id="getProblemByScene" resultMap="BaseResultMap" parameterType="String"> SELECT - a.* + a.* FROM - im_t_problemlist AS a + im_t_problemlist AS a LEFT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID WHERE - a.S_GUID = #{param1} + a.S_GUID = #{param1} AND b.T_GUID = #{param2} - </select> - <select id="findMonthProblemById" resultType="map" > + </select> + <select id="findMonthProblemById" resultType="map"> SELECT - b.S_TownCode as towncode, - b.S_TownName as townname, - b.S_TypeID as scenetype, - b.S_Type as scenetypename, - COUNT(DISTINCT a.S_GUID) as totalscenecount, - COUNT(DISTINCT d.S_GUID) as problemscenes, - COUNT(d.PL_GUID) as totalproblems, - SUM(CASE WHEN d.PL_IsChanged = 1 THEN 1 ELSE 0 END) as changedproblems + b.S_TownCode as towncode, + b.S_TownName as townname, + b.S_TypeID as scenetype, + b.S_Type as scenetypename, + COUNT(DISTINCT a.S_GUID) as totalscenecount, + COUNT(DISTINCT d.S_GUID) as problemscenes, + COUNT(d.PL_GUID) as totalproblems, + SUM(CASE WHEN d.PL_IsChanged = 1 THEN 1 ELSE 0 END) as changedproblems FROM - sm_t_monitorobjectversion AS a + sm_t_monitorobjectversion AS a LEFT JOIN sm_t_scense AS b ON a.S_GUID = b.S_GUID LEFT JOIN tm_t_subtask AS c ON a.T_ID = c.T_GUID AND b.S_GUID = c.ST_ScenseID LEFT JOIN im_t_problemlist AS d ON c.ST_GUID = d.ST_GUID WHERE - a.T_ID = #{param1} + a.T_ID = #{param1} <if test="param2 !=null and param2 !=''"> AND S_TypeID = #{param2} </if> GROUP BY - b.S_TownCode + b.S_TownCode </select> - <select id="findUnchangedCount" resultType="int" parameterType="String"> SELECT - SUM(CASE WHEN a.PL_IsChanged = 0 THEN 1 ELSE 0 END) as unChanged + SUM(CASE WHEN a.PL_IsChanged = 0 THEN 1 ELSE 0 END) as unChanged FROM - im_t_problemlist AS a - LEFT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID + im_t_problemlist AS a + LEFT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID WHERE - b.TS_GUID = #{param1} + b.TS_GUID = #{param1} GROUP BY - b.ST_GUID + b.ST_GUID + </select> + <select id="getSceneProSummary" resultMap="SceneProblemSummary"> + SELECT + IF(proNum = 0, 1, changeNum/proNum) AS changePer, + t_p.* + FROM ( + SELECT + b.S_GUID AS sceneId, + SUM(d.PL_GUID is NOT null) AS proNum, + SUM(d.PL_IsChanged = TRUE) AS changeNum, + b.* + FROM + sm_t_scense AS b + LEFT JOIN tm_t_subtask AS a ON a.ST_ScenseID = b.S_GUID + LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID + WHERE + a.T_GUID = #{topTaskId} + <if test="sceneTypeId != null"> + and b.S_TypeID = #{sceneTypeId} + </if> + GROUP BY + b.S_GUID + ) as t_p + <if test="sortBy == 'pro'"> + <if test="sort == 'asc'"> + ORDER BY proNum asc, changeNum desc + </if> + <if test="sort == 'desc'"> + ORDER BY proNum desc, changeNum asc + </if> + </if> + <if test="sortBy == 'changePer'"> + <if test="sort == 'asc'"> + ORDER BY changePer asc, proNum desc + </if> + <if test="sort == 'desc'"> + ORDER BY changePer desc, proNum asc + </if> + </if> </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ds1/SubtaskMapper.xml b/src/main/resources/mapper/ds1/SubtaskMapper.xml index 1df171d..e3ddd41 100644 --- a/src/main/resources/mapper/ds1/SubtaskMapper.xml +++ b/src/main/resources/mapper/ds1/SubtaskMapper.xml @@ -153,6 +153,7 @@ <result column="ST_GUID" property="stGuid" jdbcType="VARCHAR" /> <result column="ST_name" property="stName" jdbcType="VARCHAR" /> <result column="ST_PlanStartTime" property="stPlanTime" jdbcType="TIMESTAMP" /> + <result column="ST_Status" property="stStatus" jdbcType="VARCHAR" /> <result column="S_GUID" property="sceneId" jdbcType="VARCHAR" /> <result column="S_Name" property="sceneName" jdbcType="VARCHAR" /> <result column="S_Type" property="sceneType" jdbcType="VARCHAR" /> @@ -279,6 +280,7 @@ a.ST_GUID, a.ST_name, a.ST_PlanStartTime, + a.ST_Status, b.S_GUID, b.S_Name, b.S_Type, @@ -303,4 +305,51 @@ GROUP BY a.ST_GUID </select> + + <select id="getSummaryByScene" resultMap="SubTaskSummary"> + SELECT + a.ST_GUID, + a.ST_name, + a.ST_PlanStartTime, + a.ST_Status, + b.S_GUID, + b.S_Name, + b.S_Type, + c.I_GUID, + SUM(d.PL_GUID is NOT null) AS proNum, + SUM(d.PL_IsChanged = TRUE) AS changeNum, + SUM(d.PL_Extension3 != 'unCheck') AS proCheckedNum, + SUM( + d.PL_Extension3 = 'change_pass' || d.PL_Extension3 = 'change_fail' + ) AS changeCheckedNum + + FROM + tm_t_subtask AS a + LEFT JOIN sm_t_scense AS b ON a.ST_ScenseID = b.S_GUID + LEFT JOIN im_t_inspection AS c ON a.ST_GUID = c.ST_GUID + LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID + WHERE + a.ST_ScenseID = #{sceneId} + <if test="startTime != null"> + and a.ST_PlanStartTime BETWEEN #{startTime} AND #{endTime} + </if> + GROUP BY + a.ST_GUID + ORDER BY a.ST_PlanStartTime DESC + </select> + + <select id="findSubTasksByProType" resultMap="BaseResultMap"> + SELECT + a.* + FROM + tm_t_subtask AS a + LEFT JOIN im_t_problemlist AS b ON a.ST_GUID = b.ST_GUID + LEFT JOIN sm_t_problemtype AS c ON b.PT_GUID = c.PT_GUID + LEFT JOIN sm_t_scense AS d ON a.ST_ScenseID = d.S_GUID + WHERE + a.T_GUID = #{topTaskId} + AND c.PT_TypeName = #{proType} + AND d.S_TypeID = #{sceneTypeId} + GROUP BY a.ST_GUID + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ds2/BaseInfoMapper.xml b/src/main/resources/mapper/ds2/BaseInfoMapper.xml index 5e7f8b8..d6a90be 100644 --- a/src/main/resources/mapper/ds2/BaseInfoMapper.xml +++ b/src/main/resources/mapper/ds2/BaseInfoMapper.xml @@ -1,32 +1,45 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="cn.flightfeather.supervision.domain.ds2.mapper.BaseInfoMapper" > - <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds2.entity.BaseInfo" > + <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds2.entity.BaseInfo"> <!-- WARNING - @mbg.generated --> - <id column="BI_GUID" property="biGuid" jdbcType="VARCHAR" /> - <result column="BI_Name" property="biName" jdbcType="VARCHAR" /> - <result column="CI_GUID" property="ciGuid" jdbcType="VARCHAR" /> - <result column="CI_Name" property="ciName" jdbcType="VARCHAR" /> - <result column="BI_Management_Company_Id" property="biManagementCompanyId" jdbcType="VARCHAR" /> - <result column="BI_Management_Company" property="biManagementCompany" jdbcType="VARCHAR" /> - <result column="BI_Contact" property="biContact" jdbcType="VARCHAR" /> - <result column="BI_Telephone" property="biTelephone" jdbcType="VARCHAR" /> - <result column="BI_Address" property="biAddress" jdbcType="VARCHAR" /> - <result column="BI_Create_Time" property="biCreateTime" jdbcType="TIMESTAMP" /> - <result column="BI_Update_Time" property="biUpdateTime" jdbcType="TIMESTAMP" /> - <result column="BI_Extension1" property="biExtension1" jdbcType="VARCHAR" /> - <result column="BI_Extension2" property="biExtension2" jdbcType="VARCHAR" /> - <result column="BI_Extension3" property="biExtension3" jdbcType="VARCHAR" /> - <result column="BI_Remark" property="biRemark" jdbcType="VARCHAR" /> + <id column="BI_GUID" jdbcType="VARCHAR" property="biGuid"/> + <result column="BI_Name" jdbcType="VARCHAR" property="biName"/> + <result column="BI_Nick_Name" jdbcType="VARCHAR" property="biNickName"/> + <result column="CI_GUID" jdbcType="VARCHAR" property="ciGuid"/> + <result column="CI_Name" jdbcType="VARCHAR" property="ciName"/> + <result column="BI_Province_Code" jdbcType="VARCHAR" property="biProvinceCode"/> + <result column="BI_Province_Name" jdbcType="VARCHAR" property="biProvinceName"/> + <result column="BI_City_Code" jdbcType="VARCHAR" property="biCityCode"/> + <result column="BI_City_Name" jdbcType="VARCHAR" property="biCityName"/> + <result column="BI_District_Code" jdbcType="VARCHAR" property="biDistrictCode"/> + <result column="BI_District_Name" jdbcType="VARCHAR" property="biDistrictName"/> + <result column="BI_Town_Code" jdbcType="VARCHAR" property="biTownCode"/> + <result column="BI_Town_Name" jdbcType="VARCHAR" property="biTownName"/> + <result column="BI_Area_Code" jdbcType="VARCHAR" property="biAreaCode"/> + <result column="BI_Area" jdbcType="VARCHAR" property="biArea"/> + <result column="BI_Management_Company_Id" jdbcType="VARCHAR" property="biManagementCompanyId"/> + <result column="BI_Management_Company" jdbcType="VARCHAR" property="biManagementCompany"/> + <result column="BI_Contact" jdbcType="VARCHAR" property="biContact"/> + <result column="BI_Telephone" jdbcType="VARCHAR" property="biTelephone"/> + <result column="BI_Address" jdbcType="VARCHAR" property="biAddress"/> + <result column="BI_Create_Time" jdbcType="TIMESTAMP" property="biCreateTime"/> + <result column="BI_Update_Time" jdbcType="TIMESTAMP" property="biUpdateTime"/> + <result column="BI_Extension1" jdbcType="VARCHAR" property="biExtension1"/> + <result column="BI_Extension2" jdbcType="VARCHAR" property="biExtension2"/> + <result column="BI_Extension3" jdbcType="VARCHAR" property="biExtension3"/> + <result column="BI_Remark" jdbcType="VARCHAR" property="biRemark"/> </resultMap> - <sql id="Base_Column_List" > + <sql id="Base_Column_List"> <!-- WARNING - @mbg.generated --> - BI_GUID, BI_Name, CI_GUID, CI_Name, BI_Management_Company_Id, BI_Management_Company, - BI_Contact, BI_Telephone, BI_Address, BI_Create_Time, BI_Update_Time, BI_Extension1, - BI_Extension2, BI_Extension3, BI_Remark + BI_GUID, BI_Name, BI_Nick_Name, CI_GUID, CI_Name, BI_Province_Code, BI_Province_Name, + BI_City_Code, BI_City_Name, BI_District_Code, BI_District_Name, BI_Town_Code, BI_Town_Name, + BI_Area_Code, BI_Area, BI_Management_Company_Id, BI_Management_Company, BI_Contact, + BI_Telephone, BI_Address, BI_Create_Time, BI_Update_Time, BI_Extension1, BI_Extension2, + BI_Extension3, BI_Remark </sql> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/ds3/JSDustSiteInfoMapper.xml b/src/main/resources/mapper/ds3/JSDustSiteInfoMapper.xml new file mode 100644 index 0000000..5acf8f7 --- /dev/null +++ b/src/main/resources/mapper/ds3/JSDustSiteInfoMapper.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteInfoMapper"> + <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteInfo"> + <!-- + WARNING - @mbg.generated + --> + <id column="id" jdbcType="INTEGER" property="id" /> + <result column="mn_code" jdbcType="VARCHAR" property="mnCode" /> + <result column="address" jdbcType="VARCHAR" property="address" /> + <result column="name" jdbcType="VARCHAR" property="name" /> + <result column="code" jdbcType="VARCHAR" property="code" /> + <result column="begin_date" jdbcType="TIMESTAMP" property="beginDate" /> + <result column="duty_company" jdbcType="VARCHAR" property="dutyCompany" /> + <result column="duty_company_id" jdbcType="VARCHAR" property="dutyCompanyId" /> + <result column="end_date" jdbcType="TIMESTAMP" property="endDate" /> + <result column="engineering_stage" jdbcType="VARCHAR" property="engineeringStage" /> + <result column="group_id" jdbcType="VARCHAR" property="groupId" /> + <result column="group_name" jdbcType="VARCHAR" property="groupName" /> + <result column="is_online" jdbcType="VARCHAR" property="isOnline" /> + <result column="is_trouble" jdbcType="VARCHAR" property="isTrouble" /> + <result column="jhpt_update_time" jdbcType="VARCHAR" property="jhptUpdateTime" /> + <result column="kindex" jdbcType="VARCHAR" property="kindex" /> + <result column="latitude" jdbcType="VARCHAR" property="latitude" /> + <result column="linkman" jdbcType="VARCHAR" property="linkman" /> + <result column="longitude" jdbcType="VARCHAR" property="longitude" /> + <result column="phone" jdbcType="VARCHAR" property="phone" /> + <result column="province" jdbcType="VARCHAR" property="province" /> + <result column="ring_id" jdbcType="VARCHAR" property="ringId" /> + <result column="ring_name" jdbcType="VARCHAR" property="ringName" /> + <result column="type_id" jdbcType="VARCHAR" property="typeId" /> + <result column="typename" jdbcType="VARCHAR" property="typename" /> + <result column="stop_time" jdbcType="TIMESTAMP" property="stopTime" /> + <result column="active" jdbcType="VARCHAR" property="active" /> + <result column="trouble_num" jdbcType="INTEGER" property="troubleNum" /> + <result column="insert_time" jdbcType="TIMESTAMP" property="insertTime" /> + <result column="stage_begin_date" jdbcType="TIMESTAMP" property="stageBeginDate" /> + <result column="tsp" jdbcType="DOUBLE" property="tsp" /> + <result column="union_type_id" jdbcType="VARCHAR" property="unionTypeId" /> + <result column="wall_height" jdbcType="VARCHAR" property="wallHeight" /> + <result column="ywsj_date" jdbcType="TIMESTAMP" property="ywsjDate" /> + <result column="build_area" jdbcType="VARCHAR" property="buildArea" /> + <result column="construction_unit" jdbcType="VARCHAR" property="constructionUnit" /> + <result column="control_level" jdbcType="VARCHAR" property="controlLevel" /> + <result column="developers" jdbcType="VARCHAR" property="developers" /> + <result column="do_time" jdbcType="TIMESTAMP" property="doTime" /> + <result column="has_monitor" jdbcType="VARCHAR" property="hasMonitor" /> + <result column="data_time" jdbcType="TIMESTAMP" property="dataTime" /> + <result column="engineering_stage_code" jdbcType="VARCHAR" property="engineeringStageCode" /> + <result column="equipment_code" jdbcType="VARCHAR" property="equipmentCode" /> + <result column="floor_area" jdbcType="VARCHAR" property="floorArea" /> + <result column="jhpt_delete" jdbcType="VARCHAR" property="jhptDelete" /> + <result column="noise_region" jdbcType="VARCHAR" property="noiseRegion" /> + <result column="responsible" jdbcType="VARCHAR" property="responsible" /> + </resultMap> + <sql id="Base_Column_List"> + <!-- + WARNING - @mbg.generated + --> + id, mn_code, address, name, code, begin_date, duty_company, duty_company_id, end_date, + engineering_stage, group_id, group_name, is_online, is_trouble, jhpt_update_time, + kindex, latitude, linkman, longitude, phone, province, ring_id, ring_name, type_id, + typename, stop_time, active, trouble_num, insert_time, stage_begin_date, tsp, union_type_id, + wall_height, ywsj_date, build_area, construction_unit, control_level, developers, + do_time, has_monitor, data_time, engineering_stage_code, equipment_code, floor_area, + jhpt_delete, noise_region, responsible + </sql> +</mapper> \ No newline at end of file diff --git a/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt b/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt index 4b2f0e0..f0e9fa0 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt @@ -2,6 +2,7 @@ import org.junit.Test import java.util.* +import kotlin.properties.Delegates class CommonTest { @@ -12,4 +13,10 @@ println(fName) println(dName) } + + @Test + fun annotationTest() { + "name" + "1" + mapOf<String, String>("name" to "1") + } } \ No newline at end of file diff --git a/src/test/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMapTest.kt b/src/test/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMapTest.kt new file mode 100644 index 0000000..90d9c9d --- /dev/null +++ b/src/test/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMapTest.kt @@ -0,0 +1,57 @@ +package cn.flightfeather.supervision.business.autooutput.dataanalysis + +import cn.flightfeather.supervision.lightshare.vo.AreaVo +import org.junit.Test +import org.junit.jupiter.api.extension.ExtendWith +import org.junit.runner.RunWith +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.test.context.junit.jupiter.SpringExtension +import org.springframework.test.context.junit4.SpringRunner +import java.time.LocalDateTime + +@RunWith(SpringRunner::class) +@ExtendWith(SpringExtension::class) +@SpringBootTest +class AopDataDeviceMapTest { + + @Autowired + lateinit var aopDataDeviceMap: AopDataDeviceMap + + @Test + fun outputMapSet() { + // 閲戝北宸ュ湴 + val areaVo = AreaVo().apply { + provincecode = "31" + provincename = "涓婃捣甯�" + citycode = "3100" + cityname = "涓婃捣甯�" + districtcode = "310116" + districtname = "閲戝北鍖�" + starttime = LocalDateTime.of(2024, 1, 1, 0, 0, 0) + scensetypeid = "1" + sourceType = 2 + } + aopDataDeviceMap.outputMapSet(areaVo) + + // 閲戝北鐮佸ご + areaVo.apply { + scensetypeid = "2" + } + aopDataDeviceMap.outputMapSet(areaVo) + + // 閲戝北鎼呮媽绔� + areaVo.apply { + scensetypeid = "3" + } + aopDataDeviceMap.outputMapSet(areaVo) + + // 闈欏畨宸ュ湴 + areaVo.apply { + districtcode = "310106" + districtname = "闈欏畨鍖�" + scensetypeid = "1" + } + aopDataDeviceMap.outputMapSet(areaVo) + } +} \ No newline at end of file diff --git a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt index c9a92e9..5d7dfde 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt @@ -2,6 +2,8 @@ import cn.flightfeather.supervision.SupervisionApplication import cn.flightfeather.supervision.domain.ds1.entity.Scense +import cn.flightfeather.supervision.domain.ds1.repository.SceneRep +import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep import cn.flightfeather.supervision.lightshare.service.ScenseService import org.junit.Test import org.junit.runner.RunWith @@ -15,6 +17,12 @@ @Autowired lateinit var scenseService: ScenseService + + @Autowired + lateinit var sceneRep: SceneRep + + @Autowired + lateinit var userInfoSVRep: UserInfoSVRep @Test fun getSceneType() { @@ -33,4 +41,34 @@ val r = scenseService.search(s) println(r) } + + @Test + fun createTZUserInfo() { + val sId = listOf("lMqvVUjDrcAfb5l9", + "iRn69RgMMJVCnvVy", + "BHkeYXhWBIN7dpm4", + "moT0gClykLAgTedp", + "9tNfxmcUBspynqOB", + "dXcHOIqFvFRSeKhg", + "XNoilpfLZESw5DP0", + "f4fOMCcBAtrmqDO7", + "GyOZyyiouI15lfdZ", + "k2FSexhq1Yj3GXAA", + "K7FTWRkLFrfenq4G", + "0nPo3EoR7K0JHq6d", + "YHYxGucNfjkMjSLI", + "ppzbVvgaqTbHLMFL", + "eJcnnfg6joXLUlYN", + "dSuH4hr66NAfflti", + "Ba8jWakmIYexMxvK", + "jYRzLMfB81qfOaec", + "L5ABNgmzgqDLGWnw", + "yYy88ocNnnZDreIK", + ) + sId.forEach { + val scene = sceneRep.findScene(sceneId = it) ?: return@forEach + val userInfo = userInfoSVRep.findUser(it) ?: return@forEach + scenseService.createTZUserInfo(userInfo, scene) + } + } } \ No newline at end of file -- Gitblit v1.9.3