Selaa lähdekoodia

提交
直播功能开发

ytf 2 vuotta sitten
vanhempi
commit
7b7091a371
18 muutettua tiedostoa jossa 1730 lisäystä ja 2 poistoa
  1. 18 0
      b2b2c/b2b2c-config-starter/pay-slodon-starter/src/main/resources/wx_cert/证书使用说明.txt
  2. 15 2
      b2b2c/b2b2c-core/src/main/java/com/slodon/b2b2c/core/util/HttpClientUtil.java
  3. 36 0
      b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/enums/WxLiveUrlEnum.java
  4. 50 0
      b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/dto/LiveBroadcastDto.java
  5. 50 0
      b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/dto/LiveBroadcastEditDto.java
  6. 66 0
      b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/example/LiveBroadcastExample.java
  7. 50 0
      b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/pojo/LiveBroadcast.java
  8. 16 0
      b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/vo/LivesVO.java
  9. 30 0
      b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/video/example/VideoSettingExample.java
  10. 265 0
      b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/controller/live/LiveBroadController.java
  11. 81 0
      b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/controller/video/admin/AdminVideoSettingController.java
  12. 8 0
      b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/dao/write/live/LiveBroadWriteMapper.java
  13. 8 0
      b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/dao/write/video/VideoSettingWriteMapper.java
  14. 54 0
      b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/model/live/LiveBroadModel.java
  15. 470 0
      b2b2c/b2b2c-web/src/main/resources/mapper/read/Live/LiveBroadReadMapper.xml
  16. 470 0
      b2b2c/b2b2c-web/src/main/resources/mapper/write/Live/LiveBroadWriteMapper.xml
  17. 20 0
      b2b2c/b2b2c-web/src/test/com/slodon/b2b2c/controller/job/ScheduleTaskControllerTest.java
  18. 23 0
      b2b2c/sql/建表语句.sql

+ 18 - 0
b2b2c/b2b2c-config-starter/pay-slodon-starter/src/main/resources/wx_cert/证书使用说明.txt

@@ -0,0 +1,18 @@
1
+欢迎使用微信支付!
2
+附件中的三份文件(证书pkcs12格式、证书pem格式、证书密钥pem格式),为接口中强制要求时需携带的证书文件。
3
+证书属于敏感信息,请妥善保管不要泄露和被他人复制。
4
+不同开发语言下的证书格式不同,以下为说明指引:
5
+    证书pkcs12格式(apiclient_cert.p12)
6
+        包含了私钥信息的证书文件,为p12(pfx)格式,由微信支付签发给您用来标识和界定您的身份
7
+        部分安全性要求较高的API需要使用该证书来确认您的调用身份
8
+        windows上可以直接双击导入系统,导入过程中会提示输入证书密码,证书密码默认为您的商户号(如:1900006031)
9
+    证书pem格式(apiclient_cert.pem)
10
+        从apiclient_cert.p12中导出证书部分的文件,为pem格式,请妥善保管不要泄漏和被他人复制
11
+        部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
12
+        您也可以使用openssl命令来自己导出:openssl pkcs12 -clcerts -nokeys -in apiclient_cert.p12 -out apiclient_cert.pem
13
+    证书密钥pem格式(apiclient_key.pem)
14
+        从apiclient_cert.p12中导出密钥部分的文件,为pem格式
15
+        部分开发语言和环境,不能直接使用p12文件,而需要使用pem,所以为了方便您使用,已为您直接提供
16
+        您也可以使用openssl命令来自己导出:openssl pkcs12 -nocerts -in apiclient_cert.p12 -out apiclient_key.pem
17
+备注说明:  
18
+        由于绝大部分操作系统已内置了微信支付服务器证书的根CA证书,  2018年3月6日后, 不再提供CA证书文件(rootca.pem)下载 

+ 15 - 2
b2b2c/b2b2c-core/src/main/java/com/slodon/b2b2c/core/util/HttpClientUtil.java

@@ -131,17 +131,30 @@ public class HttpClientUtil {
131 131
     }
132 132
 
133 133
     /**
134
-     * post请求json
135
-     *
134
+     * post请求json 原本
135
+     *  提交类型是表单,由于是旧代码不敢修改 application/x-www-form-urlencoded
136 136
      * @param url
137 137
      * @param json
138 138
      * @return
139 139
      * @throws Exception
140 140
      */
141
+    @Deprecated
141 142
     public static String sendJsonPost(String url, String json) throws Exception {
142 143
         return sendPost(url, json, "application/x-www-form-urlencoded");
143 144
     }
144 145
 
