mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-02 21:18:05 +08:00
update
This commit is contained in:
@@ -30,9 +30,7 @@ import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
|||||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
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.uniapp.customer.BillingPriceVO;
|
||||||
import com.jsowell.pile.vo.uniapp.customer.OrderVO;
|
|
||||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||||
import com.jsowell.pile.vo.web.PileMerchantInfoVO;
|
import com.jsowell.pile.vo.web.PileMerchantInfoVO;
|
||||||
import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo;
|
import com.jsowell.thirdparty.lianlian.domain.ConnectorChargeStatusInfo;
|
||||||
@@ -597,87 +595,64 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
* supervise_notification_charge_order_info
|
* supervise_notification_charge_order_info
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String notificationChargeOrderInfo(String orderCode) {
|
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) {
|
||||||
// 通过订单号查询订单信息
|
// 根据订单号查询出信息
|
||||||
OrderVO orderVO = orderBasicInfoService.getChargeOrderInfoByOrderCode(orderCode);
|
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
BigDecimal startSoc = orderVO.getStartSoc() == null ? BigDecimal.ZERO : new BigDecimal(orderVO.getStartSoc());
|
if (orderBasicInfo == null) {
|
||||||
BigDecimal endSoc = orderVO.getEndSoc() == null ? BigDecimal.ZERO : new BigDecimal(orderVO.getEndSoc());
|
|
||||||
|
|
||||||
com.jsowell.thirdparty.platform.common.ChargeOrderInfo chargeOrderInfo = com.jsowell.thirdparty.platform.common.ChargeOrderInfo.builder()
|
|
||||||
.operatorId(Constants.OPERATORID_JIANG_SU)
|
|
||||||
// .equipmentId()
|
|
||||||
.stationId(orderVO.getStationId())
|
|
||||||
.equipmentId(orderVO.getPileSn())
|
|
||||||
.equipmentClassification(Constants.one)
|
|
||||||
.connectorId(orderVO.getPileConnectorCode())
|
|
||||||
.startChargeSeq(orderVO.getOrderCode())
|
|
||||||
.startSoc(startSoc)
|
|
||||||
.endSoc(endSoc)
|
|
||||||
.totalMoney(orderVO.getOrderAmount())
|
|
||||||
.totalElecMoney(orderVO.getTotalElectricityAmount())
|
|
||||||
.totalSeviceMoney(orderVO.getTotalServiceAmount())
|
|
||||||
.totalPower(new BigDecimal(orderVO.getTotalPower()))
|
|
||||||
.startTime(orderVO.getStartTime())
|
|
||||||
.endTime(orderVO.getEndTime())
|
|
||||||
.paymentAmount(orderVO.getPayAmount())
|
|
||||||
.payTime(orderVO.getPayTime())
|
|
||||||
// .payWay(orderVO.getPayMode())
|
|
||||||
.stopReason(Constants.two) // 2-BMS 停止充电
|
|
||||||
.startMeterNum(BigDecimal.ZERO) // 电表起止值(暂时给0)
|
|
||||||
.endMeterNum(BigDecimal.ZERO)
|
|
||||||
|
|
||||||
.build();
|
|
||||||
// 设备产权所属单位ID
|
|
||||||
String organizationCode = orderVO.getOrganizationCode();
|
|
||||||
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
|
||||||
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
|
||||||
chargeOrderInfo.setEquipmentOwnerId(equipmentOwnerId);
|
|
||||||
} else {
|
|
||||||
chargeOrderInfo.setEquipmentOwnerId(Constants.OPERATORID_JIANG_SU);
|
|
||||||
}
|
|
||||||
// 支付方式
|
|
||||||
String payMode = orderVO.getPayMode();
|
|
||||||
if (StringUtils.equals("4", payMode)) {
|
|
||||||
// 微信支付
|
|
||||||
chargeOrderInfo.setPayWay(2);
|
|
||||||
} else {
|
|
||||||
chargeOrderInfo.setPayWay(6);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取推送配置密钥信息
|
|
||||||
ThirdPartyStationRelationVO settingInfo = getGuiZhouSettingInfo();
|
|
||||||
if (settingInfo == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String operatorId = settingInfo.getOperatorId();
|
|
||||||
String operatorSecret = settingInfo.getOperatorSecret();
|
|
||||||
String signSecret = settingInfo.getSignSecret();
|
|
||||||
String dataSecret = settingInfo.getDataSecret();
|
|
||||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
|
||||||
String urlAddress = settingInfo.getUrlAddress();
|
|
||||||
|
|
||||||
String url = urlAddress + "notification_charge_order_info";
|
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();
|
||||||
|
|
||||||
|
// 根据订单号查询订单详情
|
||||||
|
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||||
|
if (orderDetail == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 推送地址
|
||||||
|
String url = urlAddress + "supervise_notification_charge_order_info";
|
||||||
|
|
||||||
|
// 拼装成平台所需格式对象
|
||||||
|
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);
|
||||||
|
|
||||||
|
List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
|
||||||
|
// 先将list按照 尖、峰、平、谷 时段排序
|
||||||
|
// List<BillingPriceVO> collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList());
|
||||||
|
// 再循环该list,拼装对应的充电价格、费率
|
||||||
|
List<SupChargeDetails> chargeDetails = transformSupChargeDetails(orderDetail, billingList);
|
||||||
|
orderInfo.setChargeDetails(chargeDetails);
|
||||||
|
|
||||||
// 获取令牌
|
// 获取令牌
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
if (StringUtils.isBlank(token)) {
|
if (StringUtils.isBlank(token)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 封装参数
|
// 调用联联平台接口
|
||||||
String jsonString = JSON.toJSONString(chargeOrderInfo);
|
String jsonString = JSON.toJSONString(orderInfo);
|
||||||
// 发送请求
|
|
||||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取青海平台配置密钥信息
|
|
||||||
private ThirdPartyStationRelationVO getGuiZhouSettingInfo() {
|
|
||||||
// 通过第三方平台类型查询相关配置信息
|
|
||||||
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
|
||||||
relation.setThirdPartyType(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode());
|
|
||||||
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
|
||||||
return relationInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
|
* 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user