From e3c9bc3a6aa412cbc8682f845796e29cced0a66c Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期二, 10 十二月 2024 10:52:39 +0800
Subject: [PATCH] 1.

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java |   33 +++++++++++++++-
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java          |   10 -----
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java                |    2 
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/BaseSetting.java             |    2 
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java  |   45 ++++++++++++++++++++++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java         |    8 ++++
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java     |    4 +
 7 files changed, 88 insertions(+), 16 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/BaseSetting.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/BaseSetting.java
index d8c2d8a..eac4a7f 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/BaseSetting.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/BaseSetting.java
@@ -26,7 +26,7 @@
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "1:合伙人积分设置一	2:合伙人积分设置二	3:会员说明设置	4:活动管理-活动设置 1开0关  5:售后设置")
+    @ApiModelProperty(value = "1:合伙人积分设置一	2:合伙人积分设置二	3:会员说明设置	4:活动管理-活动设置 1开0关  5:售后设置 6:充值设置")
     @TableId("id")
     private Integer id;
 
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 e8de328..6ba0a73 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
@@ -1,11 +1,19 @@
 package com.ruoyi.order.controller;
 
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 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.vo.*;
+import com.ruoyi.other.api.domain.GoodsShop;
+import com.ruoyi.other.api.domain.Shop;
+import com.ruoyi.other.api.feignClient.GoodsShopClient;
+import com.ruoyi.other.api.feignClient.ShopClient;
+import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds;
+import com.ruoyi.system.api.model.LoginUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -14,6 +22,9 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/shopping-cart")
@@ -25,6 +36,11 @@
 	
 	@Resource
 	private TokenService tokenService;
+
+	@Resource
+	private GoodsShopClient goodsShopClient;
+	@Resource
+	private ShopClient shopClient;
 	
 	
 	
@@ -91,6 +107,35 @@
 	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);
+				}
+			}
+		}
+		return R.ok(verifiableShopVoList);
+	}
 	
 	
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/VerifiableShopVo.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
similarity index 91%
rename from ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/VerifiableShopVo.java
rename to ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
index c55dc85..6e75148 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/VerifiableShopVo.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
@@ -1,4 +1,4 @@
-package com.ruoyi.other.vo;
+package com.ruoyi.order.vo;
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
index b6c5b53..aa66681 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java
@@ -1,14 +1,13 @@
 package com.ruoyi.other.controller;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.other.api.domain.GoodsCategory;
 import com.ruoyi.other.service.GoodsCategoryService;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.Api;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -28,6 +27,34 @@
     @Resource
     private GoodsCategoryService goodsCategoryService;
 
+
+    @PostMapping("/addGoodsCategory")
+    @ApiOperation(value = "添加商品分类", tags = {"管理后台-商品分类"})
+    public R<Void> addGoodsCategory(GoodsCategory goodsCategory){
+        goodsCategoryService.save(goodsCategory);
+        return R.ok();
+    }
+
+    @PutMapping("/updateGoodsCategory")
+    @ApiOperation(value = "修改商品分类", tags = {"管理后台-商品分类"})
+    public R<Void> updateGoodsCategory(GoodsCategory goodsCategory){
+        goodsCategoryService.updateById(goodsCategory);
+        return R.ok();
+    }
+
+    @GetMapping("/getGoodsCategoryById")
+	@ApiOperation(value = "商品分类详情", tags = {"管理后台-商品分类"})
+	public R<GoodsCategory> getGoodsCategoryById(@RequestParam("id") Integer id){
+        return R.ok(goodsCategoryService.getById(id));
+    }
+
+
+    @GetMapping("/getList")
+    @ApiOperation(value = "商品分类列表", tags = {"管理后台-商品分类"})
+    public R<List<GoodsCategory>> list(IPage<GoodsCategory> page, GoodsCategory goodsCategory){
+        return R.ok(goodsCategoryService.list());
+    }
+
     @GetMapping("/index/list")
 	@ApiOperation(value = "商品分类", tags = {"小程序-首页"})
 	public R<List<GoodsCategory>> indexlist(){
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
index f5d19af..8b1b86b 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -31,6 +31,14 @@
     @Resource
     private GoodsService goodsService;
 
+    /**
+     * 添加商品
+     */
+    @PostMapping("/addGoods")
+    @ApiOperation(value = "添加商品", tags = {"管理后台-发布商品"})
+    public R<Void> addGoods(@RequestBody Goods goods) {
+        return R.ok();
+    }
 
 
 
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java
index 0578e20..48dfc60 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java
@@ -49,7 +49,9 @@
 	@ResponseBody
 	@PostMapping("/getGoodsShopByGoodsIds")
 	public R<List<GoodsShop>> getGoodsShopByGoodsIds(@RequestBody GetGoodsShopByGoodsIds goodsIds) {
-		List<GoodsShop> list = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getShopId, goodsIds.getShopId()).in(GoodsShop::getGoodsId, goodsIds.getGoodsIds()));
+		List<GoodsShop> list = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>()
+				.eq(goodsIds.getShopId() != null,GoodsShop::getShopId, goodsIds.getShopId())
+				.in(goodsIds.getGoodsIds() !=null ,GoodsShop::getGoodsId, goodsIds.getGoodsIds()));
 		return R.ok(list);
 	}
 }
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
index 39cf8ce..a5f04a0 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -16,7 +16,6 @@
 import com.ruoyi.other.service.TechnicianService;
 import com.ruoyi.other.vo.NearbyShopVO;
 import com.ruoyi.other.vo.ShopDetailVO;
-import com.ruoyi.other.vo.VerifiableShopVo;
 import com.ruoyi.system.api.model.LoginUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -118,15 +117,6 @@
 
 
 
-    @ResponseBody
-    @GetMapping("/getVerifiableShop")
-    @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"})
-    public R<List<VerifiableShopVo>> getVerifiableShop(){
-        // todo 待完善 pu
-        return R.ok();
-    }
-    
-    
     /**
      * 根据id获取门店信息
      * @param id

--
Gitblit v1.7.1