| | |
| | | import com.xiaopeng.common.core.web.controller.BaseController; |
| | | import com.xiaopeng.common.core.web.domain.AjaxResult; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.annotation.Log; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import com.xiaopeng.common.log.enums.BusinessType; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | |
| | | @Log(title = "帐号管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/api/v1/sys-user/add") |
| | | @ApiOperation(value = "添加帐号", tags = {"管理后台-帐号管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.ACCOUNT_MANAGEMENT, |
| | | operationType = AdminOperationType.ADD, |
| | | content = "添加帐号", |
| | | appendRequestData = true |
| | | ) |
| | | public AjaxResult add(@RequestBody SysUser user) { |
| | | if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique(user)) { |
| | | throw new ServiceException("手机号已开通账号", I18nKeyConstant.ACCOUNT_PHONE_DUPLICATE); |
| | |
| | | @Log(title = "帐号管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/api/v1/sys-user/edit") |
| | | @ApiOperation(value = "编辑帐号", tags = {"管理后台-帐号管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.ACCOUNT_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "编辑帐号", |
| | | appendRequestData = true |
| | | ) |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | | userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getId()); |
| | |
| | | @Log(title = "帐号管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/api/v1/sys-user/{userIds}") |
| | | @ApiOperation(value = "删除账号", tags = {"管理后台-帐号管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.ACCOUNT_MANAGEMENT, |
| | | operationType = AdminOperationType.DELETE, |
| | | content = "删除账号", |
| | | appendRequestData = true |
| | | ) |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | | if (ArrayUtils.contains(userIds, tokenService.getLoginUser())) { |
| | | throw new ServiceException("当前用户不能删除", I18nKeyConstant.ACCOUNT_CURRENT_USER_NOT_DELETE); |
| | |
| | | |
| | | @PostMapping("/api/v1/sys-user/switchStatus/{id}") |
| | | @ApiOperation(value = "账号管理--禁用/启用", tags = {"管理后台-帐号管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.ACCOUNT_MANAGEMENT, |
| | | operationType = AdminOperationType.SWITCH_STATUS, |
| | | content = "账号管理--禁用/启用", |
| | | appendRequestData = true |
| | | ) |
| | | public AjaxResult shopUserStart(@ApiParam(name = "id", value = "帐号ID") @PathVariable("id") Long id) { |
| | | SysUser sysUser = userService.getById(id); |
| | | if (sysUser.getStatus().equals(DisabledEnum.NO.getCode())) { |
| | |
| | | @Log(title = "帐号管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/api/v1/sys-user/rePassword") |
| | | @ApiOperation(value = "重置密码", tags = {"管理后台-帐号管理"}) |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.ACCOUNT_MANAGEMENT, |
| | | operationType = AdminOperationType.RESET_PASSWORD, |
| | | content = "重置密码", |
| | | appendRequestData = true |
| | | ) |
| | | public AjaxResult resetPwd(@RequestBody UserPwdResetDTO dto) { |
| | | SysUser user = userService.getById(dto.getUserId()); |
| | | if (Objects.isNull(user)) { |