package com.mosty.wzzx.remote;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mosty.base.feign.service.MostyQwzxFeignService;
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;

/**
 * Created by
 *
 * @ClassName TbXfbbAdaptRemoteService
 */
@Slf4j
@Service
@AllArgsConstructor
public class TbXfbbAdaptRemoteService {

    private final MostyQwzxFeignService mostyQwzxFeignService;

    /**
     * 查询预警信息
     * @param id 内容
     * @return 部门信息
     */
    public JSONObject getBbxx(String id) {
        ResponseResult responseResult = mostyQwzxFeignService.getBbInfo(id);
        if (responseResult == null || !responseResult.isSuccess()) {
            log.error("查询报备信息异常Result = {}", JSON.toJSONString(responseResult));
            return null;
        }
        return JSONObject.parseObject(JSONObject.toJSONString(responseResult.getData()));
    }
}
