From b212ef0208cb094f63ea8a239a1361f8e859c839 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期一, 08 七月 2024 17:40:39 +0800 Subject: [PATCH] 2024.7.8 --- src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 41 insertions(+), 4 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..5c3c05a 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,10 +70,10 @@ 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)}鑷姩璇勫垎" @@ -69,7 +93,7 @@ } return bgTask.taskStatus } else { - throw ResponseErrorException("宸℃煡鎬讳换鍔′笉瀛樺湪锛屾棤娉曡瘎浼�") + throw BizException("宸℃煡鎬讳换鍔′笉瀛樺湪锛屾棤娉曡瘎浼�") } } @@ -78,4 +102,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