中车电站数据融合
This commit is contained in:
@ -243,7 +243,8 @@ public class ShipEnergyService {
|
|||||||
JSONObject jsonObj = (JSONObject) i;
|
JSONObject jsonObj = (JSONObject) i;
|
||||||
Integer stationId = jsonObj.getInteger("stationId");
|
Integer stationId = jsonObj.getInteger("stationId");
|
||||||
String json = getMainTotal(stationId);
|
String json = getMainTotal(stationId);
|
||||||
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + stationId;
|
Integer finalStationId = stationId +10000;
|
||||||
|
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + finalStationId;
|
||||||
redisService.set(mainKey,json);
|
redisService.set(mainKey,json);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -349,16 +349,15 @@ public class IargeScreenShowServiceImpl implements IargeScreenShowService {
|
|||||||
}
|
}
|
||||||
// 寄点站点数据融合
|
// 寄点站点数据融合
|
||||||
stations.forEach(s->{
|
stations.forEach(s->{
|
||||||
if(s.getId()==11003 || s.getId()==10942) {
|
if(s.getId()==11003 || s.getId()==10942 || s.getId()==11006) {
|
||||||
// 寄点电站数据
|
// 寄点电站数据
|
||||||
Integer stationId = s.getId() - 10000;
|
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + s.getId();
|
||||||
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + stationId;
|
|
||||||
String json = (String) redisService.get(mainKey);
|
String json = (String) redisService.get(mainKey);
|
||||||
ShipStationRespVO respVO = JSON.parseObject(json, ShipStationRespVO.class);
|
ShipStationRespVO respVO = JSON.parseObject(json, ShipStationRespVO.class);
|
||||||
// 日充
|
// 日充
|
||||||
annualOverviewResp.setDayCharge(annualOverviewResp.getDayCharge().add(BigDecimal.valueOf(respVO.getPositivePowerToday())));
|
annualOverviewResp.setDayCharge(annualOverviewResp.getDayCharge().add(respVO.getPositivePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(respVO.getPositivePowerToday())));
|
||||||
// 日放
|
// 日放
|
||||||
annualOverviewResp.setDayDischarge(annualOverviewResp.getDayDischarge().add(BigDecimal.valueOf(respVO.getReversePowerToday())));
|
annualOverviewResp.setDayDischarge(annualOverviewResp.getDayDischarge().add(respVO.getReversePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(respVO.getReversePowerToday())));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return annualOverviewResp;
|
return annualOverviewResp;
|
||||||
|
|||||||
@ -176,7 +176,7 @@ public class OutApiServiceImpl implements OutApiService {
|
|||||||
}
|
}
|
||||||
String deviceType = DeviceTypeConstant.BMS;
|
String deviceType = DeviceTypeConstant.BMS;
|
||||||
log.info("stations.size:" + stations.size());
|
log.info("stations.size:" + stations.size());
|
||||||
stations = stations.stream().filter(i->i.getId()!=11003 && i.getId()!=10942).collect(Collectors.toList());
|
stations = stations.stream().filter(i->i.getId()!=11003 && i.getId()!=10942 && i.getId()!=11006).collect(Collectors.toList());
|
||||||
for (Station station : stations) {
|
for (Station station : stations) {
|
||||||
try {
|
try {
|
||||||
//先删除站的当日数据
|
//先删除站的当日数据
|
||||||
|
|||||||
@ -960,14 +960,13 @@ public class StationHomeServiceImpl implements StationHomeService {
|
|||||||
dailyDischargeElec = new BigDecimal(dailyDischargeElecStr);
|
dailyDischargeElec = new BigDecimal(dailyDischargeElecStr);
|
||||||
pcsElecData.setChargeElec(dailyChargeElec);
|
pcsElecData.setChargeElec(dailyChargeElec);
|
||||||
pcsElecData.setDischargeElec(dailyDischargeElec);
|
pcsElecData.setDischargeElec(dailyDischargeElec);
|
||||||
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 + req.getStationId();
|
||||||
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + stationId;
|
|
||||||
String json = (String)redisService.get(mainKey);
|
String json = (String)redisService.get(mainKey);
|
||||||
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
|
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
|
||||||
pcsElecData.setChargeElec(BigDecimal.valueOf(vo.getPositivePowerToday()));
|
pcsElecData.setChargeElec(vo.getPositivePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getPositivePowerToday()));
|
||||||
pcsElecData.setDischargeElec(BigDecimal.valueOf(vo.getReversePowerToday()));
|
pcsElecData.setDischargeElec(vo.getReversePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getReversePowerToday()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,35 +119,36 @@ public class OpenStationController {
|
|||||||
log.info("realtimeCurve.stationRealtimeCurve:" + stationReq);
|
log.info("realtimeCurve.stationRealtimeCurve:" + stationReq);
|
||||||
List<NewRealTimeCurveVo> resList = stationHomeService.getRealtimeCurve(stationReq);
|
List<NewRealTimeCurveVo> resList = stationHomeService.getRealtimeCurve(stationReq);
|
||||||
// 寄点电站功率、soc曲线
|
// 寄点电站功率、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 + stationReq.getStationId();
|
||||||
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + stationId;
|
|
||||||
String json = (String)redisService.get(mainKey);
|
String json = (String)redisService.get(mainKey);
|
||||||
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
|
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
|
||||||
JSONArray historyDataList = vo.getHistoryDataList();
|
JSONArray historyDataList = vo.getHistoryDataList();
|
||||||
NewRealTimeCurveVo soc = new NewRealTimeCurveVo();
|
if(historyDataList!=null){
|
||||||
soc.setName("SOC");
|
NewRealTimeCurveVo soc = new NewRealTimeCurveVo();
|
||||||
List<StationHomeRespVo> soclist =new ArrayList<>();
|
soc.setName("SOC");
|
||||||
NewRealTimeCurveVo p = new NewRealTimeCurveVo();
|
List<StationHomeRespVo> soclist =new ArrayList<>();
|
||||||
p.setName("实时功率");
|
NewRealTimeCurveVo p = new NewRealTimeCurveVo();
|
||||||
List<StationHomeRespVo> plist =new ArrayList<>();
|
p.setName("实时功率");
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstant.DATE);
|
List<StationHomeRespVo> plist =new ArrayList<>();
|
||||||
historyDataList.forEach(i->{
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CommonConstant.DATE);
|
||||||
JSONObject obj = (JSONObject) i;
|
historyDataList.forEach(i->{
|
||||||
StationHomeRespVo socCurve = new StationHomeRespVo();
|
JSONObject obj = (JSONObject) i;
|
||||||
socCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
|
StationHomeRespVo socCurve = new StationHomeRespVo();
|
||||||
socCurve.setDigital(obj.getBigDecimal("soc"));
|
socCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
|
||||||
soclist.add(socCurve);
|
socCurve.setDigital(obj.getBigDecimal("soc"));
|
||||||
StationHomeRespVo pCurve = new StationHomeRespVo();
|
soclist.add(socCurve);
|
||||||
pCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
|
StationHomeRespVo pCurve = new StationHomeRespVo();
|
||||||
pCurve.setDigital(obj.getBigDecimal("p_total"));
|
pCurve.setDate(ZonedDateTime.parse(obj.getString("record_time")).format(formatter));
|
||||||
plist.add(pCurve);
|
pCurve.setDigital(obj.getBigDecimal("p_total"));
|
||||||
});
|
plist.add(pCurve);
|
||||||
soc.setList(soclist);
|
});
|
||||||
p.setList(plist);
|
soc.setList(soclist);
|
||||||
resList.add(soc);
|
p.setList(plist);
|
||||||
resList.add(p);
|
resList.add(soc);
|
||||||
|
resList.add(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//返回值的BigDecimal类型保留两位小数
|
//返回值的BigDecimal类型保留两位小数
|
||||||
for (NewRealTimeCurveVo newRealTimeCurveVo : resList) {
|
for (NewRealTimeCurveVo newRealTimeCurveVo : resList) {
|
||||||
@ -264,19 +265,20 @@ public class OpenStationController {
|
|||||||
req.setDeviceType(deviceType);
|
req.setDeviceType(deviceType);
|
||||||
}
|
}
|
||||||
PcsTotalData data = stationHomeService.getPcsTotalData(req);
|
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 + req.getStationId();
|
||||||
String mainKey = CommonConstant.SHIP_ENERGY_MAIN + stationId;
|
|
||||||
String json = (String)redisService.get(mainKey);
|
String json = (String)redisService.get(mainKey);
|
||||||
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
|
ShipStationRespVO vo = JSON.parseObject(json,ShipStationRespVO.class);
|
||||||
// 数据转换
|
// 数据转换
|
||||||
data.setTotalChargeElec(BigDecimal.valueOf(vo.getPositivePowerSum()));
|
data.setTotalChargeElec(vo.getPositivePowerSum()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getPositivePowerSum()));
|
||||||
data.setTotalDischargeElec(BigDecimal.valueOf(vo.getReversePowerSum()));
|
data.setTotalDischargeElec(vo.getReversePowerSum()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getReversePowerSum()));
|
||||||
data.setDailyChargeElec(BigDecimal.valueOf(vo.getPositivePowerToday()));
|
data.setDailyChargeElec(vo.getPositivePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getPositivePowerToday()));
|
||||||
data.setDailyDischargeElec(BigDecimal.valueOf(vo.getReversePowerToday()));
|
data.setDailyDischargeElec(vo.getReversePowerToday()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getReversePowerToday()));
|
||||||
data.setCurrentPower(BigDecimal.valueOf(vo.getRealTimePower()));
|
data.setCurrentPower(vo.getRealTimePower()==null?BigDecimal.ZERO:BigDecimal.valueOf(vo.getRealTimePower()));
|
||||||
data.setSystemEfficiency(data.getTotalDischargeElec().divide(data.getTotalChargeElec(), 4, BigDecimal.ROUND_HALF_UP));
|
if(data.getTotalChargeElec().compareTo(BigDecimal.ZERO)>0){
|
||||||
|
data.setSystemEfficiency(data.getTotalDischargeElec().divide(data.getTotalChargeElec(), 4, BigDecimal.ROUND_HALF_UP));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BigDecimal systemEfficiency = data.getSystemEfficiency();
|
BigDecimal systemEfficiency = data.getSystemEfficiency();
|
||||||
bigDecimalUtil.keepTwoDecimalPlaces(data);
|
bigDecimalUtil.keepTwoDecimalPlaces(data);
|
||||||
|
|||||||
@ -187,7 +187,7 @@ public class HttpUtils {
|
|||||||
/**
|
/**
|
||||||
* 将Map转换为JSON字符串(简单实现,实际项目中建议使用Jackson/Gson等库)
|
* 将Map转换为JSON字符串(简单实现,实际项目中建议使用Jackson/Gson等库)
|
||||||
*/
|
*/
|
||||||
private static String mapToJson(Map<String, Object> params) {
|
public static String mapToJson(Map<String, Object> params) {
|
||||||
if (params == null || params.isEmpty()) {
|
if (params == null || params.isEmpty()) {
|
||||||
return "{}";
|
return "{}";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -293,4 +293,29 @@ public class JobHandler {
|
|||||||
log.info("jobCacheShipEnergyEle end !");
|
log.info("jobCacheShipEnergyEle end !");
|
||||||
return ReturnT.SUCCESS;
|
return ReturnT.SUCCESS;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 中车-站点收益、充放电数据 - 昨日
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@XxlJob("jobBoulderEleIncome")
|
||||||
|
public ReturnT<String> jobBoulderEleIncome(String param){
|
||||||
|
log.info("jobCacheShipEnergyEle start !");
|
||||||
|
businessFeignClient.jobBoulderEleIncome(param);
|
||||||
|
log.info("jobCacheShipEnergyEle end !");
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中车-站点收益、充放电数据 - 今日
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@XxlJob("jobBoulderEleIncomeToday")
|
||||||
|
public ReturnT<String> jobBoulderEleIncomeToday(String param){
|
||||||
|
log.info("jobCacheShipEnergyEle start !");
|
||||||
|
businessFeignClient.jobBoulderEleIncome(DateUtil.formatDate(new Date()));
|
||||||
|
log.info("jobCacheShipEnergyEle end !");
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user