| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.* |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | |
| | | |
| | | @Autowired |
| | | lateinit var taskService: TaskService |
| | | |
| | | @Autowired |
| | | lateinit var taskMapper: TaskMapper |
| | | |
| | | @Autowired |
| | | lateinit var evaluationMapper: EvaluationMapper |
| | | |
| | | @Autowired |
| | | lateinit var problemlistMapper: ProblemlistMapper |
| | | |
| | | @Autowired |
| | | lateinit var mediafileMapper: MediafileMapper |
| | | |
| | | @Autowired |
| | | lateinit var scenseMapper: ScenseMapper |
| | | |
| | | @Autowired |
| | | lateinit var inspectionMapper: InspectionMapper |
| | | |
| | | @Autowired |
| | | lateinit var monitorobjectversionMapper: MonitorobjectversionMapper |
| | | |
| | | @Autowired |
| | | lateinit var problemtypeMapper: ProblemtypeMapper |
| | | |
| | |
| | | criteria.andEqualTo("towncode", areaVo.towncode) |
| | | criteria.andBetween("planstarttime", areaVo.starttime, areaVo.endtime) |
| | | if (!Objects.equals(userGuid, Constant.UserType.ALL_USER.des)) |
| | | criteria.andLike("executorguids","%"+userGuid+"%") |
| | | criteria.andLike("executorguids", "%" + userGuid + "%") |
| | | var completecount = 0 |
| | | var subtasklist = subtaskMapper.selectByExample(example) |
| | | subtasklist.forEach { |
| | | if (Objects.equals(it.status, Constant.TaskProgress.RUNINGSTATUS3.text)){ |
| | | if (Objects.equals(it.status, Constant.TaskProgress.RUNINGSTATUS3.text)) { |
| | | completecount++ |
| | | } |
| | | } |
| | |
| | | return subtaskVoList |
| | | } |
| | | |
| | | override fun findByDayTaskID(dayTaskId: String, userId: String, userType: String): List<Subtask> { |
| | | override fun findByDayTaskID(dayTaskId: String, userId: String, userType: String): List<SubtaskVo> { |
| | | val example = Example(Subtask::class.java) |
| | | val criteria = example.createCriteria() |
| | | criteria.andEqualTo("tsguid", dayTaskId) |
| | | if (userType == "1") { |
| | | example.and( |
| | | example.createCriteria().orLike("executorguids", "%$userId%") |
| | | .orLike("stAssessorguid", "%$userId%") |
| | | example.createCriteria().orLike("executorguids", "%$userId%") |
| | | .orLike("stAssessorguid", "%$userId%") |
| | | ) |
| | | } |
| | | example.orderBy("name") |
| | | val result = subtaskMapper.selectByExample(example).apply{ |
| | | forEach breaking@{ |
| | | //已审核提示 |
| | | it.remark= Constant.PROBLEM_CHECK_PASS |
| | | |
| | | problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { |
| | | createCriteria().andEqualTo("stguid", it.stguid) |
| | | and(createCriteria().orIsNull("remark") |
| | | .orNotEqualTo("remark", Constant.PROBLEM_DELETED)) |
| | | }).forEach {problem -> |
| | | //子任务中有问题未审核时,设置未审核提示 |
| | | if (problem.extension3 == Constant.PROBLEM_UNCHECKED) { |
| | | it.remark= Constant.PROBLEM_UNCHECKED |
| | | return@breaking |
| | | } |
| | | val result = subtaskMapper.selectByExample(example).map { |
| | | val vo = SubtaskVo() |
| | | BeanUtils.copyProperties(it, vo) |
| | | vo |
| | | }.onEach { |
| | | //已审核提示 |
| | | it.remark = Constant.PROBLEM_CHECK_PASS |
| | | problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { |
| | | createCriteria().andEqualTo("stguid", it.stguid) |
| | | and( |
| | | createCriteria().orIsNull("remark") |
| | | .orNotEqualTo("remark", Constant.PROBLEM_DELETED) |
| | | ) |
| | | }).forEach { problem -> |
| | | //子任务中有问题未审核时,设置未审核提示 |
| | | if (problem.extension3 == Constant.PROBLEM_UNCHECKED) { |
| | | it.remark = Constant.PROBLEM_UNCHECKED |
| | | } |
| | | } |
| | | |
| | | // 场景类型 |
| | | scenseMapper.selectByPrimaryKey(it.scenseid)?.let { s-> |
| | | it.sceneTypeId = s.typeid |
| | | it.sceneTypeName = s.type |
| | | } |
| | | } |
| | | return result |
| | |
| | | } else { |
| | | guid |
| | | } |
| | | val userTypeId = if (userType == "主管部门"){ |
| | | val userTypeId = if (userType == "主管部门") { |
| | | "2" |
| | | }else if (userType == "飞羽用户") { |
| | | } else if (userType == "飞羽用户") { |
| | | "1" |
| | | } else if(userType == "管理员"){ |
| | | } else if (userType == "管理员") { |
| | | "0" |
| | | }else if (userType == "场景") { |
| | | } else if (userType == "场景") { |
| | | "3" |
| | | } else { |
| | | userType |
| | |
| | | two = dateString |
| | | three = DateUtil.addMonth(dateString, 1) |
| | | } |
| | | |
| | | "Left" -> { |
| | | one = DateUtil.addMonth(dateString, 1) |
| | | two = DateUtil.addMonth(dateString, 2) |
| | | three = DateUtil.addMonth(dateString, 3) |
| | | } |
| | | |
| | | "Right" -> { |
| | | one = DateUtil.addMonth(dateString, -1) |
| | | two = DateUtil.addMonth(dateString, -2) |
| | | three = DateUtil.addMonth(dateString, -3) |
| | | } |
| | | |
| | | else -> { |
| | | //参数不正确就返回 |
| | | return taskPackList |
| | |
| | | two = dateString |
| | | three = DateUtil.addMonth(dateString, 1) |
| | | } |
| | | |
| | | "Left" -> { |
| | | one = DateUtil.addMonth(dateString, 1) |
| | | two = DateUtil.addMonth(dateString, 2) |
| | | three = DateUtil.addMonth(dateString, 3) |
| | | } |
| | | |
| | | "Right" -> { |
| | | one = DateUtil.addMonth(dateString, -1) |
| | | two = DateUtil.addMonth(dateString, -2) |
| | | three = DateUtil.addMonth(dateString, -3) |
| | | } |
| | | |
| | | else -> { |
| | | //参数不正确就返回 |
| | | return taskPackList |
| | |
| | | subtask.tsguid = daytaskVo.tguid |
| | | //*(修改)*日任务正在执行,子任务结束,遍历所有其余子任务,都是结束时才将日任务修改为结束**** |
| | | if (subtask.status == Constant.TaskProgress.RUNINGSTATUS3.text |
| | | && daytaskVo.runingstatus == Constant.TaskProgress.RUNINGSTATUS2.text){ |
| | | && daytaskVo.runingstatus == Constant.TaskProgress.RUNINGSTATUS2.text |
| | | ) { |
| | | val subtaskVolist = findByDayTaskID(daytaskVo.tguid!!) |
| | | var bool = false |
| | | subtaskVolist.forEach { |
| | | if (it.status != Constant.TaskProgress.RUNINGSTATUS3.text){ |
| | | if (it.status != Constant.TaskProgress.RUNINGSTATUS3.text) { |
| | | bool = true |
| | | } |
| | | } |
| | | if (!bool){ |
| | | if (!bool) { |
| | | daytaskVo.runingstatus = Constant.TaskProgress.RUNINGSTATUS3.text |
| | | } |
| | | |
| | | } |
| | | //两者状态相同时不做修改,其余情况日任务都为正在执行 |
| | | else if (subtask.status != daytaskVo.runingstatus){ |
| | | else if (subtask.status != daytaskVo.runingstatus) { |
| | | daytaskVo.runingstatus = Constant.TaskProgress.RUNINGSTATUS2.text |
| | | } |
| | | val daytask = Task() |
| | |
| | | return res |
| | | } |
| | | |
| | | override fun delete(id: String): Int{ |
| | | @Transactional |
| | | override fun delete(id: String): Int { |
| | | val subtask = subtaskMapper.selectByPrimaryKey(id) |
| | | val dayTaskId = subtask.tsguid |
| | | subtaskMapper.deleteByPrimaryKey(id) |
| | |
| | | } |
| | | |
| | | |
| | | override fun searchSubTask(token: String, sceneType: Int?, districtCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseSearchResultVo { |
| | | override fun searchSubTask( |
| | | token: String, |
| | | sceneType: Int?, |
| | | districtCode: String?, |
| | | startTime: String?, |
| | | endTime: String?, |
| | | page: Int?, |
| | | perPage: Int?, |
| | | ): BaseSearchResultVo { |
| | | if (token != "jingan") { |
| | | return BaseSearchResultVo().apply { |
| | | head = DataHead().apply { |
| | |
| | | // val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) |
| | | subtaskMapper.getSubtask2(null, null, _districtCode, _sceneType.toByte(), _startTime, _endTime).forEach { |
| | | if (!subtaskMap.containsKey(it.subTaskId)) { |
| | | val vo =SubtaskSearchResultVo() |
| | | val vo = SubtaskSearchResultVo() |
| | | BeanUtils.copyProperties(it, vo) |
| | | subtaskMap[it.subTaskId] = vo |
| | | } |
| | |
| | | problemMap[it.problemId] = problemDetail |
| | | subtaskMap[it.subTaskId]?.problemList?.add(problemDetail) |
| | | } |
| | | val url = it.mExtension1 + it.mGuid+ ".jpg" |
| | | val url = it.mExtension1 + it.mGuid + ".jpg" |
| | | if (it.isChanged == true) { |
| | | problemMap[it.problemId]?.rectificationPics?.add(url) |
| | | } else { |
| | |
| | | } |
| | | |
| | | |
| | | val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) |
| | | val p = PageHelper.startPage<SubtaskSearchResultVo>(page ?: 1, perPage ?: 30) |
| | | |
| | | val subtasklist = subtaskMapper.getSubtask(_districtCode, _startTime, _endTime, _sceneType?.toByte()) |
| | | |
| | |
| | | .andNotEqualTo("extension3", Constant.CHANGE_CHECK_FAIL) |
| | | .andIsNotNull("extension3") |
| | | time?.let { |
| | | and(createCriteria().orGreaterThan("time", it) |
| | | .orGreaterThan("changedtime", it)) |
| | | and( |
| | | createCriteria().orGreaterThan("time", it) |
| | | .orGreaterThan("changedtime", it) |
| | | ) |
| | | } |
| | | }).forEach { p -> |
| | | val problem = ProblemDetail().apply { |
| | |
| | | return BaseResponse(true, "请求成功", data = result) |
| | | } |
| | | |
| | | override fun searchSubTask3(token: String, updateTime: String?, sceneType: Int?, districtCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<BaseSearchResultVo> { |
| | | override fun searchSubTask3( |
| | | token: String, |
| | | updateTime: String?, |
| | | sceneType: Int?, |
| | | districtCode: String?, |
| | | startTime: String?, |
| | | endTime: String?, |
| | | page: Int?, |
| | | perPage: Int?, |
| | | ): BaseResponse<BaseSearchResultVo> { |
| | | if (token != "jinshan") { |
| | | return BaseResponse(false, "请求token错误") |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) |
| | | val p = PageHelper.startPage<SubtaskSearchResultVo>(page ?: 1, perPage ?: 30) |
| | | |
| | | val subtasklist = subtaskMapper.getSubtask(_districtCode, _startTime, _endTime, _sceneType?.toByte()) |
| | | |
| | |
| | | .andNotEqualTo("extension3", Constant.CHANGE_CHECK_FAIL) |
| | | .andIsNotNull("extension3") |
| | | time?.let { |
| | | and(createCriteria().orGreaterThan("time", it) |
| | | .orGreaterThan("changedtime", it)) |
| | | and( |
| | | createCriteria().orGreaterThan("time", it) |
| | | .orGreaterThan("changedtime", it) |
| | | ) |
| | | } |
| | | }).forEach { p -> |
| | | val problem = ProblemDetail().apply { |
| | |
| | | // val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) |
| | | subtaskMapper.getSubtask2(time, time2, _districtCode, _sceneType?.toByte(), null, null).forEach { |
| | | if (!subtaskMap.containsKey(it.subTaskId)) { |
| | | val vo =SubtaskSearchResultVo() |
| | | val vo = SubtaskSearchResultVo() |
| | | BeanUtils.copyProperties(it, vo) |
| | | subtaskMap[it.subTaskId] = vo |
| | | } |
| | |
| | | problemMap[it.problemId] = problemDetail |
| | | subtaskMap[it.subTaskId]?.problemList?.add(problemDetail) |
| | | } |
| | | val url = it.mExtension1 + it.mGuid+ ".jpg" |
| | | val url = it.mExtension1 + it.mGuid + ".jpg" |
| | | if (it.isChanged == true) { |
| | | problemMap[it.problemId]?.rectificationPics?.add(url) |
| | | } else { |
| | |
| | | return BaseResponse(true, "请求成功", data = result) |
| | | } |
| | | |
| | | override fun findByDate(date: String, userId: String): List<SubtaskVo> { |
| | | val time = DateUtil.StringToDate(date) |
| | | override fun findByDate(date: String?, userId: String?, sceneId: String?): List<SubtaskVo> { |
| | | val time = if (date == null) null else DateUtil.StringToDate(date) |
| | | |
| | | val resultList = mutableListOf<SubtaskVo>() |
| | | |
| | | subtaskMapper.selectByExample(Example(Subtask::class.java).apply { |
| | | createCriteria().andLessThanOrEqualTo("planstarttime", time) |
| | | val subtasks = if (time != null) { |
| | | // 获取某一天的巡查任务 |
| | | subtaskMapper.selectByExample(Example(Subtask::class.java).apply { |
| | | createCriteria().andLessThanOrEqualTo("planstarttime", time) |
| | | .andGreaterThanOrEqualTo("planendtime", time) |
| | | }).forEach { |
| | | .apply { sceneId?.let { andEqualTo("scenseid", it) } } |
| | | }) |
| | | } else { |
| | | // 获取最近一次总任务内的(某个场景的)所有巡查任务 |
| | | PageHelper.startPage<Subtask>(1, 1) |
| | | val lastOne = subtaskMapper.selectByExample(Example(Subtask::class.java).apply { |
| | | createCriteria().apply { |
| | | sceneId?.let { andEqualTo("scenseid", it) } |
| | | } |
| | | orderBy("planstarttime").desc() |
| | | }).takeIf { it.isNotEmpty() }?.get(0) |
| | | if (lastOne == null) { |
| | | emptyList() |
| | | } else { |
| | | subtaskMapper.selectByExample(Example(Subtask::class.java).apply { |
| | | createCriteria().andEqualTo("tguid", lastOne.tguid) |
| | | .andEqualTo("scenseid", lastOne.scenseid) |
| | | }) |
| | | } |
| | | } |
| | | subtasks.forEach { |
| | | val vo = SubtaskVo() |
| | | BeanUtils.copyProperties(it, vo) |
| | | resultList.add(vo) |
| | |
| | | topTaskId: String, |
| | | startTime: String?, |
| | | endTime: String?, |
| | | sceneTypeId: Int? |
| | | sceneTypeId: Int?, |
| | | ): List<Subtask> { |
| | | |
| | | return subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId) |
| | |
| | | override fun getTaskProgressByArea(areaVo: AreaVo): List<TaskProgressVo> { |
| | | // areaVo.scensetypeid ?: throw BizException("缺少场景类型参数") |
| | | val res = mutableListOf<TaskProgressVo>() |
| | | taskRep.findTasks(areaVo).forEach {t-> |
| | | taskRep.findTasks(areaVo).forEach { t -> |
| | | if (t?.tguid == null) return@forEach |
| | | val pro = TaskProgressVo().apply { |
| | | tguid = t.tguid |