短信发放 券发放
This commit is contained in:
parent
a970d129e0
commit
9a196e4d4a
|
|
@ -111,7 +111,6 @@ public class AShopUserServiceImpl implements AShopUserService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ShopUser> getPushEventUserList(SmsPushEventUser smsPushEventUser) {
|
public List<ShopUser> getPushEventUserList(SmsPushEventUser smsPushEventUser) {
|
||||||
List<Long> shopUserIds = new ArrayList<>();
|
|
||||||
Long mainShopId = shopInfoService.getMainIdByShopId(smsPushEventUser.getShopId());
|
Long mainShopId = shopInfoService.getMainIdByShopId(smsPushEventUser.getShopId());
|
||||||
smsPushEventUser.checkIsAll();
|
smsPushEventUser.checkIsAll();
|
||||||
// 调用Mapper层查询
|
// 调用Mapper层查询
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
|
@ -133,25 +134,20 @@ public class SmsPushEventServiceImpl extends ServiceImpl<SmsPushEventMapper, Sms
|
||||||
// 推送消息 进行 消息发送
|
// 推送消息 进行 消息发送
|
||||||
rabbitPublisher.sendApplySmsMsg(pushEvent.getShopId() + "," + pushEvent.getId(), "sendMarkSms");
|
rabbitPublisher.sendApplySmsMsg(pushEvent.getShopId() + "," + pushEvent.getId(), "sendMarkSms");
|
||||||
//发放优惠券
|
//发放优惠券
|
||||||
CompletableFuture.runAsync(() -> {
|
grantCoupon(param);
|
||||||
try {
|
|
||||||
grantCoupon(param);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("异步发放优惠券失败", e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPushEventCoupon(String eventId) {
|
public void sendPushEventCoupon(String eventId) {
|
||||||
SmsPushEventDTO pushEvent = getObjAs(new QueryWrapper().eq(SmsPushEvent::getId, eventId), SmsPushEventDTO.class);
|
SmsPushEvent smsPushEvent = getOne(new QueryWrapper().eq(SmsPushEvent::getId, eventId));
|
||||||
AssertUtil.isNull(pushEvent, "券发放失败,推送事件不存在");
|
AssertUtil.isNull(smsPushEvent, "券发放失败,推送事件不存在");
|
||||||
|
SmsPushEventDTO pushEvent = BeanUtil.toBean(smsPushEvent, SmsPushEventDTO.class);
|
||||||
SmsPushEventUser eventUser = eventUserMapper.selectOneByQuery(
|
SmsPushEventUser eventUser = eventUserMapper.selectOneByQuery(
|
||||||
new QueryWrapper().eq(SmsPushEventUser::getEventId, eventId)
|
new QueryWrapper().eq(SmsPushEventUser::getEventId, eventId)
|
||||||
);
|
);
|
||||||
AssertUtil.isNull(eventUser, "券发放失败,推送事件用户群体不存在");
|
|
||||||
pushEvent.setSmsPushEventUser(eventUser);
|
pushEvent.setSmsPushEventUser(eventUser);
|
||||||
if (pushEvent.getSendType() == 1 && StrUtil.isNotBlank(pushEvent.getCoupon())) {
|
if (StrUtil.isNotBlank(pushEvent.getCoupon())) {
|
||||||
grantCoupon(pushEvent);
|
grantCoupon(pushEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +158,14 @@ public class SmsPushEventServiceImpl extends ServiceImpl<SmsPushEventMapper, Sms
|
||||||
//发放优惠券
|
//发放优惠券
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
List<ShopUser> userList = shopUserService.getPushEventUserList(param.getSmsPushEventUser());
|
SmsPushEventUser smsPushEventUser = param.getSmsPushEventUser();
|
||||||
|
List<ShopUser> userList = new ArrayList<>();
|
||||||
|
if (param.getUserType() == 1) {
|
||||||
|
smsPushEventUser = new SmsPushEventUser();
|
||||||
|
smsPushEventUser.setShopId(param.getShopId());
|
||||||
|
smsPushEventUser.setIsAll(1);
|
||||||
|
}
|
||||||
|
userList = shopUserService.getPushEventUserList(smsPushEventUser);
|
||||||
// 2. 将JSON字符串解析为JSONArray
|
// 2. 将JSON字符串解析为JSONArray
|
||||||
JSONArray couponArray = JSON.parseArray(param.getCoupon());
|
JSONArray couponArray = JSON.parseArray(param.getCoupon());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue