|
@@ -17,12 +17,14 @@ import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.im.ImFeignService;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class LiveGoodsMapperServiceImpl extends BaseServiceImpl<Integer, LiveGoodsMapper> implements LiveGoodsMapperService {
|
|
@@ -113,6 +115,20 @@ public class LiveGoodsMapperServiceImpl extends BaseServiceImpl<Integer, LiveGoo
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
+ public void downGoods(String liveId){
|
|
|
+ ImLiveBroadcastRoom imLiveBroadcastRoom = Optional
|
|
|
+ .of(imLiveBroadcastRoomService.getBaseMapper().selectOne(new QueryWrapper<ImLiveBroadcastRoom>().eq("room_uid_",liveId))).
|
|
|
+ orElseThrow(() -> new RuntimeException("直播间不存在"));
|
|
|
+ List<LiveGoodsMapperDto> liveGoodsList = liveGoodsMapperDao.getLiveGoodsList(liveId, null, true);
|
|
|
+ if (CollectionUtils.isEmpty(liveGoodsList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (LiveGoodsMapperDto liveGoodsMapperDto : liveGoodsList) {
|
|
|
+ this.down(liveGoodsMapperDto.getId(), liveId,imLiveBroadcastRoom);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void downGoods(Integer liveGoodsId, String liveId){
|
|
|
ImLiveBroadcastRoom imLiveBroadcastRoom = Optional
|
|
|
.of(imLiveBroadcastRoomService.getBaseMapper().selectOne(new QueryWrapper<ImLiveBroadcastRoom>().eq("room_uid_",liveId))).
|
|
@@ -122,7 +138,10 @@ public class LiveGoodsMapperServiceImpl extends BaseServiceImpl<Integer, LiveGoo
|
|
|
if(!liveGoodsMapper.getStatus()){
|
|
|
throw new BizException("该商品已下架");
|
|
|
}
|
|
|
- //下架直播间商品
|
|
|
+ this.down(liveGoodsId, liveId,imLiveBroadcastRoom);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void down(Integer liveGoodsId, String liveId,ImLiveBroadcastRoom imLiveBroadcastRoom){
|
|
|
int i = liveGoodsMapperDao.updateStatus(liveId, liveGoodsId, false);
|
|
|
if (i == 0) {
|
|
|
return;
|