146
+    /**
147
+     * post请求json 新的
148
+     *
149
+     * @param url
150
+     * @param json
151
+     * @return
152
+     * @throws Exception
153
+     */
154
+    public static String sendJsonPostNew(String url, String json) throws Exception {
155
+        return sendPost(url, json, "application/json");
156
+    }
157
+
145 158
     public static String sendPost(String url, String content, String type) throws ClientProtocolException {
146 159
         CloseableHttpClient client = null;
147 160
         CloseableHttpResponse resp = null;

+ 36 - 0
b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/enums/WxLiveUrlEnum.java

@@ -0,0 +1,36 @@
1
+package com.slodon.b2b2c.enums;
2
+
3
+public enum WxLiveUrlEnum {
4
+    ADD_LIVE("创建直播间","https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token="),
5
+    GET_LIVE_LIST("获取直播间列表","https://api.weixin.qq.com/wxa/business/getliveinfo?access_token="),
6
+    GET_LIVE_PLAYBACK("获取直播间回放","https://api.weixin.qq.com/wxa/business/getliveinfo?access_token="),
7
+    ADD_LIVE_GOODS("直播间导入商品","https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods?access_token="),
8
+    DEL_LIVE("删除直播间","https://api.weixin.qq.com/wxaapi/broadcast/room/deleteroom?access_token="),
9
+    EDIT_LIVE("编辑直播间","https://api.weixin.qq.com/wxaapi/broadcast/room/editroom?access_token="),
10
+    GET_PUSH_LIVE("获取直播间推流地址","https://api.weixin.qq.com/wxaapi/broadcast/room/getpushurl?access_token=")
11
+    ;
12
+
13
+    private String explain;
14
+    private String url;
15
+
16
+    WxLiveUrlEnum(String explain, String url) {
17
+        this.explain = explain;
18
+        this.url = url;
19
+    }
20
+
21
+    public String getExplain() {
22
+        return explain;
23
+    }
24
+
25
+    public void setExplain(String explain) {
26
+        this.explain = explain;
27
+    }
28
+
29
+    public String getUrl() {
30
+        return url;
31
+    }
32
+
33
+    public void setUrl(String url) {
34
+        this.url = url;
35
+    }
36
+}

+ 50 - 0
b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/dto/LiveBroadcastDto.java

@@ -0,0 +1,50 @@
1
+package com.slodon.b2b2c.live.dto;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Data;
5
+
6
+import java.io.Serializable;
7
+
8
+@Data
9
+public class LiveBroadcastDto implements Serializable {
10
+    @ApiModelProperty("直播间id")
11
+    private String roomId;
12
+    @ApiModelProperty(value = "直播间名字,最短3个汉字,最长17个汉字,1个汉字相当于2个字符",required = true)
13
+    private String name;
14
+    @ApiModelProperty(value = "背景图,填入mediaID(mediaID获取后,三天内有效)",required = true)
15
+    private String coverImg;
16
+    @ApiModelProperty(value = "直播计划开始时间(开播时间需要在当前时间的10分钟后 并且 开始时间不能在 6 个月后)",required = true)
17
+    private Long startTime;
18
+    @ApiModelProperty(value = "直播计划结束时间(开播时间和结束时间间隔不得短于30分钟,不得超过24小时)",required = true)
19
+    private Long endTime;
20
+    @ApiModelProperty(value = "主播昵称,最短2个汉字,最长15个汉字,1个汉字相当于2个字符",required = true)
21
+    private String anchorName;
22
+    @ApiModelProperty(value = "主播微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证,",required = true)
23
+    private String anchorWechat;
24
+    @ApiModelProperty("主播副号微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证 ")
25
+    private String subAnchorWechat;
26
+    @ApiModelProperty("创建者微信号,不传入则此直播间所有成员可见。传入则此房间仅创建者、管理员、超管、直播间主播可见")
27
+    private String createrWechat;
28
+    @ApiModelProperty(value = "分享图,填入mediaID",required = true)
29
+    private String shareImg;
30
+    @ApiModelProperty(value = "购物直播频道封面图,填入mediaID",required = true)
31
+    private String feedsImg;
32
+    @ApiModelProperty("是否开启官方收录 【1: 开启,0:关闭】,默认开启收录")
33
+    private Integer isFeedsPublic;
34
+    @ApiModelProperty(value = "直播间类型 【1: 推流,0:手机直播】",required = true)
35
+    private Integer type;
36
+    @ApiModelProperty(value = "是否关闭点赞 【0:开启,1:关闭】(若关闭,观众端将隐藏点赞按钮,直播开始后不允许开启)",required = true)
37
+    private Integer closeLike;
38
+    @ApiModelProperty(value = "是否关闭货架 【0:开启,1:关闭】(若关闭,观众端将隐藏商品货架,直播开始后不允许开启)",required = true)
39
+    private Integer closeGoods;
40
+    @ApiModelProperty(value = "是否关闭评论 【0:开启,1:关闭】(若关闭,观众端将隐藏评论入口,直播开始后不允许开启)",required = true)
41
+    private Integer closeComment;
42
+    @ApiModelProperty("是否关闭回放 【0:开启,1:关闭】默认关闭回放(直播开始后允许开启)")
43
+    private Integer closeReplay;
44
+    @ApiModelProperty("是否关闭分享 【0:开启,1:关闭】默认开启分享(直播开始后不允许修改)")
45
+    private Integer closeShare;
46
+    @ApiModelProperty("是否关闭客服 【0:开启,1:关闭】 默认关闭客服(直播开始后允许开启)")
47
+    private Integer closeKf;
48
+
49
+
50
+}

+ 50 - 0
b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/dto/LiveBroadcastEditDto.java

@@ -0,0 +1,50 @@
1
+package com.slodon.b2b2c.live.dto;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Data;
5
+
6
+import java.io.Serializable;
7
+
8
+@Data
9
+public class LiveBroadcastEditDto implements Serializable {
10
+    @ApiModelProperty("直播间id")
11
+    private Integer id;
12
+    @ApiModelProperty(value = "直播间名字,最短3个汉字,最长17个汉字,1个汉字相当于2个字符",required = true)
13
+    private String name;
14
+    @ApiModelProperty(value = "背景图,填入mediaID(mediaID获取后,三天内有效)",required = true)
15
+    private String coverImg;
16
+    @ApiModelProperty(value = "直播计划开始时间(开播时间需要在当前时间的10分钟后 并且 开始时间不能在 6 个月后)",required = true)
17
+    private Long startTime;
18
+    @ApiModelProperty(value = "直播计划结束时间(开播时间和结束时间间隔不得短于30分钟,不得超过24小时)",required = true)
19
+    private Long endTime;
20
+    @ApiModelProperty(value = "主播昵称,最短2个汉字,最长15个汉字,1个汉字相当于2个字符",required = true)
21
+    private String anchorName;
22
+    @ApiModelProperty(value = "主播微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证,",required = true)
23
+    private String anchorWechat;
24
+    @ApiModelProperty("主播副号微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证 ")
25
+    private String subAnchorWechat;
26
+    @ApiModelProperty("创建者微信号,不传入则此直播间所有成员可见。传入则此房间仅创建者、管理员、超管、直播间主播可见")
27
+    private String createrWechat;
28
+    @ApiModelProperty(value = "分享图,填入mediaID",required = true)
29
+    private String shareImg;
30
+    @ApiModelProperty(value = "购物直播频道封面图,填入mediaID",required = true)
31
+    private String feedsImg;
32
+    @ApiModelProperty("是否开启官方收录 【1: 开启,0:关闭】,默认开启收录")
33
+    private Integer isFeedsPublic;
34
+    @ApiModelProperty(value = "直播间类型 【1: 推流,0:手机直播】",required = true)
35
+    private Integer type;
36
+    @ApiModelProperty(value = "是否关闭点赞 【0:开启,1:关闭】(若关闭,观众端将隐藏点赞按钮,直播开始后不允许开启)",required = true)
37
+    private Integer closeLike;
38
+    @ApiModelProperty(value = "是否关闭货架 【0:开启,1:关闭】(若关闭,观众端将隐藏商品货架,直播开始后不允许开启)",required = true)
39
+    private Integer closeGoods;
40
+    @ApiModelProperty(value = "是否关闭评论 【0:开启,1:关闭】(若关闭,观众端将隐藏评论入口,直播开始后不允许开启)",required = true)
41
+    private Integer closeComment;
42
+    @ApiModelProperty("是否关闭回放 【0:开启,1:关闭】默认关闭回放(直播开始后允许开启)")
43
+    private Integer closeReplay;
44
+    @ApiModelProperty("是否关闭分享 【0:开启,1:关闭】默认开启分享(直播开始后不允许修改)")
45
+    private Integer closeShare;
46
+    @ApiModelProperty("是否关闭客服 【0:开启,1:关闭】 默认关闭客服(直播开始后允许开启)")
47
+    private Integer closeKf;
48
+
49
+
50
+}

+ 66 - 0
b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/example/LiveBroadcastExample.java

@@ -0,0 +1,66 @@
1
+package com.slodon.b2b2c.live.example;
2
+
3
+import com.slodon.b2b2c.core.response.PagerInfo;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.io.Serializable;
8
+
9
+@Data
10
+public class LiveBroadcastExample implements Serializable {
11
+    @ApiModelProperty("直播间id")
12
+    private String roomId;
13
+    @ApiModelProperty(value = "直播间名字,最短3个汉字,最长17个汉字,1个汉字相当于2个字符",required = true)
14
+    private String name;
15
+    @ApiModelProperty(value = "背景图,填入mediaID(mediaID获取后,三天内有效)",required = true)
16
+    private String coverImg;
17
+    @ApiModelProperty(value = "直播计划开始时间(开播时间需要在当前时间的10分钟后 并且 开始时间不能在 6 个月后)",required = true)
18
+    private Long startTime;
19
+    @ApiModelProperty(value = "直播计划结束时间(开播时间和结束时间间隔不得短于30分钟,不得超过24小时)",required = true)
20
+    private Long endTime;
21
+    @ApiModelProperty(value = "主播昵称,最短2个汉字,最长15个汉字,1个汉字相当于2个字符",required = true)
22
+    private String anchorName;
23
+    @ApiModelProperty(value = "主播微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证,",required = true)
24
+    private String anchorWechat;
25
+    @ApiModelProperty("主播副号微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证 ")
26
+    private String subAnchorWechat;
27
+    @ApiModelProperty("创建者微信号,不传入则此直播间所有成员可见。传入则此房间仅创建者、管理员、超管、直播间主播可见")
28
+    private String createrWechat;
29
+    @ApiModelProperty(value = "分享图,填入mediaID",required = true)
30
+    private String shareImg;
31
+    @ApiModelProperty(value = "购物直播频道封面图,填入mediaID",required = true)
32
+    private String feedsImg;
33
+    @ApiModelProperty("是否开启官方收录 【1: 开启,0:关闭】,默认开启收录")
34
+    private Integer isFeedsPublic;
35
+    @ApiModelProperty(value = "直播间类型 【1: 推流,0:手机直播】",required = true)
36
+    private Integer type;
37
+    @ApiModelProperty(value = "是否关闭点赞 【0:开启,1:关闭】(若关闭,观众端将隐藏点赞按钮,直播开始后不允许开启)",required = true)
38
+    private Integer closeLike;
39
+    @ApiModelProperty(value = "是否关闭货架 【0:开启,1:关闭】(若关闭,观众端将隐藏商品货架,直播开始后不允许开启)",required = true)
40
+    private Integer closeGoods;
41
+    @ApiModelProperty(value = "是否关闭评论 【0:开启,1:关闭】(若关闭,观众端将隐藏评论入口,直播开始后不允许开启)",required = true)
42
+    private Integer closeComment;
43
+    @ApiModelProperty("是否关闭回放 【0:开启,1:关闭】默认关闭回放(直播开始后允许开启)")
44
+    private Integer closeReplay;
45
+    @ApiModelProperty("是否关闭分享 【0:开启,1:关闭】默认开启分享(直播开始后不允许修改)")
46
+    private Integer closeShare;
47
+    @ApiModelProperty("是否关闭客服 【0:开启,1:关闭】 默认关闭客服(直播开始后允许开启)")
48
+    private Integer closeKf;
49
+
50
+    //=====================mybatis需要字段============================
51
+    /**
52
+     * 排序条件,条件之间用逗号隔开,如果不传则按照goodsId倒序排列
53
+     */
54
+    private String orderBy;
55
+
56
+    /**
57
+     * 分组条件
58
+     */
59
+    private String groupBy;
60
+
61
+    /**
62
+     * 分页信息
63
+     */
64
+    private PagerInfo pager;
65
+
66
+}

+ 50 - 0
b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/pojo/LiveBroadcast.java

@@ -0,0 +1,50 @@
1
+package com.slodon.b2b2c.live.pojo;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Data;
5
+
6
+import java.io.Serializable;
7
+
8
+@Data
9
+public class LiveBroadcast implements Serializable {
10
+    @ApiModelProperty("直播间id")
11
+    private String roomId;
12
+    @ApiModelProperty(value = "直播间名字,最短3个汉字,最长17个汉字,1个汉字相当于2个字符",required = true)
13
+    private String name;
14
+    @ApiModelProperty(value = "背景图,填入mediaID(mediaID获取后,三天内有效)",required = true)
15
+    private String coverImg;
16
+    @ApiModelProperty(value = "直播计划开始时间(开播时间需要在当前时间的10分钟后 并且 开始时间不能在 6 个月后)",required = true)
17
+    private Long startTime;
18
+    @ApiModelProperty(value = "直播计划结束时间(开播时间和结束时间间隔不得短于30分钟,不得超过24小时)",required = true)
19
+    private Long endTime;
20
+    @ApiModelProperty(value = "主播昵称,最短2个汉字,最长15个汉字,1个汉字相当于2个字符",required = true)
21
+    private String anchorName;
22
+    @ApiModelProperty(value = "主播微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证,",required = true)
23
+    private String anchorWechat;
24
+    @ApiModelProperty("主播副号微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证 ")
25
+    private String subAnchorWechat;
26
+    @ApiModelProperty("创建者微信号,不传入则此直播间所有成员可见。传入则此房间仅创建者、管理员、超管、直播间主播可见")
27
+    private String createrWechat;
28
+    @ApiModelProperty(value = "分享图,填入mediaID",required = true)
29
+    private String shareImg;
30
+    @ApiModelProperty(value = "购物直播频道封面图,填入mediaID",required = true)
31
+    private String feedsImg;
32
+    @ApiModelProperty("是否开启官方收录 【1: 开启,0:关闭】,默认开启收录")
33
+    private Integer isFeedsPublic = 1;
34
+    @ApiModelProperty(value = "直播间类型 【1: 推流,0:手机直播】",required = true)
35
+    private Integer type;
36
+    @ApiModelProperty(value = "是否关闭点赞 【0:开启,1:关闭】(若关闭,观众端将隐藏点赞按钮,直播开始后不允许开启)",required = true)
37
+    private Integer closeLike;
38
+    @ApiModelProperty(value = "是否关闭货架 【0:开启,1:关闭】(若关闭,观众端将隐藏商品货架,直播开始后不允许开启)",required = true)
39
+    private Integer closeGoods;
40
+    @ApiModelProperty(value = "是否关闭评论 【0:开启,1:关闭】(若关闭,观众端将隐藏评论入口,直播开始后不允许开启)",required = true)
41
+    private Integer closeComment;
42
+    @ApiModelProperty("是否关闭回放 【0:开启,1:关闭】默认关闭回放(直播开始后允许开启)")
43
+    private Integer closeReplay = 1;
44
+    @ApiModelProperty("是否关闭分享 【0:开启,1:关闭】默认开启分享(直播开始后不允许修改)")
45
+    private Integer closeShare = 0;
46
+    @ApiModelProperty("是否关闭客服 【0:开启,1:关闭】 默认关闭客服(直播开始后允许开启)")
47
+    private Integer closeKf = 1;
48
+
49
+
50
+}

+ 16 - 0
b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/vo/LivesVO.java

@@ -0,0 +1,16 @@
1
+package com.slodon.b2b2c.live.vo;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Data;
5
+
6
+import java.io.Serializable;
7
+
8
+@Data
9
+public class LivesVO {
10
+    @ApiModelProperty("直播间id")
11
+    private String roomId;
12
+    @ApiModelProperty(value = "直播间名字,最短3个汉字,最长17个汉字,1个汉字相当于2个字符",required = true)
13
+    private String name;
14
+    @ApiModelProperty(value = "主播昵称,最短2个汉字,最长15个汉字,1个汉字相当于2个字符",required = true)
15
+    private String anchorName;
16
+}

+ 30 - 0
b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/video/example/VideoSettingExample.java

@@ -0,0 +1,30 @@
1
+package com.slodon.b2b2c.video.example;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Data;
5
+
6
+import java.io.Serializable;
7
+
8
+@Data
9
+public class VideoSettingExample implements Serializable {
10
+    /**
11
+     * 配置名称
12
+     */
13
+    private String name;
14
+    /**
15
+     * 配置主题,前端展示使用
16
+     */
17
+    private String title;
18
+    /**
19
+     * 配置值
20
+     */
21
+    private String value;
22
+    /**
23
+     * 配置描述
24
+     */
25
+    private String description;
26
+    /**
27
+     * 类型,1-字符串,2-图片,3-固定不能修改,4-开关
28
+     */
29
+    private Integer type;
30
+}

+ 265 - 0
b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/controller/live/LiveBroadController.java

@@ -0,0 +1,265 @@
1
+package com.slodon.b2b2c.controller.live;
2
+
3
+
4
+import com.alibaba.fastjson.JSON;
5
+import com.alibaba.fastjson.JSONObject;
6
+import com.slodon.b2b2c.core.controller.BaseController;
7
+import com.slodon.b2b2c.core.response.JsonResult;
8
+import com.slodon.b2b2c.core.response.PageVO;
9
+import com.slodon.b2b2c.core.response.PagerInfo;
10
+import com.slodon.b2b2c.core.response.SldResponse;
11
+import com.slodon.b2b2c.core.util.AssertUtil;
12
+import com.slodon.b2b2c.core.util.HttpClientUtil;
13
+import com.slodon.b2b2c.core.util.WebUtil;
14
+import com.slodon.b2b2c.enums.WxLiveUrlEnum;
15
+import com.slodon.b2b2c.live.dto.LiveBroadcastDto;
16
+import com.slodon.b2b2c.live.dto.LiveBroadcastEditDto;
17
+import com.slodon.b2b2c.live.example.LiveBroadcastExample;
18
+import com.slodon.b2b2c.live.pojo.LiveBroadcast;
19
+import com.slodon.b2b2c.live.vo.LivesVO;
20
+import com.slodon.b2b2c.model.live.LiveBroadModel;
21
+import io.swagger.annotations.Api;
22
+import io.swagger.annotations.ApiImplicitParam;
23
+import io.swagger.annotations.ApiImplicitParams;
24
+import io.swagger.annotations.ApiOperation;
25
+import lombok.extern.slf4j.Slf4j;
26
+import org.apache.commons.beanutils.PropertyUtils;
27
+import org.springframework.data.redis.core.StringRedisTemplate;
28
+import org.springframework.util.CollectionUtils;
29
+import org.springframework.web.bind.annotation.*;
30
+
31
+import javax.annotation.Resource;
32
+import javax.servlet.http.HttpServletRequest;
33
+import java.util.ArrayList;
34
+import java.util.HashMap;
35
+import java.util.List;
36
+import java.util.Map;
37
+
38
+@Api(tags = "admin-微信直播管理")
39
+@RestController
40
+@Slf4j
41
+@RequestMapping("v3/live/broad")
42
+public class LiveBroadController extends BaseController {
43
+    private final String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=";//获取access_token地址
44
+
45
+    @Resource
46
+    private StringRedisTemplate stringRedisTemplate;
47
+    @Resource
48
+    private LiveBroadModel liveBroadModel;
49
+
50
+    private String getToken() throws Exception {
51
+        String appId = stringRedisTemplate.opsForValue().get("login_wx_mini_appid");
52
+        String secret = stringRedisTemplate.opsForValue().get("login_wx_mini_appsecret");
53
+        String access_token_resp = HttpClientUtil.httpGet(ACCESS_TOKEN_URL + appId + "&secret=" + secret);
54
+        String access_token = JSON.parseObject(access_token_resp).getString("access_token");
55
+        AssertUtil.notEmpty(access_token, "微信认证失败");
56
+        System.out.println("结果access_token: "+access_token);
57
+        return access_token;
58
+    }
59
+
60
+//    @ApiOperation("添加临时素材")
61
+//    @PostMapping("/mediaUpload")
62
+//    public JsonResult mediaUpload(HttpServletRequest request, @RequestBody LiveBroadcastDto liveBroadcastDto) {
63
+//        try {
64
+//            String access_token = getToken();
65
+//            //校验
66
+//            String url = "https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token="+access_token;
67
+//            String reStr = HttpClientUtil.sendJsonPostNew(url,JSON.toJSONString(liveBroadcastDto));
68
+//            JSONObject jsonObject = JSONObject.parseObject(reStr);
69
+//            String errCode = jsonObject.getString("errcode");
70
+//            if (!"0".equals(errCode)){
71
+//                log.warn("直播间添加失败原因:"+reStr);
72
+//                return SldResponse.success("添加失败");
73
+//            }
74
+//            liveBroadcastDto.setRoomId(String.valueOf(jsonObject.get("roomId")));
75
+//            liveBroadModel.broadcastRoomCreate(liveBroadcastDto);
76
+//        } catch (Exception e) {
77
+//            e.printStackTrace();
78
+//        }
79
+//        return SldResponse.success("添加成功");
80
+//    }
81
+
82
+    @ApiOperation("添加直播间")
83
+    @PostMapping("/wxBroadcastRoomCreate")
84
+    public JsonResult wxBroadcastRoomCreate(HttpServletRequest request, @RequestBody LiveBroadcastDto liveBroadcastDto) {
85
+        try {
86
+            String access_token = getToken();
87
+            //校验
88
+            String url = WxLiveUrlEnum.ADD_LIVE.getUrl()+access_token;
89
+            String reStr = HttpClientUtil.sendJsonPostNew(url,JSON.toJSONString(liveBroadcastDto));
90
+            JSONObject jsonObject = JSONObject.parseObject(reStr);
91
+            String errCode = jsonObject.getString("errcode");
92
+            if (!"0".equals(errCode)){
93
+                log.warn("直播间添加失败原因:"+reStr);
94
+                return SldResponse.success("添加失败");
95
+            }
96
+            liveBroadcastDto.setRoomId(String.valueOf(jsonObject.get("roomId")));
97
+            liveBroadModel.broadcastRoomCreate(liveBroadcastDto);
98
+        } catch (Exception e) {
99
+            e.printStackTrace();
100
+        }
101
+        return SldResponse.success("添加成功");
102
+    }
103
+
104
+    @ApiOperation("获取直播列表")
105
+    @ApiImplicitParams({
106
+            @ApiImplicitParam(name = "name", value = "直播名称", paramType = "query"),
107
+            @ApiImplicitParam(name = "pageSize", value = "分页大小", defaultValue = "20", paramType = "query"),
108
+            @ApiImplicitParam(name = "current", value = "当前页面位置", defaultValue = "1", paramType = "query")
109
+    })
110
+    @GetMapping("/list")
111
+    public JsonResult<PageVO<LivesVO>> getList(HttpServletRequest request, String name) {
112
+        PagerInfo pager = WebUtil.handlerPagerInfo(request);
113
+        LiveBroadcastExample example = new LiveBroadcastExample();
114
+        example.setName(name);
115
+        List<LiveBroadcast> livesList = liveBroadModel.getLivesList(example, pager);
116
+        List<LivesVO> livesVOS = new ArrayList<>();
117
+        if (!CollectionUtils.isEmpty(livesList)) {
118
+            livesList.forEach(node->{
119
+                LivesVO vo = new LivesVO();
120
+                vo.setName(node.getName());
121
+                vo.setAnchorName(node.getAnchorName());
122
+                vo.setRoomId(node.getRoomId());
123
+                livesVOS.add(vo);
124
+            });
125
+        }
126
+        return SldResponse.success(new PageVO<>(livesVOS, pager));
127
+    }
128
+
129
+    @ApiOperation("获取直播间列表及直播间信息")
130
+    @ApiImplicitParams({
131
+            @ApiImplicitParam(name = "start", value = "起始房间,0表示从第1个房间开始拉取", paramType = "query"),
132
+            @ApiImplicitParam(name = "limit", value = "每次拉取的房间数量,建议100以内", paramType = "query")
133
+    })
134
+    @GetMapping("/wxGetLiveInfoList")
135
+    public JsonResult wxGetLiveInfoList(HttpServletRequest request, Integer start,Integer limit) {
136
+        try {
137
+            String access_token = getToken();
138
+            //校验
139
+            String url = WxLiveUrlEnum.GET_LIVE_LIST.getUrl()+access_token;
140
+            Map map = new HashMap();
141
+            map.put("start",start);
142
+            map.put("limit",limit);
143
+            String reStr = HttpClientUtil.sendJsonPostNew(url,JSON.toJSONString(map));
144
+            return SldResponse.success(reStr);
145
+        } catch (Exception e) {
146
+            e.printStackTrace();
147
+        }
148
+        return SldResponse.success("查询失败");
149
+    }
150
+
151
+    @ApiOperation("获取直播间回放")
152
+    @ApiImplicitParams({
153
+            @ApiImplicitParam(name = "roomId", value = "房间ID", paramType = "query"),
154
+            @ApiImplicitParam(name = "start", value = "起始房间,0表示从第1个房间开始拉取", paramType = "query"),
155
+            @ApiImplicitParam(name = "limit", value = "每次拉取的房间数量,建议100以内", paramType = "query")
156
+    })
157
+    @GetMapping("/wxGetLivePlayback")
158
+    public JsonResult wxGetLivePlayback(HttpServletRequest request,Integer roomId, Integer start,Integer limit) {
159
+        try {
160
+            String access_token = getToken();
161
+            //校验
162
+            String url = WxLiveUrlEnum.GET_LIVE_PLAYBACK.getUrl()+access_token;
163
+            Map map = new HashMap();
164
+            map.put("action","get_replay");
165
+            map.put("room_id",roomId);
166
+            map.put("start",start);
167
+            map.put("limit",limit);
168
+            String reStr = HttpClientUtil.sendJsonPostNew(url,JSON.toJSONString(map));
169
+            return SldResponse.success(reStr);
170
+        } catch (Exception e) {
171
+            e.printStackTrace();
172
+        }
173
+        return SldResponse.success("查询失败");
174
+    }
175
+
176
+    @ApiOperation("直播间导入商品")
177
+    @ApiImplicitParams({
178
+            @ApiImplicitParam(name = "ids", value = "[商品 ID]", paramType = "query"),
179
+            @ApiImplicitParam(name = "roomId", value = "房间ID", paramType = "query"),
180
+    })
181
+    @GetMapping("/wxAddLiveGoods")
182
+    public JsonResult wxAddLiveGoods(HttpServletRequest request,Integer[] ids,Integer roomId) {
183
+        try {
184
+            String access_token = getToken();
185
+            //校验
186
+            String url = WxLiveUrlEnum.ADD_LIVE_GOODS.getUrl()+access_token;
187
+            Map map = new HashMap();
188
+            map.put("ids",ids);
189
+            map.put("roomId",roomId);
190
+            String reStr = HttpClientUtil.sendJsonPostNew(url,JSON.toJSONString(map));
191
+            return SldResponse.success(reStr);
192
+        } catch (Exception e) {
193
+            e.printStackTrace();
194
+        }
195
+        return SldResponse.success("查询失败");
196
+    }
197
+
198
+    @ApiOperation("删除直播间")
199
+    @ApiImplicitParams({
200
+            @ApiImplicitParam(name = "roomId", value = "房间ID", paramType = "query"),
201
+    })
202
+    @GetMapping("/wxDelLive")
203
+    public JsonResult wxDelLive(HttpServletRequest request,Integer roomId) {
204
+        try {
205
+            String access_token = getToken();
206
+            //校验
207
+            String url = WxLiveUrlEnum.DEL_LIVE.getUrl()+access_token;
208
+            String reStr = HttpClientUtil.sendJsonPostNew(url,JSON.toJSONString(new HashMap<>().put("id",roomId)));
209
+            return SldResponse.success(reStr);
210
+        } catch (Exception e) {
211
+            e.printStackTrace();
212
+        }
213
+        return SldResponse.success("查询失败");
214
+    }
215
+
216
+    @ApiOperation("编辑直播间")
217
+    @PostMapping("/wxBroadcastRoomEdit")
218
+    public JsonResult wxBroadcastRoomEdit(HttpServletRequest request, @RequestBody LiveBroadcastEditDto liveBroadcastEditDto) {
219
+        try {
220
+            String access_token = getToken();
221
+            //校验
222
+            String url = WxLiveUrlEnum.EDIT_LIVE.getUrl()+access_token;
223
+            String reStr = HttpClientUtil.sendJsonPostNew(url,JSON.toJSONString(liveBroadcastEditDto));
224
+            JSONObject jsonObject = JSONObject.parseObject(reStr);
225
+            String errCode = jsonObject.getString("errcode");
226
+            if (!"0".equals(errCode)){
227
+                log.warn("直播间编辑失败原因:"+reStr);
228
+                return SldResponse.success("编辑失败");
229
+            }
230
+            LiveBroadcast live_broadcast = new LiveBroadcast();
231
+            PropertyUtils.copyProperties(live_broadcast,liveBroadcastEditDto);
232
+            live_broadcast.setRoomId(String.valueOf(liveBroadcastEditDto.getId()));
233
+            liveBroadModel.broadcastRoomEdit(live_broadcast);
234
+        } catch (Exception e) {
235
+            e.printStackTrace();
236
+        }
237
+        return SldResponse.success("编辑成功");
238
+    }
239
+
240
+    @ApiOperation("获取直播间推流地址")
241
+    @ApiImplicitParams({
242
+            @ApiImplicitParam(name = "roomId", value = "房间ID", paramType = "query"),
243
+    })
244
+    @GetMapping("/wxGetPushUrl")
245
+    public JsonResult wxGetPushUrl(HttpServletRequest request,Integer roomId) {
246
+        try {
247
+            String access_token = getToken();
248
+            //校验
249
+            String url = WxLiveUrlEnum.GET_PUSH_LIVE.getUrl()+access_token;
250
+            String reStr = HttpClientUtil.sendJsonPostNew(url,JSON.toJSONString(new HashMap<>().put("id",roomId)));
251
+            return SldResponse.success(reStr);
252
+        } catch (Exception e) {
253
+            e.printStackTrace();
254
+        }
255
+        return SldResponse.success("查询失败");
256
+    }
257
+
258
+    public static void main(String[] args) {
259
+        Map map = new HashMap();
260
+        map.put("start",1);
261
+        map.put("limit",10);
262
+        System.out.println(JSON.toJSONString(map));
263
+    }
264
+
265
+}

+ 81 - 0
b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/controller/video/admin/AdminVideoSettingController.java

@@ -1,21 +1,30 @@
1 1
 package com.slodon.b2b2c.controller.video.admin;
2 2
 
3 3
 
4
+import com.alibaba.fastjson.JSON;
4 5
 import com.slodon.b2b2c.core.controller.BaseController;
5 6
 import com.slodon.b2b2c.core.response.JsonResult;
6 7
 import com.slodon.b2b2c.core.response.SldResponse;
7 8
 import com.slodon.b2b2c.core.util.AssertUtil;
9
+import com.slodon.b2b2c.core.util.HttpClientUtil;
10
+import com.slodon.b2b2c.live.pojo.LiveBroadcast;
8 11
 import com.slodon.b2b2c.model.system.BillModel;
9 12
 import com.slodon.b2b2c.model.video.AdminVideoSettingModel;
10 13
 import com.slodon.b2b2c.video.pojo.VideoSetting;
11 14
 import io.swagger.annotations.Api;
12 15
 import io.swagger.annotations.ApiOperation;
13 16
 import lombok.extern.slf4j.Slf4j;
17
+import org.springframework.data.redis.core.StringRedisTemplate;
14 18
 import org.springframework.web.bind.annotation.GetMapping;
15 19
 import org.springframework.web.bind.annotation.RequestMapping;
16 20
 import org.springframework.web.bind.annotation.RestController;
17 21
 
18 22
 import javax.annotation.Resource;
23
+import javax.imageio.ImageIO;
24
+import java.awt.image.BufferedImage;
25
+import java.io.PrintWriter;
26
+import java.net.HttpURLConnection;
27
+import java.net.URL;
19 28
 import java.util.List;
20 29
 
21 30
 @Api(tags = "admin-直播管理")
@@ -39,4 +48,76 @@ public class AdminVideoSettingController extends BaseController {
39 48
         return SldResponse.success();
40 49
     }
41 50
 
51
+    public static void main(String[] args) throws Exception {
52
+        final String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=";//获取access_token地址
53
+        String access_token_resp = HttpClientUtil.httpGet(ACCESS_TOKEN_URL + "wx43aba958092afe0c" + "&secret=" + "647d35cc24fc7996003168d44ea91a43");
54
+        String access_token = JSON.parseObject(access_token_resp).getString("access_token");
55
+        AssertUtil.notEmpty(access_token, "微信认证失败");
56
+        System.out.println("结果access_token: "+access_token);
57
+        String url = "https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token="+access_token;
58
+        LiveBroadcast t = new LiveBroadcast();
59
+        t.setName("测试直播间");
60
+        t.setCoverImg("Oftl3yAWV5lJIHHMpprnVi5Ad8nnQtGmkbYgspS1mJxMqPSzJlV3cZPOq-V6_yo8");
61
+        t.setStartTime(System.currentTimeMillis()/1000+700);
62
+        t.setEndTime(System.currentTimeMillis()/1000+5000);
63
+        t.setAnchorName("主播昵称");
64
+        t.setAnchorWechat("feiskyend");
65
+        t.setShareImg("Oftl3yAWV5lJIHHMpprnVlJvIjvSoldaVmDE5-hzb46CdTAEO3GhyvoJZsGGkA6z");
66
+        t.setFeedsImg("Oftl3yAWV5lJIHHMpprnVgmkSTWNVnNTCCM6FvfZQqG8nlAiiSSY4ssBzLFXro4E");
67
+        t.setType(1);
68
+        t.setCloseLike(0);
69
+        t.setCloseGoods(0);
70
+        t.setCloseComment(0);
71
+        System.out.println("json: "+JSON.toJSONString(t));
72
+
73
+        String reStr = HttpClientUtil.sendJsonPostNew(url,JSON.toJSONString(t));
74
+        System.out.println("结果: "+reStr);
75
+        /*System.out.println(System.currentTimeMillis()+1800000);
76
+        System.out.println(System.currentTimeMillis()+3600000);*/
77
+       /* //定义接收数据
78
+        JSONObject result = new JSONObject();
79
+
80
+        HttpPost httpPost = new HttpPost(url);
81
+        CloseableHttpClient client = HttpClients.createDefault();
82
+//请求参数转JOSN字符串
83
+        StringEntity entity = new StringEntity(t.toString(), "UTF-8");
84
+        entity.setContentEncoding("UTF-8");
85
+        entity.setContentType("application/json");
86
+        httpPost.setEntity(entity);
87
+        try {
88
+            HttpResponse response = client.execute(httpPost);
89
+            if (response.getStatusLine().getStatusCode() == 200) {
90
+                result = JSON.parseObject(EntityUtils.toString(response.getEntity(), "UTF-8"));
91
+            }
92
+        } catch (IOException e) {
93
+            e.printStackTrace();
94
+            result.put("error", "连接错误!");
95
+        }
96
+        System.out.println(result.toJSONString());*/
97
+    }
98
+    @Resource
99
+    private StringRedisTemplate stringRedisTemplate;
100
+
101
+    private BufferedImage get(String jsonStr) throws Exception {
102
+        final String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=";//获取access_token地址
103
+        String appId = stringRedisTemplate.opsForValue().get("login_wx_mini_appid");
104
+        String secret = stringRedisTemplate.opsForValue().get("login_wx_mini_appsecret");
105
+
106
+        //获取小程序 access_token
107
+        String access_token_resp = HttpClientUtil.httpGet(ACCESS_TOKEN_URL + appId + "&secret=" + secret);
108
+        String access_token = JSON.parseObject(access_token_resp).getString("access_token");
109
+        AssertUtil.notEmpty(access_token, "微信认证失败");
110
+
111
+        URL url = new URL("https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token=" + access_token);
112
+        HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
113
+        httpURLConnection.setRequestMethod("POST");// 提交模式
114
+        httpURLConnection.setDoOutput(true);
115
+        httpURLConnection.setDoInput(true);
116
+        PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream());
117
+        //构造json参数
118
+        printWriter.write(jsonStr);
119
+        printWriter.flush();
120
+
121
+        return ImageIO.read(httpURLConnection.getInputStream());
122
+    }
42 123
 }

