| | |
| | | |
| | | @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++ |
| | | } |
| | | } |
| | |
| | | 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{ |
| | | val result = subtaskMapper.selectByExample(example).apply { |
| | | forEach breaking@{ |
| | | //已审核提示 |
| | | it.remark= Constant.PROBLEM_CHECK_PASS |
| | | 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 -> |
| | | and( |
| | | createCriteria().orIsNull("remark") |
| | | .orNotEqualTo("remark", Constant.PROBLEM_DELETED) |
| | | ) |
| | | }).forEach { problem -> |
| | | //子任务中有问题未审核时,设置未审核提示 |
| | | if (problem.extension3 == Constant.PROBLEM_UNCHECKED) { |
| | | it.remark= Constant.PROBLEM_UNCHECKED |
| | | it.remark = Constant.PROBLEM_UNCHECKED |
| | | return@breaking |
| | | } |
| | | } |
| | |
| | | @Transactional |
| | | override fun saveList(subtasklist: List<Subtask>): Int { |
| | | subtasklist.forEach { |
| | | if (it.stguid == null) it.stguid = UUIDGenerator.generate16ShortUUID() |
| | | subtaskMapper.insert(it) |
| | | } |
| | | return subtasklist.size |
| | |
| | | } 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 |
| | |
| | | |
| | | override fun findAll(): MutableList<Subtask> = subtaskMapper.selectAll() |
| | | |
| | | override fun save(subtask: Subtask): Int = subtaskMapper.insert(subtask) |
| | | override fun save(subtask: Subtask): Int { |
| | | if (subtask.stguid == null) subtask.stguid = UUIDGenerator.generate16ShortUUID() |
| | | return subtaskMapper.insert(subtask) |
| | | } |
| | | |
| | | //更新子任务 |
| | | override fun update(subtask: Subtask): Int { |
| | | var res = 0 |
| | | //根据子任务guid获取顶层任务 |
| | | val toptaskVo = taskService.findByID(subtask.tguid.toString()) |
| | | |
| | | // //根据日期获取日任务 |
| | | // val daytaskVo = taskService.findByDate(DateUtil.getDate(subtask.planstarttime)!!) |
| | | val daytaskVo = taskService.findByDate(subtask.tguid!!, DateUtil.getDate(subtask.planstarttime)!!) |
| | | |
| | | //应该直接根据子任务的日任务id查询日任务 |
| | | val daytaskVo = taskService.findByID(subtask.tsguid!!) |
| | | // val daytaskVo = taskService.findByID(subtask.tsguid!!) |
| | | |
| | | //判断是否有日任务 |
| | | if (StringUtil.isEmpty(daytaskVo.tguid)) { |
| | |
| | | task.name = subtask.name |
| | | task.starttime = DateUtil.StringToDate(DateUtil.getDate(subtask.planstarttime)!!.substring(0, 10)) |
| | | task.endtime = |
| | | DateUtil.StringToDate(DateUtil.getDate(subtask.planstarttime)!!.substring(0, 10) + " 23:59:59") |
| | | DateUtil.StringToDate(DateUtil.getDate(subtask.planstarttime)!!.substring(0, 10) + " 23:59:59") |
| | | //****日任务执行状态继承子任务的状态*(修改)*** |
| | | task.runingstatus = subtask.status |
| | | //******************************************** |
| | | taskService.save(task) |
| | | subtask.tsguid = guid |
| | | subtaskMapper.updateByPrimaryKeySelective(subtask) |
| | | res = subtaskMapper.updateByPrimaryKeySelective(subtask) |
| | | } else { |
| | | // subtask.tsguid = daytaskVo.tguid |
| | | 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() |
| | | BeanUtils.copyProperties(daytaskVo, daytask) |
| | | taskMapper.updateByPrimaryKeySelective(daytask) |
| | | //**************************************************************************************** |
| | | subtaskMapper.updateByPrimaryKeySelective(subtask) |
| | | res = subtaskMapper.updateByPrimaryKeySelective(subtask) |
| | | } |
| | | return res |
| | | } |
| | | |
| | | override fun changeStatus(subtask: Subtask): Int { |
| | | val res = update(subtask) |
| | | //对已结束的子任务进行自动评分 |
| | | if (subtask.status == Constant.TaskProgress.RUNINGSTATUS3.text) { |
| | | val example = Example(Evaluation::class.java) |
| | |
| | | } |
| | | } |
| | | |
| | | return 1 |
| | | 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) |
| | |
| | | createCriteria().andEqualTo("tid", topTaskId).andEqualTo("sguid", sceneId) |
| | | }) |
| | | mList.forEach { |
| | | if (it.monitornum == null) { |
| | | it.monitornum = 0 |
| | | } else { |
| | | it.monitornum = it.monitornum!! - 1 |
| | | if (it.monitornum!! < 0) { |
| | | it.monitornum = 0 |
| | | } |
| | | var count = it.extension1?.toIntOrNull() ?: 0 |
| | | count-- |
| | | if (count < 0) { |
| | | count = 0 |
| | | } |
| | | monitorobjectversionMapper.insert(it) |
| | | it.extension1 = count.toString() |
| | | monitorobjectversionMapper.updateByPrimaryKeySelective(it) |
| | | } |
| | | |
| | | // 同时删除对应问题和巡查记录 |
| | |
| | | } |
| | | |
| | | |
| | | 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 |
| | |
| | | districtName = t.districtname |
| | | townCode = t.towncode |
| | | townName = t.townname |
| | | subTaskSummary = subtaskMapper.getSummary(t.tguid!!, areaVo.scensetypeid?.toIntOrNull()) |
| | | areaVo.topTaskId = t.tguid |
| | | subTaskSummary = subTaskRep.findSummary(areaVo) |
| | | } |
| | | res.add(pro) |
| | | } |