|
|
@@ -274,20 +274,23 @@ public class MerchantService {
|
|
|
//criteriaBuilder.like(root.get("name"), "%" + pageQuery.getSearch() + "%")).getRestriction()
|
|
|
);
|
|
|
|
|
|
- List<Goods> goods = goodsRepo.findAll((root, criteriaQuery, criteriaBuilder) ->
|
|
|
- criteriaQuery.where(
|
|
|
- criteriaBuilder.and(
|
|
|
- criteriaBuilder.like(root.get("name"), "%" + pageQuery.getSearch() + "%")),
|
|
|
- criteriaBuilder.equal(root.get("status"), ApplyStatus.PASS)).getRestriction()
|
|
|
- );
|
|
|
-
|
|
|
Set<Merchant> merchants = new HashSet<>(merchantList);
|
|
|
- goods.forEach(g -> {
|
|
|
- Merchant merchant = merchantRepo.findById(g.getMerchantId()).orElse(null);
|
|
|
- if (ObjectUtil.isNotNull(merchant) && ApplyStatus.PASS.equals(merchant.getStatus())) {
|
|
|
- merchants.add(merchant);
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ if (StrUtil.isNotBlank(pageQuery.getSearch())) {
|
|
|
+ List<Goods> goods = goodsRepo.findAll((root, criteriaQuery, criteriaBuilder) ->
|
|
|
+ criteriaQuery.where(
|
|
|
+ criteriaBuilder.and(
|
|
|
+ criteriaBuilder.like(root.get("name"), "%" + pageQuery.getSearch() + "%")),
|
|
|
+ criteriaBuilder.equal(root.get("status"), ApplyStatus.PASS)).getRestriction()
|
|
|
+ );
|
|
|
+
|
|
|
+ goods.forEach(g -> {
|
|
|
+ Merchant merchant = merchantRepo.findById(g.getMerchantId()).orElse(null);
|
|
|
+ if (ObjectUtil.isNotNull(merchant) && ApplyStatus.PASS.equals(merchant.getStatus())) {
|
|
|
+ merchants.add(merchant);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
/* //所有商家要按距离排序规则
|
|
|
Map<Merchant, Double> map = new HashMap<>();
|
|
|
@@ -312,9 +315,9 @@ public class MerchantService {
|
|
|
|
|
|
Map<Merchant, Double> mers = this.distanceSorting(merchants, longitude, latitude, null);
|
|
|
|
|
|
- if (popularTag == null) {
|
|
|
+/* if (popularTag == null) {
|
|
|
popularTag = pageQuery.getSearch();
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
//转DTO
|
|
|
List<MerchantDTO> merchantDTOS = CollUtil.newArrayList();
|
|
|
@@ -324,8 +327,8 @@ public class MerchantService {
|
|
|
// }
|
|
|
// for (Merchant m : mers) {
|
|
|
MerchantSettings settings = merchantSettingsRepo.findByMerchantId(m.getKey().getId()).orElseThrow(new BusinessException("商户不存在"));
|
|
|
+ MerchantDTO merchantDTO = new MerchantDTO(m.getKey(), settings, m.getValue());
|
|
|
if (StrUtil.isNotBlank(popularTag)) {
|
|
|
- MerchantDTO merchantDTO = new MerchantDTO(m.getKey(), settings, m.getValue());
|
|
|
merchantDTO.setFullReductions(fullReductionRepo.findAllByMerchantId(merchantDTO.getMid()));
|
|
|
switch (popularTag) {
|
|
|
case "首单立减":
|
|
|
@@ -361,6 +364,8 @@ public class MerchantService {
|
|
|
merchantDTOS.add(merchantDTO);
|
|
|
break;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ merchantDTOS.add(merchantDTO);
|
|
|
}
|
|
|
}
|
|
|
|