|
@@ -3,7 +3,6 @@ package org.dromara.service.impl;
|
|
import cn.dev33.satoken.secure.BCrypt;
|
|
import cn.dev33.satoken.secure.BCrypt;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -243,13 +242,14 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
|
|
});
|
|
});
|
|
if (sysRoleVo != null) {
|
|
if (sysRoleVo != null) {
|
|
Long[] longArray = new Long[1];
|
|
Long[] longArray = new Long[1];
|
|
|
|
+ Long roleId = sysRoleVo.getRoleId();
|
|
longArray[0] = sysRoleVo.getRoleId();
|
|
longArray[0] = sysRoleVo.getRoleId();
|
|
user.setRoleIds(longArray);
|
|
user.setRoleIds(longArray);
|
|
//判断该用户是否有游客角色
|
|
//判断该用户是否有游客角色
|
|
- SysUserVo sysUserVo = userService.selectUserById(user.getUserId());
|
|
|
|
- Long roleId = sysUserVo.getRoleId();
|
|
|
|
- if (roleId != null && !roleId.equals(sysRoleVo.getRoleId())) {
|
|
|
|
- userService.insertUserRole(user, false);
|
|
|
|
|
|
+ List<Long> useIds = userRoleMapper.selectUserIdsByRoleId(roleId);
|
|
|
|
+ if (useIds != null && !useIds.isEmpty()) {
|
|
|
|
+ if (!useIds.contains(userId))
|
|
|
|
+ userService.insertUserRole(user, false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -354,13 +354,15 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
|
|
});
|
|
});
|
|
if (sysRoleVo != null) {
|
|
if (sysRoleVo != null) {
|
|
Long[] longArray = new Long[1];
|
|
Long[] longArray = new Long[1];
|
|
- longArray[0] = sysRoleVo.getRoleId();
|
|
|
|
|
|
+ Long roleId = sysRoleVo.getRoleId();
|
|
|
|
+ longArray[0] = roleId;
|
|
user.setRoleIds(longArray);
|
|
user.setRoleIds(longArray);
|
|
//判断该用户是否有住户角色
|
|
//判断该用户是否有住户角色
|
|
- SysUserVo sysUserVo = userService.selectUserById(user.getUserId());
|
|
|
|
- Long roleId = sysUserVo.getRoleId();
|
|
|
|
- if (roleId != null && !roleId.equals(sysRoleVo.getRoleId())) {
|
|
|
|
- userService.insertUserRole(user, false);
|
|
|
|
|
|
+ //判断该用户是否有住户角色
|
|
|
|
+ List<Long> useIds = userRoleMapper.selectUserIdsByRoleId(roleId);
|
|
|
|
+ if (useIds != null && !useIds.isEmpty()) {
|
|
|
|
+ if (!useIds.contains(userId))
|
|
|
|
+ userService.insertUserRole(user, false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -468,9 +470,10 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
|
|
String tenantId = residentInfo.getTenantId();
|
|
String tenantId = residentInfo.getTenantId();
|
|
String residentType = residentInfo.getResidentType();
|
|
String residentType = residentInfo.getResidentType();
|
|
String isHouseholder = residentInfo.getIsHouseholder();
|
|
String isHouseholder = residentInfo.getIsHouseholder();
|
|
|
|
+ Long userId = residentInfo.getUserId();
|
|
if (TWO.equals(residentInfo.getExamine())) {
|
|
if (TWO.equals(residentInfo.getExamine())) {
|
|
SysUserBo sysUser = new SysUserBo();
|
|
SysUserBo sysUser = new SysUserBo();
|
|
- sysUser.setUserId(bo.getUserId());
|
|
|
|
|
|
+ sysUser.setUserId(userId);
|
|
if (TenantHelper.isEnable()) {
|
|
if (TenantHelper.isEnable()) {
|
|
//把租户id更新到sys_user表/sys_user_tenant表中
|
|
//把租户id更新到sys_user表/sys_user_tenant表中
|
|
sysUser.setTenantId(tenantId);
|
|
sysUser.setTenantId(tenantId);
|
|
@@ -491,18 +494,17 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
|
|
.eq(SysRole::getTenantId, tenantId));
|
|
.eq(SysRole::getTenantId, tenantId));
|
|
});
|
|
});
|
|
if (sysRoleVo != null) {
|
|
if (sysRoleVo != null) {
|
|
|
|
+ Long roleId = sysRoleVo.getRoleId();
|
|
Long[] longArray = new Long[1];
|
|
Long[] longArray = new Long[1];
|
|
- longArray[0] = sysRoleVo.getRoleId();
|
|
|
|
|
|
+ longArray[0] = roleId;
|
|
sysUser.setRoleIds(longArray);
|
|
sysUser.setRoleIds(longArray);
|
|
//判断该用户是否有住户角色
|
|
//判断该用户是否有住户角色
|
|
- SysUserVo sysUserVo = userService.selectUserById(sysUser.getUserId());
|
|
|
|
- Long roleId = sysUserVo.getRoleId();
|
|
|
|
- if (roleId != null && !roleId.equals(sysRoleVo.getRoleId())) {
|
|
|
|
- userService.insertUserRole(sysUser, false);
|
|
|
|
|
|
+ List<Long> useIds = userRoleMapper.selectUserIdsByRoleId(roleId);
|
|
|
|
+ if (useIds != null && !useIds.isEmpty()) {
|
|
|
|
+ if (!useIds.contains(userId))
|
|
|
|
+ userService.insertUserRole(sysUser, false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
//认证通过后 把用户提交的房本信息同步到房屋主表
|
|
//认证通过后 把用户提交的房本信息同步到房屋主表
|
|
if (ONE.equals(residentType) && Y.equals(isHouseholder)) {
|
|
if (ONE.equals(residentType) && Y.equals(isHouseholder)) {
|
|
List<HouseInfoRedident> houseInfoRedidentList = bo.getHouseInfoRedidentList();
|
|
List<HouseInfoRedident> houseInfoRedidentList = bo.getHouseInfoRedidentList();
|
|
@@ -589,7 +591,7 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 管理员修改住户管理
|
|
|
|
|
|
+ * 管理员修改住户管理(认证通过后)
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -597,13 +599,13 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
|
|
ResidentInfo residentInfo = MapstructUtils.convert(bo, ResidentInfo.class);
|
|
ResidentInfo residentInfo = MapstructUtils.convert(bo, ResidentInfo.class);
|
|
//判断是否修改了租户
|
|
//判断是否修改了租户
|
|
ResidentInfoVo residentInfoVo = baseMapper.selectVoById(residentInfo.getResidentId());
|
|
ResidentInfoVo residentInfoVo = baseMapper.selectVoById(residentInfo.getResidentId());
|
|
- String tenantIdOld = residentInfoVo.getTenantId();
|
|
|
|
|
|
+ //String tenantIdOld = residentInfoVo.getTenantId();
|
|
String tenantIdNew = residentInfo.getTenantId();
|
|
String tenantIdNew = residentInfo.getTenantId();
|
|
Long userId = residentInfoVo.getUserId();
|
|
Long userId = residentInfoVo.getUserId();
|
|
SysUserBo sysUser = new SysUserBo();
|
|
SysUserBo sysUser = new SysUserBo();
|
|
- sysUser.setUserId(bo.getUserId());
|
|
|
|
|
|
+ sysUser.setUserId(userId);
|
|
sysUser.setTenantId(tenantIdNew);
|
|
sysUser.setTenantId(tenantIdNew);
|
|
- if (!tenantIdOld.equals(tenantIdNew)) {
|
|
|
|
|
|
+/* if (!tenantIdOld.equals(tenantIdNew)) {
|
|
sysUserTenantMapper.update(new LambdaUpdateWrapper<SysUserTenant>()
|
|
sysUserTenantMapper.update(new LambdaUpdateWrapper<SysUserTenant>()
|
|
.set(SysUserTenant::getTenantId, tenantIdNew)
|
|
.set(SysUserTenant::getTenantId, tenantIdNew)
|
|
.eq(SysUserTenant::getUserId, userId).eq(SysUserTenant::getTenantId, tenantIdOld));
|
|
.eq(SysUserTenant::getUserId, userId).eq(SysUserTenant::getTenantId, tenantIdOld));
|
|
@@ -620,11 +622,17 @@ public class ResidentInfoServiceImpl implements IResidentInfoService {
|
|
});
|
|
});
|
|
if (sysRoleVo != null) {
|
|
if (sysRoleVo != null) {
|
|
Long[] longArray = new Long[1];
|
|
Long[] longArray = new Long[1];
|
|
|
|
+ Long roleId = sysRoleVo.getRoleId();
|
|
longArray[0] = sysRoleVo.getRoleId();
|
|
longArray[0] = sysRoleVo.getRoleId();
|
|
sysUser.setRoleIds(longArray);
|
|
sysUser.setRoleIds(longArray);
|
|
|
|
+ //判断该用户是否有住户角色
|
|
|
|
+ List<Long> useIds = userRoleMapper.selectUserIdsByRoleId(roleId);
|
|
|
|
+ if (useIds != null && !useIds.isEmpty()) {
|
|
|
|
+ if (!useIds.contains(userId))
|
|
|
|
+ userService.insertUserRole(sysUser, false);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- userService.insertUserRole(sysUser, true);
|
|
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
sysUser.setPhonenumber(residentInfo.getResidentPhone());
|
|
sysUser.setPhonenumber(residentInfo.getResidentPhone());
|
|
userService.updateUserByIdNoTenantId(sysUser);
|
|
userService.updateUserByIdNoTenantId(sysUser);
|
|
return baseMapper.updateById(residentInfo) > 0;
|
|
return baseMapper.updateById(residentInfo) > 0;
|