|
@@ -259,19 +259,17 @@ public class So2Controller extends BaseController {
|
|
beginTime = month + "-01 00:00:00";
|
|
beginTime = month + "-01 00:00:00";
|
|
endTime = DateUtil.formatDate(DateUtil.endOfMonth(DateUtil.parseDate(beginTime))) + " 23:59:59";
|
|
endTime = DateUtil.formatDate(DateUtil.endOfMonth(DateUtil.parseDate(beginTime))) + " 23:59:59";
|
|
}
|
|
}
|
|
- Map<String, Object> aisRangeCondition = new HashMap<>();
|
|
|
|
- aisRangeCondition.put("peakTime", StrUtil.concat(true, "[", beginTime, ",", endTime, "]"));
|
|
|
|
- Map<Object, Object> aisAggs = client.aggs(ElasticConstants.AIS_ILLEGAL_SHIP, AggsType.count, "monitorPointName", "id", null, aisRangeCondition);
|
|
|
|
|
|
+ Map<String, Object> equalsCondition = new HashMap<>();
|
|
|
|
+ equalsCondition.put("illegalStatus", 2);
|
|
Map<String, Object> so2RangeCondition = new HashMap<>();
|
|
Map<String, Object> so2RangeCondition = new HashMap<>();
|
|
so2RangeCondition.put("createTime", StrUtil.concat(true, "[", beginTime, ",", endTime, "]"));
|
|
so2RangeCondition.put("createTime", StrUtil.concat(true, "[", beginTime, ",", endTime, "]"));
|
|
- Map<Object, Object> so2Aggs = client.aggs(ElasticConstants.SO2_ALERT, AggsType.count, "monitorPointName", "id", null, so2RangeCondition);
|
|
|
|
|
|
+ Map<Object, Object> so2Aggs = client.aggs(AggsType.count, "monitorPointName", "id", equalsCondition, so2RangeCondition, ElasticConstants.AIS_ILLEGAL_SHIP, ElasticConstants.SO2_ALERT);
|
|
// 构造硫的数据
|
|
// 构造硫的数据
|
|
List<SysDictData> so2_snap_pos = dictTypeService.selectDictDataByType("so2_snap_pos");
|
|
List<SysDictData> so2_snap_pos = dictTypeService.selectDictDataByType("so2_snap_pos");
|
|
Map<String, Object> result = new HashMap<>();
|
|
Map<String, Object> result = new HashMap<>();
|
|
for (SysDictData so2_snap_po : so2_snap_pos) {
|
|
for (SysDictData so2_snap_po : so2_snap_pos) {
|
|
result.put(so2_snap_po.getDictLabel(),
|
|
result.put(so2_snap_po.getDictLabel(),
|
|
- (ObjectUtil.isEmpty(aisAggs.get(so2_snap_po.getDictLabel())) ? 0 : Convert.toInt(aisAggs.get(so2_snap_po.getDictLabel())))
|
|
|
|
- + (ObjectUtil.isEmpty(so2Aggs.get(so2_snap_po.getDictLabel())) ? 0 : Convert.toInt(so2Aggs.get(so2_snap_po.getDictLabel()))));
|
|
|
|
|
|
+ (ObjectUtil.isEmpty(so2Aggs.get(so2_snap_po.getDictLabel())) ? 0 : Convert.toInt(so2Aggs.get(so2_snap_po.getDictLabel()))));
|
|
}
|
|
}
|
|
return AjaxResult.success(result);
|
|
return AjaxResult.success(result);
|
|
}
|
|
}
|
|
@@ -283,8 +281,7 @@ public class So2Controller extends BaseController {
|
|
// 默认值为1个月
|
|
// 默认值为1个月
|
|
interval = "1M";
|
|
interval = "1M";
|
|
}
|
|
}
|
|
- Map<String, Object> so2RangeCondition = new HashMap<>();
|
|
|
|
- Map<String, Object> heiyanRangeCondition = new HashMap<>();
|
|
|
|
|
|
+ Map<String, Object> rangeCondition = new HashMap<>();
|
|
if (!StrUtil.isAllBlank(startMonth, endMonth)) {
|
|
if (!StrUtil.isAllBlank(startMonth, endMonth)) {
|
|
if (StrUtil.isNotBlank(startMonth)) {
|
|
if (StrUtil.isNotBlank(startMonth)) {
|
|
startMonth = startMonth + "-01 00:00:00";
|
|
startMonth = startMonth + "-01 00:00:00";
|
|
@@ -292,12 +289,14 @@ public class So2Controller extends BaseController {
|
|
if (StrUtil.isNotBlank(endMonth)) {
|
|
if (StrUtil.isNotBlank(endMonth)) {
|
|
endMonth = DateUtil.formatDate(DateUtil.endOfMonth(DateUtil.parseDate(endMonth + "-01 00:00:00"))) + " 23:59:59";
|
|
endMonth = DateUtil.formatDate(DateUtil.endOfMonth(DateUtil.parseDate(endMonth + "-01 00:00:00"))) + " 23:59:59";
|
|
}
|
|
}
|
|
- so2RangeCondition.put("createTime", StrUtil.concat(true, "[", startMonth, ",", endMonth, "]"));
|
|
|
|
- heiyanRangeCondition.put("snapTimeFmt", StrUtil.concat(true, "[", startMonth, ",", endMonth, "]"));
|
|
|
|
|
|
+ rangeCondition.put("createTime", StrUtil.concat(true, "[", startMonth, ",", endMonth, "]"));
|
|
}
|
|
}
|
|
- Map<Object, Object> aisAggs = client.dateHistogramAggs(ElasticConstants.AIS_ILLEGAL_SHIP, AggsType.count, "peakTime", "id", null, so2RangeCondition, new DateHistogramInterval(interval));
|
|
|
|
- Map<Object, Object> so2Aggs = client.dateHistogramAggs(ElasticConstants.SO2_ALERT, AggsType.count, "createTime", "id", null, so2RangeCondition, new DateHistogramInterval(interval));
|
|
|
|
- Map<Object, Object> heiyanAggs = client.dateHistogramAggs(ElasticConstants.HEIYAN_SHIP_RECOGNITION, AggsType.count, "snapTimeFmt", "id", null, heiyanRangeCondition, new DateHistogramInterval(interval));
|
|
|
|
|
|
+ Map<String, Object> equalsCondition = new HashMap<>();
|
|
|
|
+ equalsCondition.put("illegalStatus", 2);
|
|
|
|
+ Map<Object, Object> aisAggs = client.dateHistogramAggs(ElasticConstants.AIS_ILLEGAL_SHIP, AggsType.count, "createTime", "id", equalsCondition, rangeCondition, new DateHistogramInterval(interval));
|
|
|
|
+ Map<Object, Object> so2Aggs = client.dateHistogramAggs(ElasticConstants.SO2_ALERT, AggsType.count, "createTime", "id", equalsCondition, rangeCondition, new DateHistogramInterval(interval));
|
|
|
|
+ equalsCondition.put("illegalStatus", 3);
|
|
|
|
+ Map<Object, Object> heiyanAggs = client.dateHistogramAggs(ElasticConstants.HEIYAN_SHIP_RECOGNITION, AggsType.count, "createTime", "id", equalsCondition, rangeCondition, new DateHistogramInterval(interval));
|
|
Map<String, Map<Object, Object>> result = new HashMap<>();
|
|
Map<String, Map<Object, Object>> result = new HashMap<>();
|
|
result.put("ais", aisAggs);
|
|
result.put("ais", aisAggs);
|
|
result.put("so2", so2Aggs);
|
|
result.put("so2", so2Aggs);
|