Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a187dbfdb5
@ -29,11 +29,11 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
|||||||
@RequestMapping("users/cart")
|
@RequestMapping("users/cart")
|
||||||
public class UsersCartController {
|
public class UsersCartController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.CartService.version}")
|
||||||
private CartService cartService;
|
private CartService cartService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true")
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
|
||||||
private CouponService couponService;
|
private CouponService couponService;
|
||||||
|
|
||||||
@PostMapping("add")
|
@PostMapping("add")
|
||||||
|
@ -61,12 +61,6 @@
|
|||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>27.0.1-jre</version>
|
<version>27.0.1-jre</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>Pingplusplus</groupId>
|
|
||||||
<artifactId>pingpp-java</artifactId>
|
|
||||||
<version>2.2.4</version>
|
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xuxueli</groupId>
|
<groupId>com.xuxueli</groupId>
|
||||||
<artifactId>xxl-job-core</artifactId>
|
<artifactId>xxl-job-core</artifactId>
|
||||||
@ -88,6 +82,19 @@
|
|||||||
<groupId>org.apache.dubbo</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>dubbo</artifactId>
|
<artifactId>dubbo</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.curator</groupId>
|
||||||
|
<artifactId>curator-framework</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.curator</groupId>
|
||||||
|
<artifactId>curator-recipes</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
@ -32,14 +32,14 @@ import java.util.stream.Collectors;
|
|||||||
* 购物车服务 Service 实现类
|
* 购物车服务 Service 实现类
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.CartService.version}")
|
||||||
public class CartServiceImpl implements CartService {
|
public class CartServiceImpl implements CartService {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}")
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}")
|
||||||
private PromotionActivityService promotionActivityService;
|
private PromotionActivityService promotionActivityService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
|
||||||
private CouponService couponService;
|
private CouponService couponService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -23,6 +23,16 @@ dubbo:
|
|||||||
name: dubbo
|
name: dubbo
|
||||||
scan:
|
scan:
|
||||||
base-packages: cn.iocoder.mall.order.biz.service
|
base-packages: cn.iocoder.mall.order.biz.service
|
||||||
|
provider:
|
||||||
|
CartService:
|
||||||
|
version: 1.0.0
|
||||||
|
consumer:
|
||||||
|
ProductSpuService:
|
||||||
|
version: 1.0.0
|
||||||
|
PromotionActivityService:
|
||||||
|
version: 1.0.0
|
||||||
|
CouponService:
|
||||||
|
version: 1.0.0
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
logging:
|
logging:
|
||||||
|
@ -58,6 +58,7 @@ public class DubboReferencePool {
|
|||||||
reference.setInterface(notifyUrlParts[0]); // 弱类型接口名
|
reference.setInterface(notifyUrlParts[0]); // 弱类型接口名
|
||||||
reference.setGeneric(true); // 声明为泛化接口
|
reference.setGeneric(true); // 声明为泛化接口
|
||||||
reference.setApplication(application);
|
reference.setApplication(application);
|
||||||
|
reference.setVersion("1.0.0"); // TODO 芋艿,后面要优化下。
|
||||||
// 获得 GenericService 对象
|
// 获得 GenericService 对象
|
||||||
GenericService genericService = reference.get();
|
GenericService genericService = reference.get();
|
||||||
// 构建最终的 ReferenceMeta 对象
|
// 构建最终的 ReferenceMeta 对象
|
||||||
|
@ -24,7 +24,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
|||||||
@Api("商品搜索")
|
@Api("商品搜索")
|
||||||
public class UsersProductSearchController {
|
public class UsersProductSearchController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ProductSearchService.version}")
|
||||||
private ProductSearchService productSearchService;
|
private ProductSearchService productSearchService;
|
||||||
|
|
||||||
@GetMapping("/page") // TODO 芋艿,后面把 BO 改成 VO
|
@GetMapping("/page") // TODO 芋艿,后面把 BO 改成 VO
|
||||||
|
@ -2,7 +2,6 @@ package cn.iocoder.mall.search.biz.service;
|
|||||||
|
|
||||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
import cn.iocoder.common.framework.util.CollectionUtil;
|
||||||
import cn.iocoder.common.framework.util.StringUtil;
|
import cn.iocoder.common.framework.util.StringUtil;
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
|
||||||
import cn.iocoder.common.framework.vo.SortingField;
|
import cn.iocoder.common.framework.vo.SortingField;
|
||||||
import cn.iocoder.mall.order.api.CartService;
|
import cn.iocoder.mall.order.api.CartService;
|
||||||
import cn.iocoder.mall.order.api.bo.CalcSkuPriceBO;
|
import cn.iocoder.mall.order.api.bo.CalcSkuPriceBO;
|
||||||
@ -37,7 +36,7 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.ProductSearchService.version}")
|
||||||
public class ProductSearchServiceImpl implements ProductSearchService {
|
public class ProductSearchServiceImpl implements ProductSearchService {
|
||||||
|
|
||||||
private static final Integer REBUILD_FETCH_PER_SIZE = 100;
|
private static final Integer REBUILD_FETCH_PER_SIZE = 100;
|
||||||
@ -47,11 +46,11 @@ public class ProductSearchServiceImpl implements ProductSearchService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ElasticsearchTemplate elasticsearchTemplate; // 因为需要使用到聚合操作,只好引入 ElasticsearchTemplate 。
|
private ElasticsearchTemplate elasticsearchTemplate; // 因为需要使用到聚合操作,只好引入 ElasticsearchTemplate 。
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.ProductSpuService.version}")
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.ProductCategoryService.version}")
|
||||||
private ProductCategoryService productCategoryService;
|
private ProductCategoryService productCategoryService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.CartService.version}")
|
||||||
private CartService cartService;
|
private CartService cartService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,10 +91,9 @@ public class ProductSearchServiceImpl implements ProductSearchService {
|
|||||||
// 获得最小价格的 SKU ,用于下面的价格计算
|
// 获得最小价格的 SKU ,用于下面的价格计算
|
||||||
ProductSpuDetailBO.Sku sku = spu.getSkus().stream().min(Comparator.comparing(ProductSpuDetailBO.Sku::getPrice)).get();
|
ProductSpuDetailBO.Sku sku = spu.getSkus().stream().min(Comparator.comparing(ProductSpuDetailBO.Sku::getPrice)).get();
|
||||||
// 价格计算
|
// 价格计算
|
||||||
CommonResult<CalcSkuPriceBO> calSkuPriceResult = cartService.calcSkuPrice(sku.getId());
|
CalcSkuPriceBO calSkuPriceResult = cartService.calcSkuPrice(sku.getId());
|
||||||
Assert.isTrue(calSkuPriceResult.isSuccess(), String.format("SKU(%d) 价格计算不会出错", sku.getId()));
|
|
||||||
// 拼装结果
|
// 拼装结果
|
||||||
return ProductSearchConvert.INSTANCE.convert(spu, calSkuPriceResult.getData());
|
return ProductSearchConvert.INSTANCE.convert(spu, calSkuPriceResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,6 +18,16 @@ dubbo:
|
|||||||
name: dubbo
|
name: dubbo
|
||||||
scan:
|
scan:
|
||||||
base-packages: cn.iocoder.mall.search.biz.service
|
base-packages: cn.iocoder.mall.search.biz.service
|
||||||
|
provider:
|
||||||
|
ProductSearchService:
|
||||||
|
version: 1.0.0
|
||||||
|
consumer:
|
||||||
|
ProductSpuService:
|
||||||
|
version: 1.0.0
|
||||||
|
ProductCategoryService:
|
||||||
|
version: 1.0.0
|
||||||
|
CartService:
|
||||||
|
version: 1.0.0
|
||||||
|
|
||||||
# rocketmq
|
# rocketmq
|
||||||
rocketmq:
|
rocketmq:
|
||||||
|
Loading…
Reference in New Issue
Block a user