This commit is contained in:
parent
ac87b0dbe9
commit
235f4dce5b
@ -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<AccountVO> queryUserByNameOrMobile(String query) {
|
||||
List<AccountVO> list = this.iSysUserService.queryUserByNameOrMobile(query);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 根据姓名或电话号查询用户
|
||||
*/
|
||||
@GetMapping(path = "/nameOrMobile")
|
||||
public List<AccountVO> queryUserByNameOrMobile(String query) {
|
||||
List<AccountVO> 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<AccountVO> queryPagedAccountOfTheSource(UserQueryVO queryVO, @PathVariable String source) {
|
||||
queryVO.setSource(source);
|
||||
return this.iSysUserService.queryPagedUser(queryVO);
|
||||
}
|
||||
/**
|
||||
* 按条件分页查询指定来源的账号
|
||||
*/
|
||||
@GetMapping("/page/criteria/{source}")
|
||||
public PageVO<AccountVO> 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<AccountVO> listByIds(@RequestBody List<Long> ids) {
|
||||
return iSysUserService.listByIds(ids);
|
||||
}
|
||||
}
|
||||
|
@ -363,4 +363,6 @@ public interface ISysUserService {
|
||||
boolean isSameMobileExist(String mobile);
|
||||
|
||||
boolean isSameEmailExist(String email);
|
||||
|
||||
List<AccountVO> listByIds(List<Long> ids);
|
||||
}
|
||||
|
@ -1112,6 +1112,14 @@ public class SysUserService implements ISysUserService {
|
||||
return sysAccountDAO.countByExample(example) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AccountVO> listByIds(List<Long> ids) {
|
||||
SysAccountExample example = new SysAccountExample();
|
||||
example.createCriteria().andIdIn(ids);
|
||||
List<SysAccount> sysAccounts = sysAccountDAO.selectByExample(example);
|
||||
return AccountVO.convertFromDB(sysAccounts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询包含组织信息的用户信息
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user