fix: 优化用户注册
This commit is contained in:
parent
27c658f149
commit
8f42025064
@ -6,6 +6,7 @@ import com.yfd.platform.annotation.Log;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.datasource.DataSource;
|
||||
import com.yfd.platform.system.domain.SysUser;
|
||||
import com.yfd.platform.system.domain.SysUserRequest;
|
||||
import com.yfd.platform.system.service.IUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -205,8 +206,9 @@ public class UserController {
|
||||
@PostMapping("/auditUser")
|
||||
@Operation(summary = "审核用户注册")
|
||||
@ResponseBody
|
||||
public ResponseResult auditUser(@RequestParam String userId,
|
||||
@RequestParam Integer auditStatus) {
|
||||
public ResponseResult auditUser(@RequestBody SysUserRequest sysUserRequest) {
|
||||
String userId = sysUserRequest.getUserId();
|
||||
Integer auditStatus = sysUserRequest.getRegStatus();
|
||||
if (userId == null || userId.isEmpty()) {
|
||||
return ResponseResult.error("用户ID不能为空");
|
||||
}
|
||||
@ -224,8 +226,8 @@ public class UserController {
|
||||
@GetMapping("/queryPendingAuditUsers")
|
||||
@Operation(summary = "查询待审核用户列表")
|
||||
@ResponseBody
|
||||
public ResponseResult queryPendingAuditUsers(Page<SysUser> page) {
|
||||
Page<SysUser> result = userService.queryPendingAuditUsers(page);
|
||||
public ResponseResult queryPendingAuditUsers(Page<SysUser> page,String name,String regStatus) {
|
||||
Page<SysUser> result = userService.queryPendingAuditUsers(page,name,regStatus);
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package com.yfd.platform.system.domain;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysUserRequest {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private List<String> userIds;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private Integer regStatus;
|
||||
|
||||
/**
|
||||
* 审批意见
|
||||
*/
|
||||
private String commentInfo;
|
||||
}
|
||||
@ -170,6 +170,6 @@ public interface IUserService extends IService<SysUser> {
|
||||
*page 分页参数
|
||||
* 返回值说明: 待审核用户分页列表
|
||||
************************************/
|
||||
Page<SysUser> queryPendingAuditUsers(Page<SysUser> page);
|
||||
Page<SysUser> queryPendingAuditUsers(Page<SysUser> page,String name, String regStatus);
|
||||
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import com.yfd.platform.system.mapper.SysRoleMapper;
|
||||
import com.yfd.platform.system.mapper.SysUserMapper;
|
||||
import com.yfd.platform.system.service.IUserService;
|
||||
import com.yfd.platform.utils.FileUtil;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.yfd.platform.config.FileSpaceProperties;
|
||||
@ -515,7 +516,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
Page<SysUser> page) {
|
||||
Page<SysUser> mapPage = sysUserMapper.queryUsers(orgid,
|
||||
username, page);
|
||||
;mapPage.getRecords().forEach(record -> {
|
||||
mapPage.getRecords().forEach(record -> {
|
||||
String id = record.getId();
|
||||
List<SysRole> sysRoles = sysRoleMapper.getRoleByUserId(id);
|
||||
record.setRoles(sysRoles);
|
||||
@ -584,7 +585,7 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
UpdateWrapper<SysUser> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("id", userId)
|
||||
.set("reg_status", auditStatus)
|
||||
.set("audit_user", getUsername())
|
||||
.set("audit_user", SecurityUtils.getUserId())
|
||||
.set("audit_time", new Timestamp(System.currentTimeMillis()))
|
||||
.set("lastmodifydate", new Timestamp(System.currentTimeMillis()))
|
||||
.set("lastmodifier", getUsername());
|
||||
@ -597,9 +598,15 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SysUser> queryPendingAuditUsers(Page<SysUser> page) {
|
||||
public Page<SysUser> queryPendingAuditUsers(Page<SysUser> page,String name,String regStatus) {
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysUser::getRegStatus, 0);
|
||||
queryWrapper.in(SysUser::getRegStatus, 0,1,2);
|
||||
queryWrapper.eq(SysUser::getRegStatus, regStatus);
|
||||
queryWrapper.and(StrUtil.isNotBlank(name), wrapper ->
|
||||
wrapper.like(SysUser::getNickname, name)
|
||||
.or()
|
||||
.like(SysUser::getRealName, name)
|
||||
);
|
||||
queryWrapper.orderByDesc(SysUser::getRegTime);
|
||||
return this.page(page, queryWrapper);
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@
|
||||
FROM
|
||||
sys_user u
|
||||
where 1=1
|
||||
and (u.REG_STATUS!=0 and u.REG_STATUS !=2)
|
||||
and u.usertype != 0
|
||||
<if test="orgid != null">
|
||||
and u.orgid = #{orgid}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user