|
|
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.sqx.common.utils.PageUtils;
|
|
|
import com.sqx.common.utils.Result;
|
|
|
+import com.sqx.modules.activity.service.ActivityShopService;
|
|
|
+import com.sqx.modules.activity.vo.ShopActivityVO;
|
|
|
import com.sqx.modules.common.entity.CommonInfo;
|
|
|
import com.sqx.modules.common.service.CommonInfoService;
|
|
|
import com.sqx.modules.coupon.dao.TbCouponDao;
|
|
|
@@ -33,7 +35,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
-import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
@@ -63,6 +64,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsDao, Goods> implements Go
|
|
|
private GoodsShopRelevancyDao goodsShopRelevancyDao;
|
|
|
@Autowired
|
|
|
private TbCouponDao tbCouponDao;
|
|
|
+ @Autowired
|
|
|
+ private ActivityShopService activityShopService;
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
@@ -546,20 +549,29 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsDao, Goods> implements Go
|
|
|
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++) {
|
|
|
- Long shopId = goodsShopIPage.getRecords().get(a).getShopId();
|
|
|
- goodsShopIPage.getRecords().get(a).setCouponList(couponMap.get(shopId));
|
|
|
+ GoodsShop goodsShop = goodsShopIPage.getRecords().get(a);
|
|
|
+ Long shopId = goodsShop.getShopId();
|
|
|
+ goodsShop.setCouponList(couponMap.get(shopId));
|
|
|
+
|
|
|
+ // 设置活动信息
|
|
|
+ goodsShop.setShopActivityList(shopActivityMap.get(shopId));
|
|
|
+
|
|
|
if (StringUtils.isNotEmpty(impotr)) {
|
|
|
- goodsShopIPage.getRecords().get(a).setGoodsList(goodsMap.get(shopId));
|
|
|
+ goodsShop.setGoodsList(goodsMap.get(shopId));
|
|
|
} else {
|
|
|
- goodsShopIPage.getRecords().get(a).setGoodsList(new ArrayList<>());
|
|
|
+ goodsShop.setGoodsList(new ArrayList<>());
|
|
|
}
|
|
|
- Double distance = goodsShopIPage.getRecords().get(a).getDistance();
|
|
|
+ Double distance = goodsShop.getDistance();
|
|
|
double errandTime = distance / Double.parseDouble(one1.getValue());
|
|
|
if (errandTime < Double.parseDouble(one2.getValue())) {
|
|
|
errandTime = Double.parseDouble(one2.getValue());
|
|
|
}
|
|
|
- goodsShopIPage.getRecords().get(a).setErrandTime(errandTime);
|
|
|
+ goodsShop.setErrandTime(errandTime);
|
|
|
}
|
|
|
PageUtils pageUtils = new PageUtils(goodsShopIPage);
|
|
|
return Result.success().put("data", pageUtils);
|