From 8059e9b991c15edbac508e6b658a0d9571d11b1c Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期五, 01 八月 2025 12:46:00 +0800
Subject: [PATCH] bug修改

---
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/management/MgtGoodsController.java |   86 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 77 insertions(+), 9 deletions(-)

diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/management/MgtGoodsController.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/management/MgtGoodsController.java
index 0981598..888b2a4 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/management/MgtGoodsController.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/management/MgtGoodsController.java
@@ -2,22 +2,26 @@
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.utils.poi.ExcelUtil;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.goods.domain.dto.*;
-import com.ruoyi.goods.domain.vo.MgtGoodsPageVo;
-import com.ruoyi.goods.domain.vo.MgtGoodsTotalVo;
+import com.ruoyi.goods.domain.vo.*;
 import com.ruoyi.goods.service.goods.GoodsService;
-import com.ruoyi.system.api.domain.dto.MgtBaseDto;
 import com.ruoyi.system.api.domain.dto.MgtBaseGetDto;
 import com.ruoyi.system.api.domain.vo.MgtSelectGoodsPageVo;
+import com.ruoyi.system.api.domain.vo.StaticsShopMgtGoodsVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -27,7 +31,7 @@
  * @date 2023年06月01日
  * @version: 1.0
  */
-@Api(value = "平台端商品相关接口", tags = "平台端商品相关接口", description = "平台端商品相关接口")
+@Api(value = "管理后台商品相关接口", tags = "管理后台商品相关接口", description = "管理后台商品相关接口")
 @RestController
 @RequestMapping("/mgt/goods")
 public class MgtGoodsController {
@@ -46,18 +50,33 @@
         return R.ok(page.setRecords(mgtGoodsPageVoList));
     }
 
+    @RequestMapping(value = "/exportPageMgtGoods", method = RequestMethod.POST)
+    @ApiOperation(value = "导出商品列表")
+    public void exportPageMgtGoods( MgtGoodsPageDto mgtGoodsPageDto, HttpServletResponse response) {
+        Page<MgtGoodsPageVo> page = new Page<>();
+        if(mgtGoodsPageDto.getPageSize() > 5000){
+            page.setSize(5000);
+            page.setCurrent(1);
+        }else{
+            page.setSize(mgtGoodsPageDto.getPageSize());
+            page.setCurrent(mgtGoodsPageDto.getPageNum());
+        }
+        List<MgtGoodsPageVo> mgtGoodsPageVoList = goodsService.pageMgtGoods(page,mgtGoodsPageDto);
+        ExcelUtil<MgtGoodsPageVo> util = new ExcelUtil<MgtGoodsPageVo>(MgtGoodsPageVo.class);
+        util.exportExcel(response, mgtGoodsPageVoList, "商品列表");
+    }
+
     @RequestMapping(value = "/getMgtGoodsTotal", method = RequestMethod.POST)
     @ApiOperation(value = "获取商品统计")
