diff --git a/doctor-auth/src/main/resources/bootstrap.yml b/doctor-auth/src/main/resources/bootstrap.yml index c30cba2..80f11fd 100644 --- a/doctor-auth/src/main/resources/bootstrap.yml +++ b/doctor-auth/src/main/resources/bootstrap.yml @@ -15,11 +15,11 @@ spring: discovery: # 服务注册地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/doctor-gateway/src/main/resources/bootstrap.yml b/doctor-gateway/src/main/resources/bootstrap.yml index cc0e562..d3e056c 100644 --- a/doctor-gateway/src/main/resources/bootstrap.yml +++ b/doctor-gateway/src/main/resources/bootstrap.yml @@ -15,11 +15,11 @@ spring: discovery: # 服务注册地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/doctor-modules/doctor-file/src/main/resources/bootstrap.yml b/doctor-modules/doctor-file/src/main/resources/bootstrap.yml index c992149..66f9597 100644 --- a/doctor-modules/doctor-file/src/main/resources/bootstrap.yml +++ b/doctor-modules/doctor-file/src/main/resources/bootstrap.yml @@ -15,11 +15,11 @@ spring: discovery: # 服务注册地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/doctor-modules/doctor-gen/src/main/resources/bootstrap.yml b/doctor-modules/doctor-gen/src/main/resources/bootstrap.yml index 007713f..81bc32c 100644 --- a/doctor-modules/doctor-gen/src/main/resources/bootstrap.yml +++ b/doctor-modules/doctor-gen/src/main/resources/bootstrap.yml @@ -15,11 +15,11 @@ spring: discovery: # 服务注册地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 # 配置文件格式 file-extension: yml # 共享配置 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 new file mode 100644 index 0000000..eb6899b --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java @@ -0,0 +1,49 @@ +package doctor.controller; + +import doctor.common.core.domain.R; +import doctor.domain.entity.UserVideoBuy; +import doctor.domain.entity.UserVideoCollection; +import doctor.service.UserVideoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @ClassName : UserVideoController + * @Description : 用户视频 + * @Author : FJJ + * @Date: 2024-01-10 14:32 + */ +@RestController +@RequestMapping("/user/verify/v1") +public class UserVideoController { + @Autowired + private UserVideoService userVideoService; + + //用户视频收藏列表 + @GetMapping("/findVideoCollectionList") + public R>findVideoCollectionList(){ + List userVideoCollectionList =userVideoService.findVideoCollectionList(); + return R.ok(userVideoCollectionList); + } + //用户取消视频收藏 + @GetMapping("/cancelVideoCollection") + public R cancelVideoCollection(@PathVariable Integer id){ + userVideoService.cancelVideoCollection(id); + return R.ok(); + } + //用户购买视频列表 + @GetMapping("/findUserVideoBuyList") + public R>findUserVideoBuyList(){ + List userVideoBuys =userVideoService.findUserVideoBuyList(); + return R.ok(userVideoBuys); + } + //用户删除购买的视频 + @DeleteMapping("/deleteVideoBuy") + public R deleteVideoBuy(@PathVariable Integer id){ + userVideoService.deleteVideoBuy(id); + return R.ok(); + } + +} 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 new file mode 100644 index 0000000..19f02d5 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java @@ -0,0 +1,41 @@ +package doctor.controller; + +import doctor.common.core.domain.R; +import doctor.domain.entity.UserVideoBuy; +import doctor.domain.entity.UserVideoCollection; +import doctor.domain.entity.Video; +import doctor.domain.entity.VideoCount; +import doctor.service.VideoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @ClassName : VideoController + * @Description : 健康课堂视频 + * @Author : FJJ + * @Date: 2024-01-10 15:58 + */ +@RestController +@RequestMapping("/user/video") +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/videoBuy") + public R videoBuy(@RequestBody UserVideoBuy userVideoBuy){ + videoService.videoBuy(userVideoBuy); + return R.ok(); + } + //视频评论列表 + + +} diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/User.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/User.java new file mode 100644 index 0000000..0ece141 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/User.java @@ -0,0 +1,142 @@ +package doctor.domain.entity; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @ClassName : User + * @Description : 用户表 + * @Author : FJJ + * @Date: 2024-01-10 20:46 + */ +public class User { + private Integer id; + private String phone; + private String pwd; + private String email; + private String nickName; + private String userName; + private String headPic; + private Integer sex; + private Integer age; + private String height; + private String weight; + private String invitationCode; + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + @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 String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getPwd() { + return pwd; + } + + public void setPwd(String pwd) { + this.pwd = pwd; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getHeadPic() { + return headPic; + } + + public void setHeadPic(String headPic) { + this.headPic = headPic; + } + + public Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public Integer getAge() { + return age; + } + + public void setAge(Integer age) { + this.age = age; + } + + public String getHeight() { + return height; + } + + public void setHeight(String height) { + this.height = height; + } + + public String getWeight() { + return weight; + } + + public void setWeight(String weight) { + this.weight = weight; + } + + public String getInvitationCode() { + return invitationCode; + } + + public void setInvitationCode(String invitationCode) { + this.invitationCode = invitationCode; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoBuy.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoBuy.java new file mode 100644 index 0000000..f4d5ff7 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoBuy.java @@ -0,0 +1,56 @@ +package doctor.domain.entity; + +/** + * @ClassName : UserVideoBuy + * @Description : 用户购买视频表 + * @Author : FJJ + * @Date: 2024-01-10 15:20 + */ +public class UserVideoBuy { + private Integer id; + private Integer userId; + private Integer videoId; + private Integer 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 Integer getCreateTime() { + return createTime; + } + + public void setCreateTime(Integer createTime) { + this.createTime = createTime; + } + + public UserVideoBuy(Integer id, Integer userId, Integer videoId, Integer createTime) { + this.id = id; + this.userId = userId; + this.videoId = videoId; + this.createTime = createTime; + } + + public UserVideoBuy() { + } +} diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollection.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollection.java new file mode 100644 index 0000000..b086678 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserVideoCollection.java @@ -0,0 +1,63 @@ +package doctor.domain.entity; + +import io.swagger.models.auth.In; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @ClassName : UserVideoCollection + * @Description : 用户视频收藏表 + * @Author : FJJ + * @Date: 2024-01-10 14:28 + */ + +public class UserVideoCollection { + private Integer id; + private Integer userId; + private Integer videoId; + @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 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 Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public UserVideoCollection(Integer id, Integer userId, Integer videoId, Date createTime) { + this.id = id; + this.userId = userId; + this.videoId = videoId; + this.createTime = createTime; + } + + public UserVideoCollection() { + } +} diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserWallet.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserWallet.java new file mode 100644 index 0000000..aa97cd1 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/UserWallet.java @@ -0,0 +1,70 @@ +package doctor.domain.entity; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @ClassName : UserWallet + * @Description : 用户钱包 + * @Author : FJJ + * @Date: 2024-01-10 20:30 + */ +public class UserWallet { + private Integer id; + private Integer userId; + private Integer balance; + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + private Integer version; + @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 getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public Integer getBalance() { + return balance; + } + + public void setBalance(Integer balance) { + this.balance = balance; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/Video.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/Video.java new file mode 100644 index 0000000..5c6ff3f --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/Video.java @@ -0,0 +1,111 @@ +package doctor.domain.entity; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @ClassName : Video + * @Description : 健康课堂视频表 + * @Author : FJJ + * @Date: 2024-01-10 15:59 + */ +public class Video { + private Integer id; + private String title; + private Integer categoryId; + private String shearUrl; + private String abstracts; + private String originalUrl; + private Integer duration; + private Integer price; + @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 String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getCategoryId() { + return categoryId; + } + + public void setCategoryId(Integer categoryId) { + this.categoryId = categoryId; + } + + public String getShearUrl() { + return shearUrl; + } + + public void setShearUrl(String shearUrl) { + this.shearUrl = shearUrl; + } + + public String getAbstracts() { + return abstracts; + } + + public void setAbstracts(String abstracts) { + this.abstracts = abstracts; + } + + public String getOriginalUrl() { + return originalUrl; + } + + public void setOriginalUrl(String originalUrl) { + this.originalUrl = originalUrl; + } + + public Integer getDuration() { + return duration; + } + + public void setDuration(Integer duration) { + this.duration = duration; + } + + public Integer getPrice() { + return price; + } + + public void setPrice(Integer price) { + this.price = price; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Video(Integer id, String title, Integer categoryId, String shearUrl, String abstracts, String originalUrl, Integer duration, Integer price, Date createTime) { + this.id = id; + this.title = title; + this.categoryId = categoryId; + this.shearUrl = shearUrl; + this.abstracts = abstracts; + this.originalUrl = originalUrl; + this.duration = duration; + this.price = price; + this.createTime = createTime; + } + + public Video() { + } +} diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoComment.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoComment.java new file mode 100644 index 0000000..783400e --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoComment.java @@ -0,0 +1,60 @@ +package doctor.domain.entity; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @ClassName : VideoComment + * @Description : 评论表 + * @Author : FJJ + * @Date: 2024-01-10 21:54 + */ +public class VideoComment { + private Integer id; + private Integer userId; + private Integer videoId; + private String content; + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") + private Date 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 String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoCount.java b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoCount.java new file mode 100644 index 0000000..3a7c090 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/domain/entity/VideoCount.java @@ -0,0 +1,82 @@ +package doctor.domain.entity; + +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @ClassName : VideoCount + * @Description : 视频数 + * @Author : FJJ + * @Date: 2024-01-10 16:24 + */ +public class VideoCount { + private Integer id; + private Integer videoId; + private Integer buyNum; + private Integer collectionNum; + private Integer commentNum; + @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 getVideoId() { + return videoId; + } + + public void setVideoId(Integer videoId) { + this.videoId = videoId; + } + + public Integer getBuyNum() { + return buyNum; + } + + public void setBuyNum(Integer buyNum) { + this.buyNum = buyNum; + } + + public Integer getCollectionNum() { + return collectionNum; + } + + public void setCollectionNum(Integer collectionNum) { + this.collectionNum = collectionNum; + } + + public Integer getCommentNum() { + return commentNum; + } + + public void setCommentNum(Integer commentNum) { + this.commentNum = commentNum; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public VideoCount(Integer id, Integer videoId, Integer buyNum, Integer collectionNum, Integer commentNum, Date createTime) { + + this.id = id; + this.videoId = videoId; + this.buyNum = buyNum; + this.collectionNum = collectionNum; + this.commentNum = commentNum; + this.createTime = createTime; + } + + public VideoCount() { + } +} 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 new file mode 100644 index 0000000..6ac8701 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java @@ -0,0 +1,25 @@ +package doctor.mapper; + +import doctor.domain.entity.UserVideoBuy; +import doctor.domain.entity.UserVideoCollection; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @ClassName : UserVideoMapper + * @Description : + * @Author : FJJ + * @Date: 2024-01-10 14:33 + */ +@Mapper +public interface UserVideoMapper { + List findVideoCollectionList(); + + void cancelVideoCollection(@Param("id") Integer id); + + List findUserVideoBuyList(); + + void deleteVideoBuy(@Param("id") Integer id); +} diff --git a/doctor-modules/doctor-health/src/main/java/doctor/mapper/VideoMapper.java b/doctor-modules/doctor-health/src/main/java/doctor/mapper/VideoMapper.java new file mode 100644 index 0000000..6c1f0a3 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/mapper/VideoMapper.java @@ -0,0 +1,35 @@ +package doctor.mapper; + +import doctor.domain.entity.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @ClassName : VideoMapper + * @Description : + * @Author : FJJ + * @Date: 2024-01-10 16:03 + */ +@Mapper +public interface VideoMapper { + + + void addUserVideoCollection(UserVideoCollection userVideoCollection); + + Video findById(@Param("videoId") Integer videoId); + + VideoCount FindVideoId(@Param("id") Integer id); + + void updateVideoCount(VideoCount videoCount); + + User FindById(@Param("userId") Integer userId); + + UserWallet FindUserWallet(@Param("id") Integer id); + + Video findByVideoId(@Param("videoId") Integer videoId); + + void updateUserWallet(@Param("newblance") int newblance, @Param("id") Integer id); + + +// UserWallet FindById(@Param("userId") Integer userId); +} 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 new file mode 100644 index 0000000..910e84b --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java @@ -0,0 +1,22 @@ +package doctor.service; + +import doctor.domain.entity.UserVideoBuy; +import doctor.domain.entity.UserVideoCollection; + +import java.util.List; + +/** + * @ClassName : UserVideoService + * @Description : + * @Author : FJJ + * @Date: 2024-01-10 14:33 + */ +public interface UserVideoService { + List findVideoCollectionList(); + + void cancelVideoCollection(Integer id); + + List findUserVideoBuyList(); + + void deleteVideoBuy(Integer id); +} 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 new file mode 100644 index 0000000..204dbbb --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/VideoService.java @@ -0,0 +1,20 @@ +package doctor.service; + +import doctor.domain.entity.UserVideoBuy; +import doctor.domain.entity.UserVideoCollection; +import doctor.domain.entity.Video; +import doctor.domain.entity.VideoCount; + +/** + * @ClassName : VideoService + * @Description : + * @Author : FJJ + * @Date: 2024-01-10 16:04 + */ +public interface VideoService { + + void addUserVideoCollection(UserVideoCollection userVideoCollection); + + + void videoBuy(UserVideoBuy userVideoBuy); +} 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 new file mode 100644 index 0000000..fcd3af1 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java @@ -0,0 +1,41 @@ +package doctor.service.impl; + +import doctor.domain.entity.UserVideoBuy; +import doctor.domain.entity.UserVideoCollection; +import doctor.mapper.UserVideoMapper; +import doctor.service.UserVideoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @ClassName : UserVideoServiceImpl + * @Description : + * @Author : FJJ + * @Date: 2024-01-10 14:34 + */ +@Service +public class UserVideoServiceImpl implements UserVideoService { + @Autowired + private UserVideoMapper userVideoMapper; + @Override + public List findVideoCollectionList() { + return userVideoMapper.findVideoCollectionList(); + } + + @Override + public void cancelVideoCollection(Integer id) { + userVideoMapper.cancelVideoCollection(id); + } + + @Override + public List findUserVideoBuyList() { + return userVideoMapper.findUserVideoBuyList(); + } + + @Override + public void deleteVideoBuy(Integer id) { + userVideoMapper.deleteVideoBuy(id); + } +} 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 new file mode 100644 index 0000000..e380525 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/VideoServiceImpl.java @@ -0,0 +1,49 @@ +package doctor.service.impl; + +import doctor.domain.entity.*; +import doctor.mapper.VideoMapper; +import doctor.service.VideoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @ClassName : VideoServiceImpl + * @Description : + * @Author : FJJ + * @Date: 2024-01-10 16:04 + */ +@Service +public class VideoServiceImpl implements VideoService { + @Autowired + private VideoMapper videoMapper; + + @Override + public void addUserVideoCollection(UserVideoCollection userVideoCollection) { + // 添加收藏 + videoMapper.addUserVideoCollection(userVideoCollection); + // 更新视频收藏数 + Video video = videoMapper.findById(userVideoCollection.getVideoId()); + VideoCount videoCount = videoMapper.FindVideoId(video.getId()); + videoMapper.updateVideoCount(videoCount); + } + + @Override + public void videoBuy(UserVideoBuy userVideoBuy) { + //查询用户信息 + User user = videoMapper.FindById(userVideoBuy.getUserId()); + //查询视频信息 + Video video = videoMapper.findByVideoId(userVideoBuy.getVideoId()); + //查询用户钱包 + UserWallet userWallet = videoMapper.FindUserWallet(user.getId()); + //判断用户钱包是否足够 + if (userWallet.getBalance() >= video.getPrice()) { + //更新用户钱包 + int newblance=userWallet.getBalance() - video.getPrice(); + //更新用户钱包 + videoMapper.updateUserWallet(newblance,userWallet.getId()); + } + + + } + +} diff --git a/doctor-modules/doctor-health/src/main/resources/bootstrap.yml b/doctor-modules/doctor-health/src/main/resources/bootstrap.yml index 31e3ecc..203e553 100644 --- a/doctor-modules/doctor-health/src/main/resources/bootstrap.yml +++ b/doctor-modules/doctor-health/src/main/resources/bootstrap.yml @@ -15,11 +15,11 @@ spring: discovery: # 服务注册地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 # 配置文件格式 file-extension: yml # 共享配置 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 new file mode 100644 index 0000000..b41fac7 --- /dev/null +++ b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml @@ -0,0 +1,26 @@ + + + + + delete + from user_video_collection + where id = #{id} + + + delete + from user_video_buy + where id = #{id} + + + + + + diff --git a/doctor-modules/doctor-health/src/main/resources/mapper/doctor/VideoMapper.xml b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/VideoMapper.xml new file mode 100644 index 0000000..e07bcce --- /dev/null +++ b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/VideoMapper.xml @@ -0,0 +1,57 @@ + + + + + + + insert into user_video_collection (user_id, + video_id, + create_time) + values (#{userId}, + #{videoId}, + now()); + + + update video_count + set collection_num=collection_num + 1 + where id = #{id} + + + update user_wallet + set blance==#{newblance} + where id=#{id} + + + + + + + + + diff --git a/doctor-modules/doctor-job/src/main/resources/bootstrap.yml b/doctor-modules/doctor-job/src/main/resources/bootstrap.yml index 537c5d6..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: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + 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 8def34f..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: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + 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 979155f..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: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 config: # 配置中心地址 server-addr: 101.34.77.101:8848 - namespace: 9de208a6-cb30-41ae-a880-78196c99c050 + namespace: 09dff3e2-9790-4d4f-beb6-9baeb01ae040 # 配置文件格式 file-extension: yml # 共享配置