Commit c403e537 authored by wujiang's avatar wujiang

添加定时任务

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