| | |
| | | |
| | | fun getProblemByScene(sceneId: String, date: String):List<ProblemListVo> |
| | | |
| | | fun getBySceneMonth(sceneId: String, year: Int?, month: Int?):List<ProblemListVo> |
| | | fun getBySceneMonth(sceneId: String, year: Int?, month: Int?):Pair<List<SubtaskVo>, List<ProblemListVo>> |
| | | |
| | | fun findMonthProblemById(taskId:String, sceneId:Int?):List<MonthProblemVo> |
| | | |
| | |
| | | |
| | | fun getDayTaskList(taskVoList: List<TaskVo>, date: String, guid: String, userType: String): List<TaskVo> |
| | | |
| | | fun getDayTask(taskId: String, userId: String?, userType: String): List<DayTaskProgressVo> |
| | | fun getDayTask(taskId: String, userId: String?, userType: String, sceneTypeId: String?): List<DayTaskProgressVo> |
| | | |
| | | fun findByName(name: String): TaskVo |
| | | |
| | |
| | | val problemlistMapper: ProblemlistMapper, |
| | | val inspectionMapper: InspectionMapper, |
| | | val mediafileMapper: MediafileMapper, |
| | | private val subtaskService: SubtaskService, |
| | | private val subtaskMapper: SubtaskMapper, |
| | | private val taskRep: TaskRep, |
| | | private val subTaskRep: SubTaskRep, |
| | | private val problemRep: ProblemRep, |
| | |
| | | return problemListVolistTemp1 |
| | | } |
| | | |
| | | override fun getBySceneMonth(sceneId: String, year: Int?, month: Int?): List<ProblemListVo> { |
| | | override fun getBySceneMonth(sceneId: String, year: Int?, month: Int?): Pair<List<SubtaskVo>, List<ProblemListVo>> { |
| | | var _year = year |
| | | var _month = month |
| | | var lastSubTasks = listOf<SubtaskVo>() |
| | | if (year == null) { |
| | | PageHelper.startPage<Problemlist>(1, 1) |
| | | val lastProblem = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { |
| | | createCriteria().andEqualTo("sguid", sceneId) |
| | | orderBy("time").desc() |
| | | }).takeIf { it.isNotEmpty() }?.get(0) |
| | | if (lastProblem == null) { |
| | | return emptyList() |
| | | lastSubTasks = subtaskService.findByDate(sceneId = sceneId) |
| | | // PageHelper.startPage<Problemlist>(1, 1) |
| | | // val lastProblem = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { |
| | | // createCriteria().andEqualTo("sguid", sceneId) |
| | | // orderBy("time").desc() |
| | | // }).takeIf { it.isNotEmpty() }?.get(0) |
| | | if (lastSubTasks.isEmpty()) { |
| | | return lastSubTasks to emptyList() |
| | | } else { |
| | | val lt = LocalDateTime.ofInstant(lastProblem.time?.toInstant(), ZoneId.systemDefault()) |
| | | val lt = LocalDateTime.ofInstant(lastSubTasks[0].planstarttime?.toInstant(), ZoneId.systemDefault()) |
| | | _year = lt.year |
| | | _month = lt.monthValue |
| | | } |
| | | } |
| | | val sT = LocalDateTime.of(_year!!, _month!!, 1, 0, 0, 0, 0) |
| | | val eT = sT.plusMonths(1).minusSeconds(1) |
| | | return problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { |
| | | if (lastSubTasks.isEmpty()) { |
| | | lastSubTasks = subtaskMapper.selectByExample(Example(Subtask::class.java).apply { |
| | | createCriteria().andBetween("planstarttime", sT, eT) |
| | | }).map { |
| | | SubtaskVo().apply { BeanUtils.copyProperties(it, this) } |
| | | } |
| | | } |
| | | val problemList = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { |
| | | createCriteria().andBetween("time", sT,eT) |
| | | .andEqualTo("sguid", sceneId) |
| | | orderBy("time").desc() |
| | | }).map { |
| | | val problemVo = ProblemListVo(); |
| | | BeanUtils.copyProperties(it, problemVo) |
| | | problemVo |
| | | } |
| | | }).map { ProblemListVo().apply { BeanUtils.copyProperties(it, this) } } |
| | | return lastSubTasks to problemList |
| | | } |
| | | |
| | | //获取某顶层任务下,某个场景下的问题整改情况 |
| | |
| | | .apply { sceneId?.let { andEqualTo("scenseid", it) } } |
| | | }) |
| | | } else { |
| | | // 获取最近一个月内的(某个场景的)所有巡查任务 |
| | | // 获取最近一次总任务内的(某个场景的)所有巡查任务 |
| | | PageHelper.startPage<Subtask>(1, 1) |
| | | val lastOne = subtaskMapper.selectByExample(Example(Subtask::class.java).apply { |
| | | createCriteria().apply { |
| | |
| | | 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.entity.Scense |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper |
| | | import cn.flightfeather.supervision.domain.ds1.repository.SceneRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.TaskRep |
| | |
| | | private val taskRep: TaskRep, |
| | | private val subTaskRep: SubTaskRep, |
| | | private val sceneRep: SceneRep, |
| | | private val scenseMapper: ScenseMapper, |
| | | ) : TaskService { |
| | | |
| | | @Autowired |
| | |
| | | return taskVoList |
| | | } |
| | | |
| | | override fun getDayTask(taskId: String, userId: String?, userType: String): List<DayTaskProgressVo> { |
| | | override fun getDayTask(taskId: String, userId: String?, userType: String, sceneTypeId: String?): List<DayTaskProgressVo> { |
| | | val resultList = ArrayList<DayTaskProgressVo>() |
| | | |
| | | // 获取总任务下所有日任务 |
| | |
| | | |
| | | // 获取总任务下所有的子任务 |
| | | val subTasks = subTaskRep.findAll(Subtask().apply { tguid = taskId }) |
| | | if (subTasks.isEmpty()) return emptyList() |
| | | // 获取所有子任务涉及的巡查场景信息 |
| | | val sceneList = scenseMapper.selectByExample(Example(Scense::class.java).apply { |
| | | createCriteria().andIn("guid", subTasks.map { it?.scenseid }) |
| | | }) |
| | | |
| | | //根据sql条件查询 |
| | | dayTasks.forEach {t-> |
| | | // 筛选当前日任务下的子任务 |
| | | val filterSubTasks = subTasks.filter {s-> |
| | | s?.tsguid == t?.tguid |
| | | val scene = sceneList.find { it?.guid == s?.scenseid } |
| | | s?.tsguid == t?.tguid && (sceneTypeId.isNullOrBlank() || scene?.typeid.toString() == sceneTypeId) |
| | | } |
| | | // 获取当日所有的问题 |
| | | val subTaskIds = filterSubTasks.map { fs-> fs?.stguid } |
| | |
| | | } else{ |
| | | emptyList() |
| | | } |
| | | |
| | | /** 总巡查量统计 **/ |
| | | // 子任务总数 |
| | | val total = filterSubTasks.size |
| | |
| | | val complete = filterSubTasks.count {fs-> |
| | | fs?.status == Constant.TaskProgress.RUNINGSTATUS3.text |
| | | } |
| | | |
| | | /** 总问题整改率统计 **/ |
| | | // 总问题数和总整改数 |
| | | val totalProblemNum = problemList.size |
| | |
| | | // 单人巡查量累计 |
| | | // 当多个人一起执行同一任务时,平分巡查量 |
| | | this.totalTaskNum += 1.0 / ids.size |
| | | if (fst.status== Constant.TaskProgress.RUNINGSTATUS3.text) |
| | | if (fst.status == Constant.TaskProgress.RUNINGSTATUS3.text) { |
| | | } |
| | | this.completeTaskNum += 1.0 / ids.size |
| | | |
| | | // 单人整改率累计(评分) |
| | |
| | | fun getDayTask( |
| | | @PathVariable("taskId") taskId: String, |
| | | @RequestParam("userId", required = false) userId: String?, |
| | | @RequestParam("userType") userType: String |
| | | ) = taskService.getDayTask(taskId, userId, userType) |
| | | @RequestParam("userType") userType: String, |
| | | @RequestParam(required = false) sceneTypeId: String?, |
| | | ) = taskService.getDayTask(taskId, userId, userType, sceneTypeId) |
| | | |
| | | @IgnoreResponseAdvice |
| | | @GetMapping("/taskprogress/{userid}") |