|
@@ -146,10 +146,10 @@ public class ContentPlatformDatastatJob {
|
|
|
return gzhDataStatMapper.countByExample(example);
|
|
|
}
|
|
|
|
|
|
- private long getQwDatastatCount(String dt) {
|
|
|
+ private List<ContentPlatformQwDataStat> getQwDatastatCount(String dt) {
|
|
|
ContentPlatformQwDataStatExample example = new ContentPlatformQwDataStatExample();
|
|
|
example.createCriteria().andDateStrEqualTo(dt);
|
|
|
- return qwDataStatMapper.countByExample(example);
|
|
|
+ return qwDataStatMapper.selectByExample(example);
|
|
|
}
|
|
|
|
|
|
private long getQwDatastatTotalCount(String dt) {
|
|
@@ -161,14 +161,12 @@ public class ContentPlatformDatastatJob {
|
|
|
@XxlJob("syncContentPlatformQwDatastatJob")
|
|
|
public ReturnT<String> syncContentPlatformQwDatastatJob(String param) {
|
|
|
String dt = DateUtil.getBeforeDayDateString("yyyyMMdd");
|
|
|
- long count = getQwDatastatCount(dt);
|
|
|
- if (count > 0) {
|
|
|
- return ReturnT.SUCCESS;
|
|
|
- }
|
|
|
List<ContentPlatformQwPlan> qwPlanList = getAllQwPlan();
|
|
|
if (CollectionUtils.isEmpty(qwPlanList)) {
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
+ List<ContentPlatformQwDataStat> existList = getQwDatastatCount(dt);
|
|
|
+ List<String> existRootSourceIds = existList.stream().map(ContentPlatformQwDataStat::getRootSourceId).collect(Collectors.toList());
|
|
|
Map<String, Long> rootSourceIdMap = qwPlanList.stream()
|
|
|
.collect(Collectors.toMap(ContentPlatformQwPlan::getRootSourceId, ContentPlatformQwPlan::getId));
|
|
|
List<Long> planIds = qwPlanList.stream().map(ContentPlatformQwPlan::getId).collect(Collectors.toList());
|
|
@@ -191,6 +189,9 @@ public class ContentPlatformDatastatJob {
|
|
|
if (!rootSourceIds.contains(rootSourceId)) {
|
|
|
continue;
|
|
|
}
|
|
|
+ if (existRootSourceIds.contains(rootSourceId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
int firstLevelCount = Integer.parseInt((String) record.get(8));
|
|
|
if (firstLevelCount == 0) {
|
|
|
continue;
|
|
@@ -219,6 +220,9 @@ public class ContentPlatformDatastatJob {
|
|
|
if (!rootSourceIds.contains(rootSourceId)) {
|
|
|
continue;
|
|
|
}
|
|
|
+ if (existRootSourceIds.contains(rootSourceId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
int firstLevelCount = Integer.parseInt((String) record.get(8));
|
|
|
if (firstLevelCount == 0) {
|
|
|
continue;
|
|
@@ -253,10 +257,7 @@ public class ContentPlatformDatastatJob {
|
|
|
@XxlJob("syncContentPlatformQwDatastatTotalJob")
|
|
|
public ReturnT<String> syncContentPlatformQwDatastatTotalJob(String param) {
|
|
|
String dt = DateUtil.getBeforeDayDateString("yyyyMMdd");
|
|
|
- long count = getQwDatastatTotalCount(dt);
|
|
|
- if (count > 0) {
|
|
|
- return ReturnT.SUCCESS;
|
|
|
- }
|
|
|
+ dataStatMapperExt.deleteQwDatastatTotal(dt);
|
|
|
Map<String, ContentPlatformQwDataStatTotal> saveMap = new HashMap<>();
|
|
|
String outSql = String.format("SELECT * FROM loghubods.qw_out_touliu_behavior_total WHERE dt=%s;", dt);
|
|
|
List<Record> outDataList = OdpsUtil.getOdpsData(outSql);
|