From 73be7ff2317fea8194b7a6dc0452b64a511c7836 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 06 十一月 2024 18:42:38 +0800 Subject: [PATCH] 合并代码 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 7 +-- /dev/null | 50 ------------------------- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java | 2 ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java | 2 ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/AliPayController.java | 3 - ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/config/AliProperties.java | 2 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 2 7 files changed, 8 insertions(+), 60 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/CallBackController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/CallBackController.java deleted file mode 100644 index e47e282..0000000 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/CallBackController.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.ruoyi.order.controller; - -import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.order.service.TVipOrderService; -import com.ruoyi.payment.api.vo.AliQueryOrder; -import io.swagger.annotations.Api; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.PrintWriter; - - -@RestController -@RequestMapping("/callBack") -public class CallBackController { - - @Resource - private TVipOrderService tVipOrderService; - - @ResponseBody - @PostMapping(value = "/ali/all") - public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { - try { - String out_trade_no = aliQueryOrder.getOutTradeNo(); - String transaction_id = aliQueryOrder.getTradeNo(); - String attach = aliQueryOrder.getPassbackParams(); - String substring = out_trade_no.substring(0, 2); - switch (substring){ - //购物订单 - case "GW": - - break; - case "HY": - tVipOrderService.payBack(out_trade_no); - break; - } - -// AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); -// if (ajaxResult.isSuccess()) { -// PrintWriter writer = response.getWriter(); -// writer.println("success"); -// writer.flush(); -// writer.close(); -// } - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index 1c9338f..97800dc 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -528,7 +528,7 @@ req.setSubject("充电充值"); req.setBuyerOpenId(appUser.getAliOpenid()); req.setBody("充电充值"); - req.setNotifyUrl("/payment/callBack/ali/all"); + req.setNotifyUrl("/payment/ali/callBack"); AliPaymentResp data = aliPaymentClient.payment(req).getData(); if(null != data){ return AjaxResult.success(data); @@ -958,10 +958,7 @@ Integer m = Integer.valueOf(data.getCumulative_charging_time() % 60); chargingDetails.setChargedTime(String.format("%02d", h) + ":" + String.format("%02d", m)); } - //转换成UTC时间 - ChargingHandshake chargingHandshake = chargingHandshakeClient.getDataByOrderCode(one.getCode()).getData(); - if(null != chargingHandshake && null != data && null != one.getAppUserCarId()){ - BigDecimal bms_battery_capacity = chargingHandshake.getBms_battery_capacity(); + if(null != data && null != one.getAppUserCarId()){ TAppUserCar appUserCar = appUserCarClient.getCarByIds(Arrays.asList(one.getAppUserCarId())).getData().get(0); // 续航 = 续航里程 * soc BigDecimal multiply = new BigDecimal(data.getSoc() / 100).multiply(new BigDecimal(appUserCar.getEndurance())); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java index 42be27c..fdb537f 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java @@ -373,7 +373,7 @@ req.setSubject("购买商品"); req.setBuyerOpenId(user.getAliOpenid()); req.setBody("购买商品"); - req.setNotifyUrl("/payment/callBack/ali/all"); + req.setNotifyUrl("/payment/ali/callBack"); AliPaymentResp data = aliPaymentClient.payment(req).getData(); if(null != data){ data.setOrderId(shopOrder.getId().toString()); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java index 2981ba1..6df0a5e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java @@ -132,7 +132,7 @@ req.setSubject("充电充值"); req.setBuyerOpenId(user.getAliOpenid()); req.setBody("充电充值"); - req.setNotifyUrl("/payment/callBack/ali/all"); + req.setNotifyUrl("/payment/ali/callBack"); AliPaymentResp data = aliPaymentClient.payment(req).getData(); if(null != data){ return AjaxResult.success(data); diff --git a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/config/AliProperties.java b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/config/AliProperties.java index 631dea4..dab2da2 100644 --- a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/config/AliProperties.java +++ b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/config/AliProperties.java @@ -3,6 +3,7 @@ import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; /** @@ -11,6 +12,7 @@ */ @Data @Component +@Configuration @ConfigurationProperties(prefix = "payment.ali") public class AliProperties { /** diff --git a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java index 1dd6852..e4dc7b4 100644 --- a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java +++ b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/ali/v2/AppletPayUtil.java @@ -64,7 +64,7 @@ AlipayTradeCreateResponse response = alipayClient.execute(request); log.info("-----调起支付宝支付-----"); - log.info("请求参数:{}", pojo); + log.info("请求参数:{}", JSON.toJSONString(request)); log.info("返回结果:{}", response.getBody()); if (response.isSuccess()) { return PaymentResp.build(response.getOutTradeNo(), response.getTradeNo()); diff --git a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/AliPayController.java b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/AliPayController.java index 8816fac..c3d5bc2 100644 --- a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/AliPayController.java +++ b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/AliPayController.java @@ -46,7 +46,6 @@ if(null != payment){ AliPaymentResp aliPaymentResp = new AliPaymentResp(); aliPaymentResp.setTradeNo(payment.getTradeNo()); - aliPaymentResp.setNotifyUrl(aliProperties.getNotifyUrl()); return R.ok(aliPaymentResp); } return R.ok(); @@ -95,7 +94,7 @@ @Resource private ChargingOrderClient chargingOrderClient; @ResponseBody - @PostMapping(value = "/all") + @PostMapping(value = "/callBack") public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { try { String out_trade_no = aliQueryOrder.getOutTradeNo(); -- Gitblit v1.7.1