package com.hzs.activity.people.provider;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.hzs.activity.dto.AcPeopleGiftProductDTO;
import com.hzs.activity.people.IAcPeopleServiceServiceApi;
import com.hzs.activity.people.service.IAcPeopleServiceService;
import com.hzs.activity.people.vo.AcPeopleGiftProductVO;
import com.hzs.common.core.domain.R;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

/**
 * 会员涉及dubbo服务
 */
@DubboService
public class AcPeopleServiceServiceProvider implements IAcPeopleServiceServiceApi {

    @Autowired
    private IAcPeopleServiceService iAcPeopleServiceService;

    @Override
    public R<List<AcPeopleGiftProductDTO>> getGiftPackProductList(Long pkNewPeople) {
        List<AcPeopleGiftProductVO> pgplist = iAcPeopleServiceService.getGiftPackProductList(pkNewPeople);
        List<AcPeopleGiftProductDTO> list = new ArrayList<>();
        if (CollectionUtil.isNotEmpty(pgplist)) {
            pgplist.forEach(item -> list.add(BeanUtil.copyProperties(item, AcPeopleGiftProductDTO.class)));
        }
        return R.ok(list);
    }
}
