|
@@ -32,6 +32,10 @@ public class AdqAdIncomeServiceImpl implements IAdqAdIncomeService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AdqErrorLogMapper adqErrorLogMapper;
|
|
private AdqErrorLogMapper adqErrorLogMapper;
|
|
|
|
|
|
|
|
|
|
+ public List<JSONObject> getAdqAdIncomeRetryJob() {
|
|
|
|
|
+ return adqAdIncomeMapper.queryAdqAdIncomeRetryJob();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public List<JSONObject> getAdqMiniApp(String appId) {
|
|
public List<JSONObject> getAdqMiniApp(String appId) {
|
|
|
return adqAdIncomeMapper.queryAdqIaaMiniApp(appId);
|
|
return adqAdIncomeMapper.queryAdqIaaMiniApp(appId);
|
|
|
}
|
|
}
|
|
@@ -41,7 +45,7 @@ public class AdqAdIncomeServiceImpl implements IAdqAdIncomeService {
|
|
|
String url = "https://api.weixin.qq.com/publisher/stat";
|
|
String url = "https://api.weixin.qq.com/publisher/stat";
|
|
|
Object tokenObj = redis2Template_db5.opsForValue().get("wechat-applet-access-token-key-" + appletId);
|
|
Object tokenObj = redis2Template_db5.opsForValue().get("wechat-applet-access-token-key-" + appletId);
|
|
|
if (tokenObj == null) {
|
|
if (tokenObj == null) {
|
|
|
- log.error("微小广告收入拉取获取token为空 [{}] {}~{} {}", appId, startDt, endDt, appletId);
|
|
|
|
|
|
|
+ log.error("微小广告细分数据拉取获取token为空 [{}] {}~{} {}", appId, startDt, endDt, appletId);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
int pageSize = 1000;
|
|
int pageSize = 1000;
|
|
@@ -58,7 +62,7 @@ public class AdqAdIncomeServiceImpl implements IAdqAdIncomeService {
|
|
|
boolean hasMore = false;
|
|
boolean hasMore = false;
|
|
|
if (!Check.isNull(jsonObject)) {
|
|
if (!Check.isNull(jsonObject)) {
|
|
|
Integer code = jsonObject.getInteger("ret");
|
|
Integer code = jsonObject.getInteger("ret");
|
|
|
- if(code == 2009) {
|
|
|
|
|
|
|
+ if (code == 2009) {
|
|
|
return; //无效的流量主
|
|
return; //无效的流量主
|
|
|
}
|
|
}
|
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
@@ -73,18 +77,20 @@ public class AdqAdIncomeServiceImpl implements IAdqAdIncomeService {
|
|
|
AdqPublisherAdunitGeneral report = JSONObject.parseObject(statItem.toJSONString(), AdqPublisherAdunitGeneral.class);
|
|
AdqPublisherAdunitGeneral report = JSONObject.parseObject(statItem.toJSONString(), AdqPublisherAdunitGeneral.class);
|
|
|
report.setAppId(appId);
|
|
report.setAppId(appId);
|
|
|
report.setStatDate(Integer.valueOf(report.getDate().replace("-", "")));
|
|
report.setStatDate(Integer.valueOf(report.getDate().replace("-", "")));
|
|
|
- System.out.println(report);
|
|
|
|
|
|
|
+ //System.out.println(report);
|
|
|
reports.add(report);
|
|
reports.add(report);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
- log.error("微小广告收入拉取失败,app_id:{} {}~{},返回信息:{}", appId, startDt, endDt, jsonObject);
|
|
|
|
|
- insertErrorLog(isLog, System.currentTimeMillis(), "adq_ma_ad_income", startDt, endDt, jsonObject.fluentPut("app_id", appId).toJSONString());
|
|
|
|
|
|
|
+ log.error("微小广告细分数据拉取失败,app_id:{} {}~{},返回信息:{}", appId, startDt, endDt, jsonObject);
|
|
|
|
|
+ insertErrorLog(isLog, System.currentTimeMillis(), "adq_ma_ad_income", startDt, endDt,
|
|
|
|
|
+ jsonObject.fluentPut("app_id", appId).fluentPut("applet_id", appletId).toJSONString());
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- log.error("微小广告收入拉取失败,app_id:{} {}~{},返回为空。", appId, startDt, endDt);
|
|
|
|
|
- insertErrorLog(isLog, System.currentTimeMillis(), "adq_ma_ad_income", startDt, endDt, new JSONObject().fluentPut("app_id", appId).fluentPut("msg", "返回为空").toJSONString());
|
|
|
|
|
|
|
+ log.error("微小广告细分数据拉取失败,app_id:{} {}~{},返回为空。", appId, startDt, endDt);
|
|
|
|
|
+ insertErrorLog(isLog, System.currentTimeMillis(), "adq_ma_ad_income", startDt, endDt,
|
|
|
|
|
+ new JSONObject().fluentPut("app_id", appId).fluentPut("applet_id", appletId).fluentPut("msg", "返回为空").toJSONString());
|
|
|
}
|
|
}
|
|
|
if (!Check.isNull(reports)) {
|
|
if (!Check.isNull(reports)) {
|
|
|
adqAdIncomeMapper.insertAdqAdIncome(reports);
|
|
adqAdIncomeMapper.insertAdqAdIncome(reports);
|
|
@@ -93,7 +99,7 @@ public class AdqAdIncomeServiceImpl implements IAdqAdIncomeService {
|
|
|
if (hasMore) {
|
|
if (hasMore) {
|
|
|
getAdqAdIncome(startDt, endDt, appId, appletId, page + 1, isLog, errId, isSend);
|
|
getAdqAdIncome(startDt, endDt, appId, appletId, page + 1, isLog, errId, isSend);
|
|
|
} else {
|
|
} else {
|
|
|
- log.info("微小广告收入拉取完成,app_id:{} {}~{}。", appId, startDt, endDt);
|
|
|
|
|
|
|
+ log.info("微小广告细分数据拉取完成,app_id:{} {}~{}。", appId, startDt, endDt);
|
|
|
if (errId != null) {
|
|
if (errId != null) {
|
|
|
adqErrorLogMapper.deleteInfoByErrorId(errId);
|
|
adqErrorLogMapper.deleteInfoByErrorId(errId);
|
|
|
}
|
|
}
|
|
@@ -102,7 +108,7 @@ public class AdqAdIncomeServiceImpl implements IAdqAdIncomeService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- log.error("微小广告收入拉取失败,app_id:{} {}~{}。", appId, startDt, endDt,e);
|
|
|
|
|
|
|
+ log.error("微小广告细分数据拉取失败,app_id:{} {}~{}。", appId, startDt, endDt, e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|