Search in sources :

Example 11 with MdcBizException

use of com.paascloud.provider.exceptions.MdcBizException in project paascloud-master by paascloud.

the class OpcRpcServiceImpl method getLocationById.

@Override
public String getLocationById(String addressId) {
    try {
        Wrapper<GaodeLocation> wrapper = opcGaodeFeignApi.getLocationByIpAddr(addressId);
        if (wrapper == null) {
            throw new MdcBizException(ErrorCodeEnum.GL99990002);
        }
        if (wrapper.error()) {
            throw new MdcBizException(ErrorCodeEnum.MDC10021002);
        }
        GaodeLocation result = wrapper.getResult();
        assert result != null;
        return result.getProvince().contains("市") ? result.getCity() : result.getProvince() + GlobalConstant.Symbol.SHORT_LINE + result.getCity();
    } catch (Exception e) {
        log.error("getLocationById={}", e.getMessage(), e);
    }
    return null;
}
Also used : MdcBizException(com.paascloud.provider.exceptions.MdcBizException) GaodeLocation(com.paascloud.provider.model.dto.gaode.GaodeLocation) MdcBizException(com.paascloud.provider.exceptions.MdcBizException)

Aggregations

MdcBizException (com.paascloud.provider.exceptions.MdcBizException)11 MdcDict (com.paascloud.provider.model.domain.MdcDict)3 MdcProductCategory (com.paascloud.provider.model.domain.MdcProductCategory)3 OmcCart (com.paascloud.provider.model.domain.OmcCart)3 ProductDto (com.paascloud.provider.model.dto.ProductDto)2 CartProductVo (com.paascloud.provider.model.vo.CartProductVo)2 ModelMapper (org.modelmapper.ModelMapper)2 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)1 MdcProduct (com.paascloud.provider.model.domain.MdcProduct)1 GaodeLocation (com.paascloud.provider.model.dto.gaode.GaodeLocation)1 CartVo (com.paascloud.provider.model.vo.CartVo)1 MdcCategoryVo (com.paascloud.provider.model.vo.MdcCategoryVo)1 MdcDictVo (com.paascloud.provider.model.vo.MdcDictVo)1 BigDecimal (java.math.BigDecimal)1 Transactional (org.springframework.transaction.annotation.Transactional)1