
package com.tmerclub.cloud.user.feign;

import com.tmerclub.cloud.api.user.feign.UserConsigneeFeignClient;
import com.tmerclub.cloud.common.handler.ExcelMergeHandler;
import com.tmerclub.cloud.common.order.vo.UserConsigneeVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.common.util.BeanUtil;
import com.tmerclub.cloud.user.model.UserConsignee;
import com.tmerclub.cloud.user.service.UserConsigneeService;
import org.apache.dubbo.config.annotation.DubboService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 用户地址feign连接
 *
 * @author tmerclub
 * @date 2020/12/07
 */
@DubboService
public class UserConsigneeFeignController implements UserConsigneeFeignClient {
    private static final Logger log = LoggerFactory.getLogger(ExcelMergeHandler.class);

    @Autowired
    private UserConsigneeService userConsigneeService;


    @Override
    public ServerResponseEntity<UserConsigneeVO> getUseConsignee() {
        log.info("UserConsigneeFeignController.getUseConsignee -- 用户id: {}", AuthUserContext.get().getUserId());
        UserConsignee userConsignee = userConsigneeService.getByUserId(AuthUserContext.get().getUserId());
        return ServerResponseEntity.success(BeanUtil.map(userConsignee, UserConsigneeVO.class));
    }
}
