diff --git a/buyer-api/src/main/resources/application.yml b/buyer-api/src/main/resources/application.yml index fa22d1d5..6de333af 100644 --- a/buyer-api/src/main/resources/application.yml +++ b/buyer-api/src/main/resources/application.yml @@ -150,6 +150,7 @@ ignored: - /buyer/memberEvaluation/**/goodsEvaluation - /buyer/memberEvaluation/**/evaluationNumber - /buyer/appVersion/** + - /buyer/broadcast/studio - /druid/** - /swagger-ui.html - /doc.html diff --git a/config/application.yml b/config/application.yml index 38c732bd..740082ce 100644 --- a/config/application.yml +++ b/config/application.yml @@ -147,6 +147,7 @@ ignored: - /buyer/memberEvaluation/**/goodsEvaluation - /buyer/memberEvaluation/**/evaluationNumber - /buyer/appVersion/** + - /buyer/broadcast/studio/** - /store/login/** - /manager/user/login - /manager/user/refresh/** diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java index c7ba9d46..7ed91670 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Goods.java @@ -182,6 +182,12 @@ public class Goods extends BaseEntity { @ApiModelProperty(value = "销售模式", required = true) private String salesModel; + /** + * @see cn.lili.modules.goods.entity.enums.GoodsTypeEnum + */ + @ApiModelProperty(value = "商品类型", required = true) + private String goodsType; + public Goods() { } @@ -203,6 +209,6 @@ public class Goods extends BaseEntity { this.cost = goodsOperationDTO.getCost(); //如果立即上架则 this.marketEnable = goodsOperationDTO.isRelease() ? GoodsStatusEnum.UPPER.name() : GoodsStatusEnum.DOWN.name(); - + this.goodsType=goodsOperationDTO.getGoodsType(); } } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java index 9e518082..40845f9a 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsOperationDTO.java @@ -16,7 +16,7 @@ import java.util.List; import java.util.Map; /** - * 商品查询条件 + * 商品编辑DTO * * @author pikachu * @date 2020-02-24 19:27:20 @@ -118,4 +118,10 @@ public class GoodsOperationDTO implements Serializable { @ApiModelProperty(value = "是否重新生成sku数据") private Boolean regeneratorSkuFlag = true; + + /** + * @see cn.lili.modules.goods.entity.enums.GoodsTypeEnum + */ + @ApiModelProperty(value = "商品类型") + private String goodsType; } diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsSearchParams.java b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsSearchParams.java index 6edfcb6b..346a913e 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsSearchParams.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dto/GoodsSearchParams.java @@ -67,6 +67,12 @@ public class GoodsSearchParams extends PageVO { @ApiModelProperty(value = "是否为推荐商品") private Boolean recommend; + /** + * @see cn.lili.modules.goods.entity.enums.GoodsTypeEnum + */ + @ApiModelProperty(value = "商品类型") + private String goodsType; + public QueryWrapper queryWrapper() { QueryWrapper queryWrapper = new QueryWrapper<>(); if (StringUtils.isNotEmpty(goodsId)) { @@ -108,6 +114,10 @@ public class GoodsSearchParams extends PageVO { if (recommend != null) { queryWrapper.le("recommend", recommend); } + if (goodsType != null) { + queryWrapper.eq("goods_type", goodsType); + } + queryWrapper.eq("delete_flag", false); this.betweenWrapper(queryWrapper); return queryWrapper; diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/enums/GoodsFreightEnum.java b/framework/src/main/java/cn/lili/modules/goods/entity/enums/GoodsFreightEnum.java deleted file mode 100644 index c89a56c2..00000000 --- a/framework/src/main/java/cn/lili/modules/goods/entity/enums/GoodsFreightEnum.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.lili.modules.goods.entity.enums; - -/** - * 商品运费承担者 - * - * @author pikachu - * @date 2020-02-26 23:24:13 - */ -public enum GoodsFreightEnum { - /** - * 买家承担运费 - */ - BUYER("买家承担运费"), - /** - * 卖家承担运费 - */ - STORE("卖家承担运费"); - - private final String description; - - GoodsFreightEnum(String description) { - this.description = description; - } - - public String description() { - return description; - } -} diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/enums/GoodsTypeEnum.java b/framework/src/main/java/cn/lili/modules/goods/entity/enums/GoodsTypeEnum.java new file mode 100644 index 00000000..db55d23e --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/goods/entity/enums/GoodsTypeEnum.java @@ -0,0 +1,29 @@ +package cn.lili.modules.goods.entity.enums; + +/** + * 商品类型 + * + * @author Bulbasaur + * @date: 2021/5/28 4:23 下午 + */ +public enum GoodsTypeEnum { + + + PHYSICAL_GOODS("实物商品"), + + VIRTUAL_GOODS("虚拟商品"), + + E_COUPON("电子卡券"); + + + private final String description; + + GoodsTypeEnum(String description) { + this.description = description; + } + + public String description() { + return description; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index 6f25a75b..8ffc0aa2 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -101,41 +101,19 @@ public class GoodsServiceImpl extends ServiceImpl implements @Override public void addGoods(GoodsOperationDTO goodsOperationDTO) { - Goods goods = new Goods(goodsOperationDTO); - - //判定商品是否需要审核 - this.checkNeedAuth(goods); - + //检查商品 + this.checkGoods(goods); // 向goods加入图片 this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods); - - //商品添加卖家信息 - StoreVO storeDetail = this.storeService.getStoreDetail(); - goods.setStoreId(storeDetail.getId()); - goods.setStoreName(storeDetail.getStoreName()); - if (storeDetail.getSelfOperated() != null) { - goods.setSelfOperated(storeDetail.getSelfOperated()); - } - // 评论次数 - goods.setCommentNum(0); - // 购买次数 - goods.setBuyCount(0); - // 购买次数 - goods.setQuantity(0); - // 商品评分 - goods.setGrade(100.0); - + //添加商品 this.save(goods); - // 添加商品参数 if (goodsOperationDTO.getGoodsParamsList() != null && !goodsOperationDTO.getGoodsParamsList().isEmpty()) { this.goodsParamsService.addParams(goodsOperationDTO.getGoodsParamsList(), goods.getId()); } - // 添加商品sku信息 this.goodsSkuService.add(goodsOperationDTO.getSkuList(), goods); - // 添加相册 if (goodsOperationDTO.getGoodsGalleryList() != null && !goodsOperationDTO.getGoodsGalleryList().isEmpty()) { this.goodsGalleryService.add(goodsOperationDTO.getGoodsGalleryList(), goods.getId()); @@ -145,35 +123,25 @@ public class GoodsServiceImpl extends ServiceImpl implements @Override public void editGoods(GoodsOperationDTO goodsOperationDTO, String goodsId) { - this.checkExist(goodsId); Goods goods = new Goods(goodsOperationDTO); goods.setId(goodsId); - - //是否需要审核 - this.checkNeedAuth(goods); - + //检查商品信息 + this.checkGoods(goods); // 向goods加入图片 this.setGoodsGalleryParam(goodsOperationDTO.getGoodsGalleryList().get(0), goods); - - //商品添加卖家信息 - StoreVO storeDetail = this.storeService.getStoreDetail(); - if (storeDetail.getSelfOperated() != null) { - goods.setSelfOperated(storeDetail.getSelfOperated()); - } - goods.setStoreId(storeDetail.getId()); - goods.setStoreName(storeDetail.getStoreName()); - //修改商品 this.updateById(goods); - // 添加商品参数 - this.goodsParamsService.addParams(goodsOperationDTO.getGoodsParamsList(), goods.getId()); - - //修改商品规格 + if (goodsOperationDTO.getGoodsParamsList() != null && !goodsOperationDTO.getGoodsParamsList().isEmpty()) { + this.goodsParamsService.addParams(goodsOperationDTO.getGoodsParamsList(), goods.getId()); + } + //修改商品sku信息 this.goodsSkuService.update(goodsOperationDTO.getSkuList(), goods, goodsOperationDTO.getRegeneratorSkuFlag()); - // 添加相册 - this.goodsGalleryService.add(goodsOperationDTO.getGoodsGalleryList(), goods.getId()); + if (goodsOperationDTO.getGoodsGalleryList() != null && !goodsOperationDTO.getGoodsGalleryList().isEmpty()) { + this.goodsGalleryService.add(goodsOperationDTO.getGoodsGalleryList(), goods.getId()); + } + } @Override @@ -353,16 +321,62 @@ public class GoodsServiceImpl extends ServiceImpl implements } /** - * 商品是否需要审核 + * 检查商品信息 + * 如果商品是虚拟商品则无需配置配送模板 + * 如果商品是实物商品需要配置配送模板 + * 判断商品是否存在 + * 判断商品是否需要审核 + * 判断当前用户是否为店铺 * * @param goods 商品 */ - private void checkNeedAuth(Goods goods) { + private void checkGoods(Goods goods) { + //判断商品类型 + switch (goods.getGoodsType()) { + case "PHYSICAL_GOODS": + if (goods.getTemplateId() == null) { + throw new ServiceException("实物商品需选择配送模板"); + } + break; + case "VIRTUAL_GOODS": + if (goods.getTemplateId() != null) { + throw new ServiceException("虚拟商品不需要选择配送模板"); + } + break; + default: + throw new ServiceException("需选择商品类型"); + } + //检查商品是否存在--修改商品时使用 + if (goods.getId() != null) { + this.checkExist(goods.getId()); + } else { + // 评论次数 + goods.setCommentNum(0); + // 购买次数 + goods.setBuyCount(0); + // 购买次数 + goods.setQuantity(0); + // 商品评分 + goods.setGrade(100.0); + } + //获取商品系统配置决定是否审核 Setting setting = settingService.get(SettingEnum.GOODS_SETTING.name()); GoodsSetting goodsSetting = JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class); //是否需要审核 goods.setIsAuth(Boolean.TRUE.equals(goodsSetting.getGoodsCheck()) ? GoodsAuthEnum.TOBEAUDITED.name() : GoodsAuthEnum.PASS.name()); + //判断当前用户是否为店铺 + if (UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) { + StoreVO storeDetail = this.storeService.getStoreDetail(); + if (storeDetail.getSelfOperated() != null) { + goods.setSelfOperated(storeDetail.getSelfOperated()); + } + goods.setStoreId(storeDetail.getId()); + goods.setStoreName(storeDetail.getStoreName()); + goods.setSelfOperated(storeDetail.getSelfOperated()); + } else { + throw new ServiceException("当前未登录店铺"); + } } /** diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java index 9aa5d281..917a5baa 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/Order.java @@ -184,7 +184,7 @@ public class Order extends BaseEntity { private Boolean canReturn; @ApiModelProperty(value = "提货码") - private String qrCode; + private String verificationCode; @ApiModelProperty(value = "分销员ID") private String distributionId; diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java index cd59e1b5..0ef83e44 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dos/OrderItem.java @@ -56,27 +56,38 @@ public class OrderItem extends BaseEntity { @ApiModelProperty(value = "商品ID") private String goodsId; + @ApiModelProperty(value = "货品ID") private String skuId; + @ApiModelProperty(value = "销售量") private Integer num; + @ApiModelProperty(value = "交易编号") private String tradeSn; + @ApiModelProperty(value = "图片") private String image; + @ApiModelProperty(value = "商品名称") private String goodsName; + @ApiModelProperty(value = "分类ID") private String categoryId; + @ApiModelProperty(value = "快照id") private String snapshotId; + @ApiModelProperty(value = "规格json") @Column(columnDefinition = "TEXT") private String specs; + @ApiModelProperty(value = "促销类型") private String promotionType; + @ApiModelProperty(value = "促销id") private String promotionId; + @ApiModelProperty(value = "销售金额") private Double goodsPrice; diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java index 7d5869da..5ec15a54 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/OrderServiceImpl.java @@ -282,7 +282,7 @@ public class OrderServiceImpl extends ServiceImpl implements //填写提货码 String code = CommonUtil.getRandomNum(); orderLambdaUpdateWrapper.eq(Order::getSn, orderSn); - orderLambdaUpdateWrapper.set(Order::getQrCode, code); + orderLambdaUpdateWrapper.set(Order::getVerificationCode, code); orderLambdaUpdateWrapper.set(Order::getOrderStatus, OrderStatusEnum.TAKE.name()); orderLambdaUpdateWrapper.set(Order::getCanReturn, !PaymentMethodEnum.BANK_TRANSFER.name().equals(order.getPaymentMethod())); @@ -395,8 +395,8 @@ public class OrderServiceImpl extends ServiceImpl implements } @Override - @OrderLogPoint(description = "'订单['+#orderSn+']核销,核销码['+#qrCode+']'", orderSn = "#orderSn") - public Order take(String orderSn, String qrCode) { + @OrderLogPoint(description = "'订单['+#orderSn+']核销,核销码['+#verificationCode+']'", orderSn = "#orderSn") + public Order take(String orderSn, String verificationCode) { //是否可以查询到订单 Order order = OperationalJudgment.judgment(this.getBySn(orderSn)); //判断是否为虚拟订单 @@ -406,7 +406,7 @@ public class OrderServiceImpl extends ServiceImpl implements //判断虚拟订单状态 if (order.getOrderStatus().equals(OrderStatusEnum.TAKE.name())) { //判断提货码是否正确\修改订单状态 - if (order.getOrderStatus().equals(OrderStatusEnum.TAKE.name()) && qrCode.equals(order.getQrCode())) { + if (order.getOrderStatus().equals(OrderStatusEnum.TAKE.name()) && verificationCode.equals(order.getVerificationCode())) { order.setOrderStatus(OrderStatusEnum.COMPLETED.name()); this.updateById(order); diff --git a/framework/src/main/java/cn/lili/modules/store/entity/vos/StoreBasicInfoVO.java b/framework/src/main/java/cn/lili/modules/store/entity/vos/StoreBasicInfoVO.java index af85fc2b..7d54992f 100644 --- a/framework/src/main/java/cn/lili/modules/store/entity/vos/StoreBasicInfoVO.java +++ b/framework/src/main/java/cn/lili/modules/store/entity/vos/StoreBasicInfoVO.java @@ -14,7 +14,7 @@ import lombok.Data; public class StoreBasicInfoVO { @ApiModelProperty(value = "店铺ID") - private Long storeId; + private String storeId; @ApiModelProperty(value = "店铺名称") private String storeName;