Browse Source

修改创建装修模板

gaohp 11 months ago
parent
commit
f8433f7216
14 changed files with 115 additions and 17 deletions
  1. 9 0
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/spu/ProductSpuController.java
  2. 9 0
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuService.java
  3. 22 0
      feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuServiceImpl.java
  4. 10 0
      feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/controller/admin/diy/DiyTemplateController.java
  5. 23 0
      feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/controller/admin/diy/vo/template/DiyTemplateCreateReqByMerVO.java
  6. 7 3
      feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/controller/admin/diy/vo/template/DiyTemplateCreateReqVO.java
  7. 2 0
      feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/convert/diy/DiyTemplateConvert.java
  8. 5 1
      feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/dal/dataobject/diy/DiyTemplateDO.java
  9. 1 4
      feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/service/diy/DiyTemplateService.java
  10. 3 4
      feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/service/diy/DiyTemplateServiceImpl.java
  11. 1 1
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/MerchantController.java
  12. 2 1
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchant/MerchantService.java
  13. 8 3
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchant/MerchantServiceImpl.java
  14. 13 0
      sql/mysql/建空库SQL/1_20240227.sql

+ 9 - 0
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/admin/spu/ProductSpuController.java

@@ -124,6 +124,15 @@ public class ProductSpuController {
         return success(productSpuService.getTabsCount());
     }
 
+    @GetMapping("/get-count-by-mer")
+    @Operation(summary = "获得商品 SPU 分页 tab count")
+    @PreAuthorize("@ss.hasPermission('product:spu:query')")
+    public CommonResult<Map<Integer, Long>> getSpuCountByMer(@RequestParam("merId") Long merId) {
+        return success(productSpuService.getTabsCount(merId));
+    }
+
+
+
     @GetMapping("/export")
     @Operation(summary = "导出商品")
     @PreAuthorize("@ss.hasPermission('product:spu:export')")

+ 9 - 0
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuService.java

