From a6024ac722d75126d6b5a5d515f7e62e5955547e Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期四, 06 六月 2024 11:33:26 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/DolphinEnglish

---
 ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/TGoodsController.java |  101 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 62 insertions(+), 39 deletions(-)

diff --git a/ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/TGoodsController.java b/ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/TGoodsController.java
index 4f7024a..60caadb 100644
--- a/ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/TGoodsController.java
+++ b/ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/TGoodsController.java
@@ -1,7 +1,6 @@
 package com.ruoyi.goods.controller;
 
 
-import com.alibaba.fastjson2.util.UUIDUtils;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.domain.R;
@@ -10,8 +9,6 @@
 import com.ruoyi.goods.domain.*;
 import com.ruoyi.goods.dto.*;
 import com.ruoyi.goods.service.*;
-import com.ruoyi.goods.utils.MyQrCodeUtil;
-import com.ruoyi.goods.utils.QRCodeUtil;
 import com.ruoyi.goods.vo.GoodDetailVO;
 import com.ruoyi.goods.vo.TGoodsVO;
 import com.ruoyi.goods.vo.TOrderVO;
@@ -20,15 +17,12 @@
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.apache.logging.log4j.core.util.UuidUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
-import java.awt.image.BufferedImage;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
@@ -77,7 +71,7 @@
     @PostMapping("/goodList")
     @ApiOperation(value = "商品列表查询", tags = {"家长端-商品列表"})
     public R<PageInfo<TGoods>> listType(@RequestBody GoodQueryDTO goodQuery) {
-        if (tokenService.getLoginUser1() == null){
+        if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         List<String> type = goodQuery.getType();
@@ -87,7 +81,7 @@
         wrapper = keywords != null && "".equals(keywords.trim()) ? wrapper.like("name", keywords) : wrapper;
 
         // 类型匹配 todo
-        if (goodQuery.getType()!=null && goodQuery.getType().size()>0){
+        if (goodQuery.getType() != null && goodQuery.getType().size() > 0) {
             StringBuilder temp = new StringBuilder("");
             for (String s : goodQuery.getType()) {
                 wrapper.or().apply("FIND_IN_SET('" + s + "', typeIds)"); // 将每个类型 ID 应用于 FIND_IN_SET 函数
@@ -96,10 +90,11 @@
         wrapper.eq("isDelete", 0);
         return R.ok(goodsService.page(new PageInfo<>(goodQuery.getPageNumber(), goodQuery.getPageSize()), wrapper));
     }
+
     @PostMapping("/goodListStudy")
     @ApiOperation(value = "商品列表查询", tags = {"学习端"})
     public R<PageInfo<TGoods>> goodListStudy(@RequestBody GoodQueryDTO goodQuery) {
-        if (tokenService.getLoginUserStudy() == null){
+        if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
         List<String> type = goodQuery.getType();
@@ -109,7 +104,7 @@
         wrapper = keywords != null && "".equals(keywords.trim()) ? wrapper.like("name", keywords) : wrapper;
 
         // 类型匹配 todo
-        if (goodQuery.getType()!=null && goodQuery.getType().size()>0){
+        if (goodQuery.getType() != null && goodQuery.getType().size() > 0) {
             StringBuilder temp = new StringBuilder("");
             for (String s : goodQuery.getType()) {
                 wrapper.or().apply("FIND_IN_SET('" + s + "', typeIds)"); // 将每个类型 ID 应用于 FIND_IN_SET 函数
@@ -211,6 +206,7 @@
         return R.ok(orderService.lambdaQuery().eq(TOrder::getUserId, tokenService.getLoginUserStudy().getUserid())
                 .orderByDesc(TOrder::getCreateTime).list());
     }
+
     @GetMapping("/exchangeRecordParent")
     @ApiOperation(value = "家长端-兑换记录", tags = {"家长端-兑换记录"})
     public R<Page<TOrder>> exchangeRecordParent(Integer pageNumber,Integer pageSize) {
@@ -249,13 +245,14 @@
             @ApiImplicitParam(value = "订单id", name = "id", dataType = "String", required = true)
     })
     public R<Boolean> confirm(@RequestParam Integer id) {
-        if (tokenService.getLoginUser1() == null){
+        if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         TOrder byId = orderService.getById(id);
         byId.setState(3);
         return R.ok(orderService.updateById(byId));
     }
+
     /**
      * 兑换记录
      */
@@ -265,7 +262,7 @@
             @ApiImplicitParam(value = "订单id", name = "id", dataType = "String", required = true)
     })
     public R<Boolean> confirmStudy(@RequestParam Integer id) {
-        if (tokenService.getLoginUserStudy() == null){
+        if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
         TOrder byId = orderService.getById(id);
@@ -279,12 +276,13 @@
     @GetMapping("/shopAddressParent")
     @ApiOperation(value = "获取用户收货地址", tags = {"家长端-获取用户收货地址"})
     public R<List<Recipient>> shopAddressParent() {
-        if (tokenService.getLoginUser1() == null){
+        if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         return R.ok(recipientService.lambdaQuery().eq(Recipient::getUserId,
                 tokenService.getLoginUser1().getUserid()).list());
     }
+
     /**
      * 设置默认地址
      */
@@ -294,7 +292,7 @@
             @ApiImplicitParam(value = "地址id", name = "id", dataType = "String", required = true)
     })
     public R setDefault(@RequestParam Integer id) {
-        if (tokenService.getLoginUser1() == null){
+        if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         Recipient byId = recipientService.getById(id);
@@ -310,6 +308,7 @@
         }
         return R.ok();
     }
+
     /**
      * 设置默认地址
      */
@@ -319,7 +318,7 @@
             @ApiImplicitParam(value = "地址id", name = "id", dataType = "String", required = true)
     })
     public R setDefaultStudy(@RequestParam Integer id) {
-        if (tokenService.getLoginUserStudy() == null){
+        if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
         Recipient byId = recipientService.getById(id);
@@ -338,6 +337,7 @@
 
     /**
      * 根据地址id 获取详情
+     *
      * @param id
      * @return
      */
@@ -347,14 +347,16 @@
             @ApiImplicitParam(value = "地址id", name = "id", dataType = "String", required = true)
     })
     public R<Recipient> getAddressById(@RequestParam Integer id) {
-        if (tokenService.getLoginUser1() == null){
+        if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         Recipient byId = recipientService.getById(id);
         return R.ok(byId);
     }
+
     /**
      * 根据地址id 获取详情
+     *
      * @param id
      * @return
      */
@@ -364,19 +366,20 @@
             @ApiImplicitParam(value = "地址id", name = "id", dataType = "String", required = true)
     })
     public R<Recipient> getAddressByIdStudy(@RequestParam Integer id) {
-        if (tokenService.getLoginUserStudy() == null){
+        if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
         Recipient byId = recipientService.getById(id);
         return R.ok(byId);
     }
+
     /**
      * 获取用户收货地址
      */
     @GetMapping("/shopAddress")
     @ApiOperation(value = "获取用户收货地址", tags = {"学习端-获取用户收货地址"})
     public R<List<Recipient>> shopAddress() {
-        if (tokenService.getLoginUserStudy() == null){
+        if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
         return R.ok(recipientService.lambdaQuery().eq(Recipient::getUserId,
@@ -402,6 +405,7 @@
         recipientService.addressSaveOrUpdate(recipient);
         return R.ok();
     }
+
     /**
      * 新增收货地址/修改收货地址
      */
@@ -450,6 +454,7 @@
     public R<String> addressDelete(@RequestParam String id) {
         return R.ok(recipientService.removeById(id) ? "删除成功!" : "删除失败!");
     }
+
     /**
      * 删除收货地址
      */
@@ -466,7 +471,7 @@
     @GetMapping("/getOrderAddressParent")
     @ApiOperation(value = "获取修改订单收货地址", tags = {"家长端-获取修改订单收货地址"})
     public R<List<Recipient>> getOrderAddressParent() {
-        if (tokenService.getLoginUser1() == null){
+        if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         List<Recipient> userId = recipientService.list(new QueryWrapper<Recipient>()
@@ -474,24 +479,26 @@
 
         return R.ok(userId);
     }
+
     @GetMapping("/getOrderAddress")
     @ApiOperation(value = "获取修改订单收货地址", tags = {"学习端-获取修改订单收货地址"})
     public R<List<Recipient>> getOrderAddress() {
-        if (tokenService.getLoginUserStudy() == null){
+        if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
         List<Recipient> userId = recipientService.list(new QueryWrapper<Recipient>()
                 .eq("userId", tokenService.getLoginUserStudy().getUserid()));
         return R.ok(userId);
     }
+
     @GetMapping("/updateOrderAddressParent")
     @ApiOperation(value = "修改订单收货地址", tags = {"家长端-修改订单收货地址"})
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "String", required = true),
             @ApiImplicitParam(value = "地址信息id", name = "recipientId", dataType = "String", required = true)
     })
-    public R updateOrderAddressParent(@RequestParam Integer orderId,@RequestParam Integer recipientId) {
-        if (tokenService.getLoginUser1() == null){
+    public R updateOrderAddressParent(@RequestParam Integer orderId, @RequestParam Integer recipientId) {
+        if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         Recipient userId = recipientService.getById(recipientId);
@@ -502,10 +509,11 @@
         orderService.updateById(byId);
         return R.ok("修改成功");
     }
+
     @GetMapping("/updateOrderAddress")
     @ApiOperation(value = "修改订单收货地址", tags = {"学习端-修改订单收货地址"})
-    public R updateOrderAddress(@RequestParam Integer orderId,@RequestParam Integer recipientId) {
-        if (tokenService.getLoginUserStudy() == null){
+    public R updateOrderAddress(@RequestParam Integer orderId, @RequestParam Integer recipientId) {
+        if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
         Recipient userId = recipientService.getById(recipientId);
@@ -537,6 +545,15 @@
     }
 
     /**
+     * 获取所有商品分类
+     */
+    @GetMapping("/goodTypeStudy")
+    @ApiOperation(value = "学习端-商品分类列表", tags = {"学习端-商品分类列表"})
+    public R<List<TGoodsType>> goodTypeStudy() {
+        return R.ok(goodsTypeService.lambdaQuery().eq(TGoodsType::getIsDelete, 0).eq(TGoodsType::getIsDelete, 0).list());
+    }
+
+    /**
      * 商品详情
      *
      * @param goodId 商品id
@@ -555,6 +572,7 @@
         int number = goods.getBasicCount() + orderService.getGoodBuyNumber(goods.getId());
         return R.ok(new GoodDetailVO(goods, goodsTypes, number));
     }
+
     /**
      * 商品详情
      *
@@ -566,7 +584,7 @@
             @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true)
     })
     public R<GoodDetailVO> goodDetailParent(@RequestParam String goodId) {
-        if (tokenService.getLoginUser1() == null){
+        if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         // 商品详情
@@ -587,7 +605,7 @@
             @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true)
     })
     public R<GoodDetailVO> redeemNow(@RequestParam String goodId) {
-        if (tokenService.getLoginUserStudy() == null){
+        if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
         Recipient recipient = recipientService.lambdaQuery()
@@ -609,6 +627,7 @@
         goodDetailVO.setOrderNumber(orderNumber);
         return R.ok(goodDetailVO);
     }
+
     /**
      * 商城-立即兑换
      */
@@ -618,7 +637,7 @@
             @ApiImplicitParam(value = "商品id", name = "goodId", dataType = "String", required = true)
     })
     public R<GoodDetailVO> redeemNowParent(@RequestParam String goodId) {
-        if (tokenService.getLoginUser1() == null){
+        if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         Recipient recipient = recipientService.lambdaQuery()
@@ -662,6 +681,7 @@
         Recipient recipient = recipientService.getById(Integer.valueOf(goodExchange.getRecipientId()));
         return goodsService.goodExchange1(goodExchange, recipient);
     }
+
     @PostMapping("/goodExchangeStudy")
     @ApiOperation(value = "学习端-商品兑换确认", tags = {"学习端-商品兑换确认"})
     public R goodExchangeStudy(@RequestBody GoodExchangeDTO goodExchange) {
@@ -672,19 +692,21 @@
 
     @Autowired
     private StudyClient studyClient;
+
     @PostMapping("/getOrderInfo/{id}")
     @ApiOperation(value = "查看详情", tags = {"后台-订单管理"})
-    public R<TOrderVO> getOrderInfo(@PathVariable("id")Integer id) {
+    public R<TOrderVO> getOrderInfo(@PathVariable("id") Integer id) {
         TOrder byId = orderService.getById(id);
         TGoods byId2 = goodsService.getById(byId.getGoodsId());
         TOrderVO tGoodsVO = new TOrderVO();
         tGoodsVO.setName(byId2.getName());
-        BeanUtils.copyProperties(byId,tGoodsVO);
+        BeanUtils.copyProperties(byId, tGoodsVO);
         TUser byId1 = studyClient.getUserById(byId.getUserId()).getData();
         tGoodsVO.setUserName(byId1.getName());
         tGoodsVO.setPhone(byId1.getPhone());
         return R.ok(tGoodsVO);
     }
+
     @PostMapping("/confirm1")
     @ApiOperation(value = "确认发货", tags = {"后台-订单管理"})
     public R getGoodsInfo1(@RequestBody OrderDTO dto) {
@@ -696,12 +718,13 @@
         orderService.updateById(byId);
         return R.ok("修改成功");
     }
+
     @PostMapping("/listAll1")
     @ApiOperation(value = "列表查询", tags = {"后台-订单管理"})
-    public R<PageInfo<TOrderVO>> listAll1(@RequestBody  OrderQuery query) throws ParseException {
+    public R<PageInfo<TOrderVO>> listAll1(@RequestBody OrderQuery query) throws ParseException {
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
-        if (query.getEndTime()!=null){
+        if (query.getEndTime() != null) {
             Date parse = format.parse(query.getStartTime());
             Date parse1 = format.parse(query.getEndTime());
             query.setStartTime1(parse);
@@ -711,25 +734,25 @@
         List<TOrderVO> list1 = new ArrayList<>();
         for (TOrderVO tOrderVO : list) {
             TUser data = studyClient.getUserById(tOrderVO.getUserId()).getData();
-            if (data!=null){
+            if (data != null) {
                 tOrderVO.setUserName(data.getName());
                 tOrderVO.setPhone(data.getPhone());
             }
-            if (!StringUtils.hasLength(query.getPhone()) && !StringUtils.hasLength(query.getUserName())){
+            if (!StringUtils.hasLength(query.getPhone()) && !StringUtils.hasLength(query.getUserName())) {
                 list1.add(tOrderVO);
                 continue;
             }
             // 如果筛选条件输入了电话或者姓名那么需要过滤掉不符合条件的数据
-            if (StringUtils.hasLength(query.getPhone()) && StringUtils.hasLength(query.getUserName())){
-                if (tOrderVO.getPhone().contains(query.getPhone()) && tOrderVO.getUserName().contains(query.getUserName())){
+            if (StringUtils.hasLength(query.getPhone()) && StringUtils.hasLength(query.getUserName())) {
+                if (tOrderVO.getPhone().contains(query.getPhone()) && tOrderVO.getUserName().contains(query.getUserName())) {
                     list1.add(tOrderVO);
                 }
-            }else if (StringUtils.hasLength(query.getPhone())){
-                if (tOrderVO.getPhone().contains(query.getPhone())){
+            } else if (StringUtils.hasLength(query.getPhone())) {
+                if (tOrderVO.getPhone().contains(query.getPhone())) {
                     list1.add(tOrderVO);
                 }
-            }else if (StringUtils.hasLength(query.getUserName())){
-                if (tOrderVO.getUserName().contains(query.getUserName())){
+            } else if (StringUtils.hasLength(query.getUserName())) {
+                if (tOrderVO.getUserName().contains(query.getUserName())) {
                     list1.add(tOrderVO);
                 }
             }

--
Gitblit v1.7.1