Commit 426dcdf5 authored by caotao's avatar caotao

1.将各厂商的数据采集周期由代码提到配置文件中

parent cab05cb6
......@@ -22,6 +22,7 @@ import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON;
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.Scheduled;
import org.springframework.stereotype.Service;
......@@ -37,7 +38,8 @@ import java.util.concurrent.TimeUnit;
@Service
public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService {
//定时任务执行频率 当前为10分钟一次
private final String dataRequstScheduled = "0 0/60 * * * *";
//锦浪云请求工具封装
@Autowired
......@@ -85,7 +87,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
@Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override
public void stationList() {
......@@ -106,7 +108,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override
public void stationDetail() {
List<String> stationIds = golangStationMapper.getStationIds();
......@@ -204,7 +206,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override
public void collectorList() {
List<String> stationIds = golangStationMapper.getStationIds();
......@@ -233,7 +235,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override
public void collectorDetail() {
List<Long> collectorIds = golangCollectorListMapper.getCollectIds();
......@@ -305,7 +307,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override
public void inverterList() {
List<String> stationIds = golangStationMapper.getStationIds();
......@@ -334,7 +336,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override
public void inverterDetail() {
List<String> inverterSns = golangInverterListMapper.getInverterSns();
......@@ -472,7 +474,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
}
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override
public void inverAlramInfo() {
List<String> inverterIds = golangInverterListMapper.getInverterSns();
......
......@@ -23,6 +23,7 @@ import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -37,6 +38,8 @@ import java.util.stream.Collectors;
@Service
public class ImasterDataServiceImpl implements ImasterDataService {
//北向请求工具封装
@Autowired
private ImasterUtils imasterUtils;
......@@ -80,12 +83,6 @@ public class ImasterDataServiceImpl implements ImasterDataService {
//定时任务执行频率 当前为10分钟一次
private final String dataRequstScheduled = "0 0/60 * * * *";
//监盘场站mapper
@Autowired
private JpStationMapper jpStationMapper;
......@@ -120,7 +117,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
JpInverterElectricityMapper jpInverterElectricityMapper;
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override
public void stationList() {
HashMap<String, Object> requestInfo = new HashMap<>();
......@@ -140,7 +137,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override
public void stationDetail() {
......@@ -295,7 +292,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override
public void collectorList() {
List<String> stationIds = imasterStationMapper.getStationIds();
......@@ -387,7 +384,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override
public void inverterList() {
List<String> stationIds = imasterStationMapper.getStationIds();
......@@ -425,7 +422,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override
public void inverterDetail() {
List<String> inverterSns = imasterInverterListMapper.getCollectIds();
......@@ -675,7 +672,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
}
@Scheduled(cron = dataRequstScheduled)
@Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override
public void inverAlramInfo() {
......
......@@ -65,4 +65,10 @@ spring.influx.database=station_platform
spring.influx.retention_policy=default
spring.influx.retention_policy_time=30d
spring.influx.actions=10000
spring.influx.bufferLimit=20000
\ No newline at end of file
spring.influx.bufferLimit=20000
# ??????????
dataRequstScheduled.jinlangyun=0 0/10 * * * *
dataRequstScheduled.huawei=0 0/10 * * * *
dataRequstScheduled.keshida=0 0/10 * * * *
\ No newline at end of file
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