fjj 2024-01-15 22:14:22 +08:00
commit b0012027c5
27 changed files with 567 additions and 188 deletions

View File

@ -54,7 +54,8 @@ public class Constants
/**
*
*/
// public static final String SUCCESS_HEALTH = "0000";
// public static final String FAIL_HEALTH = "9001";
/**
*

View File

@ -26,10 +26,15 @@ public class HealthUserVideoController{
}
@GetMapping("/findVideoVoList")
public HealthR<List<VideoVo>> findVideoVoList(@RequestParam Integer categoryId,@RequestParam Integer page,@RequestParam Integer count){
public HealthR<List<VideoVo>> findVideoVoList(@RequestParam Integer categoryId,
@RequestParam Integer page,
@RequestParam Integer count,
@RequestHeader Integer userId,
@RequestHeader String sessionId){
startPage(page,count);
List<VideoVo> List = healthUserVideoService.findVideoVoList(categoryId);
List<VideoVo> List = healthUserVideoService.findVideoVoList(categoryId,userId);
return HealthR.ok(List);
}
}

View File

@ -1,10 +1,12 @@
package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.domain.dto.UserArchivesDto;
import doctor.domain.entity.UserAdoptCommentEntity;
import doctor.domain.entity.UserEntity;
import doctor.domain.entity.UserInfoCollectionEntity;
import doctor.domain.entity.UserWalletEntity;
import doctor.domain.vo.UserConsumptionRecordVo;
import doctor.domain.vo.UserVideoBuyVo;
import doctor.domain.vo.UserVideoCollectionVo;
import doctor.domain.vo.*;
import doctor.service.UserVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -28,9 +30,9 @@ public class UserVideoController {
//用户视频收藏列表
@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);
List<UserVideoCollectionVo> userVideoCollectionVos=userVideoService.findVideoCollectionList();
List<UserVideoCollectionVo> userVideoCollectionVos=userVideoService.findVideoCollectionList(userId);
return HealthR.ok(userVideoCollectionVos);
}
//用户取消视频收藏
@ -47,8 +49,8 @@ public class UserVideoController {
return HealthR.ok(userVideoCollectionVos);
}
//用户删除购买的视频
@DeleteMapping("/deleteVideoBuy/{videoId}")
public HealthR deleteVideoBuy(@PathVariable Integer videoId){
@DeleteMapping("/deleteVideoBuy}")
public HealthR deleteVideoBuy(@RequestParam Integer videoId){
userVideoService.deleteVideoBuy(videoId);
return HealthR.ok();
}
@ -67,5 +69,36 @@ public class UserVideoController {
return HealthR.ok(userConsumptionRecordVos);
}
//用户详情页面
@GetMapping("/whetherSignToday")
public HealthR<List<UserEntity>> whetherSignToday(@RequestHeader Integer userId){
List<UserEntity> userEntities = userVideoService.whetherSignToday(userId);
return HealthR.ok(userEntities);
}
// 用户资讯收藏列表
@GetMapping("/findUserInfoCollectionList")
public HealthR<List<UserInfoCollectionVo>> findUserInfoCollectionList(){
List<UserInfoCollectionVo> userInfoCollections = userVideoService.findUserInfoCollectionList();
return HealthR.ok(userInfoCollections);
}
//用户被采纳意见列表
@GetMapping("/findMyAdoptedCommentList")
public HealthR<List<UserAdoptCommentVo>> findMyAdoptedCommentList(@RequestParam Integer page,@RequestParam Integer count){
startPage(page,count);
List<UserAdoptCommentVo> userAdoptCommentEntities = userVideoService.findMyAdoptedCommentList();
return HealthR.ok(userAdoptCommentEntities);
}
//用户查看自己的档案
@GetMapping("/findUserArchives")
public HealthR<List<UserArchivesVo>> findUserArchives(@RequestHeader Integer userId){
List<UserArchivesVo> userArchivesVos = userVideoService.findUserArchives(userId);
return HealthR.ok(userArchivesVos);
}
//添加用户档案
@PostMapping("/addUserArchives")
public HealthR addUserArchives(@RequestBody UserArchivesDto userArchivesDto){
userVideoService.addUserArchives(userArchivesDto);
return HealthR.ok();
}
}

View File

@ -3,6 +3,7 @@ package doctor.controller;
import doctor.common.core.domain.HealthR;
import doctor.common.core.domain.R;
import doctor.domain.entity.*;
import doctor.domain.vo.VideoCommentVo;
import doctor.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -21,9 +22,9 @@ public class VideoController {
@Autowired
private VideoService videoService;
//收藏健康讲堂视频列表
@PostMapping("/verify/v1/addUserVideoCollection/{videoId}")
public HealthR addUserVideoCollection(@RequestParam 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();
}
//购买健康讲堂视频
@ -32,11 +33,12 @@ public class VideoController {
videoService.videoBuy(videoId,price);
return HealthR.ok();
}
// //视频评论列表
// @GetMapping("/v1/findVideoCommentList")
// public R<List<VideoCommentEntity>> findVideoCommentList(){
// List<VideoCommentEntity> videoCommentList = videoService.findVideoCommentList();
// return R.ok(videoCommentList);
// }
//评论列表
@GetMapping("/v1/findVideoCommentList")
public HealthR<List<VideoCommentVo>> findVideoCommentList(@RequestParam Integer videoId) {
List<VideoCommentVo> videoCommentVoList = videoService.findVideoCommentList(videoId);
return HealthR.ok(videoCommentVoList);
}
}

View File

@ -0,0 +1,82 @@
package doctor.domain.dto;
/**
* @ClassName : UserArchivesDto
* @Description :
* @Author : FJJ
* @Date: 2024-01-15 21:51
*/
public class UserArchivesDto {
private Integer userId;
private String diseaseMain;
private String diseaseNow;
private String diseaseBefore;
private String treatmentHospitalRecent;
private String treatmentProcess;
private String treatmentStartTime;
private String treatmentEndTime;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getDiseaseMain() {
return diseaseMain;
}
public void setDiseaseMain(String diseaseMain) {
this.diseaseMain = diseaseMain;
}
public String getDiseaseNow() {
return diseaseNow;
}
public void setDiseaseNow(String diseaseNow) {
this.diseaseNow = diseaseNow;
}
public String getDiseaseBefore() {
return diseaseBefore;
}
public void setDiseaseBefore(String diseaseBefore) {
this.diseaseBefore = diseaseBefore;
}
public String getTreatmentHospitalRecent() {
return treatmentHospitalRecent;
}
public void setTreatmentHospitalRecent(String treatmentHospitalRecent) {
this.treatmentHospitalRecent = treatmentHospitalRecent;
}
public String getTreatmentProcess() {
return treatmentProcess;
}
public void setTreatmentProcess(String treatmentProcess) {
this.treatmentProcess = treatmentProcess;
}
public String getTreatmentStartTime() {
return treatmentStartTime;
}
public void setTreatmentStartTime(String treatmentStartTime) {
this.treatmentStartTime = treatmentStartTime;
}
public String getTreatmentEndTime() {
return treatmentEndTime;
}
public void setTreatmentEndTime(String treatmentEndTime) {
this.treatmentEndTime = treatmentEndTime;
}
}

