update 联联平台Service

This commit is contained in:
Lemon
2025-04-03 11:20:37 +08:00
parent 7e6556b6d6
commit bdb1a4e7c0

View File

@@ -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; // // return null;
// } // // }
String operatorId = Constants.OPERATORID_LIANLIAN; // String operatorId = Constants.OPERATORID_LIANLIAN;
String operatorSecret = secretInfoVO.getTheirOperatorSecret(); // String operatorSecret = secretInfoVO.getTheirOperatorSecret();
String signSecret = secretInfoVO.getTheirSigSecret(); // String signSecret = secretInfoVO.getTheirSigSecret();
String dataSecret = secretInfoVO.getTheirDataSecret(); // String dataSecret = secretInfoVO.getTheirDataSecret();
String dataSecretIv = secretInfoVO.getTheirDataSecretIv(); // String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
String urlAddress = secretInfoVO.getTheirUrlPrefix(); // String urlAddress = secretInfoVO.getTheirUrlPrefix();
//
String url = urlAddress + "notification_charge_order_info"; // String url = urlAddress + "notification_charge_order_info";
//
// 拼装成联联平台所需格式对象 // // 拼装成联联平台所需格式对象
OrderInfo orderInfo = OrderInfo.builder() // OrderInfo orderInfo = OrderInfo.builder()
.startChargeSeq(orderCode) // .startChargeSeq(orderCode)
.connectorID(orderBasicInfo.getPileConnectorCode()) // .connectorID(orderBasicInfo.getPileConnectorCode())
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime())) // .startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime()))
.endTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime())) // .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)) // .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)) // .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)) // .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)) // .totalMoney(new BigDecimal(String.valueOf(orderBasicInfo.getOrderAmount())).setScale(2, BigDecimal.ROUND_HALF_UP))
.stopReason(0) // .stopReason(0)
.build(); // .build();
// if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { // // if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) {
// orderInfo.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO); // // orderInfo.setEquipmentOwnerID(Constants.OPERATORID_XI_XIAO);
// } // // }
// if (StringUtils.equals("36", String.valueOf(orderBasicInfo.getMerchantId()))) { // // if (StringUtils.equals("36", String.valueOf(orderBasicInfo.getMerchantId()))) {
// // 远大 // // // 远大
// orderInfo.setEquipmentOwnerID(Constants.OPERATORID_YUAN_DA); // // orderInfo.setEquipmentOwnerID(Constants.OPERATORID_YUAN_DA);
// } // // }
// // 支付方式 // // // 支付方式
// if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) { // // if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())) {
// // 微信支付 // // // 微信支付
// orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.WEXIN_PAY.getCode())); // // orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.WEXIN_PAY.getCode()));
// } else if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_ALIPAY.getValue())) { // // } else if (StringUtils.equals(orderBasicInfo.getPayMode(), OrderPayModeEnum.PAYMENT_OF_ALIPAY.getValue())) {
// // 支付宝支付 // // // 支付宝支付
// orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.ALI_PAY.getCode())); // // orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.ALI_PAY.getCode()));
// } else { // // } else {
// // 其他 // // // 其他
// orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.OTHER.getCode())); // // orderInfo.setPayChannel(Integer.valueOf(PayChannelEnum.OTHER.getCode()));
// } // // }
// 订单详情 // // 订单详情
// ChargeDetail detail; // // ChargeDetail detail;
// // //
// List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // // List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
// // 先将list按照 尖、峰、平、谷 时段排序 // // // 先将list按照 尖、峰、平、谷 时段排序
// // List<BillingPriceVO> collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList()); // // // List<BillingPriceVO> collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList());
// // 再循环该list拼装对应的充电价格、费率 // // // 再循环该list拼装对应的充电价格、费率
// List<ChargeDetail> chargeDetails = new ArrayList<>(); // // List<ChargeDetail> chargeDetails = new ArrayList<>();
// for (BillingPriceVO billingPriceVO : billingList) { // // for (BillingPriceVO billingPriceVO : billingList) {
// detail = new ChargeDetail(); // // detail = new ChargeDetail();
// if (StringUtils.equals(billingPriceVO.getTimeType(), "1")) { // // if (StringUtils.equals(billingPriceVO.getTimeType(), "1")) {
// // 尖时段 // // // 尖时段
// detail.setDetailStartTime(billingPriceVO.getStartTime()); // // detail.setDetailStartTime(billingPriceVO.getStartTime());
// detail.setDetailEndTime(billingPriceVO.getEndTime()); // // detail.setDetailEndTime(billingPriceVO.getEndTime());
// detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); // // 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.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
// detail.setDetailPower(orderDetail.getSharpUsedElectricity()); // // detail.setDetailPower(orderDetail.getSharpUsedElectricity());
// detail.setDetailElecMoney(orderDetail.getSharpElectricityPrice()); // // detail.setDetailElecMoney(orderDetail.getSharpElectricityPrice());
// detail.setDetailSeviceMoney(orderDetail.getSharpServicePrice()); // // detail.setDetailSeviceMoney(orderDetail.getSharpServicePrice());
// } else if (StringUtils.equals(billingPriceVO.getTimeType(), "2")) { // // } else if (StringUtils.equals(billingPriceVO.getTimeType(), "2")) {
// // 峰时段 // // // 峰时段
// detail.setDetailStartTime(billingPriceVO.getStartTime()); // // detail.setDetailStartTime(billingPriceVO.getStartTime());
// detail.setDetailEndTime(billingPriceVO.getEndTime()); // // detail.setDetailEndTime(billingPriceVO.getEndTime());
// detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); // // 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.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
// detail.setDetailPower(orderDetail.getPeakUsedElectricity()); // // detail.setDetailPower(orderDetail.getPeakUsedElectricity());
// detail.setDetailElecMoney(orderDetail.getPeakElectricityPrice()); // // detail.setDetailElecMoney(orderDetail.getPeakElectricityPrice());
// detail.setDetailSeviceMoney(orderDetail.getPeakServicePrice()); // // detail.setDetailSeviceMoney(orderDetail.getPeakServicePrice());
// } else if (StringUtils.equals(billingPriceVO.getTimeType(), "3")) { // // } else if (StringUtils.equals(billingPriceVO.getTimeType(), "3")) {
// // 平时段 // // // 平时段
// detail.setDetailStartTime(billingPriceVO.getStartTime()); // // detail.setDetailStartTime(billingPriceVO.getStartTime());
// detail.setDetailEndTime(billingPriceVO.getEndTime()); // // detail.setDetailEndTime(billingPriceVO.getEndTime());
// detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); // // 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.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
// detail.setDetailPower(orderDetail.getFlatUsedElectricity()); // // detail.setDetailPower(orderDetail.getFlatUsedElectricity());
// detail.setDetailElecMoney(orderDetail.getFlatElectricityPrice()); // // detail.setDetailElecMoney(orderDetail.getFlatElectricityPrice());
// detail.setDetailSeviceMoney(orderDetail.getFlatServicePrice()); // // detail.setDetailSeviceMoney(orderDetail.getFlatServicePrice());
// } else if (StringUtils.equals(billingPriceVO.getTimeType(), "4")) { // // } else if (StringUtils.equals(billingPriceVO.getTimeType(), "4")) {
// // 谷时段 // // // 谷时段
// detail.setDetailStartTime(billingPriceVO.getStartTime()); // // detail.setDetailStartTime(billingPriceVO.getStartTime());
// detail.setDetailEndTime(billingPriceVO.getEndTime()); // // detail.setDetailEndTime(billingPriceVO.getEndTime());
// detail.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); // // 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.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
// detail.setDetailPower(orderDetail.getValleyUsedElectricity()); // // detail.setDetailPower(orderDetail.getValleyUsedElectricity());
// detail.setDetailElecMoney(orderDetail.getValleyElectricityPrice()); // // detail.setDetailElecMoney(orderDetail.getValleyElectricityPrice());
// detail.setDetailSeviceMoney(orderDetail.getValleyServicePrice()); // // detail.setDetailSeviceMoney(orderDetail.getValleyServicePrice());
// } // // }
// chargeDetails.add(detail); // // chargeDetails.add(detail);
// } // // }
// orderInfo.setChargeDetails(chargeDetails); // // 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;
} // }
// 调用联联平台接口 // // 调用联联平台接口
// JSONObject json = new JSONObject(); // // JSONObject json = new JSONObject();
// json.put("OrderInfo", orderInfo); // // json.put("OrderInfo", orderInfo);
String jsonString = JSON.toJSONString(orderInfo); // 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;
} // }
/** /**
* 站点费率变化推送 notification_stationFee * 站点费率变化推送 notification_stationFee