|
@@ -200,13 +200,26 @@ public class ChannelDemandMatchJob {
|
|
|
log.info("数据日期: {}", dt);
|
|
log.info("数据日期: {}", dt);
|
|
|
|
|
|
|
|
// 1.1 param为空时,检查当日是否已有数据,有则跳过(防止无参数重复执行覆盖已有结果)
|
|
// 1.1 param为空时,检查当日是否已有数据,有则跳过(防止无参数重复执行覆盖已有结果)
|
|
|
|
|
+ // 但如果当日数据量不足前一天的50%,则重新执行
|
|
|
if (!StringUtils.hasText(param)) {
|
|
if (!StringUtils.hasText(param)) {
|
|
|
ChannelDemandMatchResultExample checkExample = new ChannelDemandMatchResultExample();
|
|
ChannelDemandMatchResultExample checkExample = new ChannelDemandMatchResultExample();
|
|
|
checkExample.createCriteria().andDtEqualTo(dt);
|
|
checkExample.createCriteria().andDtEqualTo(dt);
|
|
|
long existingCount = resultMapper.countByExample(checkExample);
|
|
long existingCount = resultMapper.countByExample(checkExample);
|
|
|
if (existingCount > 0) {
|
|
if (existingCount > 0) {
|
|
|
- log.info("param为空且channel_demand_match_result表dt={}已有{}条数据,跳过执行", dt, existingCount);
|
|
|
|
|
- return ReturnT.SUCCESS;
|
|
|
|
|
|
|
+ // 查询前一天的count
|
|
|
|
|
+ String prevDt = LocalDate.parse(dt, DateTimeFormatter.ofPattern("yyyyMMdd"))
|
|
|
|
|
+ .minusDays(1).format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
|
|
|
|
+ ChannelDemandMatchResultExample prevExample = new ChannelDemandMatchResultExample();
|
|
|
|
|
+ prevExample.createCriteria().andDtEqualTo(prevDt);
|
|
|
|
|
+ long prevCount = resultMapper.countByExample(prevExample);
|
|
|
|
|
+
|
|
|
|
|
+ if (prevCount > 0 && existingCount < prevCount * 0.5) {
|
|
|
|
|
+ log.info("param为空,dt={}现有{}条,前一天dt={}有{}条,不足50%,重新执行",
|
|
|
|
|
+ dt, existingCount, prevDt, prevCount);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.info("param为空且channel_demand_match_result表dt={}已有{}条数据,跳过执行", dt, existingCount);
|
|
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|