|
|
@@ -391,9 +391,8 @@ public class LiveServiceImpl implements ILiveService
|
|
|
|
|
|
}
|
|
|
int result = baseMapper.updateLive(live);
|
|
|
- if (live.getStatus() == 2) {
|
|
|
- liveAutoTaskService.recalcLiveAutoTask(live);
|
|
|
- }
|
|
|
+ liveAutoTaskService.recalcLiveAutoTask(live);
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -634,6 +633,7 @@ public class LiveServiceImpl implements ILiveService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public R startLive(Live live) {
|
|
|
Live exist = baseMapper.selectLiveByLiveId(live.getLiveId());
|
|
|
if (exist == null) {
|
|
|
@@ -659,7 +659,13 @@ public class LiveServiceImpl implements ILiveService
|
|
|
exist.setFinishTime( null);
|
|
|
exist.setStartTime(LocalDateTime.now());
|
|
|
baseMapper.updateLive(exist);
|
|
|
-
|
|
|
+ List<LiveAutoTask> liveAutoTasks = liveAutoTaskService.selectNoActivedByLiveId(exist.getLiveId(), new Date());
|
|
|
+ liveAutoTasks.forEach(liveAutoTask -> {
|
|
|
+ liveAutoTask.setCreateTime(null);
|
|
|
+ liveAutoTask.setUpdateTime(null);
|
|
|
+ redisCache.redisTemplate.opsForZSet().add("live:auto_task:" + live.getLiveId(), JSON.toJSONString(liveAutoTask),liveAutoTask.getAbsValue().getTime());
|
|
|
+ redisCache.redisTemplate.expire("live:auto_task:"+live.getLiveId(), 1, TimeUnit.DAYS);
|
|
|
+ });
|
|
|
|
|
|
return R.ok();
|
|
|
}
|
|
|
@@ -735,8 +741,8 @@ public class LiveServiceImpl implements ILiveService
|
|
|
List<LiveAutoTask> lotteryTaskList = liveAutoTasksList.stream().filter(liveAutoTask -> liveAutoTask.getTaskType() == 4L).collect(Collectors.toList());
|
|
|
List<LiveAutoTask> addList = new ArrayList<>();
|
|
|
if (!barrageTask.isEmpty()) {
|
|
|
- LiveAutoTask liveAutoTaskEntity = new LiveAutoTask();
|
|
|
for (LiveAutoTask liveAutoTask : barrageTask) {
|
|
|
+ LiveAutoTask liveAutoTaskEntity = new LiveAutoTask();
|
|
|
BeanUtils.copyBeanProp(liveAutoTaskEntity, liveAutoTask);
|
|
|
liveAutoTaskEntity.setId(null);
|
|
|
liveAutoTaskEntity.setLiveId(newLiveId);
|
|
|
@@ -757,8 +763,8 @@ public class LiveServiceImpl implements ILiveService
|
|
|
//直播间红包配置
|
|
|
List<LiveRedConf> liveRedConfs = liveRedConfService.selectByLiveId(existLiveId);
|
|
|
if (!liveRedConfs.isEmpty()) {
|
|
|
- LiveRedConf liveRedConfEntity = new LiveRedConf();
|
|
|
for (LiveRedConf liveRedConf : liveRedConfs) {
|
|
|
+ LiveRedConf liveRedConfEntity = new LiveRedConf();
|
|
|
BeanUtils.copyBeanProp(liveRedConfEntity, liveRedConf);
|
|
|
liveRedConfEntity.setRedId(null);
|
|
|
liveRedConfEntity.setLiveId(newLiveId);
|
|
|
@@ -782,10 +788,11 @@ public class LiveServiceImpl implements ILiveService
|
|
|
// 直播间礼物配置
|
|
|
List<LiveLotteryConf> liveLotteryConfs = liveLotteryConfService.selectByLiveId(existLiveId);
|
|
|
if (!liveLotteryConfs.isEmpty()) {
|
|
|
- LiveLotteryConf liveLotteryConfEntity = new LiveLotteryConf();
|
|
|
+
|
|
|
List<Long> lotteryIds = liveLotteryConfs.stream().map(LiveLotteryConf::getLotteryId).collect(Collectors.toList());
|
|
|
List<LiveLotteryProductConf> products = liveLotteryProductConfMapper.selectEntityByIds(lotteryIds);
|
|
|
for (LiveLotteryConf liveLotteryConf : liveLotteryConfs) {
|
|
|
+ LiveLotteryConf liveLotteryConfEntity = new LiveLotteryConf();
|
|
|
BeanUtils.copyBeanProp(liveLotteryConfEntity, liveLotteryConf);
|
|
|
liveLotteryConfEntity.setLotteryId(null);
|
|
|
liveLotteryConfEntity.setLiveId(newLiveId);
|
|
|
@@ -818,8 +825,8 @@ public class LiveServiceImpl implements ILiveService
|
|
|
if (!goodsList.isEmpty()) {
|
|
|
List<String> goodsProductIds = goodsList.stream().map(item -> String.valueOf(item.getProductId())).collect(Collectors.toList());
|
|
|
Map<Long, FsStoreProduct> collect = fsStoreProductMapper.selectFsStoreProductByProductIds(goodsProductIds).stream().collect(Collectors.toMap(FsStoreProduct::getProductId, item -> item));
|
|
|
- LiveGoods liveGoodsEntity = new LiveGoods();
|
|
|
for (LiveGoodsVo liveGoods : goodsList) {
|
|
|
+ LiveGoods liveGoodsEntity = new LiveGoods();
|
|
|
BeanUtils.copyBeanProp(liveGoodsEntity, liveGoods);
|
|
|
liveGoodsEntity.setGoodsId(null);
|
|
|
liveGoodsEntity.setLiveId(newLiveId);
|