src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionAnalysisController.kt
@@ -1,5 +1,6 @@ package com.flightfeather.monitor.analysis.dust import com.flightfeather.monitor.analysis.dust.exception.* import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData import com.flightfeather.monitor.domain.ds1.repository.DustExceptionDataRep import com.flightfeather.monitor.domain.ds1.repository.DustExceptionSettingRep src/main/java/com/flightfeather/monitor/analysis/dust/RiskAnalysisController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,7 @@ package com.flightfeather.monitor.analysis.dust; /** * æ°æ®é£é©åææ§å¶å¨ */ public class RiskAnalysisController { } src/main/java/com/flightfeather/monitor/analysis/dust/exception/BaseDustExceptionAnalysis.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/BaseDustExceptionAnalysis.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.analysis.BaseDataAnalysis import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData src/main/java/com/flightfeather/monitor/analysis/dust/exception/BaseExceptionContinuous.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/BaseExceptionContinuous.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting import com.flightfeather.monitor.domain.ds1.entity.DustSiteData src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionApproachExceeding.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionApproachExceeding.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting import com.flightfeather.monitor.domain.ds1.entity.DustSiteData src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionDataExceed.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionDataExceed.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting import com.flightfeather.monitor.domain.ds1.entity.DustSiteData src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionDataLowValue.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionDataLowValue.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionDataMissing.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionDataMissing.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting import com.flightfeather.monitor.domain.ds1.entity.DustSiteData src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionExceedingTimes.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionExceedingTimes.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionNoFluctuation.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionNoFluctuation.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting import com.flightfeather.monitor.domain.ds1.entity.DustSiteData src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionSlideAverage.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionSlideAverage.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting import com.flightfeather.monitor.domain.ds1.entity.DustSiteData src/main/java/com/flightfeather/monitor/analysis/dust/exception/ExceptionValueMutation.kt
ÎļþÃû´Ó src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionValueMutation.kt ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.flightfeather.monitor.analysis.dust package com.flightfeather.monitor.analysis.dust.exception import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting import com.flightfeather.monitor.domain.ds1.entity.DustSiteData src/main/java/com/flightfeather/monitor/domain/ds1/entity/RiskValue.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,214 @@ package com.flightfeather.monitor.domain.ds1.entity; import java.util.Date; import javax.persistence.*; @Table(name = "du_js_t_risk_value") public class RiskValue { @Id private Integer id; /** * çæµç¹ç¼å· */ @Column(name = "mn_code") private String mnCode; /** * æ¶é´ */ private Date lst; /** * å¨çº¿çé£é©å¼ */ @Column(name = "online_risk") private Double onlineRisk; /** * ææçé£é©å¼ */ @Column(name = "valid_risk") private Double validRisk; /** * è¶ æ é£é©å¼ */ @Column(name = "exceed_risk") private Double exceedRisk; /** * å¼å¸¸ç±»åèé度 */ @Column(name = "exception_type_aggregation") private Double exceptionTypeAggregation; /** * å ¸åå¼å¸¸å¤ç°ç */ @Column(name = "typical_exception_repetition_rate") private Double typicalExceptionRepetitionRate; /** * ç»è®¡ç±»åï¼æ¥ç»è®¡ææç»è®¡ï¼,day month */ private String type; /** * @return id */ public Integer getId() { return id; } /** * @param id */ public void setId(Integer id) { this.id = id; } /** * è·åçæµç¹ç¼å· * * @return mn_code - çæµç¹ç¼å· */ public String getMnCode() { return mnCode; } /** * è®¾ç½®çæµç¹ç¼å· * * @param mnCode çæµç¹ç¼å· */ public void setMnCode(String mnCode) { this.mnCode = mnCode == null ? null : mnCode.trim(); } /** * è·åæ¶é´ * * @return lst - æ¶é´ */ public Date getLst() { return lst; } /** * 设置æ¶é´ * * @param lst æ¶é´ */ public void setLst(Date lst) { this.lst = lst; } /** * è·åå¨çº¿çé£é©å¼ * * @return online_risk - å¨çº¿çé£é©å¼ */ public Double getOnlineRisk() { return onlineRisk; } /** * 设置å¨çº¿çé£é©å¼ * * @param onlineRisk å¨çº¿çé£é©å¼ */ public void setOnlineRisk(Double onlineRisk) { this.onlineRisk = onlineRisk; } /** * è·åææçé£é©å¼ * * @return valid_risk - ææçé£é©å¼ */ public Double getValidRisk() { return validRisk; } /** * 设置ææçé£é©å¼ * * @param validRisk ææçé£é©å¼ */ public void setValidRisk(Double validRisk) { this.validRisk = validRisk; } /** * è·åè¶ æ é£é©å¼ * * @return exceed_risk - è¶ æ é£é©å¼ */ public Double getExceedRisk() { return exceedRisk; } /** * è®¾ç½®è¶ æ é£é©å¼ * * @param exceedRisk è¶ æ é£é©å¼ */ public void setExceedRisk(Double exceedRisk) { this.exceedRisk = exceedRisk; } /** * è·åå¼å¸¸ç±»åèé度 * * @return exception_type_aggregation - å¼å¸¸ç±»åèé度 */ public Double getExceptionTypeAggregation() { return exceptionTypeAggregation; } /** * 设置å¼å¸¸ç±»åèé度 * * @param exceptionTypeAggregation å¼å¸¸ç±»åèé度 */ public void setExceptionTypeAggregation(Double exceptionTypeAggregation) { this.exceptionTypeAggregation = exceptionTypeAggregation; } /** * è·åå ¸åå¼å¸¸å¤ç°ç * * @return typical_exception_repetition_rate - å ¸åå¼å¸¸å¤ç°ç */ public Double getTypicalExceptionRepetitionRate() { return typicalExceptionRepetitionRate; } /** * è®¾ç½®å ¸åå¼å¸¸å¤ç°ç * * @param typicalExceptionRepetitionRate å ¸åå¼å¸¸å¤ç°ç */ public void setTypicalExceptionRepetitionRate(Double typicalExceptionRepetitionRate) { this.typicalExceptionRepetitionRate = typicalExceptionRepetitionRate; } /** * è·åç»è®¡ç±»åï¼æ¥ç»è®¡ææç»è®¡ï¼,day month * * @return type - ç»è®¡ç±»åï¼æ¥ç»è®¡ææç»è®¡ï¼,day month */ public String getType() { return type; } /** * 设置ç»è®¡ç±»åï¼æ¥ç»è®¡ææç»è®¡ï¼,day month * * @param type ç»è®¡ç±»åï¼æ¥ç»è®¡ææç»è®¡ï¼,day month */ public void setType(String type) { this.type = type == null ? null : type.trim(); } } src/main/java/com/flightfeather/monitor/domain/ds1/mapper/RiskValueMapper.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package com.flightfeather.monitor.domain.ds1.mapper import com.flightfeather.monitor.domain.ds1.entity.RiskValue import com.flightfeather.monitor.domain.util.MyMapper import org.apache.ibatis.annotations.Mapper @Mapper interface RiskValueMapper : MyMapper<RiskValue?> src/main/java/com/flightfeather/monitor/scheduledtasks/DustAnalysisTask.kt
@@ -33,28 +33,31 @@ // 夿仿¥ç¬å任塿¯å¦å®æ val task = requestTaskRep.findLatestTask(localtime) task1Delay = isTaskDelay(task) if (task1Delay) return if (!task1Delay) { log.info("å¼å¸¸åææ§è¡") exceptionAnalysisController.init() exceptionAnalysisController.autoRun() } } if (task2Delay || (localtime.hour == 9 && localtime.minute == 0)) { val task = requestTaskRep.findLatestTask(localtime) task2Delay = isTaskDelay(task) if (task2Delay) return if (!task2Delay) { log.info("æ¥åææ§è¡") statisticAnalysisController.autoRunDailyStatics() } } if (task3Delay || (localtime.dayOfMonth == 1 && localtime.hour == 9 && localtime.minute == 0)) { val task = requestTaskRep.findLatestTask(localtime) task3Delay = isTaskDelay(task) if (task3Delay) return if (!task3Delay) { log.info("æåææ§è¡") statisticAnalysisController.autoRunMonthlyStatics() } } } /** * å½ä»»å¡å¼å§æ§è¡æ¶ï¼å¤æä»»å¡ç¶æï¼å³å®æ¯å¦å»¶è¿æ§è¡ src/main/resources/generator/generatorConfig4ds1.xml
@@ -86,7 +86,11 @@ <!-- enableCountByExample="false"--> <!-- enableUpdateByExample="false" enableDeleteByExample="false"--> <!-- enableSelectByExample="false" selectByExampleQueryId="false"/>--> <table tableName="du_js_t_request_task" domainObjectName="RequestTask" <!-- <table tableName="du_js_t_request_task" domainObjectName="RequestTask"--> <!-- enableCountByExample="false"--> <!-- enableUpdateByExample="false" enableDeleteByExample="false"--> <!-- enableSelectByExample="false" selectByExampleQueryId="false"/>--> <table tableName="du_js_t_risk_value" domainObjectName="RiskValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> src/main/resources/mapper/ds1/RiskValueMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,25 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.flightfeather.monitor.domain.ds1.mapper.RiskValueMapper"> <resultMap id="BaseResultMap" type="com.flightfeather.monitor.domain.ds1.entity.RiskValue"> <!-- WARNING - @mbg.generated --> <id column="id" jdbcType="INTEGER" property="id" /> <result column="mn_code" jdbcType="VARCHAR" property="mnCode" /> <result column="lst" jdbcType="DATE" property="lst" /> <result column="online_risk" jdbcType="DOUBLE" property="onlineRisk" /> <result column="valid_risk" jdbcType="DOUBLE" property="validRisk" /> <result column="exceed_risk" jdbcType="DOUBLE" property="exceedRisk" /> <result column="exception_type_aggregation" jdbcType="DOUBLE" property="exceptionTypeAggregation" /> <result column="typical_exception_repetition_rate" jdbcType="DOUBLE" property="typicalExceptionRepetitionRate" /> <result column="type" jdbcType="VARCHAR" property="type" /> </resultMap> <sql id="Base_Column_List"> <!-- WARNING - @mbg.generated --> id, mn_code, lst, online_risk, valid_risk, exceed_risk, exception_type_aggregation, typical_exception_repetition_rate, type </sql> </mapper> src/test/java/com/flightfeather/monitor/analysis/dust/ExceptionAnalysisControllerTest.kt
@@ -1,12 +1,13 @@ package com.flightfeather.monitor.analysis.dust import org.junit.jupiter.api.Test import org.junit.Test import org.junit.jupiter.api.extension.ExtendWith import org.junit.runner.RunWith import org.springframework.beans.factory.annotation.Autowired 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.Duration import java.time.LocalDate @RunWith(SpringRunner::class) @@ -26,8 +27,12 @@ @Test fun run() { exceptionAnalysisController.init() val d = LocalDate.of(2023, 7, 2) exceptionAnalysisController.run(d) var d1 = LocalDate.of(2023, 10, 26) val d2 = LocalDate.of(2023, 10, 26) while (Duration.between(d1.atStartOfDay(), d2.atStartOfDay()).toDays() >= 0L) { exceptionAnalysisController.run(d1) d1 = d1.plusDays(1) } // exceptionAnalysisController.debugRun() } }