From 82baf5d28ce79aa4d3b64956207d247596726924 Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期二, 10 十二月 2024 11:21:33 +0800
Subject: [PATCH] 1. BgTaskStatus状态属性序列化
---
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt | 58 ++++++++++++++++++++--------------------------------------
1 files changed, 20 insertions(+), 38 deletions(-)
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..9b3a7c3 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
@@ -29,41 +34,16 @@
@Autowired
lateinit var subtaskService: SubtaskService
- 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鑾峰彇闂鍒楄〃
- override fun findProblemListById(id: String): MutableList<ProblemlistVo> {
+ override fun findProblemListById(id: String): MutableList<ProblemListVo> {
- val problemList = mutableListOf<ProblemlistVo>()
+ val problemList = mutableListOf<ProblemListVo>()
val inspection = inspectionMapper.selectByPrimaryKey(id)
if (inspection != null) {
val problemListVo = problemlistService.findByInspectionID(inspection.guid!!)
@@ -96,7 +76,7 @@
val example = Example(Inspection::class.java)
val criteria = example.createCriteria()
criteria.andEqualTo("sguid", id)
- criteria.andLessThan("executionstarttime", DateUtil().StringToDate(date))
+ criteria.andLessThan("executionstarttime", DateUtil.StringToDate(date))
//娣诲姞宸℃煡鎸夋墽琛屾椂闂存帓搴�*****
example.orderBy("executionstarttime").desc()
//**************************
@@ -241,12 +221,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
--
Gitblit v1.9.3