Commit a86b56ea authored by wujiang's avatar wujiang

修改阳光采集

parent 44bf6c6a
...@@ -12,6 +12,8 @@ import java.util.Map; ...@@ -12,6 +12,8 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -121,9 +123,11 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -121,9 +123,11 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
List<SofarStationList> jsonObject = requestUtil.getResPonseList(SoFarConstant.stationListUrl, List<SofarStationList> jsonObject = requestUtil.getResPonseList(SoFarConstant.stationListUrl,
SoFarConstant.requestPost, requestInfo, SoFarConstant.resovleRule_data, SofarStationList.class); SoFarConstant.requestPost, requestInfo, SoFarConstant.resovleRule_data, SofarStationList.class);
// 新增td电站 // 新增td电站
int i = 0;
for (SofarStationList sunlight : jsonObject) { for (SofarStationList sunlight : jsonObject) {
sunlight.setCreatedTime(System.currentTimeMillis()); sunlight.setCreatedTime(System.currentTimeMillis());
sofarStationListMapper.insert(sunlight); sofarStationListMapper.insert(sunlight);
System.out.println(++i);
} }
//删除多余的信息 //删除多余的信息
deleteSHMessage(jsonObject); deleteSHMessage(jsonObject);
...@@ -191,11 +195,18 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -191,11 +195,18 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
} }
} }
List<String> names = jpStations.stream().map(i->i.getName()).collect(Collectors.toList());
// 封装电站数据 // 封装电站数据
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
SofarStationList sunlightDto = list.get(i); SofarStationList sunlightDto = list.get(i);
if(names.contains(sunlightDto.getName()))
{
continue;
}
// System.out.println(i+"===================================================="); // System.out.println(i+"====================================================");
JpStation jpStation = null; JpStation jpStation = null;
if (bodyparam.containsKey(sunlightDto.getId().toString())) { if (bodyparam.containsKey(sunlightDto.getId().toString())) {
...@@ -383,7 +394,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -383,7 +394,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
if (jsonObject1 != null && !jsonObject1.isEmpty()) { if (jsonObject1 != null && !jsonObject1.isEmpty()) {
Map<String, String> maps = jsonObject1.stream() Map<String, String> maps = jsonObject1.stream()
.collect(Collectors.toMap(SofarInverterDto::getKey, SofarInverterDto::getValue)); .collect(Collectors.toMap(SofarInverterDto::getKey, SofarInverterDto::getValue,(k1,k2)->k1));
// // 功率 // // 功率
// jpStation.setRealTimePower( // jpStation.setRealTimePower(
// maps != null && maps.containsKey("TPG") // maps != null && maps.containsKey("TPG")
......
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