|
@@ -24,6 +24,7 @@
|
|
|
|
|
|
package com.tzld.crawler.etl.service.impl;
|
|
package com.tzld.crawler.etl.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
import com.google.common.base.Stopwatch;
|
|
import com.google.common.base.Stopwatch;
|
|
import com.google.common.base.Strings;
|
|
import com.google.common.base.Strings;
|
|
@@ -160,12 +161,14 @@ public class EtlServiceImpl implements EtlService {
|
|
// 参数校验
|
|
// 参数校验
|
|
CustomValidator.Result result = CustomValidator.validate(param);
|
|
CustomValidator.Result result = CustomValidator.validate(param);
|
|
if (result.notSuccess()) {
|
|
if (result.notSuccess()) {
|
|
|
|
+ metric(MetricTypeEnum.PARAM_INVALID, JSON.toJSONString(param));
|
|
throw new CommonException(ExceptionEnum.PARAM_ERROR, "param validate failed." + result.getMessage());
|
|
throw new CommonException(ExceptionEnum.PARAM_ERROR, "param validate failed." + result.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
// 保存数据库(去重校验)
|
|
// 保存数据库(去重校验)
|
|
id = save2db(crawlerVideo);
|
|
id = save2db(crawlerVideo);
|
|
if (id <= 0) {
|
|
if (id <= 0) {
|
|
|
|
+ metric(MetricTypeEnum.SAVE_DB_FAILED, JSON.toJSONString(crawlerVideo));
|
|
throw new CommonException(ExceptionEnum.DATA_ERROR, "save2db failed, duplicated out video id.");
|
|
throw new CommonException(ExceptionEnum.DATA_ERROR, "save2db failed, duplicated out video id.");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -175,6 +178,7 @@ public class EtlServiceImpl implements EtlService {
|
|
|
|
|
|
StrategyDataDto data = strategyHandlerService.execute(strategies, param);
|
|
StrategyDataDto data = strategyHandlerService.execute(strategies, param);
|
|
if (data == null) {
|
|
if (data == null) {
|
|
|
|
+ metric(MetricTypeEnum.STRATEGY_FAILED, JSON.toJSONString(param));
|
|
throw new CommonException(ExceptionEnum.DATA_ERROR, param + " filter by strategies " + strategies);
|
|
throw new CommonException(ExceptionEnum.DATA_ERROR, param + " filter by strategies " + strategies);
|
|
}
|
|
}
|
|
|
|
|