From c97ae0369607c7091041273012b291d3b6e6bdc1 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期一, 25 八月 2025 10:10:01 +0800
Subject: [PATCH] 迭代代码

---
 ruoyi-service/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/TGoodsController.java |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 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 0913107..c87a3ae 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
@@ -306,7 +306,7 @@
         }
         List<ExchangeRecordVO> exchangeRecord = orderService.exchangeRecord(res,tokenService.getLoginUserStudy().getUserid());
         for (ExchangeRecordVO record : exchangeRecord) {
-            TGoods goods = goodsService.getById(record.getGoodsId());
+            TGoods goods = goodsService.getById1(record.getGoodsId());
             List<String> typeList;
             if (null != goods) {
                 List<TGoodsType> goodsTypes = goodsTypeService.lambdaQuery().in(TGoodsType::getId, Arrays.stream(goods.getTypeIds().split(",")).collect(Collectors.toList()))
@@ -331,7 +331,7 @@
         }
         List<ExchangeRecordVO> exchangeRecord = orderService.exchangeRecord(res,tokenService.getLoginUser1().getUserid());
         for (ExchangeRecordVO record : exchangeRecord) {
-            TGoods goods = goodsService.getById(record.getGoodsId());
+            TGoods goods = goodsService.getById1(record.getGoodsId());
             List<String> typeList;
             if (null != goods) {
                 List<TGoodsType> goodsTypes = goodsTypeService.lambdaQuery().in(TGoodsType::getId, Arrays.stream(goods.getTypeIds().split(",")).collect(Collectors.toList()))
@@ -356,11 +356,12 @@
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "id", dataType = "String", required = true)
     })
-    public R<Boolean> confirm(@RequestParam Integer id) {
+    public R<Boolean> confirm(@RequestParam String id) {
         if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
         TOrder byId = orderService.getById(id);
+        byId.setUserId(null);
         byId.setState(3);
         byId.setCompleteTime(new Date());
         return R.ok(orderService.updateById(byId));
@@ -375,11 +376,12 @@
     @ApiImplicitParams({
             @ApiImplicitParam(value = "订单id", name = "id", dataType = "String", required = true)
     })
-    public R<Boolean> confirmStudy(@RequestParam Integer id) {
+    public R<Boolean> confirmStudy(@RequestParam String id) {
         if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
         TOrder byId = orderService.getById(id);
+        byId.setUserId(null);
         byId.setState(3);
         byId.setCompleteTime(new Date());
         return R.ok(orderService.updateById(byId));
@@ -628,7 +630,7 @@
             @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) {
+    public R updateOrderAddressParent(@RequestParam String orderId, @RequestParam Integer recipientId) {
         if (tokenService.getLoginUser1() == null) {
             return R.tokenError("登录失效");
         }
@@ -640,6 +642,7 @@
         if (!Constants.ONE.equals(order.getState())) {
             throw new GlobalException("订单已发货,无法修改收货地址!");
         }
+        order.setUserId(null);
         order.setConsigneeName(recipient.getRecipient());
         order.setConsigneePhone(recipient.getRecipientPhone());
         order.setConsigneeAddress(recipient.getProvince()+recipient.getCity()+recipient.getAddress());
@@ -654,7 +657,7 @@
             @ApiImplicitParam(value = "订单id", name = "orderId", dataType = "String", required = true),
             @ApiImplicitParam(value = "地址信息id", name = "recipientId", dataType = "String", required = true)
     })
-    public R updateOrderAddress(@RequestParam Integer orderId, @RequestParam Integer recipientId) {
+    public R updateOrderAddress(@RequestParam String orderId, @RequestParam Integer recipientId) {
         if (tokenService.getLoginUserStudy() == null) {
             return R.tokenError("登录失效");
         }
@@ -666,6 +669,7 @@
         if (!Constants.ONE.equals(order.getState())) {
             throw new GlobalException("订单已发货,无法修改收货地址!");
         }
+        order.setUserId(null);
         order.setConsigneeName(recipient.getRecipient());
         order.setConsigneePhone(recipient.getRecipientPhone());
         order.setConsigneeAddress(recipient.getProvince()+recipient.getCity()+recipient.getAddress());
@@ -748,7 +752,10 @@
         if (null != goods.getBasicCount()) {
             number += goods.getBasicCount();
         }
-        number += orderService.getGoodBuyNumber(goods.getId());
+        List<TOrder> list = orderService.list(new QueryWrapper<TOrder>().eq("goodsId", goods.getId()));
+        for (TOrder tOrder : list) {
+            number+=tOrder.getCount();
+        }
         // 剩余兑换数量
         Integer residueNumber = null;
         if (null != goods.getTotal()) {
@@ -790,7 +797,10 @@
         if (null != goods.getBasicCount()) {
             number += goods.getBasicCount();
         }
-        number += orderService.getGoodBuyNumber(goods.getId());
+        List<TOrder> list = orderService.list(new QueryWrapper<TOrder>().eq("goodsId", goods.getId()));
+        for (TOrder tOrder : list) {
+            number+=tOrder.getCount();
+        }
         // 剩余兑换数量
         Integer residueNumber = null;
         if (null != goods.getTotal()) {
@@ -920,9 +930,9 @@
     @PostMapping("/getOrderInfo/{id}")
     @ApiOperation(value = "查看详情", tags = {"后台-订单管理"})
     @ApiOperationSupport(order = 11)
-    public R<TOrderVO> getOrderInfo(@PathVariable("id") Integer id) {
+    public R<TOrderVO> getOrderInfo(@PathVariable("id") String id) {
         TOrder byId = orderService.getById(id);
-        TGoods byId2 = goodsService.getById(byId.getGoodsId());
+        TGoods byId2 = goodsService.getById1(byId.getGoodsId());
         TOrderVO tGoodsVO = new TOrderVO();
         BeanUtils.copyProperties(byId, tGoodsVO);
         tGoodsVO.setName(byId2.getName());
@@ -940,6 +950,7 @@
     @ApiOperationSupport(order = 12)
     public R getGoodsInfo1(@RequestBody OrderDTO dto) {
         TOrder byId = orderService.getById(dto.getId());
+        byId.setUserId(null);
         byId.setState(2);
         byId.setExpress(dto.getExpress());
         byId.setExpressNumber(dto.getExpressNumber());
@@ -989,8 +1000,6 @@
                     list1.add(tOrderVO);
                 }
             }
-
-
         }
         PageInfo<TOrderVO> res = new PageInfo<>(query.getPageNumber(), query.getPageSize());
         res.setRecords(list1);

--
Gitblit v1.7.1