+ 8 - 0
b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/dao/write/live/LiveBroadWriteMapper.java

@@ -0,0 +1,8 @@
1
+package com.slodon.b2b2c.dao.write.live;
2
+
3
+import com.slodon.b2b2c.core.database.BaseWriteMapper;
4
+import com.slodon.b2b2c.live.example.LiveBroadcastExample;
5
+import com.slodon.b2b2c.live.pojo.LiveBroadcast;
6
+
7
+public interface LiveBroadWriteMapper extends BaseWriteMapper<LiveBroadcast, LiveBroadcastExample> {
8
+}

+ 8 - 0
b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/dao/write/video/VideoSettingWriteMapper.java

@@ -0,0 +1,8 @@
1
+package com.slodon.b2b2c.dao.write.video;
2
+
3
+import com.slodon.b2b2c.core.database.BaseReadMapper;
4
+import com.slodon.b2b2c.video.example.VideoSettingExample;
5
+import com.slodon.b2b2c.video.pojo.VideoSetting;
6
+
7
+public interface VideoSettingWriteMapper extends BaseReadMapper<VideoSetting, VideoSettingExample> {
8
+}

+ 54 - 0
b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/model/live/LiveBroadModel.java

@@ -0,0 +1,54 @@
1
+package com.slodon.b2b2c.model.live;
2
+
3
+import com.slodon.b2b2c.core.response.PagerInfo;
4
+import com.slodon.b2b2c.dao.write.live.LiveBroadWriteMapper;
5
+import com.slodon.b2b2c.live.dto.LiveBroadcastDto;
6
+import com.slodon.b2b2c.live.example.LiveBroadcastExample;
7
+import com.slodon.b2b2c.live.pojo.LiveBroadcast;
8
+import lombok.extern.slf4j.Slf4j;
9
+import org.apache.commons.beanutils.PropertyUtils;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.stereotype.Component;
12
+
13
+import java.util.List;
14
+
15
+@Component
16
+@Slf4j
17
+public class LiveBroadModel {
18
+
19
+    @Autowired
20
+    private LiveBroadWriteMapper liveBroadWriteMapper;
21
+
22
+    public void broadcastRoomCreate(LiveBroadcastDto liveBroadcastDto) {
23
+
24
+        LiveBroadcast live_broadcast = new LiveBroadcast();
25
+        try {
26
+            PropertyUtils.copyProperties(live_broadcast,liveBroadcastDto);
27
+        } catch (Exception e) {
28
+            e.printStackTrace();
29
+        }
30
+        liveBroadWriteMapper.insert(live_broadcast);
31
+    }
32
+
33
+    public void broadcastRoomEdit(LiveBroadcast live_broadcast) {
34
+        liveBroadWriteMapper.updateByPrimaryKeySelective(live_broadcast);
35
+    }
36
+
37
+    /**
38
+     * 根据条件获取直播公共信息表(SPU)列表
39
+     *
40
+     * @param example 查询条件信息
41
+     * @param pager   分页信息
42
+     * @return
43
+     */
44
+    public List<LiveBroadcast> getLivesList(LiveBroadcastExample example, PagerInfo pager) {
45
+        List<LiveBroadcast> goodsList;
46
+        if (pager != null) {
47
+            pager.setRowsCount(liveBroadWriteMapper.countByExample(example));
48
+            goodsList = liveBroadWriteMapper.listPageByExample(example, pager.getStart(), pager.getPageSize());
49
+        } else {
50
+            goodsList = liveBroadWriteMapper.listByExample(example);
51
+        }
52
+        return goodsList;
53
+    }
54
+}

