|
@@ -12,6 +12,7 @@ import com.backendsys.modules.system.entity.SysUserDTO;
|
|
|
import com.backendsys.modules.system.entity.SysUserInfo;
|
|
|
import com.backendsys.modules.system.entity.SysUserRole;
|
|
|
import com.backendsys.modules.system.entity.SysUserRoleRelation;
|
|
|
+import com.backendsys.modules.system.service.SysUserService;
|
|
|
import com.backendsys.utils.response.PageEntity;
|
|
|
import com.backendsys.utils.response.PageInfoResult;
|
|
|
import com.backendsys.utils.v2.PageUtils;
|
|
@@ -36,6 +37,9 @@ public class MaterialUserServiceImpl implements MaterialUserService {
|
|
|
@Autowired
|
|
|
private SysUserRoleRelationDao sysUserRoleRelationDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysUserService sysUserService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取素材用户列表 ({ invite_code = Material })
|
|
|
*/
|
|
@@ -79,8 +83,6 @@ public class MaterialUserServiceImpl implements MaterialUserService {
|
|
|
if (user_info_detail == null) throw new CustException("用户不存在");
|
|
|
|
|
|
// 判断用户是否待审核状态 (-1审核拒绝, 1待审核, 2审核通过)
|
|
|
-// Integer audit_status = user_info_detail.getAudit_status();
|
|
|
-// if (audit_status == 2) throw new CustException("用户已通过审核");
|
|
|
if (materialAudit.getUser_id() == SecurityUtil.getUserId()) throw new CustException("不能审核自己");
|
|
|
|
|
|
// [DB] 获取素材用户角色ID集合
|
|
@@ -88,11 +90,17 @@ public class MaterialUserServiceImpl implements MaterialUserService {
|
|
|
List<Long> role_ids = role_list.stream().map(SysUserRole::getRole_id).toList();
|
|
|
if (!role_ids.contains(materialAudit.getRole_id())) throw new CustException("必须指定素材用户角色");
|
|
|
|
|
|
- // [DB] 更新用户信息-审核状态
|
|
|
+ // [DB] 更新用户信息-审核状态/用户状态
|
|
|
SysUserInfo entity = new SysUserInfo();
|
|
|
entity.setAudit_status(materialAudit.getAudit_status());
|
|
|
+ entity.setStatus(materialAudit.getStatus());
|
|
|
sysUserInfoDao.update(entity, wrapper);
|
|
|
|
|
|
+ // 如果是禁用状态,则清除该用户的登录信息
|
|
|
+ if (materialAudit.getStatus() == -1) {
|
|
|
+ sysUserService.kickUser(materialAudit.getUser_id());
|
|
|
+ }
|
|
|
+
|
|
|
// [DB] 更新用户与角色关系 (先删,后增)
|
|
|
LambdaQueryWrapper<SysUserRoleRelation> wrapperRoleRelation = new LambdaQueryWrapper<>();
|
|
|
wrapperRoleRelation.eq(SysUserRoleRelation::getUser_id, materialAudit.getUser_id());
|