SyncAddressBookJob.java 2.09 KB
/*
package cn.com.glsx.entmicro.job;

import cn.com.glsx.entmicro.entity.EntmicroStaff;
import cn.com.glsx.entmicro.model.response.EntmicroDepartmentResponse;
import cn.com.glsx.entmicro.service.CustomerBaseService;
import cn.com.glsx.entmicro.service.EntmicroDepartmentService;
import cn.com.glsx.entmicro.service.EntmicroStaffService;
import cn.com.glsx.entmicro.service.SyncDataService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

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

*/
/**
 * @author zhouhaibao
 * @version 1.0
 * @description: 广汇通讯录同步事件
 * @date 2022/1/18 20:05
 *//*

@Slf4j
@Component
@ElasticSimpleJob(jobName = "syncAddressBookJob", cron = "0 0 23 * * ?")
public class SyncAddressBookJob implements SimpleJob {

    @Autowired
    private EntmicroDepartmentService entmicroDepartmentService;

    @Autowired
    private Environment environment;

    @Autowired
    @Lazy
    private SyncDataService syncDataService;

    @Override
    public void execute(ShardingContext shardingContext) {
        try {
            // 控制同步客户客户群
            String property = environment.getProperty("authorize.merchantIds");
            if (!org.springframework.util.StringUtils.isEmpty(property)) {
                String[] split = property.split(",");
                for (String merchantid : split) {
                    int merchantId = Integer.parseInt(merchantid);
                    //entmicroDepartmentService.syncDepartment(merchantId);
                    syncDataService.syncDepStaCustAndCustGroup(merchantId);
                }
            }
        } catch (Exception e) {
            log.info("同步部门数据异常");
        }
    }
}
*/