package com.mosty.sjzx.remote;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.yjzl.TbYjxxDTO;
import com.mosty.base.feign.service.MostyYjzlFeignService;
import com.mosty.base.model.query.yjzl.TbYjxxQuery;
import com.mosty.common.base.domain.ResponseResult;
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 TbYjxxAdaptRemoteService {

    private final MostyYjzlFeignService mostyYjzlFeignService;

    // 查询预警信息
    public Object getPageList(TbYjxxQuery dto) {
        ResponseResult<IPage<TbYjxxDTO>> responseResult = mostyYjzlFeignService.getPageList(dto);
        if (responseResult == null || !responseResult.isSuccess()) {
            log.error("查询预警信息异常Result = {}", JSON.toJSONString(responseResult));
            return null;
        }
        return responseResult.getData();
    }
}
