package com.uas.task;

import com.uas.service.CustomerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * @author koul
 * @email koul@usoftchina.com
 * @date 2020-10-27 15:42
 */
@Component("scheduleTask")
public class ScheduleTask {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private CustomerService customerService;

    /**
     * 保存客户资料
     */
    public void saveFbCustomer() {
        logger.info("保存客户资料开始");
        Date date = new Date();
        List<String> following = customerService.getFollowingByGroup();
        if (following != null) {
            customerService.updateGZStatus(following);
            for (String s : following) {
                customerService.saveBusiness(s);
            }
            customerService.updateCUGZStatus(following);
        }
        logger.info("保存客户资料结束:用时" + ((System.currentTimeMillis() - date.getTime()) / 1000));

    }
}
