|
@@ -27,12 +27,12 @@ import java.util.*;
|
|
|
public class BytedancePromoterReportServiceImpl implements IBytedancePromoterReportService {
|
|
public class BytedancePromoterReportServiceImpl implements IBytedancePromoterReportService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private BytedancePromoterReportMapper promoterReportMapper;
|
|
private BytedancePromoterReportMapper promoterReportMapper;
|
|
|
- private static final int MAX_BATCH_SIZE = 10000;
|
|
|
|
|
|
|
+ /*private static final int MAX_BATCH_SIZE = 10000;
|
|
|
private static final long MAX_WAIT_TIME_MS = 2 * 60 * 1000;
|
|
private static final long MAX_WAIT_TIME_MS = 2 * 60 * 1000;
|
|
|
private final List<BytedancePromoterReportHour> promoterReportHourBuffer = Collections.synchronizedList(new ArrayList<>());
|
|
private final List<BytedancePromoterReportHour> promoterReportHourBuffer = Collections.synchronizedList(new ArrayList<>());
|
|
|
private final List<BytedancePromoterReportDaily> promoterReportDailyBuffer = Collections.synchronizedList(new ArrayList<>());
|
|
private final List<BytedancePromoterReportDaily> promoterReportDailyBuffer = Collections.synchronizedList(new ArrayList<>());
|
|
|
private long promoterReportHourLastFlushTime = System.currentTimeMillis();
|
|
private long promoterReportHourLastFlushTime = System.currentTimeMillis();
|
|
|
- private long promoterReportDailyLastFlushTime = System.currentTimeMillis();
|
|
|
|
|
|
|
+ private long promoterReportDailyLastFlushTime = System.currentTimeMillis();*/
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -100,11 +100,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
|
|
|
}
|
|
}
|
|
|
if (!Check.isNull(hours)) {
|
|
if (!Check.isNull(hours)) {
|
|
|
promoterReportMapper.replacePromoterReportHour(hours);
|
|
promoterReportMapper.replacePromoterReportHour(hours);
|
|
|
- try {
|
|
|
|
|
- promoterReportHourBuffer.addAll(hours);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("", e);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ promoterReportMapper.replacePromoterReportHourSD(hours);
|
|
|
|
|
+ //promoterReportHourBuffer.addAll(hours);
|
|
|
}
|
|
}
|
|
|
if (hours.size() >= 100) {
|
|
if (hours.size() >= 100) {
|
|
|
try {
|
|
try {
|
|
@@ -184,12 +181,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
|
|
|
}
|
|
}
|
|
|
if (!Check.isNull(promoterReportDailies)) {
|
|
if (!Check.isNull(promoterReportDailies)) {
|
|
|
promoterReportMapper.replacePromoterReportDailies(promoterReportDailies);
|
|
promoterReportMapper.replacePromoterReportDailies(promoterReportDailies);
|
|
|
- try {
|
|
|
|
|
- promoterReportDailyBuffer.addAll(promoterReportDailies);
|
|
|
|
|
-
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("", e);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ promoterReportMapper.replacePromoterReportDailiesSD(promoterReportDailies);
|
|
|
|
|
+ //promoterReportDailyBuffer.addAll(promoterReportDailies);
|
|
|
log.info("账户ID:{},广告日报(最细粒度)数据请求成功", advertiserId);
|
|
log.info("账户ID:{},广告日报(最细粒度)数据请求成功", advertiserId);
|
|
|
}
|
|
}
|
|
|
if (promoterReportDailies.size() >= 100) {
|
|
if (promoterReportDailies.size() >= 100) {
|
|
@@ -291,11 +284,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
|
|
|
}
|
|
}
|
|
|
if (!Check.isNull(hours)) {
|
|
if (!Check.isNull(hours)) {
|
|
|
promoterReportMapper.replacePromoterReportHour(hours);
|
|
promoterReportMapper.replacePromoterReportHour(hours);
|
|
|
- try {
|
|
|
|
|
- promoterReportHourBuffer.addAll(hours);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ promoterReportMapper.replacePromoterReportHourSD(hours);
|
|
|
|
|
+ //promoterReportHourBuffer.addAll(hours);
|
|
|
}
|
|
}
|
|
|
if (hours.size() >= 100) {
|
|
if (hours.size() >= 100) {
|
|
|
try {
|
|
try {
|
|
@@ -388,11 +378,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
|
|
|
}
|
|
}
|
|
|
if (!Check.isNull(promoterReportDailies)) {
|
|
if (!Check.isNull(promoterReportDailies)) {
|
|
|
promoterReportMapper.replacePromoterReportDailies(promoterReportDailies);
|
|
promoterReportMapper.replacePromoterReportDailies(promoterReportDailies);
|
|
|
- try {
|
|
|
|
|
- promoterReportDailyBuffer.addAll(promoterReportDailies);
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- log.error("", e);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ promoterReportMapper.replacePromoterReportDailiesSD(promoterReportDailies);
|
|
|
|
|
+ //promoterReportDailyBuffer.addAll(promoterReportDailies);
|
|
|
log.info("账户ID:{},广告日报(最细粒度)数据请求成功", advertiserId);
|
|
log.info("账户ID:{},广告日报(最细粒度)数据请求成功", advertiserId);
|
|
|
}
|
|
}
|
|
|
if (promoterReportDailies.size() >= 100) {
|
|
if (promoterReportDailies.size() >= 100) {
|
|
@@ -419,7 +406,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
|
|
|
return promoterReportMapper.getAllList();
|
|
return promoterReportMapper.getAllList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Scheduled(fixedRate = 11000) // 每30秒检查一次
|
|
|
|
|
|
|
+ /*@Scheduled(fixedRate = 11000) // 每30秒检查一次
|
|
|
public void flushIfNeeded() {
|
|
public void flushIfNeeded() {
|
|
|
log.info("开始执行广告报表定时批处理任务....");
|
|
log.info("开始执行广告报表定时批处理任务....");
|
|
|
synchronized (promoterReportHourBuffer) {
|
|
synchronized (promoterReportHourBuffer) {
|
|
@@ -498,7 +485,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|