Selaa lähdekoodia

订单部分售后直接取消问题

fubojin 1 päivä sitten
vanhempi
commit
bf35575ae1

+ 6 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/model/OrderRefund.java

@@ -167,8 +167,14 @@ public class OrderRefund implements Serializable{
 
     private Double freightAmount;
 
+    /**
+     * 该退款单是否处理完成
+     */
     private Boolean handler;
 
+    /**
+     * 企业用户用积分抵扣,后台充值积分
+     */
     private Long offsetPoints;
     //过期的积分
     private Long refundExpiredScore;

+ 6 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/param/CategoryProductDTO.java

@@ -19,6 +19,12 @@ public class CategoryProductDTO {
      @NotNull(message = "分类code不能为空")
     private String code;
 
+    /**
+     * 门店 id
+     */
+    @NotNull(message = "门店 id不能为空")
+    private Long shopId;
+
     /**
      *  商品idList
      */

+ 30 - 21
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/CategoryPropController.java

@@ -10,28 +10,19 @@
 
 package com.yami.shop.platform.controller;
 
-import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.yami.shop.bean.dto.ListCategoryDTO;
-import com.yami.shop.bean.model.Category;
-import com.yami.shop.bean.model.Product;
-import com.yami.shop.bean.model.ShopDetail;
-import com.yami.shop.bean.vo.ListCategoryVO;
-import com.yami.shop.common.annotation.SysLog;
-import com.yami.shop.common.config.Constant;
+import com.yami.shop.bean.model.CategoryProd;
+import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
 import com.yami.shop.service.CategoryProdService;
-import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Date;
 import java.util.List;
-import java.util.Objects;
 
 
 /**
@@ -45,14 +36,32 @@ import java.util.Objects;
 @RequestMapping("/platform/categoryProd")
 public class CategoryPropController {
 
-	@Autowired
-	private CategoryProdService categoryProdService;
-
-	/**
-	 * 通过商品id查询分类绑定商品
-	 */
+    @Autowired
+    private CategoryProdService categoryProdService;
 
+    /**
+     * 通过code查询分类绑定商品
+     */
+    @GetMapping("/listByCode")
+    public R<List<CategoryProd>> listByCode(CategoryProd categoryProd) {
+        List<CategoryProd> list = categoryProdService.list(new LambdaQueryWrapper<CategoryProd>()
+                .eq(CategoryProd::getCode, categoryProd.getCode())
+                .eq(CategoryProd::getIsDelete, 0)
+                .eq(ObjectUtil.isNotEmpty(categoryProd.getShopId()), CategoryProd::getShopId, categoryProd.getShopId()));
+        return R.SUCCESS(list);
+    }
 
 
+    /**
+     * 分页通过code查询分类绑定商品
+     */
+    @GetMapping("/pageByCode")
+    public R<IPage<CategoryProd>> pageByCode(CategoryProd categoryProd, PageParam<CategoryProd> page) {
+        IPage<CategoryProd> list = categoryProdService.page(page, new LambdaQueryWrapper<CategoryProd>()
+                .eq(CategoryProd::getCode, categoryProd.getCode())
+                .eq(CategoryProd::getIsDelete, 0)
+                .eq(ObjectUtil.isNotEmpty(categoryProd.getShopId()), CategoryProd::getShopId, categoryProd.getShopId()));
+        return R.SUCCESS(list);
+    }
 
 }

+ 1 - 0
yami-shop-service/src/main/java/com/yami/shop/service/impl/OrderRefundServiceImpl.java

@@ -1088,6 +1088,7 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
 
             if (ObjectUtil.isNotEmpty(applyDeal)) {
                 if (applyDeal == 40) {
+                    //40:退货退款
                     applyDeal = 2;
                 } else {
                     applyDeal = 1;

+ 15 - 1
yami-shop-service/src/main/java/com/yami/shop/service/impl/OrderServiceImpl.java

@@ -1176,7 +1176,21 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                     }
                     break;
             }
-            order.setHbOrderStatus(OrderStatus.CLOSE.value());
+
+
+            if (1 == orderRefund.getRefundType()) {
+                order.setHbOrderStatus(OrderStatus.CLOSE.value());
+            }else {
+                List<OrderRefund> orderRefundList = orderRefundMapper.selectList(new LambdaQueryWrapper<OrderRefund>()
+                        .eq(OrderRefund::getOrderNumber, orderNumber)
+                        .eq(OrderRefund::getReturnMoneySts, 70)
+                );
+                //统计全部退货商品数量(goodsNum)
+                int goodsNum = orderRefundList.stream().mapToInt(OrderRefund::getGoodsNum).sum();
+                if (goodsNum == order.getProductNums()) {
+                    order.setHbOrderStatus(OrderStatus.CLOSE.value());
+                }
+            }
             orderMapper.updateById(order);
 
             orderRefund.setRefundAmount(refundActual.doubleValue());

+ 3 - 1
yami-shop-service/src/main/java/com/yami/shop/service/impl/ShopCategoryServiceImpl.java

@@ -196,14 +196,16 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
 
             Integer integer = categoryProdMapper.selectCount(new LambdaQueryWrapper<CategoryProd>().eq(CategoryProd::getProdId, aLong)
                     .eq(CategoryProd::getIsDelete, 0)
+                    .eq(CategoryProd::getShopId, categoryProductDTO.getShopId())
                     .eq(CategoryProd::getCode, categoryProductDTO.getCode()));
 
             if (integer > 0) {
-                new GlobalException("该门店分类对应商品已存在!请勿重复添加");
+                new GlobalException("该门店分类对应商品ID="+aLong+" 已存在!请勿重复添加");
             }
             CategoryProd categoryProd = new CategoryProd();
             categoryProd.setCategoryId(categoryProductDTO.getCategoryId());
             categoryProd.setProdId(aLong);
+            categoryProd.setShopId(categoryProductDTO.getShopId());
             categoryProd.setCode(categoryProductDTO.getCode());
             categoryProd.setIsDelete(0);
             categoryProd.setCreateTime(new Date());