From 0f7b47105d80fb9a260486270cf925a232e74791 Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期一, 22 十二月 2025 21:20:13 +0800
Subject: [PATCH] 2025.12.22 1. 修改日任务统计接口,新增当天内整改问题数和48小时内整改问题数统计
---
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt | 319 ++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 240 insertions(+), 79 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..aee2d25 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
@@ -1,5 +1,6 @@
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
@@ -8,21 +9,31 @@
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.entity.Scense
+import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper
+import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
+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
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
+import java.time.LocalDateTime
+import java.time.ZoneId
import java.util.*
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,
+ private val sceneRep: SceneRep,
+ private val scenseMapper: ScenseMapper,
+) : TaskService {
@Autowired
lateinit var subtaskService: SubtaskService
@@ -102,7 +113,7 @@
townRank.standardRate = it.get("standardRate").toString().toFloat()
} catch (e: Exception) {
}
- val s =it.get("hasScoredNum").toString()
+ val s = it.get("hasScoredNum").toString()
try {
townRank.hasScoredNum = it.get("hasScoredNum").toString().toInt()
} catch (e: Exception) {
@@ -162,7 +173,7 @@
if (type == 0)
return getAllTop()
//鑾峰彇鏈畬鎴愰《灞備换鍔″強瀵瑰簲鏃ヤ换鍔″垪琛�
- else if (type == 1){
+ else if (type == 1) {
val tmp = getAllTop()
tmp.forEach {
if (it.runingstatus != Constant.TaskProgress.RUNINGSTATUS3.text) {
@@ -176,13 +187,13 @@
}
//鏍规嵁鏃ユ湡鑾峰彇鏃ヤ换鍔�
- 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("starttime", DateUtil.StringToDate(date.substring(0, 10)))
+ criteria.andEqualTo("tsguid", topTaskId)
val tasklist = taskMapper.selectByExample(example)
if (tasklist.isNotEmpty()) {
BeanUtils.copyProperties(tasklist[0], taskVo)
@@ -221,10 +232,10 @@
// .andEqualTo("districtcode", districtCode)
// .andLessThanOrEqualTo("endtime", date)
// example.or(
- example.createCriteria().andIsNull("tsguid")
- .andEqualTo("districtcode", districtCode)
- .andLessThanOrEqualTo("starttime", date)
- .andGreaterThanOrEqualTo("endtime", date)
+ example.createCriteria().andIsNull("tsguid")
+ .andEqualTo("districtcode", districtCode)
+ .andLessThanOrEqualTo("starttime", date)
+ .andGreaterThanOrEqualTo("endtime", date)
// )
example.orderBy("starttime").desc()
val tasklist = taskMapper.selectByExample(example)
@@ -287,8 +298,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 +306,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%")
}
@@ -316,56 +325,150 @@
return taskVoList
}
- override fun getDayTask(taskId: String, userId: String, userType: String): List<DayTaskProgressVo> {
- val example = Example(Task::class.java)
- val criteria = example.createCriteria()
- //鏋勯�犳煡璇㈡潯浠�
- criteria.andEqualTo("tsguid", taskId)
- if (userType == "1") {
- criteria.andLike("executorguids", "%$userId%")
- }
-
+ override fun getDayTask(taskId: String, userId: String?, userType: String, sceneTypeId: String?): List<DayTaskProgressVo> {
val resultList = ArrayList<DayTaskProgressVo>()
+ // 鑾峰彇鎬讳换鍔′笅鎵�鏈夋棩浠诲姟
+ val dayTasks = if (userType == "1") {
+ taskRep.findDayTasks(taskId, userId)
+ } else {
+ taskRep.findDayTasks(taskId)
+ }
+
+ // 鑾峰彇鎬讳换鍔′笅鎵�鏈夌殑瀛愪换鍔�
+ val subTasks = subTaskRep.findAll(Subtask().apply { tguid = taskId })
+ if (subTasks.isEmpty()) return emptyList()
+ // 鑾峰彇鎵�鏈夊瓙浠诲姟娑夊強鐨勫贰鏌ュ満鏅俊鎭�
+ val sceneList = scenseMapper.selectByExample(Example(Scense::class.java).apply {
+ createCriteria().andIn("guid", subTasks.map { it?.scenseid })
+ })
+
//鏍规嵁sql鏉′欢鏌ヨ
- taskMapper.selectByExample(example).forEach {
- val exampleTotal = Example(Subtask::class.java).apply {
- createCriteria().andEqualTo("tsguid", it.tguid)
+ dayTasks.forEach { t ->
+ // 绛涢�夊綋鍓嶆棩浠诲姟涓嬬殑瀛愪换鍔�
+ val filterSubTasks = subTasks.filter { s ->
+ val scene = sceneList.find { it?.guid == s?.scenseid }
+ s?.tsguid == t?.tguid && (sceneTypeId.isNullOrBlank() || scene?.typeid.toString() == sceneTypeId)
+ }
+ // 鑾峰彇褰撴棩鎵�鏈夌殑闂
+ val subTaskIds = filterSubTasks.map { fs -> fs?.stguid }
+ val problemList = if (subTaskIds.isNotEmpty()) {
+ problemListMapper.selectByExample(Example(Problemlist::class.java).apply {
+ createCriteria().andIn("stguid", subTaskIds)
+ })
+ } else {
+ emptyList()
}
- val total = subtaskMapper.selectCountByExample(exampleTotal)
-
- val exampleComplete = exampleTotal.apply {
- and().andEqualTo("status", Constant.TaskProgress.RUNINGSTATUS3.text)
+ /** 鎬诲贰鏌ラ噺缁熻 **/
+ // 瀛愪换鍔℃�绘暟
+ val total = filterSubTasks.size
+ // 瀛愪换鍔″畬鎴愭暟
+ val complete = filterSubTasks.count { fs ->
+ fs?.status == Constant.TaskProgress.RUNINGSTATUS3.text
}
- val complete = subtaskMapper.selectCountByExample(exampleComplete)
- var changed = 0
- problemListMapper.findUnchangedCount(it.tguid ?: "").forEach {i ->
- //缁撴灉琛ㄧず璇ュ瓙浠诲姟鏈暣鏀归棶棰樻暟
- if (i == 0) {
- changed++
+ /** 鎬婚棶棰樻暣鏀圭巼缁熻 **/
+ // 鎬婚棶棰樻暟鍜屾�绘暣鏀规暟
+ val totalProblemNum = problemList.size
+ val changedProblemNum = problemList.filter { it.ischanged == true }.size
+
+ /** 姣忎釜浜虹殑宸℃煡閲忛棶棰樻暣鏀圭巼 **/
+ val userProgressMap = mutableMapOf<String, ProgressPerUserPerDay>()
+ filterSubTasks.forEach fst@{ fst ->
+ fst ?: return@fst
+ // fixme 2025.11.30 鐢变簬鐩戠APP鐨刡ug锛屽鑷寸敤鎴峰彲浠ヤ笉閫夋嫨鎵ц浜哄憳鐩存帴鍒涘缓浠诲姟锛屾墍浠ユ殏鏃跺皢娌℃湁鎵ц浜哄憳鐨勪换鍔″畾涔変负鍖垮悕鐢ㄦ埛
+ if (fst.executorguids.isNullOrBlank()) {
+ fst.executorguids = "niming"
+ fst.executorusernames = "niming"
+ fst.executorrealtimes = "鍖垮悕鐢ㄦ埛"
+ }
+ val ids = fst.executorguids?.split("#") ?: return@fst
+ val names = fst.executorrealtimes?.split("#") ?: return@fst
+ // 绛涢�夋瘡涓瓙浠诲姟涓嬬殑闂
+ val proList = problemList.filter { p -> p?.stguid == fst.stguid }
+ for (i in ids.indices) {
+ val key = ids[i]
+ if (!userProgressMap.containsKey(key)) {
+ userProgressMap[key] = ProgressPerUserPerDay().apply {
+ this.userId = key
+ this.userName = names[i]
+ }
+ }
+ userProgressMap[key]?.apply {
+ // 鍗曚汉宸℃煡閲忕疮璁�
+ // 褰撳涓汉涓�璧锋墽琛屽悓涓�浠诲姟鏃讹紝骞冲垎宸℃煡閲�
+ this.totalTaskNum += 1.0 / ids.size
+ if (fst.status == Constant.TaskProgress.RUNINGSTATUS3.text) {
+ }
+ this.completeTaskNum += 1.0 / ids.size
+
+ // 鍗曚汉鏁存敼鐜囩疮璁★紙璇勫垎锛�
+ this.totalProblemNum += proList.size.toDouble() / ids.size
+ this.changedProblemNum += proList.filter { it.ischanged == true }.size.toDouble() / ids.size
+ this.changedProblemNumOnTime += proList.filter {
+ // 鏄惁鍦ㄥ悓涓�澶╁唴鏁存敼
+ val _changedDate = it.changedtime?.let { c->
+ LocalDateTime.ofInstant(c.toInstant(), ZoneId.systemDefault()).toLocalDate()
+ }
+ val _proDate = it.time?.let { t->
+ LocalDateTime.ofInstant(t.toInstant(), ZoneId.systemDefault()).toLocalDate()
+ }
+ val isSameDay = _changedDate?.equals(_proDate)
+ it.ischanged == true && (isSameDay ?: false)
+ }.size.toDouble() / ids.size
+ this.efficientChangedProNum += proList.filter {
+ // 鏁存敼鑰楁椂锛堝ぉ锛�
+ val day = ((it.changedtime?.time ?: 0L) - (it?.time?.time ?: 0L)).div(1000 * 60 * 60 * 24)
+ it.ischanged == true && day <= 2
+ }.size.toDouble() / ids.size
+ // 姝ゅ鍏堢疮璁″贰鏌ユ椂闀匡紝鏈�鍚庡啀鏍规嵁浠诲姟鏁伴噺骞冲潎
+ this.avgInspectionTime += if (fst.executionendtime == null || fst.executionstarttime == null) {
+ 0
+ } else {
+ (fst.executionendtime!!.time - fst.executionstarttime!!.time).div(1000).div(ids.size)
+ }
+ }
+
}
}
+ // 缁熶竴璁$畻骞冲潎宸℃煡鏃堕暱锛堢锛�
+ userProgressMap.forEach { (t, u) ->
+ u.avgInspectionTime = if (u.completeTaskNum == .0 ) 0 else (u.avgInspectionTime / u.completeTaskNum).toLong()
+ u.formatParam()
+ }
+ /** 浠诲姟鏁存敼瀹屾垚鎯呭喌鍜屽鏍告儏鍐电粺璁� **/
+ var changed = 0
//瀹℃牳鏄惁瀹屾垚
- var check = false
- with(subtaskMapper.selectByExample(exampleTotal)) breaking@{
- forEach {
- problemListMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("stguid", it.stguid)
- }).forEach {problem ->
- if (problem.extension3 == Constant.PROBLEM_UNCHECKED) {
- check = true
- return@breaking
- }
+ var check = true
+ filterSubTasks.forEach { fs ->
+ // 绛涢�夋瘡涓瓙浠诲姟涓嬬殑闂鏈暣鏀规暟
+ problemList.filter { p -> p?.stguid == fs?.stguid }.onEach { pro ->
+ // 褰撳瓨鍦ㄨ嚦灏戜竴涓棶棰樻病鏈夊鏍告椂锛屽綋鏃ュ鏍哥姸鎬佷负鏈鏍�
+ if (pro.extension3 == Constant.PROBLEM_UNCHECKED || pro.extension3 == Constant.CHANGE_UNCHECKED) {
+ check = false
+ }
+ }.count { i -> i?.ischanged != true }.let { c ->
+ // 娌℃湁鏈暣鏀归棶棰樻椂锛屽垯琛ㄧず璇ュ瓙浠诲姟宸茬粡鏁存敼瀹屾垚
+ if (c == 0) {
+ changed++
}
}
}
- resultList.add(DayTaskProgressVo(
- it.tguid, it.starttime, taskId, complete, changed, total, check
- ))
+ resultList.add(DayTaskProgressVo().apply {
+ this.guid = t?.tguid
+ this.date = t?.starttime
+ this.tsGuid = taskId
+ this.totalTaskNum = total
+ this.completeTaskNum = complete
+ this.changedTaskNum = changed
+ this.check = check
+ this.totalProblemNum = totalProblemNum
+ this.changedProblemNum = changedProblemNum
+ this.progressPerUser = userProgressMap.entries.map { it.value }
+ })
}
return resultList
@@ -379,9 +482,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 +505,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 +557,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 +601,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()
@@ -522,25 +625,25 @@
val criteria2 = example.createCriteria()
criteria2.orBetween(
- "endtime",
- startDate,
- endDate
+ "endtime",
+ startDate,
+ endDate
).andIsNull("tsguid");
if (userType == "1") {
criteria2.andLike("executorguids", "%$guid%")
- } else if (userType == "2"){
+ } else if (userType == "2") {
criteria2.andEqualTo("districtcode", districtCode)
}
example.or(criteria2)
val criteria3 = example.createCriteria()
criteria3.orLessThan("starttime", startDate).andGreaterThan(
- "endtime",
- endDate
+ "endtime",
+ endDate
).andIsNull("tsguid");
if (userType == "1") {
criteria3.andLike("executorguids", "%$guid%")
- } else if (userType == "2"){
+ } else if (userType == "2") {
criteria3.andEqualTo("districtcode", districtCode)
}
example.or(criteria3)
@@ -587,7 +690,7 @@
}
return taskVoList
}
-
+
override fun save(task: Task): Int {
// FIXME: 2021/10/9 鎸夌収褰撳墠鐨勯�昏緫锛屾鍑芥暟涓昏鐢ㄤ簬鏂板缓椤跺眰浠诲姟浠ュ強鏃ヤ换鍔★紝浣嗘槸鏃ヤ换鍔″唴瀹圭殑鐢熸垚閫昏緫鐩墠鐢卞墠绔痑pp瀹屾垚锛屽洜姝や細鍑虹幇涓�涓猙ug锛�
// FIXME: 2021/10/9 褰撳墠绔涓敤鎴峰悓鏃跺湪鍚屼竴涓《灞備换鍔′笅鐨勬柊鐨勪竴澶╁垱寤轰换鍔℃椂锛屼細鍑虹幇鍚屼竴澶╂湁澶氫釜鏃ヤ换鍔★紝姝ゆ椂鍓嶇鍚庣画鏌ョ湅鍙兘鐪嬪埌鍏朵腑涓�涓棩浠诲姟涓嬬殑瀛愪换鍔�
@@ -595,6 +698,7 @@
// FIXME: 2021/10/9 鍙﹀瀵逛簬椤跺眰浠诲姟涔熸坊鍔犵被浼奸�昏緫锛岀敱浜庨《灞備换鍔$殑浠诲姟鍚嶇О榛樿绯荤粺鑷姩鐢熸垚锛屽洜姝ゆ殏鏃跺彧鍒ゆ柇鍚屽悕鐨勯《灞備换鍔★紝褰撳瓨鍦ㄥ悓鍚嶉《灞備换鍔℃椂锛屼笉鍋氫繚瀛樻搷浣�
var result = 0
+ if (task.tguid == null) task.tguid = UUIDGenerator.generate16ShortUUID()
// 1銆侀鍏堝垽鏂槸椤跺眰浠诲姟杩樻槸鏃ヤ换鍔�
if (task.levelnum == 2) {
//2.1銆� 鏄《灞備换鍔℃椂锛屽垽鏂槸鍚﹀凡鏈夊悓鍚嶄换鍔�
@@ -608,7 +712,7 @@
}
} else {
//3.1銆� 褰撴槸鏃ヤ换鍔℃椂锛屽垽鏂湪鍚屼竴涓《灞備换鍔′笅锛屾槸鍚︽湁鍚屽悕鐨勬棩浠诲姟
- val r =taskMapper.selectByExample(Example(Task::class.java).apply {
+ val r = taskMapper.selectByExample(Example(Task::class.java).apply {
createCriteria().andEqualTo("tsguid", task.tsguid)
.andEqualTo("name", task.name)
})
@@ -634,6 +738,14 @@
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
@@ -646,7 +758,7 @@
BeanUtils.copyProperties(it, subtask)
subtask.planstarttime = task.starttime
subtask.planendtime = task.endtime
- subtaskService.update(subtask)
+ subtaskService.changeStatus(subtask)
}
}
return re
@@ -665,7 +777,7 @@
criteria.andIsNull("tsguid")
example.orderBy("starttime").asc()
val result = taskMapper.selectByExample(example)
- if (result.isNotEmpty()){
+ if (result.isNotEmpty()) {
result.forEach {
var mytotalcount = 0
var mycompletecount = 0
@@ -692,7 +804,7 @@
taskProgressVo.mycompletetask = mycompletecount
val daytaskVolist = getDayTaskByTaskID(it.tguid!!)
val daytasklist = mutableListOf<TaskVo>()
- if (daytaskVolist.isNotEmpty()){
+ if (daytaskVolist.isNotEmpty()) {
daytaskVolist.forEach {
var mytotalcount1 = 0
var mycompletecount1 = 0
@@ -704,7 +816,7 @@
if (Objects.equals(it.status!!, Constant.TaskProgress.RUNINGSTATUS3.text))
mycompletecount1++
}
- if(Objects.equals(it.status, Constant.TaskProgress.RUNINGSTATUS3.text))
+ if (Objects.equals(it.status, Constant.TaskProgress.RUNINGSTATUS3.text))
completecount1++
}
val daytaskProgressVo = TaskVo()
@@ -729,4 +841,53 @@
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
+ val countByScene = mutableMapOf<String?, Int>()
+ val allScenes = sceneRep.findSceneList(t.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
+ taskRep.findMonitorList(t.tguid!!, areaVo.scensetypeid).forEach {
+ val c = it.monitornum ?: 1
+ count += c
+
+ allScenes.find { s-> s?.guid == it.sguid }?.let { s->
+// if (!countByScene.containsKey(s.type)) {
+// countByScene[s.type] = 0
+// }
+ countByScene[s.type] = (countByScene[s.type] ?: 0) + c
+ }
+ }
+ totaltask = count
+ totaltaskByScene = countByScene
+
+ subTaskSummary = subTaskRep.findSummary(AreaVo().apply {
+ topTaskId = t.tguid
+ })
+ val completeByScene = mutableMapOf<String?, Int>()
+ subTaskSummary?.forEach {
+ completeByScene[it.sceneType] = (completeByScene[it.sceneType] ?: 0) + 1
+ }
+ completetask = this.subTaskSummary?.size
+ completetaskByScene = completeByScene
+ }
+ res.add(pro)
+ }
+ return res
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3