SyncAddressBookJob.java
2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
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("同步部门数据异常");
}
}
}
*/