feat(REQ-2545): 产品权限编辑,旧接口编辑旧权限,新接口编辑新权限
This commit is contained in:
parent
82f93462a6
commit
0c6bc1a479
@ -30,7 +30,7 @@ public interface ProductFeatureRelationService extends IService<SaasProductModul
|
||||
*
|
||||
* @param req
|
||||
*/
|
||||
void updateFeatureResourceRelation(List<ProductFeatureRelationUpdateReq> req);
|
||||
void updateFeatureResourceRelation(List<ProductFeatureRelationUpdateReq> req, int relationType);
|
||||
|
||||
ApiResult<List<ProductFeatureRelationVO>> featureListByProduct(List<Long> productIds);
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ public class ProductFeatureRelationServiceImpl extends ServiceImpl<SaasProductMo
|
||||
List<Long> productIds = req.stream().map(ProductFeatureRelationUpdateReq::getProductModuleId).distinct().collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(productIds)) {
|
||||
saasProductModuleFeatureRelationDao.remove(new LambdaQueryWrapper<SaasProductModuleFeatureRelation>()
|
||||
.in(SaasProductModuleFeatureRelation::getProductModuleId, productIds));
|
||||
.in(SaasProductModuleFeatureRelation::getProductModuleId, productIds).eq(SaasProductModuleFeatureRelation::getType, 0));
|
||||
}
|
||||
List<SaasProductModuleFeatureRelation> saveList = new ArrayList<>();
|
||||
req.forEach(i -> i.getFeatureIds().forEach(featureId -> {
|
||||
@ -103,11 +103,11 @@ public class ProductFeatureRelationServiceImpl extends ServiceImpl<SaasProductMo
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateFeatureResourceRelation(List<ProductFeatureRelationUpdateReq> req) {
|
||||
public void updateFeatureResourceRelation(List<ProductFeatureRelationUpdateReq> req, int relationType) {
|
||||
List<Long> productIds = req.stream().map(ProductFeatureRelationUpdateReq::getProductModuleId).distinct().collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(productIds)) {
|
||||
saasProductModuleFeatureRelationDao.remove(new LambdaQueryWrapper<SaasProductModuleFeatureRelation>()
|
||||
.in(SaasProductModuleFeatureRelation::getProductModuleId, productIds));
|
||||
.in(SaasProductModuleFeatureRelation::getProductModuleId, productIds).eq(SaasProductModuleFeatureRelation::getType, relationType));
|
||||
}
|
||||
|
||||
Set<Long> allFeatureResourceIds = req.stream().map(ProductFeatureRelationUpdateReq::getFeatureIds)
|
||||
|
||||
@ -309,9 +309,9 @@ public class ProductServiceImpl implements ProductService {
|
||||
AssertUtil.isTrue(Objects.nonNull(req.getFeatureScope())
|
||||
&& CollectionUtils.isNotEmpty(req.getFeatureScope().getRelations()), "产品的功能范围选择有误");
|
||||
} else {
|
||||
SaasProductModuleFeatureRelation oneRelation = productFeatureRelationService.getOneByProductId(req.getId());
|
||||
AssertUtil.isTrue(Objects.isNull(oneRelation)
|
||||
|| ProductModuleFeatureRelationTypeEnum.FEATURE_RESOURCE.getCode().equals(oneRelation.getType()), "请在老的产品管理菜单编辑产品权限。");
|
||||
// SaasProductModuleFeatureRelation oneRelation = productFeatureRelationService.getOneByProductId(req.getId());
|
||||
// AssertUtil.isTrue(Objects.isNull(oneRelation)
|
||||
// || ProductModuleFeatureRelationTypeEnum.FEATURE_RESOURCE.getCode().equals(oneRelation.getType()), "请在老的产品管理菜单编辑产品权限。");
|
||||
}
|
||||
}
|
||||
productModule.setProductName(req.getProductName());
|
||||
@ -360,7 +360,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
featureIds.addAll(rootFeatureIds);
|
||||
req.getFeatureIds().addAll(featureIds);
|
||||
req.setFeatureRelationType(ProductModuleFeatureRelationTypeEnum.FEATURE_RESOURCE.getCode());
|
||||
productFeatureRelationService.updateFeatureRelation(Collections.singletonList(req));
|
||||
productFeatureRelationService.updateFeatureResourceRelation(Collections.singletonList(req), ProductModuleFeatureRelationTypeEnum.FEATURE_RESOURCE.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -388,7 +388,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
req.setFeatureRelationType(ProductModuleFeatureRelationTypeEnum.FEATURE_RESOURCE.getCode());
|
||||
reqs.add(req);
|
||||
}
|
||||
productFeatureRelationService.updateFeatureResourceRelation(reqs);
|
||||
productFeatureRelationService.updateFeatureResourceRelation(reqs, ProductModuleFeatureRelationTypeEnum.FEATURE_RESOURCE.getCode());
|
||||
}
|
||||
|
||||
private void fillFeatureScope(ProductVO product) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user