-    public R<MgtGoodsTotalVo> getMgtGoodsTotal(@RequestBody MgtBaseDto mgtBaseDto) {
-        Long userId = SecurityUtils.getUserId();
-        mgtBaseDto.setUserId(userId);
+    public R<MgtGoodsTotalVo> getMgtGoodsTotal() {
         MgtGoodsTotalVo mgtGoodsTotalVo = goodsService.getMgtGoodsTotal();
         return R.ok(mgtGoodsTotalVo);
     }
 
     @RequestMapping(value = "/editMgtGoods", method = RequestMethod.POST)
+    @Log(title = "商品管理", businessType = BusinessType.UPDATE,operContent = "编辑商品")
     @ApiOperation(value = "平台编辑商品")
-    public R editMgtGoods(@RequestBody MgtGoodsEditDto mgtGoodsEditDto) {
+    public R editMgtGoods(@Validated @RequestBody MgtGoodsEditDto mgtGoodsEditDto) {
         Long userId = SecurityUtils.getUserId();
         mgtGoodsEditDto.setUserId(userId);
         goodsService.editMgtGoods(mgtGoodsEditDto);
@@ -65,6 +84,7 @@
     }
 
     @RequestMapping(value = "/upDownMgtGoods", method = RequestMethod.POST)
+    @Log(title = "商品管理", businessType = BusinessType.UPDATE,operContent = "上下架商品")
     @ApiOperation(value = "平台上下架商品")
     public R upDownMgtGoods(@RequestBody MgtGoodsUpDownDto mgtGoodsUpDownDto) {
         Long userId = SecurityUtils.getUserId();
@@ -74,6 +94,7 @@
     }
 
     @RequestMapping(value = "/recommendMgtGoods", method = RequestMethod.POST)
+    @Log(title = "商品管理", businessType = BusinessType.UPDATE,operContent = "推荐商品")
     @ApiOperation(value = "平台推荐商品")
     public R recommendMgtGoods(@RequestBody MgtGoodsRecommendDto mgtGoodsRecommendDto) {
         Long userId = SecurityUtils.getUserId();
@@ -83,7 +104,8 @@
     }
 
     @RequestMapping(value = "/deleteMgtGoods", method = RequestMethod.POST)
-    @ApiOperation(value = "平台推荐商品")
+    @Log(title = "商品管理", businessType = BusinessType.DELETE,operContent = "删除商品")
+    @ApiOperation(value = "删除商品")
     public R deleteMgtGoods(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
         Long userId = SecurityUtils.getUserId();
         mgtBaseGetDto.setUserId(userId);
@@ -101,4 +123,50 @@
         List<MgtSelectGoodsPageVo> mgtSelectGoodsPageVos = goodsService.pageMgtSelectGoods(page,mgtSelectGoodsPageDto);
         return R.ok(page.setRecords(mgtSelectGoodsPageVos));
     }
+
+    @RequestMapping(value = "/getMgtGoodsEditInfo", method = RequestMethod.POST)
+    @ApiOperation(value = "获取商品编辑信息")
+    public R<MgtGoodsEditInfoVo> getMgtGoodsEditInfo(@RequestBody MgtBaseGetDto mgtBaseGetDto) {
+        MgtGoodsEditInfoVo mgtGoodsEditInfoVo = goodsService.getMgtGoodsEditInfo(mgtBaseGetDto);
+        return R.ok(mgtGoodsEditInfoVo);
+    }
+
+    @RequestMapping(value = "/pageShopMgtGoods", method = RequestMethod.POST)
+    @ApiOperation(value = "商品信息-分页获取门店内商品信息【2.0】",tags = "管理台商户相关接口")
+    public R<Page<PageShopMgtGoodsVO>> pageShopMgtGoods(@RequestBody PageShopMgtGoodsDTO pageShopMgtGoodsDTO) {
+        Page<PageShopMgtGoodsVO> page = new Page<>();
+        page.setSize(pageShopMgtGoodsDTO.getPageSize());
+        page.setCurrent(pageShopMgtGoodsDTO.getPageNum());
+        page.setOptimizeCountSql(false);
+        List<PageShopMgtGoodsVO> pageShopMgtGoods = goodsService.pageShopMgtGoods(page,pageShopMgtGoodsDTO);
+        return R.ok(page.setRecords(pageShopMgtGoods));
+    }
+
+    @RequestMapping(value = "/exportShopMgtGoods", method = RequestMethod.POST)
+    @ApiOperation(value = "商品信息-分页获取门店内商品信息-导出【2.0】",tags = "管理台商户相关接口")
+    public void exportShopMgtGoods(@RequestBody PageShopMgtGoodsDTO pageShopMgtGoodsDTO, HttpServletResponse response) {
+        Page<PageShopMgtGoodsVO> page = new Page<>();
+        if(pageShopMgtGoodsDTO.getPageSize() > 5000){
+            page.setSize(5000);
+            page.setCurrent(1);
+        }else{
+            page.setSize(pageShopMgtGoodsDTO.getPageSize());
+            page.setCurrent(pageShopMgtGoodsDTO.getPageNum());
+        }
+        List<PageShopMgtGoodsVO> pageShopMgtGoods = goodsService.pageShopMgtGoods(page,pageShopMgtGoodsDTO);
+        ExcelUtil<PageShopMgtGoodsVO> util = new ExcelUtil<PageShopMgtGoodsVO>(PageShopMgtGoodsVO.class);
+        util.exportExcel(response, pageShopMgtGoods, "商品信息");
+    }
+    @RequestMapping(value = "/staticsShopMgtGoods", method = RequestMethod.POST)
+    @ApiOperation(value = "商品信息-获取门店内商品信息统计汇总【2.0】",tags = "管理台商户相关接口")
+    public R<StaticsShopMgtGoodsVO> staticsShopMgtGoods(@RequestBody PageShopMgtGoodsDTO pageShopMgtGoodsDTO) {
+        return R.ok(goodsService.staticsShopMgtGoods(pageShopMgtGoodsDTO));
+    }
+    @RequestMapping(value = "/updateGoodsPrice", method = RequestMethod.POST)
+    @Log(title = "商品管理", businessType = BusinessType.UPDATE,operContent = "修改门店内商品价格")
+    @ApiOperation(value = "商品信息-修改价格【2.0】",tags = "管理台商户相关接口")
+    public R<Void> updateGoodsPrice(@RequestBody UpdateGoodsPriceDTO updateGoodsPriceDTO) {
+        return goodsService.updateGoodsPrice(updateGoodsPriceDTO);
+    }
+
 }

--
Gitblit v1.7.1