From fd45fcbd496bbeaf9ee18edd8f2f858cf9cebaf3 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 24 一月 2025 16:47:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java |   90 ++++++++++++++++++++++++++++++--------------
 1 files changed, 61 insertions(+), 29 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
index 6ba0a73..5be0fba 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
@@ -2,11 +2,14 @@
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ruoyi.account.api.feignClient.AppUserClient;
+import com.ruoyi.account.api.model.AppUser;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.order.service.ShoppingCartService;
+import com.ruoyi.order.util.payment.model.UniPayCallbackResult;
 import com.ruoyi.order.vo.*;
 import com.ruoyi.other.api.domain.GoodsShop;
 import com.ruoyi.other.api.domain.Shop;
@@ -22,6 +25,9 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -36,11 +42,9 @@
 	
 	@Resource
 	private TokenService tokenService;
-
+	
 	@Resource
-	private GoodsShopClient goodsShopClient;
-	@Resource
-	private ShopClient shopClient;
+	private AppUserClient appUserClient;
 	
 	
 	
@@ -107,34 +111,62 @@
 	public R<String> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){
 		return shoppingCartService.shoppingCartPayment(shoppingCartPayment);
 	}
-
-
+	
+	/**
+	 * 订单支付回调通知
+	 */
 	@ResponseBody
-	@GetMapping("/getVerifiableShop")
-	@ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"})
-	public R<List<VerifiableShopVo>> getVerifiableShop(){
-		LoginUser loginUser = tokenService.getLoginUser();
-		List<ShoppingCart> shoppingCarts = shoppingCartService.list(new LambdaQueryWrapper<ShoppingCart>()
-				.eq(ShoppingCart::getAppUserId, loginUser.getUserid()));
-
-		List<Integer> goodsIds = shoppingCarts.stream().map(ShoppingCart::getGoodsId).collect(Collectors.toList());
-		GetGoodsShopByGoodsIds goodsShopByGoodsIds = new GetGoodsShopByGoodsIds();
-		goodsShopByGoodsIds.setGoodsIds(goodsIds);
-		R<List<GoodsShop>> r = goodsShopClient.getGoodsShopByGoodsIds(goodsShopByGoodsIds);
-		List<GoodsShop> goodsShops = r.getData();
-		List<VerifiableShopVo> verifiableShopVoList = new ArrayList<>();
-		if (CollectionUtil.isNotEmpty(goodsShops)){
-			for (GoodsShop goodsShop : goodsShops) {
-				R<Shop> shopR = shopClient.getShopById(goodsShop.getShopId());
-				if (R.isSuccess(shopR)){
-					VerifiableShopVo verifiableShopVo = new VerifiableShopVo();
-					verifiableShopVo.setId(shopR.getData().getId());
-					verifiableShopVo.setName(shopR.getData().getName());
-					verifiableShopVoList.add(verifiableShopVo);
-				}
+	@GetMapping("/shoppingCartPaymentCallback")
+	public void shoppingCartPaymentCallback(UniPayCallbackResult uniPayCallbackResult, HttpServletResponse response){
+		R callback = shoppingCartService.shoppingCartPaymentCallback(uniPayCallbackResult);
+		if(callback.getCode() == 200){
+			response.setStatus(200);
+			PrintWriter out = null;
+			try {
+				out = response.getWriter();
+			} catch (IOException e) {
+				throw new RuntimeException(e);
 			}
+			out.println("success");
+			out.flush();
+			out.close();
 		}
-		return R.ok(verifiableShopVoList);
+	}
+	
+	
+	/**
+	 * 快递费支付回调
+	 * @param uniPayCallbackResult
+	 * @param response
+	 */
+	@ResponseBody
+	@GetMapping("/shoppingCartMaterialFlowPaymentCallback")
+	public void shoppingCartMaterialFlowPaymentCallback(UniPayCallbackResult uniPayCallbackResult, HttpServletResponse response){
+		R callback = shoppingCartService.shoppingCartMaterialFlowPaymentCallback(uniPayCallbackResult);
+		if(callback.getCode() == 200){
+			response.setStatus(200);
+			PrintWriter out = null;
+			try {
+				out = response.getWriter();
+			} catch (IOException e) {
+				throw new RuntimeException(e);
+			}
+			out.println("success");
+			out.flush();
+			out.close();
+		}
+	}
+	
+	
+
+
+
+
+	@GetMapping("/getGoodsPrice")
+	public R<Price> getGoodsPrice(Long appUserId, Integer goodsId, Integer shopId){
+		AppUser appUser = appUserClient.getAppUserById(appUserId);
+		Price price = shoppingCartService.getPrice(appUser, goodsId, 1, shopId);
+		return R.ok(price);
 	}
 	
 	

--
Gitblit v1.7.1