From 6904763f0e74d9a9fa4dbc39f635d2aee39416c6 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 30 九月 2025 09:34:22 +0800
Subject: [PATCH] 2025.9.30
---
src/test/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustDataTest.kt | 2
src/main/kotlin/cn/flightfeather/supervision/common/risk/RiskAssessment.kt | 28 +++++++++----
src/main/kotlin/cn/flightfeather/supervision/common/score/EvaluationUtil.kt | 10 ++--
src/main/kotlin/cn/flightfeather/supervision/config/WebMvcConfig.kt | 2
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/RiskServiceImpl.kt | 2
src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt | 13 +++++-
src/main/kotlin/cn/flightfeather/supervision/lightshare/CORSFilter.kt | 5 +-
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ConfigController.kt | 2
src/main/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustData.kt | 2
src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt | 3 +
src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt | 5 +-
src/main/kotlin/cn/flightfeather/supervision/bgtask/TaskController.kt | 4 +
12 files changed, 51 insertions(+), 27 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt b/src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt
index f70f3d8..52d1c3a 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt
@@ -32,11 +32,12 @@
taskController.run()
// 2023.8.20 搴旂敤浜庡畨鍗揳pp鍚庡彴锛屽悗缁簲璇ュ悎骞朵簬灏忕▼搴忓悗鍙�
if (mode == "proapp") {
- webSocketServer.start()
+// webSocketServer.start()
}
// 搴旂敤浜庡井淇″皬绋嬪簭鍚庡彴
else if (mode == "pro") {
wxTokenManager.run()
+ webSocketServer.start()
}
println("mode: $mode")
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/bgtask/TaskController.kt b/src/main/kotlin/cn/flightfeather/supervision/bgtask/TaskController.kt
index c5cc611..eac8cf8 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/bgtask/TaskController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/bgtask/TaskController.kt
@@ -45,9 +45,11 @@
timeTask.clear()
//椋炵窘鐜锛岃幏鍙杤oc鏁版嵁銆佹帹閫佹补鐑熸暟鎹�
if (mode == "proapp") {
+// timeTask.add(fetchVOC)
+// timeTask.add(pushFume)
+ } else if (mode == "pro") {
timeTask.add(fetchVOC)
timeTask.add(pushFume)
- } else if (mode == "pro") {
//寰俊灏忕▼搴忥紙涓皬浼佷笟瀹堟硶鑷姪锛夛紝鍙拌处澶嶅埗銆佸畾鏃朵换鍔℃帹閫佺瓑
// timeTask.add(ledgerCopy)
timeTask.add(ledgerRemind)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustData.kt b/src/main/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustData.kt
index 8b30104..041da2d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustData.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustData.kt
@@ -28,7 +28,7 @@
*/
fun handle() {
val end = LocalDate.now().atStartOfDay()
- val start = end.minusDays(7)
+ val start = end.withDayOfMonth(1)
handle(start, end)
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/risk/RiskAssessment.kt b/src/main/kotlin/cn/flightfeather/supervision/common/risk/RiskAssessment.kt
index 37c82ac..af18c99 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/risk/RiskAssessment.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/risk/RiskAssessment.kt
@@ -2,6 +2,7 @@
import cn.flightfeather.supervision.common.score.EvaluationUtil
import cn.flightfeather.supervision.domain.entity.Evaluation
+import cn.flightfeather.supervision.domain.entity.Evaluationrule
import cn.flightfeather.supervision.domain.entity.Userinfo
import cn.flightfeather.supervision.infrastructure.utils.DateUtil
import com.github.pagehelper.PageHelper
@@ -33,24 +34,33 @@
fun getResult(user: Userinfo, config: DataSource.Config, dbMapper: DbMapper): Triple<Boolean, Int?, String> {
reset()
- val sTime = LocalDateTime.of(config.year, config.month, 1, 0, 0, 0, 0)
- val eTime = sTime.plusMonths(1)
+ val rule = dbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
+ createCriteria().andEqualTo("scensetypeid", config.sceneType)
+ .andEqualTo("ruletype", 0)
+ }).takeIf { it.isNotEmpty() }?.get(0)
+
+ // 鏍规嵁璇勪及鐨勬彁浜ゅ懆鏈燂紙鍗曚綅锛氭湀锛夛紝璁$畻瀵瑰簲鐨勬湀浠借寖鍥�
+ val period = rule?.scensesubtypeid?.toInt() ?: 1
+ // 鎻愪氦鍛ㄦ湡涓嬬殑璧锋鏈堜唤
+ val startM = DateUtil.getStartMonthByPeriod(config.month, period)
+ val endM = startM?.plus(period)?.minus(1)
+
+ // 鏌ヨ寮�濮嬫椂闂翠负鍛ㄦ湡涓嬬殑棣栦釜鏈堜唤
+ val sTime = LocalDateTime.of(config.year, startM ?: config.month, 1, 0, 0, 0, 0)
+ // 鏌ヨ缁撴潫鏃堕棿涓虹粺璁$殑鏈堜唤
+ val eTime = LocalDateTime.of(config.year, config.month, 1, 0, 0, 0, 0)
+ .plusMonths(1).minusSeconds(1)
PageHelper.startPage<Evaluation>(1, 1)
val result = dbMapper.evaluationMapper.selectByExample((Example(Evaluation::class.java).apply {
createCriteria().andEqualTo("evaluatorguid", user.guid)
.andEqualTo("ertype", 0)
-// .andBetween("createdate", sTime, eTime)
+ .andBetween("createdate", sTime, eTime)
orderBy("createdate").desc()
}))
if (result.isEmpty()) {
return Triple(false, null, "/")
} else {
- val rule = dbMapper.evaluationruleMapper.selectByPrimaryKey(result[0].stguid)
- totalScore = rule.resultrange?.toInt() ?: 0
- // 鏍规嵁璇勪及鐨勬彁浜ゅ懆鏈燂紙鍗曚綅锛氭湀锛夛紝璁$畻瀵瑰簲鐨勬湀浠借寖鍥�
- val period = rule.scensesubtypeid?.toInt() ?: 1
- val startM = DateUtil.getStartMonthByPeriod(config.month, period)
- val endM = startM?.plus(period)?.minus(1)
+ totalScore = rule?.resultrange?.toInt() ?: 0
// 璁$畻璇勪及璁板綍瀵瑰簲鐨勫懆鏈燂紙鍝勾鐨勫嚑鏈堝埌鍑犳湀锛�
val list1 = result[0].scensename?.split("/") ?: return Triple(false, null, "/")
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/score/EvaluationUtil.kt b/src/main/kotlin/cn/flightfeather/supervision/common/score/EvaluationUtil.kt
index f03ee76..cff5fdb 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/score/EvaluationUtil.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/score/EvaluationUtil.kt
@@ -10,15 +10,15 @@
var evaluateLevel: String = ""
}
- fun getEvaluationLevel(totalPoint: Int, rule: Evaluationrule): EvaluationLevel {
+ fun getEvaluationLevel(totalPoint: Int, rule: Evaluationrule?): EvaluationLevel {
val pointLevel = mutableListOf<Pair<Int, Int>>()
- rule.extension1?.split("#")?.forEach {
+ rule?.extension1?.split("#")?.forEach {
val pStr = it.split(",")
pointLevel.add(Pair(pStr[0].toInt(), pStr[1].toInt()))
}
- val evaluateLevel = rule.extension2?.split("#") ?: emptyList()
- val creditTexts = rule.extension3?.split("#") ?: emptyList()
- val levelColors = rule.remark?.split(";") ?: emptyList()
+ val evaluateLevel = rule?.extension2?.split("#") ?: emptyList()
+ val creditTexts = rule?.extension3?.split("#") ?: emptyList()
+ val levelColors = rule?.remark?.split(";") ?: emptyList()
val result = EvaluationLevel()
if (pointLevel.isEmpty() || evaluateLevel.isEmpty() || creditTexts.isEmpty() || levelColors.isEmpty()) {
diff --git a/src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt b/src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt
index 50a22c2..0144822 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt
@@ -6,7 +6,8 @@
import org.springframework.web.cors.UrlBasedCorsConfigurationSource
import org.springframework.web.filter.CorsFilter
-@Configuration
+@Deprecated("浣跨敤tomcat鐨剋eb.xml閰嶇疆璺ㄥ煙")
+//@Configuration
class CorsConfig {
private fun buildConfig(): CorsConfiguration {
@@ -18,7 +19,7 @@
}
}
- @Bean
+// @Bean
fun corsFilter(): CorsFilter {
val source = UrlBasedCorsConfigurationSource().apply {
registerCorsConfiguration("/**", buildConfig())
diff --git a/src/main/kotlin/cn/flightfeather/supervision/config/WebMvcConfig.kt b/src/main/kotlin/cn/flightfeather/supervision/config/WebMvcConfig.kt
index 0858240..84fc6b8 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/config/WebMvcConfig.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/config/WebMvcConfig.kt
@@ -7,7 +7,7 @@
/**
* web閰嶇疆
*/
-@Configuration
+//@Configuration
class WebMvcConfig : WebMvcConfigurer {
override fun addInterceptors(registry: InterceptorRegistry) {
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/CORSFilter.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/CORSFilter.kt
index b7d0861..e20adea 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/CORSFilter.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/CORSFilter.kt
@@ -16,8 +16,9 @@
* @author riku
* Date: 2020/8/11
*/
-@Order(1)
-@WebFilter(filterName = "corsFilter", urlPatterns = ["/*"])
+@Deprecated("浣跨敤tomcat鐨剋eb.xml閰嶇疆璺ㄥ煙")
+//@Order(1)
+//@WebFilter(filterName = "corsFilter", urlPatterns = ["/*"])
class CORSFilter : Filter {
@Throws(ServletException::class)
override fun init(filterConfig: FilterConfig) {
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/RiskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/RiskServiceImpl.kt
index dcc24fc..fc17b27 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/RiskServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/RiskServiceImpl.kt
@@ -100,7 +100,7 @@
val riskAnalysis = RiskAnalysis(dataSource, toDatabase = false, toFile = true)
// val fName = Base64.getEncoder().encodeToString("risk.xlsx".toByteArray())
- val fName = "risk.xls"
+ val fName = "${year}-${month} risk.xls"
response.apply {
setHeader("Content-Disposition", "attachment;filename=$fName")
setHeader("fileName", fName)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ConfigController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ConfigController.kt
index 44bd7d3..1f221f4 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ConfigController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ConfigController.kt
@@ -25,7 +25,7 @@
@ApiParam("鏌ヨ鏉′欢") @RequestBody condition: UserSearchCondition,
) = resPack { configService.getCommitmentTemplate(condition) }
- @ApiOperation(value = "鑾峰彇鐢ㄦ埛绫诲瀷鍙敤鐨勫満鏅寖鍥�")
+ @ApiOperation(value = "鑾峰彇鐢ㄦ埛鐨勬潈闄愰厤缃俊鎭�")
@GetMapping("/user/config")
fun getUserConfig(
@ApiParam("鐢ㄦ埛id") @RequestParam("userId") userId: String,
diff --git a/src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt b/src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt
index 9c199ba..5fe3032 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/scheduler/ScheduleService.kt
@@ -8,6 +8,7 @@
import org.springframework.scheduling.annotation.Async
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Component
+import java.time.LocalDate
import java.time.LocalDateTime
/**
@@ -32,7 +33,6 @@
@Async
@Scheduled(cron = "0 0 * * * *")
fun eachHour() {
- if (mode != "proapp") return
logger.info("=====>>>>>姣忓皬鏃朵换鍔℃墽琛� {}", System.currentTimeMillis())
taskJinAnHourlyDustData.doTask(LocalDateTime.now())
logger.info("=====>>>>>姣忓皬鏃朵换鍔$粨鏉� {}", System.currentTimeMillis())
@@ -49,9 +49,18 @@
@Async
@Scheduled(cron = "0 0 0 * * SUN")
fun eachSunday() {
- if (mode != "proapp") return
logger.info("=====>>>>>姣忓懆鏃ラ浂鐐逛换鍔℃墽琛� {}", System.currentTimeMillis())
mTaskJinAnHourlyDustData.handle()
logger.info("=====>>>>>姣忓懆鏃ラ浂鐐逛换鍔$粨鏉� {}", System.currentTimeMillis())
}
+
+ @Async
+ @Scheduled(cron = "0 0 3 1 * *")
+ fun eachMonth() {
+ logger.info("=====>>>>>姣忔湀鍒濅换鍔℃墽琛� {}", System.currentTimeMillis())
+ // 鎵ц涓婁釜鏈堢殑闈欏畨宸ュ湴鎵皹鏁版嵁琛ュ叏浠诲姟
+ val now = LocalDate.now().minusMonths(1)
+ mTaskJinAnHourlyDustData.handle(now.year, now.monthValue)
+ logger.info("=====>>>>>姣忔湀鍒濅换鍔$粨鏉� {}", System.currentTimeMillis())
+ }
}
\ No newline at end of file
diff --git a/src/test/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustDataTest.kt b/src/test/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustDataTest.kt
index e3ef1c3..339a495 100644
--- a/src/test/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustDataTest.kt
+++ b/src/test/kotlin/cn/flightfeather/supervision/bgtask/maintenance/MTJinAnHourlyDustDataTest.kt
@@ -20,7 +20,7 @@
@Test
fun handleMonth() {
- mTJinAnHourlyDustData.handle(2024, 5)
+ mTJinAnHourlyDustData.handle(2025, 5)
}
@Test
--
Gitblit v1.9.3