c66ed91b47929f1fbb79afbf07db1f3387f92612..8f069a80ed15dd431450f58304513aa3985e62ba
2023-11-14 feiyu02
1. 新增风险值的查询逻辑;
8f069a 对比 | 目录
2023-11-14 feiyu02
1. 新增风险值的自动运行逻辑;
aa94ef 对比 | 目录
已修改14个文件
已删除3个文件
已添加4个文件
363 ■■■■■ 文件已修改
src/main/java/com/flightfeather/monitor/MonitorApplication.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionAnalysisController.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/analysis/dust/RiskAnalysisController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/analysis/dust/RiskAnalysisController.kt 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/analysis/dust/StatisticAnalysisController.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/analysis/dust/risk/DustRiskAnalysis.kt 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/analysis/dust/risk/DustRiskMonthAnalysis.kt 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/controller/dust/RiskValueController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/domain/ds1/repository/RiskValueRep.kt 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/pojo/Result.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/scheduledtasks/TaskController.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/scheduledtasks/dust/BaseDustTimingTask.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/scheduledtasks/dust/RiskDailyAnalysisTask.kt 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/scheduledtasks/dust/RiskMonthlyAnalysisTask.kt 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/service/RiskAnalysisService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/service/RiskValueService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/service/impl/RiskAnalysisServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/service/impl/RiskValueServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/utils/UUIDGenerator.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/flightfeather/monitor/analysis/dust/RiskAnalysisControllerTest.kt 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/flightfeather/monitor/MonitorApplication.java
@@ -18,7 +18,7 @@
        return new ApplicationRunner() {
            @Override
            public void run(ApplicationArguments args) throws Exception {
//                taskController.run();
                taskController.run();
            }
        };
    }
