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; ...@@ -22,6 +22,7 @@ import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum; import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON; import fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired; 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.Async;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -37,7 +38,8 @@ import java.util.concurrent.TimeUnit; ...@@ -37,7 +38,8 @@ import java.util.concurrent.TimeUnit;
@Service @Service
public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService { public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService {
//定时任务执行频率 当前为10分钟一次 //定时任务执行频率 当前为10分钟一次
private final String dataRequstScheduled = "0 0/60 * * * *";
//锦浪云请求工具封装 //锦浪云请求工具封装
@Autowired @Autowired
...@@ -85,7 +87,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -85,7 +87,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
@Autowired @Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper; private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override @Override
public void stationList() { public void stationList() {
...@@ -106,7 +108,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -106,7 +108,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override @Override
public void stationDetail() { public void stationDetail() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
...@@ -204,7 +206,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -204,7 +206,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override @Override
public void collectorList() { public void collectorList() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
...@@ -233,7 +235,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -233,7 +235,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override @Override
public void collectorDetail() { public void collectorDetail() {
List<Long> collectorIds = golangCollectorListMapper.getCollectIds(); List<Long> collectorIds = golangCollectorListMapper.getCollectIds();
...@@ -305,7 +307,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -305,7 +307,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override @Override
public void inverterList() { public void inverterList() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
...@@ -334,7 +336,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -334,7 +336,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override @Override
public void inverterDetail() { public void inverterDetail() {
List<String> inverterSns = golangInverterListMapper.getInverterSns(); List<String> inverterSns = golangInverterListMapper.getInverterSns();
...@@ -472,7 +474,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -472,7 +474,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
} }
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.jinlangyun}")
@Override @Override
public void inverAlramInfo() { public void inverAlramInfo() {
List<String> inverterIds = golangInverterListMapper.getInverterSns(); List<String> inverterIds = golangInverterListMapper.getInverterSns();
......
...@@ -23,6 +23,7 @@ import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum; ...@@ -23,6 +23,7 @@ import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON; import fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -37,6 +38,8 @@ import java.util.stream.Collectors; ...@@ -37,6 +38,8 @@ import java.util.stream.Collectors;
@Service @Service
public class ImasterDataServiceImpl implements ImasterDataService { public class ImasterDataServiceImpl implements ImasterDataService {
//北向请求工具封装 //北向请求工具封装
@Autowired @Autowired
private ImasterUtils imasterUtils; private ImasterUtils imasterUtils;
...@@ -80,12 +83,6 @@ public class ImasterDataServiceImpl implements ImasterDataService { ...@@ -80,12 +83,6 @@ public class ImasterDataServiceImpl implements ImasterDataService {
//定时任务执行频率 当前为10分钟一次
private final String dataRequstScheduled = "0 0/60 * * * *";
//监盘场站mapper //监盘场站mapper
@Autowired @Autowired
private JpStationMapper jpStationMapper; private JpStationMapper jpStationMapper;
...@@ -120,7 +117,7 @@ public class ImasterDataServiceImpl implements ImasterDataService { ...@@ -120,7 +117,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
JpInverterElectricityMapper jpInverterElectricityMapper; JpInverterElectricityMapper jpInverterElectricityMapper;
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override @Override
public void stationList() { public void stationList() {
HashMap<String, Object> requestInfo = new HashMap<>(); HashMap<String, Object> requestInfo = new HashMap<>();
...@@ -140,7 +137,7 @@ public class ImasterDataServiceImpl implements ImasterDataService { ...@@ -140,7 +137,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override @Override
public void stationDetail() { public void stationDetail() {
...@@ -295,7 +292,7 @@ public class ImasterDataServiceImpl implements ImasterDataService { ...@@ -295,7 +292,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override @Override
public void collectorList() { public void collectorList() {
List<String> stationIds = imasterStationMapper.getStationIds(); List<String> stationIds = imasterStationMapper.getStationIds();
...@@ -387,7 +384,7 @@ public class ImasterDataServiceImpl implements ImasterDataService { ...@@ -387,7 +384,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override @Override
public void inverterList() { public void inverterList() {
List<String> stationIds = imasterStationMapper.getStationIds(); List<String> stationIds = imasterStationMapper.getStationIds();
...@@ -425,7 +422,7 @@ public class ImasterDataServiceImpl implements ImasterDataService { ...@@ -425,7 +422,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override @Override
public void inverterDetail() { public void inverterDetail() {
List<String> inverterSns = imasterInverterListMapper.getCollectIds(); List<String> inverterSns = imasterInverterListMapper.getCollectIds();
...@@ -675,7 +672,7 @@ public class ImasterDataServiceImpl implements ImasterDataService { ...@@ -675,7 +672,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.huawei}")
@Override @Override
public void inverAlramInfo() { public void inverAlramInfo() {
......
...@@ -25,6 +25,7 @@ import com.yeejoin.amos.api.householdapi.face.service.KSolarDataAcquisitionServi ...@@ -25,6 +25,7 @@ import com.yeejoin.amos.api.householdapi.face.service.KSolarDataAcquisitionServi
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum; import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON; import fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -45,8 +46,7 @@ import java.util.concurrent.atomic.AtomicReference; ...@@ -45,8 +46,7 @@ import java.util.concurrent.atomic.AtomicReference;
@Service @Service
public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionService { public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionService {
//定时任务执行频率 当前为10分钟一次
private final String dataRequstScheduled = "0 0/60 * * * *";
@Autowired @Autowired
KsolarRequestUtil kSolarRequestUtil; KsolarRequestUtil kSolarRequestUtil;
...@@ -93,7 +93,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -93,7 +93,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
@Autowired @Autowired
private JpInverterElectricityMapper jpInverterElectricityMapper; private JpInverterElectricityMapper jpInverterElectricityMapper;
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.keshida}")
@Override @Override
public void stationList() { public void stationList() {
HashMap<String, Object> requestInfo = new HashMap<>(); HashMap<String, Object> requestInfo = new HashMap<>();
...@@ -110,7 +110,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -110,7 +110,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
} }
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.keshida}")
@Override @Override
public void stationDetail() { public void stationDetail() {
List<String> stationIds = kSolarStationMapper.getStationIds(); List<String> stationIds = kSolarStationMapper.getStationIds();
...@@ -189,27 +189,27 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -189,27 +189,27 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
jpStation.setCumulativeIncome(stationEarn.getTotalEarn()); jpStation.setCumulativeIncome(stationEarn.getTotalEarn());
// 并网类型 // 并网类型
// jpStation.setOnGridType(GoLangConstant.intoNetWorkStatus.get(String.valueOf(golangStationDetail.getStationtypenew()))); // jpStation.setOnGridType(GoLangConstant.intoNetWorkStatus.get(String.valueOf(golangStationDetail.getStationtypenew())));
// // 邮箱 // // 邮箱
// jpStation.setEmail(golangStationDetail.getUseremail()); // jpStation.setEmail(golangStationDetail.getUseremail());
// // 并网时间 // // 并网时间
// jpStation.setOnGridTime(new Date(golangStationDetail.getFispowertime())); // jpStation.setOnGridTime(new Date(golangStationDetail.getFispowertime()));
// // 接入平台时间 // // 接入平台时间
// jpStation.setAccessTime(new Date(golangStationDetail.getFisgeneratetime())); // jpStation.setAccessTime(new Date(golangStationDetail.getFisgeneratetime()));
// // 创建时间 // // 创建时间
// jpStation.setCreateTime(new Date(golangStationDetail.getCreatedate())); // jpStation.setCreateTime(new Date(golangStationDetail.getCreatedate()));
// // 额定功率 // // 额定功率
// jpStation.setRatedPower(Double.valueOf(golangStationDetail.getInverterpower())); // jpStation.setRatedPower(Double.valueOf(golangStationDetail.getInverterpower()));
// 第三方电站id // 第三方电站id
// jpStation.setThirdStationId(String.valueOf(golangStationDetail.getId())); // jpStation.setThirdStationId(String.valueOf(golangStationDetail.getId()));
// 第三方厂商标识 // 第三方厂商标识
// jpStation.setThirdCode(PVProducerInfoEnum.JLY.getCode()); // jpStation.setThirdCode(PVProducerInfoEnum.JLY.getCode());
// 业主电话 // 业主电话
// jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile())); // jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile()));
// 电站联系人 // 电站联系人
// jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile()).toLowerCase().replace("null", "")); // jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile()).toLowerCase().replace("null", ""));
// 组件数量 // 组件数量
// jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule()))?0:Math.toIntExact(golangStationDetail.getModule())); // jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule()))?0:Math.toIntExact(golangStationDetail.getModule()));
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) { if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation); jpStationMapper.updateById(jpStation);
...@@ -253,10 +253,11 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -253,10 +253,11 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
/** /**
* 获取单个站的发电量 * 获取单个站的发电量
*
* @param stationId 站id * @param stationId 站id
* @return 发电量实体 * @return 发电量实体
*/ */
private KsolarStationEarn getStationEarn (String stationId) { private KsolarStationEarn getStationEarn(String stationId) {
KsolarStationEarn ksolarStationEarn = new KsolarStationEarn(); KsolarStationEarn ksolarStationEarn = new KsolarStationEarn();
// 获取单个电站的发电量和收益 // 获取单个电站的发电量和收益
try { try {
...@@ -266,7 +267,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -266,7 +267,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
} }
HashMap<String, Object> requestInfo = new HashMap<>(1); HashMap<String, Object> requestInfo = new HashMap<>(1);
String requestParaminfo = JSON.toJSONString(requestInfo); String requestParaminfo = JSON.toJSONString(requestInfo);
String url = KSolarConstant.stationEarnUrl + "?stationId=" + stationId; String url = KSolarConstant.stationEarnUrl + "?stationId=" + stationId;
List<KsolarStationEarn> ksolarStationEarns = kSolarRequestUtil.getResPonse( List<KsolarStationEarn> ksolarStationEarns = kSolarRequestUtil.getResPonse(
url, url,
KSolarConstant.requestGET, KSolarConstant.requestGET,
...@@ -282,7 +283,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -282,7 +283,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
return ksolarStationEarn; return ksolarStationEarn;
} }
Map<String, Double> getStationMonthEarn (String stationId, String type) { Map<String, Double> getStationMonthEarn(String stationId, String type) {
Map<String, Double> map = new HashMap<>(1); Map<String, Double> map = new HashMap<>(1);
try { try {
TimeUnit.SECONDS.sleep(1); TimeUnit.SECONDS.sleep(1);
...@@ -306,7 +307,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -306,7 +307,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
attribId = "202"; attribId = "202";
stime = year; stime = year;
} }
String url = KSolarConstant.stationEarnChartUrl + "?stationId=" + stationId + "&attribId="+ attribId + "&stime=" + stime; String url = KSolarConstant.stationEarnChartUrl + "?stationId=" + stationId + "&attribId=" + attribId + "&stime=" + stime;
List<KsolarStationEarnChart> ksolarStationEarnCharts = kSolarRequestUtil.getResPonse( List<KsolarStationEarnChart> ksolarStationEarnCharts = kSolarRequestUtil.getResPonse(
url, url,
KSolarConstant.requestGET, KSolarConstant.requestGET,
...@@ -325,7 +326,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -325,7 +326,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
return map; return map;
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.keshida}")
@Override @Override
public void collectorList() { public void collectorList() {
List<String> stationIds = kSolarStationMapper.getStationIds(); List<String> stationIds = kSolarStationMapper.getStationIds();
...@@ -410,7 +411,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -410,7 +411,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
} }
} }
@Scheduled(cron = dataRequstScheduled) @Scheduled(cron = "${dataRequstScheduled.keshida}")
@Override @Override
public void collectorDetail() { public void collectorDetail() {
List<String> collectIds = ksolarStationCollectListMapper.getCollectIds(); List<String> collectIds = ksolarStationCollectListMapper.getCollectIds();
...@@ -578,20 +579,20 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe ...@@ -578,20 +579,20 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
} }
// //
HYGFJPInverterElecHistory hygfjpInverterElecHistory = new HYGFJPInverterElecHistory(); HYGFJPInverterElecHistory hygfjpInverterElecHistory = new HYGFJPInverterElecHistory();
hygfjpInverterElecHistory.setThirdStationId(ksolarStationCollectList.getThirdStationId()); hygfjpInverterElecHistory.setThirdStationId(ksolarStationCollectList.getThirdStationId());
hygfjpInverterElecHistory.setCreatedTime(System.currentTimeMillis()); hygfjpInverterElecHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterElecHistory.setSnCode(ksolarStationCollectData.getInverterId()); hygfjpInverterElecHistory.setSnCode(ksolarStationCollectData.getInverterId());
hygfjpInverterElecHistory.setUAcCurrent(ksolarStationCollectData.getCurrentR()); hygfjpInverterElecHistory.setUAcCurrent(ksolarStationCollectData.getCurrentR());
hygfjpInverterElecHistory.setVAcCurrent(ksolarStationCollectData.getCurrents()); hygfjpInverterElecHistory.setVAcCurrent(ksolarStationCollectData.getCurrents());
hygfjpInverterElecHistory.setWAcCurrent(ksolarStationCollectData.getCurrentT()); hygfjpInverterElecHistory.setWAcCurrent(ksolarStationCollectData.getCurrentT());
hygfjpInverterElecHistory.setUAcVoltage(ksolarStationCollectData.getVoltageRs()); hygfjpInverterElecHistory.setUAcVoltage(ksolarStationCollectData.getVoltageRs());
hygfjpInverterElecHistory.setVAcVoltage(ksolarStationCollectData.getVoltageSt()); hygfjpInverterElecHistory.setVAcVoltage(ksolarStationCollectData.getVoltageSt());
hygfjpInverterElecHistory.setWAcVoltage(ksolarStationCollectData.getVoltageTr()); hygfjpInverterElecHistory.setWAcVoltage(ksolarStationCollectData.getVoltageTr());
hygfjpInverterElecHistory.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode()); hygfjpInverterElecHistory.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
hygfjpInverterElecHistory.setTime(System.currentTimeMillis()); hygfjpInverterElecHistory.setTime(System.currentTimeMillis());
hygfjpInverterElecHistoryMapper.insert(hygfjpInverterElecHistory); hygfjpInverterElecHistoryMapper.insert(hygfjpInverterElecHistory);
// 逆变器历史 // 逆变器历史
String today = DateUtil.today(); String today = DateUtil.today();
......
...@@ -65,4 +65,10 @@ spring.influx.database=station_platform ...@@ -65,4 +65,10 @@ spring.influx.database=station_platform
spring.influx.retention_policy=default spring.influx.retention_policy=default
spring.influx.retention_policy_time=30d spring.influx.retention_policy_time=30d
spring.influx.actions=10000 spring.influx.actions=10000
spring.influx.bufferLimit=20000 spring.influx.bufferLimit=20000
\ No newline at end of file
# ??????????
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