|
@@ -7,7 +7,9 @@ import com.miaxis.common.core.domain.entity.SysUser;
|
|
|
import com.miaxis.common.core.domain.entity.UserInfo;
|
|
|
import com.miaxis.common.core.page.ResponsePageInfo;
|
|
|
import com.miaxis.common.utils.SecurityUtils;
|
|
|
+import com.miaxis.common.utils.StringUtils;
|
|
|
import com.miaxis.user.dto.UserDto;
|
|
|
+import com.miaxis.user.dto.UserInfoUpdateDto;
|
|
|
import com.miaxis.user.service.IUserInfoService;
|
|
|
import com.miaxis.user.vo.UserVo;
|
|
|
import io.swagger.annotations.*;
|
|
@@ -30,126 +32,28 @@ public class UserInfoController extends BaseController{
|
|
|
@Autowired
|
|
|
private IUserInfoService userInfoService;
|
|
|
|
|
|
- /**
|
|
|
- * 查询用户信息列表
|
|
|
- */
|
|
|
- @GetMapping("/list")
|
|
|
- @ApiOperation("查询用户信息列表")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
|
|
|
- @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
|
|
|
- })
|
|
|
- public ResponsePageInfo<UserInfo> list(@ModelAttribute UserInfo userInfo){
|
|
|
- startPage();
|
|
|
- List<UserInfo> list = userInfoService.list();
|
|
|
- return toResponsePageInfo(list);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取用户id获取详细信息
|
|
|
- */
|
|
|
- @GetMapping(value = "/ids/{id}")
|
|
|
- @ApiOperation("获取用户信息详细信息")
|
|
|
- public Response<UserInfo> getInfo(
|
|
|
- @ApiParam(name = "id", value = "用户信息参数", required = true)
|
|
|
- @PathVariable("id") Long id
|
|
|
- ){
|
|
|
- return Response.success(userInfoService.selectUserInfoById(id));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据电话获取用户信息详细信息
|
|
|
- */
|
|
|
- @GetMapping(value = "mobles/{mobile}")
|
|
|
- @ApiOperation("获取用户信息详细信息")
|
|
|
- public Response<UserInfo> getInfo(
|
|
|
- @ApiParam(name = "mobile", value = "用户电话", required = true)
|
|
|
- @PathVariable("mobile") String mobile
|
|
|
- ){
|
|
|
- return Response.success(userInfoService.selectUserInfoByMoble(mobile));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 修改用户信息
|
|
|
*/
|
|
|
- @PutMapping
|
|
|
+ @PostMapping
|
|
|
@ApiOperation("修改用户信息")
|
|
|
- public Response<Integer> edit(@RequestBody UserInfo userInfo){
|
|
|
- return toResponse(userInfoService.updateUserInfo(userInfo));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存用户报名信息
|
|
|
- * uploadIdCardAndHeadPicture
|
|
|
- */
|
|
|
- @PostMapping(Constants.OPEN_PREFIX + "/saveUserInformation")
|
|
|
- @ApiOperation("保存用户报名信息")
|
|
|
- public Response saveUserInformation(UserDto userDto) {
|
|
|
+ public Response edit(@RequestBody UserInfoUpdateDto userInfoUpdateDto){
|
|
|
|
|
|
- return userInfoService.saveUserInformation(userDto);
|
|
|
+ UserInfo userInfo= SecurityUtils.getLoginUser().getStudent();
|
|
|
+ if (userInfo!= null){
|
|
|
+ if (!StringUtils.isEmpty(userInfoUpdateDto.getHeadImage())){
|
|
|
+ userInfo.setHeadImage(userInfoUpdateDto.getHeadImage());
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(userInfoUpdateDto.getNickName())){
|
|
|
+ userInfo.setNickName(userInfoUpdateDto.getNickName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //更新数据库
|
|
|
+ userInfoService.updateById(userInfo);
|
|
|
+ return Response.success("更新成功");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 注册报名获取短信验证码
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation("注册报名获取短信验证码")
|
|
|
- @ApiImplicitParam(name = "phone",value = "手机号码" ,dataType = "String",required = true)
|
|
|
- @PostMapping(value = Constants.OPEN_PREFIX + "/sendSignUpVerificationCode")
|
|
|
- public Response sendSignUpVerificationCode(String phone){
|
|
|
-
|
|
|
- return userInfoService.sendSignUpVerificationCode(phone);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 修改手机号获取短信验证码
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation("修改手机号获取短信验证码")
|
|
|
- @ApiImplicitParam(name = "phone",value = "手机号码" ,dataType = "String",required = true)
|
|
|
- @PostMapping(value = "/sendModifyVerificationCode")
|
|
|
- public Response sendModifyVerificationCode(String phone){
|
|
|
- //获取当前用户
|
|
|
- SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
|
|
|
- return userInfoService.sendModifyVerificationCode(user,phone);
|
|
|
- }
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 修改用户手机号
|
|
|
- */
|
|
|
- @PostMapping("/modifyPhoneNumber")
|
|
|
- @ApiOperation("修改用户手机号")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "smsCodeType,", value = "login:用户登录验证码、modify:修改手机验证码、signUp:注册报名验证码", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "phone", value = "手机号码", required = true, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "verificationCode", value = "短信验证码", required = true, dataType = "String")
|
|
|
- })
|
|
|
- public Response modifyPhoneNumber(String phone,String verificationCode){
|
|
|
- //获取当前用户
|
|
|
- SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
- //修改手机号
|
|
|
- return userInfoService.modifyPhoneNumber(phone,verificationCode,user);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询我的报名信息
|
|
|
- */
|
|
|
- @GetMapping("/getMyRegistrationInformation")
|
|
|
- @ApiOperation("查询我的报名信息")
|
|
|
- @ApiImplicitParam(name = "userId",value = "用户id" ,dataType = "String",required = true)
|
|
|
- public Response<UserVo> getMyRegistrationInformation(String userId){
|
|
|
-
|
|
|
- return userInfoService.getMyRegistrationInformation(userId);
|
|
|
- }
|
|
|
-
|
|
|
- public static void main(String[] args) {
|
|
|
- System.out.println(System.getProperty("user.dir"));
|
|
|
- }
|
|
|
-
|
|
|
}
|