From 1a677d2b4a4bc615602f8c2a22bc07ec1356e5be Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 16 十月 2025 17:39:06 +0800
Subject: [PATCH] 2025.10.16 1. 根据全局响应增强器GlobalResponseAdvice,将原先的BaseResPack接口包装函数统一去除; 2. 新增三种类型的数据产品数据库实体 3. 新增典型问题场景清单中间数据产品接口
---
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt | 47 ++++++++++++++++++++++++++++++++++++++---------
1 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt
index 874a17b..8c3cded 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt
@@ -7,8 +7,9 @@
import java.time.Duration
import java.time.LocalDateTime
import java.time.ZoneId
+import java.time.temporal.ChronoUnit
-class ColStrategy : BaseCols() {
+class ColStrategy(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
return mutableListOf(mutableListOf(
ExcelUtil.MyCell("鏁存敼璺熻釜鎻愰啋")
@@ -16,7 +17,7 @@
}
override fun onOneRow(rowData: DataSource.RowData): List<Any> {
- if (rowData.problems.isEmpty()) return listOf("")
+ if (rowData.noRecord()) return listOf("")
val strategyList = listOf(
"1銆佸瓨鍦ㄩ棶棰樿秴鏈�3澶╀笉婊�7澶╂湭鏁存敼锛岀敱绯荤粺鎺ㄩ�佹暣鏀规彁閱掞紱",
@@ -40,29 +41,32 @@
continue
}
val pTime = LocalDateTime.ofInstant(p.time?.toInstant(), ZoneId.systemDefault())
- val duration = Duration.between(pTime.toLocalDate(), now)
- val day = duration.toDays()
+ val day = pTime.toLocalDate().until(now.toLocalDate(), ChronoUnit.DAYS)
when {
+ //1銆佸瓨鍦ㄩ棶棰樿秴鏈�3澶╀笉婊�7澶╂湭鏁存敼锛岀敱绯荤粺鎺ㄩ�佹暣鏀规彁閱掞紱
day in 3..6 -> {
result += strategyList[0] + "\n"
break
}
+ //2銆佸瓨鍦ㄩ棶棰樿秴鏈�7澶╂湭鏁存敼锛岀敱鎶�鏈湇鍔¢儴绾夸笂鐫d績锛�
day > 6 -> {
result += strategyList[1] + "\n"
break
}
}
}
+ //3銆佸贰鏌ュ悗10澶╂垨鏈堟湯鍓�3澶╋紝闂鏁存敼鐜囦綆浜�50%锛岀敱鏁版嵁搴旂敤閮ㄤ竴瀵逛竴鐫d績锛屽苟浜庝富绠¢儴闂ㄨ仈鍔紱
//鏁存敼鐜�
val cPer = cPros.toDouble() / rowData.problems.size
//宸℃煡鏃堕棿
val sTime = LocalDateTime.ofInstant(rowData.subTask?.planstarttime?.toInstant(), ZoneId.systemDefault())
- val day1 = Duration.between(sTime.toLocalDate(), now).toDays()
+ val day1 = sTime.toLocalDate().until(now.toLocalDate(), ChronoUnit.DAYS)
val lastDayOfMon = now.plusMonths(1).withDayOfMonth(1).minusDays(1)
- val day2 = Duration.between(lastDayOfMon.toLocalDate(), now.toLocalDate()).toDays()
+ val day2 = lastDayOfMon.toLocalDate().until(now.toLocalDate(), ChronoUnit.DAYS)
if (cPer < .5 && (day1 >= 10 || day2 <= 3)) result += strategyList[2] + "\n"
+ //4銆侀棶棰樺鏍告垨鏁存敼瀹℃牳鏈紑灞曟垨闂瀹℃牳杈冨贰鏌ユ椂闂村欢鍚�24灏忔椂浠ヤ笂鎴栭棶棰樹笌鏁存敼鏃堕棿闂撮殧瓒呰繃涓�鍛紝椤圭洰绠$悊浜哄憳搴斿強鏃跺紑灞曞鏍告垨鍚庣画搴旀彁鍗囧鏍告椂鏁堟�э紱
//瀹℃牳
for (p in rowData.problems) {
//闂瀹℃牳鎴栨暣鏀瑰鏍告湭寮�灞�
@@ -80,7 +84,7 @@
if (p.changedtime != null) {
val ct = LocalDateTime.ofInstant(p.changedtime?.toInstant(), ZoneId.systemDefault())
val pt = LocalDateTime.ofInstant(p.time?.toInstant(), ZoneId.systemDefault())
- if (Duration.between(pt.toLocalDate(), ct.toLocalDate()).toDays() > 7) {
+ if (pt.toLocalDate().until(ct.toLocalDate(), ChronoUnit.DAYS) > 7) {
result += strategyList[3] + "\n"
break
}
@@ -89,21 +93,46 @@
}
+ //5銆佸彴璐︽湭鎸夋椂鎻愪氦锛岀敱鎶�鏈湇鍔¢儴涓�瀵逛竴鐫d績锛�
//鍙拌处
val rNum = rowData.ledgerRecords.size
if (rNum == 0) result += strategyList[4] + "\n"
+ //6銆佸彴璐﹀凡閮ㄥ垎鎻愪氦锛屾彁浜ゆ瘮渚嬩笉瓒�100%鐨勶紝鐢辨暟鎹簲鐢ㄩ儴涓�瀵逛竴鐫d績锛�
if (rNum != 0 && rNum < rowData.ledgerCount) result += strategyList[5] + "\n"
//7銆佸綋鏈堥棶棰樻暟瓒�3涓笖鍏ㄩ儴鏈暣鏀规垨杩炵画涓ゆ湀闂鏁存敼鐜囦綆浜�50%鐨勫満鏅紝鍒椾负閲嶇偣鐩戠锛岀敱鎶�鏈湇鍔¢儴褰撴湀澧炲姞涓嶅皯浜庝竴娆$幇鍦哄鏍革紱
+ val lastMonData = rowData.lastOne()
if (rowData.problems.size > 3 && cPros == 0) {
result += strategyList[6] + "\n"
} else if (cPer < .5) {
-
+ if (!lastMonData.noRecord()) {
+ var lastCPer = 0
+ lastMonData.problems.forEach {
+ if (it.ischanged == true) {
+ lastCPer++
+ }
+ }
+ if (lastMonData.problems.size != 0 && (lastCPer.toDouble() / lastMonData.problems.size > .5)) {
+ result += strategyList[6] + "\n"
+ }
+ }
}
//8銆佽繛缁袱鏈堝彴璐︽彁浜ゆ瘮渚嬩綆浜�50%鐨勶紝鐢辨妧鏈湇鍔¢儴褰撴湀澧炲姞涓�娆$幇鍦烘垨绾夸笂鎿嶄綔鎸囧锛�
+ val thisMonLedgerPer = rowData.ledgerRecords.size.toDouble() / rowData.ledgerCount
+ if (thisMonLedgerPer < .5) {
+ val lastMonLedgerPer = lastMonData.ledgerRecords.size.toDouble() / lastMonData.ledgerCount
+ if (lastMonLedgerPer < .5) {
+ result += strategyList[7] + "\n"
+ }
+ }
//9銆佸彴璐﹀鏍歌緝鎻愪氦鏃堕棿寤跺悗5鏃ヤ互涓婃垨鏈堟湯鍓�3鏃ヤ粛鏈鏍哥殑锛岀敱鏁版嵁搴旂敤閮ㄥ強鏃跺紑灞曪紱
+ // TODO: 2022/7/26
- return strategyList
+ if (result.isNotEmpty()) {
+ result = result.substring(0, result.length - 2)
+ }
+
+ return listOf(result)
}
}
\ No newline at end of file
--
Gitblit v1.9.3