package cn.newfeifan.mall.module.distri.service.integralchangelog;

import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
import cn.newfeifan.mall.module.distri.controller.admin.integralchangelog.vo.IntegralChangeLogSaveReqVO;
import cn.newfeifan.mall.module.distri.dal.dataobject.integralchangelog.IntegralChangeLogDO;
import cn.newfeifan.mall.module.distri.dal.mysql.integralchangelog.IntegralChangeLogMapper;
import cn.newfeifan.mall.module.member.service.user.MemberUserService;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;

/**
 * 平台消费分变动记录 Service 实现类
 *
 * @author 非繁人
 */
@Service
@Validated
public class IntegralChangeLogServiceImpl implements IntegralChangeLogService {

    @Resource
    private IntegralChangeLogMapper integralChangeLogMapper;

    @Resource
    private MemberUserService memberUserService;

    @Override
    public Long createConsumptionChangeLog(IntegralChangeLogSaveReqVO createReqVO) {
        // 插入
        IntegralChangeLogDO consumptionChangeLog = BeanUtils.toBean(createReqVO, IntegralChangeLogDO.class);
        integralChangeLogMapper.insert(consumptionChangeLog);
        // 返回
        return consumptionChangeLog.getId();
    }

}