|
|
@@ -23,6 +23,7 @@ import com.izouma.dingdong.repo.backstage.*;
|
|
|
import com.izouma.dingdong.repo.merchant.*;
|
|
|
import com.izouma.dingdong.repo.user.UserCouponRepo;
|
|
|
import com.izouma.dingdong.service.backstage.CategoryService;
|
|
|
+import com.izouma.dingdong.service.backstage.PromoteService;
|
|
|
import com.izouma.dingdong.utils.MapUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -59,6 +60,7 @@ public class MerchantSettingsService {
|
|
|
private UserCouponRepo userCouponRepo;
|
|
|
private PriorityRepo priorityRepo;
|
|
|
private SalesRepo salesRepo;
|
|
|
+ private PromoteService promoteService;
|
|
|
|
|
|
/*
|
|
|
时间标签类商家列表
|
|
|
@@ -161,12 +163,13 @@ public class MerchantSettingsService {
|
|
|
|
|
|
//优惠专区
|
|
|
//主推荐位 2个
|
|
|
- List<Promote> promote1 = promoteRepo.findAllByAction(1)
|
|
|
- .stream().filter(p ->
|
|
|
- //距离小于3000米
|
|
|
- MapUtils.distance(p.getMerchant().getLongitude(), p.getMerchant()
|
|
|
- .getLatitude(), longitude, latitude) < 3000
|
|
|
- ).collect(Collectors.toList());
|
|
|
+ promoteService.all();
|
|
|
+ List<Promote> promote1 = promoteRepo.findAllByAction(1);
|
|
|
+ promote1.stream().filter(p ->
|
|
|
+ //距离小于3000米
|
|
|
+ MapUtils.distance(p.getMerchant().getLongitude(), p.getMerchant()
|
|
|
+ .getLatitude(), longitude, latitude) < 3000
|
|
|
+ ).collect(Collectors.toList());
|
|
|
if (promote1.size() > 2) {
|
|
|
promote1 = promote1.subList(0, 2);
|
|
|
}
|
|
|
@@ -482,10 +485,10 @@ public class MerchantSettingsService {
|
|
|
);
|
|
|
//商品名称匹配出商家
|
|
|
goods.forEach(g ->
|
|
|
- merchantRepo.findById(g.getMerchantId()).ifPresent(m -> {
|
|
|
- if (ApplyStatus.PASS.equals(m.getStatus()))
|
|
|
- merchants.add(m);
|
|
|
- })
|
|
|
+ merchantRepo.findById(g.getMerchantId()).ifPresent(m -> {
|
|
|
+ if (ApplyStatus.PASS.equals(m.getStatus()))
|
|
|
+ merchants.add(m);
|
|
|
+ })
|
|
|
);
|
|
|
}
|
|
|
|