package com.mosty.yszx.remote;

import com.alibaba.fastjson.JSON;
import com.mosty.base.model.dto.sjzx.TbSjSpbfDTO;
import com.mosty.base.feign.service.MostySjzxFeignService;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 事件中心远程调用
 */
@Slf4j
@Service
@AllArgsConstructor
public class TbSjzxAdaptRemoteService {

    private final MostySjzxFeignService mostySjzxFeignService;

    // 保存视频播放日志
    public void tbSjSpbfAdd(TbSjSpbfDTO dto) {
        ResponseResult<Integer> responseResult = mostySjzxFeignService.tbSjSpbfAdd(dto);
        if (responseResult == null || !responseResult.isSuccess()) {
            log.error("保存视频播放日志失败 responseResult = {}", JSON.toJSONString(responseResult));
            throw new BusinessException("保存视频播放日志失败");
        }
    }
}
