From fff067b1a6925a7bd3f29001226b5f9d4d4652e4 Mon Sep 17 00:00:00 2001 From: xuwenbo <717567226@qq.com> Date: Wed, 12 Aug 2020 16:55:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=95=86=E5=93=81=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4=E5=90=8C=E6=AD=A5=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=9B=B4=E6=92=AD=E9=97=B4=E7=9A=84=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E6=B7=BB=E5=8A=A0=E5=85=B3=E8=81=94=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/yx_wechat_live.sql | 25 ++++++------ .../modules/wechat/domain/YxWechatLive.java | 1 + .../wechat/service/dto/YxWechatLiveDto.java | 12 +++++- .../service/dto/YxWechatLiveGoodsDto.java | 2 +- .../impl/YxWechatLiveGoodsServiceImpl.java | 5 +-- .../service/impl/YxWechatLiveServiceImpl.java | 40 ++++++++++++------- .../wechat/rest/YxWechatLiveController.java | 0 .../rest/YxWechatLiveGoodsController.java | 0 8 files changed, 52 insertions(+), 33 deletions(-) rename {yshop-mall => yshop-shop}/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveController.java (100%) rename {yshop-mall => yshop-shop}/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveGoodsController.java (100%) diff --git a/sql/yx_wechat_live.sql b/sql/yx_wechat_live.sql index 17ba7d26..a25129aa 100644 --- a/sql/yx_wechat_live.sql +++ b/sql/yx_wechat_live.sql @@ -11,7 +11,7 @@ Target Server Version : 50729 File Encoding : 65001 - Date: 11/08/2020 11:22:41 + Date: 12/08/2020 16:51:47 */ SET NAMES utf8mb4; @@ -24,19 +24,20 @@ DROP TABLE IF EXISTS `yx_wechat_live`; CREATE TABLE `yx_wechat_live` ( `roomid` bigint(11) NOT NULL COMMENT '直播间id', `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '直播间标题', - `cover_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '背景图', - `share_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '分享图片', + `cover_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '背景图', + `share_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分享图片', `live_status` int(9) NULL DEFAULT NULL COMMENT '直播间状态', - `start_time` bigint(11) NOT NULL COMMENT '开始时间', - `end_time` bigint(11) NOT NULL COMMENT '预计结束时间', - `anchor_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主播昵称', - `anchor_wechat` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主播微信号', + `start_time` bigint(11) NULL DEFAULT NULL COMMENT '开始时间', + `end_time` bigint(11) NULL DEFAULT NULL COMMENT '预计结束时间', + `anchor_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主播昵称', + `anchor_wechat` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主播微信号', `anchor_imge` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主播头像', - `type` tinyint(1) NOT NULL COMMENT '直播间类型 1:推流 0:手机直播', - `screen_type` tinyint(1) NOT NULL COMMENT '横屏、竖屏 【1:横屏,0:竖屏】', - `close_like` tinyint(1) NOT NULL COMMENT '是否关闭点赞 【0:开启,1:关闭】', - `close_comment` tinyint(1) NOT NULL COMMENT '是否关闭评论 【0:开启,1:关闭】', - `close_goods` tinyint(1) NOT NULL COMMENT '是否关闭货架 【0:开启,1:关闭】', + `type` tinyint(1) NULL DEFAULT NULL COMMENT '直播间类型 1:推流 0:手机直播', + `screen_type` tinyint(1) NULL DEFAULT NULL COMMENT '横屏、竖屏 【1:横屏,0:竖屏】', + `close_like` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭点赞 【0:开启,1:关闭】', + `close_comment` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭评论 【0:开启,1:关闭】', + `close_goods` tinyint(1) NULL DEFAULT NULL COMMENT '是否关闭货架 【0:开启,1:关闭】', + `product_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品id 多个,分割', PRIMARY KEY (`roomid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; diff --git a/yshop-mall/src/main/java/co/yixiang/modules/wechat/domain/YxWechatLive.java b/yshop-mall/src/main/java/co/yixiang/modules/wechat/domain/YxWechatLive.java index 054e2ed7..72012025 100644 --- a/yshop-mall/src/main/java/co/yixiang/modules/wechat/domain/YxWechatLive.java +++ b/yshop-mall/src/main/java/co/yixiang/modules/wechat/domain/YxWechatLive.java @@ -119,6 +119,7 @@ public class YxWechatLive implements Serializable { @NotNull private Integer closeComment; + private String productId; public void copy(YxWechatLive source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); diff --git a/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/dto/YxWechatLiveDto.java b/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/dto/YxWechatLiveDto.java index dd9e4793..6444312e 100644 --- a/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/dto/YxWechatLiveDto.java +++ b/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/dto/YxWechatLiveDto.java @@ -10,6 +10,8 @@ package co.yixiang.modules.wechat.service.dto; import lombok.Data; import java.io.Serializable; +import java.util.List; + import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; @@ -62,9 +64,17 @@ public class YxWechatLiveDto implements Serializable { /** 横屏、竖屏 【1:横屏,0:竖屏】 */ private Integer screenType; - /** 是否关闭货架 【0:开启,1:关闭】 */ + /** 是否关闭点赞 【0:开启,1:关闭】 */ private Integer closeLike; /** 是否关闭评论 【0:开启,1:关闭】 */ private Integer closeComment; + + /** 是否关闭货架 【0:开启,1:关闭】 */ + private Integer closeGoods; + /** + * 关联商品id多个,隔开 + */ + private String productId; + private List product; } diff --git a/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/dto/YxWechatLiveGoodsDto.java b/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/dto/YxWechatLiveGoodsDto.java index 56bebf1a..de393233 100644 --- a/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/dto/YxWechatLiveGoodsDto.java +++ b/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/dto/YxWechatLiveGoodsDto.java @@ -51,7 +51,7 @@ public class YxWechatLiveGoodsDto implements Serializable { private String thirdPartyTag; /** 审核单id */ - private Long auditid; + private Long auditId; /** 审核状态 0:未审核,1:审核中,2:审核通过,3审核失败 */ private Integer auditStatus; diff --git a/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/impl/YxWechatLiveGoodsServiceImpl.java b/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/impl/YxWechatLiveGoodsServiceImpl.java index efa314b3..ca56052b 100644 --- a/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/impl/YxWechatLiveGoodsServiceImpl.java +++ b/yshop-mall/src/main/java/co/yixiang/modules/wechat/service/impl/YxWechatLiveGoodsServiceImpl.java @@ -80,9 +80,6 @@ public class YxWechatLiveGoodsServiceImpl extends BaseServiceImpl convert = generator.convert(liveInfos.getGoods(), YxWechatLiveGoods.class); - convert.forEach(i ->{ - i.setCoverImgeUrl(i.getCoverImgUrl()); - }); this.saveOrUpdateBatch(convert); } catch (WxErrorException e) { e.printStackTrace(); @@ -178,7 +175,7 @@ public class YxWechatLiveGoodsServiceImpl extends BaseServiceImpl liveInfos = wxMaLiveService.getLiveInfos(); List convert = generator.convert(liveInfos, YxWechatLive.class); - convert.forEach(i ->{ - i.setAnchorImge(i.getAnchorImg()); - i.setCoverImge(i.getCoverImg()); - i.setShareImge(i.getShareImg()); - }); this.saveOrUpdateBatch(convert); } catch (WxErrorException e) { e.printStackTrace(); @@ -99,7 +93,14 @@ public class YxWechatLiveServiceImpl extends BaseServiceImpl map = new LinkedHashMap<>(2); // List liveInfos = wxMaLiveService.getLiveInfos(); List liveDtos = generator.convert(page.getList(), YxWechatLiveDto.class); + //获取所有商品 liveDtos.forEach(i ->{ + if(StringUtils.isNotBlank(i.getProductId())){ + List wechatLiveGoodsDtos = generator.convert( + wechatLiveGoodsService.list(new LambdaQueryWrapper().in(YxWechatLiveGoods::getGoodsId,i.getProductId().split(","))) + ,YxWechatLiveGoodsDto.class); + i.setProduct(wechatLiveGoodsDtos); + } i.setId(i.getRoomid()); }); map.put("content",liveDtos); @@ -118,6 +119,15 @@ public class YxWechatLiveServiceImpl extends BaseServiceImpl pids = new ArrayList<>(); + for (String productId : productIds) { + pids.add(Integer.valueOf(productId)); + } + //添加商品 + wxMaLiveService.addGoodsToRoom(status, pids); + } this.save(resources); } catch (WxErrorException e) { e.printStackTrace(); diff --git a/yshop-mall/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveController.java b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveController.java similarity index 100% rename from yshop-mall/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveController.java rename to yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveController.java diff --git a/yshop-mall/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveGoodsController.java b/yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveGoodsController.java similarity index 100% rename from yshop-mall/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveGoodsController.java rename to yshop-shop/src/main/java/co/yixiang/modules/wechat/rest/YxWechatLiveGoodsController.java