Commit 00742ab1 authored by tangwei's avatar tangwei

修改异步方法事务

parent 238f5f42
package com.yeejoin.amos.boot.module.hygf.biz.scheduled;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -17,7 +18,7 @@ import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHi
public class WindSpeedScheduled {
@Autowired
MonthPowerServiceImpl monthPowerServiceImpl;
JpStationServiceImpl jpStationServiceImpl;
@Autowired
TdHygfJpCollectorHistoryServiceImpl tdHygfJpCollectorHistoryServiceImpl;
......@@ -27,7 +28,7 @@ public class WindSpeedScheduled {
@Scheduled(cron = "${cheduled.crons}")
private void initData() {
monthPowerServiceImpl.getMonthPower();
jpStationServiceImpl.getMonthPower();
tdHygfJpCollectorHistoryServiceImpl.syncData();
tdHygfJpInvertorElecHistoryServiceImpl.syncData();
}
......
......@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthPowerMapper;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -32,6 +33,8 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
JpStationMapper jpStationMapper;
@Autowired
MonthPowerMapper monthPowerMapper;
@Autowired
MonthPowerServiceImpl monthPowerServiceImpl;
/**
* 分页查询
*/
......@@ -46,6 +49,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
pagenew.setRecords(page.getList());
return pagenew;
}
@Async
public void getMonthPower() {
monthPowerServiceImpl.getMonthPower();
}
@Override
......
......@@ -52,7 +52,7 @@ public class MonthPowerServiceImpl extends BaseService<MonthPowerDto,MonthPower,
@Override
@Async
@Transactional
public void getMonthPower() {
List<MonthPower> list= monthPowerMapper.getMonthPowerint();
LocalDateTime now = LocalDateTime.now();
......
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