Commit c403e537 authored by wujiang's avatar wujiang

添加定时任务

parent 2dd4708f
......@@ -49,7 +49,7 @@
<dependency>
<groupId>com.qiyuesuo.sdk</groupId>
<artifactId>sdk-java</artifactId>
<version>3.0.0</version>
<version>3.6.3</version>
</dependency>
</dependencies>
......
package com.yeejoin.amos.boot.module.hygf.biz.scheduled;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.MonthPowerServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.MonthPowerServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpCollectorHistoryServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHistoryServiceImpl;
/**
* @description:
* @author: tw
......@@ -13,13 +16,19 @@ import org.springframework.scheduling.annotation.Scheduled;
@EnableScheduling
public class WindSpeedScheduled {
@Autowired
MonthPowerServiceImpl monthPowerServiceImpl;
@Autowired
MonthPowerServiceImpl monthPowerServiceImpl;
@Scheduled(cron="${cheduled.crons}")
private void initData(){
monthPowerServiceImpl.getMonthPower();
}
@Autowired
TdHygfJpCollectorHistoryServiceImpl tdHygfJpCollectorHistoryServiceImpl;
@Autowired
TdHygfJpInvertorElecHistoryServiceImpl tdHygfJpInvertorElecHistoryServiceImpl;
@Scheduled(cron = "${cheduled.crons}")
private void initData() {
monthPowerServiceImpl.getMonthPower();
tdHygfJpCollectorHistoryServiceImpl.syncData();
tdHygfJpInvertorElecHistoryServiceImpl.syncData();
}
}
......@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -99,6 +100,7 @@ public class TdHygfJpCollectorHistoryServiceImpl
return new ArrayList<>();
}
@Async
public Object syncData() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
......
......@@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -96,6 +97,7 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
return new ArrayList<>();
}
@Async
public Object syncData() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
......
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