mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-04 22:18:02 +08:00
对接浙江平台
This commit is contained in:
@@ -385,6 +385,7 @@ public interface ThirdPartyPlatformService extends InitializingBean {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送充换电站实时功率
|
* 推送充换电站实时功率
|
||||||
|
* 浙江省平台: 推送充电站实时功率信息 supervise_notification_realtime_power_info
|
||||||
* @param stationIds
|
* @param stationIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -108,11 +108,12 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求令牌 query_token
|
* 请求令牌 query_token
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> queryToken(CommonParamsDTO dto) {
|
public Map<String, String> queryToken(CommonParamsDTO dto) {
|
||||||
String operatorId = dto.getOperatorID();
|
String operatorId = dto.getOperatorID();
|
||||||
// 通过operatorId 查出 operatorSecret
|
// 通过operatorId 查出 operatorSecret
|
||||||
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
|
ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId);
|
||||||
@@ -183,6 +184,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询站点信息 query_stations_info
|
* 查询站点信息 query_stations_info
|
||||||
|
*
|
||||||
* @param dto 查询站点信息dto
|
* @param dto 查询站点信息dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -289,6 +291,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
/**
|
/**
|
||||||
* 设备状态变化推送(在0x13中调用统一推送接口)
|
* 设备状态变化推送(在0x13中调用统一推送接口)
|
||||||
* notification_stationStatus
|
* notification_stationStatus
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -350,7 +353,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
ConnectorChargeStatusInfo info;
|
ConnectorChargeStatusInfo info;
|
||||||
if (CollectionUtils.isEmpty(realTimeData)) {
|
if (CollectionUtils.isEmpty(realTimeData)) {
|
||||||
info = new ConnectorChargeStatusInfo();
|
info = new ConnectorChargeStatusInfo();
|
||||||
}else {
|
} else {
|
||||||
RealTimeMonitorData data = realTimeData.get(0);
|
RealTimeMonitorData data = realTimeData.get(0);
|
||||||
String orderStatus = orderInfo.getOrderStatus();
|
String orderStatus = orderInfo.getOrderStatus();
|
||||||
if (StringUtils.equals(orderStatus, OrderStatusEnum.IN_THE_CHARGING.getValue())) {
|
if (StringUtils.equals(orderStatus, OrderStatusEnum.IN_THE_CHARGING.getValue())) {
|
||||||
@@ -405,6 +408,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送充换电站实时功率 supervise_notification_realtime_power_info
|
* 推送充换电站实时功率 supervise_notification_realtime_power_info
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String notificationPowerInfo(List<String> stationIds) {
|
public String notificationPowerInfo(List<String> stationIds) {
|
||||||
@@ -412,17 +416,11 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
List<SupStationPowerInfo> list = new ArrayList<>();
|
List<SupStationPowerInfo> list = new ArrayList<>();
|
||||||
String dateTimeNow = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS);
|
String dateTimeNow = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS);
|
||||||
|
|
||||||
List<SupStationPowerInfo
|
List<SupStationPowerInfo.EquipmentPowerInfo> supPileInfoList = null;
|
||||||
.EquipmentPowerInfo> supPileInfoList = null;
|
SupStationPowerInfo.EquipmentPowerInfo supPileInfo = null;
|
||||||
SupStationPowerInfo
|
|
||||||
.EquipmentPowerInfo supPileInfo = null;
|
|
||||||
|
|
||||||
List<SupStationPowerInfo
|
List<SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo> connectorPowerInfoList;
|
||||||
.EquipmentPowerInfo
|
SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo connectorPowerInfo;
|
||||||
.ConnectorPowerInfo> connectorPowerInfoList = null;
|
|
||||||
SupStationPowerInfo
|
|
||||||
.EquipmentPowerInfo
|
|
||||||
.ConnectorPowerInfo connectorPowerInfo = null;
|
|
||||||
for (String stationId : stationIds) {
|
for (String stationId : stationIds) {
|
||||||
BigDecimal stationPower = BigDecimal.ZERO;
|
BigDecimal stationPower = BigDecimal.ZERO;
|
||||||
supStationPowerInfo = new SupStationPowerInfo();
|
supStationPowerInfo = new SupStationPowerInfo();
|
||||||
@@ -437,7 +435,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
||||||
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
||||||
supStationPowerInfo.setEquipmentOwnerID(equipmentOwnerId);
|
supStationPowerInfo.setEquipmentOwnerID(equipmentOwnerId);
|
||||||
}else {
|
} else {
|
||||||
supStationPowerInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU);
|
supStationPowerInfo.setEquipmentOwnerID(Constants.OPERATORID_JIANG_SU);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,9 +469,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BigDecimal instantPower = pileConnectorInfoVO.getInstantPower() == null ? BigDecimal.ZERO : pileConnectorInfoVO.getInstantPower();
|
BigDecimal instantPower = pileConnectorInfoVO.getInstantPower() == null ? BigDecimal.ZERO : pileConnectorInfoVO.getInstantPower();
|
||||||
connectorPowerInfo = new SupStationPowerInfo
|
connectorPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo();
|
||||||
.EquipmentPowerInfo
|
|
||||||
.ConnectorPowerInfo();
|
|
||||||
connectorPowerInfo.setConnectorID(pileConnectorInfoVO.getPileConnectorCode());
|
connectorPowerInfo.setConnectorID(pileConnectorInfoVO.getPileConnectorCode());
|
||||||
connectorPowerInfo.setEquipmentClassification(Constants.one);
|
connectorPowerInfo.setEquipmentClassification(Constants.one);
|
||||||
connectorPowerInfo.setDataTime(dateTimeNow);
|
connectorPowerInfo.setDataTime(dateTimeNow);
|
||||||
@@ -525,6 +521,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询业务策略信息结果 query_equip_business_policy
|
* 查询业务策略信息结果 query_equip_business_policy
|
||||||
|
*
|
||||||
* @param dto 请求启动充电DTO
|
* @param dto 请求启动充电DTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -585,6 +582,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送充电订单信息 notification_charge_order_info
|
* 推送充电订单信息 notification_charge_order_info
|
||||||
|
*
|
||||||
* @param orderCode 订单编号
|
* @param orderCode 订单编号
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -632,7 +630,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
if (StringUtils.equals("4", payMode)) {
|
if (StringUtils.equals("4", payMode)) {
|
||||||
// 微信支付
|
// 微信支付
|
||||||
chargeOrderInfo.setPayWay(2);
|
chargeOrderInfo.setPayWay(2);
|
||||||
}else {
|
} else {
|
||||||
chargeOrderInfo.setPayWay(6);
|
chargeOrderInfo.setPayWay(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,7 +660,6 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取青海平台配置密钥信息
|
// 获取青海平台配置密钥信息
|
||||||
private ThirdPartyStationRelationVO getQingHaiSettingInfo() {
|
private ThirdPartyStationRelationVO getQingHaiSettingInfo() {
|
||||||
// 通过第三方平台类型查询相关配置信息
|
// 通过第三方平台类型查询相关配置信息
|
||||||
@@ -675,6 +672,7 @@ public class QingHaiPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 将需要发送至对接平台的的返回参数加密返回
|
* 将需要发送至对接平台的的返回参数加密返回
|
||||||
|
*
|
||||||
* @param jsonObject
|
* @param jsonObject
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
|||||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||||
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||||
|
import com.jsowell.pile.vo.web.PileStationVO;
|
||||||
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
||||||
import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO;
|
import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO;
|
||||||
import com.jsowell.thirdparty.platform.common.StationInfo;
|
import com.jsowell.thirdparty.platform.common.StationInfo;
|
||||||
@@ -630,4 +631,89 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
* 推送充电站实时功率信息
|
* 推送充电站实时功率信息
|
||||||
* supervise_notification_realtime_power_info
|
* supervise_notification_realtime_power_info
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
|
public String notificationPowerInfo(List<String> stationIds) {
|
||||||
|
List<SupStationPowerInfo> supStationPowerInfoList = new ArrayList<>();
|
||||||
|
stationIds.forEach(stationId -> {
|
||||||
|
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
|
||||||
|
String dateTimeNow = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS);
|
||||||
|
SupStationPowerInfo supStationPowerInfo = new SupStationPowerInfo();
|
||||||
|
// 根据站点id查询桩列表
|
||||||
|
List<PileBasicInfo> pileList = pileBasicInfoService.getPileListByStationId(stationId);
|
||||||
|
SupStationPowerInfo.EquipmentPowerInfo equipmentPowerInfo = null;
|
||||||
|
List<SupStationPowerInfo.EquipmentPowerInfo> equipmentPowerInfoList = new ArrayList<>();
|
||||||
|
BigDecimal stationInstantPower = BigDecimal.ZERO;
|
||||||
|
supStationPowerInfo.setOperatorId(Constants.OPERATORID_LIANLIAN);
|
||||||
|
supStationPowerInfo.setEquipmentOwnerID(stationInfo.getMerchantId());
|
||||||
|
supStationPowerInfo.setStationId(stationId);
|
||||||
|
supStationPowerInfo.setStationClassification(1);
|
||||||
|
supStationPowerInfo.setDataTime(dateTimeNow);
|
||||||
|
|
||||||
|
for (PileBasicInfo pileBasicInfo : pileList) {
|
||||||
|
equipmentPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo();
|
||||||
|
equipmentPowerInfo.setEquipmentID(pileBasicInfo.getSn());
|
||||||
|
equipmentPowerInfo.setEquipmentClassification(1);
|
||||||
|
equipmentPowerInfo.setDataTime(dateTimeNow);
|
||||||
|
|
||||||
|
// 根据桩sn查询枪口列表
|
||||||
|
List<PileConnectorInfo> pileConnectorInfos = pileConnectorInfoService.selectPileConnectorInfoList(pileBasicInfo.getSn());
|
||||||
|
// 如果枪口状态为充电中,则查询枪口功率等信息
|
||||||
|
SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo connectorPowerInfo = null;
|
||||||
|
List<SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo> connectorPowerInfoList = new ArrayList<>();
|
||||||
|
// 初始化桩功率
|
||||||
|
BigDecimal pileInstantPower = BigDecimal.ZERO;
|
||||||
|
for (PileConnectorInfo pileConnectorInfo : pileConnectorInfos) {
|
||||||
|
if (StringUtils.equals(PileConnectorDataBaseStatusEnum.OCCUPIED_CHARGING.getValue(), pileConnectorInfo.getStatus())) {
|
||||||
|
// 查询充电枪口状态
|
||||||
|
PileConnectorInfoVO connectorInfo = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(pileConnectorInfo.getPileConnectorCode());
|
||||||
|
if (Objects.isNull(connectorInfo)) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_CONNECTOR_INFO_NULL_ERROR);
|
||||||
|
}
|
||||||
|
BigDecimal instantPower = connectorInfo.getInstantPower();
|
||||||
|
pileInstantPower = pileInstantPower.add(instantPower);
|
||||||
|
|
||||||
|
connectorPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo();
|
||||||
|
connectorPowerInfo.setConnectorID(connectorInfo.getPileConnectorCode());
|
||||||
|
connectorPowerInfo.setEquipmentClassification(1);
|
||||||
|
connectorPowerInfo.setDataTime(dateTimeNow);
|
||||||
|
connectorPowerInfo.setConnectorRealTimePower(instantPower);
|
||||||
|
|
||||||
|
connectorPowerInfoList.add(connectorPowerInfo);
|
||||||
|
}
|
||||||
|
// 计算桩的功率(枪口功率之和)
|
||||||
|
equipmentPowerInfo.setEquipRealTimePower(pileInstantPower);
|
||||||
|
// 汇总站点功率
|
||||||
|
stationInstantPower = stationInstantPower.add(pileInstantPower);
|
||||||
|
|
||||||
|
equipmentPowerInfo.setConnectorPowerInfos(connectorPowerInfoList);
|
||||||
|
equipmentPowerInfoList.add(equipmentPowerInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
supStationPowerInfo.setStationRealTimePower(stationInstantPower);
|
||||||
|
supStationPowerInfo.setEquipmentPowerInfos(equipmentPowerInfoList);
|
||||||
|
supStationPowerInfoList.add(supStationPowerInfo);
|
||||||
|
});
|
||||||
|
// 发送请求
|
||||||
|
ThirdPartySecretInfoVO ningXiaSecretInfo = getZheJiangPlatformSecretInfo();
|
||||||
|
|
||||||
|
String operatorId = ningXiaSecretInfo.getOurOperatorId();
|
||||||
|
String operatorSecret = ningXiaSecretInfo.getTheirOperatorSecret();
|
||||||
|
String signSecret = ningXiaSecretInfo.getTheirSigSecret();
|
||||||
|
String dataSecret = ningXiaSecretInfo.getTheirDataSecret();
|
||||||
|
String dataSecretIv = ningXiaSecretInfo.getTheirDataSecretIv();
|
||||||
|
String urlAddress = ningXiaSecretInfo.getTheirUrlPrefix();
|
||||||
|
String url = urlAddress + "supervise_notification_realtime_power_info";
|
||||||
|
// 获取令牌
|
||||||
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
|
if (StringUtils.isBlank(token)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 调用平台接口
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("SupStationPowerInfos", supStationPowerInfoList);
|
||||||
|
String jsonString = JSON.toJSONString(json);
|
||||||
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user