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/bgtask/AopTaskCtrl.kt | 50 ++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
index bd04aa1..4de46d6 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
@@ -4,7 +4,7 @@
import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig
import cn.flightfeather.supervision.business.autooutput.score.AopCreditCode
import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
-import cn.flightfeather.supervision.common.exception.ResponseErrorException
+import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
import cn.flightfeather.supervision.common.executor.BgTaskStatus
import cn.flightfeather.supervision.common.executor.BgTaskType
@@ -12,6 +12,7 @@
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import org.springframework.stereotype.Component
+import java.time.LocalDateTime
/**
* 鑷姩璇勪及浠诲姟绠$悊
@@ -39,6 +40,29 @@
dataAnalysisMap["310116"]?.put(Constant.SceneType.TYPE3.value.toInt(), jsMpDataAnalysis)
}
+ fun startAllEvaluation(time: LocalDateTime) {
+ startEvaluation(getArea(time, "310106", "闈欏畨鍖�", Constant.SceneType.TYPE1))
+ startEvaluation(getArea(time, "310104", "寰愭眹鍖�", Constant.SceneType.TYPE5))
+ startEvaluation(getArea(time, "310116", "閲戝北鍖�", Constant.SceneType.TYPE1))
+ startEvaluation(getArea(time, "310116", "閲戝北鍖�", Constant.SceneType.TYPE2))
+ startEvaluation(getArea(time, "310116", "閲戝北鍖�", Constant.SceneType.TYPE3))
+ }
+
+ fun startEvaluation(areaVo: AreaVo) {
+ val task = taskRep.findOneTask(areaVo)
+ val taskId = task?.tguid
+ val sceneType = areaVo.scensetypeid?.toInt() ?: throw BizException("鍦烘櫙绫诲瀷鏈缃紝鏃犳硶璇勪及")
+ aopEvaluation.executeByTopTask(taskId, sceneType)
+ }
+
+ fun startAll(time: LocalDateTime) {
+ startNewTask(getArea(time, "310106", "闈欏畨鍖�", Constant.SceneType.TYPE1))
+ startNewTask(getArea(time, "310104", "寰愭眹鍖�", Constant.SceneType.TYPE5))
+ startNewTask(getArea(time, "310116", "閲戝北鍖�", Constant.SceneType.TYPE1))
+ startNewTask(getArea(time, "310116", "閲戝北鍖�", Constant.SceneType.TYPE2))
+ startNewTask(getArea(time, "310116", "閲戝北鍖�", Constant.SceneType.TYPE3))
+ }
+
fun startNewTask(areaVo: AreaVo): BgTaskStatus {
val task = taskRep.findOneTask(areaVo)
val taskId = task?.tguid
@@ -46,18 +70,19 @@
val districtCode = areaVo.districtcode
val districtName = areaVo.districtname
// val d = LocalDateTime.parse(areaVo.starttime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
- val d = areaVo.starttime ?: throw ResponseErrorException("鑷姩璇勪及浠诲姟蹇呴』璁惧畾鏃堕棿")
+ val d = areaVo.starttime ?: throw BizException("鑷姩璇勪及浠诲姟蹇呴』璁惧畾鏃堕棿")
val year = d.year
val month = d.monthValue
- val sceneType = areaVo.scensetypeid?.toInt() ?: throw ResponseErrorException("鍦烘櫙绫诲瀷鏈缃紝鏃犳硶璇勪及")
+ val sceneType = areaVo.scensetypeid?.toInt() ?: throw BizException("鍦烘櫙绫诲瀷鏈缃紝鏃犳硶璇勪及")
val id = "${BgTaskType.AUTO_SCORE.name}-${districtCode}-${sceneType}"
val name = "${districtName}${Constant.SceneType.getDes(sceneType)}鑷姩璇勫垎"
val bgTask = backgroundTaskCtrl.startNewTask(BgTaskType.AUTO_SCORE, id, name) {
+ // 鐩戞祴鏁版嵁鍒嗘瀽鍏ュ簱
dataAnalysis(districtCode, sceneType, taskId, year, month)
-
+ // 鑷姩璇勪及璁$畻鍏ュ簱
aopEvaluation.executeByTopTask(taskId, sceneType)
-
+ // 鐜俊鐮佺粨鏋滆浆鎹㈠叆搴�
aopCreditCode.execute(AopDataConfig(
year = year,
month = month,
@@ -69,7 +94,7 @@
}
return bgTask.taskStatus
} else {
- throw ResponseErrorException("宸℃煡鎬讳换鍔′笉瀛樺湪锛屾棤娉曡瘎浼�")
+ throw BizException("宸℃煡鎬讳换鍔′笉瀛樺湪锛屾棤娉曡瘎浼�")
}
}
@@ -78,4 +103,17 @@
aopDataAnalysis?.setResource(taskId, sceneType, year, month)
aopDataAnalysis?.execute()
}
+
+ fun getArea(time: LocalDateTime, dCode: String, dName: String, sceneType: Constant.SceneType): AreaVo {
+ return AreaVo().apply {
+ provincecode = "31"
+ provincename = "涓婃捣甯�"
+ citycode = "3100"
+ cityname = "涓婃捣甯�"
+ starttime = time
+ districtcode = dCode
+ districtname = dName
+ scensetypeid = sceneType.value
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3