From 8a0a8adfbe53db564df7aaaf561a60be7d4d8dd0 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 26 九月 2024 17:52:24 +0800 Subject: [PATCH] 1. 新增监管系统中用户模糊搜索功能 2. 新增监测设备和用户的匹配关系搜索功能 --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt | 76 ++++++++++++++++++++++++++----------- 1 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt index cb7885b..bc6354d 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt @@ -8,11 +8,9 @@ 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.domain.ds1.repository.SubTaskRep import cn.flightfeather.supervision.domain.ds1.repository.TaskRep -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.lightshare.service.* import cn.flightfeather.supervision.lightshare.vo.* import org.springframework.beans.BeanUtils import org.springframework.beans.factory.annotation.Autowired @@ -22,7 +20,11 @@ import kotlin.collections.ArrayList @Service -class TaskServiceImpl(val taskMapper: TaskMapper, private val taskRep: TaskRep,) : TaskService { +class TaskServiceImpl( + val taskMapper: TaskMapper, + private val taskRep: TaskRep, + private val subTaskRep: SubTaskRep, +) : TaskService { @Autowired lateinit var subtaskService: SubtaskService @@ -181,7 +183,7 @@ 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()) { @@ -287,8 +289,6 @@ return if (tasks.isEmpty()) Task() else tasks[0] } - val dateUtil = DateUtil() - //鏍规嵁椤跺眰鍒楄〃,鏃ユ湡,鍜屾墽琛屼汉鍛業D锛岀敤鎴风被鍨嬭幏鍙栨棩浠诲姟 override fun getDayTaskList(taskVoList: List<TaskVo>, date: String, guid: String, userType: String): List<TaskVo> { if (taskVoList.isEmpty()) return taskVoList @@ -297,9 +297,9 @@ 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%") } @@ -379,9 +379,9 @@ 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) @@ -402,10 +402,10 @@ 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() @@ -454,22 +454,22 @@ // 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) // } // } // @@ -498,10 +498,10 @@ 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() @@ -729,4 +729,34 @@ 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 + } } \ No newline at end of file -- Gitblit v1.9.3