Commit 019ac91c authored by wujiang's avatar wujiang

修改首航采集

parent 55682b35
...@@ -11,14 +11,10 @@ public class SoFarConstant { ...@@ -11,14 +11,10 @@ public class SoFarConstant {
{ {
put("1", "在线"); put("1", "在线");
put("0", "离线"); put("0", "离线");
put("2","报警" ); put("2", "报警");
} }
}; };
public static String baseurl = "https://openapi.sofarsolarmonitor.com"; public static String baseurl = "https://openapi.sofarsolarmonitor.com";
public static String appId = "447430219192733696"; public static String appId = "447430219192733696";
public static String appSecret = "5881ee8c062817016a2b34425c45937d"; public static String appSecret = "5881ee8c062817016a2b34425c45937d";
...@@ -33,10 +29,11 @@ public class SoFarConstant { ...@@ -33,10 +29,11 @@ public class SoFarConstant {
public static String currentData = "/device/v1.0/currentData"; public static String currentData = "/device/v1.0/currentData";
public static String nbqlist = "/station/v1.0/device?language=zh"; public static String nbqlist = "/station/v1.0/device?language=zh";
public static String historical = "/device/v1.0/historical"; public static String historical = "/device/v1.0/historical";
public static String stationhisUrl = "/station/v1.0/plantHistory";
public static String alert = "/station/v1.0/alert"; public static String alert = "/station/v1.0/alert";
public static String equipComm ="/device/v1.0/equipComm"; public static String equipComm = "/device/v1.0/equipComm";
public static String alertDetail= "device/v1.0/alertDetail"; public static String alertDetail = "/device/v1.0/alertDetail";
public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor"; public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor";
public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail"; public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail";
...@@ -45,12 +42,12 @@ public class SoFarConstant { ...@@ -45,12 +42,12 @@ public class SoFarConstant {
public static String inverterListUrl = "/v1/api/inverterList"; public static String inverterListUrl = "/v1/api/inverterList";
public static String inverterDetailUrl = "/v1/api/inverterDetail"; public static String inverterDetailUrl = "/v1/api/inverterDetail";
public static String alarmListUrl = "/v1/api/alarmList"; public static String alarmListUrl = "/v1/api/alarmList";
public static String stationDayGenUrl ="/v1/api/stationDayEnergyList"; public static String stationDayGenUrl = "/v1/api/stationDayEnergyList";
public static String stationMonthEnergyList ="/v1/api/stationDayEnergyList"; public static String stationMonthEnergyList = "/v1/api/stationDayEnergyList";
public static String stationYearEnergyList ="/v1/api/stationDayEnergyList"; public static String stationYearEnergyList = "/v1/api/stationDayEnergyList";
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 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";
...@@ -58,10 +55,9 @@ public class SoFarConstant { ...@@ -58,10 +55,9 @@ public class SoFarConstant {
public static String deviceListItems = "deviceListItems"; public static String deviceListItems = "deviceListItems";
public static String communication="communication"; public static String communication = "communication";
public static String stationAlertItems="stationAlertItems"; public static String stationAlertItems = "stationAlertItems";
public static String dataList = "dataList"; public static String dataList = "dataList";
public static String paramDataList = "paramDataList"; public static String paramDataList = "paramDataList";
public static String requestPost = "POST"; public static String requestPost = "POST";
......
...@@ -212,7 +212,7 @@ public class JpStation implements Serializable { ...@@ -212,7 +212,7 @@ public class JpStation implements Serializable {
@TableField("day_power_use") @TableField("day_power_use")
private Double dayPowerUse; // 日用电量 private Double dayPowerUse; // 日用电量
@TableField("month_power_use") @TableField("month_power_use")
private Double monthPowerPse; // 月用电量 private Double monthPowerUse; // 月用电量
@TableField("year_power_use") @TableField("year_power_use")
private Double yearPowerUse; // 年用电量 private Double yearPowerUse; // 年用电量
@TableField("email") @TableField("email")
......
...@@ -22,8 +22,8 @@ public class SofarStationList { ...@@ -22,8 +22,8 @@ public class SofarStationList {
private Integer installedCapacity ;// 装机容量 private Integer installedCapacity ;// 装机容量
private Long lastUpdateTime ;//电站的最后一条数据更新时间 private Long lastUpdateTime ;//电站的最后一条数据更新时间
private String locationAddress ;// 详细地址 private String locationAddress ;// 详细地址
private Integer locationLat ;// 纬度 private String locationLat ;// 纬度
private Integer locationLng ;// 经度 private String locationLng ;// 经度
private String name ;// 电站名称 private String name ;// 电站名称
private String networkStatus ;// 通信状态 private String networkStatus ;// 通信状态
private Integer regionLevel1 ;// 行政区1 private Integer regionLevel1 ;// 行政区1
......
package com.yeejoin.amos.api.householdapi.face.service.impl; package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.date.DatePattern; import java.math.BigDecimal;
import cn.hutool.core.date.DateTime; import java.math.RoundingMode;
import cn.hutool.core.date.DateUtil; import java.text.SimpleDateFormat;
import cn.hutool.json.JSONUtil; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.Utils.SofarRequestUtil; import com.yeejoin.amos.api.householdapi.Utils.SofarRequestUtil;
import com.yeejoin.amos.api.householdapi.Utils.SunlightUtil;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.constant.KSolarConstant;
import com.yeejoin.amos.api.householdapi.constant.SoFarConstant; import com.yeejoin.amos.api.householdapi.constant.SoFarConstant;
import com.yeejoin.amos.api.householdapi.face.dto.*; import com.yeejoin.amos.api.householdapi.face.dto.SofarInverterDto;
import com.yeejoin.amos.api.householdapi.face.dto.SofarWarm;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpCollector; 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;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.*; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPInverterWarn;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPStationPowerHistory;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.SofarInverter;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.SofarStationList;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterDayGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterTotalGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterYearGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationDayGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationYearGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpCollectorMapper; import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpCollectorMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterElectricityMapper; import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterElectricityMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterMapper; import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper; import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*; import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPCollectorHistoryMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPDayPowerMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPInverterWarnMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPStationPowerHistoryMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.SofarStationListMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterDayGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterMonthGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterTotalGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterYearGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFStationDayGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFStationMonthGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFStationYearGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdJpStationMapper;
import com.yeejoin.amos.api.householdapi.face.service.SofarDataAcquisitionService; import com.yeejoin.amos.api.householdapi.face.service.SofarDataAcquisitionService;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum; import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.text.SimpleDateFormat; import cn.hutool.core.date.DatePattern;
import java.util.*; import cn.hutool.core.date.DateUtil;
import java.util.concurrent.TimeUnit; import fastjson.JSON;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service @Service
public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionService { public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionService {
...@@ -66,7 +93,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -66,7 +93,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
private TdHYGFInverterTotalGenerateMapper tdHYGFInverterTotalGenerateMapper; private TdHYGFInverterTotalGenerateMapper tdHYGFInverterTotalGenerateMapper;
@Autowired @Autowired
private JpInverterElectricityMapper jpInverterElectricityMapper; private JpInverterElectricityMapper jpInverterElectricityMapper;
//户用光伏逆变器告警 // 户用光伏逆变器告警
@Autowired @Autowired
private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper; private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper;
@Autowired @Autowired
...@@ -85,233 +112,328 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -85,233 +112,328 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
@Override @Override
@Scheduled(cron = "${dataRequstScheduled.Sofar}") @Scheduled(cron = "${dataRequstScheduled.Sofar}")
@PostConstruct
public void stationList() { public void stationList() {
Map<String, Object> requestInfo = new HashMap<>(); Map<String, Object> requestInfo = new HashMap<>();
requestInfo.put("page", 1); requestInfo.put("page", 1);
requestInfo.put("size", 1000); requestInfo.put("size", 1000);
String param = JSON.toJSONString(requestInfo); String param = JSON.toJSONString(requestInfo);
List<SofarStationList> jsonObject= requestUtil.getResPonse( List<SofarStationList> jsonObject = requestUtil.getResPonse(SoFarConstant.stationListUrl,
SoFarConstant.stationListUrl, SoFarConstant.requestPost, param, SoFarConstant.resovleRule_data, SofarStationList.class);
SoFarConstant.requestPost, // 新增td电站
param,
SoFarConstant.resovleRule_data,
SofarStationList.class);
//新增td电站
for (SofarStationList sunlight : jsonObject) { for (SofarStationList sunlight : jsonObject) {
sunlight.setCreatedTime(System.currentTimeMillis()); sunlight.setCreatedTime(System.currentTimeMillis());
sofarStationListMapper.insert(sunlight); sofarStationListMapper.insert(sunlight);
} }
//mysql电站信息 // mysql电站信息
this.stationDetail(jsonObject); this.stationDetail(jsonObject);
} }
@Override @Override
public void stationDetail(List<SofarStationList> list) { public void stationDetail(List<SofarStationList> list) {
// 业务表场站
List<JpStation> jpStations = jpStationMapper
.selectList(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.SH.getCode()));
//业务表场站 Map<String, JpStation> bodyparam = new HashMap<>();
List<JpStation> jpStations = jpStationMapper.selectList(new QueryWrapper<JpStation>().
eq("third_code", PVProducerInfoEnum.SH.getCode()));
Map<String, JpStation> bodyparam=new HashMap<>(); if (jpStations != null && jpStations.size() > 0) {
if(jpStations!=null&&jpStations.size()>0){
for (JpStation jpStation : jpStations) { for (JpStation jpStation : jpStations) {
bodyparam.put(jpStation.getThirdStationId(),jpStation); bodyparam.put(jpStation.getThirdStationId(), jpStation);
} }
} }
// 封装电站数据
//封装电站数据
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);
// 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())){ jpStation = bodyparam.get(sunlightDto.getId().toString());
jpStation=bodyparam.get(sunlightDto.getId().toString()); } else {
}else{ jpStation = new JpStation();
jpStation=new JpStation();
} }
jpStation.setThirdStationId(sunlightDto.getId().toString()); jpStation.setThirdStationId(sunlightDto.getId().toString());
jpStation.setName(sunlightDto.getName()); jpStation.setName(sunlightDto.getName());
jpStation.setAddress(sunlightDto.getLocationAddress()); jpStation.setAddress(sunlightDto.getLocationAddress());
jpStation.setLongitude(sunlightDto.getLocationLng()==null?null:sunlightDto.getLocationLng().toString()); if(sunlightDto.getLocationLng() != null)
jpStation.setLatitude(sunlightDto.getLocationLat()==null?null:sunlightDto.getLocationLat().toString()); {
BigDecimal bd = new BigDecimal(sunlightDto.getLocationLng());
bd = bd.setScale(6, RoundingMode.DOWN);
double truncatedNumber = bd.doubleValue();
jpStation.setLongitude(String.valueOf(truncatedNumber));
}
if(sunlightDto.getLocationLat() != null )
{
BigDecimal bd = new BigDecimal(sunlightDto.getLocationLat());
bd = bd.setScale(6, RoundingMode.DOWN);
double truncatedNumber = bd.doubleValue();
jpStation.setLatitude(String.valueOf(truncatedNumber));
}
jpStation.setThirdCode(PVProducerInfoEnum.SH.getCode()); jpStation.setThirdCode(PVProducerInfoEnum.SH.getCode());
// 并网类型 // 并网类型
jpStation.setOnGridType(SofarRequestUtil.intoNetWorkStatus.get(sunlightDto.getGridInterconnectionType())); jpStation.setOnGridType(SofarRequestUtil.intoNetWorkStatus.get(sunlightDto.getGridInterconnectionType()));
//第三方厂商标识 // 第三方厂商标识
// jpStation.setThirdCode(PVProducerInfoEnum.YG.getCode()); // jpStation.setThirdCode(PVProducerInfoEnum.YG.getCode());
jpStation.setRecDate(new Date()); jpStation.setRecDate(new Date());
//获取单个电站详情 // 获取单个电站详情
Map<String, Object> requestInfo = new HashMap<>(); Map<String, Object> requestInfo = new HashMap<>();
requestInfo.put("stationId", sunlightDto.getId()); requestInfo.put("stationId", sunlightDto.getId());
String param = JSON.toJSONString(requestInfo); String param = JSON.toJSONString(requestInfo);
com.alibaba.fastjson.JSONObject jsonObject= requestUtil.getResPonseobj( com.alibaba.fastjson.JSONObject jsonObject = requestUtil.getResPonseobj(SoFarConstant.stationUrl,
SoFarConstant.stationUrl, SoFarConstant.requestPost, param, null);
SoFarConstant.requestPost,
param, jpStation.setType("家庭户用");// 电站类型
null jpStation.setPrice(jsonObject.get("mergeElectricPrice") != null
); ? Double.valueOf(jsonObject.get("mergeElectricPrice").toString())
: null);// 上网电价
jpStation.setType("家庭户用");//电站类型 jpStation.setUserName(jsonObject.get("ownerName") != null ? jsonObject.get("ownerName").toString() : null);// 业主姓名
jpStation.setPrice(jsonObject.get("mergeElectricPrice")!=null?Double.valueOf(jsonObject.get("mergeElectricPrice").toString()):null);//上网电价
jpStation.setUserName(jsonObject.get("ownerName")!=null?jsonObject.get("ownerName").toString():null);// 业主姓名
// jpStation.setEmail(null);// 邮箱 // jpStation.setEmail(null);// 邮箱
// jpStation.setArea();//地区 // jpStation.setArea();//地区
// jpStation.setOnGridTime(); // 并网时间 Long startOperatingTime = jsonObject.get("startOperatingTime") != null
? Long.valueOf(jsonObject.get("startOperatingTime").toString())
: null;
if (startOperatingTime != null) {
jpStation.setOnGridTime(new Date(startOperatingTime)); // 并网时间
}
// jpStation.setAccessTime();// 接入平台时间 // jpStation.setAccessTime();// 接入平台时间
// jpStation.setStationContact();// 电站联系人 // jpStation.setStationContact();// 电站联系人
// jpStation.setModuleCount(); // 组件数量 // jpStation.setModuleCount(); // 组件数量
jpStation.setUserPhone(jsonObject.get("contactPhone")!=null?jsonObject.get("contactPhone").toString():null);//业主电话 jpStation.setUserPhone(
jpStation.setCreateTime(sunlightDto.getCreateDate()!=null? jsonObject.get("contactPhone") != null ? jsonObject.get("contactPhone").toString() : null);// 业主电话
new Date(sunlightDto.getCreateDate()) :null); // 创建时间 jpStation.setCreateTime(sunlightDto.getCreateDate() != null ? new Date(sunlightDto.getCreateDate()) : null); // 创建时间
jpStation.setSnCode(sunlightDto.getId().toString());//sncode jpStation.setSnCode(sunlightDto.getId().toString());// sncode
jpStation.setCapacity( jsonObject.get("installedCapacity")!=null? Double.valueOf(jsonObject.get("installedCapacity").toString())/100:null);//装机容量 jpStation.setCapacity(jsonObject.get("installedCapacity") != null
jpStation.setRatedPower(sunlightDto.getGenerationPower()!=null?Double.valueOf(sunlightDto.getGenerationPower())/1000:null);//额定功率 ? Double.valueOf(jsonObject.get("installedCapacity").toString())
: null);// 装机容量
jpStation.setRatedPower(
sunlightDto.getGenerationPower() != null ? Double.valueOf(sunlightDto.getGenerationPower()) / 1000
: null);// 额定功率
String state = "离线";
if ("NORMAL".equals(sunlightDto.getNetworkStatus())) {
state = "在线";
} else if ("ALL_OFFLINE".equals(sunlightDto.getNetworkStatus())) {
state = "离线";
}
jpStation.setState(state);// 状态
// 获取单个电站历史数据
// 获取当日数据
Date date = new Date();
Calendar calendar = Calendar.getInstance();
int cDay = calendar.get(Calendar.DAY_OF_MONTH);
int cMonth = calendar.get(Calendar.MONTH) + 1;
int cYear = calendar.get(Calendar.YEAR);
SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM");
String month = sdfMonth.format(date);
Map<String, Object> requestInfoDay = new HashMap<>();
requestInfoDay.put("startTime", month);
requestInfoDay.put("endTime", month);
requestInfoDay.put("stationId", sunlightDto.getId());
requestInfoDay.put("timeType", 2);
String paramDay = JSON.toJSONString(requestInfoDay);
com.alibaba.fastjson.JSONObject jsonObjectDay = requestUtil.getResPonseobj(SoFarConstant.stationhisUrl,
SoFarConstant.requestPost, paramDay, null);
if (jsonObjectDay != null && jsonObjectDay.get("stationDataItems") != null) {
JSONArray monthList = jsonObjectDay.getJSONArray("stationDataItems");
Stream<JSONObject> stream = monthList.stream().map(element -> (JSONObject) element);
List<JSONObject> filteredList = stream.filter(obj -> cDay == (obj.getInteger("day")))
.collect(Collectors.toList());
if (filteredList != null && filteredList.size() > 0) {
jpStation.setRealTimePower(filteredList.get(0).getDouble("generationPower") / 1000);
jpStation.setDayGenerate(filteredList.get(0).getDouble("generationValue"));
jpStation.setDayPowerUse(filteredList.get(0).getDouble("useValue"));
jpStation.setDayIncome(filteredList.get(0).getDouble("generationValue") * 0.45);
}
}
// 获取当月数据
SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
String year = sdfYear.format(date);
requestInfoDay.put("startTime", year);
requestInfoDay.put("endTime", year);
requestInfoDay.put("timeType", 3);
paramDay = JSON.toJSONString(requestInfoDay);
com.alibaba.fastjson.JSONObject jsonObjectMonth = requestUtil.getResPonseobj(SoFarConstant.stationhisUrl,
SoFarConstant.requestPost, paramDay, null);
if (jsonObjectMonth != null && jsonObjectMonth.get("stationDataItems") != null) {
JSONArray monthList = jsonObjectMonth.getJSONArray("stationDataItems");
Stream<JSONObject> stream = monthList.stream().map(element -> (JSONObject) element);
List<JSONObject> filteredList = stream.filter(obj -> cMonth == (obj.getInteger("month")))
.collect(Collectors.toList());
if (filteredList != null && filteredList.size() > 0) {
jpStation.setMonthGenerate(filteredList.get(0).getDouble("generationValue"));
jpStation.setMonthPowerUse(filteredList.get(0).getDouble("useValue"));
jpStation.setMonthIncome(filteredList.get(0).getDouble("generationValue") * 0.45);
}
}
// 获取当年数据
requestInfoDay.put("timeType", 4);
paramDay = JSON.toJSONString(requestInfoDay);
com.alibaba.fastjson.JSONObject jsonObjectYear = requestUtil.getResPonseobj(SoFarConstant.stationhisUrl,
SoFarConstant.requestPost, paramDay, null);
if (jsonObjectYear != null && jsonObjectYear.get("stationDataItems") != null) {
JSONArray monthList = jsonObjectYear.getJSONArray("stationDataItems");
Stream<JSONObject> stream = monthList.stream().map(element -> (JSONObject) element);
List<JSONObject> filteredList = stream.filter(obj -> cYear == (obj.getInteger("year")))
.collect(Collectors.toList());
if (filteredList != null && filteredList.size() > 0) {
jpStation.setYearGenerate(filteredList.get(0).getDouble("generationValue"));
jpStation.setYearPowerUse(filteredList.get(0).getDouble("useValue"));
jpStation.setYearIncome(filteredList.get(0).getDouble("generationValue") * 0.45);
}
}
// 获取累计数据
requestInfoDay.put("startTime", cYear - 2);
paramDay = JSON.toJSONString(requestInfoDay);
com.alibaba.fastjson.JSONObject jsonObjectAll = requestUtil.getResPonseobj(SoFarConstant.stationhisUrl,
SoFarConstant.requestPost, paramDay, null);
if (jsonObjectAll != null && jsonObjectAll.get("stationDataItems") != null) {
JSONArray monthList = jsonObjectYear.getJSONArray("stationDataItems");
double all = 0.0;
if (monthList != null && monthList.size() > 0) {
for (Object obj : monthList) {
JSONObject json = (JSONObject) obj;
all += json.getDouble("generationValue");
}
}
jpStation.setAccumulatedPower(all);
jpStation.setCumulativeIncome(all * 0.45);
}
//获取所电站下逆变器 // 获取所电站下逆变器
Map<String, Object> requestInfo2 = new HashMap<>(); Map<String, Object> requestInfo2 = new HashMap<>();
requestInfo2.put("stationId", sunlightDto.getId()); requestInfo2.put("stationId", sunlightDto.getId());
requestInfo2.put("deviceType", "INVERTER"); requestInfo2.put("deviceType", "INVERTER");
requestInfo2.put("page", "1");
requestInfo2.put("size", "10000");
String param2 = JSON.toJSONString(requestInfo2); String param2 = JSON.toJSONString(requestInfo2);
List<SofarInverter> jsonObject2= requestUtil.getResPonse( List<SofarInverter> jsonObject2 = requestUtil.getResPonse(SoFarConstant.nbqlist, SoFarConstant.requestPost,
SoFarConstant.nbqlist, param2, SoFarConstant.deviceListItems, SofarInverter.class);
SoFarConstant.requestPost, if (jsonObject2 != null && jsonObject2.size() > 0) {
param2, // 获取设备实时数据
SoFarConstant.deviceListItems,
SofarInverter.class);
if(jsonObject2!=null&&jsonObject2.size()>0){
//获取设备实时数据
Map<String, Object> requestInfo1 = new HashMap<>(); Map<String, Object> requestInfo1 = new HashMap<>();
requestInfo1.put("deviceSn", jsonObject2.get(0).getDeviceSn()); requestInfo1.put("deviceSn", jsonObject2.get(0).getDeviceSn());
String param1 = JSON.toJSONString(requestInfo1); String param1 = JSON.toJSONString(requestInfo1);
List<SofarInverterDto> jsonObject1= requestUtil.getResPonse( List<SofarInverterDto> jsonObject1 = requestUtil.getResPonse(SoFarConstant.currentData,
SoFarConstant.currentData, SoFarConstant.requestPost, param1, SoFarConstant.dataList, SofarInverterDto.class);
SoFarConstant.requestPost, // 电站 报警状态 值为2
param1, for (SofarInverter sofarInverter : jsonObject2) {
SoFarConstant.dataList, if (sofarInverter.getConnectStatus() == 2) {
SofarInverterDto.class jpStation.setState(SoFarConstant.stationStaus.get(sofarInverter.getConnectStatus() + ""));// 电站状态
); break;
//状态
if( jsonObject2.get(0).getConnectStatus()!=null) {
jpStation.setState(SoFarConstant.stationStaus.get(jsonObject2.get(0).getConnectStatus()+""));//电站状态
}
if(jsonObject1!=null&&!jsonObject1.isEmpty()){
Map<String, String> maps = jsonObject1.stream().collect(Collectors.toMap(SofarInverterDto::getKey,SofarInverterDto::getValue));
//功率
jpStation.setRealTimePower( maps!=null&&maps.containsKey("TPG")?
(String.valueOf(maps.get("TPG"))!=null?Double.valueOf(maps.get("TPG").toString())/1000:null):null);//实时功率
//日发电量
jpStation.setDayGenerate( maps!=null&&maps.containsKey("Etdy_ge1")?
(String.valueOf(maps.get("Etdy_ge1"))!=null?Double.valueOf(maps.get("Etdy_ge1").toString()):null):null);//日发电量
//累计发电量
jpStation.setAccumulatedPower(maps!=null&&maps.containsKey("Et_ge0")?
(String.valueOf(maps.get("Et_ge0"))!=null?Double.valueOf(maps.get("Et_ge0").toString()):null):null);//累计发电量
//累计发电量
jpStation.setAccumulatedPower(jpStation.getDayGenerate()!=null?
Double.valueOf(jpStation.getDayGenerate().toString())*0.45:null);//日收益
//累计发电量
jpStation.setCumulativeIncome(jpStation.getAccumulatedPower()!=null?
Double.valueOf(jpStation.getAccumulatedPower().toString())*0.45:null);//累计收益
//获取月发电量
Map<String, Object> requestInfoy = new HashMap<>();
requestInfoy.put("deviceSn", jsonObject2.get(0).getDeviceSn());
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
requestInfoy.put("startTime",year+"" );
requestInfoy.put("endTime", year+"");
requestInfoy.put("timeType", 4);
String paramy = JSON.toJSONString(requestInfoy);
List<Sofarhistorical> jsonObjecty= requestUtil.getResPonse(
SoFarConstant.currentData,
SoFarConstant.requestPost,
paramy,
SoFarConstant.paramDataList,
Sofarhistorical.class
);
if(jsonObjecty!=null&&jsonObjecty.size()>0){
List<Sofarhistorical> jsonObjectyf=jsonObjecty.stream()
.filter(da -> Objects.nonNull(da))
.filter(da -> da.getCollectTime().equals(month+""))
.collect(Collectors.toList());
if(!jsonObjectyf.isEmpty()){
for (Sofarhistorical sofarhistorical : jsonObjectyf) {
if(sofarhistorical.getDataList().get(0).getKey().equals("generation")){
// 月发电量
jpStation.setMonthGenerate(sofarhistorical.getDataList().get(0).getValue()!=null?Double.valueOf(sofarhistorical.getDataList().get(0).getValue()):null);
// 月收益
jpStation.setMonthIncome(jpStation.getMonthGenerate()!=null?jpStation.getMonthGenerate()*0.45:null);
}
}
} }
} }
if (jsonObject1 != null && !jsonObject1.isEmpty()) {
Map<String, String> maps = jsonObject1.stream()
//获取年发电量 .collect(Collectors.toMap(SofarInverterDto::getKey, SofarInverterDto::getValue));
Map<String, Object> requestInfoyn = new HashMap<>(); // // 功率
requestInfoyn.put("deviceSn", jsonObject2.get(0).getDeviceSn()); // jpStation.setRealTimePower(
requestInfoyn.put("startTime",year+"" ); // maps != null && maps.containsKey("TPG")
requestInfoyn.put("endTime", year+""); // ? (String.valueOf(maps.get("TPG")) != null
requestInfoyn.put("timeType", 5); // ? Double.valueOf(maps.get("TPG").toString()) / 1000
// : null)
// : null);// 实时功率
String paramyn = JSON.toJSONString(requestInfoyn); //
List<Sofarhistorical> jsonObjectyn= requestUtil.getResPonse( // // 日发电量
SoFarConstant.currentData, // jpStation
SoFarConstant.requestPost, // .setDayGenerate(maps != null && maps.containsKey("Etdy_ge1")
paramyn, // ? (String.valueOf(maps.get("Etdy_ge1")) != null
SoFarConstant.paramDataList, // ? Double.valueOf(maps.get("Etdy_ge1").toString())
Sofarhistorical.class // : null)
); // : null);// 日发电量
// // 累计发电量
if(jsonObjectyn!=null&&jsonObjectyn.size()>0){ // jpStation
// .setAccumulatedPower(maps != null && maps.containsKey("Et_ge0")
List<Sofarhistorical> jsonObjectyfn=jsonObjectyn.stream() // ? (String.valueOf(maps.get("Et_ge0")) != null
.filter(da -> Objects.nonNull(da)) // ? Double.valueOf(maps.get("Et_ge0").toString())
.filter(da -> da.getCollectTime().equals(year+"")) // : null)
.collect(Collectors.toList()); // : null);// 累计发电量
if(!jsonObjectyfn.isEmpty()){ // // 累计发电量
for (Sofarhistorical sofarhistorical : jsonObjectyfn) { // jpStation.setAccumulatedPower(jpStation.getDayGenerate() != null
if(sofarhistorical.getDataList().get(0).getKey().equals("generation")){ // ? Double.valueOf(jpStation.getDayGenerate().toString()) * 0.45
// 年发电量 // : null);// 日收益
jpStation.setYearGenerate(sofarhistorical.getDataList().get(0).getValue()!=null?Double.valueOf(sofarhistorical.getDataList().get(0).getValue()):null); // // 累计发电量
// 年月收益 // jpStation.setCumulativeIncome(jpStation.getAccumulatedPower() != null
jpStation.setYearIncome(jpStation.getYearGenerate()!=null?jpStation.getYearGenerate()*0.45:null); // ? Double.valueOf(jpStation.getAccumulatedPower().toString()) * 0.45
// : null);// 累计收益
}
} // 获取月发电量
} // Map<String, Object> requestInfoy = new HashMap<>();
} // requestInfoy.put("deviceSn", jsonObject2.get(0).getDeviceSn());
// Calendar calendar = Calendar.getInstance();
// int year = calendar.get(Calendar.YEAR);
// int month = calendar.get(Calendar.MONTH) + 1;
// requestInfoy.put("startTime", year + "");
// requestInfoy.put("endTime", year + "");
// requestInfoy.put("timeType", 4);
//
// String paramy = JSON.toJSONString(requestInfoy);
// List<Sofarhistorical> jsonObjecty = requestUtil.getResPonse(SoFarConstant.currentData,
// SoFarConstant.requestPost, paramy, SoFarConstant.paramDataList, Sofarhistorical.class);
//
// if (jsonObjecty != null && jsonObjecty.size() > 0) {
//
// List<Sofarhistorical> jsonObjectyf = jsonObjecty.stream().filter(da -> Objects.nonNull(da))
// .filter(da -> da.getCollectTime().equals(month + "")).collect(Collectors.toList());
// if (!jsonObjectyf.isEmpty()) {
// for (Sofarhistorical sofarhistorical : jsonObjectyf) {
// if (sofarhistorical.getDataList().get(0).getKey().equals("generation")) {
// // 月发电量
// jpStation.setMonthGenerate(sofarhistorical.getDataList().get(0).getValue() != null
// ? Double.valueOf(sofarhistorical.getDataList().get(0).getValue())
// : null);
// // 月收益
// jpStation.setMonthIncome(
// jpStation.getMonthGenerate() != null ? jpStation.getMonthGenerate() * 0.45
// : null);
//
// }
// }
// }
// }
//
// // 获取年发电量
// Map<String, Object> requestInfoyn = new HashMap<>();
// requestInfoyn.put("deviceSn", jsonObject2.get(0).getDeviceSn());
// requestInfoyn.put("startTime", year + "");
// requestInfoyn.put("endTime", year + "");
// requestInfoyn.put("timeType", 5);
//
// String paramyn = JSON.toJSONString(requestInfoyn);
// List<Sofarhistorical> jsonObjectyn = requestUtil.getResPonse(SoFarConstant.currentData,
// SoFarConstant.requestPost, paramyn, SoFarConstant.paramDataList, Sofarhistorical.class);
//
// if (jsonObjectyn != null && jsonObjectyn.size() > 0) {
//
// List<Sofarhistorical> jsonObjectyfn = jsonObjectyn.stream().filter(da -> Objects.nonNull(da))
// .filter(da -> da.getCollectTime().equals(year + "")).collect(Collectors.toList());
// if (!jsonObjectyfn.isEmpty()) {
// for (Sofarhistorical sofarhistorical : jsonObjectyfn) {
// if (sofarhistorical.getDataList().get(0).getKey().equals("generation")) {
// // 年发电量
// jpStation.setYearGenerate(sofarhistorical.getDataList().get(0).getValue() != null
// ? Double.valueOf(sofarhistorical.getDataList().get(0).getValue())
// : null);
// // 年月收益
// jpStation.setYearIncome(
// jpStation.getYearGenerate() != null ? jpStation.getYearGenerate() * 0.45
// : null);
//
// }
// }
// }
// }
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) { if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation); jpStationMapper.updateById(jpStation);
} else { } else {
...@@ -321,11 +443,8 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -321,11 +443,8 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
String today = DateUtil.today(); String today = DateUtil.today();
String hour = new Date().getHours() + ":00"; String hour = new Date().getHours() + ":00";
HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne( HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne(
new QueryWrapper<HYGFJPDayPower>(). new QueryWrapper<HYGFJPDayPower>().eq("tation_id", sunlightDto.getId().toString())
eq("tation_id", sunlightDto.getId().toString()). .eq("year_month_day", today).eq("hour", hour));
eq("year_month_day", today).
eq("hour", hour)
);
if (ObjectUtils.isEmpty(hygfjpDayPower)) { if (ObjectUtils.isEmpty(hygfjpDayPower)) {
hygfjpDayPower = new HYGFJPDayPower(); hygfjpDayPower = new HYGFJPDayPower();
} }
...@@ -333,7 +452,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -333,7 +452,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
hygfjpDayPower.setHour(hour); hygfjpDayPower.setHour(hour);
hygfjpDayPower.setYearMonthDay(today); hygfjpDayPower.setYearMonthDay(today);
hygfjpDayPower.setPower(jpStation.getRealTimePower()); hygfjpDayPower.setPower(jpStation.getRealTimePower());
//新加 // 新加
hygfjpDayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode()); hygfjpDayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
hygfjpDayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); hygfjpDayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
hygfjpDayPower.setStationName(jpStation.getName()); hygfjpDayPower.setStationName(jpStation.getName());
...@@ -352,16 +471,14 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -352,16 +471,14 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower()); hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower());
hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode()); hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode());
hygfjpStationPowerHistory.setTime(System.currentTimeMillis()); hygfjpStationPowerHistory.setTime(System.currentTimeMillis());
//新加 // 新加
hygfjpStationPowerHistory.setAmosCompanyCode(jpStation.getAmosCompanyCode()); hygfjpStationPowerHistory.setAmosCompanyCode(jpStation.getAmosCompanyCode());
hygfjpStationPowerHistory.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); hygfjpStationPowerHistory.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
hygfjpStationPowerHistory.setStationName(jpStation.getName()); hygfjpStationPowerHistory.setStationName(jpStation.getName());
hygfjpStationPowerHistory.setStationState(jpStation.getState()); hygfjpStationPowerHistory.setStationState(jpStation.getState());
hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory); hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory);
// 增加td 电站区域公司,经销商绑定表
//增加td 电站区域公司,经销商绑定表
// TdJpStation tdJpStation = tdJpStationMapper.selectOne(new QueryWrapper<TdJpStation>(). // TdJpStation tdJpStation = tdJpStationMapper.selectOne(new QueryWrapper<TdJpStation>().
// eq("third_code",PVProducerInfoEnum.SH.getCode()). // eq("third_code",PVProducerInfoEnum.SH.getCode()).
// eq("third_station_id", jpStation.getThirdStationId())); // eq("third_station_id", jpStation.getThirdStationId()));
...@@ -385,24 +502,27 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -385,24 +502,27 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
requestInfo3.put("stationId", sunlightDto.getId()); requestInfo3.put("stationId", sunlightDto.getId());
requestInfo3.put("deviceType", "COLLECTOR"); requestInfo3.put("deviceType", "COLLECTOR");
String param3 = JSON.toJSONString(requestInfo3); String param3 = JSON.toJSONString(requestInfo3);
List<SofarInverter> jsonObject3= requestUtil.getResPonse( List<SofarInverter> jsonObject3 = requestUtil.getResPonse(SoFarConstant.nbqlist,
SoFarConstant.nbqlist, SoFarConstant.requestPost, param3, SoFarConstant.deviceListItems, SofarInverter.class);
SoFarConstant.requestPost, // 逆变器信信息
param3, this.inverterList(jsonObject2, jpStation, maps);
SoFarConstant.deviceListItems, this.collectorDetail(jsonObject3, jpStation);
SofarInverter.class); // 报警列表无法获取ruleId了 首航更新接口了
//逆变器信信息
this.inverterList( jsonObject2, jpStation, maps);
this.collectorDetail( jsonObject3, jpStation);
this.inverAlramInfo(jpStation); this.inverAlramInfo(jpStation);
} }
} else {
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation);
} else {
jpStationMapper.insert(jpStation);
}
} }
//电站报表 // 电站报表
//户用场站日发电量 // 户用场站日发电量
Date today1 = new Date(); Date today1 = new Date();
TdHYGFStationDayGenerate tdHYGFStationDayGenerate = tdHYGFStationDayGenerateMapper.selectOne(new QueryWrapper<TdHYGFStationDayGenerate>() TdHYGFStationDayGenerate tdHYGFStationDayGenerate = tdHYGFStationDayGenerateMapper.selectOne(
.eq("third_station_id",jpStation.getThirdStationId() ) new QueryWrapper<TdHYGFStationDayGenerate>().eq("third_station_id", jpStation.getThirdStationId())
.eq("day_time", DateUtil.format(today1, "yyyy-MM-dd")) .eq("day_time", DateUtil.format(today1, "yyyy-MM-dd"))
.eq("year_month", DateUtil.format(today1, "yyyy-MM"))); .eq("year_month", DateUtil.format(today1, "yyyy-MM")));
if (ObjectUtils.isEmpty(tdHYGFStationDayGenerate)) { if (ObjectUtils.isEmpty(tdHYGFStationDayGenerate)) {
...@@ -413,7 +533,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -413,7 +533,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
tdHYGFStationDayGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM")); tdHYGFStationDayGenerate.setYearMonth(DateUtil.format(today1, "yyyy-MM"));
tdHYGFStationDayGenerate.setGenerate(jpStation.getDayGenerate()); tdHYGFStationDayGenerate.setGenerate(jpStation.getDayGenerate());
//新加 // 新加
tdHYGFStationDayGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode()); tdHYGFStationDayGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode());
tdHYGFStationDayGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); tdHYGFStationDayGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
tdHYGFStationDayGenerate.setStationName(jpStation.getName()); tdHYGFStationDayGenerate.setStationName(jpStation.getName());
...@@ -421,9 +541,10 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -421,9 +541,10 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
tdHYGFStationDayGenerate.setFullhour( tdHYGFStationDayGenerate.setFullhour(
(jpStation.getDayGenerate()==null || jpStation.getCapacity()==null)?null: (jpStation.getDayGenerate() == null || jpStation.getCapacity() == null) ? null :
(jpStation.getCapacity()<=0.0?null:jpStation.getDayGenerate()/jpStation.getCapacity()) (jpStation.getCapacity() <= 0.0 ? null
: jpStation.getDayGenerate() / jpStation.getCapacity())
); );
tdHYGFStationDayGenerate.setIncome(jpStation.getDayIncome()); tdHYGFStationDayGenerate.setIncome(jpStation.getDayIncome());
...@@ -433,9 +554,9 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -433,9 +554,9 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
} else { } else {
tdHYGFStationDayGenerateMapper.insert(tdHYGFStationDayGenerate); tdHYGFStationDayGenerateMapper.insert(tdHYGFStationDayGenerate);
} }
//户用场站月发电量 // 户用场站月发电量
TdHYGFStationMonthGenerate tdHYGFStationMonthGenerate = tdHYGFStationMonthGenerateMapper.selectOne(new QueryWrapper<TdHYGFStationMonthGenerate>() TdHYGFStationMonthGenerate tdHYGFStationMonthGenerate = tdHYGFStationMonthGenerateMapper.selectOne(
.eq("third_station_id", jpStation.getThirdStationId()) new QueryWrapper<TdHYGFStationMonthGenerate>().eq("third_station_id", jpStation.getThirdStationId())
.eq("month_time", DateUtil.format(today1, "yyyy-MM")) .eq("month_time", DateUtil.format(today1, "yyyy-MM"))
.eq("year", DateUtil.format(today1, "yyyy"))); .eq("year", DateUtil.format(today1, "yyyy")));
if (ObjectUtils.isEmpty(tdHYGFStationMonthGenerate)) { if (ObjectUtils.isEmpty(tdHYGFStationMonthGenerate)) {
...@@ -446,32 +567,27 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -446,32 +567,27 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
tdHYGFStationMonthGenerate.setYear(DateUtil.format(today1, "yyyy")); tdHYGFStationMonthGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFStationMonthGenerate.setGenerate(jpStation.getMonthGenerate()); tdHYGFStationMonthGenerate.setGenerate(jpStation.getMonthGenerate());
tdHYGFStationMonthGenerate.setFullhour( tdHYGFStationMonthGenerate.setFullhour(
// jpStation.getMonthGenerate() / jpStation.getCapacity() // jpStation.getMonthGenerate() / jpStation.getCapacity()
(jpStation.getMonthGenerate() == null || jpStation.getCapacity() == null) ? null
(jpStation.getMonthGenerate()==null || jpStation.getCapacity()==null)?null: : (jpStation.getCapacity() <= 0.0 ? null
: jpStation.getMonthGenerate() / jpStation.getCapacity()));
(jpStation.getCapacity()<=0.0?null:jpStation.getMonthGenerate()/jpStation.getCapacity())
);
tdHYGFStationMonthGenerate.setIncome(jpStation.getMonthIncome()); tdHYGFStationMonthGenerate.setIncome(jpStation.getMonthIncome());
//新加 // 新加
tdHYGFStationMonthGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode()); tdHYGFStationMonthGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode());
tdHYGFStationMonthGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); tdHYGFStationMonthGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
tdHYGFStationMonthGenerate.setStationName(jpStation.getName()); tdHYGFStationMonthGenerate.setStationName(jpStation.getName());
tdHYGFStationMonthGenerate.setStationState(jpStation.getState()); tdHYGFStationMonthGenerate.setStationState(jpStation.getState());
if (ObjectUtils.isEmpty(tdHYGFStationMonthGenerate.getCreatedTime())) { if (ObjectUtils.isEmpty(tdHYGFStationMonthGenerate.getCreatedTime())) {
tdHYGFStationMonthGenerate.setCreatedTime(System.currentTimeMillis()); tdHYGFStationMonthGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFStationMonthGenerateMapper.insert(tdHYGFStationMonthGenerate); tdHYGFStationMonthGenerateMapper.insert(tdHYGFStationMonthGenerate);
} else { } else {
tdHYGFStationMonthGenerateMapper.insert(tdHYGFStationMonthGenerate); tdHYGFStationMonthGenerateMapper.insert(tdHYGFStationMonthGenerate);
} }
//户用场站年发电量 // 户用场站年发电量
TdHYGFStationYearGenerate tdHYGFStationYearGenerate = tdHYGFStationYearGenerateMapper.selectOne(new QueryWrapper<TdHYGFStationYearGenerate>() TdHYGFStationYearGenerate tdHYGFStationYearGenerate = tdHYGFStationYearGenerateMapper.selectOne(
.eq("third_station_id", jpStation.getThirdStationId()) new QueryWrapper<TdHYGFStationYearGenerate>().eq("third_station_id", jpStation.getThirdStationId())
.eq("year_time", DateUtil.format(today1, "yyyy")) .eq("year_time", DateUtil.format(today1, "yyyy"))
.eq("year", DateUtil.format(today1, "yyyy"))); .eq("year", DateUtil.format(today1, "yyyy")));
if (ObjectUtils.isEmpty(tdHYGFStationYearGenerate)) { if (ObjectUtils.isEmpty(tdHYGFStationYearGenerate)) {
...@@ -483,11 +599,11 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -483,11 +599,11 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
tdHYGFStationYearGenerate.setGenerate(jpStation.getYearGenerate()); tdHYGFStationYearGenerate.setGenerate(jpStation.getYearGenerate());
tdHYGFStationYearGenerate.setFullhour( tdHYGFStationYearGenerate.setFullhour(
// jpStation.getYearGenerate() / jpStation.getCapacity() // jpStation.getYearGenerate() / jpStation.getCapacity()
(jpStation.getYearGenerate()==null || jpStation.getCapacity()==null)?null: (jpStation.getYearGenerate() == null || jpStation.getCapacity() == null) ? null
(jpStation.getCapacity()<=0.0?null:jpStation.getYearGenerate()/jpStation.getCapacity()) : (jpStation.getCapacity() <= 0.0 ? null
); : jpStation.getYearGenerate() / jpStation.getCapacity()));
tdHYGFStationYearGenerate.setIncome(jpStation.getYearIncome()); tdHYGFStationYearGenerate.setIncome(jpStation.getYearIncome());
//新加 // 新加
tdHYGFStationYearGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode()); tdHYGFStationYearGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode());
tdHYGFStationYearGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); tdHYGFStationYearGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
tdHYGFStationYearGenerate.setStationName(jpStation.getName()); tdHYGFStationYearGenerate.setStationName(jpStation.getName());
...@@ -500,13 +616,8 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -500,13 +616,8 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
tdHYGFStationYearGenerateMapper.insert(tdHYGFStationYearGenerate); tdHYGFStationYearGenerateMapper.insert(tdHYGFStationYearGenerate);
} }
} }
} }
@Override @Override
...@@ -515,31 +626,30 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -515,31 +626,30 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
} }
@Override @Override
public void collectorDetail(List<SofarInverter> devices,JpStation jpStation) { public void collectorDetail(List<SofarInverter> devices, JpStation jpStation) {
new Thread(new Runnable(){ new Thread(new Runnable() {
@Override @Override
public void run(){ public void run() {
try{ try {
for (SofarInverter device : devices) { for (SofarInverter device : devices) {
JpCollector jpCollector = jpCollectorMapper.selectOne(new QueryWrapper<JpCollector>(). JpCollector jpCollector = jpCollectorMapper.selectOne(new QueryWrapper<JpCollector>()
eq("third_station_id", jpStation.getThirdStationId()). .eq("third_station_id", jpStation.getThirdStationId())
eq("third_code", PVProducerInfoEnum.SH.getCode()). .eq("third_code", PVProducerInfoEnum.SH.getCode()).eq("sn_code", device.getDeviceSn()));
eq("sn_code", device.getDeviceSn()));
if (ObjectUtils.isEmpty(jpCollector)) { if (ObjectUtils.isEmpty(jpCollector)) {
jpCollector = new JpCollector(); jpCollector = new JpCollector();
} }
//sn编码 // sn编码
jpCollector.setSnCode(device.getDeviceSn()); jpCollector.setSnCode(device.getDeviceSn());
jpCollector.setAddr(jpStation.getAddress()); jpCollector.setAddr(jpStation.getAddress());
jpCollector.setName(device.getDeviceSn()); jpCollector.setName(device.getDeviceSn());
//类型 // 类型
jpCollector.setType("通信模块"); jpCollector.setType("通信模块");
//更新时间 // 更新时间
jpCollector.setUpdateTime(new Date()); jpCollector.setUpdateTime(new Date());
//出场日期 // 出场日期
// jpCollector.setDischargeDate(new Date(collectorDetailDto.getFactoryTime())); // jpCollector.setDischargeDate(new Date(collectorDetailDto.getFactoryTime()));
// //生产日期 // //生产日期
// jpCollector.setProductDate(new Date(collectorDetailDto.getFactoryTime())); // jpCollector.setProductDate(new Date(collectorDetailDto.getFactoryTime()));
...@@ -549,13 +659,13 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -549,13 +659,13 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
// jpCollector.setThisWorkTime(new DateTime(collectorDetailDto.getCurrentWorkingTime())); // jpCollector.setThisWorkTime(new DateTime(collectorDetailDto.getCurrentWorkingTime()));
// //累计工作时间 // //累计工作时间
// jpCollector.setTotalWorkTime(new DateTime(collectorDetailDto.getTotalWorkingTime())); // jpCollector.setTotalWorkTime(new DateTime(collectorDetailDto.getTotalWorkingTime()));
//第三方电站id // 第三方电站id
jpCollector.setThirdStationId(jpStation.getThirdStationId()); jpCollector.setThirdStationId(jpStation.getThirdStationId());
//第三方厂商标识 // 第三方厂商标识
jpCollector.setThirdCode(PVProducerInfoEnum.SH.getCode()); jpCollector.setThirdCode(PVProducerInfoEnum.SH.getCode());
if( device.getConnectStatus()!=null) { if (device.getConnectStatus() != null) {
jpCollector.setState(SoFarConstant.stationStaus.get(device.getConnectStatus()+""));//电站状态 jpCollector.setState(SoFarConstant.stationStaus.get(device.getConnectStatus() + ""));// 电站状态
} }
jpCollector.setStationName(jpStation.getName()); jpCollector.setStationName(jpStation.getName());
// jpCollector.setVersion(imasterCollectorList.getSoftwareVersion()); // jpCollector.setVersion(imasterCollectorList.getSoftwareVersion());
...@@ -566,7 +676,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -566,7 +676,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
jpCollectorMapper.updateById(jpCollector); jpCollectorMapper.updateById(jpCollector);
} }
} }
}catch(Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -575,19 +685,19 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -575,19 +685,19 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
@Override @Override
// @Async // @Async
public void inverterList(List<SofarInverter> devices, JpStation jpStation,Map<String, String> maps) { public void inverterList(List<SofarInverter> devices, JpStation jpStation, Map<String, String> maps) {
//存储逆变器 // 存储逆变器
new Thread(new Runnable(){ new Thread(new Runnable() {
@Override @Override
public void run(){ public void run() {
try{ try {
for (SofarInverter device : devices) { for (SofarInverter device : devices) {
if(device!=null){ if (device != null) {
//获取逆变器信息存库 // 获取逆变器信息存库
JpInverter jpInverter = jpInverterMapper.selectOne(new QueryWrapper<JpInverter>(). JpInverter jpInverter = jpInverterMapper.selectOne(
eq("third_station_id", jpStation.getThirdStationId()). new QueryWrapper<JpInverter>().eq("third_station_id", jpStation.getThirdStationId())
eq("third_code", PVProducerInfoEnum.SH.getCode()). .eq("third_code", PVProducerInfoEnum.SH.getCode())
eq("ID", device.getDeviceId().toString())); .eq("ID", device.getDeviceId().toString()));
if (ObjectUtils.isEmpty(jpInverter)) { if (ObjectUtils.isEmpty(jpInverter)) {
jpInverter = new JpInverter(); jpInverter = new JpInverter();
...@@ -596,8 +706,8 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -596,8 +706,8 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
jpInverter.setBrand(null); jpInverter.setBrand(null);
jpInverter.setSnCode(device.getDeviceSn()); jpInverter.setSnCode(device.getDeviceSn());
jpInverter.setId(device.getDeviceId().toString()); jpInverter.setId(device.getDeviceId().toString());
if( device.getConnectStatus()!=null) { if (device.getConnectStatus() != null) {
jpInverter.setState(SoFarConstant.stationStaus.get(device.getConnectStatus()+""));//电站状态 jpInverter.setState(SoFarConstant.stationStaus.get(device.getConnectStatus() + ""));// 电站状态
} }
jpInverter.setUpdateTime(new Date()); jpInverter.setUpdateTime(new Date());
...@@ -614,21 +724,17 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -614,21 +724,17 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
jpInverter.setCapacity(jpStation.getCapacity()); jpInverter.setCapacity(jpStation.getCapacity());
jpInverter.setCurrentPower(jpStation.getRealTimePower()); jpInverter.setCurrentPower(jpStation.getRealTimePower());
// 获取逆变器铜须关系
//获取逆变器铜须关系
Map<String, Object> requestInfo3 = new HashMap<>(); Map<String, Object> requestInfo3 = new HashMap<>();
requestInfo3.put("deviceSn", device.getDeviceSn()); requestInfo3.put("deviceSn", device.getDeviceSn());
String param3 = JSON.toJSONString(requestInfo3); String param3 = JSON.toJSONString(requestInfo3);
JSONObject jsonObject3= requestUtil.getResPonseobj( JSONObject jsonObject3 = requestUtil.getResPonseobj(SoFarConstant.equipComm,
SoFarConstant.equipComm, SoFarConstant.requestPost, param3, SoFarConstant.communication);
SoFarConstant.requestPost,
param3,
SoFarConstant.communication);
if(jsonObject3!=null){ if (jsonObject3 != null) {
jpInverter.setCollectorId(jsonObject3.get("plantId").toString()); jpInverter.setCollectorId(jsonObject3.get("plantId").toString());
//采集器sn编码 // 采集器sn编码
jpInverter.setCollectorSnCode(jsonObject3.get("parentSn").toString()); jpInverter.setCollectorSnCode(jsonObject3.get("parentSn").toString());
} }
...@@ -646,35 +752,35 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -646,35 +752,35 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) { if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter); jpInverterMapper.updateById(jpInverter);
} else { } else {
if(StringUtils.isNotEmpty(jpInverter.getSnCode())){ if (StringUtils.isNotEmpty(jpInverter.getSnCode())) {
jpInverterMapper.insert(jpInverter); jpInverterMapper.insert(jpInverter);
} }
} }
//逆变器指标信息 // 逆变器指标信息
if(maps!=null&&!maps.isEmpty()){ if (maps != null && !maps.isEmpty()) {
List<String> liname=new ArrayList<>(); List<String> liname = new ArrayList<>();
liname.add("AC1");//A 相电压 liname.add("AC1");// A 相电压
liname.add("AC2");//B 相电压 liname.add("AC2");// B 相电压
liname.add("AC3");//C 相电压 liname.add("AC3");// C 相电压
liname.add("PV1");//直流电压 1 liname.add("PV1");// 直流电压 1
liname.add("PV2");//直流电压 2 liname.add("PV2");// 直流电压 2
liname.add("PV3");//直流电压 3 liname.add("PV3");// 直流电压 3
liname.add("PV4");//直流电压 4 liname.add("PV4");// 直流电压 4
liname.add("PV5");//直流电压 5 liname.add("PV5");// 直流电压 5
liname.add("PV6");//直流电压 6 liname.add("PV6");// 直流电压 6
liname.add("PV7");//直流电压 7 liname.add("PV7");// 直流电压 7
liname.add("PV8");//直流电压 8 liname.add("PV8");// 直流电压 8
liname.add("PV9");//直流电压 9 liname.add("PV9");// 直流电压 9
liname.add("PV10");//直流电压 10 liname.add("PV10");// 直流电压 10
for (int i = 0; i < liname.size(); i++) { for (int i = 0; i < liname.size(); i++) {
JpInverterElectricity jpInverterElectricity = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>(). JpInverterElectricity jpInverterElectricity = jpInverterElectricityMapper
eq("sn_code",jpInverter.getSnCode()). .selectOne(new QueryWrapper<JpInverterElectricity>()
eq("third_code", PVProducerInfoEnum.SH.getCode()). .eq("sn_code", jpInverter.getSnCode())
eq("name", liname.get(i)) .eq("third_code", PVProducerInfoEnum.SH.getCode())
); .eq("name", liname.get(i)));
if (ObjectUtils.isEmpty(jpInverterElectricity)) { if (ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity(); jpInverterElectricity = new JpInverterElectricity();
} }
...@@ -683,172 +789,284 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -683,172 +789,284 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.SH.getCode()); jpInverterElectricity.setThirdCode(PVProducerInfoEnum.SH.getCode());
jpInverterElectricity.setThirdStationId(jpInverter.getThirdStationId()); jpInverterElectricity.setThirdStationId(jpInverter.getThirdStationId());
if(i>2){ if (i > 2) {
jpInverterElectricity.setType("直流"); jpInverterElectricity.setType("直流");
}else{ } else {
jpInverterElectricity.setType("交流"); jpInverterElectricity.setType("交流");
} }
jpInverterElectricity.setName(liname.get(i)); jpInverterElectricity.setName(liname.get(i));
String voltage=null; String voltage = null;
String current=null; String current = null;
String power=null; String power = null;
switch (liname.get(i)) { switch (liname.get(i)) {
case "AC1": case "AC1":
voltage=maps.containsKey("AV1")&&maps.get("AV1")!=null?maps.get("AV1").toString():null; voltage = maps.containsKey("AV1") && maps.get("AV1") != null
current=maps.containsKey("AC1")&&maps.get("AC1")!=null?maps.get("AC1").toString():null; ? maps.get("AV1").toString()
: null;
current = maps.containsKey("AC1") && maps.get("AC1") != null
? maps.get("AC1").toString()
: null;
break; break;
case "AC2": case "AC2":
voltage=maps.containsKey("AV2")&&maps.get("AV2")!=null?maps.get("AV2").toString():null; voltage = maps.containsKey("AV2") && maps.get("AV2") != null
current=maps.containsKey("AC2")&&maps.get("AC2")!=null?maps.get("AC2").toString():null; ? maps.get("AV2").toString()
: null;
current = maps.containsKey("AC2") && maps.get("AC2") != null
? maps.get("AC2").toString()
: null;
break; break;
case "AC3": case "AC3":
voltage=maps.containsKey("AV3")&&maps.get("AV3")!=null?maps.get("AV3").toString():null; voltage = maps.containsKey("AV3") && maps.get("AV3") != null
current=maps.containsKey("AC3")&&maps.get("AC3")!=null?maps.get("AC3").toString():null; ? maps.get("AV3").toString()
: null;
current = maps.containsKey("AC3") && maps.get("AC3") != null
? maps.get("AC3").toString()
: null;
break; break;
case "PV1": case "PV1":
voltage=maps.containsKey("DV1")&&maps.get("DV1")!=null?maps.get("DV1").toString():null; voltage = maps.containsKey("DV1") && maps.get("DV1") != null
current=maps.containsKey("DC1")&&maps.get("DC1")!=null?maps.get("DC1").toString():null; ? maps.get("DV1").toString()
power=maps.containsKey("DP1")&&maps.get("DP1")!=null?maps.get("DP1").toString():null; : null;
current = maps.containsKey("DC1") && maps.get("DC1") != null
? maps.get("DC1").toString()
: null;
power = maps.containsKey("DP1") && maps.get("DP1") != null
? maps.get("DP1").toString()
: null;
break; break;
case "PV2": case "PV2":
voltage=maps.containsKey("DV2")&&maps.get("DV2")!=null?maps.get("DV2").toString():null; voltage = maps.containsKey("DV2") && maps.get("DV2") != null
current=maps.containsKey("DC2")&&maps.get("DC2")!=null?maps.get("DC2").toString():null; ? maps.get("DV2").toString()
power=maps.containsKey("DP2")&&maps.get("DP2")!=null?maps.get("DP2").toString():null; : null;
current = maps.containsKey("DC2") && maps.get("DC2") != null
? maps.get("DC2").toString()
: null;
power = maps.containsKey("DP2") && maps.get("DP2") != null
? maps.get("DP2").toString()
: null;
break; break;
case "PV3": case "PV3":
voltage=maps.containsKey("DV3")&&maps.get("DV3")!=null?maps.get("DV3").toString():null; voltage = maps.containsKey("DV3") && maps.get("DV3") != null
current=maps.containsKey("DC3")&&maps.get("DC3")!=null?maps.get("DC3").toString():null; ? maps.get("DV3").toString()
power=maps.containsKey("DP3")&&maps.get("DP3")!=null?maps.get("DP3").toString():null; : null;
current = maps.containsKey("DC3") && maps.get("DC3") != null
? maps.get("DC3").toString()
: null;
power = maps.containsKey("DP3") && maps.get("DP3") != null
? maps.get("DP3").toString()
: null;
break; break;
case "PV4": case "PV4":
voltage=maps.containsKey("DV4")&&maps.get("DV4")!=null?maps.get("DV4").toString():null; voltage = maps.containsKey("DV4") && maps.get("DV4") != null
current=maps.containsKey("DC4")&&maps.get("DC4")!=null?maps.get("DC4").toString():null; ? maps.get("DV4").toString()
power=maps.containsKey("DP4")&&maps.get("DP4")!=null?maps.get("DP4").toString():null; : null;
current = maps.containsKey("DC4") && maps.get("DC4") != null
? maps.get("DC4").toString()
: null;
power = maps.containsKey("DP4") && maps.get("DP4") != null
? maps.get("DP4").toString()
: null;
break; break;
case "PV5": case "PV5":
voltage=maps.containsKey("DV5")&&maps.get("DV5")!=null?maps.get("DV5").toString():null; voltage = maps.containsKey("DV5") && maps.get("DV5") != null
current=maps.containsKey("DC5")&&maps.get("DC5")!=null?maps.get("DC5").toString():null; ? maps.get("DV5").toString()
power=maps.containsKey("DP5")&&maps.get("DP5")!=null?maps.get("DP5").toString():null; : null;
current = maps.containsKey("DC5") && maps.get("DC5") != null
? maps.get("DC5").toString()
: null;
power = maps.containsKey("DP5") && maps.get("DP5") != null
? maps.get("DP5").toString()
: null;
break; break;
case "PV6": case "PV6":
voltage=maps.containsKey("DV6")&&maps.get("DV6")!=null?maps.get("DV6").toString():null; voltage = maps.containsKey("DV6") && maps.get("DV6") != null
current=maps.containsKey("DC6")&&maps.get("DC6")!=null?maps.get("DC6").toString():null; ? maps.get("DV6").toString()
power=maps.containsKey("DP6")&&maps.get("DP6")!=null?maps.get("DP6").toString():null; : null;
current = maps.containsKey("DC6") && maps.get("DC6") != null
? maps.get("DC6").toString()
: null;
power = maps.containsKey("DP6") && maps.get("DP6") != null
? maps.get("DP6").toString()
: null;
break; break;
case "PV7": case "PV7":
voltage=maps.containsKey("DV7")&&maps.get("DV7")!=null?maps.get("DV7").toString():null; voltage = maps.containsKey("DV7") && maps.get("DV7") != null
current=maps.containsKey("DC7")&&maps.get("DC7")!=null?maps.get("DC7").toString():null; ? maps.get("DV7").toString()
power=maps.containsKey("DP7")&&maps.get("DP7")!=null?maps.get("DP7").toString():null; : null;
current = maps.containsKey("DC7") && maps.get("DC7") != null
? maps.get("DC7").toString()
: null;
power = maps.containsKey("DP7") && maps.get("DP7") != null
? maps.get("DP7").toString()
: null;
break; break;
case "PV8": case "PV8":
voltage=maps.containsKey("DV8")&&maps.get("DV8")!=null?maps.get("DV8").toString():null; voltage = maps.containsKey("DV8") && maps.get("DV8") != null
current=maps.containsKey("DC8")&&maps.get("DC8")!=null?maps.get("DC8").toString():null; ? maps.get("DV8").toString()
power=maps.containsKey("DP8")&&maps.get("DP8")!=null?maps.get("DP8").toString():null; : null;
current = maps.containsKey("DC8") && maps.get("DC8") != null
? maps.get("DC8").toString()
: null;
power = maps.containsKey("DP8") && maps.get("DP8") != null
? maps.get("DP8").toString()
: null;
break; break;
case "PV9": case "PV9":
voltage=maps.containsKey("DV9")&&maps.get("DV9")!=null?maps.get("DV9").toString():null; voltage = maps.containsKey("DV9") && maps.get("DV9") != null
current=maps.containsKey("DC9")&&maps.get("DC9")!=null?maps.get("DC9").toString():null; ? maps.get("DV9").toString()
power=maps.containsKey("DP9")&&maps.get("DP9")!=null?maps.get("DP9").toString():null; : null;
current = maps.containsKey("DC9") && maps.get("DC9") != null
? maps.get("DC9").toString()
: null;
power = maps.containsKey("DP9") && maps.get("DP9") != null
? maps.get("DP9").toString()
: null;
break; break;
case "PV10": case "PV10":
voltage=maps.containsKey("DV10")&&maps.get("DV10")!=null?maps.get("DV10").toString():null; voltage = maps.containsKey("DV10") && maps.get("DV10") != null
current=maps.containsKey("DC10")&&maps.get("DC10")!=null?maps.get("DC10").toString():null; ? maps.get("DV10").toString()
power=maps.containsKey("DP10")&&maps.get("DP10")!=null?maps.get("DP10").toString():null; : null;
current = maps.containsKey("DC10") && maps.get("DC10") != null
? maps.get("DC10").toString()
: null;
power = maps.containsKey("DP10") && maps.get("DP10") != null
? maps.get("DP10").toString()
: null;
break; break;
default: default:
} }
jpInverterElectricity.setVoltage(voltage!=null?Double.valueOf(voltage):null); jpInverterElectricity.setVoltage(voltage != null ? Double.valueOf(voltage) : null);
jpInverterElectricity.setCurrent(current!=null?Double.valueOf(current):null); jpInverterElectricity.setCurrent(current != null ? Double.valueOf(current) : null);
jpInverterElectricity.setPower(power!=null?Double.valueOf(power):null); jpInverterElectricity.setPower(power != null ? Double.valueOf(power) : null);
if (ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())) { if (ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricity); jpInverterElectricityMapper.insert(jpInverterElectricity);
} else { } else {
jpInverterElectricityMapper.updateById(jpInverterElectricity); jpInverterElectricityMapper.updateById(jpInverterElectricity);
} }
} }
//逆变器报表 // 逆变器报表
//-----------------------户用光伏日报表---------------------- // -----------------------户用光伏日报表----------------------
TdHYGFInverterDayGenerate tdHYGFInverterDayGenerate = new TdHYGFInverterDayGenerate(); TdHYGFInverterDayGenerate tdHYGFInverterDayGenerate = new TdHYGFInverterDayGenerate();
tdHYGFInverterDayGenerate.setCreatedTime(System.currentTimeMillis()); tdHYGFInverterDayGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterDayGenerate.setThirdStationId(jpInverter.getThirdStationId()); tdHYGFInverterDayGenerate.setThirdStationId(jpInverter.getThirdStationId());
tdHYGFInverterDayGenerate.setSnCode(jpInverter.getSnCode()); tdHYGFInverterDayGenerate.setSnCode(jpInverter.getSnCode());
tdHYGFInverterDayGenerate.setName(jpInverter.getName()); tdHYGFInverterDayGenerate.setName(jpInverter.getName());
tdHYGFInverterDayGenerate.setWorkStatus(jpInverter.getState()); tdHYGFInverterDayGenerate.setWorkStatus(jpInverter.getState());
//交流电压 // 交流电压
tdHYGFInverterDayGenerate.setDcv1(maps.containsKey("AV1")&&maps.get("AV1")!=null?Double.valueOf(maps.get("AV1").toString()):null); tdHYGFInverterDayGenerate.setDcv1(maps.containsKey("AV1") && maps.get("AV1") != null
tdHYGFInverterDayGenerate.setDcv2(maps.containsKey("AV2")&&maps.get("AV2")!=null?Double.valueOf(maps.get("AV2").toString()):null); ? Double.valueOf(maps.get("AV1").toString())
tdHYGFInverterDayGenerate.setDcv3(maps.containsKey("AV3")&&maps.get("AV3")!=null?Double.valueOf(maps.get("AV3").toString()):null); : null);
//交流电流 tdHYGFInverterDayGenerate.setDcv2(maps.containsKey("AV2") && maps.get("AV2") != null
tdHYGFInverterDayGenerate.setDcc1(maps.containsKey("AC1")&&maps.get("AC1")!=null?Double.valueOf(maps.get("AC1").toString()):null); ? Double.valueOf(maps.get("AV2").toString())
tdHYGFInverterDayGenerate.setDcc2(maps.containsKey("AC2")&&maps.get("AC2")!=null?Double.valueOf(maps.get("AC2").toString()):null); : null);
tdHYGFInverterDayGenerate.setDcc3(maps.containsKey("AC3")&&maps.get("AC3")!=null?Double.valueOf(maps.get("AC3").toString()):null); tdHYGFInverterDayGenerate.setDcv3(maps.containsKey("AV3") && maps.get("AV3") != null
//直流电压 ? Double.valueOf(maps.get("AV3").toString())
tdHYGFInverterDayGenerate.setAcv1(maps.containsKey("DV1")&&maps.get("DV1")!=null?Double.valueOf(maps.get("DV1").toString()):null); : null);
tdHYGFInverterDayGenerate.setAcv2(maps.containsKey("DV2")&&maps.get("DV2")!=null?Double.valueOf(maps.get("DV2").toString()):null); // 交流电流
tdHYGFInverterDayGenerate.setAcv3(maps.containsKey("DV3")&&maps.get("DV3")!=null?Double.valueOf(maps.get("DV3").toString()):null); tdHYGFInverterDayGenerate.setDcc1(maps.containsKey("AC1") && maps.get("AC1") != null
tdHYGFInverterDayGenerate.setAcv4(maps.containsKey("DV4")&&maps.get("DV4")!=null?Double.valueOf(maps.get("DV4").toString()):null); ? Double.valueOf(maps.get("AC1").toString())
//直流电流 : null);
tdHYGFInverterDayGenerate.setAcc1(maps.containsKey("DC1")&&maps.get("DC1")!=null?Double.valueOf(maps.get("DC1").toString()):null); tdHYGFInverterDayGenerate.setDcc2(maps.containsKey("AC2") && maps.get("AC2") != null
tdHYGFInverterDayGenerate.setAcc2(maps.containsKey("DC2")&&maps.get("DC2")!=null?Double.valueOf(maps.get("DC2").toString()):null); ? Double.valueOf(maps.get("AC2").toString())
tdHYGFInverterDayGenerate.setAcc3(maps.containsKey("DC3")&&maps.get("DC3")!=null?Double.valueOf(maps.get("DC3").toString()):null); : null);
tdHYGFInverterDayGenerate.setAcc4(maps.containsKey("DC4")&&maps.get("DC4")!=null?Double.valueOf(maps.get("DC4").toString()):null); tdHYGFInverterDayGenerate.setDcc3(maps.containsKey("AC3") && maps.get("AC3") != null
? Double.valueOf(maps.get("AC3").toString())
tdHYGFInverterDayGenerate.setPv1(maps.containsKey("DP1")&&maps.get("DP1")!=null?Double.valueOf(maps.get("DP1").toString()):null); : null);
tdHYGFInverterDayGenerate.setPv2(maps.containsKey("DP2")&&maps.get("DP2")!=null?Double.valueOf(maps.get("DP2").toString()):null); // 直流电压
tdHYGFInverterDayGenerate.setPv3(maps.containsKey("DP3")&&maps.get("DP3")!=null?Double.valueOf(maps.get("DP3").toString()):null); tdHYGFInverterDayGenerate.setAcv1(maps.containsKey("DV1") && maps.get("DV1") != null
tdHYGFInverterDayGenerate.setPv4(maps.containsKey("DP4")&&maps.get("DP4")!=null?Double.valueOf(maps.get("DP4").toString()):null); ? Double.valueOf(maps.get("DV1").toString())
: null);
tdHYGFInverterDayGenerate.setAcv2(maps.containsKey("DV2") && maps.get("DV2") != null
? Double.valueOf(maps.get("DV2").toString())
//功率 : null);
tdHYGFInverterDayGenerate.setAcv3(maps.containsKey("DV3") && maps.get("DV3") != null
? Double.valueOf(maps.get("DV3").toString())
: null);
tdHYGFInverterDayGenerate.setAcv4(maps.containsKey("DV4") && maps.get("DV4") != null
? Double.valueOf(maps.get("DV4").toString())
: null);
// 直流电流
tdHYGFInverterDayGenerate.setAcc1(maps.containsKey("DC1") && maps.get("DC1") != null
? Double.valueOf(maps.get("DC1").toString())
: null);
tdHYGFInverterDayGenerate.setAcc2(maps.containsKey("DC2") && maps.get("DC2") != null
? Double.valueOf(maps.get("DC2").toString())
: null);
tdHYGFInverterDayGenerate.setAcc3(maps.containsKey("DC3") && maps.get("DC3") != null
? Double.valueOf(maps.get("DC3").toString())
: null);
tdHYGFInverterDayGenerate.setAcc4(maps.containsKey("DC4") && maps.get("DC4") != null
? Double.valueOf(maps.get("DC4").toString())
: null);
tdHYGFInverterDayGenerate.setPv1(maps.containsKey("DP1") && maps.get("DP1") != null
? Double.valueOf(maps.get("DP1").toString())
: null);
tdHYGFInverterDayGenerate.setPv2(maps.containsKey("DP2") && maps.get("DP2") != null
? Double.valueOf(maps.get("DP2").toString())
: null);
tdHYGFInverterDayGenerate.setPv3(maps.containsKey("DP3") && maps.get("DP3") != null
? Double.valueOf(maps.get("DP3").toString())
: null);
tdHYGFInverterDayGenerate.setPv4(maps.containsKey("DP4") && maps.get("DP4") != null
? Double.valueOf(maps.get("DP4").toString())
: null);
// 功率
tdHYGFInverterDayGenerate.setTotalPower(jpInverter.getCurrentPower()); tdHYGFInverterDayGenerate.setTotalPower(jpInverter.getCurrentPower());
// //频率 // //频率
tdHYGFInverterDayGenerate.setFrequency(maps.containsKey("A_Fo1")&&maps.get("A_Fo1")!=null?String.valueOf(maps.get("A_Fo1")):null); tdHYGFInverterDayGenerate
.setFrequency(maps.containsKey("A_Fo1") && maps.get("A_Fo1") != null
? String.valueOf(maps.get("A_Fo1"))
: null);
// //功率因数 // //功率因数
tdHYGFInverterDayGenerate.setPowerFactor(1.0); tdHYGFInverterDayGenerate.setPowerFactor(1.0);
tdHYGFInverterDayGenerate.setDayGen(jpInverter.getDayPowerGeneration()); tdHYGFInverterDayGenerate.setDayGen(jpInverter.getDayPowerGeneration());
tdHYGFInverterDayGenerate.setMonthGen(jpInverter.getMonthPowerGeneration()); tdHYGFInverterDayGenerate.setMonthGen(jpInverter.getMonthPowerGeneration());
tdHYGFInverterDayGenerate.setYearGen(jpInverter.getYearPowerGeneration()); tdHYGFInverterDayGenerate.setYearGen(jpInverter.getYearPowerGeneration());
tdHYGFInverterDayGenerate.setTotalGen(jpInverter.getTotalPowerGeneration()); tdHYGFInverterDayGenerate.setTotalGen(jpInverter.getTotalPowerGeneration());
tdHYGFInverterDayGenerate.setIgbtTemp(ObjectUtils.isEmpty(jpInverter.getIgbtTemperature()) ? null : Double.valueOf(jpInverter.getIgbtTemperature())); tdHYGFInverterDayGenerate
.setIgbtTemp(ObjectUtils.isEmpty(jpInverter.getIgbtTemperature()) ? null
: Double.valueOf(jpInverter.getIgbtTemperature()));
tdHYGFInverterDayGenerate.setIncome(null); tdHYGFInverterDayGenerate.setIncome(null);
tdHYGFInverterDayGenerate.setFullhour( tdHYGFInverterDayGenerate.setFullhour(
(jpInverter.getDayPowerGeneration()==null || jpInverter.getCapacity()==null)?null: (jpInverter.getDayPowerGeneration() == null || jpInverter.getCapacity() == null)
(jpInverter.getCapacity()<=0.0?null:jpInverter.getDayPowerGeneration()/jpInverter.getCapacity()) ? null
); : (jpInverter.getCapacity() <= 0.0 ? null
: jpInverter.getDayPowerGeneration()
/ jpInverter.getCapacity()));
// 电站区域经销商,
//电站区域经销商, JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>()
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>(). .eq("third_code", PVProducerInfoEnum.SH.getCode())
eq("third_code",PVProducerInfoEnum.SH.getCode()). .eq("third_station_id", String.valueOf(jpInverter.getThirdStationId())));
eq("third_station_id", String.valueOf(jpInverter.getThirdStationId())));
if (jpStation != null) {
if(jpStation!=null){
tdHYGFInverterDayGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode()); tdHYGFInverterDayGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode());
tdHYGFInverterDayGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); tdHYGFInverterDayGenerate
.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
tdHYGFInverterDayGenerate.setStationName(jpStation.getName()); tdHYGFInverterDayGenerate.setStationName(jpStation.getName());
tdHYGFInverterDayGenerate.setStationState(jpStation.getState()); tdHYGFInverterDayGenerate.setStationState(jpStation.getState());
} }
tdHYGFInverterDayGenerateMapper.insert(tdHYGFInverterDayGenerate); tdHYGFInverterDayGenerateMapper.insert(tdHYGFInverterDayGenerate);
//户用场站月发电量 // 户用场站月发电量
Date today1 = new Date(); Date today1 = new Date();
TdHYGFInverterMonthGenerate tdHYGFInverterMonthGenerate = tdHYGFInverterMonthGenerateMapper.selectOne(new QueryWrapper<TdHYGFInverterMonthGenerate>() TdHYGFInverterMonthGenerate tdHYGFInverterMonthGenerate = tdHYGFInverterMonthGenerateMapper
.selectOne(new QueryWrapper<TdHYGFInverterMonthGenerate>()
.eq("third_station_id", jpInverter.getThirdStationId()) .eq("third_station_id", jpInverter.getThirdStationId())
.eq("sn_code", jpInverter.getSnCode()) .eq("sn_code", jpInverter.getSnCode())
.eq("day_time", DateUtil.format(today1, "yyyy-MM-dd")) .eq("day_time", DateUtil.format(today1, "yyyy-MM-dd"))
...@@ -863,15 +1081,17 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -863,15 +1081,17 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
tdHYGFInverterMonthGenerate.setGenerate(jpInverter.getDayPowerGeneration()); tdHYGFInverterMonthGenerate.setGenerate(jpInverter.getDayPowerGeneration());
tdHYGFInverterMonthGenerate.setName(jpInverter.getName()); tdHYGFInverterMonthGenerate.setName(jpInverter.getName());
tdHYGFInverterMonthGenerate.setFullhour( tdHYGFInverterMonthGenerate.setFullhour(
(jpInverter.getDayPowerGeneration()==null || jpInverter.getCapacity()==null)?null: (jpInverter.getDayPowerGeneration() == null || jpInverter.getCapacity() == null)
(jpInverter.getCapacity()<=0.0?null:jpInverter.getDayPowerGeneration()/jpInverter.getCapacity()) ? null
); : (jpInverter.getCapacity() <= 0.0 ? null
: jpInverter.getDayPowerGeneration()
/ jpInverter.getCapacity()));
//新加
if(jpStation!=null){ // 新加
if (jpStation != null) {
tdHYGFInverterMonthGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode()); tdHYGFInverterMonthGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode());
tdHYGFInverterMonthGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); tdHYGFInverterMonthGenerate
.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
tdHYGFInverterMonthGenerate.setStationName(jpStation.getName()); tdHYGFInverterMonthGenerate.setStationName(jpStation.getName());
tdHYGFInverterMonthGenerate.setStationState(jpStation.getState()); tdHYGFInverterMonthGenerate.setStationState(jpStation.getState());
...@@ -882,8 +1102,9 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -882,8 +1102,9 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
} else { } else {
tdHYGFInverterMonthGenerateMapper.insert(tdHYGFInverterMonthGenerate); tdHYGFInverterMonthGenerateMapper.insert(tdHYGFInverterMonthGenerate);
} }
//户用场站年发电量 // 户用场站年发电量
TdHYGFInverterYearGenerate tdHYGFInverterYearGenerate = tdHYGFInverterYearGenerateMapper.selectOne(new QueryWrapper<TdHYGFInverterYearGenerate>() TdHYGFInverterYearGenerate tdHYGFInverterYearGenerate = tdHYGFInverterYearGenerateMapper
.selectOne(new QueryWrapper<TdHYGFInverterYearGenerate>()
.eq("third_station_id", jpInverter.getThirdStationId()) .eq("third_station_id", jpInverter.getThirdStationId())
.eq("sn_code", jpInverter.getSnCode()) .eq("sn_code", jpInverter.getSnCode())
.eq("month_time", DateUtil.format(today1, "yyyy-MM")) .eq("month_time", DateUtil.format(today1, "yyyy-MM"))
...@@ -897,16 +1118,18 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -897,16 +1118,18 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
tdHYGFInverterYearGenerate.setYear(DateUtil.format(today1, "yyyy")); tdHYGFInverterYearGenerate.setYear(DateUtil.format(today1, "yyyy"));
tdHYGFInverterYearGenerate.setGenerate(jpInverter.getMonthPowerGeneration()); tdHYGFInverterYearGenerate.setGenerate(jpInverter.getMonthPowerGeneration());
tdHYGFInverterYearGenerate.setName(jpInverter.getName()); tdHYGFInverterYearGenerate.setName(jpInverter.getName());
tdHYGFInverterYearGenerate.setFullhour( tdHYGFInverterYearGenerate.setFullhour((jpInverter.getMonthPowerGeneration() == null
(jpInverter.getMonthPowerGeneration()==null || jpInverter.getCapacity()==null)?null: || jpInverter.getCapacity() == null)
(jpInverter.getCapacity()<=0.0?null:jpInverter.getMonthPowerGeneration()/jpInverter.getCapacity()) ? null
); : (jpInverter.getCapacity() <= 0.0 ? null
: jpInverter.getMonthPowerGeneration()
/ jpInverter.getCapacity()));
//新加
if(jpStation!=null){ // 新加
if (jpStation != null) {
tdHYGFInverterYearGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode()); tdHYGFInverterYearGenerate.setAmosCompanyCode(jpStation.getAmosCompanyCode());
tdHYGFInverterYearGenerate.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode()); tdHYGFInverterYearGenerate
.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
tdHYGFInverterYearGenerate.setStationName(jpStation.getName()); tdHYGFInverterYearGenerate.setStationName(jpStation.getName());
tdHYGFInverterYearGenerate.setStationState(jpStation.getState()); tdHYGFInverterYearGenerate.setStationState(jpStation.getState());
...@@ -918,8 +1141,9 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -918,8 +1141,9 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
} else { } else {
tdHYGFInverterYearGenerateMapper.insert(tdHYGFInverterYearGenerate); tdHYGFInverterYearGenerateMapper.insert(tdHYGFInverterYearGenerate);
} }
//户用场站年发电量 // 户用场站年发电量
TdHYGFInverterTotalGenerate tdHYGFInverterTotalGenerate = tdHYGFInverterTotalGenerateMapper.selectOne(new QueryWrapper<TdHYGFInverterTotalGenerate>() TdHYGFInverterTotalGenerate tdHYGFInverterTotalGenerate = tdHYGFInverterTotalGenerateMapper
.selectOne(new QueryWrapper<TdHYGFInverterTotalGenerate>()
.eq("third_station_id", jpInverter.getThirdStationId()) .eq("third_station_id", jpInverter.getThirdStationId())
.eq("sn_code", jpInverter.getSnCode()) .eq("sn_code", jpInverter.getSnCode())
.eq("year_time", DateUtil.format(today1, "yyyy")) .eq("year_time", DateUtil.format(today1, "yyyy"))
...@@ -934,10 +1158,12 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -934,10 +1158,12 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
tdHYGFInverterTotalGenerate.setGenerate(jpInverter.getYearPowerGeneration()); tdHYGFInverterTotalGenerate.setGenerate(jpInverter.getYearPowerGeneration());
tdHYGFInverterTotalGenerate.setFullhour(0.0d); tdHYGFInverterTotalGenerate.setFullhour(0.0d);
tdHYGFInverterTotalGenerate.setName(jpInverter.getName()); tdHYGFInverterTotalGenerate.setName(jpInverter.getName());
tdHYGFInverterTotalGenerate.setFullhour( tdHYGFInverterTotalGenerate.setFullhour((jpInverter.getYearPowerGeneration() == null
(jpInverter.getYearPowerGeneration()==null || jpInverter.getCapacity()==null)?null: || jpInverter.getCapacity() == null)
(jpInverter.getCapacity()<=0.0?null:jpInverter.getYearPowerGeneration()/jpInverter.getCapacity()) ? null
); : (jpInverter.getCapacity() <= 0.0 ? null
: jpInverter.getYearPowerGeneration()
/ jpInverter.getCapacity()));
if (ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate.getCreatedTime())) { if (ObjectUtils.isEmpty(tdHYGFInverterTotalGenerate.getCreatedTime())) {
tdHYGFInverterTotalGenerate.setCreatedTime(System.currentTimeMillis()); tdHYGFInverterTotalGenerate.setCreatedTime(System.currentTimeMillis());
tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate); tdHYGFInverterTotalGenerateMapper.insert(tdHYGFInverterTotalGenerate);
...@@ -947,13 +1173,12 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -947,13 +1173,12 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
} }
} }
} }
}catch(Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
}).start(); }).start();
} }
@Override @Override
...@@ -965,7 +1190,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -965,7 +1190,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
@Async @Async
public void inverAlramInfo(JpStation jpStation) { public void inverAlramInfo(JpStation jpStation) {
SimpleDateFormat shortSdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat shortSdf = new SimpleDateFormat("yyyy-MM-dd");
String date= shortSdf.format(new Date()); String date = shortSdf.format(new Date());
Map<String, Object> requestInfo = new HashMap<>(); Map<String, Object> requestInfo = new HashMap<>();
requestInfo.put("page", 1); requestInfo.put("page", 1);
requestInfo.put("size", 99); requestInfo.put("size", 99);
...@@ -974,17 +1199,13 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -974,17 +1199,13 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
requestInfo.put("stationId", jpStation.getThirdStationId()); requestInfo.put("stationId", jpStation.getThirdStationId());
String param = JSON.toJSONString(requestInfo); String param = JSON.toJSONString(requestInfo);
List<SofarWarm> jsonObject2= requestUtil.getResPonse( List<SofarWarm> jsonObject2 = requestUtil.getResPonse(SoFarConstant.alert, SoFarConstant.requestPost, param,
SoFarConstant.alert, SoFarConstant.stationAlertItems, SofarWarm.class);
SoFarConstant.requestPost, if (jsonObject2 != null && jsonObject2.size() > 0) {
param,
SoFarConstant.stationAlertItems,
SofarWarm.class);
if(jsonObject2!=null&&jsonObject2.size()>0){
System.out.println("88888888888888888888888"); System.out.println("88888888888888888888888");
} }
for (SofarWarm sofarWarm : jsonObject2) { for (SofarWarm sofarWarm : jsonObject2) {
if(sofarWarm.getDeviceType().equals("INVERTER")||sofarWarm.getDeviceType().equals("COLLECTOR")){ if (sofarWarm.getDeviceType().equals("INVERTER") || sofarWarm.getDeviceType().equals("COLLECTOR")) {
HYGFJPInverterWarn hygfjpInverterWarn = new HYGFJPInverterWarn(); HYGFJPInverterWarn hygfjpInverterWarn = new HYGFJPInverterWarn();
hygfjpInverterWarn.setTime(System.currentTimeMillis()); hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(sofarWarm.getDeviceSn()); hygfjpInverterWarn.setSnCode(sofarWarm.getDeviceSn());
...@@ -997,24 +1218,20 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -997,24 +1218,20 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
hygfjpInverterWarn.setStationState(jpStation.getState()); hygfjpInverterWarn.setStationState(jpStation.getState());
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis()); hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.SH.getCode()); hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.SH.getCode());
//告警詳情 // 告警詳情
Map<String, Object> requestInfo1 = new HashMap<>(); Map<String, Object> requestInfo1 = new HashMap<>();
requestInfo1.put("alertId", sofarWarm.getRuleId()); requestInfo1.put("addr", sofarWarm.getAddr());
requestInfo1.put("deviceSn", sofarWarm.getDeviceSn()); requestInfo1.put("deviceSn", sofarWarm.getDeviceSn());
requestInfo1.put("alertTime", sofarWarm.getAlertTime());
String param1 = JSON.toJSONString(requestInfo1); String param1 = JSON.toJSONString(requestInfo1);
JSONObject jsonObject21= requestUtil.getResPonseobj( JSONObject jsonObject21 = requestUtil.getResPonseobj(SoFarConstant.alertDetail,
SoFarConstant.alertDetail, SoFarConstant.requestPost, param1, null);
SoFarConstant.requestPost, hygfjpInverterWarn.setContent(jsonObject21.get("alertName").toString());
param1,
null
);
hygfjpInverterWarn.setContent(jsonObject21.get("reason").toString());
hygfjpInverterWarn.setTreatment(jsonObject21.get("solution").toString()); hygfjpInverterWarn.setTreatment(jsonObject21.get("solution").toString());
if("1".equals(jsonObject21.get("alarmState").toString())){ if ("1".equals(jsonObject21.get("alarmState").toString())) {
hygfjpInverterWarn.setState("已处理"); hygfjpInverterWarn.setState("已处理");
}else{ } else {
hygfjpInverterWarn.setState("未处理"); hygfjpInverterWarn.setState("未处理");
} }
...@@ -1026,23 +1243,21 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ ...@@ -1026,23 +1243,21 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
hygfjpInverterWarn.setStartTime(Long.valueOf(jsonObject21.get("alertTime").toString())); hygfjpInverterWarn.setStartTime(Long.valueOf(jsonObject21.get("alertTime").toString()));
} }
hygfjpInverterWarn.setTimeLong(null); hygfjpInverterWarn.setTimeLong(null);
if ((!ObjectUtils.isEmpty(jsonObject21.get("alertTime"))) && (!ObjectUtils.isEmpty(jsonObject21.get("restoreTime")))) { if ((!ObjectUtils.isEmpty(jsonObject21.get("alertTime")))
hygfjpInverterWarn.setTimeLong(this.convertDate(hygfjpInverterWarn.getRecoverTime()) - this.convertDate(hygfjpInverterWarn.getStartTime())); && (!ObjectUtils.isEmpty(jsonObject21.get("restoreTime")))) {
hygfjpInverterWarn.setTimeLong(this.convertDate(hygfjpInverterWarn.getRecoverTime())
- this.convertDate(hygfjpInverterWarn.getStartTime()));
} }
} }
} }
} }
public Long convertDate(Long input){ public Long convertDate(Long input) {
Long result = 0L; Long result = 0L;
Date date = DateUtil.date(input); Date date = DateUtil.date(input);
result = DateUtil.parse( DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN)).getTime(); result = DateUtil.parse(DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN)).getTime();
return result; return result;
} }
} }
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