| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Subtask |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Task |
| | |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.TaskMapper |
| | | 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.SubTaskRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.TaskRep |
| | | import cn.flightfeather.supervision.lightshare.service.* |
| | |
| | | } |
| | | |
| | | //根据日期获取日任务 |
| | | override fun findByDate(date: String): TaskVo { |
| | | override fun findByDate(topTaskId: String, date: String): TaskVo { |
| | | val taskVo = TaskVo() |
| | | val example = Example(Task::class.java) |
| | | val criteria = example.createCriteria() |
| | | //gsguid不为空为日任务,日任务开始时间和结束时间在同一天,过滤开始时间就ok |
| | | criteria.andEqualTo("starttime", DateUtil.StringToDate(date.substring(0, 10))) |
| | | criteria.andIsNotNull("tsguid") |
| | | criteria.andEqualTo("tsguid", topTaskId) |
| | | val tasklist = taskMapper.selectByExample(example) |
| | | if (tasklist.isNotEmpty()) { |
| | | BeanUtils.copyProperties(tasklist[0], taskVo) |
| | |
| | | // FIXME: 2021/10/9 另外对于顶层任务也添加类似逻辑,由于顶层任务的任务名称默认系统自动生成,因此暂时只判断同名的顶层任务,当存在同名顶层任务时,不做保存操作 |
| | | |
| | | var result = 0 |
| | | if (task.tguid == null) task.tguid = UUIDGenerator.generate16ShortUUID() |
| | | // 1、首先判断是顶层任务还是日任务 |
| | | if (task.levelnum == 2) { |
| | | //2.1、 是顶层任务时,判断是否已有同名任务 |
| | |
| | | return result |
| | | } |
| | | |
| | | override fun create(task: Task): Task { |
| | | val res = save(task) |
| | | if (res < 1) |
| | | throw BizException("任务创建失败") |
| | | else |
| | | return task |
| | | } |
| | | |
| | | //修改日任务信息,若有子任务,子任务也修改 |
| | | override fun update(task: Task): Int { |
| | | var re = 1 |
| | |
| | | BeanUtils.copyProperties(it, subtask) |
| | | subtask.planstarttime = task.starttime |
| | | subtask.planendtime = task.endtime |
| | | subtaskService.update(subtask) |
| | | subtaskService.changeStatus(subtask) |
| | | } |
| | | } |
| | | return re |