diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/LianLianPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/LianLianPlatformServiceImpl.java index c0cb1d32d..dad8c4f56 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/LianLianPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/LianLianPlatformServiceImpl.java @@ -874,21 +874,21 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { * @throws UnsupportedOperationException 未实现异常 */ @Override - public String notificationChargeOrderInfo(String orderCode) { + public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) { // 根据订单号查询出信息 OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); // 通过站点id查询相关配置信息 - ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo(); + // ThirdPartySecretInfoVO thirdPartySecretInfoVO = getLianLianPlatformSecretInfo(); - 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 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_orderInfo"; @@ -999,120 +999,120 @@ public class LianLianPlatformServiceImpl implements ThirdPartyPlatformService { return result; } - @Override - public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) { - - // 根据订单号查询出信息 - OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); - OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); - - // 通过站点id查询相关配置信息 - // ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId()); - // 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 billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); - // // 先将list按照 尖、峰、平、谷 时段排序 - // // List collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList()); - // // 再循环该list,拼装对应的充电价格、费率 - // List 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; - } + // @Override + // public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) { + // + // // 根据订单号查询出信息 + // OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); + // OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); + // + // // 通过站点id查询相关配置信息 + // // ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(orderBasicInfo.getStationId()); + // // 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 billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); + // // // 先将list按照 尖、峰、平、谷 时段排序 + // // // List collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList()); + // // // 再循环该list,拼装对应的充电价格、费率 + // // List 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