|
|
@ -2,6 +2,8 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.distributedlock.DistributedLock; |
|
|
|
import com.epmet.commons.tools.distributedlock.LockConstants; |
|
|
|
import com.epmet.commons.tools.enums.EnvEnum; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
@ -20,6 +22,7 @@ import com.epmet.service.stats.DimCustomerService; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.redisson.api.RLock; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
@ -86,6 +89,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
|
private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService; |
|
|
|
@Autowired |
|
|
|
private ScreenProjectCategoryGridAndOrgDailyService screenProjectCategoryGridAndOrgDailyService; |
|
|
|
@Autowired |
|
|
|
private DistributedLock distributedLock; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param extractOriginFormDTO |
|
|
@ -163,6 +168,10 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
|
* @date 2020/9/24 10:16 上午 |
|
|
|
*/ |
|
|
|
public void extractDaily(String customerId, String dateId, boolean isLast) { |
|
|
|
RLock lock = null; |
|
|
|
try { |
|
|
|
// 锁持有10分钟,等待10s
|
|
|
|
lock = distributedLock.getLock(LockConstants.SCREEN_DAILY, NumConstant.SIX_HUNDRED_L, NumConstant.TEN_L, TimeUnit.SECONDS); |
|
|
|
//等待3个线程执行完毕后再 继续执行下一个客户的 避免死锁
|
|
|
|
final CountDownLatch latch = new CountDownLatch(NumConstant.FOUR); |
|
|
|
threadPool.submit(() -> { |
|
|
@ -312,6 +321,10 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
|
log.error("extractDaily run exception", e); |
|
|
|
} |
|
|
|
log.info("===== extractDaily method end customerId:{}======",customerId); |
|
|
|
}finally { |
|
|
|
lock.unlock(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|