|
@ -106,13 +106,17 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
if (StringUtils.isNotBlank(extractOriginFormDTO.getStartDate()) && StringUtils.isNotBlank(extractOriginFormDTO.getEndDate())) { |
|
|
if (StringUtils.isNotBlank(extractOriginFormDTO.getStartDate()) && StringUtils.isNotBlank(extractOriginFormDTO.getEndDate())) { |
|
|
List<String> daysBetween = DateUtils.getDaysBetween(extractOriginFormDTO.getStartDate(), extractOriginFormDTO.getEndDate()); |
|
|
List<String> daysBetween = DateUtils.getDaysBetween(extractOriginFormDTO.getStartDate(), extractOriginFormDTO.getEndDate()); |
|
|
daysBetween.forEach(dateId -> { |
|
|
daysBetween.forEach(dateId -> { |
|
|
extractDaily(customerId, dateId); |
|
|
boolean isLastDay = false; |
|
|
|
|
|
if (dateId.equals(daysBetween.get(daysBetween.size() - 1))) { |
|
|
|
|
|
isLastDay = true; |
|
|
|
|
|
} |
|
|
|
|
|
extractDaily(customerId, dateId, isLastDay); |
|
|
}); |
|
|
}); |
|
|
} else if (StringUtils.isNotBlank(extractOriginFormDTO.getDateId())) { |
|
|
} else if (StringUtils.isNotBlank(extractOriginFormDTO.getDateId())) { |
|
|
extractDaily(customerId, extractOriginFormDTO.getDateId()); |
|
|
extractDaily(customerId, extractOriginFormDTO.getDateId(), true); |
|
|
} else { |
|
|
} else { |
|
|
String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); |
|
|
String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); |
|
|
extractDaily(customerId, dateId); |
|
|
extractDaily(customerId, dateId, true); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -151,13 +155,14 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
/** |
|
|
/** |
|
|
* @param customerId |
|
|
* @param customerId |
|
|
* @param dateId |
|
|
* @param dateId |
|
|
|
|
|
* @param isLast 是否是最后一天 |
|
|
* @Description 按天计算 |
|
|
* @Description 按天计算 |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
* @date 2020/9/24 10:16 上午 |
|
|
* @date 2020/9/24 10:16 上午 |
|
|
*/ |
|
|
*/ |
|
|
public void extractDaily(String customerId, String dateId) { |
|
|
public void extractDaily(String customerId, String dateId, boolean isLast) { |
|
|
//等待3个线程执行完毕后再 继续执行下一个客户的 避免死锁
|
|
|
//等待3个线程执行完毕后再 继续执行下一个客户的 避免死锁
|
|
|
final CountDownLatch latch = new CountDownLatch(NumConstant.THREE); |
|
|
final CountDownLatch latch = new CountDownLatch(NumConstant.FOUR); |
|
|
threadPool.submit(() -> { |
|
|
threadPool.submit(() -> { |
|
|
//党员基本情况screen_cpc_base_data
|
|
|
//党员基本情况screen_cpc_base_data
|
|
|
try { |
|
|
try { |
|
@ -166,6 +171,7 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
} |
|
|
} |
|
|
//先锋模范screen_pioneer_data
|
|
|
//先锋模范screen_pioneer_data
|
|
|
|
|
|
if (isLast) { |
|
|
try { |
|
|
try { |
|
|
pioneerDataExtractService.extractGridPioneerData(customerId, dateId); |
|
|
pioneerDataExtractService.extractGridPioneerData(customerId, dateId); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
@ -181,6 +187,8 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
latch.countDown(); |
|
|
latch.countDown(); |
|
|
log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId); |
|
|
log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId); |
|
|
}); |
|
|
}); |
|
@ -191,7 +199,7 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
} |
|
|
} |
|
|
|
|
|
if (isLast) { |
|
|
//基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data
|
|
|
//基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data
|
|
|
try { |
|
|
try { |
|
|
ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); |
|
|
ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); |
|
@ -205,6 +213,7 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
latch.countDown(); |
|
|
latch.countDown(); |
|
|
log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId); |
|
|
log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId); |
|
|
}); |
|
|
}); |
|
@ -245,7 +254,10 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); |
|
|
} |
|
|
} |
|
|
|
|
|
latch.countDown(); |
|
|
|
|
|
log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId); |
|
|
|
|
|
}); |
|
|
|
|
|
threadPool.submit(() -> { |
|
|
//治理能力排行screen_govern_rank_data
|
|
|
//治理能力排行screen_govern_rank_data
|
|
|
try { |
|
|
try { |
|
|
governRankDataExtractService.extractGridDataDaily(customerId, dateId); |
|
|
governRankDataExtractService.extractGridDataDaily(customerId, dateId); |
|
@ -290,14 +302,14 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { |
|
|
} |
|
|
} |
|
|
extractPartData(customerId, dateId); |
|
|
extractPartData(customerId, dateId); |
|
|
latch.countDown(); |
|
|
latch.countDown(); |
|
|
log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}",dateId,customerId); |
|
|
log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId); |
|
|
}); |
|
|
}); |
|
|
try { |
|
|
try { |
|
|
latch.await(); |
|
|
latch.await(); |
|
|
} catch (InterruptedException e) { |
|
|
} catch (InterruptedException e) { |
|
|
log.error("extractDaily run exception", e); |
|
|
log.error("extractDaily run exception", e); |
|
|
} |
|
|
} |
|
|
log.info("===== extractDaily method end ======"); |
|
|
log.info("===== extractDaily method end customerId:{}======",customerId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|