package cn.iocoder.yudao.module.member.api.activitypay;

import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.member.api.activitypay.dto.ActivityPayDTO;
import cn.iocoder.yudao.module.member.api.activitypay.dto.ActivityPayRespDTO;
import cn.iocoder.yudao.module.member.controller.admin.activitypay.vo.ActivityPaySaveReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.activitypay.ActivityPayDO;
import cn.iocoder.yudao.module.member.service.activitypay.ActivityPayService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 用户收件地址 API 接口
 *
 * @author 芋道源码
 */
@Service
public class ActivityApiImpl implements ActivityApi {


    @Resource
    private ActivityPayService activityPayService;

    @Override
    public void createActivityPay(ActivityPayDTO createReqVO) {
        ActivityPaySaveReqVO bean = BeanUtil.toBean(createReqVO, ActivityPaySaveReqVO.class);
        bean.setMenu(createReqVO.getMenu());
        activityPayService.addActivityPay(bean);
    }

    @Override
    public ActivityPayRespDTO getActivityPay(Long id) {
        ActivityPayDO activityPay = activityPayService.getActivityPay(id);
        return BeanUtils.toBean(activityPay, ActivityPayRespDTO.class);
    }
}
