|
|
@@ -117,16 +117,23 @@ public class LifeDiscountCouponUserServiceImpl extends ServiceImpl<LifeDiscountC
|
|
|
//是否领取优惠券收藏店铺
|
|
|
Integer attentionCanReceived = lifeDiscountCoupon.getAttentionCanReceived();
|
|
|
if(attentionCanReceived != null && attentionCanReceived == 1){
|
|
|
- LifeCollect lifeCollect = new LifeCollect();
|
|
|
- lifeCollect.setStoreId(lifeDiscountCoupon.getStoreId());
|
|
|
- lifeCollect.setUserId(lifeDiscountCouponUserDto.getUserId().toString());
|
|
|
- lifeCollectMapper.insert(lifeCollect);
|
|
|
-
|
|
|
- //同步店铺收藏数量
|
|
|
- if (!StringUtils.isEmpty(lifeCollect.getStoreId())) {
|
|
|
- LambdaQueryWrapper<LifeCollect> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(LifeCollect::getStoreId, lifeCollect.getStoreId());
|
|
|
- storeInfoMapper.update(null, new LambdaUpdateWrapper<StoreInfo>().eq(StoreInfo::getId, lifeCollect.getStoreId()).set(StoreInfo::getCollectNum, lifeCollectMapper.selectCount(queryWrapper)));
|
|
|
+
|
|
|
+ LambdaQueryWrapper<LifeCollect> lifeCollectLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lifeCollectLambdaQueryWrapper.eq(LifeCollect::getStoreId, lifeDiscountCoupon.getStoreId());
|
|
|
+ lifeCollectLambdaQueryWrapper.eq(LifeCollect::getUserId, lifeDiscountCouponUserDto.getUserId());
|
|
|
+ lifeCollectLambdaQueryWrapper.eq(LifeCollect::getDeleteFlag, 0);
|
|
|
+ int lifeCollectCount = lifeCollectMapper.selectCount(lifeCollectLambdaQueryWrapper);
|
|
|
+ if(lifeCollectCount == 0){
|
|
|
+ LifeCollect lifeCollect = new LifeCollect();
|
|
|
+ lifeCollect.setStoreId(lifeDiscountCoupon.getStoreId());
|
|
|
+ lifeCollect.setUserId(lifeDiscountCouponUserDto.getUserId().toString());
|
|
|
+ lifeCollectMapper.insert(lifeCollect);
|
|
|
+ //同步店铺收藏数量
|
|
|
+ if (!StringUtils.isEmpty(lifeCollect.getStoreId())) {
|
|
|
+ LambdaQueryWrapper<LifeCollect> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(LifeCollect::getStoreId, lifeCollect.getStoreId());
|
|
|
+ storeInfoMapper.update(null, new LambdaUpdateWrapper<StoreInfo>().eq(StoreInfo::getId, lifeCollect.getStoreId()).set(StoreInfo::getCollectNum, lifeCollectMapper.selectCount(queryWrapper)));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|