| | |
| | | import cn.flightfeather.supervision.domain.ds1.repository.TaskRep |
| | | import cn.flightfeather.supervision.lightshare.service.MediafileService |
| | | import cn.flightfeather.supervision.lightshare.service.ProblemlistService |
| | | import cn.flightfeather.supervision.lightshare.service.SubtaskService |
| | | import cn.flightfeather.supervision.lightshare.service.TaskService |
| | | import cn.flightfeather.supervision.lightshare.vo.* |
| | | import com.fasterxml.jackson.core.type.TypeReference |
| | |
| | | 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?): Pair<List<SubtaskVo>, List<ProblemListVo>> { |
| | | var _year = year |
| | | var _month = month |
| | | var lastSubTasks = listOf<SubtaskVo>() |
| | | if (year == null) { |
| | | 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(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) |
| | | 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 { ProblemListVo().apply { BeanUtils.copyProperties(it, this) } } |
| | | return lastSubTasks to problemList |
| | | } |
| | | |
| | | //获取某顶层任务下,某个场景下的问题整改情况 |
| | |
| | | |
| | | override fun delete(id: String): Int = problemlistMapper.deleteByPrimaryKey(id) |
| | | |
| | | override fun setDeleteStatus(id: String): BaseResponse<Int> { |
| | | override fun setDeleteStatus(id: String): Int { |
| | | val p = problemlistMapper.selectByPrimaryKey(id) |
| | | |
| | | return when { |
| | | p.ischanged == true -> BaseResponse(false, "问题已整改,无法删除", data = 0) |
| | | p.extension3 != Constant.PROBLEM_UNCHECKED -> BaseResponse(false, "问题已审核,无法删除", data = 0) |
| | | p.ischanged == true -> throw BizException("问题已整改,无法删除") |
| | | p.extension3 != Constant.PROBLEM_UNCHECKED -> throw BizException("问题已审核,无法删除") |
| | | else -> { |
| | | // 2021/4/25 将原来的添加删除状态改为直接删除 |
| | | // p.remark = Constant.PROBLEM_DELETED |
| | |
| | | inspection.problemcount = inspection.problemcount!! - 1 |
| | | inspectionMapper.updateByPrimaryKey(inspection) |
| | | } |
| | | BaseResponse(true, "问题删除成功", data = i) |
| | | i |
| | | } |
| | | } |
| | | } |
| | |
| | | remark: String, |
| | | userId: String, |
| | | userName: String, |
| | | ): BaseResponse<String> { |
| | | ): String { |
| | | if (action !in 0..5) { |
| | | return BaseResponse(false, "非法的操作指令") |
| | | throw BizException("非法的操作指令") |
| | | } |
| | | val p = problemlistMapper.selectByPrimaryKey(pId) ?: return BaseResponse(false, "问题不存在") |
| | | val p = problemlistMapper.selectByPrimaryKey(pId) ?: throw BizException("问题不存在") |
| | | val subtask = p.stguid?.let { subTaskRep.findOne(it) } |
| | | val response = BaseResponse<String>(true) |
| | | var event = "" |
| | |
| | | bizLog.info(WorkStreamLogInfo(userId, userName, event)) |
| | | } |
| | | } |
| | | return response |
| | | return if (response.success) "问题审核成功" else throw BizException(response.message) |
| | | } |
| | | |
| | | override fun newProblem(problem: String, files: Array<MultipartFile>): BaseResponse<String> { |
| | | override fun newProblem(problem: String, files: Array<MultipartFile>): String { |
| | | //json转object |
| | | val problemVo = ObjectMapper().readValue(problem, object : TypeReference<ProblemVo>() {}) |
| | | |
| | | val inspection = inspectionMapper.selectByPrimaryKey(problemVo.insGuid) ?: return BaseResponse(false, "巡查记录不存在") |
| | | val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: return BaseResponse(false, "巡查记录对应场景不存在") |
| | | val inspection = inspectionMapper.selectByPrimaryKey(problemVo.insGuid) ?: throw BizException("巡查记录不存在") |
| | | val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: throw BizException("巡查记录对应场景不存在") |
| | | // 保存问题 |
| | | val problemlist = ProblemListVo.newPro(inspection, problemVo, scene) |
| | | problemlistMapper.insert(problemlist) |
| | |
| | | bizLog.info(WorkStreamLogInfo(subtask?.executorguids, subtask?.executorrealtimes, event)) |
| | | } |
| | | |
| | | return BaseResponse(true) |
| | | return "success" |
| | | } |
| | | |
| | | override fun updateProblem(problem: ProblemListVo, deleteImg: List<String>, files: Array<MultipartFile>): String { |
| | |
| | | } |
| | | |
| | | |
| | | override fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String> { |
| | | override fun changeProblem(problemId: String, files: Array<MultipartFile>): String { |
| | | // 问题和问题图片合法性检查 |
| | | val p = problemlistMapper.selectByPrimaryKey(problemId) ?: return BaseResponse(false, "问题不存在") |
| | | val p = problemlistMapper.selectByPrimaryKey(problemId) ?: throw BizException("问题不存在") |
| | | val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { |
| | | createCriteria().andEqualTo("businessguid", p.guid) |
| | | .andEqualTo("businesstypeid", 1) |
| | | .andEqualTo("ischanged", false) |
| | | }) |
| | | if (mediaFiles.isEmpty()) return BaseResponse(false, "问题不存在或已整改,无法重复整改") |
| | | if (mediaFiles.isEmpty()) throw BizException("问题不存在或已整改,无法重复整改") |
| | | |
| | | // 更新问题 |
| | | p.apply { |
| | |
| | | } |
| | | } |
| | | |
| | | return BaseResponse(true) |
| | | return "success" |
| | | } |
| | | |
| | | override fun updateChange(problemId: String, deleteImg: List<String>, files: Array<MultipartFile>): String { |