|
@@ -64,7 +64,7 @@ public class OrderBaseCountLogic {
|
|
|
String endTime){
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
OrderBaseCountBean orderBaseCountBean = new OrderBaseCountBean();
|
|
|
-
|
|
|
+ adminUser.setAdminWebsitIds(null);
|
|
|
BoolQueryBuilder queryBuilderCount = QueryBuilders.boolQuery();
|
|
|
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(adminUser.getAdminWebsitIds())) {
|
|
@@ -214,7 +214,7 @@ public class OrderBaseCountLogic {
|
|
|
}
|
|
|
queryBuilder.must(
|
|
|
QueryBuilders.rangeQuery("create_time")
|
|
|
- .gte(DateUtil.format(DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), (-7))),"yyyy-MM-dd HH:mm:ss"))
|
|
|
+ .gte(DateUtil.format(DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), (-6))),"yyyy-MM-dd HH:mm:ss"))
|
|
|
.lte(DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")));
|
|
|
|
|
|
NativeSearchQuery searchQueryDay = new NativeSearchQueryBuilder()
|
|
@@ -247,8 +247,14 @@ public class OrderBaseCountLogic {
|
|
|
|
|
|
|
|
|
NativeSearchQuery searchQueryWGD = new NativeSearchQueryBuilder()
|
|
|
- .withQuery(queryBuilder)
|
|
|
- .withQuery(QueryBuilders.termsQuery("order_status",orderStatus))
|
|
|
+ .withQuery(QueryBuilders.boolQuery()
|
|
|
+ .must(QueryBuilders.termsQuery("order_status",orderStatus))
|
|
|
+ .must( QueryBuilders.rangeQuery("create_time")
|
|
|
+ .gte(DateUtil.format(DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), (-6))),"yyyy-MM-dd HH:mm:ss"))
|
|
|
+ .lte(DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")))
|
|
|
+ .must( QueryBuilders.boolQuery().should(QueryBuilders.termsQuery("create_websit_id", adminUser.getAdminWebsitIds()))
|
|
|
+ .should(QueryBuilders.termsQuery("websit_id", adminUser.getAdminWebsitIds())))
|
|
|
+ )
|
|
|
.withSourceFilter(new FetchSourceFilter(new String[]{"create_time"}, null))
|
|
|
.withPageable(PageRequest.of(1, 1))
|
|
|
.addAggregation(AggregationBuilders.dateHistogram("WGD")
|
|
@@ -277,9 +283,16 @@ public class OrderBaseCountLogic {
|
|
|
|
|
|
|
|
|
NativeSearchQuery searchQueryJXZ= new NativeSearchQueryBuilder()
|
|
|
- .withQuery(queryBuilder)
|
|
|
- .withQuery(QueryBuilders.boolQuery().mustNot(QueryBuilders.termsQuery("order_status",orderStatus))
|
|
|
- .mustNot(QueryBuilders.termsQuery("order_status",orderStatusQx)))
|
|
|
+
|
|
|
+ .withQuery(QueryBuilders.boolQuery()
|
|
|
+ .must( QueryBuilders.rangeQuery("create_time")
|
|
|
+ .gte(DateUtil.format(DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), (-6))),"yyyy-MM-dd HH:mm:ss"))
|
|
|
+ .lte(DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")))
|
|
|
+ .must( QueryBuilders.boolQuery().should(QueryBuilders.termsQuery("create_websit_id", adminUser.getAdminWebsitIds()))
|
|
|
+ .should(QueryBuilders.termsQuery("websit_id", adminUser.getAdminWebsitIds())))
|
|
|
+ .mustNot(QueryBuilders.termsQuery("order_status",orderStatus))
|
|
|
+ .mustNot(QueryBuilders.termsQuery("order_status",orderStatusQx))
|
|
|
+ )
|
|
|
.withSourceFilter(new FetchSourceFilter(new String[]{"create_time"}, null))
|
|
|
.withPageable(PageRequest.of(1, 1))
|
|
|
.addAggregation(AggregationBuilders.dateHistogram("JXZ")
|
|
@@ -295,7 +308,7 @@ public class OrderBaseCountLogic {
|
|
|
var aggregationsJXZ = searchHitsJXZ.getAggregations();
|
|
|
|
|
|
if (aggregationsJXZ != null) {
|
|
|
- ParsedDateHistogram dateHistogram = aggregationsWGD.get("JXZ");
|
|
|
+ ParsedDateHistogram dateHistogram = aggregationsJXZ.get("JXZ");
|
|
|
List<? extends Histogram.Bucket> buckets = dateHistogram.getBuckets();
|
|
|
|
|
|
// 遍历每天的统计结果
|
|
@@ -312,29 +325,35 @@ public class OrderBaseCountLogic {
|
|
|
|
|
|
orderBaseCountBean.setQtddqs(qtddqs);
|
|
|
|
|
|
- for (int i = 0; i < 7; i++) {
|
|
|
- Integer day = i;
|
|
|
-
|
|
|
|
|
|
-/* Long qtsm = pgOrderBaseList.stream().filter(item -> item.getAppointmentTime() != null && item.getAppointmentTime().before(DateUtil.endOfDay(DateUtil.offsetDay(new Date(), (day)))) &&
|
|
|
- item.getAppointmentTime().after(DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), (day))))
|
|
|
|
|
|
- ).count();*/
|
|
|
-
|
|
|
- //七天上门
|
|
|
- NativeSearchQuery searchQueryQTSM= new NativeSearchQueryBuilder()
|
|
|
- .withQuery(queryBuilder)
|
|
|
- .withPageable(PageRequest.of(1, 1))
|
|
|
- .addAggregation(this.getAggs(AggregationBuilders.filter("qtsm", QueryBuilders.boolQuery()
|
|
|
- .must(QueryBuilders.rangeQuery("appointment_time")
|
|
|
- .gte(DateUtil.format(DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), (day))),"yyyy-MM-dd HH:mm:ss"))
|
|
|
- .lte(DateUtil.format(DateUtil.endOfDay(DateUtil.offsetDay(new Date(), (day))),"yyyy-MM-dd HH:mm:ss"))))))
|
|
|
- .build();
|
|
|
- SearchHits responseQTSM = elasticsearchRestTemplate.search(searchQueryQTSM, OrderBaseEs.class);
|
|
|
+ NativeSearchQuery searchQueryQTSM= new NativeSearchQueryBuilder()
|
|
|
+ .withQuery(QueryBuilders.boolQuery()
|
|
|
+ .must( QueryBuilders.boolQuery().should(QueryBuilders.termsQuery("create_websit_id", adminUser.getAdminWebsitIds()))
|
|
|
+ .should(QueryBuilders.termsQuery("websit_id", adminUser.getAdminWebsitIds())))
|
|
|
+ .must(QueryBuilders.rangeQuery("appointment_time")
|
|
|
+ .gte(DateUtil.format(DateUtil.beginOfDay(new Date()),"yyyy-MM-dd HH:mm:ss"))
|
|
|
+ .lte(DateUtil.format(DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), (6))),"yyyy-MM-dd HH:mm:ss"))))
|
|
|
+ .withPageable(PageRequest.of(1, 1))
|
|
|
+ .addAggregation(AggregationBuilders.dateHistogram("QTDSM")
|
|
|
+ .field("create_time")
|
|
|
+ .calendarInterval(DateHistogramInterval.DAY)
|
|
|
+ .format("yyyy-MM-dd"))
|
|
|
+ .build();
|
|
|
+ SearchHits responseQTSM = elasticsearchRestTemplate.search(searchQueryQTSM, OrderBaseEs.class);
|
|
|
|
|
|
+ var aggregationsQTSM = responseQTSM.getAggregations();
|
|
|
|
|
|
- qtsmList.add(this.getWorkerOrderCountResult(responseQTSM.getAggregations(),"qtsm"));
|
|
|
+ if (aggregationsQTSM != null) {
|
|
|
+ ParsedDateHistogram dateHistogram = aggregationsQTSM.get("QTDSM");
|
|
|
+ List<? extends Histogram.Bucket> buckets = dateHistogram.getBuckets();
|
|
|
|
|
|
+ // 遍历每天的统计结果
|
|
|
+ for (Histogram.Bucket bucket : buckets) {
|
|
|
+ String date = bucket.getKeyAsString();
|
|
|
+ long count = bucket.getDocCount();
|
|
|
+ qtsmList.add(count);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|