mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 联联平台Service
This commit is contained in:
@@ -874,21 +874,21 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
* @throws UnsupportedOperationException 未实现异常
|
* @throws UnsupportedOperationException 未实现异常
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String notificationChargeOrderInfo(String orderCode) {
|
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) {
|
||||||
|
|
||||||
// 根据订单号查询出信息
|
// 根据订单号查询出信息
|
||||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||||
|
|
||||||
// 通过站点id查询相关配置信息
|
// 通过站点id查询相关配置信息
|
||||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
// ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo();
|
||||||
|
|
||||||
String operatorId = thirdPartySecretInfoVO.getOurOperatorId();
|
String operatorId = Constants.OPERATORID_LIANLIAN;
|
||||||
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
String operatorSecret = secretInfoVO.getTheirOperatorSecret();
|
||||||
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
String signSecret = secretInfoVO.getTheirSigSecret();
|
||||||
String dataSecret = thirdPartySecretInfoVO.getTheirDataSecret();
|
String dataSecret = secretInfoVO.getTheirDataSecret();
|
||||||
String dataSecretIv = thirdPartySecretInfoVO.getTheirDataSecretIv();
|
String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
|
||||||
String urlAddress = thirdPartySecretInfoVO.getTheirUrlPrefix();
|
String urlAddress = secretInfoVO.getTheirUrlPrefix();
|
||||||
|
|
||||||
String url = urlAddress + "notification_orderInfo";
|
String url = urlAddress + "notification_orderInfo";
|
||||||
|
|
||||||
@@ -999,120 +999,120 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) {
|
// public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) {
|
||||||
|
//
|
||||||
// 根据订单号查询出信息
|
// // 根据订单号查询出信息
|
||||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
// OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
// OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||||
|
//
|
||||||
// 通过站点id查询相关配置信息
|
// // 通过站点id查询相关配置信息
|
||||||
// ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId());
|
// // ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId());
|
||||||
// if (relationInfo == null) {
|
// // if (relationInfo == null) {
|
||||||
|
// // return null;
|
||||||
|
// // }
|
||||||
|
// String operatorId = Constants.OPERATORID_LIANLIAN;
|
||||||
|
// String operatorSecret = secretInfoVO.getTheirOperatorSecret();
|
||||||
|
// String signSecret = secretInfoVO.getTheirSigSecret();
|
||||||
|
// String dataSecret = secretInfoVO.getTheirDataSecret();
|
||||||
|
// String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
|
||||||
|
// String urlAddress = secretInfoVO.getTheirUrlPrefix();
|
||||||
|
//
|
||||||
|
// String url = urlAddress + "notification_charge_order_info";
|
||||||
|
//
|
||||||
|
// // 拼装成联联平台所需格式对象
|
||||||
|
// OrderInfo orderInfo = OrderInfo.builder()
|
||||||
|
// .startChargeSeq(orderCode)
|
||||||
|
// .connectorID(orderBasicInfo.getPileConnectorCode())
|
||||||
|
// .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(new BigDecimal(String.valueOf(orderDetail.getTotalUsedElectricity())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
||||||
|
// .totalElecMoney(new BigDecimal(String.valueOf(orderDetail.getTotalElectricityAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
||||||
|
// .totalSeviceMoney(new BigDecimal(String.valueOf(orderDetail.getTotalServiceAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
||||||
|
// .totalMoney(new BigDecimal(String.valueOf(orderBasicInfo.getOrderAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
||||||
|
// .stopReason(0)
|
||||||
|
// .build();
|
||||||
|
// // if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) {
|
||||||
|
// // orderInfo.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO);
|
||||||
|
// // }
|
||||||
|
// // if (StringUtils.equals("36", String.valueOf(orderBasicInfo.getMerchantId()))) {
|
||||||
|
// // // 远大
|
||||||
|
// // orderInfo.setEquipmentOwnerID(Constants.OPERATORID_YUAN_DA);
|
||||||
|
// // }
|
||||||
|
// // // 支付方式
|
||||||
|
// // if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
|
||||||
|
// // // 微信支付
|
||||||
|
// // orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.WEXIN_PAY.getCode()));
|
||||||
|
// // } else if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_ALIPAY.getValue())) {
|
||||||
|
// // // 支付宝支付
|
||||||
|
// // orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.ALI_PAY.getCode()));
|
||||||
|
// // } else {
|
||||||
|
// // // 其他
|
||||||
|
// // orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.OTHER.getCode()));
|
||||||
|
// // }
|
||||||
|
// // 订单详情
|
||||||
|
// // ChargeDetail detail;
|
||||||
|
// //
|
||||||
|
// // List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
|
||||||
|
// // // 先将list按照 尖、峰、平、谷 时段排序
|
||||||
|
// // // List<BillingPriceVO> collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList());
|
||||||
|
// // // 再循环该list,拼装对应的充电价格、费率
|
||||||
|
// // List<ChargeDetail> chargeDetails = new ArrayList<>();
|
||||||
|
// // for (BillingPriceVO billingPriceVO : billingList) {
|
||||||
|
// // detail = new ChargeDetail();
|
||||||
|
// // if (StringUtils.equals(billingPriceVO.getTimeType(), "1")) {
|
||||||
|
// // // 尖时段
|
||||||
|
// // detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||||
|
// // detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||||
|
// // 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());
|
||||||
|
// // detail.setDetailElecMoney(orderDetail.getSharpElectricityPrice());
|
||||||
|
// // detail.setDetailSeviceMoney(orderDetail.getSharpServicePrice());
|
||||||
|
// // } else if (StringUtils.equals(billingPriceVO.getTimeType(), "2")) {
|
||||||
|
// // // 峰时段
|
||||||
|
// // detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||||
|
// // detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||||
|
// // 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());
|
||||||
|
// // detail.setDetailElecMoney(orderDetail.getPeakElectricityPrice());
|
||||||
|
// // detail.setDetailSeviceMoney(orderDetail.getPeakServicePrice());
|
||||||
|
// // } else if (StringUtils.equals(billingPriceVO.getTimeType(), "3")) {
|
||||||
|
// // // 平时段
|
||||||
|
// // detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||||
|
// // detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||||
|
// // 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());
|
||||||
|
// // detail.setDetailElecMoney(orderDetail.getFlatElectricityPrice());
|
||||||
|
// // detail.setDetailSeviceMoney(orderDetail.getFlatServicePrice());
|
||||||
|
// // } else if (StringUtils.equals(billingPriceVO.getTimeType(), "4")) {
|
||||||
|
// // // 谷时段
|
||||||
|
// // detail.setDetailStartTime(billingPriceVO.getStartTime());
|
||||||
|
// // detail.setDetailEndTime(billingPriceVO.getEndTime());
|
||||||
|
// // 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());
|
||||||
|
// // detail.setDetailElecMoney(orderDetail.getValleyElectricityPrice());
|
||||||
|
// // detail.setDetailSeviceMoney(orderDetail.getValleyServicePrice());
|
||||||
|
// // }
|
||||||
|
// // chargeDetails.add(detail);
|
||||||
|
// // }
|
||||||
|
// // orderInfo.setChargeDetails(chargeDetails);
|
||||||
|
//
|
||||||
|
// // 获取令牌
|
||||||
|
// String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||||
|
// if (StringUtils.isBlank(token)) {
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
String operatorId = Constants.OPERATORID_LIANLIAN;
|
// // 调用联联平台接口
|
||||||
String operatorSecret = secretInfoVO.getTheirOperatorSecret();
|
// // JSONObject json = new JSONObject();
|
||||||
String signSecret = secretInfoVO.getTheirSigSecret();
|
// // json.put("OrderInfo", orderInfo);
|
||||||
String dataSecret = secretInfoVO.getTheirDataSecret();
|
// String jsonString = JSON.toJSONString(orderInfo);
|
||||||
String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
|
// String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||||
String urlAddress = secretInfoVO.getTheirUrlPrefix();
|
// return result;
|
||||||
|
|
||||||
String url = urlAddress + "notification_charge_order_info";
|
|
||||||
|
|
||||||
// 拼装成联联平台所需格式对象
|
|
||||||
OrderInfo orderInfo = OrderInfo.builder()
|
|
||||||
.startChargeSeq(orderCode)
|
|
||||||
.connectorID(orderBasicInfo.getPileConnectorCode())
|
|
||||||
.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(new BigDecimal(String.valueOf(orderDetail.getTotalUsedElectricity())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
||||||
.totalElecMoney(new BigDecimal(String.valueOf(orderDetail.getTotalElectricityAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
||||||
.totalSeviceMoney(new BigDecimal(String.valueOf(orderDetail.getTotalServiceAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
||||||
.totalMoney(new BigDecimal(String.valueOf(orderBasicInfo.getOrderAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
||||||
.stopReason(0)
|
|
||||||
.build();
|
|
||||||
// if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) {
|
|
||||||
// orderInfo.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO);
|
|
||||||
// }
|
// }
|
||||||
// if (StringUtils.equals("36", String.valueOf(orderBasicInfo.getMerchantId()))) {
|
|
||||||
// // 远大
|
|
||||||
// orderInfo.setEquipmentOwnerID(Constants.OPERATORID_YUAN_DA);
|
|
||||||
// }
|
|
||||||
// // 支付方式
|
|
||||||
// if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
|
|
||||||
// // 微信支付
|
|
||||||
// orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.WEXIN_PAY.getCode()));
|
|
||||||
// } else if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_ALIPAY.getValue())) {
|
|
||||||
// // 支付宝支付
|
|
||||||
// orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.ALI_PAY.getCode()));
|
|
||||||
// } else {
|
|
||||||
// // 其他
|
|
||||||
// orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.OTHER.getCode()));
|
|
||||||
// }
|
|
||||||
// 订单详情
|
|
||||||
// ChargeDetail detail;
|
|
||||||
//
|
|
||||||
// List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
|
|
||||||
// // 先将list按照 尖、峰、平、谷 时段排序
|
|
||||||
// // List<BillingPriceVO> collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList());
|
|
||||||
// // 再循环该list,拼装对应的充电价格、费率
|
|
||||||
// List<ChargeDetail> chargeDetails = new ArrayList<>();
|
|
||||||
// for (BillingPriceVO billingPriceVO : billingList) {
|
|
||||||
// detail = new ChargeDetail();
|
|
||||||
// if (StringUtils.equals(billingPriceVO.getTimeType(), "1")) {
|
|
||||||
// // 尖时段
|
|
||||||
// detail.setDetailStartTime(billingPriceVO.getStartTime());
|
|
||||||
// detail.setDetailEndTime(billingPriceVO.getEndTime());
|
|
||||||
// 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());
|
|
||||||
// detail.setDetailElecMoney(orderDetail.getSharpElectricityPrice());
|
|
||||||
// detail.setDetailSeviceMoney(orderDetail.getSharpServicePrice());
|
|
||||||
// } else if (StringUtils.equals(billingPriceVO.getTimeType(), "2")) {
|
|
||||||
// // 峰时段
|
|
||||||
// detail.setDetailStartTime(billingPriceVO.getStartTime());
|
|
||||||
// detail.setDetailEndTime(billingPriceVO.getEndTime());
|
|
||||||
// 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());
|
|
||||||
// detail.setDetailElecMoney(orderDetail.getPeakElectricityPrice());
|
|
||||||
// detail.setDetailSeviceMoney(orderDetail.getPeakServicePrice());
|
|
||||||
// } else if (StringUtils.equals(billingPriceVO.getTimeType(), "3")) {
|
|
||||||
// // 平时段
|
|
||||||
// detail.setDetailStartTime(billingPriceVO.getStartTime());
|
|
||||||
// detail.setDetailEndTime(billingPriceVO.getEndTime());
|
|
||||||
// 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());
|
|
||||||
// detail.setDetailElecMoney(orderDetail.getFlatElectricityPrice());
|
|
||||||
// detail.setDetailSeviceMoney(orderDetail.getFlatServicePrice());
|
|
||||||
// } else if (StringUtils.equals(billingPriceVO.getTimeType(), "4")) {
|
|
||||||
// // 谷时段
|
|
||||||
// detail.setDetailStartTime(billingPriceVO.getStartTime());
|
|
||||||
// detail.setDetailEndTime(billingPriceVO.getEndTime());
|
|
||||||
// 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());
|
|
||||||
// detail.setDetailElecMoney(orderDetail.getValleyElectricityPrice());
|
|
||||||
// detail.setDetailSeviceMoney(orderDetail.getValleyServicePrice());
|
|
||||||
// }
|
|
||||||
// chargeDetails.add(detail);
|
|
||||||
// }
|
|
||||||
// orderInfo.setChargeDetails(chargeDetails);
|
|
||||||
|
|
||||||
// 获取令牌
|
|
||||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
|
||||||
if (StringUtils.isBlank(token)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// 调用联联平台接口
|
|
||||||
// JSONObject json = new JSONObject();
|
|
||||||
// json.put("OrderInfo", orderInfo);
|
|
||||||
String jsonString = JSON.toJSONString(orderInfo);
|
|
||||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站点费率变化推送 notification_stationFee
|
* 站点费率变化推送 notification_stationFee
|
||||||
|
|||||||
Reference in New Issue
Block a user