| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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获取问题列表 |
| | |
| | | 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() |
| | | //************************** |
| | |
| | | |
| | | 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中场景类型scensetypeid不能为空") |
| | | val topTask = taskRep.findOneTask(areaVo) ?: throw BizException("未找到相关巡查总任务") |
| | | return getStatistic(topTask.tguid!!, areaVo.scensetypeid!!) |
| | | } |
| | | } |