puzhibing
2024-09-27 8c03ae07df6e094ab3420017d76bcd9ad0a8dac0
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -511,7 +511,7 @@
         req.setBody("充电充值");
         AliPaymentResp data = aliPaymentClient.payment(req).getData();
         if(null != data){
            data.setNotifyUrl(data.getNotifyUrl() + "/t-charging-order/chargingOrderALICallback");
            data.setNotifyUrl(data.getNotifyUrl() + "/order/t-charging-order/chargingOrderALICallback");
            return AjaxResult.success(data);
         }
      }
@@ -560,8 +560,7 @@
      //先根据额定功率计算出每秒充电度数,然后计算出支付金额能充多少度电
      TChargingGun tChargingGun = chargingGunClient.getChargingGunById(chargingOrder.getChargingGunId()).getData();
      BigDecimal s_degrees = tChargingGun.getRatedPower().divide(new BigDecimal(3600));
      TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData();
      List<AccountingStrategyDetailOrder> list = accountingStrategyDetailOrderClient.getAllAccountingStrategyDetailOrder(chargingOrder.getId()).getData();
      for (AccountingStrategyDetailOrder accountingStrategyDetailOrder : list) {
@@ -620,7 +619,8 @@
      chargingOrder.setChargeAmount(electrovalence);
      chargingOrder.setVipDiscountAmount(discountAmount);
      this.updateById(chargingOrder);
      TChargingPile chargingPile = chargingPileClient.getChargingPileById(tChargingGun.getChargingPileId()).getData();
      //调用远程启动充电消息
      PlatformStartCharging platformStartCharging = new PlatformStartCharging();
@@ -630,6 +630,10 @@
      //使用订单id作为逻辑卡号
      platformStartCharging.setCard_number(chargingOrder.getId().toString());
      platformStartCharging.setAccount_balance(electrovalence);
      System.err.println("-------------------远程调起开始充电请求-------------------");
      System.err.println(platformStartCharging.toString());
      sendMessageClient.platformStartCharging(platformStartCharging);
      //异步线程检测远程启动的应答结果。如果失败,则需要全额退款
      String code = chargingOrder.getCode();
@@ -637,6 +641,8 @@
      ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
      scheduler.scheduleAtFixedRate(()->{
         List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData();
         System.err.println("-------------------开始检查调起充电结果-------------------");
         System.err.println(data.toString());
         if(data.size() != 0){
            PlatformStartChargingReply platformStartChargingReply = data.get(1);
            Integer startup_result = platformStartChargingReply.getStartup_result();
@@ -1115,7 +1121,7 @@
            model.setOut_trade_no(chargingOrder.getCode());
            model.setOut_refund_no(chargingOrderRefund.getRefundCode());
            model.setReason("充电完成退款");
            model.setNotify_url("http://221.182.45.100:9000/order/t-charging-order/chargingOrderStartupFailureWxRefund");
            model.setNotify_url("/order/t-charging-order/chargingOrderStartupFailureWxRefund");
            WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount();
            amount.setRefund(refundAmount.multiply(new BigDecimal(100)).intValue());
            amount.setTotal(rechargeAmount.multiply(new BigDecimal(100)).intValue());
@@ -1900,7 +1906,7 @@
               model.setOut_refund_no(chargingOrderRefund.getRefundCode());
               model.setTransaction_id(tChargingOrder.getRechargeSerialNumber());
               model.setReason("取消订单");
               model.setNotify_url("http://221.182.45.100:9000/order/t-shopping-order/cancelShoppingOrderWxRefund");
               model.setNotify_url("/order/t-shopping-order/cancelShoppingOrderWxRefund");
               WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount();
               amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue());
               amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue());
@@ -1955,7 +1961,7 @@
               model.setOut_refund_no(chargingOrderRefund.getRefundCode());
               model.setTransaction_id(tChargingOrder.getSerialNumber());
               model.setReason("取消订单");
               model.setNotify_url("http://221.182.45.100:9000/order/t-shopping-order/cancelShoppingOrderWxRefund");
               model.setNotify_url("/order/t-shopping-order/cancelShoppingOrderWxRefund");
               WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount();
               amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue());
               amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue());