From 44f81d63412eac4e3442cf6005ea18b22ee2175b Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 05 十一月 2024 14:57:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java | 4 +-
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java | 4 +-
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java | 28 ++++++++++++++
ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/controller/AliPayController.java | 31 +++++++++++----
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TVipService.java | 3 +
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml | 6 ++
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 12 +++--
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java | 21 +++++++++-
8 files changed, 87 insertions(+), 22 deletions(-)
diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
index dcea1b1..2666ac1 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingGunServiceImpl.java
@@ -306,8 +306,36 @@
StatusModeStatisticsVO statusModeStatistics1 = this.baseMapper.getStatusModeStatistics(siteIds,1);
StatusModeStatisticsVO statusModeStatistics2 = this.baseMapper.getStatusModeStatistics(siteIds,2);
StatusModeStatisticsVO statusModeStatistics3 = this.baseMapper.getStatusModeStatistics(siteIds,3);
+ if (statusModeStatistics1==null){
+ StatusModeStatisticsVO vo = new StatusModeStatisticsVO();
+ vo.setChargeMode(1);
+ vo.setFreeCount(0);
+ vo.setFilledCount(0);
+ vo.setInsertCount(0);
+ vo.setChargingCount(0);
+ statusModeStatistics1 =vo;
+ }
statusModeStatisticsVOS.add(statusModeStatistics1);
+ if (statusModeStatistics2==null){
+ StatusModeStatisticsVO vo = new StatusModeStatisticsVO();
+ vo.setChargeMode(2);
+ vo.setFreeCount(0);
+ vo.setFilledCount(0);
+ vo.setInsertCount(0);
+ vo.setChargingCount(0);
+ statusModeStatistics2 =vo;
+ }
statusModeStatisticsVOS.add(statusModeStatistics2);
+
+ if (statusModeStatistics3==null){
+ StatusModeStatisticsVO vo = new StatusModeStatisticsVO();
+ vo.setChargeMode(3);
+ vo.setFreeCount(0);
+ vo.setFilledCount(0);
+ vo.setInsertCount(0);
+ vo.setChargingCount(0);
+ statusModeStatistics3 =vo;
+ }
statusModeStatisticsVOS.add(statusModeStatistics3);
gunStatusStatisticsVO.setStatusModeStatistics(statusModeStatisticsVOS);
return gunStatusStatisticsVO;
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
index 05e93fc..bb06444 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -1280,11 +1280,13 @@
brands.add(objectMap.get("vehicle_brand").toString());
}
- Long count = chargingOrderService.countCar(brands);
- Map<String, Object> others = new HashMap<>();
- others.put("vehicle_brand","其他");
- others.put("counts",count);
- carBrandMap.add(others);
+ if (carBrandMap.size()>=5) {
+ Long count = chargingOrderService.countCar(brands);
+ Map<String, Object> others = new HashMap<>();
+ others.put("vehicle_brand", "其他");
+ others.put("counts", count);
+ carBrandMap.add(others);
+ }
//本地车数量
Map<String,Object> localCarMap = chargingOrderService.countLocalCar();
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
index ed930b2..bda3e7a 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -1549,9 +1549,13 @@
select count(1)
from
charging_pile_account.t_app_user_car
- where del_flag = 0 and vehicle_brand not in
+ where del_flag = 0
+
+ <if test="brands != null and brands.size() > 0">
+ and vehicle_brand not in
<foreach collection="brands" item="brand" open="(" separator="," close=")">
#{brand}
</foreach>
+ </if>
</select>
</mapper>
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 c003b2e..9a46c41 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
@@ -30,7 +30,10 @@
import com.ruoyi.other.service.TActivityService;
import com.ruoyi.other.service.TCouponService;
import com.ruoyi.other.service.TGoodsService;
+import com.ruoyi.payment.api.feignClient.AliPaymentClient;
import com.ruoyi.payment.api.feignClient.WxPaymentClient;
+import com.ruoyi.payment.api.vo.AliPaymentReq;
+import com.ruoyi.payment.api.vo.AliPaymentResp;
import com.ruoyi.payment.api.vo.PaymentOrder;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -282,9 +285,12 @@
}
+ @Resource
+ private AliPaymentClient aliPaymentClient;
+
@ApiOperation(tags = {"小程序-现金商城"},value = "支付商品")
@PostMapping(value = "/app/pay")
- public R<Map<String, Object>> pay(@RequestBody ExchangeDto exchangeDto) {
+ public Object pay(@RequestBody ExchangeDto exchangeDto) {
Long userId = tokenService.getLoginUserApplet().getUserId();
TAppUser user = appUserClient.getUserById(userId).getData();
boolean isVip = false;
@@ -361,8 +367,17 @@
mapR.getData().put("orderId",shopOrder.getId().toString());
return mapR;
}else {
- //todo 罗 支付宝支付
- return R.ok();
+ AliPaymentReq req = new AliPaymentReq();
+ req.setOutTradeNo(shopOrder.getCode());
+ req.setTotalAmount(shopOrder.getPaymentAmount().toString());
+ req.setSubject("购买商品");
+ req.setBuyerOpenId(user.getAliOpenid());
+ req.setBody("购买商品");
+ AliPaymentResp data = aliPaymentClient.payment(req).getData();
+ if(null != data){
+ data.setNotifyUrl(data.getNotifyUrl() + "/payment/callBack/ali/all");
+ return AjaxResult.success(data);
+ }
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
index 8ebbd2f..48e5837 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TVipController.java
@@ -322,7 +322,7 @@
@ApiOperation(value = "购买会员", tags = {"小程序-个人中心"})
@GetMapping("/vipInfo/pay")
- public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType,
+ public Object vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType,
@RequestParam("payType") Integer payType
) {
@@ -366,7 +366,7 @@
Long userId = tokenService.getLoginUserApplet().getUserId();
- return R.ok(vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId));
+ return vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId);
}
}
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TVipService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TVipService.java
index 522dd5a..7908f43 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TVipService.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TVipService.java
@@ -1,6 +1,7 @@
package com.ruoyi.other.service;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.TVip;
@@ -19,5 +20,5 @@
PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize);
- Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId);
+ Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType, BigDecimal discountMoney, BigDecimal discount, Integer buyType, Long userId);
}
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 0bad395..b1d5fe1 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
@@ -124,7 +124,7 @@
paymentOrder.setAmount(shopOrder.getPaymentAmount());
paymentOrder.setOpenId(user.getWxOpenid());
paymentOrder.setDescription("购买会员");
- return wxPaymentClient.orderPay(paymentOrder).getData();
+ return AjaxResult.success(wxPaymentClient.orderPay(paymentOrder).getData());
}else {
AliPaymentReq req = new AliPaymentReq();
req.setOutTradeNo(shopOrder.getCode());
@@ -134,7 +134,7 @@
req.setBody("充电充值");
AliPaymentResp data = aliPaymentClient.payment(req).getData();
if(null != data){
- data.setNotifyUrl(data.getNotifyUrl() + "/callBack/ali/all");
+ data.setNotifyUrl(data.getNotifyUrl() + "/payment/callBack/ali/all");
return AjaxResult.success(data);
}
}
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 171369c..8816fac 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
@@ -2,6 +2,8 @@
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.order.api.feignClient.ChargingOrderClient;
+import com.ruoyi.order.api.feignClient.OrderClient;
import com.ruoyi.payment.ali.config.AliProperties;
import com.ruoyi.payment.ali.v2.AppletPayUtil;
import com.ruoyi.payment.api.model.*;
@@ -88,20 +90,33 @@
}
+ @Resource
+ private OrderClient orderClient;
+ @Resource
+ private ChargingOrderClient chargingOrderClient;
@ResponseBody
- @PostMapping(value = "/allCallBack")
+ @PostMapping(value = "/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();
-// 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();
-// }
+ String substring = out_trade_no.substring(0, 2);
+ switch (substring){
+ //购物订单
+ case "GW":
+ R r = orderClient.callBack(out_trade_no, transaction_id);
+ System.err.println("----收到购物回调");
+ break;
+ case "HY":
+ orderClient.vipCallBack(out_trade_no,transaction_id);
+ System.err.println("----收到会员回调");
+ break;
+ case "CD":
+ chargingOrderClient.chargingOrderWXCallback(out_trade_no, transaction_id, attach);
+ System.err.println("----充电支付回调");
+ break;
+ }
} catch (Exception e) {
e.printStackTrace();
}
--
Gitblit v1.7.1