|
@@ -477,6 +477,58 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
|
|
|
if (ObjectUtil.isNotEmpty(bo.getIsCustomize())) {
|
|
if (ObjectUtil.isNotEmpty(bo.getIsCustomize())) {
|
|
|
wrapper.eq(ProductBaseVo::getIsCustomize, bo.getIsCustomize());
|
|
wrapper.eq(ProductBaseVo::getIsCustomize, bo.getIsCustomize());
|
|
|
}
|
|
}
|
|
|
|
|
+ if(ObjectUtil.isNotEmpty(bo.getIds())){
|
|
|
|
|
+ wrapper.in(ProductBaseVo::getId, bo.getIds().split(","));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bo.getBrandIds())){
|
|
|
|
|
+ wrapper.in(ProductBaseVo::getBrandId, bo.getBrandIds().split(","));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bo.getCategoryIds())){
|
|
|
|
|
+ wrapper.in(ProductBaseVo::getBottomCategoryId, bo.getCategoryIds().split(","));
|
|
|
|
|
+ }
|
|
|
|
|
+ // 添加额外的查询条件
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bo.getSearchKeyword())) {
|
|
|
|
|
+ wrapper.and(e -> e
|
|
|
|
|
+ .like(ProductBaseVo::getItemName, bo.getSearchKeyword())
|
|
|
|
|
+ .or()
|
|
|
|
|
+ .like(ProductBaseVo::getBrandName, bo.getSearchKeyword())
|
|
|
|
|
+ .or()
|
|
|
|
|
+ .like(ProductBaseVo::getProductNo, bo.getSearchKeyword())
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (bo.getPriceRange() != null) {
|
|
|
|
|
+ //价格区间 1:1-100 2:100-500 3:500-1000 4:1000以上
|
|
|
|
|
+ switch (bo.getPriceRange()) {
|
|
|
|
|
+ case "1":
|
|
|
|
|
+ wrapper.between(ProductBaseVo::getMemberPrice, 1, 100);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "2":
|
|
|
|
|
+ wrapper.between(ProductBaseVo::getMemberPrice, 100, 500);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "3":
|
|
|
|
|
+ wrapper.between(ProductBaseVo::getMemberPrice, 500, 1000);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "4":
|
|
|
|
|
+ wrapper.ge(ProductBaseVo::getMemberPrice, 1000);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(bo.getSortField() != null && bo.getSortOrder() != null){
|
|
|
|
|
+ String[] sortFields = bo.getSortField().split(",");
|
|
|
|
|
+ String[] sortOrders = bo.getSortOrder().split(",");
|
|
|
|
|
+ for (int i = 0; i < sortFields.length; i++) {
|
|
|
|
|
+ switch (sortFields[i]) {
|
|
|
|
|
+ case "1":
|
|
|
|
|
+ wrapper.orderBy( true, sortOrders[i].equals("Asc"),ProductBaseVo::getCreateTime);
|
|
|
|
|
+ case "2":
|
|
|
|
|
+ wrapper.orderBy( true, sortOrders[i].equals("Asc"),ProductBaseVo::getTotalInventory);
|
|
|
|
|
+ case "3":
|
|
|
|
|
+ wrapper.orderBy( true, sortOrders[i].equals("Asc"),ProductBaseVo::getMemberPrice);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return wrapper;
|
|
return wrapper;
|
|
|
}
|
|
}
|
|
@@ -1494,58 +1546,7 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
|
|
|
// 使用ES分页查询
|
|
// 使用ES分页查询
|
|
|
try {
|
|
try {
|
|
|
LambdaEsQueryWrapper<ProductBaseVo> esQueryWrapper = buildEsQueryWrapperForPc(bo);
|
|
LambdaEsQueryWrapper<ProductBaseVo> esQueryWrapper = buildEsQueryWrapperForPc(bo);
|
|
|
- if(ObjectUtil.isNotEmpty(bo.getIds())){
|
|
|
|
|
- esQueryWrapper.in(ProductBaseVo::getId, bo.getIds().split(","));
|
|
|
|
|
- }
|
|
|
|
|
- if (ObjectUtil.isNotEmpty(bo.getBrandIds())){
|
|
|
|
|
- esQueryWrapper.in(ProductBaseVo::getBrandId, bo.getBrandIds().split(","));
|
|
|
|
|
- }
|
|
|
|
|
- if (ObjectUtil.isNotEmpty(bo.getCategoryIds())){
|
|
|
|
|
- esQueryWrapper.in(ProductBaseVo::getBottomCategoryId, bo.getCategoryIds().split(","));
|
|
|
|
|
- }
|
|
|
|
|
- // 添加额外的查询条件
|
|
|
|
|
- if (ObjectUtil.isNotEmpty(bo.getSearchKeyword())) {
|
|
|
|
|
- esQueryWrapper.and(wrapper -> wrapper
|
|
|
|
|
- .like(ProductBaseVo::getItemName, bo.getSearchKeyword())
|
|
|
|
|
- .or()
|
|
|
|
|
- .like(ProductBaseVo::getBrandName, bo.getSearchKeyword())
|
|
|
|
|
- .or()
|
|
|
|
|
- .like(ProductBaseVo::getProductNo, bo.getSearchKeyword())
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- if (bo.getPriceRange() != null) {
|
|
|
|
|
- //价格区间 1:1-100 2:100-500 3:500-1000 4:1000以上
|
|
|
|
|
- switch (bo.getPriceRange()) {
|
|
|
|
|
- case "1":
|
|
|
|
|
- esQueryWrapper.between(ProductBaseVo::getMemberPrice, 1, 100);
|
|
|
|
|
- break;
|
|
|
|
|
- case "2":
|
|
|
|
|
- esQueryWrapper.between(ProductBaseVo::getMemberPrice, 100, 500);
|
|
|
|
|
- break;
|
|
|
|
|
- case "3":
|
|
|
|
|
- esQueryWrapper.between(ProductBaseVo::getMemberPrice, 500, 1000);
|
|
|
|
|
- break;
|
|
|
|
|
- case "4":
|
|
|
|
|
- esQueryWrapper.ge(ProductBaseVo::getMemberPrice, 1000);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(bo.getSortField() != null && bo.getSortOrder() != null){
|
|
|
|
|
- String[] sortFields = bo.getSortField().split(",");
|
|
|
|
|
- String[] sortOrders = bo.getSortOrder().split(",");
|
|
|
|
|
- for (int i = 0; i < sortFields.length; i++) {
|
|
|
|
|
- switch (sortFields[i]) {
|
|
|
|
|
- case "1":
|
|
|
|
|
- esQueryWrapper.orderBy( true, sortOrders[i].equals("Asc"),ProductBaseVo::getCreateTime);
|
|
|
|
|
- case "2":
|
|
|
|
|
- esQueryWrapper.orderBy( true, sortOrders[i].equals("Asc"),ProductBaseVo::getTotalInventory);
|
|
|
|
|
- case "3":
|
|
|
|
|
- esQueryWrapper.orderBy( true, sortOrders[i].equals("Asc"),ProductBaseVo::getMemberPrice);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
// 检查ES索引是否存在
|
|
// 检查ES索引是否存在
|
|
|
if (!esMapper.existsIndex("productbasevo")) {
|
|
if (!esMapper.existsIndex("productbasevo")) {
|
|
@@ -1747,7 +1748,7 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
|
|
|
List<Long> productIds = productRecommendLinkVos.stream().map(ProductRecommendLinkVo::getProductId).toList();
|
|
List<Long> productIds = productRecommendLinkVos.stream().map(ProductRecommendLinkVo::getProductId).toList();
|
|
|
QueryWrapper<ProductBase> lqw = Wrappers.query(ProductBase.class);
|
|
QueryWrapper<ProductBase> lqw = Wrappers.query(ProductBase.class);
|
|
|
lqw.in("b.id", productIds);
|
|
lqw.in("b.id", productIds);
|
|
|
- lqw.eq("b.product_status", 1);
|
|
|
|
|
|
|
+// lqw.eq("b.product_status", 1);
|
|
|
List<ProductBaseVo> productBaseVos = baseMapper.selectAllList(lqw);
|
|
List<ProductBaseVo> productBaseVos = baseMapper.selectAllList(lqw);
|
|
|
if (CollUtil.isNotEmpty(productBaseVos)) {
|
|
if (CollUtil.isNotEmpty(productBaseVos)) {
|
|
|
return BeanUtil.copyToList(productBaseVos, PcProductVo.class);
|
|
return BeanUtil.copyToList(productBaseVos, PcProductVo.class);
|
|
@@ -2032,25 +2033,24 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * PC端站点商品列表
|
|
|
|
|
|
|
+ * PC端企业商品列表
|
|
|
*
|
|
*
|
|
|
- * @param siteId
|
|
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public List<PcProductVo> getSiteProductList(Long siteId) {
|
|
|
|
|
- List<ClientSiteProductVo> clientSiteProductVos = clientSiteProductMapper.selectVoList(Wrappers.lambdaQuery(ClientSiteProduct.class).eq(ClientSiteProduct::getSiteId, siteId));
|
|
|
|
|
|
|
+ public TableDataInfo<PcProductVo> getSiteProductPage(PcProductBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ List<ClientSiteProductVo> clientSiteProductVos = clientSiteProductMapper.selectVoList();
|
|
|
if (CollUtil.isNotEmpty(clientSiteProductVos)) {
|
|
if (CollUtil.isNotEmpty(clientSiteProductVos)) {
|
|
|
|
|
+ LambdaEsQueryWrapper<ProductBaseVo> wrapper =buildEsQueryWrapperForPc(bo);
|
|
|
List<ProductBaseVo> productBaseVos = esMapper.selectList(new LambdaEsQueryWrapper<ProductBaseVo>()
|
|
List<ProductBaseVo> productBaseVos = esMapper.selectList(new LambdaEsQueryWrapper<ProductBaseVo>()
|
|
|
.in(ProductBaseVo::getId, clientSiteProductVos.stream().map(ClientSiteProductVo::getProductId).toList())
|
|
.in(ProductBaseVo::getId, clientSiteProductVos.stream().map(ClientSiteProductVo::getProductId).toList())
|
|
|
);
|
|
);
|
|
|
List<PcProductVo> pcProductVos = BeanUtil.copyToList(productBaseVos, PcProductVo.class);
|
|
List<PcProductVo> pcProductVos = BeanUtil.copyToList(productBaseVos, PcProductVo.class);
|
|
|
- pcProductVos.forEach(pcProductVo -> {
|
|
|
|
|
- pcProductVo.setAgreementPrice(clientSiteProductVos.stream()
|
|
|
|
|
- .filter(o -> o.getProductId().equals(pcProductVo.getId())).findFirst().get().getAgreementPrice()); // Fixed method call
|
|
|
|
|
- });
|
|
|
|
|
- return pcProductVos;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ TableDataInfo<PcProductVo> build = TableDataInfo.build(pcProductVos);
|
|
|
|
|
+ build.setTotal(productBaseVos.size());
|
|
|
|
|
+ return build;
|
|
|
}
|
|
}
|
|
|
- return List.of();
|
|
|
|
|
|
|
+ return TableDataInfo.build();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2227,5 +2227,33 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
|
|
|
// 如果找到了记录,说明存在重复
|
|
// 如果找到了记录,说明存在重复
|
|
|
return productExtend != null;
|
|
return productExtend != null;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取站点商品池商品列表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param productBaseBo
|
|
|
|
|
+ * @param pageQuery
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public TableDataInfo<PcProductVo> getSitePoolProductList(ProductBaseBo productBaseBo, PageQuery pageQuery) {
|
|
|
|
|
+ //获取协议池的商品Id
|
|
|
|
|
+ List<ProtocolProducts> protocolProducts= protocolProductsMapper.selectList(new LambdaQueryWrapper<ProtocolProducts>()
|
|
|
|
|
+ .eq(ProtocolProducts::getCustomerId, productBaseBo.getCustomerId())
|
|
|
|
|
+ );
|
|
|
|
|
+ if (CollUtil.isEmpty(protocolProducts)) {
|
|
|
|
|
+ return TableDataInfo.build();
|
|
|
|
|
+ }
|
|
|
|
|
+ //获取商品列表
|
|
|
|
|
+ LambdaEsQueryWrapper<ProductBaseVo> wrapper = buildEsQueryWrapper(productBaseBo);
|
|
|
|
|
+ wrapper.in(ProductBaseVo::getId, protocolProducts.stream().map(ProtocolProducts::getProductId).toList());
|
|
|
|
|
+ EsPageInfo<ProductBaseVo> esPageInfo = esMapper.pageQuery(wrapper, pageQuery.getPageNum(), pageQuery.getPageSize());
|
|
|
|
|
+ List<PcProductVo> pcProductVos = BeanUtil.copyToList(esPageInfo.getList(), PcProductVo.class);
|
|
|
|
|
+ pcProductVos.forEach(item -> {
|
|
|
|
|
+ item.setAgreementPrice(protocolProducts.stream().filter(o -> o.getProductId().equals(item.getId())).findFirst().get().getAgreementPrice());
|
|
|
|
|
+ });
|
|
|
|
|
+ TableDataInfo<PcProductVo> build = TableDataInfo.build(pcProductVos);
|
|
|
|
|
+ build.setTotal(esPageInfo.getTotal());
|
|
|
|
|
+ return build;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|