|
@@ -13,13 +13,7 @@ import com.qs.mp.admin.domain.param.TicketBoxCreateParam;
|
|
import com.qs.mp.admin.domain.param.TicketBoxUpdateParam;
|
|
import com.qs.mp.admin.domain.param.TicketBoxUpdateParam;
|
|
import com.qs.mp.admin.mapper.TicketBoxMapper;
|
|
import com.qs.mp.admin.mapper.TicketBoxMapper;
|
|
import com.qs.mp.admin.service.*;
|
|
import com.qs.mp.admin.service.*;
|
|
-import com.qs.mp.common.enums.MqTopicType;
|
|
|
|
-import com.qs.mp.common.enums.TicketBoxStatusEnum;
|
|
|
|
-import com.qs.mp.common.enums.TicketPkgSaleStatusEnum;
|
|
|
|
-import com.qs.mp.common.enums.TicketPkgStatusEnum;
|
|
|
|
-import com.qs.mp.common.enums.TicketPrizeTypeEnum;
|
|
|
|
-import com.qs.mp.common.enums.TicketStatusEnum;
|
|
|
|
-import com.qs.mp.common.enums.TicketTypeEnum;
|
|
|
|
|
|
+import com.qs.mp.common.enums.*;
|
|
import com.qs.mp.common.exception.ServiceException;
|
|
import com.qs.mp.common.exception.ServiceException;
|
|
import com.qs.mp.common.pulsar.PulsarClientService;
|
|
import com.qs.mp.common.pulsar.PulsarClientService;
|
|
import com.qs.mp.common.utils.LogUtil;
|
|
import com.qs.mp.common.utils.LogUtil;
|
|
@@ -93,6 +87,9 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
|
|
@Autowired
|
|
@Autowired
|
|
private ICouponPkgService couponPkgService;
|
|
private ICouponPkgService couponPkgService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ITicketBoxChannelService ticketBoxChannelService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public boolean updateTicketBox(TicketBoxUpdateParam param) {
|
|
public boolean updateTicketBox(TicketBoxUpdateParam param) {
|
|
@@ -107,8 +104,28 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
|
|
ticketBox.setSalePrice(param.getSalePrice());
|
|
ticketBox.setSalePrice(param.getSalePrice());
|
|
ticketBox.setPkgSalePrice(param.getPkgSalePrice());
|
|
ticketBox.setPkgSalePrice(param.getPkgSalePrice());
|
|
ticketBox.setSaleCommRate(param.getSaleCommRate());
|
|
ticketBox.setSaleCommRate(param.getSaleCommRate());
|
|
|
|
+ ticketBox.setSaleChannelType(param.getSaleChannelType());
|
|
this.updateById(ticketBox);
|
|
this.updateById(ticketBox);
|
|
|
|
|
|
|
|
+ // 清除指定渠道内容
|
|
|
|
+ ticketBoxChannelService.remove(new LambdaUpdateWrapper<TicketBoxChannel>().eq(TicketBoxChannel::getBoxId, ticketBox.getBoxId()));
|
|
|
|
+
|
|
|
|
+ // 指定渠道
|
|
|
|
+ if (TicketBoxSaleChannelTypeEnum.PART.getValue().equals(param.getSaleChannelType())) {
|
|
|
|
+ List<Long> channelIdList = param.getChannelIdList();
|
|
|
|
+ if (CollectionUtils.isEmpty(channelIdList)) {
|
|
|
|
+ throw new ServiceException("渠道列表为空");
|
|
|
|
+ }
|
|
|
|
+ List<TicketBoxChannel> ticketBoxChannelList = new ArrayList<>();
|
|
|
|
+ for (Long channelId : channelIdList) {
|
|
|
|
+ TicketBoxChannel ticketBoxChannel = new TicketBoxChannel();
|
|
|
|
+ ticketBoxChannel.setBoxId(ticketBox.getBoxId());
|
|
|
|
+ ticketBoxChannel.setChannelId(channelId);
|
|
|
|
+ ticketBoxChannelList.add(ticketBoxChannel);
|
|
|
|
+ }
|
|
|
|
+ ticketBoxChannelService.saveBatch(ticketBoxChannelList);
|
|
|
|
+ }
|
|
|
|
+
|
|
// 校验更新奖品信息
|
|
// 校验更新奖品信息
|
|
if (CollectionUtils.isEmpty(param.getAwardsList())) {
|
|
if (CollectionUtils.isEmpty(param.getAwardsList())) {
|
|
throw new ServiceException("奖品列表不能为空");
|
|
throw new ServiceException("奖品列表不能为空");
|
|
@@ -196,7 +213,7 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- @Transactional
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public String createTicketBox(TicketBoxCreateParam param) {
|
|
public String createTicketBox(TicketBoxCreateParam param) {
|
|
// 创建盲票组
|
|
// 创建盲票组
|
|
TicketBox ticketBox = mapperFacade.map(param, TicketBox.class);
|
|
TicketBox ticketBox = mapperFacade.map(param, TicketBox.class);
|
|
@@ -204,8 +221,25 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
|
|
ticketBox.setStatus(TicketBoxStatusEnum.WAIT);
|
|
ticketBox.setStatus(TicketBoxStatusEnum.WAIT);
|
|
ticketBox.setBoxNo(ticketBoxSerialService.generateSerial(ticketBox.getType()));
|
|
ticketBox.setBoxNo(ticketBoxSerialService.generateSerial(ticketBox.getType()));
|
|
ticketBox.setBoxId(bizIdGenerator.newId());
|
|
ticketBox.setBoxId(bizIdGenerator.newId());
|
|
|
|
+ ticketBox.setSaleChannelType(param.getSaleChannelType());
|
|
save(ticketBox);
|
|
save(ticketBox);
|
|
|
|
|
|
|
|
+ // 指定渠道
|
|
|
|
+ if (TicketBoxSaleChannelTypeEnum.PART.getValue().equals(param.getSaleChannelType())) {
|
|
|
|
+ List<Long> channelIdList = param.getChannelIdList();
|
|
|
|
+ if (CollectionUtils.isEmpty(channelIdList)) {
|
|
|
|
+ throw new ServiceException("渠道列表为空");
|
|
|
|
+ }
|
|
|
|
+ List<TicketBoxChannel> ticketBoxChannelList = new ArrayList<>();
|
|
|
|
+ for (Long channelId : channelIdList) {
|
|
|
|
+ TicketBoxChannel ticketBoxChannel = new TicketBoxChannel();
|
|
|
|
+ ticketBoxChannel.setBoxId(ticketBox.getBoxId());
|
|
|
|
+ ticketBoxChannel.setChannelId(channelId);
|
|
|
|
+ ticketBoxChannelList.add(ticketBoxChannel);
|
|
|
|
+ }
|
|
|
|
+ ticketBoxChannelService.saveBatch(ticketBoxChannelList);
|
|
|
|
+ }
|
|
|
|
+
|
|
// 创建奖级
|
|
// 创建奖级
|
|
List<TicketAwards> ticketAwardsList = new ArrayList<>();
|
|
List<TicketAwards> ticketAwardsList = new ArrayList<>();
|
|
List<TicketAwardsPrize> awardsPrizeList = new ArrayList<>();
|
|
List<TicketAwardsPrize> awardsPrizeList = new ArrayList<>();
|