Browse Source

海博订单模块

fubojin 1 week ago
parent
commit
c014ec665c

+ 25 - 10
yami-shop-bean/src/main/java/com/yami/shop/bean/enums/OrderStatus.java

@@ -13,29 +13,44 @@ package com.yami.shop.bean.enums;
 public enum OrderStatus {
 
     /**
-     * 没有付款.待付
+     * 待
      */
-    UNPAY(1),
+    UNPAY(0),
 
     /**
-     * 已经付款,但卖家没有发货.待发货
+     * 订单已接单(待拣货)
      */
-    PADYED(2),
+    PADYED(20),
 
     /**
-     * 发货,导致实际库存减少,没有确认收货.待收货
+     * 订单待配送(拣货完成/自提类订单为待自提)
      */
-    CONSIGNMENT(3),
+    CONSIGNMENT(30),
 
     /**
-     * 订单确认收货成功,购买数增加1.
+     * 订单配送中
      */
-    SUCCESS(5),
+    DELIVERY(40),
 
     /**
-     * 交易失败.,还原库存
+     * 订单已送达
      */
-    CLOSE(6),
+    RECEIVED(70),
+
+    /**
+     * 订单已完成
+     */
+    SUCCESS(80),
+
+    /**
+     * 订单取消待审核
+     */
+    CANCEL_AUDIT(50),
+
+    /**
+     * 订单已取消
+     */
+    CLOSE(60),
 
     /**
      * 待成团

+ 3 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/model/ShopSku.java

@@ -37,6 +37,9 @@ public class ShopSku implements Serializable {
      */
     private Long shopId;
 
+    @TableField(exist = false)
+    private String shopName;
+
     /**
      * 单品ID
      */

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

@@ -144,7 +144,7 @@ public class HBOrderService implements IHBOrderService {
         requestBody.put("operator", "admin");
         // 订单操作时间戳毫秒数
         requestBody.put("operatorTime", System.currentTimeMillis());
-        //操作类型 (20:订单已接单 30:订单待配送 60:订单已取消 80:订单已完成)
+        //操作类型 (20:订单已接单 30:订单待配送 60:订单已取消 70:退款 80:订单已完成)
         requestBody.put("operatorType", type);
         // 4. 将整个JSON对象序列化为字符串并设置
         build.setBody(JSON.toJSONString(requestBody));
@@ -153,6 +153,8 @@ public class HBOrderService implements IHBOrderService {
         log.info("post 订单推送单号参数:{}", JSON.toJSONString(build));
         String post = post(hbSignUtil.getHBHost() + "/api/order/changeOrderStatus", build);
         log.info("post 订单推送结果:{}", post);
+
+
         return post;
     }
 

+ 19 - 4
yami-shop-service/src/main/java/com/yami/shop/service/impl/ShopCategoryServiceImpl.java

@@ -20,8 +20,10 @@ import com.yami.shop.dao.ShopCategoryMapper;
 import com.yami.shop.dao.ShopDetailMapper;
 import com.yami.shop.service.IShopCategoryService;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.core.annotation.OrderUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
@@ -38,6 +40,7 @@ import java.util.stream.Collectors;
  * @author YourName
  * @since 2025-09-XX
  */
+@Slf4j
 @Service
 @AllArgsConstructor
 public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, ShopCategory> implements IShopCategoryService {
@@ -122,9 +125,21 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
                     ShopCategory category = shopCategories.get(i);
                     // 检查数据有效性
                     Long shopId = validateShopCategories(category, i);
-                    category.setShopId(shopId);
-                    category.setPid(0L);
-                    this.save(category);
+                    ShopCategory shopCategory = shopCategoryMapper.selectOne(
+                            new LambdaQueryWrapper<ShopCategory>()
+                                    .eq(ShopCategory::getName, category.getName())
+                                    .eq(ShopCategory::getShopId, shopId)
+                    .eq(ShopCategory::getIsDelete, 0).eq(ShopCategory::getPid, 0L));
+                    if (ObjectUtils.isEmpty(shopCategory)) {
+                        category.setShopId(shopId);
+                        category.setPid(0L);
+                        this.save(category);
+                    } else {
+                        category.setId(shopCategory.getId());
+                    }
+
+                    System.out.println(category);
+
                     //添加对应的二级和三级类目
                     FrontCategory frontCategoryByName = frontCategoryMapper.selectListName(category.getSubName());
                     frontCategoryByName.setParentCode(category.getCode());
@@ -187,7 +202,7 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
 
         shopCategory.setHbShopId(hbShopId);
         shopCategory.setShopId(shopId);
-
+log.info("添加门店前台类目:{}", shopCategory);
         this.save(shopCategory);
         List<FrontCategory> frontCategoryList = frontCategoryMapper.selectList(new LambdaQueryWrapper<FrontCategory>()
                 .eq(FrontCategory::getParentCode, frontCategory.getCode()));

+ 7 - 4
yami-shop-service/src/main/java/com/yami/shop/service/impl/ShopSkuServiceImpl.java

@@ -6,12 +6,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yami.shop.bean.model.ChannelProd;
 import com.yami.shop.bean.model.Label;
+import com.yami.shop.bean.model.ShopDetail;
 import com.yami.shop.bean.model.ShopSku;
 import com.yami.shop.common.util.PageParam;
-import com.yami.shop.dao.ChannelProdMapper;
-import com.yami.shop.dao.ProductMapper;
-import com.yami.shop.dao.ShopSkuMapper;
-import com.yami.shop.dao.SkuMapper;
+import com.yami.shop.dao.*;
 import com.yami.shop.service.ShopSkuService;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang3.ObjectUtils;
@@ -27,6 +25,7 @@ public class ShopSkuServiceImpl extends ServiceImpl<ShopSkuMapper, ShopSku> impl
     private final ChannelProdMapper channelProdMapper;
     private final SkuMapper skuMapper;
     private final ProductMapper productMapper;
+    private final ShopDetailMapper shopDetailMapper;
 
 
     @Override
@@ -45,8 +44,12 @@ public class ShopSkuServiceImpl extends ServiceImpl<ShopSkuMapper, ShopSku> impl
                 queryWrapper.eq(ObjectUtils.isNotEmpty(shopSku.getSkuId()),ShopSku::getSkuId, shopSku.getSkuId());
                 queryWrapper.eq(ShopSku::getIsDelete, 0);
         IPage<ShopSku> page = shopProdMapper.selectPage(pageParam, queryWrapper);
+
+
         //循环获取sku和渠道价格设置信息
         for (ShopSku record : page.getRecords()) {
+            ShopDetail shopDetail = shopDetailMapper.selectById(record.getShopId());
+            record.setShopName(shopDetail.getShopName());
             record.setSku(skuMapper.selectById(record.getSkuId()));
             List<ChannelProd> channelProds = channelProdMapper.selectListAll(record.getSkuId(), record.getShopId());
             record.setChannelProdList(channelProds);