|
|
@@ -14,9 +14,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.jtzx.crm.module.sys.entity.SysUserEntity;
|
|
|
import com.jtzx.crm.module.sys.entity.SysUserGroupRelationEntity;
|
|
|
+import com.jtzx.crm.module.sys.entity.SysUserRoleRelationEntity;
|
|
|
import com.jtzx.crm.module.sys.enums.SysErrorEnum;
|
|
|
import com.jtzx.crm.module.sys.mapper.SysUserGroupRelationMapper;
|
|
|
import com.jtzx.crm.module.sys.mapper.SysUserMapper;
|
|
|
+import com.jtzx.crm.module.sys.mapper.SysUserRoleRelationMapper;
|
|
|
import com.jtzx.crm.module.sys.model.request.AdminListSysUserDTO;
|
|
|
import com.jtzx.crm.module.sys.model.request.InsertOrUpdateSysUserDTO;
|
|
|
import com.jtzx.crm.module.sys.model.request.UpdateSysUserPasswordDTO;
|
|
|
@@ -44,6 +46,7 @@ public class SysUserService {
|
|
|
private final SysUserMapper sysUserMapper;
|
|
|
private final SysRoleService sysRoleService;
|
|
|
private final SysUserGroupRelationMapper sysUserGroupRelationMapper;
|
|
|
+ private final SysUserRoleRelationMapper sysUserRoleRelationMapper;
|
|
|
|
|
|
/**
|
|
|
* 后台管理-分页列表
|
|
|
@@ -126,11 +129,22 @@ public class SysUserService {
|
|
|
public void adminDelete(Collection<Long> ids) {
|
|
|
log.info("[后台管理-删除后台用户] >> 入参={}", ids);
|
|
|
preDeleteCheck(ids);
|
|
|
- //删除关系
|
|
|
- sysUserGroupRelationMapper.delete(
|
|
|
- new LambdaQueryWrapper<>(SysUserGroupRelationEntity.class)
|
|
|
- .in(SysUserGroupRelationEntity::getUserId,ids)
|
|
|
- );
|
|
|
+ long count =
|
|
|
+ sysUserGroupRelationMapper.selectCount(
|
|
|
+ new LambdaQueryWrapper<>(SysUserGroupRelationEntity.class)
|
|
|
+ .in(SysUserGroupRelationEntity::getUserId, ids)
|
|
|
+ );
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BusinessException(400, "不能删除,请先删除分组管理中的人员配置");
|
|
|
+ }
|
|
|
+ long size =
|
|
|
+ sysUserRoleRelationMapper.selectCount(
|
|
|
+ new LambdaQueryWrapper<>(SysUserRoleRelationEntity.class)
|
|
|
+ .in(SysUserRoleRelationEntity::getUserId, ids)
|
|
|
+ );
|
|
|
+ if(size > 0){
|
|
|
+ throw new BusinessException(400,"不能删除,请先删除权限管理中的人员配置");
|
|
|
+ }
|
|
|
sysUserMapper.deleteByIds(ids);
|
|
|
}
|
|
|
|
|
|
@@ -234,23 +248,23 @@ public class SysUserService {
|
|
|
* @param userId
|
|
|
* @param followType 开关的跟进类型,公海跟进-publicFollow,历史跟进 -historyFollow
|
|
|
*/
|
|
|
- public Integer updateUserFollow(Long userId,String followType) {
|
|
|
+ public Integer updateUserFollow(Long userId, String followType) {
|
|
|
SysUserEntity sysUserEntity = sysUserMapper.selectById(userId);
|
|
|
if (sysUserEntity == null) {
|
|
|
throw new BusinessException(400, "用户不存在");
|
|
|
}
|
|
|
- if(followType.equals("publicFollow")){
|
|
|
- if(sysUserEntity.getPublicFollowStatus().equals(1)) {
|
|
|
+ if (followType.equals("publicFollow")) {
|
|
|
+ if (sysUserEntity.getPublicFollowStatus().equals(1)) {
|
|
|
sysUserEntity.setPublicFollowStatus(0);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sysUserEntity.setPublicFollowStatus(1);
|
|
|
}
|
|
|
return sysUserEntity.getPublicFollowStatus();
|
|
|
}
|
|
|
- if(followType.equals("historyFollow")){
|
|
|
- if(sysUserEntity.getHistoryFollowStatus().equals(1)) {
|
|
|
+ if (followType.equals("historyFollow")) {
|
|
|
+ if (sysUserEntity.getHistoryFollowStatus().equals(1)) {
|
|
|
sysUserEntity.setHistoryFollowStatus(0);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
sysUserEntity.setHistoryFollowStatus(1);
|
|
|
}
|
|
|
return sysUserEntity.getHistoryFollowStatus();
|
|
|
@@ -259,7 +273,6 @@ public class SysUserService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 根据用户账号查询
|
|
|
*/
|