后台接口1
parent
227ba63d99
commit
a49d47c6ae
|
@ -0,0 +1,53 @@
|
|||
package doctor;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Author ifredom
|
||||
* @Description 类型转换: Entity - Vo转换
|
||||
* @Date 2022/5/10 15:59
|
||||
* @Param [params]
|
||||
**/
|
||||
public class ConvertUtil {
|
||||
public static final Logger logger = LoggerFactory.getLogger(ConvertUtil.class);
|
||||
|
||||
public static <T> T entityToVo(Object source, Class<T> target) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
T targetObject = null;
|
||||
try {
|
||||
targetObject = target.newInstance();
|
||||
BeanUtils.copyProperties(source, targetObject);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return targetObject;
|
||||
}
|
||||
|
||||
public static <T> List<T> entityToVoList(Collection<?> sourceList, Class<T> target) {
|
||||
if (sourceList == null) {
|
||||
return null;
|
||||
}
|
||||
List<T> targetList = new ArrayList<>(sourceList.size());
|
||||
|
||||
try {
|
||||
for (Object source : sourceList) {
|
||||
T targetObject = target.newInstance();
|
||||
BeanUtils.copyProperties(source, targetObject);
|
||||
targetList.add(targetObject);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("convert error ", e);
|
||||
}
|
||||
return targetList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package doctor.controller;
|
||||
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.domain.vo.InquiryDetailsRecordVo;
|
||||
import doctor.service.InquiryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.pagehelper.page.PageMethod.startPage;
|
||||
|
||||
/**
|
||||
* @ClassName : InquiryController
|
||||
* @Description : 问诊
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 19:09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/inquiry/verify/v1")
|
||||
public class InquiryController {
|
||||
@Autowired
|
||||
private InquiryService inquiryService;
|
||||
//历史问诊记录列表
|
||||
@GetMapping("/findHistoryInquiryRecord")
|
||||
public HealthR<List<InquiryDetailsRecordVo>> findHistoryInquiryRecord(@RequestParam Integer page,@RequestParam Integer count){
|
||||
startPage(page,count);
|
||||
List<InquiryDetailsRecordVo> inquiryDetailsRecordVoList = inquiryService.findHistoryInquiryRecord();
|
||||
return HealthR.ok(inquiryDetailsRecordVoList);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,15 +1,21 @@
|
|||
package doctor.controller;
|
||||
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.domain.entity.UserVideoBuyEntity;
|
||||
import doctor.domain.entity.UserVideoCollectionEntity;
|
||||
import doctor.domain.entity.UserWalletEntity;
|
||||
import doctor.domain.vo.UserVideoBuyVo;
|
||||
import doctor.domain.vo.UserVideoCollectionVo;
|
||||
import doctor.service.UserVideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.github.pagehelper.page.PageMethod.startPage;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoController
|
||||
* @Description : 用户视频
|
||||
|
@ -24,34 +30,36 @@ public class UserVideoController {
|
|||
|
||||
//用户视频收藏列表
|
||||
@GetMapping("/findVideoCollectionList")
|
||||
public R<List<UserVideoCollection>>findVideoCollectionList(){
|
||||
List<UserVideoCollection> userVideoCollectionList =userVideoService.findVideoCollectionList();
|
||||
return R.ok(userVideoCollectionList);
|
||||
public HealthR<List<UserVideoCollectionVo>> findVideoCollectionList(@RequestParam Integer page,@RequestParam Integer count){
|
||||
startPage(page,count);
|
||||
List<UserVideoCollectionVo> userVideoCollectionVos=userVideoService.findVideoCollectionList();
|
||||
return HealthR.ok(userVideoCollectionVos);
|
||||
}
|
||||
//用户取消视频收藏
|
||||
@GetMapping("/cancelVideoCollection/{id}")
|
||||
public R cancelVideoCollection(@PathVariable Integer id){
|
||||
public HealthR cancelVideoCollection(@PathVariable Integer id){
|
||||
userVideoService.cancelVideoCollection(id);
|
||||
return R.ok();
|
||||
return HealthR.ok();
|
||||
}
|
||||
//用户购买视频列表
|
||||
@GetMapping("/findUserVideoBuyList")
|
||||
public R<List<UserVideoBuy>>findUserVideoBuyList(){
|
||||
List<UserVideoBuy> userVideoBuys =userVideoService.findUserVideoBuyList();
|
||||
return R.ok(userVideoBuys);
|
||||
public HealthR<List<UserVideoBuyVo>>findUserVideoBuyList(@RequestParam Integer page, @RequestParam Integer count){
|
||||
startPage(page,count);
|
||||
List<UserVideoBuyVo> userVideoCollectionVos =userVideoService.findUserVideoBuyList();
|
||||
return HealthR.ok(userVideoCollectionVos);
|
||||
}
|
||||
//用户删除购买的视频
|
||||
@DeleteMapping("/deleteVideoBuy/{id}")
|
||||
public R deleteVideoBuy(@PathVariable Integer id){
|
||||
public HealthR deleteVideoBuy(@PathVariable Integer id){
|
||||
userVideoService.deleteVideoBuy(id);
|
||||
return R.ok();
|
||||
return HealthR.ok();
|
||||
}
|
||||
|
||||
//我的钱包
|
||||
@GetMapping("/findUserWallet")
|
||||
public R<List<UserWallet>> findUserWallet(){
|
||||
List<UserWallet> userWallets = userVideoService.findUserWallet();
|
||||
return R.ok(userWallets);
|
||||
public HealthR<List<UserWalletEntity>> findUserWallet(){
|
||||
List<UserWalletEntity> userWallets = userVideoService.findUserWallet();
|
||||
return HealthR.ok(userWallets);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package doctor.controller;
|
||||
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.domain.entity.*;
|
||||
import doctor.service.VideoService;
|
||||
|
@ -20,22 +21,22 @@ public class VideoController {
|
|||
@Autowired
|
||||
private VideoService videoService;
|
||||
//收藏健康讲堂视频列表
|
||||
@PostMapping("/verify/v1/addUserVideoCollection")
|
||||
public R addUserVideoCollection(@RequestBody UserVideoCollection userVideoCollection){
|
||||
videoService.addUserVideoCollection(userVideoCollection);
|
||||
return R.ok();
|
||||
@PostMapping("/verify/v1/addUserVideoCollection/{videoId}")
|
||||
public HealthR addUserVideoCollection(@RequestParam Integer videoId){
|
||||
videoService.addUserVideoCollection(videoId);
|
||||
return HealthR.ok();
|
||||
}
|
||||
//购买健康讲堂视频
|
||||
@PostMapping("/verify/v1/videoBuy")
|
||||
public R videoBuy(@RequestBody UserVideoBuy userVideoBuy){
|
||||
videoService.videoBuy(userVideoBuy);
|
||||
return R.ok();
|
||||
}
|
||||
//视频评论列表
|
||||
@GetMapping("/v1/findVideoCommentList")
|
||||
public R<List<VideoComment>> findVideoCommentList(){
|
||||
List<VideoComment> videoCommentList = videoService.findVideoCommentList();
|
||||
return R.ok(videoCommentList);
|
||||
public HealthR videoBuy(@RequestParam Integer videoId, @RequestParam Integer price){
|
||||
videoService.videoBuy(videoId,price);
|
||||
return HealthR.ok();
|
||||
}
|
||||
// //视频评论列表
|
||||
// @GetMapping("/v1/findVideoCommentList")
|
||||
// public R<List<VideoCommentEntity>> findVideoCommentList(){
|
||||
// List<VideoCommentEntity> videoCommentList = videoService.findVideoCommentList();
|
||||
// return R.ok(videoCommentList);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import java.security.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
public class DoctorUser {
|
||||
public class DoctorUserEntity {
|
||||
|
||||
private int id;
|
||||
private String phone;
|
|
@ -0,0 +1,106 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : InquiryDetailsRecordEntity
|
||||
* @Description : 查询详情记录表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 17:26
|
||||
*/
|
||||
public class InquiryDetailsRecordEntity {
|
||||
private Integer id;
|
||||
private Integer inquiryId;
|
||||
private Integer userId;
|
||||
private Integer friendId;
|
||||
private String askContent;
|
||||
private String askImage;
|
||||
private String voiceChat;
|
||||
private Integer direction;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date askTime;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getInquiryId() {
|
||||
return inquiryId;
|
||||
}
|
||||
|
||||
public void setInquiryId(Integer inquiryId) {
|
||||
this.inquiryId = inquiryId;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getFriendId() {
|
||||
return friendId;
|
||||
}
|
||||
|
||||
public void setFriendId(Integer friendId) {
|
||||
this.friendId = friendId;
|
||||
}
|
||||
|
||||
public String getAskContent() {
|
||||
return askContent;
|
||||
}
|
||||
|
||||
public void setAskContent(String askContent) {
|
||||
this.askContent = askContent;
|
||||
}
|
||||
|
||||
public String getAskImage() {
|
||||
return askImage;
|
||||
}
|
||||
|
||||
public void setAskImage(String askImage) {
|
||||
this.askImage = askImage;
|
||||
}
|
||||
|
||||
public String getVoiceChat() {
|
||||
return voiceChat;
|
||||
}
|
||||
|
||||
public void setVoiceChat(String voiceChat) {
|
||||
this.voiceChat = voiceChat;
|
||||
}
|
||||
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public Date getAskTime() {
|
||||
return askTime;
|
||||
}
|
||||
|
||||
public void setAskTime(Date askTime) {
|
||||
this.askTime = askTime;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,14 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : User
|
||||
* @ClassName : UserEntity
|
||||
* @Description : 用户表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 20:46
|
||||
*/
|
||||
public class User {
|
||||
public class UserEntity {
|
||||
private Integer id;
|
||||
private String phone;
|
||||
private String pwd;
|
|
@ -1,12 +1,12 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoBuy
|
||||
* @ClassName : UserVideoBuyEntity
|
||||
* @Description : 用户购买视频表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 15:20
|
||||
*/
|
||||
public class UserVideoBuy {
|
||||
public class UserVideoBuyEntity {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer videoId;
|
||||
|
@ -44,13 +44,13 @@ public class UserVideoBuy {
|
|||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoBuy(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
public UserVideoBuyEntity(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.videoId = videoId;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoBuy() {
|
||||
public UserVideoBuyEntity() {
|
||||
}
|
||||
}
|
|
@ -1,18 +1,13 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoCollection
|
||||
* @ClassName : UserVideoCollectionEntity
|
||||
* @Description : 用户视频收藏表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 14:28
|
||||
*/
|
||||
|
||||
public class UserVideoCollection {
|
||||
public class UserVideoCollectionEntity {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer videoId;
|
||||
|
@ -50,13 +45,13 @@ public class UserVideoCollection {
|
|||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoCollection(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
public UserVideoCollectionEntity(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.videoId = videoId;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoCollection() {
|
||||
public UserVideoCollectionEntity() {
|
||||
}
|
||||
}
|
|
@ -1,16 +1,12 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : UserWallet
|
||||
* @ClassName : UserWalletEntity
|
||||
* @Description : 用户钱包
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 20:30
|
||||
*/
|
||||
public class UserWallet {
|
||||
public class UserWalletEntity {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer balance;
|
|
@ -1,16 +1,14 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : VideoComment
|
||||
* @ClassName : VideoCommentEntity
|
||||
* @Description : 评论表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 21:54
|
||||
*/
|
||||
public class VideoComment {
|
||||
public class VideoCommentEntity {
|
||||
private Integer id;
|
||||
|
||||
private Integer userId;
|
|
@ -1,16 +1,14 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : VideoCount
|
||||
* @ClassName : VideoCountEntity
|
||||
* @Description : 视频数
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 16:24
|
||||
*/
|
||||
public class VideoCount {
|
||||
public class VideoCountEntity {
|
||||
private Integer id;
|
||||
private Integer videoId;
|
||||
private Integer buyNum;
|
|
@ -1,16 +1,12 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : Video
|
||||
* @ClassName : VideoEntity
|
||||
* @Description : 健康课堂视频表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 15:59
|
||||
*/
|
||||
public class Video {
|
||||
public class VideoEntity {
|
||||
private Integer id;
|
||||
private String title;
|
||||
private Integer categoryId;
|
||||
|
@ -93,7 +89,7 @@ public class Video {
|
|||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Video(Integer id, String title, Integer categoryId, String shearUrl, String abstracts, String originalUrl, Integer duration, Integer price, Long createTime) {
|
||||
public VideoEntity(Integer id, String title, Integer categoryId, String shearUrl, String abstracts, String originalUrl, Integer duration, Integer price, Long createTime) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.categoryId = categoryId;
|
||||
|
@ -105,6 +101,6 @@ public class Video {
|
|||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Video() {
|
||||
public VideoEntity() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package doctor.domain.vo;
|
||||
|
||||
/**
|
||||
* @ClassName : InquiryDetailsRecordVo
|
||||
* @Description : 历史问诊记录
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 19:02
|
||||
*/
|
||||
public class InquiryDetailsRecordVo {
|
||||
private Integer recordId;
|
||||
private Integer doctorId;
|
||||
private String imagePic;
|
||||
private String doctorName;
|
||||
private String department;
|
||||
private String jobTitle;
|
||||
private Integer evaluateStatus;
|
||||
private String userName;
|
||||
private String jiGuangPwd;
|
||||
private Long inquiryTime;
|
||||
|
||||
public Integer getRecordId() {
|
||||
return recordId;
|
||||
}
|
||||
|
||||
public void setRecordId(Integer recordId) {
|
||||
this.recordId = recordId;
|
||||
}
|
||||
|
||||
public Integer getDoctorId() {
|
||||
return doctorId;
|
||||
}
|
||||
|
||||
public void setDoctorId(Integer doctorId) {
|
||||
this.doctorId = doctorId;
|
||||
}
|
||||
|
||||
public String getImagePic() {
|
||||
return imagePic;
|
||||
}
|
||||
|
||||
public void setImagePic(String imagePic) {
|
||||
this.imagePic = imagePic;
|
||||
}
|
||||
|
||||
public String getDoctorName() {
|
||||
return doctorName;
|
||||
}
|
||||
|
||||
public void setDoctorName(String doctorName) {
|
||||
this.doctorName = doctorName;
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
public String getJobTitle() {
|
||||
return jobTitle;
|
||||
}
|
||||
|
||||
public void setJobTitle(String jobTitle) {
|
||||
this.jobTitle = jobTitle;
|
||||
}
|
||||
|
||||
public Integer getEvaluateStatus() {
|
||||
return evaluateStatus;
|
||||
}
|
||||
|
||||
public void setEvaluateStatus(Integer evaluateStatus) {
|
||||
this.evaluateStatus = evaluateStatus;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getJiGuangPwd() {
|
||||
return jiGuangPwd;
|
||||
}
|
||||
|
||||
public void setJiGuangPwd(String jiGuangPwd) {
|
||||
this.jiGuangPwd = jiGuangPwd;
|
||||
}
|
||||
|
||||
public Long getInquiryTime() {
|
||||
return inquiryTime;
|
||||
}
|
||||
|
||||
public void setInquiryTime(Long inquiryTime) {
|
||||
this.inquiryTime = inquiryTime;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package doctor.domain.vo;
|
||||
|
||||
/**
|
||||
* @ClassName : UserArchivesVo
|
||||
* @Description : 历史问诊
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 18:52
|
||||
*/
|
||||
public class UserArchivesVo {
|
||||
private Integer recordId;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package doctor.domain.vo;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoBuyVo
|
||||
* @Description : 购买视频表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 16:37
|
||||
*/
|
||||
public class UserVideoBuyVo {
|
||||
private Integer id;
|
||||
private Integer videoId;
|
||||
private String title;
|
||||
private String original;
|
||||
private Integer duration;
|
||||
private Long createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getVideoId() {
|
||||
return videoId;
|
||||
}
|
||||
|
||||
public void setVideoId(Integer videoId) {
|
||||
this.videoId = videoId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getOriginal() {
|
||||
return original;
|
||||
}
|
||||
|
||||
public void setOriginal(String original) {
|
||||
this.original = original;
|
||||
}
|
||||
|
||||
public Integer getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Integer duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package doctor.domain.vo;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoCollectionVo
|
||||
* @Description : 用户视频收藏表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 16:11
|
||||
*/
|
||||
public class UserVideoCollectionVo {
|
||||
private Integer id;
|
||||
private String title;
|
||||
private String shearUrl;
|
||||
private String original;
|
||||
private Integer price;
|
||||
private Integer duration;
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -3,10 +3,11 @@ package doctor.mapper;
|
|||
import doctor.system.api.domain.Department;
|
||||
import doctor.system.api.domain.Doctor;
|
||||
import doctor.system.api.domain.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
@MapperScan
|
||||
@Mapper
|
||||
public interface DoctorUserMapper {
|
||||
User selectUserByEmail(@Param("email") String email);
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package doctor.mapper;
|
||||
|
||||
import doctor.domain.entity.InquiryDetailsRecordEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : InquiryMapper
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 19:18
|
||||
*/
|
||||
@Mapper
|
||||
public interface InquiryMapper {
|
||||
List<InquiryDetailsRecordEntity> findHistoryInquiryRecord();
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package doctor.mapper;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.domain.entity.UserVideoBuyEntity;
|
||||
import doctor.domain.entity.UserVideoCollectionEntity;
|
||||
import doctor.domain.entity.UserWalletEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -16,13 +16,13 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface UserVideoMapper {
|
||||
List<UserVideoCollection> findVideoCollectionList();
|
||||
List<UserVideoCollectionEntity> findVideoCollectionList();
|
||||
|
||||
void cancelVideoCollection(@Param("id") Integer id);
|
||||
|
||||
List<UserVideoBuy> findUserVideoBuyList();
|
||||
List<UserVideoBuyEntity> findUserVideoBuyList();
|
||||
|
||||
void deleteVideoBuy(@Param("id") Integer id);
|
||||
|
||||
List<UserWallet> findUserWallet();
|
||||
List<UserWalletEntity> findUserWallet();
|
||||
}
|
||||
|
|
|
@ -16,24 +16,23 @@ import java.util.List;
|
|||
public interface VideoMapper {
|
||||
|
||||
|
||||
void addUserVideoCollection(UserVideoCollection userVideoCollection);
|
||||
void addUserVideoCollection(@Param("userId") Integer userId, @Param("videoId") Integer videoId);
|
||||
|
||||
Video findById(@Param("videoId") Integer videoId);
|
||||
VideoEntity findById(@Param("videoId") Integer videoId);
|
||||
|
||||
VideoCount FindVideoId(@Param("id") Integer id);
|
||||
VideoCountEntity FindVideoId(@Param("id") Integer id);
|
||||
|
||||
void updateVideoCount(VideoCount videoCount);
|
||||
void updateVideoCount(VideoCountEntity videoCount);
|
||||
|
||||
User FindById(@Param("userId") Integer userId);
|
||||
UserEntity FindById(@Param("userId") Integer userId);
|
||||
|
||||
UserWallet FindUserWallet(@Param("id") Integer id);
|
||||
UserWalletEntity FindUserWallet(@Param("id") Integer id);
|
||||
|
||||
Video findByVideoId(@Param("videoId") Integer videoId);
|
||||
|
||||
void updateUserWallet(@Param("newblance") int newblance, @Param("id") Integer id);
|
||||
|
||||
List<VideoComment> findVideoCommentList();
|
||||
|
||||
|
||||
// UserWallet FindById(@Param("userId") Integer userId);
|
||||
|
||||
// UserWalletEntity FindById(@Param("userId") Integer userId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.domain.vo.InquiryDetailsRecordVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : InquiryService
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 19:18
|
||||
*/
|
||||
public interface InquiryService {
|
||||
List<InquiryDetailsRecordVo> findHistoryInquiryRecord();
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.domain.entity.UserVideoBuyEntity;
|
||||
import doctor.domain.entity.UserVideoCollectionEntity;
|
||||
import doctor.domain.entity.UserWalletEntity;
|
||||
import doctor.domain.vo.UserVideoBuyVo;
|
||||
import doctor.domain.vo.UserVideoCollectionVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -13,13 +15,15 @@ import java.util.List;
|
|||
* @Date: 2024-01-10 14:33
|
||||
*/
|
||||
public interface UserVideoService {
|
||||
List<UserVideoCollection> findVideoCollectionList();
|
||||
|
||||
|
||||
void cancelVideoCollection(Integer id);
|
||||
|
||||
List<UserVideoBuy> findUserVideoBuyList();
|
||||
List<UserVideoBuyVo> findUserVideoBuyList();
|
||||
|
||||
void deleteVideoBuy(Integer id);
|
||||
|
||||
List<UserWallet> findUserWallet();
|
||||
List<UserWalletEntity> findUserWallet();
|
||||
|
||||
List<UserVideoCollectionVo> findVideoCollectionList();
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ import java.util.List;
|
|||
*/
|
||||
public interface VideoService {
|
||||
|
||||
void addUserVideoCollection(UserVideoCollection userVideoCollection);
|
||||
void addUserVideoCollection(Integer videoId);
|
||||
|
||||
|
||||
void videoBuy(UserVideoBuy userVideoBuy);
|
||||
void videoBuy(Integer videoId,Integer price);
|
||||
|
||||
|
||||
List<VideoComment> findVideoCommentList();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package doctor.service.impl;
|
||||
|
||||
import doctor.ConvertUtil;
|
||||
import doctor.domain.entity.InquiryDetailsRecordEntity;
|
||||
import doctor.domain.vo.InquiryDetailsRecordVo;
|
||||
import doctor.mapper.InquiryMapper;
|
||||
import doctor.service.InquiryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : InquiryServiceImpl
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-12 19:19
|
||||
*/
|
||||
@Service
|
||||
public class InquiryServiceImpl implements InquiryService {
|
||||
@Autowired
|
||||
private InquiryMapper inquiryMapper;
|
||||
@Override
|
||||
public List<InquiryDetailsRecordVo> findHistoryInquiryRecord() {
|
||||
List<InquiryDetailsRecordEntity> inquiryDetailsRecordEntity = inquiryMapper.findHistoryInquiryRecord();
|
||||
List<InquiryDetailsRecordVo> inquiryDetailsRecordVos = ConvertUtil.entityToVoList(inquiryDetailsRecordEntity, InquiryDetailsRecordVo.class);
|
||||
return inquiryDetailsRecordVos;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
package doctor.service.impl;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.ConvertUtil;
|
||||
import doctor.domain.entity.UserVideoBuyEntity;
|
||||
import doctor.domain.entity.UserVideoCollectionEntity;
|
||||
import doctor.domain.entity.UserWalletEntity;
|
||||
import doctor.domain.vo.UserVideoBuyVo;
|
||||
import doctor.domain.vo.UserVideoCollectionVo;
|
||||
import doctor.mapper.UserVideoMapper;
|
||||
import doctor.service.UserVideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -20,9 +23,13 @@ import java.util.List;
|
|||
public class UserVideoServiceImpl implements UserVideoService {
|
||||
@Autowired
|
||||
private UserVideoMapper userVideoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<UserVideoCollection> findVideoCollectionList() {
|
||||
return userVideoMapper.findVideoCollectionList();
|
||||
public List<UserVideoCollectionVo> findVideoCollectionList() {
|
||||
List<UserVideoCollectionEntity> userVideoCollectionEntityList=userVideoMapper.findVideoCollectionList();
|
||||
List<UserVideoCollectionVo> userVideoCollectionVoList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserVideoCollectionVo.class);
|
||||
return userVideoCollectionVoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,8 +38,10 @@ public class UserVideoServiceImpl implements UserVideoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<UserVideoBuy> findUserVideoBuyList() {
|
||||
return userVideoMapper.findUserVideoBuyList();
|
||||
public List<UserVideoBuyVo> findUserVideoBuyList() {
|
||||
List<UserVideoBuyEntity> userVideoCollectionEntityList=userVideoMapper.findUserVideoBuyList();
|
||||
List<UserVideoBuyVo> userVideoBuyList = ConvertUtil.entityToVoList(userVideoCollectionEntityList, UserVideoBuyVo.class);
|
||||
return userVideoBuyList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +50,9 @@ public class UserVideoServiceImpl implements UserVideoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<UserWallet> findUserWallet() {
|
||||
public List<UserWalletEntity> findUserWallet() {
|
||||
return userVideoMapper.findUserWallet();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package doctor.service.impl;
|
||||
|
||||
import doctor.common.core.utils.JwtUtils;
|
||||
import doctor.domain.entity.*;
|
||||
import doctor.mapper.VideoMapper;
|
||||
import doctor.service.VideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -18,39 +20,38 @@ import java.util.List;
|
|||
public class VideoServiceImpl implements VideoService {
|
||||
@Autowired
|
||||
private VideoMapper videoMapper;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
@Override
|
||||
public void addUserVideoCollection(UserVideoCollection userVideoCollection) {
|
||||
public void addUserVideoCollection(Integer videoId) {
|
||||
//获取用户id
|
||||
String token = request.getHeader("token");
|
||||
Integer userId = Integer.valueOf(JwtUtils.getUserId(token));
|
||||
// 添加收藏
|
||||
videoMapper.addUserVideoCollection(userVideoCollection);
|
||||
videoMapper.addUserVideoCollection(userId,videoId);
|
||||
// 更新视频收藏数
|
||||
Video video = videoMapper.findById(userVideoCollection.getVideoId());
|
||||
VideoCount videoCount = videoMapper.FindVideoId(video.getId());
|
||||
VideoEntity video = videoMapper.findById(videoId);
|
||||
VideoCountEntity videoCount = videoMapper.FindVideoId(video.getId());
|
||||
videoMapper.updateVideoCount(videoCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void videoBuy(UserVideoBuy userVideoBuy) {
|
||||
public void videoBuy(Integer videoId,Integer price) {
|
||||
//获取用户id
|
||||
String token = request.getHeader("token");
|
||||
Integer userId = Integer.valueOf(JwtUtils.getUserId(token));
|
||||
//查询用户信息
|
||||
User user = videoMapper.FindById(userVideoBuy.getUserId());
|
||||
//查询视频信息
|
||||
Video video = videoMapper.findByVideoId(userVideoBuy.getVideoId());
|
||||
UserEntity user = videoMapper.FindById(userId);
|
||||
//查询用户钱包
|
||||
UserWallet userWallet = videoMapper.FindUserWallet(user.getId());
|
||||
UserWalletEntity userWallet = videoMapper.FindUserWallet(user.getId());
|
||||
//判断用户钱包是否足够
|
||||
if (userWallet.getBalance() >= video.getPrice()) {
|
||||
if (userWallet.getBalance() >= price) {
|
||||
//更新用户钱包
|
||||
int newblance=userWallet.getBalance() - video.getPrice();
|
||||
int newblance = userWallet.getBalance() -price;
|
||||
//更新用户钱包
|
||||
videoMapper.updateUserWallet(newblance,userWallet.getId());
|
||||
videoMapper.updateUserWallet(newblance, userWallet.getId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VideoComment> findVideoCommentList() {
|
||||
return videoMapper.findVideoCommentList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?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="doctor.mapper.InquiryMapper">
|
||||
|
||||
|
||||
<select id="findHistoryInquiryRecord" resultType="doctor.domain.entity.InquiryDetailsRecordEntity">
|
||||
select *
|
||||
from inquiry_details_record
|
||||
</select>
|
||||
</mapper>
|
|
@ -6,22 +6,22 @@
|
|||
<delete id="cancelVideoCollection">
|
||||
delete
|
||||
from user_video_collection
|
||||
where id = #{id}
|
||||
where video_id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteVideoBuy">
|
||||
delete
|
||||
from user_video_buy
|
||||
where id = #{id}
|
||||
where video_id = #{id}
|
||||
</delete>
|
||||
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollection">
|
||||
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollectionEntity">
|
||||
select *
|
||||
from user_video_collection
|
||||
</select>
|
||||
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuy">
|
||||
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuyEntity">
|
||||
select *
|
||||
from user_video_buy
|
||||
</select>
|
||||
<select id="findUserWallet" resultType="doctor.domain.entity.UserWallet">
|
||||
<select id="findUserWallet" resultType="doctor.domain.entity.UserWalletEntity">
|
||||
select *
|
||||
from user_wallet
|
||||
</select>
|
||||
|
|
|
@ -24,38 +24,29 @@
|
|||
where id=#{id}
|
||||
</update>
|
||||
|
||||
<select id="findById" resultType="doctor.domain.entity.Video">
|
||||
<select id="findById" resultType="doctor.domain.entity.VideoEntity">
|
||||
SELECT user_video_collection.*
|
||||
FROM user_video_collection
|
||||
LEFT JOIN video ON user_video_collection.video_id = video.id
|
||||
WHERE video.id = #{videoId}
|
||||
</select>
|
||||
<select id="FindVideoId" resultType="doctor.domain.entity.VideoCount">
|
||||
<select id="FindVideoId" resultType="doctor.domain.entity.VideoCountEntity">
|
||||
select *
|
||||
from video_count
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="FindById" resultType="doctor.domain.entity.User">
|
||||
<select id="FindById" resultType="doctor.domain.entity.UserEntity">
|
||||
SELECT user.*
|
||||
FROM user_video_buy
|
||||
LEFT JOIN user ON user.id = user_video_buy.user_id
|
||||
WHERE user_video_buy.user_id = #{userId}
|
||||
</select>
|
||||
<select id="FindUserWallet" resultType="doctor.domain.entity.UserWallet">
|
||||
<select id="FindUserWallet" resultType="doctor.domain.entity.UserWalletEntity">
|
||||
SELECT user.*
|
||||
FROM user_wallet
|
||||
LEFT JOIN user ON user.id = user_wallet.user_id
|
||||
WHERE user_wallet.user_id==#{id}
|
||||
</select>
|
||||
<select id="findByVideoId" resultType="doctor.domain.entity.Video">
|
||||
SELECT user_video_buy.*
|
||||
FROM user_video_buy
|
||||
LEFT JOIN video ON video.id = user_video_buy.video_id
|
||||
WHERE video.video.id = #{videoId}
|
||||
</select>
|
||||
<select id="findVideoCommentList" resultType="doctor.domain.entity.VideoComment">
|
||||
select *
|
||||
from video_comment
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue