|
|
|
@ -717,27 +717,11 @@ public class CustomerViewService {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void syncVip() throws InterruptedException {
|
|
|
|
|
//初始化线程
|
|
|
|
|
ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(8);
|
|
|
|
|
|
|
|
|
|
//查询现有企业微信账号
|
|
|
|
|
List<OpCustomer> customers = opCustomerDOMapper.selectList(null);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(customers)){
|
|
|
|
|
//分组
|
|
|
|
|
final List<List<OpCustomer>> afterPageList = com.kiisoo.ic.utils.CollectionUtils.portListByQuantity(customers, 100);
|
|
|
|
|
//定义线程池长度
|
|
|
|
|
int threadPoolSize = afterPageList.size();
|
|
|
|
|
//定义countDownLatch
|
|
|
|
|
final CountDownLatch countDownLatch = new CountDownLatch(threadPoolSize);
|
|
|
|
|
for (int i = 0; i < afterPageList.size(); i++) {
|
|
|
|
|
List<OpCustomer> opCustomers = afterPageList.get(i);
|
|
|
|
|
newFixedThreadPool.execute(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
try {
|
|
|
|
|
//查询企业微信已配置联系我的用户
|
|
|
|
|
for (OpCustomer customer : opCustomers) {
|
|
|
|
|
for (OpCustomer customer : customers) {
|
|
|
|
|
String wechatUniId = customer.getWechatUniId();
|
|
|
|
|
if (StringUtils.isBlank(wechatUniId)){
|
|
|
|
|
continue;
|
|
|
|
@ -788,18 +772,6 @@ public class CustomerViewService {
|
|
|
|
|
wrapper1.eq("wechat_uni_id", wechatUniId);
|
|
|
|
|
opCustomerDOMapper.update(opCustomer, wrapper1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("同步会员数据", e);
|
|
|
|
|
} finally {
|
|
|
|
|
//每次减去一,避免死锁
|
|
|
|
|
countDownLatch.countDown();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
countDownLatch.await();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|