|
@@ -147,7 +147,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
if(showType != 0 && showType != 1){
|
|
|
List<String> showPersonIds = productCategoryDTO.getShowPersonIds();
|
|
|
//0所有人可见,1本人可见
|
|
|
- if(showPersonIds != null && showPersonIds.size() != 0){
|
|
|
+ if(showPersonIds.size() != 0){
|
|
|
for (String showPersonId : showPersonIds) {
|
|
|
AssoProductCategoryPerson assoProductCategoryPerson = new AssoProductCategoryPerson();
|
|
|
assoProductCategoryPerson.setProductCategoryId(productCategory.getId());
|
|
@@ -163,11 +163,11 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
}
|
|
|
assoProductCategoryPeople.add(assoProductCategoryPerson);
|
|
|
}
|
|
|
- if(assoProductCategoryPeople != null && assoProductCategoryPeople.size() != 0){
|
|
|
- assoProductCategoryPersonService.saveBatch(assoProductCategoryPeople);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
+ if(assoProductCategoryPeople != null && assoProductCategoryPeople.size() != 0){
|
|
|
+ assoProductCategoryPersonService.saveBatch(assoProductCategoryPeople);
|
|
|
+ }
|
|
|
//判断文件是否为空
|
|
|
if (files != null && files.size() != 0) {
|
|
|
try {
|
|
@@ -205,18 +205,22 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
queryWrapper.in(Product::getCategoryId, ids);
|
|
|
List<Product> products = productService.list(queryWrapper);
|
|
|
if (products != null && products.size() != 0) {
|
|
|
- throw new XiaoShiException("该产品分类下有产品");
|
|
|
+ throw new XiaoShiException("该产品类别下有产品");
|
|
|
}
|
|
|
//根据产品类别id删除产品类别和文件关联表
|
|
|
- LambdaQueryWrapper<AssoProductCategoryFile> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.in(AssoProductCategoryFile::getProductCategoryId, ids);
|
|
|
- List<AssoProductCategoryFile> assoProductCategoryFiles = assoProductCategoryFileService.list(wrapper);
|
|
|
+ LambdaQueryWrapper<AssoProductCategoryFile> fileWrapper = new LambdaQueryWrapper<>();
|
|
|
+ fileWrapper.in(AssoProductCategoryFile::getProductCategoryId, ids);
|
|
|
+ List<AssoProductCategoryFile> assoProductCategoryFiles = assoProductCategoryFileService.list(fileWrapper);
|
|
|
List<String> guids = assoProductCategoryFiles.stream().map(AssoProductCategoryFile::getFileGuid).collect(Collectors.toList());
|
|
|
if (guids.size() != 0) {
|
|
|
fileManagerService.deleteFileFromFMS(guids);
|
|
|
}
|
|
|
//删除产品类别和文件关联表中数据
|
|
|
- assoProductCategoryFiles.remove(queryWrapper);
|
|
|
+ assoProductCategoryFileService.remove(fileWrapper);
|
|
|
+ //根据产品类别id删除产品类别和可见人员关联表
|
|
|
+ LambdaQueryWrapper<AssoProductCategoryPerson> personWrapper = new LambdaQueryWrapper<>();
|
|
|
+ personWrapper.in(AssoProductCategoryPerson::getProductCategoryId, ids);
|
|
|
+ assoProductCategoryPersonService.remove(personWrapper);
|
|
|
//根据产品类别id删除产品类别
|
|
|
this.removeBatchByIds(ids);
|
|
|
return ids;
|
|
@@ -301,11 +305,11 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
}
|
|
|
assoProductCategoryPeople.add(assoProductCategoryPerson);
|
|
|
}
|
|
|
- if(assoProductCategoryPeople != null && assoProductCategoryPeople.size() != 0){
|
|
|
- assoProductCategoryPersonService.saveBatch(assoProductCategoryPeople);
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
+ if(assoProductCategoryPeople != null && assoProductCategoryPeople.size() != 0){
|
|
|
+ assoProductCategoryPersonService.saveBatch(assoProductCategoryPeople);
|
|
|
+ }
|
|
|
/**
|
|
|
* 与产品类别有关的文件的处理
|
|
|
*/
|
|
@@ -420,6 +424,8 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
Personnel personnel = personnels.stream().filter(item -> item.getGuid().equals(productCategoryVO.getCreateId())).findFirst().orElse(null);
|
|
|
if(personnel != null){
|
|
|
productCategoryVO.setCreateName(personnel.getPersonnelName());
|
|
|
+ } else {
|
|
|
+ throw new XiaoShiException("未获取到当前登陆人信息");
|
|
|
}
|
|
|
//装载文件信息
|
|
|
List<AssoProductCategoryFile> assoProductCategoryFilesTemp = assoProductCategoryFiles.stream().filter(item -> item.getProductCategoryId().equals(productCategoryVO.getId())).collect(Collectors.toList());
|