| | |
| | | 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 |
| | | } |
| | | |
| | | //获取某顶层任务下,某个场景下的问题整改情况 |
| | |
| | | return "success" |
| | | } |
| | | |
| | | override fun updateProblem(problem: ProblemListVo, deleteImg: List<String>, files: Array<MultipartFile>): String { |
| | | override fun updateProblem(problem: ProblemListVo, deleteImg: List<String>?, files: Array<MultipartFile>): String { |
| | | problemRep.findOne(problem.guid) ?: throw BizException("该问题不存在") |
| | | problemRep.update(problem) |
| | | val inspection = inspectionMapper.selectByPrimaryKey(problem.iguid) ?: throw BizException("巡查记录不存在") |
| | | val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: throw BizException("巡查记录对应场景不存在") |
| | | mediafileService.saveMediaFile(files) { MediaFileVo.newProFile(inspection, problem, scene) } |
| | | mediafileService.deleteList(deleteImg) |
| | | deleteImg?.let { mediafileService.deleteList(it) } |
| | | return "success" |
| | | } |
| | | |
| | |
| | | val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { |
| | | createCriteria().andEqualTo("businessguid", problemId) |
| | | .andEqualTo("businesstypeid", 1) |
| | | .andEqualTo("ischanged", true) |
| | | // .andEqualTo("ischanged", true) |
| | | }) |
| | | if (mediaFiles.isEmpty()) throw BizException("问题还未整改,无法修改整改") |
| | | if (mediaFiles.isEmpty()) throw BizException("缺少问题和整改图片,无法修改") |
| | | if (p.ischanged != true) throw BizException("未整改问题无法修改") |
| | | |
| | | // 保存新的整改图片 |
| | | val m = mediaFiles[0] |
| | |
| | | m.apply { |
| | | guid = UUIDGenerator.generate16ShortUUID() |
| | | description = p.problemname + " " + p.location + " 整改 " + UUIDGenerator.generateUUID(4) + ".jpg" |
| | | ischanged = true |
| | | } |
| | | } |
| | | mediafileService.deleteList(deleteImg) |