From 85ef942e7195abeb71466b7159c3ee30161e1e54 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 07 四月 2026 08:51:01 +0800
Subject: [PATCH] 2026.4.7
---
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt | 41 ++++++++++++++++++++++++++++++-----------
1 files changed, 30 insertions(+), 11 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 7fd361b..987fb06 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
@@ -21,6 +21,8 @@
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
@@ -335,11 +337,14 @@
// 鑾峰彇鎬讳换鍔′笅鎵�鏈夌殑瀛愪换鍔�
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 })
- })
+ val sceneList = if (subTasks.isEmpty()) {
+ emptyList()
+ } else {
+ scenseMapper.selectByExample(Example(Scense::class.java).apply {
+ createCriteria().andIn("guid", subTasks.map { it?.scenseid })
+ })
+ }
//鏍规嵁sql鏉′欢鏌ヨ
dayTasks.forEach { t ->
@@ -375,7 +380,7 @@
val userProgressMap = mutableMapOf<String, ProgressPerUserPerDay>()
filterSubTasks.forEach fst@{ fst ->
fst ?: return@fst
- // fixme 2025.11.30 鐢变簬鐩戠APP鐨刡ug锛屽鑷寸敤鎴峰彲浠ヤ笉閫夋嫨鎵ц浜哄憳鐩存帴鍒涘缓浠诲姟锛屾墍浠ユ殏鏃跺皢娌℃湁鎵ц浜哄憳鐨勪换鍔″畾涔変负鍖垮悕鐢ㄦ埛
+ // 2026.2.2 灏嗘病鏈夋墽琛屼汉鍛樼殑浠诲姟瀹氫箟涓哄尶鍚嶇敤鎴�
if (fst.executorguids.isNullOrBlank()) {
fst.executorguids = "niming"
fst.executorusernames = "niming"
@@ -398,27 +403,41 @@
// 褰撳涓汉涓�璧锋墽琛屽悓涓�浠诲姟鏃讹紝骞冲垎宸℃煡閲�
this.totalTaskNum += 1.0 / ids.size
if (fst.status == Constant.TaskProgress.RUNINGSTATUS3.text) {
+ this.completeTaskNum += 1.0 / ids.size
}
- 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 <= 1
+ it.ischanged == true && day <= 2
}.size.toDouble() / ids.size
// 姝ゅ鍏堢疮璁″贰鏌ユ椂闀匡紝鏈�鍚庡啀鏍规嵁浠诲姟鏁伴噺骞冲潎
- this.avgInspectionTime +=
- ((fst.executionendtime?.time ?: 0L) - (fst.executionstarttime?.time ?: 0L)).div(1000).div(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 = (u.avgInspectionTime / u.completeTaskNum).toLong()
+ u.avgInspectionTime = if (u.completeTaskNum == .0 ) 0 else (u.avgInspectionTime / u.completeTaskNum).toLong()
u.formatParam()
}
@@ -725,7 +744,7 @@
override fun create(task: Task): Task {
val res = save(task)
if (res < 1)
- throw BizException("浠诲姟鍒涘缓澶辫触")
+ throw BizException("鎬讳换鍔℃垨褰撴棩浠诲姟鍒涘缓澶辫触")
else
return task
}
--
Gitblit v1.9.3