diff --git a/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java b/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java index 9a467e4..c01ad46 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/controller/UserVideoController.java @@ -55,8 +55,8 @@ public class UserVideoController { //我的钱包 @GetMapping("/findUserWallet") - public HealthR> findUserWallet(){ - List userWallets = userVideoService.findUserWallet(); + public HealthR> findUserWallet(@RequestHeader Integer userId){ + List userWallets = userVideoService.findUserWallet(userId); return HealthR.ok(userWallets); } //用户消费记录 @@ -124,7 +124,34 @@ public class UserVideoController { List signEntities = userVideoService.findUserSign(userId); return HealthR.ok(signEntities); } -// //根据用户ID查询用户信息 -// @GetMapping("/getUserInfoById") -// public HealthR<> + //根据用户ID查询用户信息 + @GetMapping("/getUserInfoById") + public HealthR> getUserInfoById(@RequestHeader Integer userId){ + List userVos = userVideoService.getUserInfoById(userId); + return HealthR.ok(userVos); + } + //用户签到 + @PostMapping("/addSign") + public HealthR addSign(){ + userVideoService.addSign(); + return HealthR.ok("签到成功"); + } + //完善用户信息 + @PutMapping("/perfectUserInfo") + public HealthR perfectUserInfo(@RequestParam Integer age,@RequestParam Integer height,@RequestParam Integer weight,@RequestHeader Integer userId ){ + userVideoService.perfectUserInfo(age,height,weight,userId); + return HealthR.ok("完善成功"); + } + //修改用户性别 + @PutMapping("/updateUserSex") + public HealthR updateUserSex(@RequestParam Integer sex,@RequestHeader Integer userId){ + userVideoService.updateUserSex(sex,userId); + return HealthR.ok("修改成功"); + } + //修改用户昵称 + @PutMapping("/modifyNickName") + public HealthR modifyNickName(@RequestParam String nickName,@RequestHeader Integer userId){ + userVideoService.modifyNickName(nickName,userId); + return HealthR.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 index a9d8dc4..4f72bc9 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/controller/VideoController.java @@ -34,6 +34,7 @@ public class VideoController { return HealthR.ok(); } + //评论列表 @GetMapping("/v1/findVideoCommentList") public HealthR> findVideoCommentList(@RequestParam Integer videoId) { diff --git a/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java b/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java index 1664b98..c55aa77 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/mapper/UserVideoMapper.java @@ -5,6 +5,7 @@ import doctor.domain.dto.UserTaskRecordDto; import doctor.domain.entity.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.RequestHeader; import java.util.List; @@ -24,7 +25,7 @@ public interface UserVideoMapper { void deleteVideoBuy(@Param("videoId") Integer videoId); - List findUserWallet(); + List findUserWallet(Integer userId); List findUserConsumptionRecordList(); @@ -46,4 +47,15 @@ public interface UserVideoMapper { List findUserTaskList(); List findUserSign(@Param("userId") Integer userId); + + List getUserInfoById(@Param("userId") Integer userId); + + void perfectUserInfo(@Param("age") Integer age, @Param("height") Integer height, @Param("weight") Integer weight, @Param("userId") Integer userId); + + void updateUserSex(@Param("sex") Integer sex, @Param("userId") Integer userId); + + void modifyNickName(@Param("nickName") String nickName, @Param("userId") Integer userId); + + +// void addSign(SignEntity signEntity); } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java b/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java index 3da852d..a61b36e 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/UserVideoService.java @@ -3,6 +3,7 @@ package doctor.service; import doctor.domain.dto.UserArchivesDto; import doctor.domain.entity.*; import doctor.domain.vo.*; +import org.springframework.web.bind.annotation.RequestHeader; import java.util.List; @@ -21,7 +22,7 @@ public interface UserVideoService { void deleteVideoBuy(Integer videoId); - List findUserWallet(); + List findUserWallet(Integer userId); List findVideoCollectionList(Integer userId); @@ -46,4 +47,14 @@ public interface UserVideoService { List findUserTaskList(); List findUserSign(Integer userId); + + List getUserInfoById(Integer userId); + + void addSign(); + + void perfectUserInfo(Integer age, Integer height, Integer weight, Integer userId); + + void updateUserSex(Integer sex, Integer userId); + + void modifyNickName(String nickName, Integer userId); } diff --git a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java index a8b59a5..86b9ee4 100644 --- a/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java +++ b/doctor-modules/doctor-health/src/main/java/doctor/service/impl/UserVideoServiceImpl.java @@ -9,6 +9,7 @@ import doctor.service.UserVideoService; import doctor.util.ConvertUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestHeader; import java.util.List; @@ -100,6 +101,33 @@ public class UserVideoServiceImpl implements UserVideoService { return userEntityList; } + @Override + public List getUserInfoById(Integer userId) { + List userEntities=userVideoMapper.getUserInfoById(userId); + List userVos = ConvertUtil.entityToVoList(userEntities, UserVo.class); + return userVos; + } + + @Override + public void addSign() { +// userVideoMapper.addSign(signEntity); + } + + @Override + public void perfectUserInfo(Integer age, Integer height, Integer weight, Integer userId) { + userVideoMapper.perfectUserInfo(age,height,weight,userId); + } + + @Override + public void updateUserSex(Integer sex, Integer userId) { + userVideoMapper.updateUserSex(sex,userId); + } + + @Override + public void modifyNickName(String nickName, Integer userId) { + userVideoMapper.modifyNickName(nickName,userId); + } + @Override public List findUserVideoBuyList() { @@ -114,8 +142,8 @@ public class UserVideoServiceImpl implements UserVideoService { } @Override - public List findUserWallet() { - return userVideoMapper.findUserWallet(); + public List findUserWallet(Integer userId) { + return userVideoMapper.findUserWallet(userId); } diff --git a/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml index 0b6832b..64d8bda 100644 --- a/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml +++ b/doctor-modules/doctor-health/src/main/resources/mapper/doctor/UserVideoMapper.xml @@ -30,11 +30,45 @@ create_time now() ); + + + + + + + + + + + + + + + + + update user_archives set picture = #{picture} where id=#{id} + + update user + set age = #{age}, +height = #{height}, +weight = #{weight} + where id = #{userId} + + + update user + set sex = #{sex} + where id = #{userId} + + + update user + set nick_name = #{nickName} + where id = #{userId} + delete from user_video_collection @@ -54,7 +88,7 @@ create_time +