src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionAnalysisController.kt
@@ -24,7 +24,7 @@
    private val dustSiteStatusRep: DustSiteStatusRep,
) {
    private var running = false
    var running = false
    private val taskList = mutableListOf<BaseDustExceptionAnalysis>()
src/main/java/com/flightfeather/monitor/analysis/dust/RiskAnalysisController.java
ÎļþÒÑɾ³ý
src/main/java/com/flightfeather/monitor/analysis/dust/RiskAnalysisController.kt
@@ -22,8 +22,8 @@
    private val dustStatisticValueRep: DustStatisticsValueRep,
) {
    private var running1 = false
    private var running2 = false
    var running1 = false
    var running2 = false
    private var taskDaily: DustRiskAnalysis? = null
    private var taskMonthly: DustRiskMonthAnalysis? = null
@@ -75,7 +75,7 @@
        // èŽ·å–æ‰€æœ‰å½“å‰ä¸Šçº¿å’Œåœè¿çš„è®¾å¤‡
        dustSiteStatusRep.select(listOf(DeviceStatus.ONLINE, DeviceStatus.STOP)).forEach { s ->
            s?.let {
                taskDaily?.roundInit()
                taskDaily?.roundInit(s.mnCode, date)
                val dustSiteDataList = dustSiteDataRep.select(s.mnCode, date)
                val dustExceptionDataList = dustExceptionDataRep.select(s.mnCode, date)
                val dustStatisticValueList = dustStatisticValueRep.select(s.mnCode, date)
@@ -95,8 +95,8 @@
        taskMonthly?.init()
        dustSiteStatusRep.select(listOf(DeviceStatus.ONLINE, DeviceStatus.STOP)).forEach { s ->
            s?.let {
                taskMonthly?.roundInit()
                val riskValueList = riskValueRep.select(s.mnCode, date)
                taskMonthly?.roundInit(s.mnCode, date)
                val riskValueList = riskValueRep.select(s.mnCode, date, "day")
                taskMonthly?.roundCal(riskValueList)
            }
        }
src/main/java/com/flightfeather/monitor/analysis/dust/StatisticAnalysisController.kt
@@ -13,8 +13,8 @@
@Component
class StatisticAnalysisController(private val dustStatisticsValueRep: DustStatisticsValueRep) {
    private var running1 = false
    private var running2 = false
    var running1 = false
    var running2 = false
    /**
     *
src/main/java/com/flightfeather/monitor/analysis/dust/risk/DustRiskAnalysis.kt
@@ -2,6 +2,9 @@
import com.flightfeather.monitor.domain.ds1.entity.*
import com.flightfeather.monitor.enumration.dust.ExceptionType
import java.time.LocalDate
import java.time.ZoneId
import java.util.*
/**
 * æ‰¬å°˜ç›‘测数据风险分析基类
@@ -21,8 +24,12 @@
    /**
     * æ¯è½®æ¬¡çš„初始化
     */
    fun roundInit() {
        resultList.add(RiskValue())
    fun roundInit(mnCode: String, date: LocalDate) {
        resultList.add(RiskValue().apply {
            this.mnCode = mnCode
            lst = Date.from(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())
            type = "day"
        })
    }
    /**
@@ -37,7 +44,6 @@
        riskExceedRate(res, list)
        riskExceptionRepetitionRate(res, dList)
        riskExceptionType(res, dList)
        onDone(res)
    }
    /**
@@ -66,7 +72,7 @@
        var v2 = 0
        // æ—¥ä¸´è¿‘超标次数/7
        var v3 = 0
        list.forEach {d ->
        list.forEach { d ->
            if (d == null) return@forEach
            when {
                d.dustValue >= 2.0 -> v2++
@@ -92,7 +98,7 @@
        var v1 = 0
        var v2 = 0
        var v3 = 0
        list.forEach { d->
        list.forEach { d ->
            if (d == null) return@forEach
            when (d.exceptionType) {
                ExceptionType.TYPE4.value -> v1++
@@ -100,10 +106,10 @@
                ExceptionType.TYPE6.value -> v3++
            }
        }
        val e1 = upperLimit((v1 - 1) / 4.0)
        val e2 = upperLimit((v2 - 1) / 3.0)
        val e3 = upperLimit((v3 - 1) / 2.0)
        riskValue.typicalExceptionRepetitionRate = upperLimit(e1 + e2 + e3)
        val e1 = settingRange((v1 - 1) / 4.0)
        val e2 = settingRange((v2 - 1) / 3.0)
        val e3 = settingRange((v3 - 1) / 2.0)
        riskValue.typicalExceptionRepetitionRate = settingRange(e1 + e2 + e3)
    }
    /**
@@ -125,9 +131,5 @@
        riskValue.exceptionTypeAggregation = exceptionTypes.size / 6.0
    }
    fun onDone(riskValue: RiskValue) {
        riskValue.type = "day"
    }
    private fun upperLimit(d:Double):Double = if (d > 1) 1.0  else d
    private fun settingRange(d: Double): Double = if (d > 1) 1.0 else if (d < 0) .0 else d
}
src/main/java/com/flightfeather/monitor/analysis/dust/risk/DustRiskMonthAnalysis.kt
@@ -1,6 +1,9 @@
package com.flightfeather.monitor.analysis.dust.risk
import com.flightfeather.monitor.domain.ds1.entity.*
import java.time.LocalDate
import java.time.ZoneId
import java.util.*
class DustRiskMonthAnalysis(val config: DustExceptionSetting) {
@@ -17,8 +20,12 @@
    /**
     * æ¯è½®æ¬¡çš„初始化
     */
    fun roundInit() {
        resultList.add(RiskValue())
    fun roundInit(mnCode: String, date: LocalDate) {
        resultList.add(RiskValue().apply {
            this.mnCode = mnCode
            lst = Date.from(date.withDayOfMonth(1).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())
            type = "month"
        })
    }
    /**
@@ -34,7 +41,6 @@
        riskExceedRate(res, list)
        riskExceptionRepetitionRate(res, list)
        riskExceptionType(res, list)
        onDone(res)
    }
    fun riskOnlineRate(riskValue: RiskValue, list: List<RiskValue?>) {
@@ -57,16 +63,14 @@
        riskValue.exceptionTypeAggregation = avg(list) { it.exceptionTypeAggregation }
    }
    fun onDone(riskValue: RiskValue) {
        riskValue.type = "month"
    }
    private fun avg(list: List<RiskValue?>, onNext: (value: RiskValue) -> Double): Double {
    private fun avg(list: List<RiskValue?>, onNext: (value: RiskValue) -> Double?): Double {
        var total = .0
        var count = 0
        list.forEach {
            if (it == null) return@forEach
            total += onNext(it)
            val a = onNext(it) ?: return@forEach
            total += a
            count++
        }
        return if (count == 0) .0 else total / count
src/main/java/com/flightfeather/monitor/controller/dust/RiskValueController.java
@@ -2,16 +2,11 @@
import com.flightfeather.monitor.domain.ds1.entity.RiskValue;
import com.flightfeather.monitor.pojo.AnalysisData;
import com.flightfeather.monitor.pojo.Result;
import com.flightfeather.monitor.service.AnalysisDataService;
import com.flightfeather.monitor.service.RiskAnalysisService;
import com.flightfeather.monitor.service.RiskValueService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -21,13 +16,24 @@
@CrossOrigin
public class RiskValueController {
    @Autowired
    private RiskAnalysisService riskAnalysisService;
    private RiskValueService riskValueService;
    /*根据站点名字(可选值),月份,类型来返回风险值*/
    /**
     * æ ¹æ®ç«™ç‚¹åå­—(可选值),月份,类型来返回风险值
     *
     * @param mnCode
     * @param month
     * @param type
     * @return
     */
    @GetMapping("/month")
    public Result queryRiskDataByMonth(String siteName,String month,String type){
        List<RiskValue> list =riskAnalysisService.queryRiskDataByMonth(siteName,month,type);
    public Result queryRiskDataByMonth(
            @RequestParam String mnCode,
            @RequestParam String month,
            @RequestParam String type
    ) {
        List<RiskValue> list = riskValueService.queryRiskDataByMonth(mnCode, month, type);
        return Result.success(list);
    }
}
src/main/java/com/flightfeather/monitor/domain/ds1/repository/RiskValueRep.kt
@@ -26,16 +26,27 @@
        }
    }
    /**
     * æ’入列表
     * @param list
     */
    fun insert(list: List<RiskValue>): Int {
        return riskValueMapper.insertList(list)
    }
    fun select(mnCode: String, date: LocalDate): List<RiskValue?> {
    /**
     * æŸ¥è¯¢
     * @param mnCode
     * @param date
     * @param type
     */
    fun select(mnCode: String, date: LocalDate, type: String): List<RiskValue?> {
        val s = date.withDayOfMonth(1).atStartOfDay()
        val e = s.plusMonths(1).minusSeconds(1)
        return riskValueMapper.selectByExample(Example(RiskValue::class.java).apply {
            createCriteria().andEqualTo("mnCode", mnCode)
                .andBetween("lst", s, e)
                .andEqualTo("type", type)
        })
    }
}
src/main/java/com/flightfeather/monitor/pojo/Result.java
@@ -14,15 +14,17 @@
    private Object data; //返回的数据
    //增删改 æˆåŠŸå“åº”
    public static Result success(){
        return new Result(1,"success",null);
    public static Result success() {
        return new Result(1, "success", null);
    }
    //查询 æˆåŠŸå“åº”
    public static Result success(Object data){
        return new Result(1,"success",data);
    public static Result success(Object data) {
        return new Result(1, "success", data);
    }
    //失败响应
    public static Result error(String msg){
        return new Result(0,msg,null);
    public static Result error(String msg) {
        return new Result(0, msg, null);
    }
}
src/main/java/com/flightfeather/monitor/scheduledtasks/TaskController.kt
@@ -1,8 +1,6 @@
package com.flightfeather.monitor.scheduledtasks
import com.flightfeather.monitor.scheduledtasks.dust.DustDailyAnalysisTask
import com.flightfeather.monitor.scheduledtasks.dust.DustExceptionAnalysisTask
import com.flightfeather.monitor.scheduledtasks.dust.DustMonthlyAnalysisTask
import com.flightfeather.monitor.scheduledtasks.dust.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Component
@@ -21,6 +19,8 @@
    dustExceptionAnalysisTask: DustExceptionAnalysisTask,
    dustDailyAnalysisTask: DustDailyAnalysisTask,
    dustMonthlyAnalysisTask: DustMonthlyAnalysisTask,
    riskDailyAnalysisTask: RiskDailyAnalysisTask,
    riskMonthlyAnalysisTask: RiskMonthlyAnalysisTask,
) {
    companion object {
@@ -41,6 +41,8 @@
        timeTask.add(dustExceptionAnalysisTask)
        timeTask.add(dustDailyAnalysisTask)
        timeTask.add(dustMonthlyAnalysisTask)
        timeTask.add(riskDailyAnalysisTask)
        timeTask.add(riskMonthlyAnalysisTask)
        log.info("添加定时任务完成,任务总计${timeTask.size}个")
    }
src/main/java/com/flightfeather/monitor/scheduledtasks/dust/BaseDustTimingTask.kt
@@ -19,7 +19,7 @@
    /**
     * å½“任务开始执行时,判断任务状态,决定是否延迟执行
     */
    protected fun isTaskDelay(localtime: LocalDateTime): Boolean {
    open fun isTaskDelay(localtime: LocalDateTime): Boolean {
        val task = requestTaskRep.findLatestTask(localtime)
        // ä»»åŠ¡æ­£åœ¨æ‰§è¡Œï¼Œè·³è¿‡æ­¤æ¬¡åˆ†æžï¼Œåœ¨ä¸‹ä¸€å‘¨æœŸç»§ç»­åˆ¤æ–­ï¼Œç­‰å¾…ä»»åŠ¡å®ŒæˆåŽè¿›è¡Œåˆ†æž
        return if (task == null || task.runningStatus) {
src/main/java/com/flightfeather/monitor/scheduledtasks/dust/RiskDailyAnalysisTask.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
package com.flightfeather.monitor.scheduledtasks.dust
import com.flightfeather.monitor.analysis.dust.ExceptionAnalysisController
import com.flightfeather.monitor.analysis.dust.RiskAnalysisController
import com.flightfeather.monitor.analysis.dust.StatisticAnalysisController
import com.flightfeather.monitor.domain.ds1.repository.DustExceptionDataRep
import com.flightfeather.monitor.domain.ds1.repository.DustStatisticsValueRep
import com.flightfeather.monitor.domain.ds1.repository.RequestTaskRep
import org.springframework.stereotype.Component
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.ZoneId
/**
 * æ‰¬å°˜æ—¥é£Žé™©åˆ†æžä»»åŠ¡
 */
@Component
class RiskDailyAnalysisTask(
    private val riskAnalysisController: RiskAnalysisController,
    private val exceptionAnalysisController: ExceptionAnalysisController,
    private val statisticAnalysisController: StatisticAnalysisController,
    private val dustExceptionDataRep: DustExceptionDataRep,
    private val dustStatisticsValueRep: DustStatisticsValueRep,
    requestTaskRep: RequestTaskRep,
) : BaseDustTimingTask(requestTaskRep) {
    override fun doTask(localtime: LocalDateTime) {
        if (taskDelay || (localtime.hour == 10 && localtime.minute == 0)) {
            taskDelay = isTaskDelay(localtime)
            if (!taskDelay) {
                log.info("日风险分析执行")
                riskAnalysisController.init()
                riskAnalysisController.autoRunDaily()
            }
        }
    }
    /**
     * å½“昨日的异常分析和日统计任务都完成后,才执行日风险分析任务,否则延迟执行
     * @param localtime å½“前时间
     * @return æ˜¯å¦å»¶è¿Ÿæ‰§è¡Œ
     */
    override fun isTaskDelay(localtime: LocalDateTime): Boolean {
        val yesterday = LocalDate.now().minusDays(1)
        // æ£€æŸ¥å¼‚常分析记录的最新时间和异常分析任务的运行状态
        val eData = dustExceptionDataRep.findLatestData() ?: return true
        val eDataTime = LocalDateTime.ofInstant(eData.endTime.toInstant(), ZoneId.systemDefault()).toLocalDate()
        val b1 = yesterday.isEqual(eDataTime)
        val b2 = exceptionAnalysisController.running
        // æ£€æŸ¥æ—¥ç»Ÿè®¡åˆ†æžè®°å½•的最新时间和日统计分析任务的运行状态
        val sData = dustStatisticsValueRep.findLatestData("day") ?: return true
        val sDataTime = LocalDateTime.ofInstant(sData.lst.toInstant(), ZoneId.systemDefault()).toLocalDate()
        val b3 = yesterday.isEqual(sDataTime)
        val b4 = statisticAnalysisController.running1
        return !(b1 && !b2 && b3 && !b4)
    }
}
src/main/java/com/flightfeather/monitor/scheduledtasks/dust/RiskMonthlyAnalysisTask.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
package com.flightfeather.monitor.scheduledtasks.dust
import com.flightfeather.monitor.analysis.dust.RiskAnalysisController
import com.flightfeather.monitor.domain.ds1.repository.RequestTaskRep
import com.flightfeather.monitor.domain.ds1.repository.RiskValueRep
import org.springframework.stereotype.Component
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.ZoneId
/**
 * æ‰¬å°˜æœˆé£Žé™©åˆ†æžä»»åŠ¡
 */
@Component
class RiskMonthlyAnalysisTask(
    private val riskAnalysisController: RiskAnalysisController,
    private val riskValueRep: RiskValueRep,
    requestTaskRep: RequestTaskRep,
) : BaseDustTimingTask(requestTaskRep) {
    override fun doTask(localtime: LocalDateTime) {
        if (taskDelay || (localtime.dayOfMonth == 1 && localtime.hour == 11 && localtime.minute == 0)) {
            taskDelay = isTaskDelay(localtime)
            if (!taskDelay) {
                log.info("月风险分析执行")
                riskAnalysisController.init()
                riskAnalysisController.autoRunMonthly()
            }
        }
    }
    /**
     * å½“上月底的日风险分析完成后,才执行月风险分析任务,否则延迟执行
     * @param localtime å½“前时间
     * @return æ˜¯å¦å»¶è¿Ÿæ‰§è¡Œ
     */
    override fun isTaskDelay(localtime: LocalDateTime): Boolean {
        val lastMonth = LocalDate.now().withDayOfMonth(1).minusDays(1)
        val data = riskValueRep.findLatestData("day") ?: return true
        val dataTime = LocalDateTime.ofInstant(data.lst.toInstant(), ZoneId.systemDefault()).toLocalDate()
        val b1 = lastMonth.isEqual(dataTime)
        val b2 = riskAnalysisController.running1
        return !(b1 && !b2)
    }
}
src/main/java/com/flightfeather/monitor/service/RiskAnalysisService.java
ÎļþÒÑɾ³ý
src/main/java/com/flightfeather/monitor/service/RiskValueService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.flightfeather.monitor.service;
import com.flightfeather.monitor.domain.ds1.entity.RiskValue;
import java.util.List;
public interface RiskValueService {
    /**
     * æ ¹æ®ç«™ç‚¹åå­—(可选值),月份,类型来返回风险值
     * @param mnCode
     * @param month
     * @param type
     * @return
     */
    List<RiskValue> queryRiskDataByMonth(String mnCode, String month, String type);
}
src/main/java/com/flightfeather/monitor/service/impl/RiskAnalysisServiceImpl.java
ÎļþÒÑɾ³ý
src/main/java/com/flightfeather/monitor/service/impl/RiskValueServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.flightfeather.monitor.service.impl;
import com.flightfeather.monitor.domain.ds1.entity.RiskValue;
import com.flightfeather.monitor.domain.ds1.mapper.RiskValueMapper;
import com.flightfeather.monitor.domain.ds1.repository.RiskValueRep;
import com.flightfeather.monitor.mapper.RiskAnalysisMapper;
import com.flightfeather.monitor.service.RiskValueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
@Service
public class RiskValueServiceImpl implements RiskValueService {
    @Autowired
    private RiskValueMapper riskValueMapper;
    @Autowired
    private RiskValueRep riskValueRep;
    @Override
    public List<RiskValue> queryRiskDataByMonth(String mnCode, String month, String type) {
        LocalDate date = LocalDate.parse(month);
        if (date != null) {
            return riskValueRep.select(mnCode, date, type);
        } else {
            return new ArrayList<>();
        }
    }
}
src/main/java/com/flightfeather/monitor/utils/UUIDGenerator.kt
@@ -74,8 +74,8 @@
            return uid.toString()
        }
        private fun toHex(value: Int, length: Int): String {
            var value = value
        private fun toHex(v: Int, length: Int): String {
            var value = v
            val hexDigits = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F')
            val buffer = StringBuffer(length)
            val shift = length - 1 shl 2
src/main/resources/application.yml
@@ -2,13 +2,14 @@
  datasource:
    ds1:
      driver-class-name: com.mysql.cj.jdbc.Driver
#      url: jdbc:mysql://localhost:3306/fume
#      username: fume
#      password: fume_feiyu2023
#      ç”Ÿäº§çŽ¯å¢ƒ
      url: jdbc:mysql://localhost:3306/fume
      username: fume
      password: fume_feiyu2023
      url: jdbc:mysql://localhost:3306/qianduan_sql
      username: root
      password: 1234
#      url: jdbc:mysql://localhost:3306/qianduan_sql
#      username: root
#      password: 1234
#      url: jdbc:mysql://localhost:3306/fume
#      username: root
src/test/java/com/flightfeather/monitor/analysis/dust/RiskAnalysisControllerTest.kt
@@ -1,6 +1,5 @@
package com.flightfeather.monitor.analysis.dust
import com.flightfeather.monitor.utils.DateUtil
import org.junit.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.runner.RunWith
@@ -8,7 +7,6 @@
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit.jupiter.SpringExtension
import org.springframework.test.context.junit4.SpringRunner
import java.time.LocalDate
@RunWith(SpringRunner::class)
@ExtendWith(SpringExtension::class)
@@ -20,16 +18,19 @@
    @Test
    fun autoRunDaily() {
        val s = LocalDate.of(2023, 10, 1)
        val e = LocalDate.of(2023, 10, 31)
        val du = DateUtil.findDurationDate(s, e)
        du.forEach {
            riskAnalysisController.runDaily(it)
        }
        riskAnalysisController.init()
//        val s = LocalDate.of(2023, 10, 1)
//        val e = LocalDate.of(2023, 10, 31)
//        val du = DateUtil.findDurationDate(s, e)
//        du.forEach {
//            riskAnalysisController.runDaily(it)
//        }
        riskAnalysisController.autoRunDaily()
    }
    @Test
    fun autoRunMonthly() {
        riskAnalysisController.init()
        riskAnalysisController.autoRunMonthly()
    }
}