|
|
@@ -1,16 +1,24 @@ |
|
|
|
package com.ningdatech.pmapi.sys.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
|
import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
|
import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; |
|
|
|
import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService; |
|
|
|
import com.ningdatech.pmapi.signature.entity.CompanySignature; |
|
|
|
import com.ningdatech.pmapi.signature.service.ICompanySignatureService; |
|
|
|
import com.ningdatech.pmapi.sys.contants.UserGuidanceContant; |
|
|
|
import com.ningdatech.pmapi.sys.model.entity.UserRole; |
|
|
|
import com.ningdatech.pmapi.sys.model.vo.UserGuidanceDetailVO; |
|
|
|
import com.ningdatech.pmapi.sys.model.vo.UserGuidanceVO; |
|
|
|
import com.ningdatech.pmapi.sys.service.IUserRoleService; |
|
|
|
import com.ningdatech.pmapi.user.entity.UserAuth; |
|
|
|
import com.ningdatech.pmapi.user.entity.UserInfo; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; |
|
|
|
import com.ningdatech.pmapi.user.service.IUserAuthService; |
|
|
|
import com.ningdatech.pmapi.user.service.IUserInfoService; |
|
|
|
import com.wflow.bean.entity.WflowOrgModels; |
|
|
|
import com.wflow.enums.ProcessDefTypeEnum; |
|
|
|
import com.wflow.service.OrgProcdefService; |
|
|
@@ -21,6 +29,7 @@ import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Classname UserGuidanceManage |
|
|
@@ -35,7 +44,11 @@ public class UserGuidanceManage { |
|
|
|
|
|
|
|
private final OrgProcdefService orgProcdefService; |
|
|
|
|
|
|
|
private final ICompanyFiscalCodeService fiscalCodeService; |
|
|
|
private final IUserInfoService userInfoService; |
|
|
|
|
|
|
|
private final IUserRoleService userRoleService; |
|
|
|
|
|
|
|
private final IUserAuthService userAuthService; |
|
|
|
|
|
|
|
private final ICompanySignatureService signatureService; |
|
|
|
|
|
|
@@ -111,4 +124,28 @@ public class UserGuidanceManage { |
|
|
|
vo.setDetails(details); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 删除重复用户 |
|
|
|
* @param userId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public String removeRepeat(Long userId) { |
|
|
|
UserInfo user = userInfoService.getById(userId); |
|
|
|
VUtils.isTrue(Objects.isNull(user)).throwMessage("该用户不存在 删除重复失败"); |
|
|
|
List<UserInfo> repeatUsers = userInfoService.list(Wrappers.lambdaQuery(UserInfo.class) |
|
|
|
.eq(UserInfo::getUsername, user.getUsername()) |
|
|
|
.ne(UserInfo::getId, userId) |
|
|
|
.isNull(UserInfo::getAccountId)); |
|
|
|
if(CollUtil.isNotEmpty(repeatUsers)){ |
|
|
|
List<Long> repeatIds = repeatUsers.stream().map(UserInfo::getId).collect(Collectors.toList()); |
|
|
|
userInfoService.removeBatchByIds(repeatIds); |
|
|
|
userAuthService.remove(Wrappers.lambdaQuery(UserAuth.class) |
|
|
|
.in(UserAuth::getUserId,repeatIds)); |
|
|
|
userRoleService.remove(Wrappers.lambdaQuery(UserRole.class) |
|
|
|
.in(UserRole::getUserId,repeatIds)); |
|
|
|
return "删除成功"; |
|
|
|
} |
|
|
|
return "不存在重复的用户"; |
|
|
|
} |
|
|
|
} |