|
@@ -1,5 +1,6 @@
|
|
|
package shop.alien.store.service.impl;
|
|
package shop.alien.store.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -191,6 +192,19 @@ public class LifeDiscountCouponStoreFriendServiceImpl extends ServiceImpl<LifeDi
|
|
|
lifeDiscountCoupon.setSingleQty(lifeDiscountCoupon.getSingleQty() - couponDto.getSingleQty());
|
|
lifeDiscountCoupon.setSingleQty(lifeDiscountCoupon.getSingleQty() - couponDto.getSingleQty());
|
|
|
// 更新数据库中的优惠券库存信息
|
|
// 更新数据库中的优惠券库存信息
|
|
|
lifeDiscountCouponMapper.updateById(lifeDiscountCoupon);
|
|
lifeDiscountCouponMapper.updateById(lifeDiscountCoupon);
|
|
|
|
|
+ // 发送好友优惠券通知
|
|
|
|
|
+ LifeNotice lifeMessage = new LifeNotice();
|
|
|
|
|
+ String text = "您的好友"+userLoginInfo.getUserName()+"送了您"+couponDto.getSingleQty()+"张店铺优惠券,快去使用吧!";
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
|
+ jsonObject.put("message", text);
|
|
|
|
|
+ lifeMessage.setReceiverId("store_"+storeUser.getPhone());
|
|
|
|
|
+ lifeMessage.setTitle("赠券通知");
|
|
|
|
|
+ lifeMessage.setContext(jsonObject.toJSONString());
|
|
|
|
|
+ lifeMessage.setNoticeType(1);
|
|
|
|
|
+ lifeMessage.setIsRead(0);
|
|
|
|
|
+ lifeMessage.setDeleteFlag(0);
|
|
|
|
|
+ lifeMessage.setSenderId("system");
|
|
|
|
|
+ lifeNoticeMapper.insert(lifeMessage);
|
|
|
}
|
|
}
|
|
|
// 如果所有优惠券都成功处理,返回 true
|
|
// 如果所有优惠券都成功处理,返回 true
|
|
|
return true;
|
|
return true;
|