From 4e20a1aaaba1bb843820fca844c20055a33febce Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 19 七月 2024 17:39:19 +0800 Subject: [PATCH] 1. 新增webSocket相关功能 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt | 141 +++++++++-------------------------------------- 1 files changed, 27 insertions(+), 114 deletions(-) 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 676a708..96d689b 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 @@ -7,6 +7,7 @@ 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.SubTaskRep import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.lightshare.service.SubtaskService import cn.flightfeather.supervision.lightshare.service.TaskService @@ -27,6 +28,7 @@ private val subtaskMapper: SubtaskMapper, private val aopEvaluation: AopEvaluation, private val taskRep: TaskRep, + private val subTaskRep: SubTaskRep, ) : SubtaskService { val dateUtil = DateUtil() @@ -393,7 +395,7 @@ // //鏍规嵁鏃ユ湡鑾峰彇鏃ヤ换鍔� // val daytaskVo = taskService.findByDate(dateUtil.getDate(subtask.planstarttime)!!) - //2019.3.1 by Riku 搴旇鐩存帴鏍规嵁瀛愪换鍔$殑鏃ヤ换鍔d鏌ヨ鏃ヤ换鍔� + //搴旇鐩存帴鏍规嵁瀛愪换鍔$殑鏃ヤ换鍔d鏌ヨ鏃ヤ换鍔� val daytaskVo = taskService.findByID(subtask.tsguid!!) //鍒ゆ柇鏄惁鏈夋棩浠诲姟 @@ -429,6 +431,7 @@ if (!bool){ daytaskVo.runingstatus = Constant.TaskProgress.RUNINGSTATUS3.text } + } //涓よ�呯姸鎬佺浉鍚屾椂涓嶅仛淇敼锛屽叾浣欐儏鍐垫棩浠诲姟閮戒负姝e湪鎵ц else if (subtask.status != daytaskVo.runingstatus){ @@ -440,30 +443,6 @@ //**************************************************************************************** subtaskMapper.updateByPrimaryKeySelective(subtask) } - - //鍒ゆ柇瀵瑰簲椤跺眰浠诲姟鐨勬墽琛岀姸鎬� - val daytaskVolist = taskService.getDayTaskByTaskID(toptaskVo.tguid!!) - val iterator: Iterator<TaskVo> = daytaskVolist.iterator() - if (daytaskVo.runingstatus == Constant.TaskProgress.RUNINGSTATUS3.text - && toptaskVo.runingstatus == Constant.TaskProgress.RUNINGSTATUS2.text) { - var bool = false - while (iterator.hasNext()) { - val tmp = iterator.next() - if (tmp.runingstatus != Constant.TaskProgress.RUNINGSTATUS3.text) { - bool = true - break - } - } - if (!bool){ - toptaskVo.runingstatus = Constant.TaskProgress.RUNINGSTATUS3.text - } - } - else if (daytaskVo.runingstatus != toptaskVo.runingstatus){ - toptaskVo.runingstatus = Constant.TaskProgress.RUNINGSTATUS2.text - } - val toptask = Task() - BeanUtils.copyProperties(toptaskVo, toptask) - taskMapper.updateByPrimaryKeySelective(toptask) //瀵瑰凡缁撴潫鐨勫瓙浠诲姟杩涜鑷姩璇勫垎 if (subtask.status == Constant.TaskProgress.RUNINGSTATUS3.text) { @@ -596,89 +575,19 @@ } } - -// val example = Example(Subtask::class.java).apply { -// createCriteria().andEqualTo("districtcode", _districtCode) -// .andGreaterThanOrEqualTo("planstarttime", _startTime) -// .andLessThanOrEqualTo("planendtime", _endTime) -// } -// -// var counts = 0 -// -// val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) -// -// subtaskMapper.selectByExample(example).forEach { s -> -// -// val scene = scenseMapper.selectByPrimaryKey(s.scenseid) -// val inspection = inspectionMapper.selectByExample(Example(Inspection::class.java).apply { -// createCriteria().andEqualTo("stguid", s.stguid) -// }).takeIf { it.isNotEmpty() }?.get(0) -// val evaluation = evaluationMapper.selectByExample(Example(Evaluation::class.java).apply { -// createCriteria().andEqualTo("stguid", s.stguid) -// }).takeIf { it.isNotEmpty() }?.get(0) -// -// if (scene.typeid != _sceneType.toByte()) { -// return@forEach -// } else { -// counts++ -// } -// -// -// val subtaskSearchResultVo = SubtaskSearchResultVo().apply { -// this.subTaskId = s.stguid -// this.districtName = scene.districtname -// this.townName = scene.townname -// this.sceneName = scene.name -// this.sceneAddress = scene.location -// this.planStartTime = s.planstarttime -// this.planEndTime = s.planendtime -// this.status = s.status -// this.path= inspection?.extension1 -// this.score = evaluation?.resultscorebef?.toIntOrNull() -// this.level = when { -// score == null -> null -// score!! >= 54 -> "鍚堟牸" -// else -> "涓嶅悎鏍�" -// } -// } -// tempResult.data.add(subtaskSearchResultVo) -// -// problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { -// createCriteria().andEqualTo("stguid", s.stguid) -// }).forEach { p -> -// val problem = ProblemDetail().apply { -// this.problemId = p.guid -// this.problemName = p.problemname -// this.longitude = p.longitude?.toDouble() -// this.latitude = p.latitude?.toDouble() -// this.location = p.location -// this.rectification = p.ischanged -// this.rectificationTime = p.changedtime -// } -// subtaskSearchResultVo.problemList.add(problem) -// -// mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { -// createCriteria().andEqualTo("businessguid", p.guid) -// }).forEach { m -> -// val url = m.extension1 + m.guid + ".jpg" -// if (m.ischanged == true) { -// problem.rectificationPics.add(url) -// } else { -// problem.problemPics.add(url) -// } -// } -// } -// } -// -// tempResult.head = DataHead().apply { -// this.page = p.pageNum -// this.totalPage = p.pages -// } - return result } - override fun searchSubTask2(token: String, updateTime: String?, sceneType: Int?, districtCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<BaseSearchResultVo> { + override fun searchSubTask2( + token: String, + updateTime: String?, + sceneType: Int?, + districtCode: String?, + startTime: String?, + endTime: String?, + page: Int?, + perPage: Int?, + ): BaseResponse<BaseSearchResultVo> { if (token != "jinshan") { return BaseResponse(false, "璇锋眰token閿欒") } @@ -728,13 +637,13 @@ problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { createCriteria().andEqualTo("stguid", s.subTaskId) - .andNotEqualTo("extension3", Constant.PROBLEM_UNCHECKED) - .andNotEqualTo("extension3", Constant.PROBLEM_CHECK_FAIL) - .andNotEqualTo("extension3", Constant.CHANGE_CHECK_FAIL) - .andIsNotNull("extension3") + .andNotEqualTo("extension3", Constant.PROBLEM_UNCHECKED) + .andNotEqualTo("extension3", Constant.PROBLEM_CHECK_FAIL) + .andNotEqualTo("extension3", Constant.CHANGE_CHECK_FAIL) + .andIsNotNull("extension3") time?.let { and(createCriteria().orGreaterThan("time", it) - .orGreaterThan("changedtime", it)) + .orGreaterThan("changedtime", it)) } }).forEach { p -> val problem = ProblemDetail().apply { @@ -798,7 +707,7 @@ // val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) subtaskMapper.getSubtask2(time, time2, _districtCode, _sceneType?.toByte(), null, null).forEach { if (!subtaskMap.containsKey(it.subTaskId)) { - val vo =SubtaskSearchResultVo() + val vo = SubtaskSearchResultVo() BeanUtils.copyProperties(it, vo) subtaskMap[it.subTaskId] = vo } @@ -808,7 +717,7 @@ problemMap[it.problemId] = problemDetail subtaskMap[it.subTaskId]?.problemList?.add(problemDetail) } - val url = it.mExtension1 + it.mGuid+ ".jpg" + val url = it.mExtension1 + it.mGuid + ".jpg" if (it.isChanged == true) { problemMap[it.problemId]?.rectificationPics?.add(url) } else { @@ -1016,8 +925,8 @@ return subtaskMapper.getSummary(topTaskId, sceneTypeId) } - override fun getSummaryByArea(areaVo: AreaVo): List<TaskProgressVo> { - areaVo.scensetypeid ?: throw BizException("缂哄皯鍦烘櫙绫诲瀷鍙傛暟") + override fun getTaskProgressByArea(areaVo: AreaVo): List<TaskProgressVo> { +// areaVo.scensetypeid ?: throw BizException("缂哄皯鍦烘櫙绫诲瀷鍙傛暟") val res = mutableListOf<TaskProgressVo>() taskRep.findTasks(areaVo).forEach {t-> if (t?.tguid == null) return@forEach @@ -1043,4 +952,8 @@ override fun getByScene(sceneId: String, startTime: LocalDateTime?, endTime: LocalDateTime?): List<SubTaskSummary> { return subtaskMapper.getSummaryByScene(sceneId, startTime, endTime) } + + override fun getSummaryByArea(areaVo: AreaVo): List<SubTaskSummary> { + return subTaskRep.findSummary(areaVo) + } } \ No newline at end of file -- Gitblit v1.9.3