Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server

This commit is contained in:
lym
2024-06-29 17:36:16 +08:00
2 changed files with 9 additions and 10 deletions
@@ -159,7 +159,7 @@
join order_body ob on oi.body_id = ob.id and oi.organ_id = ob.organ_id
left join order_group og on oi.group_id = og.id and ob.organ_id = og.organ_id
where
oi.order_id = #{orderNo} and oi.organ_id = #{organId}
oi.order_id = #{orderNo} and oi.organ_id = #{organId} and oi.package_id = 0
</select>
@@ -346,19 +346,13 @@ public class PermissionServiceImpl implements PermissionService {
}
// 前端没传或者查一次后切换了组织导致跟角色组织不一致的统一为角色的组织
Long roleOrganId = role.getOrganId();
if (Objects.isNull(organId) || ObjectUtil.notEqual(roleOrganId, organId)) {
boolean isOrganRole = Objects.equals(roleId, InternalRoleConstants.ORGAN_ADMIN_ROLE_ID) || Objects.equals(roleId, InternalRoleConstants.ORGAN_STAFF_ROLE_ID);
// 内置角色还是按照机构来存
if (!isOrganRole && (Objects.isNull(organId) || ObjectUtil.notEqual(roleOrganId, organId))) {
organId = roleOrganId;
}
final Long finalOrganId = organId;
// 当前用户不能操作含有自己的角色
if (CollectionUtil.isNotEmpty(userIds)) {
Long incloudSelf = userIds.stream().filter(userId -> userId.equals(loginUser.getId())).findAny().orElse(null);
if (incloudSelf != null) {
throw new ServiceException(ROLE_ME_ERROR);
}
}
// 获得角色下的角色用户列表
Set<Long> roleUserIds = convertSet(userRoleMapper.selectList(new LambdaQueryWrapperX<UserRoleDO>()
.eqIfPresent(UserRoleDO::getOrganId, organId)
@@ -378,6 +372,11 @@ public class PermissionServiceImpl implements PermissionService {
// 筛选要删除的userRole:前端没有,数据库有
Collection<Long> deleteRoleUserIds = CollUtil.subtract(roleUserIds, userIds);
if (!CollectionUtil.isEmpty(deleteRoleUserIds)) {
// 当前用户不能移除自身的角色
Long incloudSelf = deleteRoleUserIds.stream().filter(userId -> userId.equals(loginUser.getId())).findAny().orElse(null);
if (incloudSelf != null) {
throw new ServiceException(ROLE_ME_ERROR);
}
userRoleMapper.deleteListByRoleIdAndUserIds(roleId, deleteRoleUserIds);
}