Commit dc72176e authored by chenzhao's avatar chenzhao

修改代码

parent cf5aeeae
package com.yeejoin.amos.boot.module.jxiop.biz.config;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Component
public class AsyncScheduledTaskConfig {
@Bean("async")
public Executor asyncScheduledTask(){
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setMaxPoolSize(50);
executor.setCorePoolSize(20);
executor.setQueueCapacity(50);
executor.setThreadNamePrefix("async-thread-");
executor.setKeepAliveSeconds(60);
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy(){});
executor.initialize();
return executor;
}
}
......@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
......@@ -39,7 +40,7 @@ public class IdxBizFanWarningRuleSet{
*
*/
@TableField("REC_DATE")
private LocalDateTime recDate;
private Date recDate;
/**
*
......@@ -81,7 +82,7 @@ public class IdxBizFanWarningRuleSet{
*
*/
@TableField("ANALYSIS_POINT_ID")
private Integer analysisPointId;
private String analysisPointId;
/**
* 分析周期((按天、10min、小时)
......
......@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
......@@ -39,7 +40,7 @@ public class IdxBizPvWarningRuleSet{
*
*/
@TableField("REC_DATE")
private LocalDateTime recDate;
private Date recDate;
/**
*
......@@ -81,7 +82,7 @@ public class IdxBizPvWarningRuleSet{
* 分析变量测点ID
*/
@TableField("ANALYSIS_POINT_ID")
private Integer analysisPointId;
private String analysisPointId;
/**
* 分析周期((按天、10min、小时)
......
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
......@@ -66,7 +67,8 @@ public class HealthStatusIndicatorServiceImpl {
*/
@Scheduled(cron = "0 0 */1 * * ?")
private void healthWarningMinuteGF() {
@Async("async")
public void healthWarningMinuteGF() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
......@@ -169,7 +171,8 @@ public class HealthStatusIndicatorServiceImpl {
*/
@Scheduled(cron = "0 0 */5 * * ?")
private void healthWarningHourGF() {
@Async("async")
public void healthWarningHourGF() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
......@@ -276,7 +279,8 @@ public class HealthStatusIndicatorServiceImpl {
*/
@Scheduled(cron = "0 0 0 */3 * ? ")
private void healthWarningDayGF() {
@Async("async")
public void healthWarningDayGF() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
......@@ -375,7 +379,8 @@ public class HealthStatusIndicatorServiceImpl {
@Scheduled(cron = "0 0/5 * * * ?")
private void healthWarningMinute() {
@Async("async")
public void healthWarningMinute() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
......@@ -482,7 +487,8 @@ public class HealthStatusIndicatorServiceImpl {
*/
@Scheduled(cron = "0 0 */5 * * ?")
private void healthWarningHour() {
@Async("async")
public void healthWarningHour() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-5);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
......@@ -589,7 +595,8 @@ public class HealthStatusIndicatorServiceImpl {
*/
@Scheduled(cron = "0 0 0 */3 * ? ")
private void healthWarningDay() {
@Async("async")
public void healthWarningDay() {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)-3);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment