package com.mosty.wzzx.remote;

import com.alibaba.fastjson.JSON;
import com.mosty.base.feign.service.MostyYjzlFeignService;
import com.mosty.base.model.dto.yjzl.TbZlxxInsertDto;
import com.mosty.base.model.entity.wzzx.TbWzSbsswz;
import com.mosty.base.model.vo.wzzx.TbWzSblswzVo;
import com.mosty.base.model.vo.yjzl.TbFzJlVo;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author dw
 * @since 2022/12/9
 * 外部调用预警指令要素接口
 **/
@Service
@Slf4j
public class TbYjzlAdaptRemoteService {

    @Resource
    private MostyYjzlFeignService mostyYjzlFeignService;

    // 添加指令信息
    public void addZl(TbZlxxInsertDto dto) {
        ResponseResult<Void> responseResult = this.mostyYjzlFeignService.addZl(dto);
        if (responseResult == null || !responseResult.isSuccess()) {
            log.error("添加指令信息失败 responseResult = {}", JSON.toJSONString(responseResult));
            throw new BusinessException("添加指令信息失败");
        }
    }

    // 修改预警信息是否发送指令
    public void updateYjxxSffszl(String id) {
        ResponseResult<Void> responseResult = this.mostyYjzlFeignService.updateYjxxSffszl(id);
        if (responseResult == null || !responseResult.isSuccess()) {
            log.error("修改预警信息是否发送指令失败 responseResult = {}", JSON.toJSONString(responseResult));
            throw new BusinessException("修改预警信息是否发送指令失败");
        }
    }



}
