Browse Source

店铺管理--商品增加分销逻辑

Gaosheng 5 ngày trước cách đây
mục cha
commit
aa1f48e8e9

+ 4 - 0
xinkeaboard-server/b2b2c-entity/src/main/java/com/slodon/b2b2c/goods/dto/GoodsPublishFrontParamDTO.java

@@ -13,10 +13,14 @@ import java.util.List;
 @Data
 public class GoodsPublishFrontParamDTO implements Serializable {
     private static final long serialVersionUID = -3375423352936079110L;
+
     //编辑用的id
     @ApiModelProperty(value = "商品id,编辑商品时必传")
     private Long goodsId;
 
+    @ApiModelProperty(value = "发布渠道:1-海外站;2-国内站,默认1")
+    private Integer distributionChannel = 1;
+
     @ApiModelProperty(value = "是否是虚拟商品:1-实物商品;2-虚拟商品,默认1", required = true)
     private Integer isVirtualGoods = 1;
 

+ 2 - 0
xinkeaboard-server/b2b2c-entity/src/main/java/com/slodon/b2b2c/goods/dto/GoodsPublishInsertDTO.java

@@ -26,6 +26,8 @@ public class GoodsPublishInsertDTO extends GoodsPublishFrontParamDTO {
     private ProductInsertInfo defaultProduct;
     @ApiModelProperty(value ="主规格id")
     private Integer mainSpecId = 0;
+    @ApiModelProperty(value ="发布渠道 1-海外站;2-国内站")
+    private Integer distributionChannel = 1;
 
     public GoodsPublishInsertDTO(GoodsPublishFrontParamDTO paramDTO) {
         //复制属性

+ 5 - 0
xinkeaboard-server/b2b2c-entity/src/main/java/com/slodon/b2b2c/goods/example/GoodsExample.java

@@ -40,6 +40,11 @@ public class GoodsExample implements Serializable {
     private Long goodsId;
 
     /**
+     * 发布渠道  1-海外站;2-国内站
+     */
+    private Integer distributionChannel;
+
+    /**
      * 商品名称为3到50个字符(商品副标题)
      */
     private String goodsName;

+ 3 - 0
xinkeaboard-server/b2b2c-entity/src/main/java/com/slodon/b2b2c/goods/pojo/Goods.java

@@ -19,6 +19,9 @@ public class Goods implements Serializable {
     @ApiModelProperty("商品ID")
     private Long goodsId;
 
+    @ApiModelProperty("发布渠道 1-海外站;2-国内站")
+    private Integer distributionChannel;
+
     @ApiModelProperty("商品名称为3到50个字符(商品副标题)")
     private String goodsName;
 

+ 7 - 4
xinkeaboard-server/b2b2c-web/src/main/java/com/slodon/b2b2c/controller/goods/seller/GoodsSellerController.java

@@ -100,18 +100,20 @@ public class GoodsSellerController extends BaseController {
             @ApiImplicitParam(name = "isVirtualGoods", value = "是否是虚拟商品:1-实物商品;2-虚拟商品", paramType = "query"),
             @ApiImplicitParam(name = "goodsCode", value = "商品货号", paramType = "query"),
             @ApiImplicitParam(name = "barCode", value = "商品条形码", paramType = "query"),
+            @ApiImplicitParam(name = "distributionChannel", value = "发布渠道", paramType = "query"),
             @ApiImplicitParam(name = "pageSize", value = "分页大小", defaultValue = "20", paramType = "query"),
             @ApiImplicitParam(name = "current", value = "当前页面位置", defaultValue = "1", paramType = "query")
     })
     @GetMapping("list")
     public JsonResult<PageVO<GoodsVO>> getList(HttpServletRequest request, String goodsName, Integer StoreCategoryId,
                                                Date startTime, Date endTime, Integer state, Integer auditState,
-                                               Integer isVirtualGoods, String goodsCode, String barCode) {
+                                               Integer isVirtualGoods, String goodsCode, String barCode,@RequestParam(value = "distributionChannel", required = false, defaultValue = "1") Integer distributionChannel) {
         Vendor vendor = UserUtil.getUser(request, Vendor.class);
         PagerInfo pager = WebUtil.handlerPagerInfo(request);
         GoodsExample example = new GoodsExample();
         example.setStoreId(vendor.getStoreId());
         example.setGoodsNameLike(goodsName);
+        example.setDistributionChannel(distributionChannel);
         if (!StringUtil.isNullOrZero(StoreCategoryId)) {
             StoreInnerLabel storeInnerLabel = storeInnerLabelModel.getStoreInnerLabelByInnerLabelId(StoreCategoryId);
             AssertUtil.notNull(storeInnerLabel, "店铺内部分类不存在");
@@ -426,7 +428,7 @@ public class GoodsSellerController extends BaseController {
         Vendor vendor = UserUtil.getUser(request, Vendor.class);
 
         //校验是否可以发布商品
-        if (!checkIsCanPublish(vendor.getStoreId())) {
+        if (!checkIsCanPublish(vendor.getStoreId(), paramDTO.getDistributionChannel())) {
             return SldResponse.fail("发布商品数量不允许超过店铺等级限制的数量");
         }
 
@@ -549,7 +551,7 @@ public class GoodsSellerController extends BaseController {
                 }
             }
         }
-        if (checkIsCanPublish(vendor.getStoreId())) {
+        if (checkIsCanPublish(vendor.getStoreId(),1)) {
             return SldResponse.success();
         } else {
             return SldResponse.fail("发布商品数量不允许超过店铺等级限制的数量");
@@ -562,7 +564,7 @@ public class GoodsSellerController extends BaseController {
      * @param storeId 店铺id
      * @return 是否可发布商品
      */
-    public boolean checkIsCanPublish(Long storeId) {
+    public boolean checkIsCanPublish(Long storeId,Integer distributionChannel) {
         boolean isCanPublish = true;
         //获取店铺信息
         Store storeDb = storeModel.getStoreByStoreId(storeId);
@@ -575,6 +577,7 @@ public class GoodsSellerController extends BaseController {
             GoodsExample example = new GoodsExample();
             example.setStoreId(storeId);
             example.setStateNotEquals(GoodsConst.GOODS_STATE_DELETE);
+            example.setDistributionChannel(distributionChannel);
             List<Goods> goodsList = goodsModel.getGoodsList(example, null);
             if (goodsList.size() >= storeGradeDb.getGoodsLimit()) {
                 isCanPublish = false;

+ 2 - 0
xinkeaboard-server/b2b2c-web/src/main/java/com/slodon/b2b2c/model/goods/GoodsSellerModel.java

@@ -196,6 +196,7 @@ public class GoodsSellerModel {
         GoodsCategory goodsCategory1 = goodsCategoryModel.getGoodsCategoryByCategoryId(goodsCategory2.getPid());
 
         Goods goods = new Goods();
+        goods.setDistributionChannel(insertDTO.getDistributionChannel());
         goods.setGoodsId(goodsId);
         goods.setGoodsName(insertDTO.getGoodsName());
         goods.setGoodsBrief(insertDTO.getGoodsBrief());
@@ -215,6 +216,7 @@ public class GoodsSellerModel {
                 goodsRecommendExample.setStoreId(vendor.getStoreId());
                 goodsRecommendExample.setStateNotEquals(GoodsConst.GOODS_STATE_DELETE);
                 goodsRecommendExample.setStoreIsRecommend(GoodsConst.IS_RECOMMEND_YES);
+                goodsRecommendExample.setDistributionChannel(insertDTO.getDistributionChannel());
                 List<Goods> goodsRecommends = goodsModel.getGoodsList(goodsRecommendExample, null);
                 //获取该店铺推荐限制数
                 StoreGrade storeGradeDb = storeGradeReadMapper.getByPrimaryKey(storeDb.getStoreGradeId());

+ 16 - 0
xinkeaboard-server/b2b2c-web/src/main/resources/mapper/write/goods/GoodsWriteMapper.xml

@@ -3,6 +3,7 @@
 <mapper namespace="com.slodon.b2b2c.dao.write.goods.GoodsWriteMapper">
   <resultMap id="resultMap" type="com.slodon.b2b2c.goods.pojo.Goods">
     <id column="goods_id" property="goodsId" />
+    <result column="distribution_channel" property="distributionChannel" />
     <result column="goods_name" property="goodsName" />
     <result column="goods_brief" property="goodsBrief" />
     <result column="keyword" property="keyword" />
@@ -54,6 +55,9 @@
       <if test="goodsId != null">
         `goods_id`,
       </if>
+      <if test="distributionChannel != null">
+        `distribution_channel`,
+      </if>
       <if test="goodsName != null">
         `goods_name`,
       </if>
@@ -202,6 +206,9 @@
         <if test="example.goodsIdIn != null">
           AND `goods_id` in (${example.goodsIdIn})
         </if>
+        <if test="example.distributionChannel != null">
+          AND `distribution_channel` = #{example.distributionChannel}
+        </if>
         <if test="example.goodsName != null">
           AND `goods_name` = #{example.goodsName}
         </if>
@@ -492,6 +499,9 @@
       <if test="goodsId != null">
         #{goodsId},
       </if>
+      <if test="distributionChannel != null">
+        #{distributionChannel},
+      </if>
       <if test="goodsName != null">
         #{goodsName},
       </if>
@@ -631,6 +641,9 @@
   <update id="updateByExampleSelective">
     UPDATE `goods`
     <trim prefix="SET" suffixOverrides=",">
+      <if test="record.distributionChannel != null">
+        `distribution_channel` = #{record.distributionChannel},
+      </if>
       <if test="record.goodsName != null">
         `goods_name` = #{record.goodsName},
       </if>
@@ -770,6 +783,9 @@
   <update id="updateByPrimaryKeySelective">
     UPDATE `goods`
     <trim prefix="SET" suffixOverrides=",">
+      <if test="distributionChannel != null">
+        `distribution_channel` = #{distributionChannel},
+      </if>
       <if test="goodsName != null">
         `goods_name` = #{goodsName},
       </if>

+ 0 - 4
xinkeaboard-server/doc/DDL/member.sql

@@ -1,4 +0,0 @@
-ALTER TABLE member
-ADD COLUMN country VARCHAR(100) NULL COMMENT '国家',
-ADD COLUMN city VARCHAR(100) NULL COMMENT '城市',
-ADD COLUMN member_type TINYINT NOT NULL DEFAULT 1 COMMENT '会员类型 1:海外门户 2:国内分销门户';

+ 8 - 0
xinkeaboard-server/doc/DDL/update.sql

@@ -0,0 +1,8 @@
+ALTER TABLE member
+ADD COLUMN country VARCHAR(100) NULL COMMENT '国家',
+ADD COLUMN city VARCHAR(100) NULL COMMENT '城市',
+ADD COLUMN member_type TINYINT NOT NULL DEFAULT 1 COMMENT '会员类型 1:海外门户 2:国内分销门户';
+
+
+ALTER TABLE goods
+ADD COLUMN distribution_channel TINYINT NOT NULL DEFAULT 1 COMMENT '发布渠道 1:国外站 2:国内站' AFTER goods_id;