|
@ -16,10 +16,7 @@ import com.yihu.quota.vo.QuotaVo;
|
|
|
import com.yihu.quota.vo.SaveModel;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.elasticsearch.client.Client;
|
|
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
|
|
import org.elasticsearch.index.query.QueryBuilders;
|
|
|
import org.elasticsearch.index.query.QueryStringQueryBuilder;
|
|
|
import org.elasticsearch.index.query.RangeQueryBuilder;
|
|
|
import org.elasticsearch.index.query.*;
|
|
|
import org.joda.time.LocalDate;
|
|
|
import org.quartz.*;
|
|
|
import org.slf4j.Logger;
|
|
@ -188,8 +185,8 @@ public class EsQuotaJob implements Job {
|
|
|
logger.info(content + dataModels.size());
|
|
|
haveThreadCount++;
|
|
|
} else {
|
|
|
status = Contant.save_status.fail;
|
|
|
content = time + "没有抽取到数据";
|
|
|
status = Contant.save_status.success;
|
|
|
content = "没有抽取到数据" + time ;
|
|
|
haveThreadCount++;
|
|
|
}
|
|
|
// 初始执行时,更新该指标为已初始执行过
|
|
@ -227,9 +224,7 @@ public class EsQuotaJob implements Job {
|
|
|
private void deleteRecord(QuotaVo quotaVo) throws Exception {
|
|
|
EsConfig esConfig = extractHelper.getEsConfig(quotaVo.getCode());
|
|
|
EsConfig sourceEsConfig = extractHelper.getDataSourceEsConfig(quotaVo.getCode());
|
|
|
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
|
|
QueryStringQueryBuilder termQueryQuotaCode = QueryBuilders.queryStringQuery("quotaCode:" + quotaVo.getCode().replaceAll("_", ""));
|
|
|
boolQueryBuilder.must(termQueryQuotaCode);
|
|
|
|
|
|
String start = "";
|
|
|
String end = "";
|
|
|
if(sourceEsConfig.getFullQuery() !=null && sourceEsConfig.getFullQuery().equals("true")){
|
|
@ -243,10 +238,20 @@ public class EsQuotaJob implements Job {
|
|
|
end = endTime;
|
|
|
}
|
|
|
}
|
|
|
RangeQueryBuilder rangeQueryStartTime = QueryBuilders.rangeQuery("quotaDate").gte(start.substring(0, 10));
|
|
|
boolQueryBuilder.must(rangeQueryStartTime);
|
|
|
RangeQueryBuilder rangeQueryEndTime = QueryBuilders.rangeQuery("quotaDate").lte(end.substring(0, 10));
|
|
|
boolQueryBuilder.must(rangeQueryEndTime);
|
|
|
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
|
|
RangeQueryBuilder rangeQuotaTime = QueryBuilders.rangeQuery("quotaDate").gte(start.substring(0, 10)).lte(end.substring(0, 10));
|
|
|
RangeQueryBuilder rangeCreateTime = QueryBuilders.rangeQuery("createDate").gte(start.substring(0, 10) + "T00:00:00+0800").lte(end.substring(0, 10) + "T23:59:59+0800");
|
|
|
String quotaCodeTerm = "quotaCode:" + quotaVo.getCode().replaceAll("_", "");
|
|
|
QueryStringQueryBuilder termQueryQuotaCode = QueryBuilders.queryStringQuery(quotaCodeTerm);
|
|
|
QueryBuilder qb = QueryBuilders.boolQuery()
|
|
|
.must(termQueryQuotaCode)
|
|
|
.must(QueryBuilders.boolQuery()
|
|
|
.should(rangeQuotaTime)
|
|
|
.should(rangeCreateTime)
|
|
|
);
|
|
|
|
|
|
boolQueryBuilder.filter(qb);
|
|
|
|
|
|
boolean flag = true ;
|
|
|
Client talClient = elasticSearchPool.getClient();
|
|
|
Client client = elasticSearchPool.getClient();
|