| | |
| | | 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.* |
| | |
| | | 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 |
| | | |
| | |
| | | class SubtaskServiceImpl( |
| | | private val subtaskMapper: SubtaskMapper, |
| | | private val aopEvaluation: AopEvaluation, |
| | | private val taskRep: TaskRep, |
| | | ) : SubtaskService { |
| | | |
| | | val dateUtil = DateUtil() |
| | |
| | | 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) |
| | | } |
| | | } |