@@ -103,6 +103,15 @@ public interface ProductSpuService {
      */
     Map<Integer, Long> getTabsCount();
 
+
+    /**
+     * 获取 SPU 列表标签对应的 Count 数量
+     *
+     * @return Count 数量
+     */
+    Map<Integer, Long> getTabsCount(Long merId);
+
+
     /**
      * 通过分类 categoryId 查询 SPU 个数
      *

+ 22 - 0
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/service/spu/ProductSpuServiceImpl.java

@@ -272,6 +272,28 @@ public class ProductSpuServiceImpl implements ProductSpuService {
         return counts;
     }
 
+    @Override
+    public Map<Integer, Long> getTabsCount(Long merId) {
+        Map<Integer, Long> counts = Maps.newLinkedHashMapWithExpectedSize(5);
+        // 查询销售中的商品数量
+        counts.put(ProductSpuPageReqVO.FOR_SALE,
+                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus()));
+        // 查询仓库中的商品数量
+        counts.put(ProductSpuPageReqVO.IN_WAREHOUSE,
+                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.DISABLE.getStatus()));
+        // 查询售空的商品数量
+        counts.put(ProductSpuPageReqVO.SOLD_OUT,
+                productSpuMapper.selectCount(ProductSpuDO::getStock, 0));
+        // 查询触发警戒库存的商品数量
+        counts.put(ProductSpuPageReqVO.ALERT_STOCK,
+                productSpuMapper.selectCount());
+        // 查询回收站中的商品数量
+        counts.put(ProductSpuPageReqVO.RECYCLE_BIN,
+                productSpuMapper.selectCount(ProductSpuDO::getStatus, ProductSpuStatusEnum.RECYCLE.getStatus()));
+        return counts;
+    }
+
+
     @Override
     public Long getSpuCountByCategoryId(Long categoryId) {
         return productSpuMapper.selectCount(ProductSpuDO::getCategoryId, categoryId);

+ 10 - 0
feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/controller/admin/diy/DiyTemplateController.java

@@ -40,6 +40,16 @@ public class DiyTemplateController {
         return success(diyTemplateService.createDiyTemplate(createReqVO));
     }
 
+    @PostMapping("/createByMer")
+    @Operation(summary = "创建装修模板")
+    @PreAuthorize("@ss.hasPermission('promotion:diy-template:create')")
+    public CommonResult<Long> createDiyTemplate2(@Valid @RequestBody DiyTemplateCreateReqVO createReqVO) {
+        return success(diyTemplateService.createDiyTemplate(createReqVO));
+    }
+
+
+
+
     @PutMapping("/update")
     @Operation(summary = "更新装修模板")
     @PreAuthorize("@ss.hasPermission('promotion:diy-template:update')")

+ 23 - 0
feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/controller/admin/diy/vo/template/DiyTemplateCreateReqByMerVO.java

@@ -0,0 +1,23 @@
+package cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+@Schema(description = "管理后台 - 装修模板创建 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class DiyTemplateCreateReqByMerVO extends DiyTemplateBaseVO {
+
+    @Schema(description = "店铺ID",  example = "123")
+    private Long shopId;
+
+    @Schema(description = "商户ID", example = "12")
+    private Long merId;
+
+}

+ 7 - 3
feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/controller/admin/diy/vo/template/DiyTemplateCreateReqVO.java

@@ -1,9 +1,7 @@
 package cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template;
 
 import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
+import lombok.*;
 
 @Schema(description = "管理后台 - 装修模板创建 Request VO")
 @Data
@@ -11,4 +9,10 @@ import lombok.ToString;
 @ToString(callSuper = true)
 public class DiyTemplateCreateReqVO extends DiyTemplateBaseVO {
 
+    @Schema(description = "店铺ID",  example = "123")
+    private Long shopId;
+
+    @Schema(description = "商户ID", example = "12")
+    private Long merId;
+
 }

+ 2 - 0
feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/convert/diy/DiyTemplateConvert.java

@@ -22,6 +22,8 @@ public interface DiyTemplateConvert {
 
     DiyTemplateDO convert(DiyTemplateCreateReqVO bean);
 
+
+
     DiyTemplateDO convert(DiyTemplateUpdateReqVO bean);
 
     DiyTemplateRespVO convert(DiyTemplateDO bean);

+ 5 - 1
feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/dal/dataobject/diy/DiyTemplateDO.java

@@ -13,7 +13,7 @@ import java.util.List;
 
 /**
  * 装修模板 DO
- *
+ * <p>
  * 1. 新建一个模版,下面可以包含多个 {@link DiyPageDO} 页面,例如说首页、我的
  * 2. 如果需要使用某个模版,则将 {@link #used} 设置为 true,表示已使用,有且仅有一个
  *
@@ -61,4 +61,8 @@ public class DiyTemplateDO extends BaseDO {
      */
     private String property;
 
+    private Long shopId;
+
+    private Long merId;
+
 }

+ 1 - 4
feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/service/diy/DiyTemplateService.java

@@ -1,10 +1,7 @@
 package cn.newfeifan.mall.module.promotion.service.diy;
 
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
-import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.DiyTemplateCreateReqVO;
-import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO;
-import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.DiyTemplatePropertyUpdateRequestVO;
-import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.DiyTemplateUpdateReqVO;
+import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.*;
 import cn.newfeifan.mall.module.promotion.dal.dataobject.diy.DiyTemplateDO;
 
 import javax.validation.Valid;

+ 3 - 4
feifan-module-mall/feifan-module-promotion-biz/src/main/java/cn/newfeifan/mall/module/promotion/service/diy/DiyTemplateServiceImpl.java

@@ -3,10 +3,7 @@ package cn.newfeifan.mall.module.promotion.service.diy;
 import cn.hutool.core.util.BooleanUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.newfeifan.mall.framework.common.pojo.PageResult;
-import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.DiyTemplateCreateReqVO;
-import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.DiyTemplatePageReqVO;
-import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.DiyTemplatePropertyUpdateRequestVO;
-import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.DiyTemplateUpdateReqVO;
+import cn.newfeifan.mall.module.promotion.controller.admin.diy.vo.template.*;
 import cn.newfeifan.mall.module.promotion.convert.diy.DiyPageConvert;
 import cn.newfeifan.mall.module.promotion.convert.diy.DiyTemplateConvert;
 import cn.newfeifan.mall.module.promotion.dal.dataobject.diy.DiyTemplateDO;
@@ -51,6 +48,8 @@ public class DiyTemplateServiceImpl implements DiyTemplateService {
         return diyTemplate.getId();
     }
 
