|
|
@@ -42,6 +42,8 @@ import shop.alien.store.util.GroupConstant;
|
|
|
import shop.alien.util.ali.AliOSSUtil;
|
|
|
import shop.alien.util.common.DistanceUtil;
|
|
|
import shop.alien.util.common.constant.CouponStatusEnum;
|
|
|
+import shop.alien.util.common.constant.CouponTypeEnum;
|
|
|
+import shop.alien.util.common.constant.OrderStatusEnum;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
@@ -928,19 +930,31 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
} else {
|
|
|
result.setCollection(1);
|
|
|
}
|
|
|
- // 获取店铺优惠券列表
|
|
|
+ // 获取店铺代金券列表
|
|
|
LambdaUpdateWrapper<LifeCoupon> quanWrapper = new LambdaUpdateWrapper<>();
|
|
|
quanWrapper.eq(LifeCoupon::getStoreId, storeId).eq(LifeCoupon::getStatus, CouponStatusEnum.ONGOING.getCode()).eq(LifeCoupon::getType, 1);
|
|
|
List<LifeCoupon> quanList = lifeCouponMapper.selectList(quanWrapper);
|
|
|
List<LifeCouponVo> quanVoList = new ArrayList<>();
|
|
|
List<String> collect = quanList.stream().map(LifeCoupon::getId).collect(Collectors.toList());
|
|
|
+ // 设置已售数量
|
|
|
+ // 定义需要的订单状态集合
|
|
|
+ Set<Integer> excludeStatuses = new HashSet<>(Arrays.asList(
|
|
|
+ OrderStatusEnum.WAIT_PAY.getStatus(),
|
|
|
+ OrderStatusEnum.WAIT_USE.getStatus(),
|
|
|
+ OrderStatusEnum.USED.getStatus()
|
|
|
+ ));
|
|
|
if (!collect.isEmpty()) {
|
|
|
- List<LifeUserOrderVo> quanCount = lifeUserOrderMapper.getQuanCount(new QueryWrapper<LifeUserOrderVo>().in("quan_id", collect).eq("delete_flag", 0).groupBy("quan_id"));
|
|
|
+ List<LifeUserOrderVo> quanCount = lifeUserOrderMapper.getQuanCount(new QueryWrapper<LifeUserOrderVo>()
|
|
|
+ .eq("luo.store_id",storeId)
|
|
|
+ .eq("luo.coupon_type", CouponTypeEnum.COUPON.getCode())
|
|
|
+ .eq("luo.delete_flag",0)
|
|
|
+ .in("ocm.status",excludeStatuses)
|
|
|
+ .groupBy("ocm.coupon_id"));
|
|
|
quanList.forEach(a -> {
|
|
|
LifeCouponVo lifeCouponVo = new LifeCouponVo();
|
|
|
BeanUtils.copyProperties(a, lifeCouponVo);
|
|
|
quanCount.forEach(item -> {
|
|
|
- if (a.getId().equals(item.getQuanId())) {
|
|
|
+ if (a.getId().equals(item.getCouponId().toString())) {
|
|
|
lifeCouponVo.setCount(item.getCount());
|
|
|
}
|
|
|
});
|