<一键创建项目下所有地图的权限分发>接口自动给没有权限的地图生成权限
This commit is contained in:
parent
4e5cd4dce4
commit
f2bea7bed0
@ -40,6 +40,7 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -668,6 +669,14 @@ public class PermissionDistributeService implements IPermissionDistributeService
|
||||
String.format("项目[%s]下没有地图", project));
|
||||
List<Long> mapIds = maps.stream().map(MapVO::getId).collect(Collectors.toList());
|
||||
List<Permission> permissions = iPermissionService.getJointAndTeachEntities(mapIds);
|
||||
Map<Long, List<Permission>> groupByMapId = permissions.stream().collect(Collectors.groupingBy(Permission::getMapId));
|
||||
List<Long> newMapIds = mapIds;
|
||||
newMapIds.removeAll(groupByMapId.keySet());
|
||||
if (!CollectionUtils.isEmpty(newMapIds)) {
|
||||
newMapIds.forEach(mapId -> iPermissionService.generatePermission(mapId, user));
|
||||
permissions = iPermissionService.getJointAndTeachEntities(mapIds);
|
||||
}
|
||||
|
||||
List<GoodsVO> goodsList = iGoodsService.getByPermissionIds(permissions.stream().map(Permission::getId).collect(Collectors.toList()));
|
||||
List<OrderDetailCreateVO> orderDetails = goodsList.stream().map(goodsVO -> new OrderDetailCreateVO(goodsVO.getId(), num)).collect(Collectors.toList());
|
||||
OrderCreateVO orderCreateVO = iOrderService.createInternalOrderCreateVO(null, orderDetails);
|
||||
|
@ -554,10 +554,7 @@ public class PermissionService implements IPermissionService {
|
||||
example.or()
|
||||
.andMapIdIn(mapIds)
|
||||
.andNameLike(String.format("%%%s%%", "Comprehensive exercise cloud platform"));
|
||||
List<Permission> permissions = permissionDAO.selectByExample(example);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(permissions,
|
||||
"权限数据不存在");
|
||||
return permissions;
|
||||
return permissionDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user