CustomerSyncToBigDataComponent.java 1.15 KB
package cn.com.glsx.entmicro.manager;

import cn.com.glsx.entmicro.entity.EntmicroStaff;
import cn.com.glsx.entmicro.service.CustomerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author wangxw
 * @version 1.0.0
 * @ClassName CustomerSyncToBigDataComponent.java
 * @description: ${description}
 * @createTime 2021年12月07日 00:09:00
 */
@Slf4j
@Component
public class CustomerSyncToBigDataComponent {

    @Autowired
    private CustomerService customerService;

    @Async("taskExecutor")
    public void syncCustomerToBigData(List<EntmicroStaff> entmicroStaffList,String type) {
        if (CollectionUtils.isEmpty(entmicroStaffList)) {
            log.info("customer info sync to bigdata staff empty.");
            return;
        }

        for (EntmicroStaff entmicroStaff:entmicroStaffList) {
            customerService.syncCustomerToBigData(entmicroStaff.getId(), type, entmicroStaff.getMerchantid());
        }
    }

}