ProductAttr改造

This commit is contained in:
zhuyang
2021-10-07 23:14:30 +08:00
parent 4f50845b66
commit a01d66a318
10 changed files with 255 additions and 174 deletions

View File

@@ -7,7 +7,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = {"cn.iocoder.mall.productservice.rpc.spu"})
@EnableFeignClients(basePackages = {"cn.iocoder.mall.productservice.rpc"})
public class ManagementWebApplication {
public static void main(String[] args) {

View File

@@ -1,7 +1,21 @@
### /product-attr/page 成功(全部)
GET {{baseUrl}}/product-attr/key/page?pageNo=1&pageSize=10
GET http://127.0.0.1:18083/management-api/product-attr/key/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
Authorization: Bearer yudaoyuanma
###
POST http://127.0.0.1:18083/management-api/product-attr/key/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
name=桶&status=1
###
POST http://127.0.0.1:18083/management-api/product-attr/value/create
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer yudaoyuanma
attrKeyId=12&name=大桶&status=1
###

View File

@@ -4,10 +4,10 @@ import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.managementweb.controller.product.vo.attr.*;
import cn.iocoder.mall.managementweb.convert.product.ProductAttrConvert;
import cn.iocoder.mall.productservice.rpc.attr.ProductAttrRpc;
import cn.iocoder.mall.productservice.rpc.attr.ProductAttrFeign;
import cn.iocoder.mall.productservice.rpc.attr.dto.ProductAttrKeyRespDTO;
import cn.iocoder.mall.productservice.rpc.attr.dto.ProductAttrValueRespDTO;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -18,9 +18,8 @@ import java.util.List;
@Service
public class ProductAttrKeyManager {
@DubboReference(version = "${dubbo.consumer.ProductAttrRpc.version}")
private ProductAttrRpc productAttrKeyRpc;
@Autowired
private ProductAttrFeign productAttrFeign;
/**
* 创建商品规格键
*
@@ -28,7 +27,7 @@ public class ProductAttrKeyManager {
* @return 商品规格键
*/
public Integer createProductAttrKey(ProductAttrKeyCreateReqVO createVO) {
CommonResult<Integer> createProductAttrKeyResult = productAttrKeyRpc.createProductAttrKey(
CommonResult<Integer> createProductAttrKeyResult = productAttrFeign.createProductAttrKey(
ProductAttrConvert.INSTANCE.convert(createVO));
createProductAttrKeyResult.checkError();
return createProductAttrKeyResult.getData();
@@ -40,7 +39,7 @@ public class ProductAttrKeyManager {
* @param updateVO 更新商品规格键 VO
*/
public void updateProductAttrKey(ProductAttrKeyUpdateReqVO updateVO) {
CommonResult<Boolean> updateProductAttrKeyResult = productAttrKeyRpc.updateProductAttrKey(
CommonResult<Boolean> updateProductAttrKeyResult = productAttrFeign.updateProductAttrKey(
ProductAttrConvert.INSTANCE.convert(updateVO));
updateProductAttrKeyResult.checkError();
}
@@ -52,7 +51,7 @@ public class ProductAttrKeyManager {
* @return 商品规格键
*/
public ProductAttrKeyRespVO getProductAttrKey(Integer productAttrKeyId) {
CommonResult<ProductAttrKeyRespDTO> getProductAttrKeyResult = productAttrKeyRpc.getProductAttrKey(productAttrKeyId);
CommonResult<ProductAttrKeyRespDTO> getProductAttrKeyResult = productAttrFeign.getProductAttrKey(productAttrKeyId);
getProductAttrKeyResult.checkError();
return ProductAttrConvert.INSTANCE.convert(getProductAttrKeyResult.getData());
}
@@ -64,7 +63,7 @@ public class ProductAttrKeyManager {
* @return 商品规格键列表
*/
public List<ProductAttrKeyRespVO> listProductAttrKeys(List<Integer> productAttrKeyIds) {
CommonResult<List<ProductAttrKeyRespDTO>> listProductAttrKeyResult = productAttrKeyRpc.listProductAttrKeys(productAttrKeyIds);
CommonResult<List<ProductAttrKeyRespDTO>> listProductAttrKeyResult = productAttrFeign.listProductAttrKeys(productAttrKeyIds);
listProductAttrKeyResult.checkError();
return ProductAttrConvert.INSTANCE.convertList(listProductAttrKeyResult.getData());
}
@@ -76,7 +75,7 @@ public class ProductAttrKeyManager {
* @return 商品规格键分页结果
*/
public PageResult<ProductAttrKeyRespVO> pageProductAttrKey(ProductAttrKeyPageReqVO pageVO) {
CommonResult<PageResult<ProductAttrKeyRespDTO>> pageProductAttrKeyResult = productAttrKeyRpc.pageProductAttrKey(
CommonResult<PageResult<ProductAttrKeyRespDTO>> pageProductAttrKeyResult = productAttrFeign.pageProductAttrKey(
ProductAttrConvert.INSTANCE.convert(pageVO));
pageProductAttrKeyResult.checkError();
return ProductAttrConvert.INSTANCE.convertPage(pageProductAttrKeyResult.getData());
@@ -89,7 +88,7 @@ public class ProductAttrKeyManager {
* @return 商品规格值
*/
public Integer createProductAttrValue(ProductAttrValueCreateReqVO createVO) {
CommonResult<Integer> createProductAttrValueResult = productAttrKeyRpc.createProductAttrValue(
CommonResult<Integer> createProductAttrValueResult = productAttrFeign.createProductAttrValue(
ProductAttrConvert.INSTANCE.convert(createVO));
createProductAttrValueResult.checkError();
return createProductAttrValueResult.getData();
@@ -101,7 +100,7 @@ public class ProductAttrKeyManager {
* @param updateVO 更新商品规格值 VO
*/
public void updateProductAttrValue(ProductAttrValueUpdateReqVO updateVO) {
CommonResult<Boolean> updateProductAttrValueResult = productAttrKeyRpc.updateProductAttrValue(
CommonResult<Boolean> updateProductAttrValueResult = productAttrFeign.updateProductAttrValue(
ProductAttrConvert.INSTANCE.convert(updateVO));
updateProductAttrValueResult.checkError();
}
@@ -113,7 +112,7 @@ public class ProductAttrKeyManager {
* @return 商品规格值
*/
public ProductAttrValueRespVO getProductAttrValue(Integer productAttrValueId) {
CommonResult<ProductAttrValueRespDTO> getProductAttrValueResult = productAttrKeyRpc.getProductAttrValue(productAttrValueId);
CommonResult<ProductAttrValueRespDTO> getProductAttrValueResult = productAttrFeign.getProductAttrValue(productAttrValueId);
getProductAttrValueResult.checkError();
return ProductAttrConvert.INSTANCE.convert(getProductAttrValueResult.getData());
}
@@ -125,7 +124,7 @@ public class ProductAttrKeyManager {
* @return 商品规格值列表
*/
public List<ProductAttrValueRespVO> listProductAttrValues(ProductAttrValueListQueryReqVO queryReqVO) {
CommonResult<List<ProductAttrValueRespDTO>> listProductAttrValueResult = productAttrKeyRpc.listProductAttrValues(
CommonResult<List<ProductAttrValueRespDTO>> listProductAttrValueResult = productAttrFeign.listProductAttrValues(
ProductAttrConvert.INSTANCE.convert(queryReqVO));
listProductAttrValueResult.checkError();
return ProductAttrConvert.INSTANCE.convertList02(listProductAttrValueResult.getData());