View File

@ -14,9 +14,14 @@ import java.util.Date;
public class UserArchivesEntity {
private Integer id;
private Integer userId;
private String bankCardNumber;
private String bankName;
private Integer bankCardType;
private String diseaseMain;
private String diseaseNow;
private String diseaseBefore;
private String treatmentHospitalRecent;
private String treatmentProcess;
private Date treatmentStartTime;
private Date treatmentEndTime;
private String picture;
private Date updateTime;
private Date createTime;
@ -36,28 +41,68 @@ public class UserArchivesEntity {
this.userId = userId;
}
public String getBankCardNumber() {
return bankCardNumber;
public String getDiseaseMain() {
return diseaseMain;
}
public void setBankCardNumber(String bankCardNumber) {
this.bankCardNumber = bankCardNumber;
public void setDiseaseMain(String diseaseMain) {
this.diseaseMain = diseaseMain;
}
public String getBankName() {
return bankName;
public String getDiseaseNow() {
return diseaseNow;
}
public void setBankName(String bankName) {
this.bankName = bankName;
public void setDiseaseNow(String diseaseNow) {
this.diseaseNow = diseaseNow;
}
public Integer getBankCardType() {
return bankCardType;
public String getDiseaseBefore() {
return diseaseBefore;
}
public void setBankCardType(Integer bankCardType) {
this.bankCardType = bankCardType;
public void setDiseaseBefore(String diseaseBefore) {
this.diseaseBefore = diseaseBefore;
}
public String getTreatmentHospitalRecent() {
return treatmentHospitalRecent;
}
public void setTreatmentHospitalRecent(String treatmentHospitalRecent) {
this.treatmentHospitalRecent = treatmentHospitalRecent;
}
public String getTreatmentProcess() {
return treatmentProcess;
}
public void setTreatmentProcess(String treatmentProcess) {
this.treatmentProcess = treatmentProcess;
}
public Date getTreatmentStartTime() {
return treatmentStartTime;
}
public void setTreatmentStartTime(Date treatmentStartTime) {
this.treatmentStartTime = treatmentStartTime;
}
public Date getTreatmentEndTime() {
return treatmentEndTime;
}
public void setTreatmentEndTime(Date treatmentEndTime) {
this.treatmentEndTime = treatmentEndTime;
}
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public Date getUpdateTime() {

View File

@ -1,56 +1,27 @@
package doctor.domain.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName : UserVideoBuyEntity
* @Description :
* @Author : FJJ
* @Date: 2024-01-10 15:20
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserVideoBuyEntity {
private Integer id;
private Integer userId;
private Integer videoId;
private Long createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getVideoId() {
return videoId;
}
public void setVideoId(Integer videoId) {
this.videoId = videoId;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public UserVideoBuyEntity(Integer id, Integer userId, Integer videoId, Long createTime) {
this.id = id;
this.userId = userId;
this.videoId = videoId;
this.createTime = createTime;
}
public UserVideoBuyEntity() {
}
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
}

View File

@ -1,5 +1,8 @@
package doctor.domain.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
@ -13,6 +16,10 @@ 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;
public Integer getId() {
@ -47,5 +54,11 @@ public class UserVideoCollectionEntity {
this.createTime = createTime;
}
public String getOriginal() {
return original;
}
public void setOriginal(String original) {
this.original = original;
}
}

View File

@ -1,5 +1,8 @@
package doctor.domain.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
@ -14,6 +17,8 @@ public class VideoCommentEntity {
private Integer userId;
private Integer videoId;
private String content;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
public Integer getId() {

View File

@ -26,5 +26,7 @@ public class VideoEntity {
private String originalUrl;
private Integer duration;
private Integer price;
private Long createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
}

View File

@ -0,0 +1,73 @@
package doctor.domain.vo;
/**
* @ClassName : UserAdoptCommentVo
* @Description :
* @Author : FJJ
* @Date: 2024-01-15 19:46
*/
public class UserAdoptCommentVo {
private Integer releaseUserId;
private String releaseUserNickName;
private String releaseUserHeadPic;
private String title;
private String disease;
private long adoptTime;
private String content;
public Integer getReleaseUserId() {
return releaseUserId;
}
public void setReleaseUserId(Integer releaseUserId) {
this.releaseUserId = releaseUserId;
}
public String getReleaseUserNickName() {
return releaseUserNickName;
}
public void setReleaseUserNickName(String releaseUserNickName) {
this.releaseUserNickName = releaseUserNickName;
}
public String getReleaseUserHeadPic() {
return releaseUserHeadPic;
}
public void setReleaseUserHeadPic(String releaseUserHeadPic) {
this.releaseUserHeadPic = releaseUserHeadPic;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDisease() {
return disease;
}
public void setDisease(String disease) {
this.disease = disease;
}
public long getAdoptTime() {
return adoptTime;
}
public void setAdoptTime(long adoptTime) {
this.adoptTime = adoptTime;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}

View File

@ -7,5 +7,14 @@ package doctor.domain.vo;
* @Date: 2024-01-12 18:52
*/
public class UserArchivesVo {
private Integer recordId;
private Integer userId;
private Integer archivesId;
private String diseaseMain;
private String diseaseNow;
private String diseaseBefore;
private String treatmentHospitalRecent;
private String treatmentProcess;
private long treatmentStartTime;
private long treatmentEndTime;
private String picture;
}

View File

@ -0,0 +1,57 @@
package doctor.domain.vo;
import java.util.Date;
/**
* @ClassName : UserInfoCollectionVo
* @Description :
* @Author : FJJ
* @Date: 2024-01-15 11:52
*/
public class UserInfoCollectionVo {
private Integer id;
private Integer infoId;
private String title;
private String thumbnail;
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getInfoId() {
return infoId;
}
public void setInfoId(Integer infoId) {
this.infoId = infoId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getThumbnail() {
return thumbnail;
}
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,13 @@
package doctor.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class VideoCommentVo {
private Integer id;
private String content;
}

View File

@ -1,10 +1,10 @@
package doctor.mapper;
import doctor.domain.dto.VideoDto;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.VideoCategoryEntity;
import doctor.domain.entity.VideoEntity;
import doctor.domain.vo.VideoCategoryVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -13,4 +13,10 @@ public interface HealthUserVideoMapper {
List<VideoCategoryEntity> findVideoCategoryList();
List<VideoEntity> findVideoVoList(@Param("categoryId") Integer categoryId);
UserVideoCollectionEntity selectWhetherCollectionByUserIdAndVideoId(@Param("userId") Integer userId, @Param("id") Integer id);
UserVideoBuyEntity selectWhetherBuyByUserIdAndVideoId(@Param("userId") Integer userId, @Param("id") Integer id);
Integer selectVideoBuyNum(@Param("id") Integer id);
}

View File

@ -1,9 +1,7 @@
package doctor.mapper;
import doctor.domain.entity.UserConsumptionRecordEntity;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.UserWalletEntity;
import doctor.domain.dto.UserArchivesDto;
import doctor.domain.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -17,7 +15,7 @@ import java.util.List;
*/
@Mapper
public interface UserVideoMapper {
List<UserVideoCollectionEntity> findVideoCollectionList();
List<UserVideoCollectionEntity> findVideoCollectionList(@Param("userId") Integer userId);
void cancelVideoCollection(@Param("videoId") Integer videoId);
@ -28,4 +26,14 @@ public interface UserVideoMapper {
List<UserWalletEntity> findUserWallet();
List<UserConsumptionRecordEntity> findUserConsumptionRecordList();
List<UserEntity> findUserEntityList(@Param("userId") Integer userId);
List<UserInfoCollectionEntity> findUserInfoCollectionList();
List<UserAdoptCommentEntity> findMyAdoptedCommentList();
List<UserArchivesEntity> findUserArchives(@Param("userId") Integer userId);
void addUserArchives(UserArchivesDto userArchivesDto);
}

View File

@ -31,7 +31,7 @@ public interface VideoMapper {
void updateUserWallet(@Param("newblance") int newblance, @Param("id") Integer id);
List<VideoCommentEntity> findVideoCommentList(@Param("videoId") Integer videoId);
// UserWalletEntity FindById(@Param("userId") Integer userId);

View File

@ -2,9 +2,6 @@ package doctor.service;
import doctor.domain.dto.VideoDto;
import doctor.domain.entity.VideoCategoryEntity;
import doctor.domain.entity.VideoEntity;
import doctor.domain.vo.VideoCategoryVo;
import doctor.domain.vo.VideoVo;
@ -13,5 +10,5 @@ import java.util.List;
public interface HealthUserVideoService {
List<VideoCategoryVo> findVideoCategoryList();
List<VideoVo> findVideoVoList(Integer categoryId);
List<VideoVo> findVideoVoList(Integer categoryId, Integer userId);
}

View File

@ -1,11 +1,10 @@
package doctor.service;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.dto.UserArchivesDto;
import doctor.domain.entity.UserAdoptCommentEntity;
import doctor.domain.entity.UserEntity;
import doctor.domain.entity.UserWalletEntity;
import doctor.domain.vo.UserConsumptionRecordVo;
import doctor.domain.vo.UserVideoBuyVo;
import doctor.domain.vo.UserVideoCollectionVo;
import doctor.domain.vo.*;
import java.util.List;
@ -26,9 +25,19 @@ public interface UserVideoService {
List<UserWalletEntity> findUserWallet();
List<UserVideoCollectionVo> findVideoCollectionList();
List<UserVideoCollectionVo> findVideoCollectionList(Integer userId);
void cancelVideoCollection(Integer userId, String sessionId, Integer videoId);
List<UserConsumptionRecordVo> findUserConsumptionRecordList();
List<UserEntity> whetherSignToday(Integer userId);
List<UserInfoCollectionVo> findUserInfoCollectionList();
List<UserAdoptCommentVo> findMyAdoptedCommentList();
List<UserArchivesVo> findUserArchives(Integer userId);
void addUserArchives(UserArchivesDto userArchivesDto);
}

View File

@ -1,6 +1,7 @@
package doctor.service;
import doctor.domain.entity.*;
import doctor.domain.vo.VideoCommentVo;
import java.util.List;
@ -12,10 +13,11 @@ import java.util.List;
*/
public interface VideoService {
void addUserVideoCollection(Integer videoId);
void addUserVideoCollection(Integer videoId,Integer userId);
void videoBuy(Integer videoId,Integer price);
List<VideoCommentVo> findVideoCommentList(Integer videoId);
}

View File

@ -1,7 +1,10 @@
package doctor.service.impl;
import doctor.domain.dto.VideoDto;
import doctor.common.security.service.TokenService;
import doctor.common.security.utils.SecurityUtils;
import doctor.domain.entity.UserVideoBuyEntity;
import doctor.domain.entity.UserVideoCollectionEntity;
import doctor.domain.entity.VideoCategoryEntity;
import doctor.domain.entity.VideoEntity;
import doctor.domain.vo.VideoCategoryVo;
@ -9,10 +12,10 @@ import doctor.domain.vo.VideoVo;
import doctor.mapper.HealthUserVideoMapper;
import doctor.service.HealthUserVideoService;
import doctor.util.ConvertUtil;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Service
@ -20,6 +23,9 @@ public class HealthUserVideoServiceImpl implements HealthUserVideoService {
@Autowired
private HealthUserVideoMapper healthUserVideoMapper;
@Autowired
private TokenService tokenService;
@Override
public List<VideoCategoryVo> findVideoCategoryList() {
@ -29,9 +35,26 @@ public class HealthUserVideoServiceImpl implements HealthUserVideoService {
}
@Override
public List<VideoVo> findVideoVoList(Integer categoryId) {
public List<VideoVo> findVideoVoList(Integer categoryId, Integer userId) {
List<VideoEntity> videoVoList = healthUserVideoMapper.findVideoVoList(categoryId);
List<VideoVo> videoVos = ConvertUtil.entityToVoList(videoVoList, VideoVo.class);
videoVos.forEach(video -> {
UserVideoCollectionEntity userVideoCollection = healthUserVideoMapper.selectWhetherCollectionByUserIdAndVideoId(userId,video.getId());
if(userVideoCollection!=null){
video.setWhetherCollection(1);
}else {
video.setWhetherCollection(2);
}
UserVideoBuyEntity userVideoBuy = healthUserVideoMapper.selectWhetherBuyByUserIdAndVideoId(userId,video.getId());
if(userVideoBuy!=null){
video.setWhetherBuy(1);
}else {
video.setWhetherBuy(2);
}
Integer buyNum = healthUserVideoMapper.selectVideoBuyNum(video.getId());
video.setBuyNum(buyNum);
});
return videoVos;
}
}

View File

@ -1,12 +1,8 @@
package doctor.service.impl;
import doctor.domain.entity.UserConsumptionRecordEntity;
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;
import doctor.domain.vo.UserVideoCollectionVo;
import doctor.domain.dto.UserArchivesDto;
import doctor.domain.entity.*;
import doctor.domain.vo.*;
import doctor.mapper.UserVideoMapper;
import doctor.service.UserVideoService;
import doctor.util.ConvertUtil;
@ -28,8 +24,8 @@ public class UserVideoServiceImpl implements UserVideoService {
@Override
public List<UserVideoCollectionVo> findVideoCollectionList() {
List<UserVideoCollectionEntity> userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList();
public List<UserVideoCollectionVo> findVideoCollectionList(Integer userId) {
List<UserVideoCollectionEntity> userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList(userId);
List<UserVideoCollectionVo> userVideoCollectionVoList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserVideoCollectionVo.class);
return userVideoCollectionVoList;
}
@ -46,6 +42,38 @@ public class UserVideoServiceImpl implements UserVideoService {
return userConsumptionRecordVoList;
}
@Override
public List<UserEntity> whetherSignToday(Integer userId) {
List<UserEntity> userEntityList=userVideoMapper.findUserEntityList(userId);
return userEntityList;
}
@Override
public List<UserInfoCollectionVo> findUserInfoCollectionList() {
List<UserInfoCollectionEntity> userVideoCollectionEntityList=userVideoMapper.findUserInfoCollectionList();
List<UserInfoCollectionVo> userVideoCollectionVoList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserInfoCollectionVo.class);
return userVideoCollectionVoList;
}
@Override
public List<UserAdoptCommentVo> findMyAdoptedCommentList() {
List<UserAdoptCommentEntity> userAdoptCommentEntityList=userVideoMapper.findMyAdoptedCommentList();
List<UserAdoptCommentVo> userAdoptCommentVoList = ConvertUtil.entityToVoList(userAdoptCommentEntityList, UserAdoptCommentVo.class);
return userAdoptCommentVoList;
}
@Override
public List<UserArchivesVo> findUserArchives(Integer userId) {
List<UserArchivesEntity> userArchivesEntityList=userVideoMapper.findUserArchives(userId);
List<UserArchivesVo> userArchivesVoList = ConvertUtil.entityToVoList(userArchivesEntityList, UserArchivesVo.class);
return userArchivesVoList;
}
@Override
public void addUserArchives(UserArchivesDto userArchivesDto) {
userVideoMapper.addUserArchives(userArchivesDto);
}
@Override
public List<UserVideoBuyVo> findUserVideoBuyList() {

View File

@ -2,8 +2,10 @@ package doctor.service.impl;
import doctor.common.core.utils.JwtUtils;
import doctor.domain.entity.*;
import doctor.domain.vo.VideoCommentVo;
import doctor.mapper.VideoMapper;
import doctor.service.VideoService;
import doctor.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -23,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);
// 更新视频收藏数
@ -53,5 +52,12 @@ public class VideoServiceImpl implements VideoService {
}
}
@Override
public List<VideoCommentVo> findVideoCommentList(Integer videoId) {
List<VideoCommentEntity> videoCommentEntityList = videoMapper.findVideoCommentList(videoId);
List<VideoCommentVo> videoCommentVoList = ConvertUtil.entityToVoList(videoCommentEntityList, VideoCommentVo.class);
return videoCommentVoList;
}
}

View File

@ -11,5 +11,14 @@
<select id="findVideoVoList" resultType="doctor.domain.entity.VideoEntity">
select * from video where category_id=#{categoryId}
</select>
<select id="selectWhetherCollectionByUserIdAndVideoId" resultType="doctor.domain.entity.UserVideoCollectionEntity">
select * from user_video_collection where user_id=#{userId} and video_id=#{id}
</select>
<select id="selectWhetherBuyByUserIdAndVideoId" resultType="doctor.domain.entity.UserVideoBuyEntity">
select * from user_video_buy where user_id=#{userId} and video_id=#{id}
</select>
<select id="selectVideoBuyNum" resultType="java.lang.Integer">
select count(*) buyNum from user_video_buy where video_id=#{id}
</select>
</mapper>

View File

@ -3,6 +3,33 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="doctor.mapper.UserVideoMapper">
<insert id="addUserArchives">
insert into user_archives (
user_id,
disease_main,
disease_now,
disease_before,
treatment_hospital_recent,
treatment_process,
treatment_start_time,
treatment_end_time,
picture,
create_time
)
values (
#{userId},
#{diseaseMain},
#{diseaseNow},
#{diseaseBefore},
#{treatmentHospitalRecent},
#{treatmentProcess},
#{treatmentStartTime},
#{treatmentEndTime},
#{picture},
now()
);
</insert>
<delete id="cancelVideoCollection">
delete
from user_video_collection
@ -14,8 +41,7 @@
where video_id = #{videoId}
</delete>
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollectionEntity">
select *
from user_video_collection
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}
</select>
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuyEntity">
select *
@ -29,4 +55,19 @@
select *
from user_consumption_record
</select>
<select id="findUserEntityList" resultType="doctor.domain.entity.UserEntity">
select *
from user where id=#{userId}
</select>
<select id="findUserInfoCollectionList" resultType="doctor.domain.entity.UserInfoCollectionEntity">
SELECT user_info_collection.*,information.title,information.content,information.source FROM user_info_collection LEFT JOIN information ON user_info_collection.info_id =information.id
</select>
<select id="findMyAdoptedCommentList" resultType="doctor.domain.entity.UserAdoptCommentEntity">
select *
from user_adopt_comment
</select>
<select id="findUserArchives" resultType="doctor.domain.entity.UserArchivesEntity">
select *
from user_archives where user_id=#{userId}
</select>
</mapper>

View File

@ -47,6 +47,9 @@
LEFT JOIN user ON user.id = user_wallet.user_id
WHERE user_wallet.user_id==#{id}
</select>
<select id="findVideoCommentList" resultType="doctor.domain.entity.VideoCommentEntity">
select * from video_comment where video_id=#{videoId}
</select>
</mapper>