|
|
@@ -249,7 +249,7 @@ public class MerchantSettingsService {
|
|
|
List<MerchantSettings> all = merchantSettingsRepo.findAll();
|
|
|
|
|
|
List<MerchantSettings> collect = all.stream()
|
|
|
- .filter(a -> a.getStartTime().isBefore(now) && a.getEndTime().isAfter(now) && a.getPriority() >= 2
|
|
|
+ .filter(a -> a.getStartTime().isBefore(now) && a.getEndTime().isAfter(now) && a.getPriority() >= 1
|
|
|
&& a.getIsOpening() && a.getWeek()
|
|
|
.contains(dayOfWeek)
|
|
|
)
|
|
|
@@ -356,11 +356,12 @@ public class MerchantSettingsService {
|
|
|
}
|
|
|
|
|
|
//其他筛选条件
|
|
|
- public List<MerchantDTO> otherFilter(List<MerchantDTO> dtos, FilterDTO filterDto) {
|
|
|
+ public List<MerchantDTO> otherFilter(List<MerchantDTO> dtos, String tag, String natureId, BigDecimal startAmount,
|
|
|
+ BigDecimal endAmount) {
|
|
|
Set<MerchantDTO> collect = new HashSet<>();
|
|
|
LongArrayConverter converter = new LongArrayConverter();
|
|
|
- if (filterDto.getNatureId() != null) {
|
|
|
- List<Long> natureIds = converter.convertToEntityAttribute(filterDto.getFilter());
|
|
|
+ if (natureId != null) {
|
|
|
+ List<Long> natureIds = converter.convertToEntityAttribute(natureId);
|
|
|
//商家性质筛选
|
|
|
natureIds.forEach(n ->
|
|
|
collect.addAll(dtos.stream()
|
|
|
@@ -370,28 +371,28 @@ public class MerchantSettingsService {
|
|
|
}
|
|
|
|
|
|
//金额区间
|
|
|
- if (filterDto.getStartAmount() != null && filterDto.getEndAmount() != null) {
|
|
|
+ if (startAmount != null && endAmount != null) {
|
|
|
collect.addAll(dtos.stream()
|
|
|
- .filter(d -> this.consumption(d.getMid()).compareTo(filterDto.getStartAmount()) >= 0
|
|
|
- && this.consumption(d.getMid()).compareTo(filterDto.getEndAmount()) <= 0
|
|
|
+ .filter(d -> this.consumption(d.getMid()).compareTo(startAmount) >= 0
|
|
|
+ && this.consumption(d.getMid()).compareTo(endAmount) <= 0
|
|
|
).collect(Collectors.toSet()));
|
|
|
|
|
|
- } else if (filterDto.getStartAmount() != null) {
|
|
|
+ } else if (startAmount != null) {
|
|
|
collect.addAll(dtos.stream()
|
|
|
- .filter(d -> this.consumption(d.getMid()).compareTo(filterDto.getStartAmount()) >= 0
|
|
|
+ .filter(d -> this.consumption(d.getMid()).compareTo(startAmount) >= 0
|
|
|
).collect(Collectors.toSet()));
|
|
|
|
|
|
- } else if (filterDto.getEndAmount() != null) {
|
|
|
+ } else if (endAmount != null) {
|
|
|
collect.addAll(dtos.stream()
|
|
|
- .filter(d -> this.consumption(d.getMid()).compareTo(filterDto.getEndAmount()) <= 0
|
|
|
+ .filter(d -> this.consumption(d.getMid()).compareTo(endAmount) <= 0
|
|
|
).collect(Collectors.toSet()));
|
|
|
} else {
|
|
|
collect.addAll(dtos);
|
|
|
}
|
|
|
|
|
|
//标签
|
|
|
- if (filterDto.getTag() != null) {
|
|
|
- List<Long> tags = converter.convertToEntityAttribute(filterDto.getTag());
|
|
|
+ if (tag != null) {
|
|
|
+ List<Long> tags = converter.convertToEntityAttribute(tag);
|
|
|
tags.forEach(t -> {
|
|
|
if (t == 1) {//新商家
|
|
|
collect.addAll(dtos.stream()
|
|
|
@@ -416,13 +417,14 @@ public class MerchantSettingsService {
|
|
|
/*
|
|
|
推荐商家
|
|
|
*/
|
|
|
- public List<MerchantDTO> recommended(Double longitude, Double latitude, Integer sort, FilterDTO filterDto, Long userId) {
|
|
|
+ public List<MerchantDTO> recommended(Double longitude, Double latitude, Integer sort, String filter, String tag, String natureId, BigDecimal startAmount,
|
|
|
+ BigDecimal endAmount, Long userId) {
|
|
|
List<MerchantDTO> dtoList;
|
|
|
dtoList = this.listSort(longitude, latitude, sort);
|
|
|
- if (filterDto.getFilter() != null) {
|
|
|
- dtoList = this.listFilter(dtoList, filterDto.getFilter(), userId);
|
|
|
+ if (filter != null) {
|
|
|
+ dtoList = this.listFilter(dtoList, filter, userId);
|
|
|
}
|
|
|
- return this.otherFilter(dtoList, filterDto);
|
|
|
+ return this.otherFilter(dtoList, tag, natureId, startAmount, endAmount);
|
|
|
}
|
|
|
|
|
|
|