cbx
fjj 2024-01-14 22:39:02 +08:00
parent 0d1707aa56
commit 4b0bd7b167
10 changed files with 28 additions and 90 deletions

View File

@ -28,9 +28,9 @@ public class UserVideoController {
//用户视频收藏列表 //用户视频收藏列表
@GetMapping("/findVideoCollectionList") @GetMapping("/findVideoCollectionList")
public HealthR<List<UserVideoCollectionVo>> findVideoCollectionList(@RequestParam Integer page, @RequestParam Integer count){ public HealthR<List<UserVideoCollectionVo>> findVideoCollectionList(@RequestParam Integer page, @RequestParam Integer count,@RequestHeader Integer userId){
startPage(page,count); startPage(page,count);
List<UserVideoCollectionVo> userVideoCollectionVos=userVideoService.findVideoCollectionList(); List<UserVideoCollectionVo> userVideoCollectionVos=userVideoService.findVideoCollectionList(userId);
return HealthR.ok(userVideoCollectionVos); return HealthR.ok(userVideoCollectionVos);
} }
//用户取消视频收藏 //用户取消视频收藏

View File

@ -22,9 +22,9 @@ public class VideoController {
@Autowired @Autowired
private VideoService videoService; private VideoService videoService;
//收藏健康讲堂视频列表 //收藏健康讲堂视频列表
@PostMapping("/verify/v1/addUserVideoCollection/{videoId}") @PostMapping("/verify/v1/addUserVideoCollection")
public HealthR addUserVideoCollection(@PathVariable Integer videoId){ public HealthR addUserVideoCollection(@RequestParam Integer videoId,@RequestHeader Integer userId){
videoService.addUserVideoCollection(videoId); videoService.addUserVideoCollection(videoId,userId);
return HealthR.ok(); return HealthR.ok();
} }
//购买健康讲堂视频 //购买健康讲堂视频

View File

@ -16,6 +16,8 @@ public class UserVideoCollectionEntity {
private Integer id; private Integer id;
private Integer userId; private Integer userId;
private Integer videoId; private Integer videoId;
private String original;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime; private Date createTime;
@ -52,5 +54,11 @@ public class UserVideoCollectionEntity {
this.createTime = createTime; this.createTime = createTime;
} }
public String getOriginal() {
return original;
}
public void setOriginal(String original) {
this.original = original;
}
} }

View File

@ -1,13 +1,21 @@
package doctor.domain.vo; package doctor.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/** /**
* @ClassName : UserVideoCollectionVo * @ClassName : UserVideoCollectionVo
* @Description : * @Description :
* @Author : FJJ * @Author : FJJ
* @Date: 2024-01-12 16:11 * @Date: 2024-01-12 16:11
*/ */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserVideoCollectionVo { public class UserVideoCollectionVo {
private Integer id; private Integer id;
private Integer videoId;
private String title; private String title;
private String shearUrl; private String shearUrl;
private String original; private String original;
@ -16,76 +24,4 @@ public class UserVideoCollectionVo {
private Integer whetherBuy; private Integer whetherBuy;
private Integer buyNum; private Integer buyNum;
private Long createTime; 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;
}
} }

View File

@ -17,7 +17,7 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface UserVideoMapper { public interface UserVideoMapper {
List<UserVideoCollectionEntity> findVideoCollectionList(); List<UserVideoCollectionEntity> findVideoCollectionList(@Param("userId") Integer userId);
void cancelVideoCollection(@Param("videoId") Integer videoId); void cancelVideoCollection(@Param("videoId") Integer videoId);

View File

@ -1,7 +1,5 @@
package doctor.service; package doctor.service;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.UserWalletEntity; import doctor.domain.entity.UserWalletEntity;
import doctor.domain.vo.UserConsumptionRecordVo; import doctor.domain.vo.UserConsumptionRecordVo;
import doctor.domain.vo.UserVideoBuyVo; import doctor.domain.vo.UserVideoBuyVo;
@ -26,7 +24,7 @@ public interface UserVideoService {
List<UserWalletEntity> findUserWallet(); List<UserWalletEntity> findUserWallet();
List<UserVideoCollectionVo> findVideoCollectionList(); List<UserVideoCollectionVo> findVideoCollectionList(Integer userId);
void cancelVideoCollection(Integer userId, String sessionId, Integer videoId); void cancelVideoCollection(Integer userId, String sessionId, Integer videoId);

View File

@ -13,7 +13,7 @@ import java.util.List;
*/ */
public interface VideoService { public interface VideoService {
void addUserVideoCollection(Integer videoId); void addUserVideoCollection(Integer videoId,Integer userId);
void videoBuy(Integer videoId,Integer price); void videoBuy(Integer videoId,Integer price);

View File

@ -28,8 +28,8 @@ public class UserVideoServiceImpl implements UserVideoService {
@Override @Override
public List<UserVideoCollectionVo> findVideoCollectionList() { public List<UserVideoCollectionVo> findVideoCollectionList(Integer userId) {
List<UserVideoCollectionEntity> userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList(); List<UserVideoCollectionEntity> userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList(userId);
List<UserVideoCollectionVo> userVideoCollectionVoList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserVideoCollectionVo.class); List<UserVideoCollectionVo> userVideoCollectionVoList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserVideoCollectionVo.class);
return userVideoCollectionVoList; return userVideoCollectionVoList;
} }

View File

@ -25,10 +25,7 @@ public class VideoServiceImpl implements VideoService {
@Autowired @Autowired
private HttpServletRequest request; private HttpServletRequest request;
@Override @Override
public void addUserVideoCollection(Integer videoId) { public void addUserVideoCollection(Integer videoId,Integer userId) {
//获取用户id
String token = request.getHeader("token");
Integer userId = Integer.valueOf(JwtUtils.getUserId(token));
// 添加收藏 // 添加收藏
videoMapper.addUserVideoCollection(userId,videoId); videoMapper.addUserVideoCollection(userId,videoId);
// 更新视频收藏数 // 更新视频收藏数

View File

@ -14,8 +14,7 @@
where video_id = #{videoId} where video_id = #{videoId}
</delete> </delete>
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollectionEntity"> <select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollectionEntity">
select * SELECT user_video_collection.*,video.original_url original FROM user_video_collection LEFT JOIN video ON video.id=user_video_collection.video_id where user_id=#{userId}
from user_video_collection
</select> </select>
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuyEntity"> <select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuyEntity">
select * select *