package com.mosty.qwzx.remote;

import com.alibaba.fastjson.JSON;
import com.mosty.base.feign.service.MostyLzotherFeignService;
import com.mosty.base.model.entity.lzother.BphJlxx;
import com.mosty.base.model.entity.lzother.VJcxx;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.base.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@AllArgsConstructor
public class TbLzotherAdaptRemoteService {

    private final MostyLzotherFeignService mostyLzotherFeignService;

    // 根据身份证查询是否有接警数据
    public BphJlxx getjlxx(String sfzh) {
        ResponseResult<BphJlxx> responseResult = this.mostyLzotherFeignService.getjlxx(sfzh);
        if (responseResult == null || !responseResult.isSuccess()) {
            log.error("查询警情类别类型细类中文异常Result = {}", JSON.toJSONString(responseResult));
            throw new BusinessException("查询警情类别类型细类中文异常");
        }
        return responseResult.getData();
    }

    // 根据信息查询是否处警
    public BphJlxx getjlxxCz(BphJlxx bphJlxx) {
        ResponseResult<BphJlxx> responseResult = this.mostyLzotherFeignService.getjlxxCz(bphJlxx);
        if (responseResult == null || !responseResult.isSuccess()) {
            log.error("查询警情类别类型细类中文异常Result = {}", JSON.toJSONString(responseResult));
            throw new BusinessException("查询警情类别类型细类中文异常");
        }
        return responseResult.getData();
    }
}
