|
|
@@ -873,4 +873,45 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsDao, Goods> implements Go
|
|
|
return Result.success().put("data", pageUtils);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result getCouponSelectShop(Integer page, Integer limit, String usedShopId, String shopName) {
|
|
|
+ Page<GoodsShop> pages = new Page<>(page, limit);
|
|
|
+ IPage<GoodsShop> goodsShopIPage = goodsShopDao.getCouponSelectShop(pages, usedShopId,shopName);
|
|
|
+ List<GoodsShop> records = goodsShopIPage.getRecords();
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(records)) {
|
|
|
+ CommonInfo one1 = commonInfoService.findOne(292);
|
|
|
+ CommonInfo one2 = commonInfoService.findOne(293);
|
|
|
+ List<Long> shopIdList = records.stream().map(GoodsShop::getShopId).collect(Collectors.toList());
|
|
|
+// List<Goods> goodsList = goodsDao.selectGoodsBySalesAndGoodsNameAndShopIds(shopIdList, null);
|
|
|
+// Map<Long, List<Goods>> goodsMap = goodsList.stream().collect(Collectors.groupingBy(Goods::getShopId));
|
|
|
+
|
|
|
+ List<TbCoupon> tbCoupons = tbCouponDao.selectCouponListByShopIdList(shopIdList, null);
|
|
|
+ Map<Long, List<TbCoupon>> couponMap = tbCoupons.stream().collect(Collectors.groupingBy(TbCoupon::getShopId));
|
|
|
+
|
|
|
+ // 查询店铺活动
|
|
|
+ List<ShopActivityVO> shopActivityVOS = activityShopService.getActivityByShopIds(shopIdList);
|
|
|
+ Map<Long, List<ShopActivityVO>> shopActivityMap = shopActivityVOS.stream().collect(Collectors.groupingBy(ShopActivityVO::getShopId));
|
|
|
+
|
|
|
+ for (int a = 0; a < goodsShopIPage.getRecords().size(); a++) {
|
|
|
+ GoodsShop goodsShop = goodsShopIPage.getRecords().get(a);
|
|
|
+ Long shopId = goodsShop.getShopId();
|
|
|
+ goodsShop.setCouponList(couponMap.get(shopId));
|
|
|
+
|
|
|
+ // 设置活动信息
|
|
|
+ goodsShop.setShopActivityList(shopActivityMap.get(shopId));
|
|
|
+
|
|
|
+ Double distance = goodsShop.getDistance();
|
|
|
+ double errandTime = distance / Double.parseDouble(one1.getValue());
|
|
|
+ if (errandTime < Double.parseDouble(one2.getValue())) {
|
|
|
+ errandTime = Double.parseDouble(one2.getValue());
|
|
|
+ }
|
|
|
+ goodsShop.setErrandTime(errandTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ PageUtils pageUtils = new PageUtils(goodsShopIPage);
|
|
|
+ return Result.success().put("data", pageUtils);
|
|
|
+ }
|
|
|
+
|
|
|
}
|