package com.gic.haoban.manage.service.service.content.impl;

import com.gic.haoban.manage.service.dao.mapper.content.TabHaobanTriggerCustomerDetailMapper;
import com.gic.haoban.manage.service.entity.content.TabHaobanTriggerCustomerDetail;
import com.gic.haoban.manage.service.pojo.bo.content.TriggerCustomerDetailBO;
import com.gic.haoban.manage.service.pojo.qo.content.TriggerCustomerDetailQO;
import com.gic.haoban.manage.service.service.content.TriggerCustomerDetailService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author MUSI
 * @Date 2023/3/19 9:38 PM
 * @Description
 * @Version
 **/
@Component
public class TriggerCustomerDetailServiceImpl implements TriggerCustomerDetailService {

    private static final Logger log = LoggerFactory.getLogger(TriggerCustomerDetailServiceImpl.class);

    @Autowired
    private TabHaobanTriggerCustomerDetailMapper triggerCustomerDetailMapper;

    @Override
    public void save(TriggerCustomerDetailBO triggerCustomerDetailBO) {

    }

    /**
     * 批量保存
     *
     * @param triggerCustomerDetailBos
     */
    @Override
    public void batchSave(List<TriggerCustomerDetailBO> triggerCustomerDetailBos) {
        if (CollectionUtils.isEmpty(triggerCustomerDetailBos)) {
            return;
        }
        List<TabHaobanTriggerCustomerDetail> customerDetails = triggerCustomerDetailBos
                .stream()
                .map(item -> {
                    TabHaobanTriggerCustomerDetail temp = new TabHaobanTriggerCustomerDetail();
                    BeanUtils.copyProperties(item, temp);
                    return temp;
                })
                .collect(Collectors.toList());
        triggerCustomerDetailMapper.insertBatch(customerDetails);
    }

    /**
     * 查询客户触达日志
     *
     * @param triggerCustomerDetailQO
     * @return
     */
    @Override
    public List<TriggerCustomerDetailBO> queryTriggerCustomerDetailList(TriggerCustomerDetailQO triggerCustomerDetailQO) {
        return null;
    }
}
