From 4b0bd7b167fec38f550cb9c74ef6919f2b04771d Mon Sep 17 00:00:00 2001 From: fjj <–1066869486@qq.com> Date: Sun, 14 Jan 2024 22:39:02 +0800 Subject: [PATCH 1/2] demo01 --- .../controller/UserVideoController.java | 4 +- .../doctor/controller/VideoController.java | 6 +- .../entity/UserVideoCollectionEntity.java | 8 ++ .../domain/vo/UserVideoCollectionVo.java | 80 ++----------------- .../java/doctor/mapper/UserVideoMapper.java | 2 +- .../java/doctor/service/UserVideoService.java | 4 +- .../java/doctor/service/VideoService.java | 2 +- .../service/impl/UserVideoServiceImpl.java | 4 +- .../doctor/service/impl/VideoServiceImpl.java | 5 +- .../mapper/doctor/UserVideoMapper.xml | 3 +- 10 files changed, 28 insertions(+), 90 deletions(-) diff --git a/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java b/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java index 6b8d89c..2255ff8 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java @@ -28,9 +28,9 @@ public class UserVideoController { //用户视频收藏列表 @GetMapping("/findVideoCollectionList") - public HealthR> findVideoCollectionList(@RequestParam Integer page, @RequestParam Integer count){ + public HealthR> findVideoCollectionList(@RequestParam Integer page, @RequestParam Integer count,@RequestHeader Integer userId){ startPage(page,count); - List userVideoCollectionVos=userVideoService.findVideoCollectionList(); + List userVideoCollectionVos=userVideoService.findVideoCollectionList(userId); return HealthR.ok(userVideoCollectionVos); } //用户取消视频收藏 diff --git a/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java b/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java index 3ee1af5..2f2d775 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java @@ -22,9 +22,9 @@ public class VideoController { @Autowired private VideoService videoService; //收藏健康讲堂视频列表 - @PostMapping("/verify/v1/addUserVideoCollection/{videoId}") - public HealthR addUserVideoCollection(@PathVariable Integer videoId){ - videoService.addUserVideoCollection(videoId); + @PostMapping("/verify/v1/addUserVideoCollection") + public HealthR addUserVideoCollection(@RequestParam Integer videoId,@RequestHeader Integer userId){ + videoService.addUserVideoCollection(videoId,userId); return HealthR.ok(); } //购买健康讲堂视频 diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollectionEntity.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollectionEntity.java index 667b98f..c46f727 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollectionEntity.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollectionEntity.java @@ -16,6 +16,8 @@ public class UserVideoCollectionEntity { private Integer id; private Integer userId; private Integer videoId; + + private String original; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private Date createTime; @@ -52,5 +54,11 @@ public class UserVideoCollectionEntity { this.createTime = createTime; } + public String getOriginal() { + return original; + } + public void setOriginal(String original) { + this.original = original; + } } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/vo/UserVideoCollectionVo.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/vo/UserVideoCollectionVo.java index 784595e..e5c8a1b 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/domain/vo/UserVideoCollectionVo.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/vo/UserVideoCollectionVo.java @@ -1,13 +1,21 @@ package doctor.domain.vo; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + /** * @ClassName : UserVideoCollectionVo * @Description : 用户视频收藏表 * @Author : FJJ * @Date: 2024-01-12 16:11 */ +@Data +@AllArgsConstructor +@NoArgsConstructor public class UserVideoCollectionVo { private Integer id; + private Integer videoId; private String title; private String shearUrl; private String original; @@ -16,76 +24,4 @@ public class UserVideoCollectionVo { private Integer whetherBuy; private Integer buyNum; private Long createTime; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getShearUrl() { - return shearUrl; - } - - public void setShearUrl(String shearUrl) { - this.shearUrl = shearUrl; - } - - public String getOriginal() { - return original; - } - - public void setOriginal(String original) { - this.original = original; - } - - public Integer getPrice() { - return price; - } - - public void setPrice(Integer price) { - this.price = price; - } - - public Integer getDuration() { - return duration; - } - - public void setDuration(Integer duration) { - this.duration = duration; - } - - public Integer getWhetherBuy() { - return whetherBuy; - } - - public void setWhetherBuy(Integer whetherBuy) { - this.whetherBuy = whetherBuy; - } - - public Integer getBuyNum() { - return buyNum; - } - - public void setBuyNum(Integer buyNum) { - this.buyNum = buyNum; - } - - public Long getCreateTime() { - return createTime; - } - - public void setCreateTime(Long createTime) { - this.createTime = createTime; - } } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java b/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java index c558185..93d47d1 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java @@ -17,7 +17,7 @@ import java.util.List; */ @Mapper public interface UserVideoMapper { - List findVideoCollectionList(); + List findVideoCollectionList(@Param("userId") Integer userId); void cancelVideoCollection(@Param("videoId") Integer videoId); diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java b/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java index 9868a70..a040f42 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java @@ -1,7 +1,5 @@ package doctor.service; -import doctor.domain.entity.UserVideoBuyEntity; -import doctor.domain.entity.UserVideoCollectionEntity; import doctor.domain.entity.UserWalletEntity; import doctor.domain.vo.UserConsumptionRecordVo; import doctor.domain.vo.UserVideoBuyVo; @@ -26,7 +24,7 @@ public interface UserVideoService { List findUserWallet(); - List findVideoCollectionList(); + List findVideoCollectionList(Integer userId); void cancelVideoCollection(Integer userId, String sessionId, Integer videoId); diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/VideoService.java b/doctor-modules/doctor-health/src/main/java/doctor/service/VideoService.java index 2a49f44..e9bd244 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/VideoService.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/VideoService.java @@ -13,7 +13,7 @@ import java.util.List; */ public interface VideoService { - void addUserVideoCollection(Integer videoId); + void addUserVideoCollection(Integer videoId,Integer userId); void videoBuy(Integer videoId,Integer price); diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java index 6564c2c..58a77e1 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java @@ -28,8 +28,8 @@ public class UserVideoServiceImpl implements UserVideoService { @Override - public List findVideoCollectionList() { - List userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList(); + public List findVideoCollectionList(Integer userId) { + List userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList(userId); List userVideoCollectionVoList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserVideoCollectionVo.class); return userVideoCollectionVoList; } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/VideoServiceImpl.java b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/VideoServiceImpl.java index 1cc550f..ce0b7c5 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/VideoServiceImpl.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/VideoServiceImpl.java @@ -25,10 +25,7 @@ public class VideoServiceImpl implements VideoService { @Autowired private HttpServletRequest request; @Override - public void addUserVideoCollection(Integer videoId) { - //获取用户id - String token = request.getHeader("token"); - Integer userId = Integer.valueOf(JwtUtils.getUserId(token)); + public void addUserVideoCollection(Integer videoId,Integer userId) { // 添加收藏 videoMapper.addUserVideoCollection(userId,videoId); // 更新视频收藏数 diff --git a/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml index 7e40b37..78e1293 100644 --- a/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml +++ b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml @@ -14,8 +14,7 @@ where video_id = #{videoId} + + + + diff --git a/doctor-modules/doctor-job/src/main/resources/bootstrap.yml b/doctor-modules/doctor-job/src/main/resources/bootstrap.yml index 0bffaa1..ab123c4 100644 --- a/doctor-modules/doctor-job/src/main/resources/bootstrap.yml +++ b/doctor-modules/doctor-job/src/main/resources/bootstrap.yml @@ -15,11 +15,11 @@ spring: discovery: # 服务注册地址 server-addr: 101.34.77.101:8848 - namespace: 7e34f104-f333-4828-b36a-02146e521c9a + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 7e34f104-f333-4828-b36a-02146e521c9a + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/doctor-modules/doctor-system/src/main/resources/bootstrap.yml b/doctor-modules/doctor-system/src/main/resources/bootstrap.yml index d48b98a..14e7505 100644 --- a/doctor-modules/doctor-system/src/main/resources/bootstrap.yml +++ b/doctor-modules/doctor-system/src/main/resources/bootstrap.yml @@ -15,11 +15,11 @@ spring: discovery: # 服务注册地址 server-addr: 101.34.77.101:8848 - namespace: 7e34f104-f333-4828-b36a-02146e521c9a + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 7e34f104-f333-4828-b36a-02146e521c9a + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/doctor-visual/doctor-monitor/src/main/resources/bootstrap.yml b/doctor-visual/doctor-monitor/src/main/resources/bootstrap.yml index ed199de..d94bf20 100644 --- a/doctor-visual/doctor-monitor/src/main/resources/bootstrap.yml +++ b/doctor-visual/doctor-monitor/src/main/resources/bootstrap.yml @@ -15,11 +15,11 @@ spring: discovery: # 服务注册地址 server-addr: 101.34.77.101:8848 - namespace: 7e34f104-f333-4828-b36a-02146e521c9a + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 7e34f104-f333-4828-b36a-02146e521c9a + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 # 配置文件格式 file-extension: yml # 共享配置