RemoteGpsBsService.java 1.04 KB
package cn.com.glsx.stdinterface.modules.remote;

import cn.com.glsx.devicemonitor.api.feign.GpsBsFeignService;
import com.glsx.plat.common.utils.StringUtils;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * GpsBsService 服务的处理层
 *
 * @author yll
 */
@Slf4j
@Service
public class RemoteGpsBsService {

    @Autowired
    private GpsBsFeignService gpsBsFeignService;

    /**
     * 通过经纬度获取地址
     *
     * @param lng 经度
     * @param lat 纬度
     * @return 地址
     */
    public String getAddressByLngAndLat(String lng, String lat) {
        if (StringUtils.isEmpty(lng) || StringUtils.isEmpty(lat)) {
            return "";
        }
        R<String> addressR = gpsBsFeignService.getAddressByLngAndLat(lng, lat);
        String address = addressR.getData(String.class);
        if (StringUtils.isNullOrEmpty(address)) {
            address = "";
        }
        return address;
    }
}