From e868be6c913a6a99e1491c088d052a5f58e252f9 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期四, 22 五月 2025 18:08:30 +0800
Subject: [PATCH] xxl-job调整、视频收藏
---
framework/src/main/java/cn/lili/modules/lmk/domain/vo/MyCollectVO.java | 43 +++
seller-api/src/main/resources/application.yml | 2
manager-api/src/main/java/cn/lili/controller/job/TestJob.java | 30 ++
consumer/src/main/resources/application.yml | 2
framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsVO.java | 32 ++
buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java | 18
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java | 30 ++
framework/src/main/java/cn/lili/modules/lmk/service/MyCollectService.java | 76 +++++
framework/src/main/java/cn/lili/modules/lmk/domain/vo/WxVideoVO.java | 74 +++++
framework/src/main/java/cn/lili/modules/lmk/mapper/MyCollectMapper.java | 43 +++
framework/src/main/resources/mapper/lmk/VideoMapper.xml | 51 +++
consumer/pom.xml | 8
framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java | 8
framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java | 7
framework/pom.xml | 6
framework/src/main/java/cn/lili/modules/lmk/domain/query/MyCollectQuery.java | 22 +
framework/src/main/java/cn/lili/config/XxlJobConfig.java | 4
buyer-api/src/main/java/cn/lili/controller/lmk/MyCollectController.java | 56 ++++
im-api/src/main/resources/application.yml | 2
config/application.yml | 6
buyer-api/src/main/resources/application.yml | 2
framework/src/main/resources/mapper/lmk/MyCollectMapper.xml | 57 ++++
framework/src/main/java/cn/lili/modules/lmk/service/impl/MyCollectServiceImpl.java | 140 ++++++++++
manager-api/src/main/resources/application.yml | 2
framework/src/main/java/cn/lili/modules/lmk/domain/entity/MyCollect.java | 33 ++
common-api/src/main/resources/application.yml | 2
framework/src/main/java/cn/lili/modules/lmk/domain/form/MyCollectForm.java | 42 +++
manager-api/pom.xml | 2
framework/src/main/java/cn/lili/modules/lmk/domain/vo/SimpleMyCollectVO.java | 35 ++
29 files changed, 799 insertions(+), 36 deletions(-)
diff --git a/buyer-api/src/main/java/cn/lili/controller/lmk/MyCollectController.java b/buyer-api/src/main/java/cn/lili/controller/lmk/MyCollectController.java
new file mode 100644
index 0000000..f4f10fa
--- /dev/null
+++ b/buyer-api/src/main/java/cn/lili/controller/lmk/MyCollectController.java
@@ -0,0 +1,56 @@
+package cn.lili.controller.lmk;
+
+import cn.lili.base.Result;
+import cn.lili.group.Add;
+import cn.lili.modules.lmk.domain.form.MyCollectForm;
+import cn.lili.modules.lmk.domain.query.MyCollectQuery;
+import cn.lili.modules.lmk.service.MyCollectService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * 鎴戠殑鏀惰棌 鍓嶇鎺у埗鍣�
+ *
+ * @author xp
+ * @since 2025-05-22
+ */
+@Validated
+@RequiredArgsConstructor
+@Api(value = "鎴戠殑鏀惰棌", tags = "鎴戠殑鏀惰棌绠$悊")
+@RestController
+@RequestMapping("/buyer/lmk/my-collect")
+public class MyCollectController {
+
+ private final MyCollectService myCollectService;
+
+ @PostMapping("/change")
+ @ApiOperation(value = "鏀惰棌/鍙栨秷鏀惰棌", notes = "鏀惰棌/鍙栨秷鏀惰棌")
+ public Result change(@RequestBody @Validated(Add.class) MyCollectForm form) {
+ return myCollectService.change(form);
+ }
+
+ @DeleteMapping("/{id}")
+ @ApiOperation(value = "ID鍒犻櫎", notes = "ID鍒犻櫎")
+ public Result removeById(@PathVariable("id") String id) {
+ return myCollectService.removeById(id);
+ }
+
+ @DeleteMapping("/batch")
+ @ApiOperation(value = "鎵归噺鍒犻櫎", notes = "鎵归噺鍒犻櫎")
+ public Result remove(@RequestBody @NotEmpty(message = "璇烽�夋嫨鏁版嵁") List<String> ids) {
+ return myCollectService.remove(ids);
+ }
+
+ @GetMapping("/page")
+ @ApiOperation(value = "鍒嗛〉", notes = "鍒嗛〉")
+ public Result page(MyCollectQuery query) {
+ return myCollectService.page(query);
+ }
+
+}
diff --git a/buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java b/buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java
index 7d66e4f..ec8ab0d 100644
--- a/buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java
+++ b/buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java
@@ -1,5 +1,6 @@
package cn.lili.controller.lmk;
+import cn.lili.base.AbsQuery;
import cn.lili.group.Update;
import cn.lili.group.Add;
import org.springframework.validation.annotation.Validated;
@@ -57,21 +58,16 @@
return videoService.remove(ids);
}
- @GetMapping("/page")
- @ApiOperation(value = "鍒嗛〉", notes = "鍒嗛〉")
- public Result page(VideoQuery query) {
- return videoService.page(query);
- }
-
@GetMapping("/{id}")
@ApiOperation(value = "璇︽儏", notes = "璇︽儏")
- public Result detail(@PathVariable("id") Integer id) {
+ public Result detail(@PathVariable("id") String id) {
return videoService.detail(id);
}
- @GetMapping("/list")
- @ApiOperation(value = "鍒楄〃", notes = "鍒楄〃")
- public Result list() {
- return videoService.all();
+ @GetMapping("/recommend")
+ @ApiOperation(value = "瑙嗛鎺ㄨ崘", notes = "瑙嗛鎺ㄨ崘")
+ public Result recommendVideo(AbsQuery query) {
+ return videoService.recommendVideo(query);
}
+
}
diff --git a/buyer-api/src/main/resources/application.yml b/buyer-api/src/main/resources/application.yml
index 383787a..b8a1629 100644
--- a/buyer-api/src/main/resources/application.yml
+++ b/buyer-api/src/main/resources/application.yml
@@ -277,6 +277,6 @@
appname: xxl-job-executor-lilishop
address:
ip:
- port: 8891
+ port: 8848
logpath: ./xxl-job/executor
logretentiondays: 7
diff --git a/common-api/src/main/resources/application.yml b/common-api/src/main/resources/application.yml
index cec358a..d94ea5b 100644
--- a/common-api/src/main/resources/application.yml
+++ b/common-api/src/main/resources/application.yml
@@ -273,6 +273,6 @@
appname: xxl-job-executor-lilishop
address:
ip:
- port: 8891
+ port: 8848
logpath: ./xxl-job/executor
logretentiondays: 7
diff --git a/config/application.yml b/config/application.yml
index d5c9fae..70c7d2a 100644
--- a/config/application.yml
+++ b/config/application.yml
@@ -62,8 +62,10 @@
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://42.193.1.25:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+# url: jdbc:mysql://127.0.0.1:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: 321$YcYl@1970!
+# password: 123456
maxActive: 50
initialSize: 20
maxWait: 60000
@@ -306,12 +308,12 @@
xxl:
job:
admin:
- addresses: http://127.0.0.1:30001/xxl-job-admin
+ addresses: http://127.0.0.1:9001/xxl-job-admin
executor:
appname: xxl-job-executor-lilishop
address:
ip:
- port: 8891
+ port: 8848
logpath: ./xxl-job/executor
logretentiondays: 7
diff --git a/consumer/pom.xml b/consumer/pom.xml
index f743fae..e28f63e 100644
--- a/consumer/pom.xml
+++ b/consumer/pom.xml
@@ -18,12 +18,6 @@
<artifactId>framework</artifactId>
<version>${revision}</version>
</dependency>
-
- <dependency>
- <groupId>com.xuxueli</groupId>
- <artifactId>xxl-job-core</artifactId>
- <version>${xxl-job}</version>
- </dependency>
</dependencies>
<repositories>
@@ -40,4 +34,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/consumer/src/main/resources/application.yml b/consumer/src/main/resources/application.yml
index 4c7d0b5..042711c 100644
--- a/consumer/src/main/resources/application.yml
+++ b/consumer/src/main/resources/application.yml
@@ -284,6 +284,6 @@
appname: xxl-job-executor-lilishop
address:
ip:
- port: 8891
+ port: 8848
logpath: ./xxl-job/executor
logretentiondays: 7
diff --git a/framework/pom.xml b/framework/pom.xml
index fbe9bf9..4bc2af7 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -22,7 +22,11 @@
<version>3.1.0</version>
</dependency>
-
+ <dependency>
+ <groupId>com.xuxueli</groupId>
+ <artifactId>xxl-job-core</artifactId>
+ <version>${xxl-job}</version>
+ </dependency>
<dependency>
<groupId>com.qiniu</groupId>
diff --git a/consumer/src/main/java/cn/lili/timetask/config/XxlJobConfig.java b/framework/src/main/java/cn/lili/config/XxlJobConfig.java
similarity index 98%
rename from consumer/src/main/java/cn/lili/timetask/config/XxlJobConfig.java
rename to framework/src/main/java/cn/lili/config/XxlJobConfig.java
index 80116a4..24052c8 100644
--- a/consumer/src/main/java/cn/lili/timetask/config/XxlJobConfig.java
+++ b/framework/src/main/java/cn/lili/config/XxlJobConfig.java
@@ -1,4 +1,4 @@
-package cn.lili.timetask.config;
+package cn.lili.config;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
@@ -75,4 +75,4 @@
*/
-}
\ No newline at end of file
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/MyCollect.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/MyCollect.java
new file mode 100644
index 0000000..64f1896
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/MyCollect.java
@@ -0,0 +1,33 @@
+package cn.lili.modules.lmk.domain.entity;
+
+import cn.lili.mybatis.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 鎴戠殑鏀惰棌
+ *
+ * @author xp
+ * @since 2025-05-22
+ */
+@Data
+@TableName("lmk_my_collect")
+public class MyCollect extends BaseEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableField("user_id")
+ /** 鐢ㄦ埛id */
+ private String userId;
+
+ @TableField("collect_type")
+ /** 鏀惰棌绫诲瀷 */
+ private String collectType;
+
+ @TableField("ref_id")
+ /** 鏀惰棌瀵瑰簲鐨刬d锛岃棰慽d銆佸晢鍝乮d锛屾牴鎹敹钘忕被鍨嬪畾 */
+ private String refId;
+
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/MyCollectForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/MyCollectForm.java
new file mode 100644
index 0000000..426d677
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/MyCollectForm.java
@@ -0,0 +1,42 @@
+package cn.lili.modules.lmk.domain.form;
+
+import cn.lili.group.Update;
+import cn.lili.group.Add;
+import cn.lili.base.AbsForm;
+import cn.lili.modules.lmk.domain.entity.MyCollect;
+import org.springframework.beans.BeanUtils;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import org.springframework.lang.NonNull;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * 鎴戠殑鏀惰棌琛ㄥ崟
+ *
+ * @author xp
+ * @since 2025-05-22
+ */
+@Data
+@ApiModel(value = "MyCollect琛ㄥ崟", description = "鎴戠殑鏀惰棌琛ㄥ崟")
+public class MyCollectForm extends AbsForm {
+
+ @NotBlank(message = "鏀惰棌绫诲瀷涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+ @ApiModelProperty("鏀惰棌绫诲瀷")
+ private String collectType;
+
+ @NotBlank(message = "鏀惰棌id涓嶈兘涓虹┖", groups = {Add.class, Update.class})
+ @ApiModelProperty("鏀惰棌瀵瑰簲鐨刬d锛岃棰慽d銆佸晢鍝乮d锛屾牴鎹敹钘忕被鍨嬪畾")
+ private String refId;
+
+ public static MyCollect getEntityByForm(@NonNull MyCollectForm form, MyCollect entity) {
+ if(entity == null) {
+ entity = new MyCollect();
+ }
+ BeanUtils.copyProperties(form, entity);
+ return entity;
+ }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/MyCollectQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/MyCollectQuery.java
new file mode 100644
index 0000000..092ea30
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/MyCollectQuery.java
@@ -0,0 +1,22 @@
+package cn.lili.modules.lmk.domain.query;
+
+import cn.lili.base.AbsQuery;
+import java.util.List;
+import org.springframework.lang.NonNull;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 鎴戠殑鏀惰棌鏌ヨ
+ *
+ * @author xp
+ * @since 2025-05-22
+ */
+@Data
+@ApiModel(value = "MyCollect鏌ヨ鍙傛暟", description = "鎴戠殑鏀惰棌鏌ヨ鍙傛暟")
+public class MyCollectQuery extends AbsQuery {
+}
+
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/MyCollectVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/MyCollectVO.java
new file mode 100644
index 0000000..975c2d6
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/MyCollectVO.java
@@ -0,0 +1,43 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.modules.lmk.domain.entity.MyCollect;
+import java.util.List;
+import org.springframework.lang.NonNull;
+import org.springframework.beans.BeanUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * 鎴戠殑鏀惰棌灞曠ず
+ *
+ * @author xp
+ * @since 2025-05-22
+ */
+@Data
+@ApiModel(value = "鎴戠殑鏀惰棌鍝嶅簲鏁版嵁", description = "鎴戠殑鏀惰棌鍝嶅簲鏁版嵁")
+public class MyCollectVO extends AbsVo {
+
+ /** 鐢ㄦ埛id */
+ @ApiModelProperty("鐢ㄦ埛id")
+ private String userId;
+
+ /** 鏀惰棌绫诲瀷 */
+ @ApiModelProperty("鏀惰棌绫诲瀷")
+ private String collectType;
+
+ /** 鏀惰棌瀵瑰簲鐨刬d锛岃棰慽d銆佸晢鍝乮d锛屾牴鎹敹钘忕被鍨嬪畾 */
+ @ApiModelProperty("鏀惰棌瀵瑰簲鐨刬d锛岃棰慽d銆佸晢鍝乮d锛屾牴鎹敹钘忕被鍨嬪畾")
+ private String refId;
+
+ public static MyCollectVO getVoByEntity(@NonNull MyCollect entity, MyCollectVO vo) {
+ if(vo == null) {
+ vo = new MyCollectVO();
+ }
+ BeanUtils.copyProperties(entity, vo);
+ return vo;
+ }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/SimpleMyCollectVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/SimpleMyCollectVO.java
new file mode 100644
index 0000000..37a0a5f
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/SimpleMyCollectVO.java
@@ -0,0 +1,35 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.modules.lmk.domain.entity.MyCollect;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+import org.springframework.lang.NonNull;
+
+/**
+ * 鎴戠殑鏀惰棌灞曠ず
+ *
+ * @author xp
+ * @since 2025-05-22
+ */
+@Data
+@ApiModel(value = "鎴戠殑鏀惰棌鍝嶅簲鏁版嵁", description = "鎴戠殑鏀惰棌鍝嶅簲鏁版嵁")
+public class SimpleMyCollectVO {
+
+ private String id;
+
+ /** 鏀惰棌瀵瑰簲鐨刬d锛岃棰慽d銆佸晢鍝乮d锛屾牴鎹敹钘忕被鍨嬪畾 */
+ @ApiModelProperty("鏀惰棌瀵瑰簲鐨刬d锛岃棰慽d銆佸晢鍝乮d锛屾牴鎹敹钘忕被鍨嬪畾")
+ private String refId;
+
+ public static SimpleMyCollectVO getVoByEntity(@NonNull MyCollect entity, SimpleMyCollectVO vo) {
+ if(vo == null) {
+ vo = new SimpleMyCollectVO();
+ }
+ BeanUtils.copyProperties(entity, vo);
+ return vo;
+ }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsVO.java
new file mode 100644
index 0000000..8f7488d
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/VideoGoodsVO.java
@@ -0,0 +1,32 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 瑙嗛鎮寕鍟嗗搧淇℃伅
+ *
+ * @author锛歺p
+ * @date锛�2025/5/22 14:17
+ */
+@Data
+public class VideoGoodsVO {
+
+ private String id;
+
+ @ApiModelProperty("鍥剧墖鍦板潃")
+ private String imageUrl = "https://picsum.photos/200/200?random=2";
+
+ @ApiModelProperty("鍟嗗搧鍚嶇О")
+ private String name = "鎺ㄦ祦";
+
+ @ApiModelProperty("浠锋牸")
+ private String price = "10";
+
+ @ApiModelProperty("鍘熶环")
+ private String originalPrice = "48.9";
+
+ @ApiModelProperty("宸插敭鏁伴噺")
+ private Long saleNum = 125L;
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/WxVideoVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/WxVideoVO.java
new file mode 100644
index 0000000..e56c50d
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/WxVideoVO.java
@@ -0,0 +1,74 @@
+package cn.lili.modules.lmk.domain.vo;
+
+import cn.lili.base.AbsVo;
+import cn.lili.modules.lmk.domain.entity.Video;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+import org.springframework.lang.NonNull;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 瑙嗛鍐呭灞曠ず
+ *
+ * @author xp
+ * @since 2025-05-16
+ */
+@Data
+@ApiModel(value = "瑙嗛鍐呭鍝嶅簲鏁版嵁", description = "瑙嗛鍐呭鍝嶅簲鏁版嵁")
+public class WxVideoVO extends AbsVo {
+
+ /** 浣滆�卛d */
+ @ApiModelProperty("浣滆�卛d")
+ private String authorId;
+ private String authorName;
+ private String authorAvatar;
+
+ /** 鍥剧墖灏侀潰 */
+ @ApiModelProperty("鍥剧墖灏侀潰")
+ private String coverUrl;
+
+ /** 瑙嗛鍦板潃 */
+ @ApiModelProperty("瑙嗛鍦板潃")
+ private String videoFileKey;
+ private String videoUrl;
+
+ @ApiModelProperty("瑙嗛鏍囩")
+ private List<SimpleVideoTagVO> tagList;
+
+ /** 瑙嗛濉厖妯″紡 */
+ @ApiModelProperty("瑙嗛濉厖妯″紡")
+ private String videoFit;
+
+ /** 瑙嗛鏍囬 */
+ @ApiModelProperty("瑙嗛鏍囬")
+ private String title;
+
+ /** 鍟嗗搧淇℃伅 */
+ @ApiModelProperty("鍟嗗搧淇℃伅")
+ private VideoGoodsVO goods;
+
+ @ApiModelProperty("褰撳墠鐢ㄦ埛鏄惁鏀惰棌浜嗚瑙嗛")
+ private Boolean collected = Boolean.FALSE;
+
+ /** 鏀惰棌鏁� */
+ @ApiModelProperty("鏀惰棌鏁�")
+ private Long collectNum;
+
+ /** 璇勮鏁� */
+ @ApiModelProperty("璇勮鏁�")
+ private Long commentNum;
+
+
+ public static WxVideoVO getVoByEntity(@NonNull Video entity, WxVideoVO vo) {
+ if(vo == null) {
+ vo = new WxVideoVO();
+ }
+ BeanUtils.copyProperties(entity, vo);
+ return vo;
+ }
+
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/MyCollectMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/MyCollectMapper.java
new file mode 100644
index 0000000..c6e6eb1
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/MyCollectMapper.java
@@ -0,0 +1,43 @@
+package cn.lili.modules.lmk.mapper;
+
+import cn.lili.modules.lmk.domain.entity.MyCollect;
+import cn.lili.modules.lmk.domain.vo.SimpleMyCollectVO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import cn.lili.modules.lmk.domain.vo.MyCollectVO;
+import cn.lili.modules.lmk.domain.form.MyCollectForm;
+import cn.lili.modules.lmk.domain.query.MyCollectQuery;
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 鎴戠殑鏀惰棌 Mapper 鎺ュ彛
+ *
+ * @author xp
+ * @since 2025-05-22
+ */
+@Mapper
+public interface MyCollectMapper extends BaseMapper<MyCollect> {
+
+ /**
+ * id鏌ユ壘鎴戠殑鏀惰棌
+ * @param id
+ * @return
+ */
+ MyCollectVO getById(String id);
+
+ /**
+ * 鍒嗛〉
+ */
+ IPage getPage(IPage page, @Param("query") MyCollectQuery query);
+
+ /**
+ * 鏌ヨ鏌愪汉鏀惰棌瀵瑰簲瑙嗛娌�
+ *
+ * @param videoIds
+ * @param currentUserId
+ * @return
+ */
+ List<SimpleMyCollectVO> getCollectsByVideoIds(@Param("videoIds") List<String> videoIds, @Param("userId") String currentUserId);
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
index e49d338..648b106 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
@@ -39,4 +39,11 @@
* @param query
*/
IPage managerPage(IPage page, @Param("query") ManagerVideoQuery query);
+
+ /**
+ * 鏌ュ嚭5涓帹鑽愯棰�
+ *
+ * @return
+ */
+ IPage recommendVideo(IPage page);
}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/MyCollectService.java b/framework/src/main/java/cn/lili/modules/lmk/service/MyCollectService.java
new file mode 100644
index 0000000..5ee9d89
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/MyCollectService.java
@@ -0,0 +1,76 @@
+package cn.lili.modules.lmk.service;
+
+import cn.lili.modules.lmk.domain.entity.MyCollect;
+import cn.lili.modules.lmk.domain.vo.SimpleMyCollectVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import cn.lili.base.Result;
+import cn.lili.modules.lmk.domain.form.MyCollectForm;
+import cn.lili.modules.lmk.domain.query.MyCollectQuery;
+import org.springframework.beans.PropertyValues;
+
+import java.util.List;
+
+/**
+ * 鎴戠殑鏀惰棌 鏈嶅姟绫�
+ *
+ * @author xp
+ * @since 2025-05-22
+ */
+public interface MyCollectService extends IService<MyCollect> {
+
+ /**
+ * 娣诲姞
+ * @param form
+ * @return
+ */
+ Result change(MyCollectForm form);
+
+ /**
+ * 淇敼
+ * @param form
+ * @return
+ */
+ Result update(MyCollectForm form);
+
+ /**
+ * 鎵归噺鍒犻櫎
+ * @param ids
+ * @return
+ */
+ Result remove(List<String> ids);
+
+ /**
+ * id鍒犻櫎
+ * @param id
+ * @return
+ */
+ Result removeById(String id);
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ * @param query
+ * @return
+ */
+ Result page(MyCollectQuery query);
+
+ /**
+ * 鏍规嵁id鏌ユ壘
+ * @param id
+ * @return
+ */
+ Result detail(String id);
+
+ /**
+ * 鍒楄〃
+ * @return
+ */
+ Result all();
+
+ /**
+ * 鏌ヨ鏌愪汉瀵瑰簲瑙嗛鐨勬敹钘�
+ *
+ * @param videoIds
+ * @return
+ */
+ List<SimpleMyCollectVO> getCollectsByVideoIds(List<String> videoIds);
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java b/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
index 1464d39..d17750f 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
@@ -1,5 +1,6 @@
package cn.lili.modules.lmk.service;
+import cn.lili.base.AbsQuery;
import cn.lili.modules.lmk.domain.entity.Video;
import cn.lili.modules.lmk.domain.form.VideoAuditingForm;
import cn.lili.modules.lmk.domain.form.VideoDownForm;
@@ -114,4 +115,11 @@
* @return
*/
Result down(VideoDownForm form);
+
+ /**
+ * 灏忕▼搴忕鐨勮棰戞帹鑽愭帴鍙�
+ *
+ * @return
+ */
+ Result recommendVideo(AbsQuery query);
}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/MyCollectServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/MyCollectServiceImpl.java
new file mode 100644
index 0000000..2b513d9
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/MyCollectServiceImpl.java
@@ -0,0 +1,140 @@
+package cn.lili.modules.lmk.service.impl;
+
+import cn.lili.common.security.context.UserContext;
+import cn.lili.modules.lmk.domain.vo.SimpleMyCollectVO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import cn.lili.modules.lmk.domain.entity.MyCollect;
+import cn.lili.modules.lmk.mapper.MyCollectMapper;
+import cn.lili.modules.lmk.service.MyCollectService;
+import cn.lili.base.Result;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import cn.lili.modules.lmk.domain.form.MyCollectForm;
+import cn.lili.modules.lmk.domain.vo.MyCollectVO;
+import cn.lili.modules.lmk.domain.query.MyCollectQuery;
+import org.springframework.stereotype.Service;
+import lombok.RequiredArgsConstructor;
+import cn.lili.utils.PageUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.util.Assert;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 鎴戠殑鏀惰棌 鏈嶅姟瀹炵幇绫�
+ *
+ * @author xp
+ * @since 2025-05-22
+ */
+@Service
+@RequiredArgsConstructor
+public class MyCollectServiceImpl extends ServiceImpl<MyCollectMapper, MyCollect> implements MyCollectService {
+
+ private final MyCollectMapper myCollectMapper;
+
+ /**
+ * 娣诲姞
+ * @param form
+ * @return
+ */
+ @Override
+ public Result change(MyCollectForm form) {
+ MyCollect myCollect = new LambdaQueryChainWrapper<>(baseMapper)
+ .eq(MyCollect::getCollectType, form.getCollectType())
+ .eq(MyCollect::getRefId, form.getRefId())
+ .eq(MyCollect::getUserId, UserContext.getCurrentUserId())
+ .one();
+ if (Objects.nonNull(myCollect)) {
+ baseMapper.deleteById(myCollect.getId());
+ } else {
+ myCollect = new MyCollect();
+ myCollect.setRefId(form.getRefId());
+ myCollect.setCollectType(form.getCollectType());
+ myCollect.setUserId(UserContext.getCurrentUserId());
+ baseMapper.insert(myCollect);
+ }
+ return Result.ok("鎿嶄綔鎴愬姛");
+ }
+
+ /**
+ * 淇敼
+ * @param form
+ * @return
+ */
+ @Override
+ public Result update(MyCollectForm form) {
+ MyCollect entity = baseMapper.selectById(form.getId());
+
+ // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊
+ Assert.notNull(entity, "璁板綍涓嶅瓨鍦�");
+ BeanUtils.copyProperties(form, entity);
+ baseMapper.updateById(entity);
+ return Result.ok("淇敼鎴愬姛");
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎
+ * @param ids
+ * @return
+ */
+ @Override
+ public Result remove(List<String> ids) {
+ baseMapper.deleteBatchIds(ids);
+ return Result.ok("鍒犻櫎鎴愬姛");
+ }
+
+ /**
+ * id鍒犻櫎
+ * @param id
+ * @return
+ */
+ @Override
+ public Result removeById(String id) {
+ baseMapper.deleteById(id);
+ return Result.ok("鍒犻櫎鎴愬姛");
+ }
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ * @param query
+ * @return
+ */
+ @Override
+ public Result page(MyCollectQuery query) {
+ IPage<MyCollectVO> page = PageUtil.getPage(query, MyCollectVO.class);
+ baseMapper.getPage(page, query);
+ return Result.ok().data(page.getRecords()).total(page.getTotal());
+ }
+
+ /**
+ * 鏍规嵁id鏌ユ壘
+ * @param id
+ * @return
+ */
+ @Override
+ public Result detail(String id) {
+ MyCollectVO vo = baseMapper.getById(id);
+ Assert.notNull(vo, "璁板綍涓嶅瓨鍦�");
+ return Result.ok().data(vo);
+ }
+
+ /**
+ * 鍒楄〃
+ * @return
+ */
+ @Override
+ public Result all() {
+ List<MyCollect> entities = baseMapper.selectList(null);
+ List<MyCollectVO> vos = entities.stream()
+ .map(entity -> MyCollectVO.getVoByEntity(entity, null))
+ .collect(Collectors.toList());
+ return Result.ok().data(vos);
+ }
+
+ @Override
+ public List<SimpleMyCollectVO> getCollectsByVideoIds(List<String> videoIds) {
+ return baseMapper.getCollectsByVideoIds(videoIds, UserContext.getCurrentUserId());
+ }
+}
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
index b6a53a8..33388a9 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
@@ -1,5 +1,6 @@
package cn.lili.modules.lmk.service.impl;
+import cn.lili.base.AbsQuery;
import cn.lili.common.security.context.UserContext;
import cn.lili.modules.lmk.domain.entity.VideoAuditRecord;
import cn.lili.modules.lmk.domain.entity.VideoTag;
@@ -8,7 +9,7 @@
import cn.lili.modules.lmk.domain.form.VideoDownForm;
import cn.lili.modules.lmk.domain.form.VideoRecommendForm;
import cn.lili.modules.lmk.domain.query.ManagerVideoQuery;
-import cn.lili.modules.lmk.domain.vo.SimpleVideoTagVO;
+import cn.lili.modules.lmk.domain.vo.*;
import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum;
import cn.lili.modules.lmk.enums.general.VideoStatusEnum;
import cn.lili.modules.lmk.service.*;
@@ -21,8 +22,8 @@
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.lili.modules.lmk.domain.form.VideoForm;
-import cn.lili.modules.lmk.domain.vo.VideoVO;
import cn.lili.modules.lmk.domain.query.VideoQuery;
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
@@ -49,6 +50,7 @@
private final VideoTagRefService videoTagRefService;
private final LmkFileService lmkFileService;
private final VideoAuditRecordService videoAuditRecordService;
+ private final MyCollectService myCollectService;
private final COSUtil cosUtil;
/**
@@ -252,4 +254,28 @@
// TODO 灏嗕笅鏋跺師鍥犱互閫氱煡鐨勬柟寮忓憡鐭ョ敤鎴�
return Result.ok("涓嬫灦鎴愬姛");
}
+
+ @Override
+ public Result recommendVideo(AbsQuery query) {
+ // 鎺ㄨ崘绠楁硶锛� 1. 鏍规嵁鐢ㄦ埛鐨勬敹钘忚棰戠殑鏍囩 2. 鏍规嵁鐢ㄦ埛鍏虫敞鐨勪綔鑰呯殑鍏跺畠瑙嗛 3. 鏍规嵁鐢ㄦ埛鐨勮鐪嬭褰曪紙瑙傜湅鏃堕暱杈冮暱鐨勩�侀噸澶嶈鐪嬫鏁拌緝澶氱殑锛� 4. 鍩轰簬鐩镐技鐢ㄦ埛鐨勮鐪嬭涓烘潵缁欒鐢ㄦ埛鎺ㄨ崘
+ IPage<WxVideoVO> page = PageUtil.getPage(query, WxVideoVO.class);
+ baseMapper.recommendVideo(page);
+ if (page.getTotal() > 0) {
+ List<String> videoIds = page.getRecords().stream().map(WxVideoVO::getId).collect(Collectors.toList());
+ Map<String, List<SimpleVideoTagVO>> tagMap = videoTagRefService.getTagsByVideoIds(videoIds)
+ .stream()
+ .collect(Collectors.groupingBy(SimpleVideoTagVO::getVideoId));
+ Map<String, List<SimpleMyCollectVO>> collectMap =myCollectService.getCollectsByVideoIds(videoIds)
+ .stream()
+ .collect(Collectors.groupingBy(SimpleMyCollectVO::getRefId));
+ // 3. 鑾峰彇瑙嗛涓存椂璁块棶鍦板潃銆佽缃棰戞爣绛俱�佹垜鏄惁鏀惰棌
+ page.getRecords().forEach(v -> {
+ v.setGoods(new VideoGoodsVO());
+ v.setTagList(tagMap.get(v.getId()));
+ v.setCollected(CollectionUtils.isNotEmpty(collectMap.get(v.getId())));
+ v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
+ });
+ }
+ return Result.ok().data(page.getRecords());
+ }
}
diff --git a/framework/src/main/resources/mapper/lmk/MyCollectMapper.xml b/framework/src/main/resources/mapper/lmk/MyCollectMapper.xml
new file mode 100644
index 0000000..b3f1a43
--- /dev/null
+++ b/framework/src/main/resources/mapper/lmk/MyCollectMapper.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.lili.modules.lmk.mapper.MyCollectMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.MyCollectVO">
+ <id column="id" property="id"/>
+ <result column="user_id" property="userId" />
+ <result column="collect_type" property="collectType" />
+ <result column="ref_id" property="refId" />
+ </resultMap>
+
+
+
+
+
+
+
+ <select id="getById" resultMap="BaseResultMap">
+ SELECT
+ LMC.user_id,
+ LMC.collect_type,
+ LMC.ref_id,
+ LMC.id
+ FROM
+ lmk_my_collect LMC
+ WHERE
+ LMC.id = #{id} AND LMC.delete_flag = 0
+ </select>
+
+
+ <select id="getPage" resultMap="BaseResultMap">
+ SELECT
+ LMC.user_id,
+ LMC.collect_type,
+ LMC.ref_id,
+ LMC.id
+ FROM
+ lmk_my_collect LMC
+ WHERE
+ LMC.delete_flag = 0
+ </select>
+
+ <select id="getCollectsByVideoIds" resultType="cn.lili.modules.lmk.domain.vo.SimpleMyCollectVO">
+ SELECT
+ id,
+ ref_id as refId
+ FROM
+ lmk_my_collect
+ WHERE
+ user_id = #{userId}
+ AND delete_flag = 0
+ AND collect_type = 'video'
+ AND ref_id IN <foreach collection="videoIds" open="(" item="videoId" close=")" separator=",">#{videoId}</foreach>
+ </select>
+
+</mapper>
diff --git a/framework/src/main/resources/mapper/lmk/VideoMapper.xml b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
index 417ca5e..1621b0e 100644
--- a/framework/src/main/resources/mapper/lmk/VideoMapper.xml
+++ b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
@@ -24,6 +24,20 @@
<result column="update_time" property="updateTime" />
</resultMap>
+ <!-- 寰俊鎺ㄨ崘瑙嗛 -->
+ <resultMap id="WxResultMap" type="cn.lili.modules.lmk.domain.vo.WxVideoVO">
+ <id column="id" property="id"/>
+ <result column="author_id" property="authorId" />
+ <result column="authorName" property="authorName" />
+ <result column="authorAvatar" property="authorAvatar" />
+ <result column="cover_url" property="coverUrl" />
+ <result column="video_file_key" property="videoFileKey" />
+ <result column="video_fit" property="videoFit" />
+ <result column="title" property="title" />
+ <result column="collect_num" property="collectNum" />
+ <result column="comment_num" property="commentNum" />
+ </resultMap>
+
<select id="getById" resultMap="BaseResultMap">
SELECT
@@ -66,13 +80,13 @@
LV.recommend,
LV.status,
LV.play_num,
- LV.collect_num,
LV.comment_num,
LV.weight,
LV.audit_pass_time,
LV.update_time,
LV.id,
- LM.nick_name as authorName
+ LM.nick_name as authorName,
+ (SELECT COUNT(*) FROM lmk_my_collect WHERE ref_id = LV.id AND collect_type = 'video' AND delete_flag = 0) as collect_num
FROM
lmk_video LV
LEFT JOIN li_member LM ON LV.author_id = LM.id
@@ -94,13 +108,13 @@
LV.recommend,
LV.status,
LV.play_num,
- LV.collect_num,
LV.comment_num,
LV.weight,
LV.audit_pass_time,
LV.update_time,
LV.id,
- LM.nick_name as authorName
+ LM.nick_name as authorName,
+ (SELECT COUNT(*) FROM lmk_my_collect WHERE ref_id = LV.id AND collect_type = 'video' AND delete_flag = 0) as collect_num
FROM
lmk_video LV
LEFT JOIN li_member LM ON LV.author_id = LM.id
@@ -119,4 +133,33 @@
<if test="query.status != null and query.status != ''">AND LV.status = #{query.status}</if>
</select>
+
+ <select id="recommendVideo" resultMap="WxResultMap">
+ SELECT
+ LV.author_id,
+ LV.cover_url,
+ LV.video_fit,
+ LV.video_file_key,
+ LV.title,
+ LV.goods_id,
+ LV.goods_view_num,
+ LV.goods_order_num,
+ LV.recommend,
+ LV.status,
+ LV.play_num,
+ LV.comment_num,
+ LV.weight,
+ LV.audit_pass_time,
+ LV.update_time,
+ LV.id,
+ LM.nick_name as authorName,
+ LM.face as authorAvatar,
+ (SELECT COUNT(*) FROM lmk_my_collect WHERE ref_id = LV.id AND collect_type = 'video' AND delete_flag = 0) as collect_num
+ FROM
+ lmk_video LV
+ LEFT JOIN li_member LM ON LV.author_id = LM.id
+ WHERE
+ LV.delete_flag = 0 AND LV.status = '1'
+ </select>
+
</mapper>
diff --git a/im-api/src/main/resources/application.yml b/im-api/src/main/resources/application.yml
index 86cc307..50b40ea 100644
--- a/im-api/src/main/resources/application.yml
+++ b/im-api/src/main/resources/application.yml
@@ -272,6 +272,6 @@
appname: xxl-job-executor-lilishop
address:
ip:
- port: 8891
+ port: 8848
logpath: ./xxl-job/executor
logretentiondays: 7
diff --git a/manager-api/pom.xml b/manager-api/pom.xml
index f2b40c4..e25db3c 100644
--- a/manager-api/pom.xml
+++ b/manager-api/pom.xml
@@ -29,4 +29,4 @@
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/manager-api/src/main/java/cn/lili/controller/job/TestJob.java b/manager-api/src/main/java/cn/lili/controller/job/TestJob.java
new file mode 100644
index 0000000..2cfab23
--- /dev/null
+++ b/manager-api/src/main/java/cn/lili/controller/job/TestJob.java
@@ -0,0 +1,30 @@
+package cn.lili.controller.job;
+
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.stereotype.Component;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author锛歺p
+ * @date锛�2025/5/22 16:49
+ */
+@Component
+public class TestJob {
+
+ // 绠�鍗曚换鍔$ず渚�
+ @XxlJob("demoJobHandler")
+ public void demoJobHandler() throws Exception {
+ XxlJobHelper.log("XXL-JOB, Hello World.");
+
+ // 鎵ц浣犵殑涓氬姟閫昏緫
+ for (int i = 0; i < 5; i++) {
+ XxlJobHelper.log("beat at:" + i);
+ TimeUnit.SECONDS.sleep(2);
+ }
+
+ // 榛樿杩斿洖鎴愬姛缁撴灉
+ }
+
+}
diff --git a/manager-api/src/main/resources/application.yml b/manager-api/src/main/resources/application.yml
index 2ca00c5..d8f5333 100644
--- a/manager-api/src/main/resources/application.yml
+++ b/manager-api/src/main/resources/application.yml
@@ -272,6 +272,6 @@
appname: xxl-job-executor-lilishop
address:
ip:
- port: 8891
+ port: 8848
logpath: ./xxl-job/executor
logretentiondays: 7
diff --git a/seller-api/src/main/resources/application.yml b/seller-api/src/main/resources/application.yml
index 75c82b1..57f3d24 100644
--- a/seller-api/src/main/resources/application.yml
+++ b/seller-api/src/main/resources/application.yml
@@ -265,6 +265,6 @@
appname: xxl-job-executor-lilishop
address:
ip:
- port: 8891
+ port: 8848
logpath: ./xxl-job/executor
logretentiondays: 7
--
Gitblit v1.8.0