添加第三方账户仿真权限逻辑判断
添加在线用户管理接口
This commit is contained in:
parent
551bdaebf9
commit
afc937068a
@ -7,7 +7,6 @@ import club.joylink.rtss.services.IRunPlanDraftService;
|
|||||||
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
|
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
|
|
||||||
import club.joylink.rtss.vo.client.runplan.*;
|
import club.joylink.rtss.vo.client.runplan.*;
|
||||||
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingSection;
|
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingSection;
|
||||||
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
|
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
package club.joylink.rtss.controller.user;
|
||||||
|
|
||||||
|
import club.joylink.rtss.constants.RoleEnum;
|
||||||
|
import club.joylink.rtss.controller.advice.Role;
|
||||||
|
import club.joylink.rtss.services.LoginSessionManager;
|
||||||
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
|
import club.joylink.rtss.vo.UserQueryVO;
|
||||||
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/loginUser")
|
||||||
|
public class LoginUserController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoginSessionManager loginSessionManager;
|
||||||
|
|
||||||
|
@Role({RoleEnum.Admin, RoleEnum.SuperAdmin})
|
||||||
|
@GetMapping("/paging")
|
||||||
|
public PageVO<LoginUserInfoVO> pagingQuery(UserQueryVO queryVO) {
|
||||||
|
List<LoginUserInfoVO> allLoginUserInfos = this.loginSessionManager.getAllLoginUserInfos();
|
||||||
|
List<LoginUserInfoVO> filterList = allLoginUserInfos.stream()
|
||||||
|
.filter(loginUserInfoVO -> {
|
||||||
|
AccountVO accountVO = loginUserInfoVO.getAccountVO();
|
||||||
|
boolean filter = true;
|
||||||
|
if (queryVO.getId() != null) {
|
||||||
|
filter = filter && queryVO.getId().equals(accountVO.getId());
|
||||||
|
}
|
||||||
|
if (StringUtils.hasText(queryVO.getNickname())) {
|
||||||
|
filter = filter && accountVO.getNickname().contains(queryVO.getNickname());
|
||||||
|
}
|
||||||
|
if (StringUtils.hasText(queryVO.getMobile())) {
|
||||||
|
filter = filter && accountVO.getMobile() != null ? accountVO.getMobile().contains(queryVO.getMobile()) : false;
|
||||||
|
}
|
||||||
|
if (StringUtils.hasText(queryVO.getEmail())) {
|
||||||
|
filter = filter && accountVO.getEmail() != null ? accountVO.getEmail().contains(queryVO.getEmail()) : false;
|
||||||
|
}
|
||||||
|
if (StringUtils.hasText(queryVO.getType())) {
|
||||||
|
filter = filter && queryVO.getType().equals(accountVO.getType());
|
||||||
|
}
|
||||||
|
if (StringUtils.hasText(queryVO.getName())) {
|
||||||
|
filter = filter && accountVO.getName() != null ? accountVO.getName().contains(queryVO.getName()) : false;
|
||||||
|
}
|
||||||
|
if (queryVO.getCompanyId() != null) {
|
||||||
|
filter = filter && queryVO.getCompanyId().equals(accountVO.getOrgId());
|
||||||
|
}
|
||||||
|
return filter;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
List<LoginUserInfoVO> resultList = filterList.stream()
|
||||||
|
.skip(queryVO.getOffset())
|
||||||
|
.limit(queryVO.getPageSize())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), filterList.size(), resultList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -46,6 +46,7 @@ public class UserController {
|
|||||||
this.userGenerateService.generateOfflineUser(generateConfigVO, user);
|
this.userGenerateService.generateOfflineUser(generateConfigVO, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Role({RoleEnum.SuperAdmin, RoleEnum.Admin})
|
||||||
@PostMapping(path = "")
|
@PostMapping(path = "")
|
||||||
public void createAccount(@RequestBody @Validated(CreateAccountCheck.class) AccountCreateVO accountCreateVO,
|
public void createAccount(@RequestBody @Validated(CreateAccountCheck.class) AccountCreateVO accountCreateVO,
|
||||||
@RequestAttribute @ApiIgnore AccountVO user) {
|
@RequestAttribute @ApiIgnore AccountVO user) {
|
||||||
|
@ -321,4 +321,6 @@ public interface ISysUserService {
|
|||||||
List<AccountVO> queryAdminsAndSuperAdmins();
|
List<AccountVO> queryAdminsAndSuperAdmins();
|
||||||
|
|
||||||
AccountVO queryOrCreateThirdAccount(String parentAccount, String account);
|
AccountVO queryOrCreateThirdAccount(String parentAccount, String account);
|
||||||
|
|
||||||
|
AccountVO getThirdAccount(String account);
|
||||||
}
|
}
|
||||||
|
@ -162,4 +162,8 @@ public class LoginSessionManager {
|
|||||||
public List<Long> getAllLoginUserIds() {
|
public List<Long> getAllLoginUserIds() {
|
||||||
return new ArrayList<>(userLoginInfoMap.keySet());
|
return new ArrayList<>(userLoginInfoMap.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LoginUserInfoVO> getAllLoginUserInfos() {
|
||||||
|
return new ArrayList<>(tokenLoginUserMap.values());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,6 +265,9 @@ public class SysUserService implements ISysUserService {
|
|||||||
if (StringUtils.hasText(queryVO.getName())) {
|
if (StringUtils.hasText(queryVO.getName())) {
|
||||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||||
}
|
}
|
||||||
|
if (StringUtils.hasText(queryVO.getType())) {
|
||||||
|
criteria.andTypeEqualTo(queryVO.getType());
|
||||||
|
}
|
||||||
if (StringUtils.hasText(queryVO.getEmail())) {
|
if (StringUtils.hasText(queryVO.getEmail())) {
|
||||||
criteria.andEmailLike(String.format("%%%s%%", queryVO.getEmail()));
|
criteria.andEmailLike(String.format("%%%s%%", queryVO.getEmail()));
|
||||||
}
|
}
|
||||||
@ -277,6 +280,15 @@ public class SysUserService implements ISysUserService {
|
|||||||
if (StringUtils.hasText(queryVO.getRolesStr())) {
|
if (StringUtils.hasText(queryVO.getRolesStr())) {
|
||||||
criteria.andRolesLike(String.format("%%%s%%", queryVO.getRolesStr()));
|
criteria.andRolesLike(String.format("%%%s%%", queryVO.getRolesStr()));
|
||||||
}
|
}
|
||||||
|
if (queryVO.getCompanyId() != null) {
|
||||||
|
List<OrgUser> orgUsers = this.iOrgUserService.queryUsersOfOrg(queryVO.getCompanyId());
|
||||||
|
List<Long> userIdList = orgUsers.stream()
|
||||||
|
.map(OrgUser::getUserId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!orgUsers.isEmpty()) {
|
||||||
|
criteria.andIdIn(userIdList);
|
||||||
|
}
|
||||||
|
}
|
||||||
Page<SysAccount> page = (Page<SysAccount>) this.sysAccountDAO.selectByExample(example);
|
Page<SysAccount> page = (Page<SysAccount>) this.sysAccountDAO.selectByExample(example);
|
||||||
List<AccountVO> accountVOS = AccountVO.convertFromDB(page.getResult());
|
List<AccountVO> accountVOS = AccountVO.convertFromDB(page.getResult());
|
||||||
List<Long> userIds = accountVOS.stream().map(AccountVO::getId).collect(Collectors.toList());
|
List<Long> userIds = accountVOS.stream().map(AccountVO::getId).collect(Collectors.toList());
|
||||||
@ -524,7 +536,7 @@ public class SysUserService implements ISysUserService {
|
|||||||
SysAccountExample example = new SysAccountExample();
|
SysAccountExample example = new SysAccountExample();
|
||||||
SysAccountExample.Criteria criteria = example.createCriteria();
|
SysAccountExample.Criteria criteria = example.createCriteria();
|
||||||
criteria.andAccountEqualTo(sysAccount.getAccount());
|
criteria.andAccountEqualTo(sysAccount.getAccount());
|
||||||
if (sysAccount.getEmail() != null) {
|
if (StringUtils.hasText(sysAccount.getEmail())) {
|
||||||
example.or().andEmailEqualTo(sysAccount.getEmail());
|
example.or().andEmailEqualTo(sysAccount.getEmail());
|
||||||
}
|
}
|
||||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST
|
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST
|
||||||
@ -895,6 +907,7 @@ public class SysUserService implements ISysUserService {
|
|||||||
SysAccount sysAccount = new SysAccount();
|
SysAccount sysAccount = new SysAccount();
|
||||||
sysAccount.setAccount(account);
|
sysAccount.setAccount(account);
|
||||||
sysAccount.setParentAccount(parentAccount);
|
sysAccount.setParentAccount(parentAccount);
|
||||||
|
sysAccount.setNickname(String.format("第三方账户%s",account));
|
||||||
sysAccount.setType(AccountVO.Type_3);
|
sysAccount.setType(AccountVO.Type_3);
|
||||||
String initPassword = EncryptUtil.md5("123456");
|
String initPassword = EncryptUtil.md5("123456");
|
||||||
sysAccount.setPassword(initPassword);
|
sysAccount.setPassword(initPassword);
|
||||||
@ -911,6 +924,17 @@ public class SysUserService implements ISysUserService {
|
|||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccountVO getThirdAccount(String account) {
|
||||||
|
SysAccountExample example = new SysAccountExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andAccountEqualTo(account)
|
||||||
|
.andTypeEqualTo(AccountVO.Type_2);
|
||||||
|
List<SysAccount> accounts = this.sysAccountDAO.selectByExample(example);
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(accounts);
|
||||||
|
return new AccountVO(accounts.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isSameEmailExist(String email) {
|
private boolean isSameEmailExist(String email) {
|
||||||
SysAccountExample example = new SysAccountExample();
|
SysAccountExample example = new SysAccountExample();
|
||||||
example.createCriteria()
|
example.createCriteria()
|
||||||
|
@ -2,7 +2,6 @@ package club.joylink.rtss.services;
|
|||||||
|
|
||||||
import club.joylink.rtss.constants.*;
|
import club.joylink.rtss.constants.*;
|
||||||
import club.joylink.rtss.dao.PermissionDAO;
|
import club.joylink.rtss.dao.PermissionDAO;
|
||||||
import club.joylink.rtss.dao.SysAccountDAO;
|
|
||||||
import club.joylink.rtss.dao.UserPermissionDAO;
|
import club.joylink.rtss.dao.UserPermissionDAO;
|
||||||
import club.joylink.rtss.dao.UserPermissionProcessingDAO;
|
import club.joylink.rtss.dao.UserPermissionProcessingDAO;
|
||||||
import club.joylink.rtss.entity.PermissionDistribute;
|
import club.joylink.rtss.entity.PermissionDistribute;
|
||||||
@ -35,9 +34,6 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class UserPermissionService implements IUserPermissionService {
|
public class UserPermissionService implements IUserPermissionService {
|
||||||
@Autowired
|
|
||||||
private SysAccountDAO sysAccountDAO;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserPermissionDAO userPermissionDAO;
|
private UserPermissionDAO userPermissionDAO;
|
||||||
|
|
||||||
@ -253,7 +249,12 @@ public class UserPermissionService implements IUserPermissionService {
|
|||||||
} else {
|
} else {
|
||||||
permission = iPermissionService.getTeachPermissionByMapId(mapId);
|
permission = iPermissionService.getTeachPermissionByMapId(mapId);
|
||||||
}
|
}
|
||||||
return this.getValidByUserIdAndPermissionId(accountVO.getId(), permission.getId());
|
Long aid = accountVO.getId();
|
||||||
|
if (accountVO.isThirdChildAccount()) {
|
||||||
|
AccountVO parentAccount = this.iSysUserService.getThirdAccount(accountVO.getParentAccount());
|
||||||
|
aid = parentAccount.getId();
|
||||||
|
}
|
||||||
|
return this.getValidByUserIdAndPermissionId(aid, permission.getId());
|
||||||
|
|
||||||
|
|
||||||
// PermissionExample permissionExample = new PermissionExample();
|
// PermissionExample permissionExample = new PermissionExample();
|
||||||
|
@ -330,15 +330,14 @@ public class AuthenticateService implements IAuthenticateService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String thirdPartyLogin(LoginUserVO loginInfo) {
|
public String thirdPartyLogin(LoginUserVO loginInfo) {
|
||||||
Project project = loginInfo.getProject();
|
if (Objects.isNull(loginInfo.getProject())) {
|
||||||
if (Objects.isNull(project)) {
|
|
||||||
loginInfo.setProject(Project.DEFAULT);
|
loginInfo.setProject(Project.DEFAULT);
|
||||||
}
|
}
|
||||||
AccountVO accountVO = this.iSysUserService.queryOrCreateThirdAccount(loginInfo.getParentAccount(),
|
AccountVO accountVO = this.iSysUserService.queryOrCreateThirdAccount(loginInfo.getParentAccount(),
|
||||||
loginInfo.getAccount());
|
loginInfo.getAccount());
|
||||||
Client client = Client.getByIdAndSecret(loginInfo.getClientId(), loginInfo.getSecret());
|
Client client = Client.getByIdAndSecret(loginInfo.getClientId(), loginInfo.getSecret());
|
||||||
// 构造登陆用户信息
|
// 构造登陆用户信息
|
||||||
LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(accountVO, client, project, null);
|
LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(accountVO, client, loginInfo.getProject(), null);
|
||||||
// 执行登录
|
// 执行登录
|
||||||
login(loginUserInfo, true);
|
login(loginUserInfo, true);
|
||||||
return loginUserInfo.getToken();
|
return loginUserInfo.getToken();
|
||||||
|
@ -77,4 +77,6 @@ public interface IOrgService {
|
|||||||
void confirmIsTopOrg(long id);
|
void confirmIsTopOrg(long id);
|
||||||
|
|
||||||
void confirmIsNonTopOrg(Long id);
|
void confirmIsNonTopOrg(Long id);
|
||||||
|
|
||||||
|
List<Org> queryAllSubOrgs(Long orgId);
|
||||||
}
|
}
|
||||||
|
@ -77,4 +77,6 @@ public interface IOrgUserService {
|
|||||||
void userBindCompanyManager(AccountVO accountVO, Long topOrgId);
|
void userBindCompanyManager(AccountVO accountVO, Long topOrgId);
|
||||||
|
|
||||||
List<StudentsUsageStatisticsVO> statisticUsage(UsageQueryVO queryVO);
|
List<StudentsUsageStatisticsVO> statisticUsage(UsageQueryVO queryVO);
|
||||||
|
|
||||||
|
List<OrgUser> queryUsersOfOrg(Long orgId);
|
||||||
}
|
}
|
||||||
|
@ -329,6 +329,16 @@ public class OrgService implements IOrgService {
|
|||||||
String.format("组织[%s]是顶级组织", id));
|
String.format("组织[%s]是顶级组织", id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Org> queryAllSubOrgs(Long orgId) {
|
||||||
|
OrgExample example = new OrgExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andParentIdEqualTo(orgId)
|
||||||
|
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||||
|
List<Org> orgs = this.orgDAO.selectByExample(example);
|
||||||
|
return orgs;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建非顶级组织
|
* 创建非顶级组织
|
||||||
*/
|
*/
|
||||||
|
@ -436,6 +436,20 @@ public class OrgUserService implements IOrgUserService {
|
|||||||
return vos;
|
return vos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OrgUser> queryUsersOfOrg(Long orgId) {
|
||||||
|
List<Org> orgs = this.iOrgService.queryAllSubOrgs(orgId);
|
||||||
|
List<Long> orgList = orgs.stream()
|
||||||
|
.map(Org::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
orgList.add(orgId);
|
||||||
|
OrgUserExample example = new OrgUserExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andOrgIdIn(orgList);
|
||||||
|
List<OrgUser> orgUsers = this.orgUserDAO.selectByExample(example);
|
||||||
|
return orgUsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入组织用户
|
* 导入组织用户
|
||||||
|
@ -10,7 +10,6 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
|
|||||||
import club.joylink.rtss.simulation.rt.RtSimulationService;
|
import club.joylink.rtss.simulation.rt.RtSimulationService;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
|
||||||
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
||||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||||
import club.joylink.rtss.vo.map.MapVO;
|
import club.joylink.rtss.vo.map.MapVO;
|
||||||
|
@ -17,7 +17,6 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
|||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
|
||||||
import club.joylink.rtss.vo.client.runplan.RunPlanLoadVO;
|
import club.joylink.rtss.vo.client.runplan.RunPlanLoadVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
|
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
|
||||||
import club.joylink.rtss.vo.client.schedulingNew.SchedulingCheckResultNewVO;
|
import club.joylink.rtss.vo.client.schedulingNew.SchedulingCheckResultNewVO;
|
||||||
|
@ -136,6 +136,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SimulationManager simulationManager;
|
private SimulationManager simulationManager;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private LoginSessionManager loginSessionManager;
|
||||||
|
@Autowired
|
||||||
private IRunPlanRunlevelService iRunPlanRunlevelService;
|
private IRunPlanRunlevelService iRunPlanRunlevelService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRunPlanParktimeService iRunPlanParktimeService;
|
private IRunPlanParktimeService iRunPlanParktimeService;
|
||||||
@ -1057,12 +1059,16 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||||||
}
|
}
|
||||||
List<UserPermissionVO> ups = iUserPermissionService.getSimulationUserPermission(accountVO, mapId, prdType);
|
List<UserPermissionVO> ups = iUserPermissionService.getSimulationUserPermission(accountVO, mapId, prdType);
|
||||||
if (!CollectionUtils.isEmpty(ups)) {
|
if (!CollectionUtils.isEmpty(ups)) {
|
||||||
if (!MapPrdTypeEnum.JOINT.getCode().equals(prdType)) {
|
if (accountVO.isThirdChildAccount()) {
|
||||||
return true;
|
return this.isThirdAccountHasPermission(accountVO, ups, mapId, prdType);
|
||||||
} else {
|
} else {
|
||||||
long upNum = ups.stream().mapToInt(UserPermissionVO::getRemains).sum();
|
if (!MapPrdTypeEnum.JOINT.getCode().equals(prdType)) {
|
||||||
if (upNum >= 3)
|
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
long upNum = ups.stream().mapToInt(UserPermissionVO::getRemains).sum();
|
||||||
|
if (upNum >= 3)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (accountVO.getCompanyId() != null) {
|
if (accountVO.getCompanyId() != null) {
|
||||||
@ -1071,4 +1077,45 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isThirdAccountHasPermission(AccountVO accountVO, List<UserPermissionVO> ups, Long mapId, String prdType) {
|
||||||
|
if (accountVO.isThirdChildAccount()) {
|
||||||
|
List<LoginUserInfoVO> loginInfos = this.loginSessionManager.getAllLoginUserInfos();
|
||||||
|
Set<LoginUserInfoVO> thirdLoginList = loginInfos.stream()
|
||||||
|
.filter(loginUserInfoVO -> loginUserInfoVO.getAccountVO().isThirdChildAccount() && loginUserInfoVO.getAccountVO().getParentAccount().equals(accountVO.getParentAccount()))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
Set<String> thirdLoginAccountIdList = thirdLoginList.stream()
|
||||||
|
.map(loginUserInfoVO -> loginUserInfoVO.getAccountVO().getId().toString())
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
long count = this.simulationManager.getSimulationList().stream()
|
||||||
|
.filter(simulation -> simulation instanceof Simulation)
|
||||||
|
.map(simulation -> ((Simulation) simulation))
|
||||||
|
.filter(simulation -> {
|
||||||
|
if (simulation.getBuildParams().getMap().getId().equals(mapId)) {
|
||||||
|
if (!((MapPrdTypeEnum.JOINT.getCode().equals(prdType) &&
|
||||||
|
MapPrdTypeEnum.JOINT.equals(simulation.getBuildParams().getProdType())) ||
|
||||||
|
(!MapPrdTypeEnum.JOINT.getCode().equals(prdType) &&
|
||||||
|
!MapPrdTypeEnum.JOINT.equals(simulation.getBuildParams().getProdType())))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (String accountId : simulation.getSimulationUserIds()) {
|
||||||
|
if (thirdLoginAccountIdList.contains(accountId)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
.count();
|
||||||
|
int sum = ups.stream()
|
||||||
|
.mapToInt(userPermissionVO -> userPermissionVO.getRemains())
|
||||||
|
.sum();
|
||||||
|
if (sum <= count) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
|||||||
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
|
||||||
import club.joylink.rtss.vo.client.project.LwConfigVO;
|
import club.joylink.rtss.vo.client.project.LwConfigVO;
|
||||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||||
import club.joylink.rtss.vo.map.MapVO;
|
import club.joylink.rtss.vo.map.MapVO;
|
||||||
|
@ -307,4 +307,8 @@ public class AccountVO implements Serializable {
|
|||||||
this.projectCodes = accountVO.getProjectCodes();
|
this.projectCodes = accountVO.getProjectCodes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isThirdChildAccount() {
|
||||||
|
return this.type == Type_3 && StringUtils.hasText(this.parentAccount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@ public class UserQueryVO extends PageQueryVO {
|
|||||||
@ApiModelProperty(value = "真实姓名")
|
@ApiModelProperty(value = "真实姓名")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,7 +43,7 @@ public class UserQueryVO extends PageQueryVO {
|
|||||||
* 单位名称
|
* 单位名称
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "单位名称")
|
@ApiModelProperty(value = "单位名称")
|
||||||
private Integer companyId;
|
private Long companyId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色
|
* 角色
|
||||||
|
@ -57,4 +57,5 @@ public class AccountCreateVO {
|
|||||||
account.setPassword(this.password);
|
account.setPassword(this.password);
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user