+ 470 - 0
b2b2c/b2b2c-web/src/main/resources/mapper/read/Live/LiveBroadReadMapper.xml

@@ -0,0 +1,470 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.slodon.b2b2c.dao.write.live.LiveBroadWriteMapper">
4
+  <resultMap id="resultMap" type="com.slodon.b2b2c.live.pojo.LiveBroadcast">
5
+    <id column="roomId" property="roomId" />
6
+    <result column="name" property="name" />
7
+    <result column="name" property="name" />
8
+    <result column="coverImg" property="coverImg" />
9
+    <result column="startTime" property="startTime" />
10
+    <result column="endTime" property="endTime" />
11
+    <result column="anchorName" property="anchorName" />
12
+    <result column="anchorWechat" property="anchorWechat" />
13
+    <result column="subAnchorWechat" property="subAnchorWechat" />
14
+    <result column="createrWechat" property="createrWechat" />
15
+    <result column="shareImg" property="shareImg" />
16
+    <result column="feedsImg" property="feedsImg" />
17
+    <result column="isFeedsPublic" property="isFeedsPublic" />
18
+    <result column="type" property="type" />
19
+    <result column="closeLike" property="closeLike" />
20
+    <result column="closeGoods" property="closeGoods" />
21
+    <result column="closeComment" property="closeComment" />
22
+    <result column="closeReplay" property="closeReplay" />
23
+    <result column="closeShare" property="closeShare" />
24
+    <result column="closeKf" property="closeKf" />
25
+  </resultMap>
26
+
27
+  <!--除主键外的所有字段,用于插入操作-->
28
+  <sql id="columns">
29
+    <trim suffixOverrides=",">
30
+      <if test="roomId != null">
31
+        roomId,
32
+      </if>
33
+      <if test="name != null">
34
+        name,
35
+      </if>
36
+      <if test="coverImg != null">
37
+        coverImg,
38
+      </if>
39
+      <if test="startTime != null">
40
+        startTime,
41
+      </if>
42
+      <if test="endTime != null">
43
+        endTime,
44
+      </if>
45
+      <if test="anchorName != null">
46
+        anchorName,
47
+      </if>
48
+      <if test="anchorWechat != null">
49
+        anchorWechat,
50
+      </if>
51
+      <if test="subAnchorWechat != null">
52
+        subAnchorWechat,
53
+      </if>
54
+      <if test="createrWechat != null">
55
+        createrWechat,
56
+      </if>
57
+      <if test="shareImg != null">
58
+        shareImg,
59
+      </if>
60
+      <if test="feedsImg != null">
61
+        feedsImg,
62
+      </if>
63
+      <if test="isFeedsPublic != null">
64
+        isFeedsPublic,
65
+      </if>
66
+      <if test="type != null">
67
+        type,
68
+      </if>
69
+      <if test="closeLike != null">
70
+        closeLike,
71
+      </if>
72
+      <if test="closeGoods != null">
73
+        closeGoods,
74
+      </if>
75
+      <if test="closeComment != null">
76
+        closeComment,
77
+      </if>
78
+      <if test="closeReplay != null">
79
+        closeReplay,
80
+      </if>
81
+      <if test="closeShare != null">
82
+        closeShare,
83
+      </if>
84
+      <if test="closeKf != null">
85
+        closeKf,
86
+      </if>
87
+    </trim>
88
+  </sql>
89
+  <!--按照主键值进行操作-->
90
+  <sql id="pkWhere">
91
+    WHERE roomId = #{primaryKey}
92
+  </sql>
93
+  <!--操作条件-->
94
+  <sql id="whereCondition">
95
+    <if test="example != null">
96
+      <trim prefix="WHERE" prefixOverrides="AND|OR">
97
+        <if test="example.roomId != null">
98
+          AND roomId = ${example.roomId}
99
+        </if>
100
+        <if test="example.name != null">
101
+          AND name like concat('%',#{example.name},'%')
102
+        </if>
103
+        <if test="example.coverImg != null">
104
+          AND coverImg = ${example.coverImg}
105
+        </if>
106
+        <if test="example.startTime != null">
107
+          AND startTime = ${example.startTime}
108
+        </if>
109
+        <if test="example.endTime != null">
110
+          AND endTime = ${example.endTime}
111
+        </if>
112
+        <if test="example.anchorName != null">
113
+          AND anchorName = ${example.anchorName}
114
+        </if>
115
+        <if test="example.anchorWechat != null">
116
+          AND anchorWechat = ${example.anchorWechat}
117
+        </if>
118
+        <if test="example.subAnchorWechat != null">
119
+          AND subAnchorWechat = ${example.subAnchorWechat}
120
+        </if>
121
+        <if test="example.createrWechat != null">
122
+          AND createrWechat = ${example.createrWechat}
123
+        </if>
124
+        <if test="example.shareImg != null">
125
+          AND shareImg = ${example.shareImg}
126
+        </if>
127
+        <if test="example.feedsImg != null">
128
+          AND feedsImg = ${example.feedsImg}
129
+        </if>
130
+        <if test="example.isFeedsPublic != null">
131
+          AND isFeedsPublic = ${example.isFeedsPublic}
132
+        </if>
133
+        <if test="example.type != null">
134
+          AND type = ${example.type}
135
+        </if>
136
+        <if test="example.closeLike != null">
137
+          AND closeLike = ${example.closeLike}
138
+        </if>
139
+        <if test="example.closeGoods != null">
140
+          AND closeGoods = ${example.closeGoods}
141
+        </if>
142
+        <if test="example.closeComment != null">
143
+          AND closeComment = ${example.closeComment}
144
+        </if>
145
+        <if test="example.closeReplay != null">
146
+          AND closeReplay = ${example.closeReplay}
147
+        </if>
148
+        <if test="example.closeShare != null">
149
+          AND closeShare = ${example.closeShare}
150
+        </if>
151
+        <if test="example.closeKf != null">
152
+          AND closeKf = ${example.closeKf}
153
+        </if>
154
+
155
+      </trim>
156
+    </if>
157
+  </sql>
158
+  <!--排序条件-->
159
+  <sql id="orderBy">
160
+    ORDER BY roomId DESC
161
+  </sql>
162
+  <sql id="orderByOther">
163
+    order by ${example.orderBy}
164
+  </sql>
165
+  <!--分组条件-->
166
+  <sql id="groupBy">
167
+    group by ${example.groupBy}
168
+  </sql>
169
+  <!--分页条件-->
170
+  <sql id="limit">
171
+    <if test="size != null and size &gt; 0">
172
+      limit #{startRow},#{size}
173
+    </if>
174
+  </sql>
175
+  <!--查询符合条件的记录数-->
176
+  <select id="countByExample" parameterType="com.slodon.b2b2c.live.example.LiveBroadcastExample" resultType="java.lang.Integer">
177
+    SELECT
178
+      COUNT(*)
179
+    FROM live_broadcast
180
+    <include refid="whereCondition" />
181
+  </select>
182
+  <!--根据主键查询记录-->
183
+  <select id="getByPrimaryKey" resultMap="resultMap">
184
+    SELECT
185
+      *
186
+    FROM live_broadcast
187
+    <include refid="pkWhere" />
188
+  </select>
189
+  <!--查询符合条件的记录(所有字段)-->
190
+  <select id="listByExample" resultMap="resultMap">
191
+    SELECT
192
+      *
193
+    FROM live_broadcast
194
+    <include refid="whereCondition" />
195
+    <if test="example.groupBy != null">
196
+      <include refid="groupBy" />
197
+    </if>
198
+    <choose>
199
+      <when test="example.orderBy != null">
200
+        <include refid="orderByOther" />
201
+      </when>
202
+      <otherwise>
203
+        <include refid="orderBy" />
204
+      </otherwise>
205
+    </choose>
206
+  </select>
207
+  <!--分页查询符合条件的记录(所有字段)-->
208
+  <select id="listPageByExample" resultMap="resultMap">
209
+    SELECT
210
+      *
211
+    FROM live_broadcast
212
+    <include refid="whereCondition" />
213
+    <if test="example.groupBy != null">
214
+      <include refid="groupBy" />
215
+    </if>
216
+    <choose>
217
+      <when test="example.orderBy != null">
218
+        <include refid="orderByOther" />
219
+      </when>
220
+      <otherwise>
221
+        <include refid="orderBy" />
222
+      </otherwise>
223
+    </choose>
224
+    <include refid="limit" />
225
+  </select>
226
+  <!--查询符合条件的记录(指定字段)-->
227
+  <select id="listFieldsByExample" resultMap="resultMap">
228
+    SELECT
229
+      ${fields}
230
+    FROM live_broadcast
231
+    <include refid="whereCondition" />
232
+    <if test="example.groupBy != null">
233
+      <include refid="groupBy" />
234
+    </if>
235
+    <choose>
236
+      <when test="example.orderBy != null">
237
+        <include refid="orderByOther" />
238
+      </when>
239
+      <otherwise>
240
+        <include refid="orderBy" />
241
+      </otherwise>
242
+    </choose>
243
+  </select>
244
+  <!--分页查询符合条件的记录(指定字段)-->
245
+  <select id="listFieldsPageByExample" resultMap="resultMap">
246
+    SELECT
247
+      ${fields}
248
+    FROM live_broadcast
249
+    <include refid="whereCondition" />
250
+    <if test="example.groupBy != null">
251
+      <include refid="groupBy" />
252
+    </if>
253
+    <choose>
254
+      <when test="example.orderBy != null">
255
+        <include refid="orderByOther" />
256
+      </when>
257
+      <otherwise>
258
+        <include refid="orderBy" />
259
+      </otherwise>
260
+    </choose>
261
+    <include refid="limit" />
262
+  </select>
263
+  <!--根据条件删除记录,可多条删除-->
264
+  <delete id="deleteByExample">
265
+    DELETE FROM live_broadcast
266
+    <include refid="whereCondition" />
267
+  </delete>
268
+  <!--根据主键删除记录-->
269
+  <delete id="deleteByPrimaryKey">
270
+    DELETE FROM live_broadcast
271
+    <include refid="pkWhere" />
272
+  </delete>
273
+  <!--插入一条记录-->
274
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.slodon.b2b2c.live.pojo.LiveBroadcast" useGeneratedKeys="true">
275
+    INSERT INTO live_broadcast(
276
+    <include refid="columns" />
277
+    )
278
+    VALUES(
279
+    <trim suffixOverrides=",">
280
+      <if test="roomId != null">
281
+        ${roomId},
282
+      </if>
283
+      <if test="name != null">
284
+        ${name},
285
+      </if>
286
+      <if test="coverImg != null">
287
+        ${coverImg},
288
+      </if>
289
+      <if test="startTime != null">
290
+        ${startTime},
291
+      </if>
292
+      <if test="endTime != null">
293
+        ${endTime},
294
+      </if>
295
+      <if test="anchorName != null">
296
+        ${anchorName},
297
+      </if>
298
+      <if test="anchorWechat != null">
299
+        ${anchorWechat},
300
+      </if>
301
+      <if test="subAnchorWechat != null">
302
+        ${subAnchorWechat},
303
+      </if>
304
+      <if test="createrWechat != null">
305
+        ${createrWechat},
306
+      </if>
307
+      <if test="shareImg != null">
308
+        ${shareImg},
309
+      </if>
310
+      <if test="feedsImg != null">
311
+        ${feedsImg},
312
+      </if>
313
+      <if test="isFeedsPublic != null">
314
+        ${isFeedsPublic},
315
+      </if>
316
+      <if test="type != null">
317
+        ${type},
318
+      </if>
319
+      <if test="closeLike != null">
320
+        ${closeLike},
321
+      </if>
322
+      <if test="closeGoods != null">
323
+        ${closeGoods},
324
+      </if>
325
+      <if test="closeComment != null">
326
+        ${closeComment},
327
+      </if>
328
+      <if test="closeReplay != null">
329
+        ${closeReplay},
330
+      </if>
331
+      <if test="closeShare != null">
332
+        ${closeShare},
333
+      </if>
334
+      <if test="closeKf != null">
335
+        ${closeKf},
336
+      </if>
337
+
338
+    </trim>
339
+    )
340
+  </insert>
341
+  <!--按条件更新记录中不为空的字段-->
342
+  <update id="updateByExampleSelective">
343
+    UPDATE live_broadcast
344
+    <trim prefix="SET" suffixOverrides=",">
345
+      <if test="record.roomId != null">
346
+        AND roomId = #{record.roomId},
347
+      </if>
348
+      <if test="record.name != null">
349
+        AND name = #{record.name},
350
+      </if>
351
+      <if test="record.coverImg != null">
352
+        AND coverImg = #{record.coverImg},
353
+      </if>
354
+      <if test="record.startTime != null">
355
+        AND startTime = #{record.startTime},
356
+      </if>
357
+      <if test="record.endTime != null">
358
+        AND endTime = #{record.endTime},
359
+      </if>
360
+      <if test="record.anchorName != null">
361
+        AND anchorName = #{record.anchorName},
362
+      </if>
363
+      <if test="record.anchorWechat != null">
364
+        AND anchorWechat = #{record.anchorWechat},
365
+      </if>
366
+      <if test="record.subAnchorWechat != null">
367
+        AND subAnchorWechat = #{record.subAnchorWechat},
368
+      </if>
369
+      <if test="record.createrWechat != null">
370
+        AND createrWechat = #{record.createrWechat},
371
+      </if>
372
+      <if test="record.shareImg != null">
373
+        AND shareImg = #{record.shareImg},
374
+      </if>
375
+      <if test="record.feedsImg != null">
376
+        AND feedsImg = #{record.feedsImg},
377
+      </if>
378
+      <if test="record.isFeedsPublic != null">
379
+        AND isFeedsPublic = #{record.isFeedsPublic},
380
+      </if>
381
+      <if test="record.type != null">
382
+        AND type = #{record.type},
383
+      </if>
384
+      <if test="record.closeLike != null">
385
+        AND closeLike = #{record.closeLike},
386
+      </if>
387
+      <if test="record.closeGoods != null">
388
+        AND closeGoods = #{record.closeGoods},
389
+      </if>
390
+      <if test="record.closeComment != null">
391
+        AND closeComment = #{record.closeComment},
392
+      </if>
393
+      <if test="record.closeReplay != null">
394
+        AND closeReplay = #{record.closeReplay},
395
+      </if>
396
+      <if test="record.closeShare != null">
397
+        AND closeShare = #{record.closeShare},
398
+      </if>
399
+      <if test="record.closeKf != null">
400
+        AND closeKf = #{record.closeKf},
401
+      </if>
402
+
403
+    </trim>
404
+    <include refid="whereCondition" />
405
+  </update>
406
+  <!--按照主键更新记录中不为空的字段-->
407
+  <update id="updateByPrimaryKeySelective">
408
+    UPDATE live_broadcast
409
+    <trim prefix="SET" suffixOverrides=",">
410
+      <if test="roomId != null">
411
+        roomId = #{roomId}
412
+      </if>
413
+      <if test="name != null">
414
+        name = #{name}
415
+      </if>
416
+      <if test="coverImg != null">
417
+        coverImg = #{coverImg}
418
+      </if>
419
+      <if test="startTime != null">
420
+        startTime = #{startTime}
421
+      </if>
422
+      <if test="endTime != null">
423
+        endTime = #{endTime}
424
+      </if>
425
+      <if test="anchorName != null">
426
+        anchorName = #{anchorName}
427
+      </if>
428
+      <if test="anchorWechat != null">
429
+        anchorWechat = #{anchorWechat}
430
+      </if>
431
+      <if test="subAnchorWechat != null">
432
+        subAnchorWechat = #{subAnchorWechat}
433
+      </if>
434
+      <if test="createrWechat != null">
435
+        createrWechat = #{createrWechat}
436
+      </if>
437
+      <if test="shareImg != null">
438
+        shareImg = #{shareImg}
439
+      </if>
440
+      <if test="feedsImg != null">
441
+        feedsImg = #{feedsImg}
442
+      </if>
443
+      <if test="isFeedsPublic != null">
444
+        isFeedsPublic = #{isFeedsPublic}
445
+      </if>
446
+      <if test="type != null">
447
+        type = #{type}
448
+      </if>
449
+      <if test="closeLike != null">
450
+        closeLike = #{closeLike}
451
+      </if>
452
+      <if test="closeGoods != null">
453
+        closeGoods = #{closeGoods}
454
+      </if>
455
+      <if test="closeComment != null">
456
+        closeComment = #{closeComment}
457
+      </if>
458
+      <if test="closeReplay != null">
459
+        closeReplay = #{closeReplay}
460
+      </if>
461
+      <if test="closeShare != null">
462
+        closeShare = #{closeShare}
463
+      </if>
464
+      <if test="closeKf != null">
465
+        closeKf = #{closeKf}
466
+      </if>
467
+    </trim>
468
+    WHERE roomId = #{roomId}
469
+  </update>
470
+</mapper>

+ 470 - 0
b2b2c/b2b2c-web/src/main/resources/mapper/write/Live/LiveBroadWriteMapper.xml

@@ -0,0 +1,470 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.slodon.b2b2c.dao.write.live.LiveBroadWriteMapper">
4
+  <resultMap id="resultMap" type="com.slodon.b2b2c.live.pojo.LiveBroadcast">
5
+    <id column="roomId" property="roomId" />
6
+    <result column="name" property="name" />
7
+    <result column="name" property="name" />
8
+    <result column="coverImg" property="coverImg" />
9
+    <result column="startTime" property="startTime" />
10
+    <result column="endTime" property="endTime" />
11
+    <result column="anchorName" property="anchorName" />
12
+    <result column="anchorWechat" property="anchorWechat" />
13
+    <result column="subAnchorWechat" property="subAnchorWechat" />
14
+    <result column="createrWechat" property="createrWechat" />
15
+    <result column="shareImg" property="shareImg" />
16
+    <result column="feedsImg" property="feedsImg" />
17
+    <result column="isFeedsPublic" property="isFeedsPublic" />
18
+    <result column="type" property="type" />
19
+    <result column="closeLike" property="closeLike" />
20
+    <result column="closeGoods" property="closeGoods" />
21
+    <result column="closeComment" property="closeComment" />
22
+    <result column="closeReplay" property="closeReplay" />
23
+    <result column="closeShare" property="closeShare" />
24
+    <result column="closeKf" property="closeKf" />
25
+  </resultMap>
26
+
27
+  <!--除主键外的所有字段,用于插入操作-->
28
+  <sql id="columns">
29
+    <trim suffixOverrides=",">
30
+      <if test="roomId != null">
31
+        roomId,
32
+      </if>
33
+      <if test="name != null">
34
+        name,
35
+      </if>
36
+      <if test="coverImg != null">
37
+        coverImg,
38
+      </if>
39
+      <if test="startTime != null">
40
+        startTime,
41
+      </if>
42
+      <if test="endTime != null">
43
+        endTime,
44
+      </if>
45
+      <if test="anchorName != null">
46
+        anchorName,
47
+      </if>
48
+      <if test="anchorWechat != null">
49
+        anchorWechat,
50
+      </if>
51
+      <if test="subAnchorWechat != null">
52
+        subAnchorWechat,
53
+      </if>
54
+      <if test="createrWechat != null">
55
+        createrWechat,
56
+      </if>
57
+      <if test="shareImg != null">
58
+        shareImg,
59
+      </if>
60
+      <if test="feedsImg != null">
61
+        feedsImg,
62
+      </if>
63
+      <if test="isFeedsPublic != null">
64
+        isFeedsPublic,
65
+      </if>
66
+      <if test="type != null">
67
+        type,
68
+      </if>
69
+      <if test="closeLike != null">
70
+        closeLike,
71
+      </if>
72
+      <if test="closeGoods != null">
73
+        closeGoods,
74
+      </if>
75
+      <if test="closeComment != null">
76
+        closeComment,
77
+      </if>
78
+      <if test="closeReplay != null">
79
+        closeReplay,
80
+      </if>
81
+      <if test="closeShare != null">
82
+        closeShare,
83
+      </if>
84
+      <if test="closeKf != null">
85
+        closeKf,
86
+      </if>
87
+    </trim>
88
+  </sql>
89
+  <!--按照主键值进行操作-->
90
+  <sql id="pkWhere">
91
+    WHERE roomId = #{primaryKey}
92
+  </sql>
93
+  <!--操作条件-->
94
+  <sql id="whereCondition">
95
+    <if test="example != null">
96
+      <trim prefix="WHERE" prefixOverrides="AND|OR">
97
+        <if test="example.roomId != null">
98
+          AND roomId = ${example.roomId}
99
+        </if>
100
+        <if test="example.name != null">
101
+          AND name like concat('%',#{example.name},'%')
102
+        </if>
103
+        <if test="example.coverImg != null">
104
+          AND coverImg = ${example.coverImg}
105
+        </if>
106
+        <if test="example.startTime != null">
107
+          AND startTime = ${example.startTime}
108
+        </if>
109
+        <if test="example.endTime != null">
110
+          AND endTime = ${example.endTime}
111
+        </if>
112
+        <if test="example.anchorName != null">
113
+          AND anchorName = ${example.anchorName}
114
+        </if>
115
+        <if test="example.anchorWechat != null">
116
+          AND anchorWechat = ${example.anchorWechat}
117
+        </if>
118
+        <if test="example.subAnchorWechat != null">
119
+          AND subAnchorWechat = ${example.subAnchorWechat}
120
+        </if>
121
+        <if test="example.createrWechat != null">
122
+          AND createrWechat = ${example.createrWechat}
123
+        </if>
124
+        <if test="example.shareImg != null">
125
+          AND shareImg = ${example.shareImg}
126
+        </if>
127
+        <if test="example.feedsImg != null">
128
+          AND feedsImg = ${example.feedsImg}
129
+        </if>
130
+        <if test="example.isFeedsPublic != null">
131
+          AND isFeedsPublic = ${example.isFeedsPublic}
132
+        </if>
133
+        <if test="example.type != null">
134
+          AND type = ${example.type}
135
+        </if>
136
+        <if test="example.closeLike != null">
137
+          AND closeLike = ${example.closeLike}
138
+        </if>
139
+        <if test="example.closeGoods != null">
140
+          AND closeGoods = ${example.closeGoods}
141
+        </if>
142
+        <if test="example.closeComment != null">
143
+          AND closeComment = ${example.closeComment}
144
+        </if>
145
+        <if test="example.closeReplay != null">
146
+          AND closeReplay = ${example.closeReplay}
147
+        </if>
148
+        <if test="example.closeShare != null">
149
+          AND closeShare = ${example.closeShare}
150
+        </if>
151
+        <if test="example.closeKf != null">
152
+          AND closeKf = ${example.closeKf}
153
+        </if>
154
+
155
+      </trim>
156
+    </if>
157
+  </sql>
158
+  <!--排序条件-->
159
+  <sql id="orderBy">
160
+    ORDER BY roomId DESC
161
+  </sql>
162
+  <sql id="orderByOther">
163
+    order by ${example.orderBy}
164
+  </sql>
165
+  <!--分组条件-->
166
+  <sql id="groupBy">
167
+    group by ${example.groupBy}
168
+  </sql>
169
+  <!--分页条件-->
170
+  <sql id="limit">
171
+    <if test="size != null and size &gt; 0">
172
+      limit #{startRow},#{size}
173
+    </if>
174
+  </sql>
175
+  <!--查询符合条件的记录数-->
176
+  <select id="countByExample" parameterType="com.slodon.b2b2c.live.example.LiveBroadcastExample" resultType="java.lang.Integer">
177
+    SELECT
178
+    COUNT(*)
179
+    FROM live_broadcast
180
+    <include refid="whereCondition" />
181
+  </select>
182
+  <!--根据主键查询记录-->
183
+  <select id="getByPrimaryKey" resultMap="resultMap">
184
+    SELECT
185
+    *
186
+    FROM live_broadcast
187
+    <include refid="pkWhere" />
188
+  </select>
189
+  <!--查询符合条件的记录(所有字段)-->
190
+  <select id="listByExample" resultMap="resultMap">
191
+    SELECT
192
+    *
193
+    FROM live_broadcast
194
+    <include refid="whereCondition" />
195
+    <if test="example.groupBy != null">
196
+      <include refid="groupBy" />
197
+    </if>
198
+    <choose>
199
+      <when test="example.orderBy != null">
200
+        <include refid="orderByOther" />
201
+      </when>
202
+      <otherwise>
203
+        <include refid="orderBy" />
204
+      </otherwise>
205
+    </choose>
206
+  </select>
207
+  <!--分页查询符合条件的记录(所有字段)-->
208
+  <select id="listPageByExample" resultMap="resultMap">
209
+    SELECT
210
+    *
211
+    FROM live_broadcast
212
+    <include refid="whereCondition" />
213
+    <if test="example.groupBy != null">
214
+      <include refid="groupBy" />
215
+    </if>
216
+    <choose>
217
+      <when test="example.orderBy != null">
218
+        <include refid="orderByOther" />
219
+      </when>
220
+      <otherwise>
221
+        <include refid="orderBy" />
222
+      </otherwise>
223
+    </choose>
224
+    <include refid="limit" />
225
+  </select>
226
+  <!--查询符合条件的记录(指定字段)-->
227
+  <select id="listFieldsByExample" resultMap="resultMap">
228
+    SELECT
229
+    ${fields}
230
+    FROM live_broadcast
231
+    <include refid="whereCondition" />
232
+    <if test="example.groupBy != null">
233
+      <include refid="groupBy" />
234
+    </if>
235
+    <choose>
236
+      <when test="example.orderBy != null">
237
+        <include refid="orderByOther" />
238
+      </when>
239
+      <otherwise>
240
+        <include refid="orderBy" />
241
+      </otherwise>
242
+    </choose>
243
+  </select>
244
+  <!--分页查询符合条件的记录(指定字段)-->
245
+  <select id="listFieldsPageByExample" resultMap="resultMap">
246
+    SELECT
247
+    ${fields}
248
+    FROM live_broadcast
249
+    <include refid="whereCondition" />
250
+    <if test="example.groupBy != null">
251
+      <include refid="groupBy" />
252
+    </if>
253
+    <choose>
254
+      <when test="example.orderBy != null">
255
+        <include refid="orderByOther" />
256
+      </when>
257
+      <otherwise>
258
+        <include refid="orderBy" />
259
+      </otherwise>
260
+    </choose>
261
+    <include refid="limit" />
262
+  </select>
263
+  <!--根据条件删除记录,可多条删除-->
264
+  <delete id="deleteByExample">
265
+    DELETE FROM live_broadcast
266
+    <include refid="whereCondition" />
267
+  </delete>
268
+  <!--根据主键删除记录-->
269
+  <delete id="deleteByPrimaryKey">
270
+    DELETE FROM live_broadcast
271
+    <include refid="pkWhere" />
272
+  </delete>
273
+  <!--插入一条记录-->
274
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.slodon.b2b2c.live.pojo.LiveBroadcast" useGeneratedKeys="true">
275
+    INSERT INTO live_broadcast(
276
+    <include refid="columns" />
277
+    )
278
+    VALUES(
279
+    <trim suffixOverrides=",">
280
+      <if test="roomId != null">
281
+        ${roomId},
282
+      </if>
283
+      <if test="name != null">
284
+        ${name},
285
+      </if>
286
+      <if test="coverImg != null">
287
+        ${coverImg},
288
+      </if>
289
+      <if test="startTime != null">
290
+        ${startTime},
291
+      </if>
292
+      <if test="endTime != null">
293
+        ${endTime},
294
+      </if>
295
+      <if test="anchorName != null">
296
+        ${anchorName},
297
+      </if>
298
+      <if test="anchorWechat != null">
299
+        ${anchorWechat},
300
+      </if>
301
+      <if test="subAnchorWechat != null">
302
+        ${subAnchorWechat},
303
+      </if>
304
+      <if test="createrWechat != null">
305
+        ${createrWechat},
306
+      </if>
307
+      <if test="shareImg != null">
308
+        ${shareImg},
309
+      </if>
310
+      <if test="feedsImg != null">
311
+        ${feedsImg},
312
+      </if>
313
+      <if test="isFeedsPublic != null">
314
+        ${isFeedsPublic},
315
+      </if>
316
+      <if test="type != null">
317
+        ${type},
318
+      </if>
319
+      <if test="closeLike != null">
320
+        ${closeLike},
321
+      </if>
322
+      <if test="closeGoods != null">
323
+        ${closeGoods},
324
+      </if>
325
+      <if test="closeComment != null">
326
+        ${closeComment},
327
+      </if>
328
+      <if test="closeReplay != null">
329
+        ${closeReplay},
330
+      </if>
331
+      <if test="closeShare != null">
332
+        ${closeShare},
333
+      </if>
334
+      <if test="closeKf != null">
335
+        ${closeKf},
336
+      </if>
337
+
338
+    </trim>
339
+    )
340
+  </insert>
341
+  <!--按条件更新记录中不为空的字段-->
342
+  <update id="updateByExampleSelective">
343
+    UPDATE live_broadcast
344
+    <trim prefix="SET" suffixOverrides=",">
345
+      <if test="record.roomId != null">
346
+        AND roomId = #{record.roomId},
347
+      </if>
348
+      <if test="record.name != null">
349
+        AND name = #{record.name},
350
+      </if>
351
+      <if test="record.coverImg != null">
352
+        AND coverImg = #{record.coverImg},
353
+      </if>
354
+      <if test="record.startTime != null">
355
+        AND startTime = #{record.startTime},
356
+      </if>
357
+      <if test="record.endTime != null">
358
+        AND endTime = #{record.endTime},
359
+      </if>
360
+      <if test="record.anchorName != null">
361
+        AND anchorName = #{record.anchorName},
362
+      </if>
363
+      <if test="record.anchorWechat != null">
364
+        AND anchorWechat = #{record.anchorWechat},
365
+      </if>
366
+      <if test="record.subAnchorWechat != null">
367
+        AND subAnchorWechat = #{record.subAnchorWechat},
368
+      </if>
369
+      <if test="record.createrWechat != null">
370
+        AND createrWechat = #{record.createrWechat},
371
+      </if>
372
+      <if test="record.shareImg != null">
373
+        AND shareImg = #{record.shareImg},
374
+      </if>
375
+      <if test="record.feedsImg != null">
376
+        AND feedsImg = #{record.feedsImg},
377
+      </if>
378
+      <if test="record.isFeedsPublic != null">
379
+        AND isFeedsPublic = #{record.isFeedsPublic},
380
+      </if>
381
+      <if test="record.type != null">
382
+        AND type = #{record.type},
383
+      </if>
384
+      <if test="record.closeLike != null">
385
+        AND closeLike = #{record.closeLike},
386
+      </if>
387
+      <if test="record.closeGoods != null">
388
+        AND closeGoods = #{record.closeGoods},
389
+      </if>
390
+      <if test="record.closeComment != null">
391
+        AND closeComment = #{record.closeComment},
392
+      </if>
393
+      <if test="record.closeReplay != null">
394
+        AND closeReplay = #{record.closeReplay},
395
+      </if>
396
+      <if test="record.closeShare != null">
397
+        AND closeShare = #{record.closeShare},
398
+      </if>
399
+      <if test="record.closeKf != null">
400
+        AND closeKf = #{record.closeKf},
401
+      </if>
402
+
403
+    </trim>
404
+    <include refid="whereCondition" />
405
+  </update>
406
+  <!--按照主键更新记录中不为空的字段-->
407
+  <update id="updateByPrimaryKeySelective">
408
+    UPDATE live_broadcast
409
+    <trim prefix="SET" suffixOverrides=",">
410
+      <if test="roomId != null">
411
+        roomId = #{roomId}
412
+      </if>
413
+      <if test="name != null">
414
+        name = #{name}
415
+      </if>
416
+      <if test="coverImg != null">
417
+        coverImg = #{coverImg}
418
+      </if>
419
+      <if test="startTime != null">
420
+        startTime = #{startTime}
421
+      </if>
422
+      <if test="endTime != null">
423
+        endTime = #{endTime}
424
+      </if>
425
+      <if test="anchorName != null">
426
+        anchorName = #{anchorName}
427
+      </if>
428
+      <if test="anchorWechat != null">
429
+        anchorWechat = #{anchorWechat}
430
+      </if>
431
+      <if test="subAnchorWechat != null">
432
+        subAnchorWechat = #{subAnchorWechat}
433
+      </if>
434
+      <if test="createrWechat != null">
435
+        createrWechat = #{createrWechat}
436
+      </if>
437
+      <if test="shareImg != null">
438
+        shareImg = #{shareImg}
439
+      </if>
440
+      <if test="feedsImg != null">
441
+        feedsImg = #{feedsImg}
442
+      </if>
443
+      <if test="isFeedsPublic != null">
444
+        isFeedsPublic = #{isFeedsPublic}
445
+      </if>
446
+      <if test="type != null">
447
+        type = #{type}
448
+      </if>
449
+      <if test="closeLike != null">
450
+        closeLike = #{closeLike}
451
+      </if>
452
+      <if test="closeGoods != null">
453
+        closeGoods = #{closeGoods}
454
+      </if>
455
+      <if test="closeComment != null">
456
+        closeComment = #{closeComment}
457
+      </if>
458
+      <if test="closeReplay != null">
459
+        closeReplay = #{closeReplay}
460
+      </if>
461
+      <if test="closeShare != null">
462
+        closeShare = #{closeShare}
463
+      </if>
464
+      <if test="closeKf != null">
465
+        closeKf = #{closeKf}
466
+      </if>
467
+    </trim>
468
+    WHERE roomId = #{roomId}
469
+  </update>
470
+</mapper>

+ 20 - 0
b2b2c/b2b2c-web/src/test/com/slodon/b2b2c/controller/job/ScheduleTaskControllerTest.java

@@ -0,0 +1,20 @@
1
+package com.slodon.b2b2c.controller.job;
2
+
3
+import org.junit.Test;
4
+import org.junit.runner.RunWith;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.boot.test.context.SpringBootTest;
7
+import org.springframework.test.context.junit4.SpringRunner;
8
+
9
+@RunWith(SpringRunner.class)
10
+@SpringBootTest
11
+public class ScheduleTaskControllerTest {
12
+
13
+    @Autowired
14
+    private ScheduleTaskController taskController;
15
+
16
+    @Test
17
+    public void getJobSystemSendStockWarnRemind(){
18
+        taskController.jobSystemSendStockWarnRemind();
19
+    }
20
+}

+ 23 - 0
b2b2c/sql/建表语句.sql

@@ -0,0 +1,23 @@
1
+DROP TABLE IF EXISTS live_broadcast;
2
+CREATE TABLE live_broadcast  (
3
+  roomId varchar(50) NOT NULL COMMENT '房间ID' ,
4
+  name varchar(50) NOT NULL COMMENT '直播间名字,最短3个汉字,最长17个汉字,1个汉字相当于2个字符',
5
+  coverImg varchar(50) NOT NULL COMMENT '背景图,填入mediaID(mediaID获取后,三天内有效);图片 mediaID 的获取,请参考以下文档: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html;直播间背景图,图片规则:建议像素1080*1920,大小不超过2M',
6
+  startTime bigint(20) NOT NULL COMMENT '直播计划开始时间(开播时间需要在当前时间的10分钟后 并且 开始时间不能在 6 个月后)',
7
+  endTime bigint(20) NOT NULL COMMENT '直播计划结束时间(开播时间和结束时间间隔不得短于30分钟,不得超过24小时)',
8
+  anchorName varchar(50) NOT NULL COMMENT '主播昵称,最短2个汉字,最长15个汉字,1个汉字相当于2个字符',
9
+  anchorWechat varchar(50) NOT NULL COMMENT '主播微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证, 小程序二维码链接:https://res.wx.qq.com/op_res/9rSix1dhHfK4rR049JL0PHJ7TpOvkuZ3mE0z7Ou_Etvjf-w1J_jVX0rZqeStLfwh',
10
+  subAnchorWechat varchar(50)  COMMENT '主播副号微信号,如果未实名认证,需要先前往“小程序直播”小程序进行实名验证, 小程序二维码链接:https://res.wx.qq.com/op_res/9rSix1dhHfK4rR049JL0PHJ7TpOvkuZ3mE0z7Ou_Etvjf-w1J_jVX0rZqeStLfwh',
11
+  createrWechat varchar(50)  COMMENT '创建者微信号,不传入则此直播间所有成员可见。传入则此房间仅创建者、管理员、超管、直播间主播可见',
12
+  shareImg varchar(50) NOT NULL COMMENT '分享图,填入mediaID(mediaID获取后,三天内有效);图片 mediaID 的获取,请参考以下文档: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html;直播间分享图,图片规则:建议像素800*640,大小不超过1M;',
13
+  feedsImg varchar(50) NOT NULL COMMENT '购物直播频道封面图,填入mediaID(mediaID获取后,三天内有效);图片 mediaID 的获取,请参考以下文档: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html; 购物直播频道封面图,图片规则:建议像素800*800,大小不超过100KB;',
14
+  isFeedsPublic int(11) NOT NULL DEFAULT 1 COMMENT '是否开启官方收录 【1: 开启,0:关闭】,默认开启收录',
15
+  type  int(11) NOT NULL  COMMENT '直播间类型 【1: 推流,0:手机直播】',
16
+  closeLike int(11) NOT NULL  COMMENT '是否关闭点赞 【0:开启,1:关闭】(若关闭,观众端将隐藏点赞按钮,直播开始后不允许开启)',
17
+  closeGoods  int(11) NOT NULL  COMMENT '是否关闭货架 【0:开启,1:关闭】(若关闭,观众端将隐藏商品货架,直播开始后不允许开启)',
18
+  closeComment  int(11) NOT NULL  COMMENT '是否关闭评论 【0:开启,1:关闭】(若关闭,观众端将隐藏评论入口,直播开始后不允许开启)',
19
+  closeReplay int(11) NOT NULL DEFAULT 1 COMMENT '是否关闭回放 【0:开启,1:关闭】默认关闭回放(直播开始后允许开启)',
20
+  closeShare  int(11) NOT NULL DEFAULT 0 COMMENT '是否关闭分享 【0:开启,1:关闭】默认开启分享(直播开始后不允许修改)',
21
+  closeKf int(11) NOT NULL DEFAULT 1 COMMENT '是否关闭客服 【0:开启,1:关闭】 默认关闭客服(直播开始后允许开启)',
22
+  PRIMARY KEY (roomId) USING BTREE
23
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '直播信息表' ROW_FORMAT = Dynamic;