
package com.tmerclub.cloud.supplier.feign;

import com.tmerclub.cloud.api.supplier.feign.SupplierRefundAddrFeignClient;
import com.tmerclub.cloud.api.supplier.vo.SupplierApiRefundAddrVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.supplier.service.SupplierRefundAddrService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author tmerclub
 * @date 2020/11/23
 */
@DubboService
public class SupplierRefundAddrFeignController implements SupplierRefundAddrFeignClient {

    @Autowired
    private SupplierRefundAddrService supplierRefundAddrService;

    @Override
    public ServerResponseEntity<SupplierApiRefundAddrVO> getSupplierRefundAddrByRefundAddrId(Long refundAddrId) {
        Long supplierId = AuthUserContext.get().getTenantId();
        SupplierApiRefundAddrVO supplierRefundAddr = supplierRefundAddrService.getBySupplierRefundAddrId(refundAddrId, supplierId);
        return ServerResponseEntity.success(supplierRefundAddr);
    }

    @Override
    public ServerResponseEntity<List<SupplierApiRefundAddrVO>> getBySupplierId(Long supplierId) {
        List<SupplierApiRefundAddrVO> list = supplierRefundAddrService.listBySupplierId(supplierId);
        return ServerResponseEntity.success(list);
    }
}
