Commit a86b56ea authored by wujiang's avatar wujiang

修改阳光采集

parent 44bf6c6a
......@@ -12,6 +12,8 @@ import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import cn.hutool.core.collection.CollectionUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
......@@ -121,9 +123,11 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
List<SofarStationList> jsonObject = requestUtil.getResPonseList(SoFarConstant.stationListUrl,
SoFarConstant.requestPost, requestInfo, SoFarConstant.resovleRule_data, SofarStationList.class);
// 新增td电站
int i = 0;
for (SofarStationList sunlight : jsonObject) {
sunlight.setCreatedTime(System.currentTimeMillis());
sofarStationListMapper.insert(sunlight);
System.out.println(++i);
}
//删除多余的信息
deleteSHMessage(jsonObject);
......@@ -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++) {
SofarStationList sunlightDto = list.get(i);
if(names.contains(sunlightDto.getName()))
{
continue;
}
// System.out.println(i+"====================================================");
JpStation jpStation = null;
if (bodyparam.containsKey(sunlightDto.getId().toString())) {
......@@ -383,7 +394,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
if (jsonObject1 != null && !jsonObject1.isEmpty()) {
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(
// maps != null && maps.containsKey("TPG")
......@@ -484,7 +495,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation);
} else {
jpStationMapper.insert(jpStation);
jpStationMapper.insert(jpStation);
}
String today = DateUtil.today();
......
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