Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
50d8aac2
提交
50d8aac2
authored
10月 07, 2021
作者:
zhuyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ProductCategory改造
上级
b5b102d1
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
171 行增加
和
227 行删除
+171
-227
ProductCategoryController.http
...mentweb/controller/product/ProductCategoryController.http
+12
-3
ProductCategoryManager.java
...managementweb/manager/product/ProductCategoryManager.java
+9
-9
ProductBrandRpc.java
...ocoder/mall/productservice/rpc/brand/ProductBrandRpc.java
+0
-63
ProductCategoryFeign.java
...all/productservice/rpc/category/ProductCategoryFeign.java
+68
-0
ProductCategoryRpc.java
.../mall/productservice/rpc/category/ProductCategoryRpc.java
+0
-62
ProductCategoryController.java
.../productservice/controller/ProductCategoryController.java
+68
-19
ProductBrandRpcImpl.java
...er/mall/productservice/rpc/brand/ProductBrandRpcImpl.java
+0
-58
SearchProductManager.java
...l/searchservice/manager/product/SearchProductManager.java
+4
-4
ProductCategoryManager.java
.../mall/shopweb/service/product/ProductCategoryManager.java
+6
-5
ProductSpuManager.java
...coder/mall/shopweb/service/product/ProductSpuManager.java
+4
-4
没有找到文件。
management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.http
浏览文件 @
50d8aac2
### /product-category/tree 成功
GET
{{baseUrl}}
/product-category/tree
GET
http://127.0.0.1:18083/management-api
/product-category/tree
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
dubbo-tag: {{dubboTag}}
Authorization: Bearer yudaoyuanma
###
POST http://127.0.0.1:18083/management-api/product-category/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
pid=0&name=美食&description=吃喝拉撒&sort=7&status=1
###
\ No newline at end of file
management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductCategoryManager.java
浏览文件 @
50d8aac2
...
...
@@ -6,11 +6,11 @@ import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCateg
import
cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO
;
import
cn.iocoder.mall.managementweb.convert.product.ProductCategoryConvert
;
import
cn.iocoder.mall.productservice.enums.category.ProductCategoryIdEnum
;
import
cn.iocoder.mall.productservice.rpc.category.ProductCategory
Rpc
;
import
cn.iocoder.mall.productservice.rpc.category.ProductCategory
Feign
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.
apache.dubbo.config.annotation.Reference
;
import
org.
springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
...
...
@@ -22,10 +22,10 @@ import java.util.stream.Collectors;
@Service
@Slf4j
public
class
ProductCategoryManager
{
@Reference
(
version
=
"${dubbo.consumer.ProductCategoryRpc.version}"
)
private
ProductCategoryRpc
productCategoryRpc
;
@Autowired
private
ProductCategoryFeign
productCategoryFeign
;
/**
* 创建商品分类表
*
...
...
@@ -33,7 +33,7 @@ public class ProductCategoryManager {
* @return 商品分类表
*/
public
Integer
createProductCategory
(
ProductCategoryCreateReqVO
createVO
)
{
CommonResult
<
Integer
>
createProductCategoryResult
=
productCategory
Rpc
.
createProductCategory
(
ProductCategoryConvert
.
INSTANCE
.
convert
(
createVO
));
CommonResult
<
Integer
>
createProductCategoryResult
=
productCategory
Feign
.
createProductCategory
(
ProductCategoryConvert
.
INSTANCE
.
convert
(
createVO
));
createProductCategoryResult
.
checkError
();
return
createProductCategoryResult
.
getData
();
}
...
...
@@ -44,7 +44,7 @@ public class ProductCategoryManager {
* @param updateVO 更新商品分类表 VO
*/
public
void
updateProductCategory
(
ProductCategoryUpdateReqVO
updateVO
)
{
CommonResult
<
Boolean
>
updateProductCategoryResult
=
productCategory
Rpc
.
updateProductCategory
(
ProductCategoryConvert
.
INSTANCE
.
convert
(
updateVO
));
CommonResult
<
Boolean
>
updateProductCategoryResult
=
productCategory
Feign
.
updateProductCategory
(
ProductCategoryConvert
.
INSTANCE
.
convert
(
updateVO
));
updateProductCategoryResult
.
checkError
();
}
...
...
@@ -54,7 +54,7 @@ public class ProductCategoryManager {
* @param productCategoryId 商品分类表编号
*/
public
void
deleteProductCategory
(
Integer
productCategoryId
)
{
CommonResult
<
Boolean
>
deleteProductCategoryResult
=
productCategory
Rpc
.
deleteProductCategory
(
productCategoryId
);
CommonResult
<
Boolean
>
deleteProductCategoryResult
=
productCategory
Feign
.
deleteProductCategory
(
productCategoryId
);
deleteProductCategoryResult
.
checkError
();
}
...
...
@@ -65,7 +65,7 @@ public class ProductCategoryManager {
*/
public
List
<
ProductCategoryTreeNodeRespVO
>
treeProductCategory
()
{
// 获得商品分类全列表
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategories
=
productCategory
Rpc
.
listProductCategories
(
new
ProductCategoryListQueryReqDTO
());
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategories
=
productCategory
Feign
.
listProductCategories
(
new
ProductCategoryListQueryReqDTO
());
listProductCategories
.
checkError
();
// 构建菜单树
return
buildProductCategoryTree
(
listProductCategories
.
getData
());
...
...
product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpc.java
deleted
100644 → 0
浏览文件 @
b5b102d1
package
cn
.
iocoder
.
mall
.
productservice
.
rpc
.
brand
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO
;
import
java.util.List
;
/**
* 商品品牌 Rpc 接口
*/
public
interface
ProductBrandRpc
{
/**
* 创建商品品牌
*
* @param createDTO 创建商品品牌 DTO
* @return 商品品牌编号
*/
CommonResult
<
Integer
>
createProductBrand
(
ProductBrandCreateReqDTO
createDTO
);
/**
* 更新商品品牌
*
* @param updateDTO 更新商品品牌 DTO
*/
CommonResult
<
Boolean
>
updateProductBrand
(
ProductBrandUpdateReqDTO
updateDTO
);
/**
* 删除商品品牌
*
* @param productBrandId 商品品牌编号
*/
CommonResult
<
Boolean
>
deleteProductBrand
(
Integer
productBrandId
);
/**
* 获得商品品牌
*
* @param productBrandId 商品品牌编号
* @return 商品品牌
*/
CommonResult
<
ProductBrandRespDTO
>
getProductBrand
(
Integer
productBrandId
);
/**
* 获得商品品牌列表
*
* @param productBrandIds 商品品牌编号列表
* @return 商品品牌列表
*/
CommonResult
<
List
<
ProductBrandRespDTO
>>
listProductBrands
(
List
<
Integer
>
productBrandIds
);
/**
* 获得商品品牌分页
*
* @param pageDTO 商品品牌分页查询
* @return 商品品牌分页结果
*/
CommonResult
<
PageResult
<
ProductBrandRespDTO
>>
pageProductBrand
(
ProductBrandPageReqDTO
pageDTO
);
}
product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryFeign.java
0 → 100644
浏览文件 @
50d8aac2
package
cn
.
iocoder
.
mall
.
productservice
.
rpc
.
category
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.Collection
;
import
java.util.List
;
@FeignClient
(
value
=
"product-service"
)
public
interface
ProductCategoryFeign
{
/**
* 创建商品分类
*
* @param createDTO 创建商品分类 DTO
* @return 商品分类编号
*/
@PostMapping
(
"/product/category/createProductCategory"
)
CommonResult
<
Integer
>
createProductCategory
(
@RequestBody
ProductCategoryCreateReqDTO
createDTO
);
/**
* 更新商品分类
*
* @param updateDTO 更新商品分类 DTO
*/
@PostMapping
(
"/product/category/updateProductCategory"
)
CommonResult
<
Boolean
>
updateProductCategory
(
@RequestBody
ProductCategoryUpdateReqDTO
updateDTO
);
/**
* 删除商品分类
*
* @param productCategoryId 商品分类编号
*/
@GetMapping
(
"/product/category/deleteProductCategory"
)
CommonResult
<
Boolean
>
deleteProductCategory
(
@RequestParam
(
"productCategoryId"
)
Integer
productCategoryId
);
/**
* 获得商品分类
*
* @param productCategoryId 商品分类编号
* @return 商品分类
*/
@GetMapping
(
"/product/category/getProductCategory"
)
CommonResult
<
ProductCategoryRespDTO
>
getProductCategory
(
@RequestParam
(
"productCategoryId"
)
Integer
productCategoryId
);
/**
* 获得商品分类列表
*
* @param productCategoryIds 商品分类编号列表
* @return 商品分类列表
*/
@GetMapping
(
"/product/category/listProductCategoriesByIds"
)
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategoriesByIds
(
@RequestParam
(
"productCategoryIds"
)
Collection
<
Integer
>
productCategoryIds
);
/**
* 获得符合条件的商品分类列表
*
* @return 商品分类列表
*/
@PostMapping
(
"/product/category/listProductCategories"
)
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategories
(
@RequestBody
ProductCategoryListQueryReqDTO
listQueryReqDTO
);
}
product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryRpc.java
deleted
100644 → 0
浏览文件 @
b5b102d1
package
cn
.
iocoder
.
mall
.
productservice
.
rpc
.
category
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO
;
import
java.util.Collection
;
import
java.util.List
;
/**
* 商品分类 Rpc 接口
*/
public
interface
ProductCategoryRpc
{
/**
* 创建商品分类
*
* @param createDTO 创建商品分类 DTO
* @return 商品分类编号
*/
CommonResult
<
Integer
>
createProductCategory
(
ProductCategoryCreateReqDTO
createDTO
);
/**
* 更新商品分类
*
* @param updateDTO 更新商品分类 DTO
*/
CommonResult
<
Boolean
>
updateProductCategory
(
ProductCategoryUpdateReqDTO
updateDTO
);
/**
* 删除商品分类
*
* @param productCategoryId 商品分类编号
*/
CommonResult
<
Boolean
>
deleteProductCategory
(
Integer
productCategoryId
);
/**
* 获得商品分类
*
* @param productCategoryId 商品分类编号
* @return 商品分类
*/
CommonResult
<
ProductCategoryRespDTO
>
getProductCategory
(
Integer
productCategoryId
);
/**
* 获得商品分类列表
*
* @param productCategoryIds 商品分类编号列表
* @return 商品分类列表
*/
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategories
(
Collection
<
Integer
>
productCategoryIds
);
/**
* 获得符合条件的商品分类列表
*
* @return 商品分类列表
*/
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategories
(
ProductCategoryListQueryReqDTO
listQueryReqDTO
);
}
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/
rpc/category/ProductCategoryRpcImpl
.java
→
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/
controller/ProductCategoryController
.java
浏览文件 @
50d8aac2
package
cn
.
iocoder
.
mall
.
productservice
.
rpc
.
category
;
package
cn
.
iocoder
.
mall
.
productservice
.
controller
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.manager.brand.ProductBrandManager
;
import
cn.iocoder.mall.productservice.manager.category.ProductCategoryManager
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Collection
;
import
java.util.List
;
...
...
@@ -15,44 +22,86 @@ import java.util.List;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
/**
* 商品分类 Rpc 实现类
*/
@DubboService
public
class
ProductCategoryRpcImpl
implements
ProductCategoryRpc
{
* Title:
* Description:
*
* @author zhuyang
* @version 1.0 2021/10/7
*/
@RestController
@RequestMapping
(
"/product/category"
)
@Api
(
"商品品牌"
)
public
class
ProductCategoryController
{
@Autowired
private
ProductCategoryManager
productCategoryManager
;
@Override
public
CommonResult
<
Integer
>
createProductCategory
(
ProductCategoryCreateReqDTO
createDTO
)
{
/**
* 创建商品分类
*
* @param createDTO 创建商品分类 DTO
* @return 商品分类编号
*/
@PostMapping
(
"createProductCategory"
)
CommonResult
<
Integer
>
createProductCategory
(
@RequestBody
ProductCategoryCreateReqDTO
createDTO
){
return
success
(
productCategoryManager
.
createProductCategory
(
createDTO
));
}
@Override
public
CommonResult
<
Boolean
>
updateProductCategory
(
ProductCategoryUpdateReqDTO
updateDTO
)
{
/**
* 更新商品分类
*
* @param updateDTO 更新商品分类 DTO
*/
@PostMapping
(
"updateProductCategory"
)
CommonResult
<
Boolean
>
updateProductCategory
(
@RequestBody
ProductCategoryUpdateReqDTO
updateDTO
){
productCategoryManager
.
updateProductCategory
(
updateDTO
);
return
success
(
true
);
}
@Override
public
CommonResult
<
Boolean
>
deleteProductCategory
(
Integer
productCategoryId
)
{
/**
* 删除商品分类
*
* @param productCategoryId 商品分类编号
*/
@GetMapping
(
"deleteProductCategory"
)
CommonResult
<
Boolean
>
deleteProductCategory
(
@RequestParam
(
"productCategoryId"
)
Integer
productCategoryId
){
productCategoryManager
.
deleteProductCategory
(
productCategoryId
);
return
success
(
true
);
}
@Override
public
CommonResult
<
ProductCategoryRespDTO
>
getProductCategory
(
Integer
productCategoryId
)
{
/**
* 获得商品分类
*
* @param productCategoryId 商品分类编号
* @return 商品分类
*/
@GetMapping
(
"getProductCategory"
)
CommonResult
<
ProductCategoryRespDTO
>
getProductCategory
(
@RequestParam
(
"productCategoryId"
)
Integer
productCategoryId
){
return
success
(
productCategoryManager
.
getProductCategory
(
productCategoryId
));
}
@Override
public
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategories
(
Collection
<
Integer
>
productCategoryIds
)
{
/**
* 获得商品分类列表
*
* @param productCategoryIds 商品分类编号列表
* @return 商品分类列表
*/
@GetMapping
(
"listProductCategoriesByIds"
)
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategoriesByIds
(
@RequestParam
(
"productCategoryIds"
)
Collection
<
Integer
>
productCategoryIds
){
return
success
(
productCategoryManager
.
listProductCategories
(
productCategoryIds
));
}
@Override
public
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategories
(
ProductCategoryListQueryReqDTO
listQueryReqDTO
)
{
/**
* 获得符合条件的商品分类列表
*
* @return 商品分类列表
*/
@PostMapping
(
"listProductCategories"
)
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategories
(
@RequestBody
ProductCategoryListQueryReqDTO
listQueryReqDTO
){
return
success
(
productCategoryManager
.
listProductCategories
(
listQueryReqDTO
));
}
}
product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandRpcImpl.java
deleted
100644 → 0
浏览文件 @
b5b102d1
package
cn
.
iocoder
.
mall
.
productservice
.
rpc
.
brand
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.manager.brand.ProductBrandManager
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO
;
import
cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
import
static
cn
.
iocoder
.
common
.
framework
.
vo
.
CommonResult
.
success
;
/**
* 商品品牌 Rpc 实现类
*/
@DubboService
public
class
ProductBrandRpcImpl
implements
ProductBrandRpc
{
@Autowired
private
ProductBrandManager
productBrandManager
;
@Override
public
CommonResult
<
Integer
>
createProductBrand
(
ProductBrandCreateReqDTO
createDTO
)
{
return
success
(
productBrandManager
.
createProductBrand
(
createDTO
));
}
@Override
public
CommonResult
<
Boolean
>
updateProductBrand
(
ProductBrandUpdateReqDTO
updateDTO
)
{
productBrandManager
.
updateProductBrand
(
updateDTO
);
return
success
(
true
);
}
@Override
public
CommonResult
<
Boolean
>
deleteProductBrand
(
Integer
productBrandId
)
{
productBrandManager
.
deleteProductBrand
(
productBrandId
);
return
success
(
true
);
}
@Override
public
CommonResult
<
ProductBrandRespDTO
>
getProductBrand
(
Integer
productBrandId
)
{
return
success
(
productBrandManager
.
getProductBrand
(
productBrandId
));
}
@Override
public
CommonResult
<
List
<
ProductBrandRespDTO
>>
listProductBrands
(
List
<
Integer
>
productBrandIds
)
{
return
success
(
productBrandManager
.
listProductBrands
(
productBrandIds
));
}
@Override
public
CommonResult
<
PageResult
<
ProductBrandRespDTO
>>
pageProductBrand
(
ProductBrandPageReqDTO
pageDTO
)
{
return
success
(
productBrandManager
.
pageProductBrand
(
pageDTO
));
}
}
search-service-project/search-service-app/src/main/java/cn/iocoder/mall/searchservice/manager/product/SearchProductManager.java
浏览文件 @
50d8aac2
...
...
@@ -3,7 +3,7 @@ package cn.iocoder.mall.searchservice.manager.product;
import
cn.iocoder.common.framework.util.CollectionUtils
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.rpc.category.ProductCategory
Rpc
;
import
cn.iocoder.mall.productservice.rpc.category.ProductCategory
Feign
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO
;
import
cn.iocoder.mall.productservice.rpc.sku.ProductSkuRpc
;
import
cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuListQueryReqDTO
;
...
...
@@ -35,9 +35,9 @@ public class SearchProductManager {
@DubboReference
(
version
=
"${dubbo.consumer.ProductSkuRpc.version}"
)
private
ProductSkuRpc
productSkuRpc
;
@DubboReference
(
version
=
"${dubbo.consumer.ProductCategoryRpc.version}"
)
private
ProductCategoryRpc
productCategoryRpc
;
@Autowired
private
ProductCategoryFeign
productCategoryFeign
;
@Autowired
private
ProductSpuFeign
productSpuFeign
;
...
...
@@ -110,7 +110,7 @@ public class SearchProductManager {
}
// 获得商品分类
CommonResult
<
ProductCategoryRespDTO
>
getProductCategoryResult
=
productCategory
Rpc
.
getProductCategory
(
productSpuResult
.
getData
().
getCid
());
productCategory
Feign
.
getProductCategory
(
productSpuResult
.
getData
().
getCid
());
getProductCategoryResult
.
checkError
();
if
(
getProductCategoryResult
.
getData
()
==
null
)
{
log
.
error
(
"[saveProduct][商品 SPU({}) 的分类({}) 不存在]"
,
id
,
productSpuResult
.
getData
().
getCid
());
...
...
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/product/ProductCategoryManager.java
浏览文件 @
50d8aac2
...
...
@@ -2,12 +2,12 @@ package cn.iocoder.mall.shopweb.service.product;
import
cn.iocoder.common.framework.enums.CommonStatusEnum
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.productservice.rpc.category.ProductCategory
Rpc
;
import
cn.iocoder.mall.productservice.rpc.category.ProductCategory
Feign
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO
;
import
cn.iocoder.mall.shopweb.controller.product.vo.category.ProductCategoryRespVO
;
import
cn.iocoder.mall.shopweb.convert.product.ProductCategoryConvert
;
import
org.
apache.dubbo.config.annotation.DubboReference
;
import
org.
springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -20,11 +20,12 @@ import java.util.List;
@Validated
public
class
ProductCategoryManager
{
@DubboReference
(
version
=
"${dubbo.consumer.ProductCategoryRpc.version}"
)
private
ProductCategoryRpc
productCategoryRpc
;
@Autowired
private
ProductCategoryFeign
productCategoryFeign
;
public
List
<
ProductCategoryRespVO
>
listProductCategories
(
Integer
pid
)
{
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategoriesResult
=
productCategory
Rpc
.
listProductCategories
(
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategoriesResult
=
productCategory
Feign
.
listProductCategories
(
new
ProductCategoryListQueryReqDTO
().
setPid
(
pid
).
setStatus
(
CommonStatusEnum
.
ENABLE
.
getValue
()));
listProductCategoriesResult
.
checkError
();
return
ProductCategoryConvert
.
INSTANCE
.
convertList
(
listProductCategoriesResult
.
getData
());
...
...
shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/product/ProductSpuManager.java
浏览文件 @
50d8aac2
...
...
@@ -4,7 +4,7 @@ import cn.iocoder.common.framework.util.CollectionUtils;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.common.framework.vo.PageResult
;
import
cn.iocoder.mall.productservice.enums.spu.ProductSpuDetailFieldEnum
;
import
cn.iocoder.mall.productservice.rpc.category.ProductCategory
Rpc
;
import
cn.iocoder.mall.productservice.rpc.category.ProductCategory
Feign
;
import
cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO
;
import
cn.iocoder.mall.productservice.rpc.spu.ProductSpuFeign
;
import
cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuDetailRespDTO
;
...
...
@@ -37,9 +37,9 @@ public class ProductSpuManager {
@DubboReference
(
version
=
"${dubbo.consumer.SearchProductRpc.version}"
)
private
SearchProductRpc
searchProductRpc
;
@DubboReference
(
version
=
"${dubbo.consumer.ProductCategoryRpc.version}"
)
private
ProductCategoryRpc
productCategoryRpc
;
@Autowired
private
ProductCategoryFeign
productCategoryFeign
;
@Autowired
private
ProductSpuFeign
productSpuFeign
;
...
...
@@ -62,7 +62,7 @@ public class ProductSpuManager {
conditionRespVO
.
setCategories
(
Collections
.
emptyList
());
}
else
{
CommonResult
<
List
<
ProductCategoryRespDTO
>>
listProductCategoriesResult
=
productCategory
Rpc
.
listProductCategorie
s
(
getSearchProductConditionResult
.
getData
().
getCids
());
productCategory
Feign
.
listProductCategoriesById
s
(
getSearchProductConditionResult
.
getData
().
getCids
());
listProductCategoriesResult
.
checkError
();
conditionRespVO
.
setCategories
(
ProductSpuConvert
.
INSTANCE
.
convertList
(
listProductCategoriesResult
.
getData
()));
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论