| | |
| | | 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.lightshare.service.EvaluationService |
| | | import cn.flightfeather.supervision.lightshare.service.SubtaskService |
| | | import cn.flightfeather.supervision.lightshare.service.TaskService |
| | | import cn.flightfeather.supervision.lightshare.service.UserinfoService |
| | | import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.TaskRep |
| | | import cn.flightfeather.supervision.lightshare.service.* |
| | | import cn.flightfeather.supervision.lightshare.vo.* |
| | | import org.springframework.beans.BeanUtils |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | |
| | | import kotlin.collections.ArrayList |
| | | |
| | | @Service |
| | | class TaskServiceImpl(val taskMapper: TaskMapper) : TaskService { |
| | | class TaskServiceImpl( |
| | | val taskMapper: TaskMapper, |
| | | private val taskRep: TaskRep, |
| | | private val subTaskRep: SubTaskRep, |
| | | ) : TaskService { |
| | | |
| | | @Autowired |
| | | lateinit var subtaskService: SubtaskService |
| | |
| | | val example = Example(Task::class.java) |
| | | val criteria = example.createCriteria() |
| | | //gsguid不为空为日任务,日任务开始时间和结束时间在同一天,过滤开始时间就ok |
| | | criteria.andEqualTo("starttime", dateUtil.StringToDate(date.substring(0, 10))) |
| | | criteria.andEqualTo("starttime", DateUtil.StringToDate(date.substring(0, 10))) |
| | | criteria.andIsNotNull("tsguid") |
| | | val tasklist = taskMapper.selectByExample(example) |
| | | if (tasklist.isNotEmpty()) { |
| | |
| | | return if (tasks.isEmpty()) Task() else tasks[0] |
| | | } |
| | | |
| | | val dateUtil = DateUtil() |
| | | |
| | | //根据顶层列表,日期,和执行人员ID,用户类型获取日任务 |
| | | override fun getDayTaskList(taskVoList: List<TaskVo>, date: String, guid: String, userType: String): List<TaskVo> { |
| | | if (taskVoList.isEmpty()) return taskVoList |
| | |
| | | val criteria = example.createCriteria() |
| | | //构造查询条件 |
| | | criteria.andEqualTo("tsguid", it.tguid) |
| | | val dateTemo = dateUtil.StringToDate(date) |
| | | val dateTemo = DateUtil.StringToDate(date) |
| | | //条件过滤 |
| | | criteria.andBetween("starttime", dateTemo, dateUtil.addSecond(dateUtil.addMonth(dateTemo!!, 1)!!, 1)) |
| | | criteria.andBetween("starttime", dateTemo, DateUtil.addSecond(DateUtil.addMonth(dateTemo!!, 1)!!, 1)) |
| | | if (userType == "1") { |
| | | criteria.andLike("executorguids", "%$guid%") |
| | | } |
| | |
| | | val criteria = example.createCriteria() |
| | | //构造查询条件 |
| | | criteria.andEqualTo("tsguid", it.tguid) |
| | | val dateTemo = dateUtil.StringToDate(date) |
| | | val dateTemo = DateUtil.StringToDate(date) |
| | | //条件过滤 |
| | | criteria.andBetween("starttime", dateTemo, dateUtil.addSecond(dateUtil.addMonth(dateTemo!!, 1)!!, 1)) |
| | | criteria.andBetween("starttime", dateTemo, DateUtil.addSecond(DateUtil.addMonth(dateTemo!!, 1)!!, 1)) |
| | | criteria.andLike("executorguids", "%$guid%") |
| | | //根据sql条件查询 |
| | | val taskList = taskMapper.selectByExample(example) |
| | |
| | | if (date.length < 7) { |
| | | return taskVoList |
| | | } |
| | | val startDate = DateUtil().StringToDate(date.substring(0, 7)) ?: return taskVoList |
| | | val startDate = DateUtil.StringToDate(date.substring(0, 7)) ?: return taskVoList |
| | | //查询一个月任务 |
| | | var endDate = DateUtil().addMonth(startDate, 1) ?: return taskVoList |
| | | endDate = DateUtil().addSecond(endDate, -1)!! |
| | | var endDate = DateUtil.addMonth(startDate, 1) ?: return taskVoList |
| | | endDate = DateUtil.addSecond(endDate, -1)!! |
| | | //构造查询条件 |
| | | val example = Example(Task::class.java) |
| | | val criteria = example.createCriteria() |
| | |
| | | // return taskVoList |
| | | // } |
| | | // //时间转换 |
| | | // val d1 = DateUtil().StringToDate(date.substring(0, 7)) ?: return taskVoList |
| | | // val d1 = DateUtil.StringToDate(date.substring(0, 7)) ?: return taskVoList |
| | | // var startDate: Date? = null |
| | | // var endDate: Date? = null |
| | | // //根据type类型,得到要查询的范围 |
| | | // when (type) { |
| | | // "Middle" -> { |
| | | // startDate = DateUtil().addMonth(d1, -1);endDate = DateUtil().addMonth(d1, 2) |
| | | // startDate = DateUtil.addMonth(d1, -1);endDate = DateUtil.addMonth(d1, 2) |
| | | // } |
| | | // "Left" -> { |
| | | // startDate = DateUtil().addMonth(d1, -3);endDate = d1 |
| | | // startDate = DateUtil.addMonth(d1, -3);endDate = d1 |
| | | // } |
| | | // "Right" -> { |
| | | // startDate = DateUtil().addMonth(d1, 1);endDate = DateUtil().addMonth(d1, 4) |
| | | // startDate = DateUtil.addMonth(d1, 1);endDate = DateUtil.addMonth(d1, 4) |
| | | // } |
| | | // else -> { |
| | | // startDate = d1;endDate = DateUtil().addMonth(d1, 1) |
| | | // startDate = d1;endDate = DateUtil.addMonth(d1, 1) |
| | | // } |
| | | // } |
| | | // |
| | |
| | | if (date.length < 7) { |
| | | return taskVoList |
| | | } |
| | | val startDate = DateUtil().StringToDate(date.substring(0, 7)) ?: return taskVoList |
| | | val startDate = DateUtil.StringToDate(date.substring(0, 7)) ?: return taskVoList |
| | | //查询一个月任务 |
| | | var endDate = DateUtil().addMonth(startDate, 1) ?: return taskVoList |
| | | endDate = DateUtil().addSecond(endDate, -1)!! |
| | | var endDate = DateUtil.addMonth(startDate, 1) ?: return taskVoList |
| | | endDate = DateUtil.addSecond(endDate, -1)!! |
| | | //构造查询条件 |
| | | val example = Example(Task::class.java) |
| | | val criteria = example.createCriteria() |
| | |
| | | return taskProgressVolist |
| | | } |
| | | |
| | | override fun findTask(areaVo: AreaVo): List<Task?> { |
| | | return taskRep.findTasks(areaVo) |
| | | } |
| | | |
| | | override fun findTaskProgress(areaVo: AreaVo): List<TaskProgressVo?> { |
| | | 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 |
| | | var count = 0 |
| | | taskRep.findMonitorList(t.tguid!!, areaVo.scensetypeid).forEach { |
| | | val c = if (it.extension1 != null) it.extension1!!.toInt() else 1 |
| | | count += c |
| | | } |
| | | totaltask = count |
| | | subTaskSummary = subTaskRep.findSummary(areaVo) |
| | | completetask = this.subTaskSummary?.size |
| | | } |
| | | res.add(pro) |
| | | } |
| | | return res |
| | | } |
| | | } |