中车电站数据融合

This commit is contained in:
2026-03-25 09:40:33 +08:00
parent b6acb9bcf4
commit a7f21789f7
7 changed files with 73 additions and 47 deletions

View File

@ -119,35 +119,36 @@ public class OpenStationController {
log.info("realtimeCurve.stationRealtimeCurve:" + stationReq);
List<NewRealTimeCurveVo> resList = stationHomeService.getRealtimeCurve(stationReq);
// 寄点电站功率、soc曲线
if(stationReq.getStationId()==11003 || stationReq.getStationId()==10942){
if(stationReq.getStationId()==11003 || stationReq.getStationId()==10942 || stationReq.getStationId()==11006){
// 寄点电站数据
Integer stationId = stationReq.getStationId()-10000;
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + stationId;
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + stationReq.getStationId();
String json = (String)redisService.get(mainKey);
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
JSONArray historyDataList = vo.getHistoryDataList();
NewRealTimeCurveVo soc = new NewRealTimeCurveVo();
soc.setName("SOC");
List<StationHomeRespVo> soclist =new ArrayList<>();
NewRealTimeCurveVo p = new NewRealTimeCurveVo();
p.setName("实时功率");
List<StationHomeRespVo> plist =new ArrayList<>();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstant.DATE);
historyDataList.forEach(i->{
JSONObject obj = (JSONObject) i;
StationHomeRespVo socCurve = new StationHomeRespVo();
socCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
socCurve.setDigital(obj.getBigDecimal("soc"));
soclist.add(socCurve);
StationHomeRespVo pCurve = new StationHomeRespVo();
pCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
pCurve.setDigital(obj.getBigDecimal("p_total"));
plist.add(pCurve);
});
soc.setList(soclist);
p.setList(plist);
resList.add(soc);
resList.add(p);
if(historyDataList!=null){
NewRealTimeCurveVo soc = new NewRealTimeCurveVo();
soc.setName("SOC");
List<StationHomeRespVo> soclist =new ArrayList<>();
NewRealTimeCurveVo p = new NewRealTimeCurveVo();
p.setName("实时功率");
List<StationHomeRespVo> plist =new ArrayList<>();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstant.DATE);
historyDataList.forEach(i->{
JSONObject obj = (JSONObject) i;
StationHomeRespVo socCurve = new StationHomeRespVo();
socCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
socCurve.setDigital(obj.getBigDecimal("soc"));
soclist.add(socCurve);
StationHomeRespVo pCurve = new StationHomeRespVo();
pCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
pCurve.setDigital(obj.getBigDecimal("p_total"));
plist.add(pCurve);
});
soc.setList(soclist);
p.setList(plist);
resList.add(soc);
resList.add(p);
}
}
//返回值的BigDecimal类型保留两位小数
for (NewRealTimeCurveVo newRealTimeCurveVo : resList) {
@ -264,19 +265,20 @@ public class OpenStationController {
req.setDeviceType(deviceType);
}
PcsTotalData data = stationHomeService.getPcsTotalData(req);
if(req.getStationId()==11003 || req.getStationId()==10942){
if(req.getStationId()==11003 || req.getStationId()==10942 || req.getStationId()==11006){
// 寄点电站数据
Integer stationId = req.getStationId()-10000;
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + stationId;
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + req.getStationId();
String json = (String)redisService.get(mainKey);
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
// 数据转换
data.setTotalChargeElec(BigDecimal.valueOf(vo.getPositivePowerSum()));
data.setTotalDischargeElec(BigDecimal.valueOf(vo.getReversePowerSum()));
data.setDailyChargeElec(BigDecimal.valueOf(vo.getPositivePowerToday()));
data.setDailyDischargeElec(BigDecimal.valueOf(vo.getReversePowerToday()));
data.setCurrentPower(BigDecimal.valueOf(vo.getRealTimePower()));
data.setSystemEfficiency(data.getTotalDischargeElec().divide(data.getTotalChargeElec(), 4, BigDecimal.ROUND_HALF_UP));
data.setTotalChargeElec(vo.getPositivePowerSum()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getPositivePowerSum()));
data.setTotalDischargeElec(vo.getReversePowerSum()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getReversePowerSum()));
data.setDailyChargeElec(vo.getPositivePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getPositivePowerToday()));
data.setDailyDischargeElec(vo.getReversePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getReversePowerToday()));
data.setCurrentPower(vo.getRealTimePower()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getRealTimePower()));
if(data.getTotalChargeElec().compareTo(BigDecimal.ZERO)>0){
data.setSystemEfficiency(data.getTotalDischargeElec().divide(data.getTotalChargeElec(), 4, BigDecimal.ROUND_HALF_UP));
}
}
BigDecimal systemEfficiency = data.getSystemEfficiency();
bigDecimalUtil.keepTwoDecimalPlaces(data);