From 8c15c9cc0d6474ed77e313258f9b09f7f2d6366e Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 17 九月 2025 17:29:47 +0800 Subject: [PATCH] 2025.9.17 1. 新增数据产品接口 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt | 67 +++++++++++++-------------------- 1 files changed, 26 insertions(+), 41 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 6586836..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 @@ -30,37 +35,15 @@ lateinit var subtaskService: SubtaskService //鑾峰彇姹℃煋鍦烘櫙鐗堟湰涓婚〉鐨勭洃绠℃儏鍐靛睍绀哄唴瀹� - 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") - inspectionInfoVo.inspectionTime = map["inspectionTime"].toString() - val time = inspectionInfoVo.inspectionTime - inspectionInfoVo.inspectionTime = time?.substring(0, time.length-11) - 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!!) @@ -93,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() //************************** @@ -182,12 +165,12 @@ } //鏍规嵁瀛愪换鍔d鑾峰彇鍗曢」鑰冩牳璇勪及 - val itemevaluation = itemevaluationService.findBySubTaskID(subTaskID) - if (!itemevaluation.isEmpty()) { - inspectionVo.itemevaluationList = itemevaluation - } else { - inspectionVo.itemevaluationList = mutableListOf() - } +// val itemevaluation = itemevaluationService.findBySubTaskID(subTaskID) +// if (!itemevaluation.isEmpty()) { +// inspectionVo.itemevaluationList = itemevaluation +// } else { +// inspectionVo.itemevaluationList = mutableListOf() +// } //杩斿洖 return inspectionVo @@ -238,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