Merge branch 'dev-zzx' into dev-new

This commit is contained in:
Lemon
2024-12-11 11:26:10 +08:00
19 changed files with 704 additions and 226 deletions

View File

@@ -33,6 +33,14 @@ public class ConnectorStatusInfo {
@JSONField(name = "Status")
private Integer status;
/**
* 设备接口分类
* 1车辆充电设备接口
* 2换电站内的电池箱 充电设备接口
*/
@JSONField(name = "EquipmentClassification")
private int equipmentClassification;
/**
* 车位状态(0-未知10-空闲50-占用) N
*/
@@ -60,4 +68,11 @@ public class ConnectorStatusInfo {
@JSONField(name = "EquipmentID")
private String equipmentId;
/**
* 状态更新时间
* 本次状态变化的时间格式“yyyy-MM-dd HH:mm:ss”
*/
@JSONField(name = "UpdateTime")
private String updateTime;
}

View File

@@ -1,6 +1,7 @@
package com.jsowell.thirdparty.platform.common;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -67,6 +68,11 @@ public class SupStationPowerInfo {
@JSONField(name = "EquipmentPowerInfos")
private List<EquipmentPowerInfo> equipmentPowerInfos;
/**
* 充电设备功率信息列表
*/
@JSONField(name = "SupEquipmentPowerInfos")
private List<EquipmentPowerInfo> supEquipmentPowerInfos;
@Data
public static class EquipmentPowerInfo{
@@ -104,6 +110,11 @@ public class SupStationPowerInfo {
@JSONField(name = "ConnectorPowerInfos")
private List<ConnectorPowerInfo> connectorPowerInfos;
/**
* 充电设备接口实时功率列表
*/
@JSONField(name = "SupConnectorPowerInfos")
private List<ConnectorPowerInfo> supConnectorPowerInfos;
@Data
public static class ConnectorPowerInfo{
@@ -136,4 +147,74 @@ public class SupStationPowerInfo {
private BigDecimal connectorRealTimePower;
}
}
@Data
private static class SupEquipmentPowerInfo{
/**
* 充电设备编码
*/
@JSONField(name = "EquipmentID")
private String equipmentID;
/**
* 设备分类
* 1车辆充电设备
* 2换电站内的电池箱充电设备
*/
@JSONField(name = "EquipmentClassification")
private Integer equipmentClassification;
/**
* 统计时间
* 格式yyyy-MM-dd HH:mm:ss
*/
@JSONField(name = "DataTime")
private String dataTime;
/**
* 充电设备实时功率
* 保留一位小数
*/
@JSONField(name = "EquipRealTimePower")
private BigDecimal equipRealTimePower;
/**
* 充电设备接口实时功率列表
*/
@JSONField(name = "ConnectorPowerInfos")
private List<SupConnectorPowerInfo> connectorPowerInfos;
@Data
private static class SupConnectorPowerInfo{
/**
* 充电设备接口编码
*/
@JsonProperty(value = "ConnectorID")
private String connectorID;
/**
* 设备分类
* 1车辆充电设备
* 2换电站内的电池箱充电设备
*/
@JSONField(name = "EquipmentClassification")
private Integer equipmentClassification;
/**
* 统计时间
* 格式yyyy-MM-dd HH:mm:ss
*/
@JSONField(name = "DataTime")
private String dataTime;
/**
* 充电设备接口实时功率
* 保留一位小数
*/
@JSONField(name = "ConnectorRealTimePower")
private BigDecimal connectorRealTimePower;
}
}
}

View File

@@ -26,6 +26,15 @@ public class ChargeOrderInfo {
@JSONField(name = "OperatorID")
private String operatorID;
/**
* 设备分类
* 1车辆充电设备
* 2换电站内的电池箱充电设备
*/
@JSONField(name = "EquipmentClassification")
private Integer equipmentClassification;
/**
* 设备所属方
* IDEquipmentOwnerID
@@ -233,6 +242,17 @@ public class ChargeOrderInfo {
@JSONField(name = "TotalSeviceMoney")
private BigDecimal totalSeviceMoney;
/**
* 总服务费
* TotalSeviceMoney
* 本单总服务费单位小数点后4位
* 是
* 浮点数
* ≤8字符小数点后4位
*/
@JSONField(name = "TotalServiceMoney")
private BigDecimal totalServiceMoney;
/**
* 累计总金额
* TotalMoney

View File

@@ -81,6 +81,47 @@ public class SupChargeOrderInfo {
@JSONField(name = "OrderNo")
private String orderNo;
/**
* 设备接口分类
* 1车辆充电设备接 口
* 2换电站内的电池 箱充电设备接口
*/
@JSONField(name = "EquipmentClassification")
private Integer equipmentClassification;
/**
* 换电订单编 号
* 换电订单唯一标识 注:设备接口分类为 2 的,该字段为必填
*/
@JSONField(name = "SwapOrderID")
private Integer swapOrderID;
/**
* 充电开始 SOC
*/
@JSONField(name = "StartSOC")
private String startSOC;
/**
* 充电结束 SOC
*/
@JSONField(name = "EndSOC")
private String endSOC;
/**
* 电池箱编码
*/
@JSONField(name = "BatteryPackID")
private String batteryPackID;
/**
* 是否有调仓
* 0否 1
* 注:设备接口分类为 2 时,该字段为必填 项;设备接口分类为 1 时,该字段为非必 填项
*/
@JSONField(name = "BatteryCabinChange")
private String batteryCabinChange;
/**
* 车牌号
* LicensePlate

View File

@@ -52,6 +52,18 @@ public class SupEquipChargeStatusInfo {
@JSONField(name = "OrderNo")
private String orderNo;
/**
* 车牌号
*/
@JSONField(name = "LicensePlate")
private String licensePlate;
/**
* 车牌号
*/
@JSONField(name = "VIN")
private String vin;
/**
* 充电订单状态
* 1、启动中
@@ -110,6 +122,32 @@ public class SupEquipChargeStatusInfo {
@JSONField(name = "VoltageA")
private BigDecimal voltageA;
/**
* B相电流
* 小数点后1位
*/
@JSONField(name = "CurrentB")
private BigDecimal currentB;
/**
* B相电压
*/
@JSONField(name = "VoltageB")
private BigDecimal voltageB;
/**
* C相电流
* 小数点后1位
*/
@JSONField(name = "CurrentC")
private BigDecimal currentC;
/**
* C相电压
*/
@JSONField(name = "VoltageC")
private BigDecimal voltageC;
/**
* 电池剩余电量
* 小数点后1位
@@ -131,11 +169,38 @@ public class SupEquipChargeStatusInfo {
/**
* 累计充电量
* 小数点后4位
*/
@JSONField(name = "TotalPower")
private BigDecimal totalPower;
/**
* 累计电费
* 小数点后2位
*/
@JSONField(name = "ElecMoney")
private String elecMoney;
/**
* 累计服务费
* 小数点后2位
*/
@JSONField(name = "ServiceMoney")
private String serviceMoney;
/**
* 时段数
* 参数范围0 32
*/
@JSONField(name = "SumPeriod")
public Integer sumPeriod;
/**
* 充电明细信息
* 单时段充电明细信 息,参照公共对象: 充电明细信息
*/
@JSONField(name = "ChargeDetails")
private List<SupChargeDetails> chargeDetails;
/**
* 上报时间
*/
@@ -162,6 +227,6 @@ public class SupEquipChargeStatusInfo {
@JSONField(name = "StartChargeSeqStat")
private Integer startChargeSeqStat;
@JSONField(name = "ChargeDetails")
private List<ChargeDetail> chargeDetails;
//@JSONField(name = "ChargeDetails")
//private List<ChargeDetail> chargeDetails;
}

View File

@@ -30,7 +30,7 @@ public class SupStationInfo extends StationInfo {
* 2换电站内的电池箱充电设备接口
*/
@JSONField(name = "EquipmentClassification")
private Integer equipmentClassification;
private String equipmentClassification;
/**
* 充换电站所在县以下行政区划代码
@@ -49,6 +49,16 @@ public class SupStationInfo extends StationInfo {
@JSONField(name = "StationClassification")
private int stationClassification;
/**
* 通用类型
* 1通用可为 3 种或 3 种以上的车型进行换电)
* 2非通用
* 注:站点分类为 2 或 3 时,此字段必填,为 1 时非必填。
*/
@JSONField(name = "GeneralApplicationType")
private Integer generalApplicationType;
/**
* 7*24小时营业
* 0
@@ -99,5 +109,41 @@ public class SupStationInfo extends StationInfo {
@JSONField(name = "BuildTime")
private String BuildTime;
/**
* 充换电站方位
* 1地面-停车场
* 2地面-路侧
* 3地下停车场
* 4立体式停车楼
*/
@JSONField(name = "StationOrientation")
private String stationOrientation;
/**
* 充换电站建筑面积
* 该充电场站建设用 地面积
*/
@JSONField(name = "StationArea")
private String stationArea;
/**
* 充换电站人工值守
* 0
* 1
*/
@JSONField(name = "HavePerson")
private String havePerson;
/**
* 周边配套设施
* 1卫生间
* 2便利店
* 3餐厅
* 4休息室
* 5雨棚
*/
@JSONField(name = "SupportingFacilities")
private String supportingFacilities;
private List<PolicyInfo> PolicyInfos;
}

View File

@@ -64,6 +64,12 @@ public class SupStationPowerInfo {
@JSONField(name = "EquipmentPowerInfos")
private List<EquipmentPowerInfo> equipmentPowerInfos;
/**
* 充电设备功率信息列表
*/
@JSONField(name = "SupEquipmentPowerInfos")
private List<EquipmentPowerInfo> supequipmentPowerInfos;
@Data
public static class EquipmentPowerInfo{
@@ -100,6 +106,12 @@ public class SupStationPowerInfo {
@JSONField(name = "ConnectorPowerInfos")
private List<ConnectorPowerInfo> connectorPowerInfos;
/**
* 充电设备接口功率信息列表
*/
@JSONField(name = "SupConnectorPowerInfos")
private List<ConnectorPowerInfo> supconnectorPowerInfos;
@Data
public static class ConnectorPowerInfo{

View File

@@ -105,8 +105,12 @@ public class SupStationStatsInfo {
private List<EquipmentStatsInfo> equipmentStatsInfos;
@JSONField(name = "SupEquipmentStatsInfos")
private List<EquipmentStatsInfo> supEquipmentStatsInfos;
@Data
public static class EquipmentStatsInfo{
public static class EquipmentStatsInfo {
/**
* 充电设备编码
@@ -152,9 +156,14 @@ public class SupStationStatsInfo {
@JSONField(name = "ConnectorStatsInfos")
private List<ConnectorStatsInfo> connectorStatsInfos;
@Data
public static class ConnectorStatsInfo{
/**
* 充电设备接口运行统计信息列表
*/
@JSONField(name = "SupConnectorStatsInfos")
private List<ConnectorStatsInfo> supconnectorStatsInfos;
@Data
public static class ConnectorStatsInfo {
/**
* 充电设备接口编码
* 1车辆充电设备
@@ -194,7 +203,5 @@ public class SupStationStatsInfo {
private Integer connectorTotalWarningNum;
}
}
}

View File

@@ -456,7 +456,7 @@ public interface ThirdPartyPlatformService extends InitializingBean {
String response = HttpUtil.post(requestUrl, tokenRequest);
LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class);
// logger.info("获取令牌 result:{}", result);
// logger.info("获取令牌 result:{}", result);
if (result.getRet() == 0) {
// 解密data

View File

@@ -11,21 +11,19 @@ import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.lianlian.StationPaymentEnum;
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.BillingTimeTypeEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.*;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
import com.jsowell.pile.dto.QueryConnectorListDTO;
import com.jsowell.pile.dto.QueryOperatorInfoDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.thirdparty.CommonParamsDTO;
import com.jsowell.pile.thirdparty.ConnectorInfo;
import com.jsowell.pile.thirdparty.EquipmentInfo;
import com.jsowell.pile.util.MerchantUtils;
import com.jsowell.pile.vo.SupStationStatsVO;
@@ -33,12 +31,10 @@ import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
import com.jsowell.pile.vo.base.ConnectorInfoVO;
import com.jsowell.pile.vo.base.MerchantInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
import com.jsowell.pile.vo.web.PileMerchantInfoVO;
import com.jsowell.pile.vo.web.PileModelInfoVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo;
import com.jsowell.thirdparty.lianlian.domain.ConnectorStatusInfo;
import com.jsowell.thirdparty.lianlian.domain.StationStatusInfo;
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
@@ -46,7 +42,6 @@ import com.jsowell.thirdparty.platform.domain.*;
import com.jsowell.thirdparty.platform.factory.ThirdPartyPlatformFactory;
import com.jsowell.thirdparty.platform.service.ThirdPartyPlatformService;
import com.jsowell.thirdparty.platform.util.Cryptos;
import com.jsowell.thirdparty.platform.util.GBSignUtils;
import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils;
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
@@ -60,6 +55,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
@@ -83,14 +79,10 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
@Autowired
private PileMerchantInfoService pileMerchantInfoService;
@Autowired
private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService;
@Autowired
private PileConnectorInfoService pileConnectorInfoService;
@Autowired
private OrderBasicInfoService orderBasicInfoService;
@Autowired
private PileModelInfoService pileModelInfoService;
@Autowired
private PileBillingTemplateService pileBillingTemplateService;
@Autowired
private RedisCache redisCache;
@@ -227,7 +219,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
String stationId = String.valueOf(pileStationInfo.getId());
stationInfo.setStationID(stationId);
// MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId()));
stationInfo.setOperatorID(Constants.OPERATORID_LIANLIAN); // 组织机构代码
stationInfo.setOperatorID(Constants.OPERATORID_JIANG_SU); // 组织机构代码
stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId()));
stationInfo.setStationName(pileStationInfo.getStationName());
stationInfo.setIsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()));
@@ -248,7 +240,18 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// stationInfo.setServiceFee(); // 服务费 xx元/度
stationInfo.setParkFree(Integer.valueOf(pileStationInfo.getParkFree()));
stationInfo.setPayment(pileStationInfo.getPayment());
stationInfo.setStationClassification(1);
stationInfo.setSupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()));
stationInfo.setStationStatus(Integer.valueOf(pileStationInfo.getStationStatus()));
stationInfo.setParkNums(Integer.valueOf(pileStationInfo.getParkNums()));
stationInfo.setRoundTheClock(Constants.ONE);
stationInfo.setParkType("255");
stationInfo.setElectricityType(1);
stationInfo.setCapacity(pileStationInfo.getCapacity().setScale(2, RoundingMode.HALF_UP));
stationInfo.setRatedPower(pileStationInfo.getRatedPower().setScale(1, RoundingMode.HALF_UP));
stationInfo.setOfficialRunTime(DateUtils.dateTime(pileStationInfo.getCreateTime()));
stationInfo.setVideoMonitor(0);
// stationInfo.setParkFeeType(pileStationInfo); // 停车收费类型
stationInfo.setBusinessExpandType(Integer.parseInt(pileStationInfo.getAloneApply()));
stationInfo.setToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()));
@@ -264,7 +267,15 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表
}
resultList.add(stationInfo);
// areaCodeCountryside
GeoCodeInfo geoCode = TermRelationTreeCoordinate.completeGeoCode(pileStationInfo.getAddress());
if (geoCode != null) {
String areaCodeCountryside = geoCode.getCounty_code();
stationInfo.setAreaCodeCountryside(areaCodeCountryside);
}
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("PageNo", pageInfo.getPageNum());
map.put("PageCount", pageInfo.getPages());
@@ -296,13 +307,21 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// 组装所需要的数据格式
SupStationInfo info = SupStationInfo.builder()
.stationID(stationId)
.equipmentClassification(Constants.ONE)
.generalApplicationType(2)
.operatorID(operatorId)
.stationName(pileStationInfo.getStationName())
.periodFee(1) // 峰谷分时 0-否1-是
.parkType("255") // 255-参考场地实际收费标准
.roundTheClock(Constants.ONE)
.electricityType(1) // 用电类型 1-商业用电
.videoMonitor(0) // 视频监控配套情况 0-无1-有
.isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
.isPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
.countryCode(pileStationInfo.getCountryCode())
.address(pileStationInfo.getAddress())
.serviceTel(pileStationInfo.getStationTel())
.stationClassification(1)
.stationType(Integer.valueOf(pileStationInfo.getStationType()))
.stationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
.parkNums(Integer.valueOf(pileStationInfo.getParkNums()))
@@ -316,8 +335,10 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
.parkFree(Integer.valueOf(pileStationInfo.getParkFree()))
.supportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
.parkFeeType(0)
.periodFee(1) // 峰谷分时 0-否1-是
.equipmentClassification(1)
.ratedPower(BigDecimal.ONE)//站点额定总功率
.officialRunTime(DateUtils.dateTime(pileStationInfo.getCreateTime()))//正式投运时间
.businessExpandType(1)//报装类型
.toiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
.storeFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
.restaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
@@ -333,20 +354,8 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// 只取最后一部分 330213
String subAreaCode = split[split.length - 1];
info.setAreaCode(subAreaCode);
// 截取运营商组织机构代码(去除最后一位后的最后九位)
String organizationCode = "";
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPlatformType)) {
// 联联平台先使用自己运营商的组织机构代码
organizationCode = Constants.OPERATORID_LIANLIAN;
info.setEquipmentOwnerID(organizationCode);
} else {
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId()));
organizationCode = merchantInfo.getOrganizationCode();
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
info.setEquipmentOwnerID(equipmentOwnerId);
}
}
info.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU);
info.setPayment(StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment()));
if (StringUtils.isNotBlank(pileStationInfo.getParkingNumber())) {
@@ -360,7 +369,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// 容量
if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getCapacity()))) {
info.setCapacity(pileStationInfo.getCapacity().setScale(4, RoundingMode.HALF_UP));
info.setCapacity(pileStationInfo.getCapacity().setScale(2, RoundingMode.HALF_UP));
}
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId);
if (CollectionUtils.isNotEmpty(pileList)) {
@@ -371,6 +380,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
GeoCodeInfo geoCode = TermRelationTreeCoordinate.completeGeoCode(pileStationInfo.getAddress());
if (geoCode != null) {
String areaCodeCountryside = geoCode.getCounty_code();
areaCodeCountryside = "123456789101";
info.setAreaCodeCountryside(areaCodeCountryside);
}
@@ -398,54 +408,37 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
public Map<String, String> queryStationStatus(QueryStationInfoDTO dto) {
List<String> stationIds = dto.getStationIds();
List<StationStatusInfo> StationStatusInfos = new ArrayList<>();
List<Object> ConnectorStatusInfos = new ArrayList<>();
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(dto.getOperatorId());
if (configInfo == null) {
List<Object> connectorStatusInfos = new ArrayList<>();
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
if (thirdPartySecretInfoVO == null) {
return null;
}
ConnectorStatusInfo connectorStatusInfo;
for (String stationId : stationIds) {
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(stationId);
StationStatusInfo stationStatusInfo = new StationStatusInfo();
stationStatusInfo.setStationId(stationId);
stationStatusInfo.setOperatorId(Constants.OPERATORID_JIANG_SU);
stationStatusInfo.setStationStatus(50);
String equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode());
stationStatusInfo.setEquipmentOwnerId(equipmentOwnerID);
// 根据站点id查询
List<ConnectorInfoVO> list = pileConnectorInfoService.getConnectorListForLianLian(Long.parseLong(stationId));
for (ConnectorInfoVO connectorInfoVO : list) {
connectorStatusInfo = new ConnectorStatusInfo();
String connectorStatus = connectorInfoVO.getConnectorStatus();
if (StringUtils.equals(connectorStatus, PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue())) {
// 充电中
ConnectorChargeStatusInfo info = new ConnectorChargeStatusInfo();
OrderBasicInfo orderBasicInfo = orderBasicInfoService.queryChargingByPileConnectorCode(connectorInfoVO.getPileConnectorCode());
if (orderBasicInfo == null) {
continue;
}
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode());
if (CollectionUtils.isNotEmpty(chargingRealTimeData)) {
RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0);
connectorStatusInfo.setEquipmentClassification(1);
connectorStatusInfo.setStationId(stationId);
connectorStatusInfo.setConnectorID(connectorInfoVO.getPileConnectorCode());
connectorStatusInfo.setEquipmentOwnerId(equipmentOwnerID);
connectorStatusInfo.setOperatorId(Constants.OPERATORID_JIANG_SU);
connectorStatusInfo.setEquipmentId(connectorInfoVO.getPileSn());
connectorStatusInfo.setStatus(Integer.parseInt(connectorStatus));
connectorStatusInfo.setUpdateTime(DateUtils.getDateTime());
info.setStartChargeSeq(orderBasicInfo.getOrderCode());
info.setConnectorID(orderBasicInfo.getPileConnectorCode());
info.setConnectorStatus(Integer.valueOf(connectorInfoVO.getConnectorStatus()));
info.setCurrentA(new BigDecimal(realTimeMonitorData.getOutputCurrent()));
info.setVoltageA(new BigDecimal(realTimeMonitorData.getOutputVoltage()));
info.setSoc(new BigDecimal(realTimeMonitorData.getSOC()));
info.setStartTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()));
info.setEndTime(DateUtils.getDateTime()); // 本次采样时间
info.setTotalPower(new BigDecimal(realTimeMonitorData.getChargingDegree())); // 累计充电量
info.setTotalMoney(new BigDecimal(realTimeMonitorData.getChargingAmount()));
ConnectorStatusInfos.add(info);
}
} else {
// 其他
connectorStatusInfo = new ConnectorStatusInfo();
connectorStatusInfo.setConnectorID(connectorInfoVO.getPileConnectorCode());
connectorStatusInfo.setStatus(Integer.parseInt(connectorInfoVO.getConnectorStatus()));
ConnectorStatusInfos.add(connectorStatusInfo);
}
connectorStatusInfos.add(connectorStatusInfo);
}
stationStatusInfo.setConnectorStatusInfos(ConnectorStatusInfos);
stationStatusInfo.setConnectorStatusInfos(connectorStatusInfos);
StationStatusInfos.add(stationStatusInfo);
}
// 将 StationStatusInfos 分页
@@ -456,58 +449,55 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
.limit(pageSize)
.collect(Collectors.toList());
int total = StationStatusInfos.size();
int pages = PageUtil.totalPage(total, pageSize);
Map<String, Object> map = new LinkedHashMap<>();
map.put("Total", total);
map.put("StationStatusInfos", collect);
Map<String, String> resultMap = Maps.newLinkedHashMap();
// 加密数据
String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv());
resultMap.put("Data", encryptData);
// 生成sig
String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret());
resultMap.put("Sig", resultSign);
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, thirdPartySecretInfoVO);
return resultMap;
}
/**
* 设备状态变化推送 notification_stationStatus
* 推送充电设备接口状态信息 supervise_notification_station_status
*
* @param dto
* @throws UnsupportedOperationException 未实现异常
* 推送充电设备接口状态信息
* supervise_notification_connector_status
*/
@Override
public String notificationStationStatus(PushRealTimeInfoDTO dto) {
String status = dto.getStatus();
String pileConnectorCode = dto.getPileConnectorCode();
public String notificationStationStatus(String stationId, String pileConnectorCode, String status, ThirdPartySecretInfoVO secretInfoVO) {
// 查询充电枪口状态
PileConnectorInfoVO connectorInfo = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(pileConnectorCode);
if (Objects.isNull(connectorInfo)) {
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
}
// 查出该桩所属哪个站点
// String pileSn = StringUtils.substring(pileConnectorCode, 0, 14);
String pileSn = YKCUtils.getPileSn(pileConnectorCode);
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileSn(pileSn);
// 通过站点id查询相关配置信息
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo();
String merchantId = connectorInfo.getMerchantId();
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId);
if (Objects.isNull(merchantInfoVO)) {
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
}
String operatorId = thirdPartySecretInfoVO.getOurOperatorId();
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_STATION_STATUS.getValue();
ConnectorStatusInfo info = ConnectorStatusInfo.builder()
SupConnectorStatusInfo info = SupConnectorStatusInfo.builder()
.operatorID(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode()))
.stationID(connectorInfo.getStationId())
.equipmentID(connectorInfo.getPileSn())
.connectorID(pileConnectorCode)
.status(Integer.parseInt(status))
.statusDesc(PileConnectorDataBaseStatusEnum.getStatusDescription(status))
.parkStatus(Constants.zero)
.lockStatus(Constants.zero)
.updateTime(DateUtils.getDateTime())
.equipmentClassification(Constants.ONE)
.build();
// 调用联联平台接口
JSONObject json = new JSONObject();
json.put("ConnectorStatusInfo", info);
String jsonString = JSON.toJSONString(json);
String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = secretInfoVO.getTheirOperatorSecret();
String signSecret = secretInfoVO.getTheirSigSecret();
String dataSecret = secretInfoVO.getTheirDataSecret();
String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
String urlAddress = secretInfoVO.getTheirUrlPrefix();
String url = urlAddress + "supervise_notification_station_status";
String jsonString = JSON.toJSONString(info);
// 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
@@ -525,11 +515,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
public String notificationEquipChargeStatus(String orderCode) {
// 根据订单号查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// 查询枪口状态
PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode());
BigDecimal current = info.getCurrent() == null ? BigDecimal.ZERO : info.getCurrent();
BigDecimal voltage = info.getVoltage() == null ? BigDecimal.ZERO : info.getVoltage();
String soc = info.getSOC() == null ? Constants.ZERO : info.getSOC();
// 查询相关配置信息
ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo();
@@ -540,35 +525,69 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
String dataSecretIv = guiZhouPlatformSecretInfo.getTheirDataSecretIv();
String urlAddress = guiZhouPlatformSecretInfo.getTheirUrlPrefix();
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderInfo.getTransactionCode());
RealTimeMonitorData realTimeMonitorData;
if (CollectionUtils.isEmpty(chargingRealTimeData)) {
realTimeMonitorData = RealTimeMonitorData.builder()
.chargingDegree("0")
.build();
chargingRealTimeData.add(realTimeMonitorData);
} else {
realTimeMonitorData = chargingRealTimeData.get(0);
}
// 查询枪口状态
PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode());
if (Objects.isNull(info)) {
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
}
String merchantId = info.getMerchantId();
MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId);
if (Objects.isNull(merchantInfoVO)) {
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
}
String orderStatus = orderInfo.getOrderStatus();
if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderStatus)) {
// 充电中
orderStatus = "2";
} else if (StringUtils.equals(OrderStatusEnum.ORDER_COMPLETE.getValue(), orderStatus)) {
// 充电完成
orderStatus = "4";
}
BigDecimal current = info.getCurrent() == null ? BigDecimal.ZERO : info.getCurrent();
BigDecimal voltage = info.getVoltage() == null ? BigDecimal.ZERO : info.getVoltage();
String soc = info.getSOC() == null ? Constants.ZERO : info.getSOC();
String dateTime = DateUtils.getDateTime();
SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder()
.operatorID(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerID(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerID(Constants.OPERATORID_GUI_ZHOU)
.stationID(orderInfo.getStationId())
.equipmentID(orderInfo.getPileSn())
.startChargeSeqStat(Integer.parseInt(orderStatus))
.connectorID(orderInfo.getPileConnectorCode())
.orderNo(orderInfo.getOrderCode())
.orderStatus(2)
.equipmentClassification(1)
.pushTimeStamp(dateTime)
.connectorStatus(info.getStatus()) // 3-充电中
.connectorStatus(3) // 3-充电中
.currentA(current.setScale(1, BigDecimal.ROUND_HALF_UP))
.voltageA(voltage.setScale(1, BigDecimal.ROUND_HALF_UP))
.soc(new BigDecimal(soc))
// .currentA(BigDecimal.ONE)
// .voltageA(BigDecimal.ONE)
// .soc(BigDecimal.ZERO)
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()))
.endTime(dateTime)
.totalPower(info.getChargingDegree())
.totalPower(new BigDecimal(realTimeMonitorData.getChargingDegree()))
.eventTime(dateTime)
.chargeVoltage(voltage.setScale(1, BigDecimal.ROUND_HALF_UP))
.chargeCurrent(current.setScale(1, BigDecimal.ROUND_HALF_UP))
.build();
// 查询运营商信息
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationId());
String organizationCode = pileMerchantInfoVO.getOrganizationCode();
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
supEquipChargeStatusInfo.setEquipmentOwnerID(equipmentOwnerId);
supEquipChargeStatusInfo.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU);
if (StringUtils.isNotBlank(info.getSOC())) {
supEquipChargeStatusInfo.setSoc(new BigDecimal(info.getSOC()));
}
String url = urlAddress + "supervise_notification_equip_charge_status";
@@ -612,19 +631,9 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// 拼装成平台所需格式对象
ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail);
orderInfo.setOperatorID(operatorId);
String equipmentOwnerID;
if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) {
equipmentOwnerID = Constants.OPERATORID_XI_XIAO;
} else {
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationID());
String organizationCode = pileMerchantInfoVO.getOrganizationCode();
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode());
} else {
equipmentOwnerID = Constants.OPERATORID_JIANG_SU;
}
}
orderInfo.setEquipmentOwnerID(equipmentOwnerID);
orderInfo.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU);
orderInfo.setTotalServiceMoney(orderInfo.getTotalSeviceMoney());
orderInfo.setTotalElecMoney(orderDetail.getTotalElectricityAmount());
List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
// 先将list按照 尖、峰、平、谷 时段排序
@@ -655,27 +664,21 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// 根据订单号查询出信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo();
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
String operatorId = guiZhouPlatformSecretInfo.getTheirOperatorId();
String operatorSecret = guiZhouPlatformSecretInfo.getTheirOperatorSecret();
String signSecret = guiZhouPlatformSecretInfo.getTheirSigSecret();
String dataSecret = guiZhouPlatformSecretInfo.getTheirDataSecret();
String dataSecretIv = guiZhouPlatformSecretInfo.getTheirDataSecretIv();
String urlAddress = guiZhouPlatformSecretInfo.getTheirUrlPrefix();
String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = getGuiZhouPlatformSecretInfo().getTheirOperatorSecret();
String signSecret = getGuiZhouPlatformSecretInfo().getTheirSigSecret();
String dataSecret = getGuiZhouPlatformSecretInfo().getTheirDataSecret();
String dataSecretIv = getGuiZhouPlatformSecretInfo().getTheirDataSecretIv();
String urlAddress = getGuiZhouPlatformSecretInfo().getTheirUrlPrefix();
String url = urlAddress + "supervise_notification_charge_order_info_history";
ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail);
orderInfo.setOperatorID(operatorId);
String equipmentOwnerID;
if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) {
equipmentOwnerID = Constants.OPERATORID_XI_XIAO;
} else {
equipmentOwnerID = Constants.OPERATORID_LIANLIAN;
}
orderInfo.setEquipmentOwnerID(equipmentOwnerID);
orderInfo.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU);
List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
// 先将list按照 尖、峰、平、谷 时段排序
@@ -690,9 +693,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
return null;
}
// 调用联联平台接口
JSONObject json = new JSONObject();
json.put("ChargeOrderInfo", orderInfo);
String jsonString = JSON.toJSONString(json);
String jsonString = JSON.toJSONString(orderInfo);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result;
}
@@ -705,17 +706,11 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
*/
@Override
public String notificationOperationStatsInfo(String stationId) {
SupStationStatsInfo.
EquipmentStatsInfo equipmentStatsInfo = new SupStationStatsInfo.EquipmentStatsInfo();
List<SupStationStatsInfo.
EquipmentStatsInfo> equipmentStatsInfoList = new ArrayList<>();
SupStationStatsInfo.EquipmentStatsInfo equipmentStatsInfo = new SupStationStatsInfo.EquipmentStatsInfo();
List<SupStationStatsInfo.EquipmentStatsInfo> equipmentStatsInfoList = new ArrayList<>();
SupStationStatsInfo.
EquipmentStatsInfo.
ConnectorStatsInfo connectorStatsInfo = null;
List<SupStationStatsInfo.
EquipmentStatsInfo.
ConnectorStatsInfo> connectorStatsInfoList = new ArrayList<>();
SupStationStatsInfo.EquipmentStatsInfo.ConnectorStatsInfo connectorStatsInfo = null;
List<SupStationStatsInfo.EquipmentStatsInfo.ConnectorStatsInfo> connectorStatsInfoList = new ArrayList<>();
// 根据站点id查询订单记录 (新建Service方法)
List<SupStationStatsVO> orderVOS = orderBasicInfoService.queryOrderListByStationId(stationId);
@@ -724,13 +719,12 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
int stationChargeTime = Constants.zero; // 充电站累计充电次数
for (SupStationStatsVO orderVO : orderVOS) {
// 充电站累计用电量
BigDecimal totalPower = orderVO.getTotalPower();
if (totalPower == null || orderVO.getChargingTime() == null) {
continue;
}
BigDecimal totalPower = (orderVO.getTotalPower() != null) ? orderVO.getTotalPower() : BigDecimal.ZERO;
Integer chargingTime = (orderVO.getChargingTime() != null) ? orderVO.getChargingTime() : Constants.zero;
stationTotalElectricity = stationTotalElectricity.add(totalPower);
// 充电站累计充电时长(分钟)
stationChargeTime += orderVO.getChargingTime();
stationChargeTime += chargingTime;
}
// 根据枪口排序,分组,将充电时长和充电量累加
@@ -752,7 +746,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// key : pileConnectorCode
// value: SupStationStatsVO
for (Map.Entry<String, SupStationStatsVO> entry : sortedMap.entrySet()) {
String pileConnectorCode = entry.getKey();
SupStationStatsVO vo = entry.getValue();
@@ -762,9 +755,9 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
connectorStatsInfo.setConnectorId(pileConnectorCode);
connectorStatsInfo.setEquipmentClassification(1);
connectorStatsInfo.setConnectorElectricity(vo.getTotalPower());
connectorStatsInfo.setConnectorTotalChargeTime(vo.getChargingTime());
// TODO connectorStatsInfo.setConnectorTotalChargeNum();
connectorStatsInfo.setConnectorElectricity((vo.getTotalPower() != null) ? vo.getTotalPower() : BigDecimal.ZERO);
connectorStatsInfo.setConnectorTotalChargeTime((vo.getChargingTime() != null) ? vo.getChargingTime() : Constants.zero);
connectorStatsInfo.setConnectorTotalChargeNum(orderVOS.size());
connectorStatsInfo.setConnectorTotalWarningNum(0);
// 对比这次循环到的桩编号和上次的桩编号如果是同一台桩将数据进行汇总如果不是新建桩数据并将之前的累计数据清0
@@ -779,21 +772,21 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
equipmentStatsInfo.setEquipmentId(pileSn);
equipmentStatsInfo.setEquipmentClassification(1);
equipmentStatsInfo.setEquipmentElectricity(vo.getTotalPower());
equipmentStatsInfo.setEquipmentTotalChargeTime(vo.getChargingTime());
// TODO equipmentStatsInfo.setEquipmentTotalChargeNum();
equipmentStatsInfo.setEquipmentElectricity((vo.getTotalPower() != null) ? vo.getTotalPower() : BigDecimal.ZERO);
equipmentStatsInfo.setEquipmentTotalChargeTime((vo.getChargingTime() != null) ? vo.getChargingTime() : Constants.zero);
equipmentStatsInfo.setEquipmentTotalChargeNum(orderVOS.size());
equipmentStatsInfo.setEquipmentTotalWarningNum(0);
pileTotalPower = pileTotalPower.add(vo.getTotalPower());
pileChargeTime += vo.getChargingTime();
pileTotalPower = pileTotalPower.add((vo.getTotalPower() != null) ? vo.getTotalPower() : BigDecimal.ZERO);
pileChargeTime += (vo.getChargingTime() != null) ? vo.getChargingTime() : Constants.zero;
connectorStatsInfoList.add(connectorStatsInfo);
equipmentStatsInfo.setConnectorStatsInfos(connectorStatsInfoList);
equipmentStatsInfoList.add(equipmentStatsInfo);
} else {
// 同一台桩,枪口号不同,累加桩数据,将枪口数据新建
pileTotalPower = pileTotalPower.add(vo.getTotalPower());
pileChargeTime += vo.getChargingTime();
pileTotalPower = pileTotalPower.add((vo.getTotalPower() != null) ? vo.getTotalPower() : BigDecimal.ZERO);
pileChargeTime += (vo.getChargingTime() != null) ? vo.getChargingTime() : Constants.zero;
equipmentStatsInfo.setEquipmentElectricity(pileTotalPower); // 第一次判断时一定不会进入到这里,所以不用判断 equipmentStatsInfo 是否为 null
equipmentStatsInfo.setEquipmentTotalChargeTime(pileChargeTime);
@@ -802,7 +795,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
equipmentStatsInfo.setConnectorStatsInfos(connectorStatsInfoList);
equipmentStatsInfoList.add(equipmentStatsInfo);
}
}
// 创建对象
@@ -821,7 +813,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
.stationTotalChargeTime(stationChargeTime)
.stationTotalWarningNum(0)
.equipmentStatsInfos(equipmentStatsInfoList)
.equipmentOwnerId(Constants.OPERATORID_GUI_ZHOU)
.build();
JSONObject json = new JSONObject();
json.put("StationStatsInfos", supStationStatsInfo);
@@ -846,37 +838,31 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
return result;
}
/**
* 推送充换电站实时功率 supervise_notification_realtime_power_info
*
* @return
*/
public String notificationPowerInfo(List<String> stationIds) {
com.jsowell.thirdparty.platform.common.SupStationPowerInfo supStationPowerInfo = null;
List<com.jsowell.thirdparty.platform.common.SupStationPowerInfo> list = new ArrayList<>();
String dateTimeNow = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS);
List<com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo> supPileInfoList = null;
com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo supPileInfo = null;
List<com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo> connectorPowerInfoList;
com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo connectorPowerInfo;
for (String stationId : stationIds) {
BigDecimal stationPower = BigDecimal.ZERO;
supStationPowerInfo = new com.jsowell.thirdparty.platform.common.SupStationPowerInfo();
com.jsowell.thirdparty.platform.common.SupStationPowerInfo supStationPowerInfo = new com.jsowell.thirdparty.platform.common.SupStationPowerInfo();
supStationPowerInfo.setOperatorID(Constants.OPERATORID_JIANG_SU);
supStationPowerInfo.setStationId(stationId);
supStationPowerInfo.setDataTime(dateTimeNow);
supStationPowerInfo.setStationClassification(Constants.one);
supStationPowerInfo.setStationRealTimePower(stationPower);
// 查询运营商基本信息
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(stationId);
String organizationCode = pileMerchantInfoVO.getOrganizationCode();
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
supStationPowerInfo.setEquipmentOwnerID(equipmentOwnerId);
} else {
supStationPowerInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU);
supStationPowerInfo.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU);
}
// 根据站点id查询桩信息
@@ -885,6 +871,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
logger.error("推送充换电站实时功率 error, 查询桩列表信息为空");
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
}
// 将桩id筛选出来用于批量查询枪口数据
List<Long> pileIds = pileList.stream()
.map(PileBasicInfo::getId)
@@ -896,20 +883,22 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
logger.error("推送充换电站实时功率 error, 查询枪口列表信息为空");
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_INFO_IS_NULL);
}
supPileInfoList = new ArrayList<>();
List<com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo> supPileInfoList = new ArrayList<>();
for (PileBasicInfo pileBasicInfo : pileList) {
supPileInfo = new com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo();
com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo supPileInfo = new com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo();
supPileInfo.setEquipmentID(pileBasicInfo.getSn());
supPileInfo.setEquipmentClassification(Constants.one);
supPileInfo.setDataTime(dateTimeNow);
supPileInfo.setEquipRealTimePower(BigDecimal.ZERO);
BigDecimal pileInstantPower = BigDecimal.ZERO;
connectorPowerInfoList = new ArrayList<>();
List<com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo> connectorPowerInfoList = new ArrayList<>();
for (PileConnectorInfoVO pileConnectorInfoVO : connectorList) {
if (!StringUtils.equals(pileBasicInfo.getSn(), pileConnectorInfoVO.getPileSn())) {
continue;
}
BigDecimal instantPower = pileConnectorInfoVO.getInstantPower() == null ? BigDecimal.ZERO : pileConnectorInfoVO.getInstantPower();
connectorPowerInfo = new com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo();
com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo connectorPowerInfo = new com.jsowell.thirdparty.platform.common.SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo();
connectorPowerInfo.setConnectorID(pileConnectorInfoVO.getPileConnectorCode());
connectorPowerInfo.setEquipmentClassification(Constants.one);
connectorPowerInfo.setDataTime(dateTimeNow);
@@ -924,16 +913,17 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// 桩实时功率
supPileInfo.setEquipRealTimePower(pileInstantPower);
stationPower = stationPower.add(pileInstantPower);
supPileInfoList.add(supPileInfo);
}
supStationPowerInfo.setEquipmentPowerInfos(supPileInfoList);
supStationPowerInfo.setStationRealTimePower(stationPower);
list.add(supStationPowerInfo);
}
list.add(supStationPowerInfo);
// 获取推送配置密钥信息
ThirdPartySecretInfoVO guiZhouPlatformSecretInfo = getGuiZhouPlatformSecretInfo();
String operatorId = guiZhouPlatformSecretInfo.getTheirOperatorId();
String operatorId = guiZhouPlatformSecretInfo.getOurOperatorId();
String operatorSecret = guiZhouPlatformSecretInfo.getTheirOperatorSecret();
String signSecret = guiZhouPlatformSecretInfo.getTheirSigSecret();
String dataSecret = guiZhouPlatformSecretInfo.getTheirDataSecret();
@@ -978,18 +968,24 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
* @return
*/
private ChargeOrderInfo transformChargeOrderInfo(OrderBasicInfo orderBasicInfo, OrderDetail orderDetail) {
DecimalFormat df2 = new DecimalFormat("#.######");
BigDecimal totalPower = new BigDecimal(df2.format(orderDetail.getTotalUsedElectricity()));
totalPower = totalPower.setScale(4, RoundingMode.HALF_UP);
ChargeOrderInfo chargeOrderInfo = ChargeOrderInfo.builder()
.operatorID(Constants.OPERATORID_JIANG_SU)
.stationID(orderBasicInfo.getStationId())
.equipmentID(orderBasicInfo.getPileSn())
.orderNo(orderBasicInfo.getOrderCode())
.connectorID(orderBasicInfo.getPileConnectorCode())
.equipmentClassification(1)
.licensePlate(orderBasicInfo.getPlateNumber())
.vin(orderBasicInfo.getVinCode())
.startSOC(orderBasicInfo.getStartSoc())
.endSOC(orderBasicInfo.getEndSoc())
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()))
.endTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime()))
.totalPower(orderDetail.getTotalUsedElectricity())
.totalPower(totalPower)
.cuspElect(orderDetail.getSharpUsedElectricity())
.peakElect(orderDetail.getSharpUsedElectricity())
.flatElect(orderDetail.getFlatUsedElectricity())
@@ -997,8 +993,9 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
.pushTimeStamp(DateUtils.getDateTime())
.totalElecMoney(orderDetail.getTotalElectricityAmount())
.totalSeviceMoney(orderDetail.getTotalServiceAmount())
.totalServiceMoney(orderDetail.getTotalServiceAmount())
.totalMoney(orderDetail.getTotalOrderAmount())
.stopReason(0)
.stopReason(2)
.stopDesc(orderBasicInfo.getReason()) // TODO 停止原因
.sumPeriod(0)
.build();
@@ -1019,8 +1016,8 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
detail = new SupChargeDetails();
if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.SHARP.getValue())) {
// 尖时段
detail.setDetailStartTime(billingPriceVO.getStartTime());
detail.setDetailEndTime(billingPriceVO.getEndTime());
detail.setDetailStartTime(DateUtils.getDateTime());
detail.setDetailEndTime(DateUtils.getDateTime());
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
detail.setDetailPower(orderDetail.getSharpUsedElectricity());
@@ -1028,8 +1025,8 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
detail.setDetailSeviceMoney(orderDetail.getSharpServicePrice());
} else if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.PEAK.getValue())) {
// 峰时段
detail.setDetailStartTime(billingPriceVO.getStartTime());
detail.setDetailEndTime(billingPriceVO.getEndTime());
detail.setDetailStartTime(DateUtils.getDateTime());
detail.setDetailEndTime(DateUtils.getDateTime());
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
detail.setDetailPower(orderDetail.getPeakUsedElectricity());
@@ -1037,8 +1034,8 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
detail.setDetailSeviceMoney(orderDetail.getPeakServicePrice());
} else if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.FLAT.getValue())) {
// 平时段
detail.setDetailStartTime(billingPriceVO.getStartTime());
detail.setDetailEndTime(billingPriceVO.getEndTime());
detail.setDetailStartTime(DateUtils.getDateTime());
detail.setDetailEndTime(DateUtils.getDateTime());
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
detail.setDetailPower(orderDetail.getFlatUsedElectricity());
@@ -1046,8 +1043,8 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
detail.setDetailSeviceMoney(orderDetail.getFlatServicePrice());
} else if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.VALLEY.getValue())) {
// 谷时段
detail.setDetailStartTime(billingPriceVO.getStartTime());
detail.setDetailEndTime(billingPriceVO.getEndTime());
detail.setDetailStartTime(DateUtils.getDateTime());
detail.setDetailEndTime(DateUtils.getDateTime());
detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
detail.setDetailPower(orderDetail.getValleyUsedElectricity());