Commit 1a238f23 authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer_bw' into developer_bw

parents b1177d9d 0938a0f3
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
public interface TanYinCustomerInfoMapper extends BaseMapper<TanYinCustomerInfo> { public interface TanYinCustomerInfoMapper extends BaseMapper<TanYinCustomerInfo> {
@Select("select project_no from tanyin_customer_info group by project_no") @Select("select project_no from house_pv_data.tanyin_customer_info group by project_no")
List<String> listProjectNo(); List<String> listProjectNo();
} }
...@@ -295,7 +295,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -295,7 +295,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate)) { if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate)) {
TdHYGFStationMonthGenerate = new TdHYGFStationMonthGenerate(); TdHYGFStationMonthGenerate = new TdHYGFStationMonthGenerate();
} }
householdPvApiService.addTdHYGFStationDayGenerate(TdHYGFStationMonthGenerate,hour);
TdHYGFStationMonthGenerate.setThirdStationId(stationIds.get(i)); TdHYGFStationMonthGenerate.setThirdStationId(stationIds.get(i));
TdHYGFStationMonthGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd")); TdHYGFStationMonthGenerate.setDayTime(DateUtil.format(today1, "yyyy-MM-dd"));
TdHYGFStationMonthGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM")); TdHYGFStationMonthGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM"));
...@@ -308,7 +308,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -308,7 +308,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
TdHYGFStationMonthGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); TdHYGFStationMonthGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
TdHYGFStationMonthGenerate.setStationName(jpStation.getName()); TdHYGFStationMonthGenerate.setStationName(jpStation.getName());
TdHYGFStationMonthGenerate.setStationState(jpStation.getState()); TdHYGFStationMonthGenerate.setStationState(jpStation.getState());
householdPvApiService.addTdHYGFStationDayGenerate(TdHYGFStationMonthGenerate,hour);
if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate.getCreatedTime())) { if (ObjectUtils.isEmpty(TdHYGFStationMonthGenerate.getCreatedTime())) {
TdHYGFStationMonthGenerate.setCreatedTime(System.currentTimeMillis()); TdHYGFStationMonthGenerate.setCreatedTime(System.currentTimeMillis());
TdHYGFStationMonthGenerateMapper.insert(TdHYGFStationMonthGenerate); TdHYGFStationMonthGenerateMapper.insert(TdHYGFStationMonthGenerate);
......
package com.yeejoin.amos.api.householdapi.face.service.impl; package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapBuilder; import cn.hutool.core.map.MapBuilder;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.api.householdapi.Utils.RedisUtils; import com.yeejoin.amos.api.householdapi.Utils.RedisUtils;
import com.yeejoin.amos.api.householdapi.Utils.TanYinApiUtils; import com.yeejoin.amos.api.householdapi.Utils.TanYinApiUtils;
import com.yeejoin.amos.api.householdapi.constant.TanYinConstant; import com.yeejoin.amos.api.householdapi.constant.TanYinConstant;
import com.yeejoin.amos.api.householdapi.face.dto.SunlightDto;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpCollector;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
...@@ -175,7 +179,6 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe ...@@ -175,7 +179,6 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
*/ */
@Scheduled (cron = "${dataRequestScheduled.tanYin}") @Scheduled (cron = "${dataRequestScheduled.tanYin}")
@Override @Override
public void customerInfoList() { public void customerInfoList() {
try { try {
String startDate = LocalDate.now().minusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String startDate = LocalDate.now().minusMonths(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
...@@ -236,16 +239,17 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe ...@@ -236,16 +239,17 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
for (List<String> projectNoList : projectNoLists) { for (List<String> projectNoList : projectNoLists) {
Map<String, Object> params = MapBuilder.<String, Object>create().put("projectNoList", projectNoList).put("powerDate", powerDate).build(); Map<String, Object> params = MapBuilder.<String, Object>create().put("projectNoList", projectNoList).put("powerDate", powerDate).build();
List<TanYinStationInfo> tanYinStationInfoList = tanYinApiUtils.post("电站基本信息", apiUrl + TanYinConstant.stationListUrl, params, null, TanYinStationInfo.class); List<TanYinStationInfo> tanYinStationInfoList = tanYinApiUtils.post("电站基本信息", apiUrl + TanYinConstant.stationListUrl, params, null, TanYinStationInfo.class);
if (CollectionUtils.isEmpty(tanYinStationInfoList)) { if (!CollectionUtils.isEmpty(tanYinStationInfoList)) {
continue; tanYinStationInfos.addAll(tanYinStationInfoList);
} }
tanYinStationInfos.addAll(tanYinStationInfoList);
} }
if (CollectionUtils.isEmpty(tanYinStationInfos)) { if (CollectionUtils.isEmpty(tanYinStationInfos)) {
log.warn("-------碳银同步电站结束: 未同步到电站基本信息 -------"); log.warn("-------碳银同步电站结束: 未同步到电站基本信息 -------");
return; return;
} }
List<String> stationIds = tanYinStationInfos.stream().map(TanYinStationInfo::getProjectNo).collect(Collectors.toList()); List<String> stationIds = tanYinStationInfos.stream().map(TanYinStationInfo::getProjectNo).collect(Collectors.toList());
//删除多余的场站
deleteTyMessage(stationIds);
List<JpStation> jpStations = jpStationMapper.selectList(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.TANYIN.getCode()).in("third_station_id", stationIds)); List<JpStation> jpStations = jpStationMapper.selectList(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.TANYIN.getCode()).in("third_station_id", stationIds));
Map<String, JpStation> jpStationMap = jpStations.stream().collect(Collectors.toMap(JpStation::getThirdStationId, Function.identity())); Map<String, JpStation> jpStationMap = jpStations.stream().collect(Collectors.toMap(JpStation::getThirdStationId, Function.identity()));
...@@ -433,6 +437,45 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe ...@@ -433,6 +437,45 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
} }
private void deleteTyMessage(List<String> stationIds) {
// 所有场站信息
if(CollectionUtil.isNotEmpty(stationIds)){
//场站
QueryWrapper<JpStation> wrapper = new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.TANYIN.getCode());
List<JpStation> jpStations = jpStationMapper.selectList(wrapper);
if(CollectionUtil.isNotEmpty(jpStations)){
for (JpStation jpStation : jpStations) {
if(!stationIds.contains(jpStation.getThirdStationId())){
//删除多余数据
jpStationMapper.deleteById(jpStation.getSequenceNbr());
}
}
}
//采集器
QueryWrapper<JpCollector> wrapper1 = new QueryWrapper<JpCollector>().eq("third_code", PVProducerInfoEnum.TANYIN.getCode());
List<JpCollector> jpCollectors = jpCollectorMapper.selectList(wrapper1);
if(CollectionUtil.isNotEmpty(jpCollectors)){
for (JpCollector jpCollector : jpCollectors) {
if(!stationIds.contains(jpCollector.getThirdStationId())){
//删除多余数据
jpCollectorMapper.deleteById(jpCollector.getSequenceNbr());
}
}
}
//逆变器
QueryWrapper<JpInverter> wrapper2 = new QueryWrapper<JpInverter>().eq("third_code", PVProducerInfoEnum.TANYIN.getCode());
List<JpInverter> jpInverters = jpInverterMapper.selectList(wrapper2);
if(CollectionUtil.isNotEmpty(jpInverters)){
for (JpInverter jpInverter : jpInverters) {
if(!stationIds.contains(jpInverter.getThirdStationId())){
//删除多余数据
jpInverterMapper.deleteById(jpInverter.getSequenceNbr());
}
}
}
}
}
@Override @Override
public void inverterList() { public void inverterList() {
......
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