+
+
     /**
      * 创建模板下面的默认页面
      * 默认创建两个页面:首页、我的

+ 1 - 1
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/MerchantController.java

@@ -51,7 +51,7 @@ public class MerchantController {
     @PostMapping("/create")
     @Operation(summary = "创建商户")
     @PreAuthorize("@ss.hasPermission('sale:merchant:create')")
-    public CommonResult<Long> createMerchant(@Valid @RequestBody MerchantSaveReqVO createReqVO) {
+    public CommonResult<HashMap<String, Long>> createMerchant(@Valid @RequestBody MerchantSaveReqVO createReqVO) {
         return success(merchantService.createMerchant(createReqVO));
     }
 

+ 2 - 1
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchant/MerchantService.java

@@ -6,6 +6,7 @@ import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantSaveReqVO;
 import cn.newfeifan.mall.sale.dal.dataobject.merchant.MerchantDO;
 
 import javax.validation.*;
+import java.util.HashMap;
 
 /**
  * 商户 Service 接口
@@ -20,7 +21,7 @@ public interface MerchantService {
      * @param createReqVO 创建信息
      * @return 编号
      */
-    Long createMerchant(@Valid MerchantSaveReqVO createReqVO);
+    HashMap<String, Long> createMerchant(@Valid MerchantSaveReqVO createReqVO);
 
     /**
      * 更新商户

+ 8 - 3
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchant/MerchantServiceImpl.java

@@ -20,6 +20,8 @@ import org.springframework.validation.annotation.Validated;
 import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 
 
+import java.util.HashMap;
+
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.newfeifan.mall.module.enums.ErrorCodeConstants.MERCHANT_NOT_EXISTS;
 import static cn.newfeifan.mall.module.system.enums.ErrorCodeConstants.USER_MOBILE_EXISTS;
@@ -46,13 +48,13 @@ public class MerchantServiceImpl implements MerchantService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Long createMerchant(MerchantSaveReqVO createReqVO) {
+    public HashMap<String, Long> createMerchant(MerchantSaveReqVO createReqVO) {
         // 插入
         MerchantDO merchant = BeanUtils.toBean(createReqVO, MerchantDO.class);
         merchantMapper.insert(merchant);
 
         // 创建一个店铺
-        shopService.createShop(merchant);
+        Long shopId = shopService.createShop(merchant);
         // 创建商户的时候, 根据手机号, 创建一个新的账号
         // 如果这个手机号已经存在, 则提示该手机号已经存在
         AdminUserDO adminUserDO = userMapper.selectByMobile(merchant.getContactNumber());
@@ -61,7 +63,10 @@ public class MerchantServiceImpl implements MerchantService {
         }
         adminUserService.createUserByMobile(merchant.getId(), merchant.getContactNumber(), merchant.getContact());
         // todo 设置直推人关联关系
-        return merchant.getId();
+        HashMap<String, Long> stringLongHashMap = new HashMap<>();
+        stringLongHashMap.put("shopId", shopId);
+        stringLongHashMap.put("merId", merchant.getId());
+        return stringLongHashMap;
     }
 
     @Override

+ 13 - 0
sql/mysql/建空库SQL/1_20240227.sql

@@ -147,3 +147,16 @@ ALTER TABLE `sale_shop` ADD COLUMN `website` varchar(255) CHARACTER SET utf8mb4
 ALTER TABLE `sale_merchant` MODIFY COLUMN `website` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '域名' AFTER `contact_number`;
 
 ALTER TABLE `sale_merchant` ADD COLUMN `business_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商户官网' AFTER `website`;
+
+-- 2024 04 01 给商户模板diy页面以及模板页面添加商户ID以及店铺ID
+
+ALTER TABLE `promotion_diy_template` ADD COLUMN `merchant_id` bigint(0) NULL DEFAULT NULL COMMENT '商户ID' AFTER `deleted`;
+
+ALTER TABLE `promotion_diy_template` ADD COLUMN `shop_id` bigint(0) NULL DEFAULT NULL COMMENT '店铺ID' AFTER `merchant_id`;
+
+ALTER TABLE `promotion_diy_page` ADD COLUMN `shop_id` bigint(0) NULL DEFAULT NULL COMMENT '店铺ID' AFTER `deleted`;
+
+ALTER TABLE `promotion_diy_page` ADD COLUMN `merchant_id` bigint(0) NULL DEFAULT NULL COMMENT '商户ID' AFTER `shop_id`;
+
+
+