Commit 01a42939 authored by chenzhao's avatar chenzhao

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

parents 612187c7 f8deeeb6
...@@ -208,6 +208,7 @@ public class GoodWeConstant { ...@@ -208,6 +208,7 @@ public class GoodWeConstant {
public static String inverterDayURL ="/v1/api/inverterDay"; public static String inverterDayURL ="/v1/api/inverterDay";
public static String inverterMonthURL ="/v1/api/inverterMonth"; public static String inverterMonthURL ="/v1/api/inverterMonth";
public static String inverterYearURL ="/v1/api/inverterYear"; public static String inverterYearURL ="/v1/api/inverterYear";
public static String snStatusURL ="/api/OpenApi/GetPowerStationMonitorDetailBySn";
public static String resovleRule_data_page_records = "data,page,records"; public static String resovleRule_data_page_records = "data,page,records";
public static String resovleRule_data_list = "data,list"; public static String resovleRule_data_list = "data,list";
public static String resovleRule_data_records = "data,records"; public static String resovleRule_data_records = "data,records";
......
...@@ -112,7 +112,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -112,7 +112,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
List<GoodWeStationMonitorDto> goodWeStationLists = goodWeRequestUtil.getResPonseList( List<GoodWeStationMonitorDto> goodWeStationLists = goodWeRequestUtil.getResPonseList(
GoodWeConstant.stationListStatusUrl, GoodWeConstant.requestPost, requestInfo, GoodWeConstant.stationListStatusUrl, GoodWeConstant.requestPost, requestInfo,
GoodWeConstant.resovleRule_data_list, GoodWeStationMonitorDto.class); GoodWeConstant.resovleRule_data_list, GoodWeStationMonitorDto.class);
//删除多余的场站 // 删除多余的场站
deleteBDWStation(goodWeStationLists); deleteBDWStation(goodWeStationLists);
if (goodWeStationLists.size() > 0) { if (goodWeStationLists.size() > 0) {
goodWeStationLists.forEach(goodWeStationMonitorDto -> { goodWeStationLists.forEach(goodWeStationMonitorDto -> {
...@@ -203,8 +203,9 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -203,8 +203,9 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
hygfjpStationPowerHistory.setStationState(jpStation.getState()); hygfjpStationPowerHistory.setStationState(jpStation.getState());
hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory); hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory);
HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne(new QueryWrapper<HYGFJPDayPower>() HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne(
.eq("third_station_id", jpStation.getThirdStationId()).eq("year_month_day", today).eq("hour", hour)); new QueryWrapper<HYGFJPDayPower>().eq("third_station_id", jpStation.getThirdStationId())
.eq("year_month_day", today).eq("hour", hour));
if (org.springframework.util.ObjectUtils.isEmpty(hygfjpDayPower)) { if (org.springframework.util.ObjectUtils.isEmpty(hygfjpDayPower)) {
hygfjpDayPower = new HYGFJPDayPower(); hygfjpDayPower = new HYGFJPDayPower();
} }
...@@ -318,20 +319,22 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -318,20 +319,22 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
/** /**
* 删除多余的场站 * 删除多余的场站
*
* @param goodWeStationLists * @param goodWeStationLists
*/ */
private void deleteBDWStation(List<GoodWeStationMonitorDto> goodWeStationLists) { private void deleteBDWStation(List<GoodWeStationMonitorDto> goodWeStationLists) {
if(CollectionUtil.isNotEmpty(goodWeStationLists)){ if (CollectionUtil.isNotEmpty(goodWeStationLists)) {
List<String> stationIds = new ArrayList<>(); List<String> stationIds = new ArrayList<>();
for (GoodWeStationMonitorDto goodWeStationMonitorDto : goodWeStationLists) { for (GoodWeStationMonitorDto goodWeStationMonitorDto : goodWeStationLists) {
stationIds.add(goodWeStationMonitorDto.getPowerstation_id()); stationIds.add(goodWeStationMonitorDto.getPowerstation_id());
} }
QueryWrapper<JpStation> wrapper = new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.GDW.getCode()); QueryWrapper<JpStation> wrapper = new QueryWrapper<JpStation>().eq("third_code",
PVProducerInfoEnum.GDW.getCode());
List<JpStation> jpStations = jpStationMapper.selectList(wrapper); List<JpStation> jpStations = jpStationMapper.selectList(wrapper);
if(CollectionUtil.isNotEmpty(jpStations)){ if (CollectionUtil.isNotEmpty(jpStations)) {
for (JpStation jpStation : jpStations) { for (JpStation jpStation : jpStations) {
if(!stationIds.contains(jpStation.getThirdStationId())){ if (!stationIds.contains(jpStation.getThirdStationId())) {
//删除多余数据 // 删除多余数据
jpStationMapper.deleteById(jpStation.getSequenceNbr()); jpStationMapper.deleteById(jpStation.getSequenceNbr());
} }
} }
...@@ -379,6 +382,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -379,6 +382,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
/** /**
* 获取场站id * 获取场站id
*
* @return * @return
*/ */
private List<String> getStationIds() { private List<String> getStationIds() {
...@@ -389,7 +393,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -389,7 +393,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
GoodWeConstant.stationListStatusUrl, GoodWeConstant.requestPost, requestInfo, GoodWeConstant.stationListStatusUrl, GoodWeConstant.requestPost, requestInfo,
GoodWeConstant.resovleRule_data_list, GoodWeStationMonitorDto.class); GoodWeConstant.resovleRule_data_list, GoodWeStationMonitorDto.class);
List<String> stationIds = new ArrayList<>(); List<String> stationIds = new ArrayList<>();
if(CollectionUtil.isNotEmpty(goodWeStationLists)){ if (CollectionUtil.isNotEmpty(goodWeStationLists)) {
for (GoodWeStationMonitorDto goodWeStationMonitorDto : goodWeStationLists) { for (GoodWeStationMonitorDto goodWeStationMonitorDto : goodWeStationLists) {
stationIds.add(goodWeStationMonitorDto.getPowerstation_id()); stationIds.add(goodWeStationMonitorDto.getPowerstation_id());
} }
...@@ -404,7 +408,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -404,7 +408,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
long ts = System.currentTimeMillis(); long ts = System.currentTimeMillis();
logger.info("-------固德威同步场站月发电量开始" + ts + "------- " + sdf.format(new Date())); logger.info("-------固德威同步场站月发电量开始" + ts + "------- " + sdf.format(new Date()));
// List<String> stationIds = goodWeStationMonitorListMapper.getStationIds(); // List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
List<String> stationIds = getStationIds(); List<String> stationIds = getStationIds();
stationIds.forEach(stationId -> { stationIds.forEach(stationId -> {
String currentMonth = DateUtil.format(new Date(), "yyyyMM"); String currentMonth = DateUtil.format(new Date(), "yyyyMM");
HashMap<String, Object> requestInfo = new HashMap<>(); HashMap<String, Object> requestInfo = new HashMap<>();
...@@ -442,7 +446,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -442,7 +446,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
long ts = System.currentTimeMillis(); long ts = System.currentTimeMillis();
logger.info("-------固德威同步场站年发电量开始" + ts + "------- " + sdf.format(new Date())); logger.info("-------固德威同步场站年发电量开始" + ts + "------- " + sdf.format(new Date()));
// List<String> stationIds = goodWeStationMonitorListMapper.getStationIds(); // List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
List<String> stationIds = getStationIds(); List<String> stationIds = getStationIds();
stationIds.forEach(stationId -> { stationIds.forEach(stationId -> {
String currentYear = DateUtil.format(new Date(), "yyyy"); String currentYear = DateUtil.format(new Date(), "yyyy");
HashMap<String, Object> requestInfo = new HashMap<>(); HashMap<String, Object> requestInfo = new HashMap<>();
...@@ -487,7 +491,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -487,7 +491,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
logger.info("-------固德威同步逆变器开始" + ts + "------- " + sdf.format(new Date())); logger.info("-------固德威同步逆变器开始" + ts + "------- " + sdf.format(new Date()));
// List<String> stationIds = goodWeStationMonitorListMapper.getStationIds(); // List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
List<String> stationIds = getStationIds(); List<String> stationIds = getStationIds();
//删除多余的逆变器 // 删除多余的逆变器
deleteGDWInverter(stationIds); deleteGDWInverter(stationIds);
stationIds.stream().forEach(stationId -> { stationIds.stream().forEach(stationId -> {
HashMap<String, Object> requestInfo = new HashMap<>(); HashMap<String, Object> requestInfo = new HashMap<>();
...@@ -519,6 +523,29 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -519,6 +523,29 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
jpInverter.setStationName(jpStation.getName()); jpInverter.setStationName(jpStation.getName());
} }
jpInverter.setRecDate(new Date()); jpInverter.setRecDate(new Date());
HashMap<String, Object> requestInfo2 = new HashMap<>();
requestInfo2.put("page_index", 1);
requestInfo2.put("page_size", 1);
requestInfo2.put("sn", jpInverter.getSnCode());
String requstParam2 = JSON.toJSONString(requestInfo2);
List<GoodWeStationDetail> goodWeStationDetails = goodWeRequestUtil.getResPonse(
GoodWeConstant.snStatusURL, GoodWeConstant.requestPost, requstParam2,
GoodWeConstant.resovleRule_data_list, GoodWeStationDetail.class);
if (goodWeStationDetails != null && !goodWeStationDetails.isEmpty()) {
Integer s = goodWeStationDetails.get(0).getStatus();
// (“” or null:全部,-1:离线 0:待机 1:发电中 2:停机 -2:无设备)
if (s == 0 || s == 1) {
jpInverter.setState("在线");
} else if (s == null || s == -1 || s == 2 | s == -2) {
jpInverter.setState("离线");
} else {
jpInverter.setState("离线");
}
} else {
jpInverter.setState("离线");
}
if (!org.springframework.util.ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) { if (!org.springframework.util.ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter); jpInverterMapper.updateById(jpInverter);
} else { } else {
...@@ -531,15 +558,17 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe ...@@ -531,15 +558,17 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
/** /**
* 删除多余的逆变器 * 删除多余的逆变器
*
* @param stationIds * @param stationIds
*/ */
private void deleteGDWInverter(List<String> stationIds) { private void deleteGDWInverter(List<String> stationIds) {
QueryWrapper<JpInverter> wrapper = new QueryWrapper<JpInverter>().eq("third_code", PVProducerInfoEnum.GDW.getCode()); QueryWrapper<JpInverter> wrapper = new QueryWrapper<JpInverter>().eq("third_code",
PVProducerInfoEnum.GDW.getCode());
List<JpInverter> jpInverters = jpInverterMapper.selectList(wrapper); List<JpInverter> jpInverters = jpInverterMapper.selectList(wrapper);
if(CollectionUtil.isNotEmpty(jpInverters)){ if (CollectionUtil.isNotEmpty(jpInverters)) {
for (JpInverter jpInverter : jpInverters) { for (JpInverter jpInverter : jpInverters) {
if(!stationIds.contains(jpInverter.getThirdStationId())){ if (!stationIds.contains(jpInverter.getThirdStationId())) {
//删除多余数据 // 删除多余数据
jpInverterMapper.deleteById(jpInverter.getSequenceNbr()); jpInverterMapper.deleteById(jpInverter.getSequenceNbr());
} }
} }
......
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