From 235f4dce5b7c865aee449387b06fa266acf12c26 Mon Sep 17 00:00:00 2001 From: thesai <1021828630@qq.com> Date: Tue, 24 Sep 2024 16:43:07 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E6=8C=89id=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/user/SysAccountController.java | 313 ++++++++++-------- .../rtss/services/ISysUserService.java | 2 + .../joylink/rtss/services/SysUserService.java | 8 + 3 files changed, 178 insertions(+), 145 deletions(-) diff --git a/src/main/java/club/joylink/rtss/controller/user/SysAccountController.java b/src/main/java/club/joylink/rtss/controller/user/SysAccountController.java index 982087133..d07990e68 100644 --- a/src/main/java/club/joylink/rtss/controller/user/SysAccountController.java +++ b/src/main/java/club/joylink/rtss/controller/user/SysAccountController.java @@ -4,15 +4,25 @@ import club.joylink.rtss.services.ISysUserService; import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.client.PageVO; -import club.joylink.rtss.vo.client.user.*; +import club.joylink.rtss.vo.client.user.MobileInfoVO; +import club.joylink.rtss.vo.client.user.RetrievePwdVO; +import club.joylink.rtss.vo.client.user.UpdateEmailVO; +import club.joylink.rtss.vo.client.user.UpdateMobileVO; +import club.joylink.rtss.vo.client.user.UpdatePasswordVO; import club.joylink.rtss.vo.user.AccountCreateVO; import club.joylink.rtss.vo.user.AccountRegisterVO; import club.joylink.rtss.vo.user.UserRegisterCheck; +import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; /** * 系统账户接口 @@ -21,165 +31,178 @@ import java.util.List; @RequestMapping("/api/userinfo") public class SysAccountController { - @Autowired - private ISysUserService iSysUserService; + @Autowired + private ISysUserService iSysUserService; - @PostMapping("/register") - public void register(@RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) { - this.iSysUserService.register(accountCreateVO); - } + @PostMapping("/register") + public void register( + @RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) { + this.iSysUserService.register(accountCreateVO); + } - /** - * 新注册接口 - */ - @PostMapping("/register2") - public void register2(@RequestBody @Validated AccountRegisterVO registerVO) { - this.iSysUserService.register2(registerVO); - } + /** + * 新注册接口 + */ + @PostMapping("/register2") + public void register2(@RequestBody @Validated AccountRegisterVO registerVO) { + this.iSysUserService.register2(registerVO); + } - /** - *根据姓名或电话号查询用户 - */ - @GetMapping(path="/nameOrMobile") - public List queryUserByNameOrMobile(String query) { - List list = this.iSysUserService.queryUserByNameOrMobile(query); - return list; - } + /** + * 根据姓名或电话号查询用户 + */ + @GetMapping(path = "/nameOrMobile") + public List queryUserByNameOrMobile(String query) { + List list = this.iSysUserService.queryUserByNameOrMobile(query); + return list; + } - /** - * 手机号是否已经注册 - */ - @GetMapping("/isExist/mobile") - public boolean isMobileExist(String mobile) { - return iSysUserService.isSameMobileExist(mobile); - } + /** + * 手机号是否已经注册 + */ + @GetMapping("/isExist/mobile") + public boolean isMobileExist(String mobile) { + return iSysUserService.isSameMobileExist(mobile); + } - /** - * 邮箱是否已经注册 - */ - @GetMapping("/isExist/email") - public boolean isEmailExist(String email) { - return iSysUserService.isSameEmailExist(email); - } + /** + * 邮箱是否已经注册 + */ + @GetMapping("/isExist/email") + public boolean isEmailExist(String email) { + return iSysUserService.isSameEmailExist(email); + } - /** - *根据用户id获取用户信息 - */ - @GetMapping(path = "/{id}") - public AccountVO getUserBaseInfoById(@PathVariable Long id) { - return this.iSysUserService.getUserBaseInfoById(id); - } + /** + * 根据用户id获取用户信息 + */ + @GetMapping(path = "/{id}") + public AccountVO getUserBaseInfoById(@PathVariable Long id) { + return this.iSysUserService.getUserBaseInfoById(id); + } - /** - *修改用户信息 - */ - @PutMapping(path = "/{id}") - public void modify(@PathVariable Long id, @RequestBody AccountVO userInfo, String vdcode) { - this.iSysUserService.modify(id, userInfo, vdcode); - } + /** + * 修改用户信息 + */ + @PutMapping(path = "/{id}") + public void modify(@PathVariable Long id, @RequestBody AccountVO userInfo, String vdcode) { + this.iSysUserService.modify(id, userInfo, vdcode); + } - /** - *微信关注事件 - */ - @GetMapping(path = "/wxsubscribe") - public void wxSubscribe(@RequestParam String wxId) { - iSysUserService.wxSubscribeEventHandle(wxId); - } + /** + * 微信关注事件 + */ + @GetMapping(path = "/wxsubscribe") + public void wxSubscribe(@RequestParam String wxId) { + iSysUserService.wxSubscribeEventHandle(wxId); + } - /** - *批量修改用户的openId为unionId - */ - @PutMapping(path = "/batchchange/unionid") - public void batchChangeOpenId2UnionId() { - this.iSysUserService.batchChangeOpenId2UnionId(); - } + /** + * 批量修改用户的openId为unionId + */ + @PutMapping(path = "/batchchange/unionid") + public void batchChangeOpenId2UnionId() { + this.iSysUserService.batchChangeOpenId2UnionId(); + } - /** - *更新用户真实姓名 - */ - @PutMapping(path = "/{id}/name") - public void updateName(@PathVariable Long id, String name) { - this.iSysUserService.updateUserName(id, name); - } + /** + * 更新用户真实姓名 + */ + @PutMapping(path = "/{id}/name") + public void updateName(@PathVariable Long id, String name) { + this.iSysUserService.updateUserName(id, name); + } - /** - *更新用户昵称 - */ - @PutMapping(path = "/{id}/nickname") - public void updateNickname(@PathVariable Long id, String nickname) { - this.iSysUserService.updateNickname(id, nickname); - } + /** + * 更新用户昵称 + */ + @PutMapping(path = "/{id}/nickname") + public void updateNickname(@PathVariable Long id, String nickname) { + this.iSysUserService.updateNickname(id, nickname); + } - /** - *用户上传头像 - */ - @PostMapping(path = "/{id}/avatar") - public void uploadAvatar(@PathVariable Long id, @RequestBody AccountVO accountVO) { - this.iSysUserService.updateAvatar(id, accountVO.getAvatarPath()); - } + /** + * 用户上传头像 + */ + @PostMapping(path = "/{id}/avatar") + public void uploadAvatar(@PathVariable Long id, @RequestBody AccountVO accountVO) { + this.iSysUserService.updateAvatar(id, accountVO.getAvatarPath()); + } - /** - *发送手机验证码 - */ - @PostMapping(path = "/mobile/code") - public String sendMobileValidCode(@RequestBody MobileInfoVO mobileInfoVO) { - return this.iSysUserService.sendMobileValidCode(mobileInfoVO); - } + /** + * 发送手机验证码 + */ + @PostMapping(path = "/mobile/code") + public String sendMobileValidCode(@RequestBody MobileInfoVO mobileInfoVO) { + return this.iSysUserService.sendMobileValidCode(mobileInfoVO); + } - /** - *发送邮箱验证码 - */ - @PostMapping(path = "/email/code") - public String sendEmailValidCode(String email) { - return this.iSysUserService.sendEmailValidCode(email); - } + /** + * 发送邮箱验证码 + */ + @PostMapping(path = "/email/code") + public String sendEmailValidCode(String email) { + return this.iSysUserService.sendEmailValidCode(email); + } - /** - *更新用户手机号 - */ - @PutMapping(path = "/{id}/mobile") - public void updateMobile(@PathVariable Long id, @RequestBody @Validated UpdateMobileVO updateMobileVO) { - this.iSysUserService.updateMobile(id, updateMobileVO); - } + /** + * 更新用户手机号 + */ + @PutMapping(path = "/{id}/mobile") + public void updateMobile(@PathVariable Long id, + @RequestBody @Validated UpdateMobileVO updateMobileVO) { + this.iSysUserService.updateMobile(id, updateMobileVO); + } - /** - *更新用户邮箱 - */ - @PutMapping(path = "/{id}/email") - public void updateEmail(@PathVariable Long id, @RequestBody @Validated UpdateEmailVO updateEmailVO) { - this.iSysUserService.updateEmail(id, updateEmailVO); - } + /** + * 更新用户邮箱 + */ + @PutMapping(path = "/{id}/email") + public void updateEmail(@PathVariable Long id, + @RequestBody @Validated UpdateEmailVO updateEmailVO) { + this.iSysUserService.updateEmail(id, updateEmailVO); + } - /** - *更新用户登陆密码 - */ - @PutMapping(path = "/{id}/password") - public void updatePassword(@PathVariable Long id, @RequestBody @Validated UpdatePasswordVO updatePasswordVO) { - this.iSysUserService.updatePassword(id, updatePasswordVO); - } + /** + * 更新用户登陆密码 + */ + @PutMapping(path = "/{id}/password") + public void updatePassword(@PathVariable Long id, + @RequestBody @Validated UpdatePasswordVO updatePasswordVO) { + this.iSysUserService.updatePassword(id, updatePasswordVO); + } - /** - * 按条件分页查询指定来源的账号 - */ - @GetMapping("/page/criteria/{source}") - public PageVO queryPagedAccountOfTheSource(UserQueryVO queryVO, @PathVariable String source) { - queryVO.setSource(source); - return this.iSysUserService.queryPagedUser(queryVO); - } + /** + * 按条件分页查询指定来源的账号 + */ + @GetMapping("/page/criteria/{source}") + public PageVO queryPagedAccountOfTheSource(UserQueryVO queryVO, + @PathVariable String source) { + queryVO.setSource(source); + return this.iSysUserService.queryPagedUser(queryVO); + } - /** - * 超管重置用户密码 - */ - @PutMapping("/{id}/reset/pwd") - public void resetPwd(@PathVariable long id) { - iSysUserService.resetPwd(id); - } + /** + * 超管重置用户密码 + */ + @PutMapping("/{id}/reset/pwd") + public void resetPwd(@PathVariable long id) { + iSysUserService.resetPwd(id); + } - /** - * 找回密码 - */ - @PutMapping("/retrieve/pwd") - public void retrievePwd(@RequestBody @Validated RetrievePwdVO vo) { - iSysUserService.retrievePwd(vo); - } + /** + * 找回密码 + */ + @PutMapping("/retrieve/pwd") + public void retrievePwd(@RequestBody @Validated RetrievePwdVO vo) { + iSysUserService.retrievePwd(vo); + } + + /** + * 根据用户id列表获取用户信息 + */ + @PostMapping("/list/ids") + public List listByIds(@RequestBody List ids) { + return iSysUserService.listByIds(ids); + } } diff --git a/src/main/java/club/joylink/rtss/services/ISysUserService.java b/src/main/java/club/joylink/rtss/services/ISysUserService.java index 378eb824b..5947f36b9 100644 --- a/src/main/java/club/joylink/rtss/services/ISysUserService.java +++ b/src/main/java/club/joylink/rtss/services/ISysUserService.java @@ -363,4 +363,6 @@ public interface ISysUserService { boolean isSameMobileExist(String mobile); boolean isSameEmailExist(String email); + + List listByIds(List ids); } diff --git a/src/main/java/club/joylink/rtss/services/SysUserService.java b/src/main/java/club/joylink/rtss/services/SysUserService.java index 599380893..88112891d 100644 --- a/src/main/java/club/joylink/rtss/services/SysUserService.java +++ b/src/main/java/club/joylink/rtss/services/SysUserService.java @@ -1112,6 +1112,14 @@ public class SysUserService implements ISysUserService { return sysAccountDAO.countByExample(example) > 0; } + @Override + public List listByIds(List ids) { + SysAccountExample example = new SysAccountExample(); + example.createCriteria().andIdIn(ids); + List sysAccounts = sysAccountDAO.selectByExample(example); + return AccountVO.convertFromDB(sysAccounts); + } + /** * 查询包含组织信息的用户信息 */