Commit ac4071a9 authored by suhuiguang's avatar suhuiguang

1.检验检测大屏接口接口开发

parent c692702c
...@@ -285,10 +285,10 @@ ...@@ -285,10 +285,10 @@
a.inspection_unit_code= b.use_unit_code a.inspection_unit_code= b.use_unit_code
and a.status != '6610' and a.status != '6615' and a.status != '6610' and a.status != '6615'
and b.supervise_org_code like CONCAT(#{orgCode}, '%') and b.supervise_org_code like CONCAT(#{orgCode}, '%')
<if test="dto.beginDate !=null"> <if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(a.application_date as date),#{dto.beginDate}) and date_ge(CAST(a.application_date as date),#{dto.beginDate})
</if> </if>
<if test="dto.endDate !=null"> <if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(a.application_date as date),#{dto.endDate}) and date_le(CAST(a.application_date as date),#{dto.endDate})
</if> </if>
</select> </select>
......
...@@ -465,12 +465,13 @@ public class DPStatisticsServiceImpl { ...@@ -465,12 +465,13 @@ public class DPStatisticsServiceImpl {
private void buildYDataForJyTime(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) { private void buildYDataForJyTime(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) {
// 1.检验检测临期设备数数量统计 // 1.检验检测临期设备数数量统计
staticsCenterMapCountDataForJyTimeTemporary(result, dpFilterParamDto, equipmentCategoryDtos); result.put("approach", staticsCenterMapCountDataForJyTimeTemporary(dpFilterParamDto, equipmentCategoryDtos));
// 2.检验检测超期设备数数量统计 // 2.检验检测超期设备数数量统计
staticsCenterMapCountDataForJyTimeOverdue(result, dpFilterParamDto, equipmentCategoryDtos); result.put("overdue", staticsCenterMapCountDataForJyTimeOverdue(dpFilterParamDto, equipmentCategoryDtos));
} }
private void staticsCenterMapCountDataForJyTimeTemporary(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) { private List<Long> staticsCenterMapCountDataForJyTimeTemporary(DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) {
List<Long> seresData = new ArrayList<>();
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
...@@ -480,12 +481,10 @@ public class DPStatisticsServiceImpl { ...@@ -480,12 +481,10 @@ public class DPStatisticsServiceImpl {
boolMust.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", true)); boolMust.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", true));
// 且在用状态设备 // 且在用状态设备
boolMust.must(QueryBuilders.termQuery("EQU_STATE", EquimentEnum.ZAIYONG.getCode())); boolMust.must(QueryBuilders.termQuery("EQU_STATE", EquimentEnum.ZAIYONG.getCode()));
// 且下次检验日期大于等于当天 // 且下次检验日期大于等于当天 且查询 下次检验日期 <= 当前天+30天 极为临期
long currentDayTime = DateUtil.parse(DateUtil.today(), "yyy-MM-dd").getTime(); long currentDayTime = DateUtil.parse(DateUtil.today(), "yyy-MM-dd").getTime();
boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE").gte(currentDayTime));
// 且查询 下次检验日期 <= 当前天+30天 极为临期
long currentDayAfter30DayTime = DateUtil.offsetDay(DateUtil.parse(DateUtil.today(), "yyy-MM-dd"), 30).getTime(); long currentDayAfter30DayTime = DateUtil.offsetDay(DateUtil.parse(DateUtil.today(), "yyy-MM-dd"), 30).getTime();
boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE").lte(currentDayAfter30DayTime)); boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE").gte(currentDayTime).lte(currentDayAfter30DayTime));
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
builder.query(boolMust); builder.query(boolMust);
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("count_by_equ_list_code").field("EQU_LIST_CODE"); TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("count_by_equ_list_code").field("EQU_LIST_CODE");
...@@ -500,14 +499,16 @@ public class DPStatisticsServiceImpl { ...@@ -500,14 +499,16 @@ public class DPStatisticsServiceImpl {
} }
// 按照8大类枚举,进行加工。目的:固定八大类防止没统计数据导致缺少分类、将设备种类的code换成前端定义的key // 按照8大类枚举,进行加工。目的:固定八大类防止没统计数据导致缺少分类、将设备种类的code换成前端定义的key
equipmentCategoryDtos.forEach(c -> { equipmentCategoryDtos.forEach(c -> {
result.put(c.getName(), countMap.getOrDefault(c.getCode(), 0L)); seresData.add(countMap.getOrDefault(c.getCode(), 0L));
}); });
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return seresData;
} }
private void staticsCenterMapCountDataForJyTimeOverdue(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) { private List<Long> staticsCenterMapCountDataForJyTimeOverdue(DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) {
List<Long> seresData = new ArrayList<>();
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
...@@ -534,11 +535,12 @@ public class DPStatisticsServiceImpl { ...@@ -534,11 +535,12 @@ public class DPStatisticsServiceImpl {
} }
// 按照8大类枚举,进行加工。目的:固定八大类防止没统计数据导致缺少分类、将设备种类的code换成前端定义的key // 按照8大类枚举,进行加工。目的:固定八大类防止没统计数据导致缺少分类、将设备种类的code换成前端定义的key
equipmentCategoryDtos.forEach(c -> { equipmentCategoryDtos.forEach(c -> {
result.put(c.getName(), countMap.getOrDefault(c.getCode(), 0L)); seresData.add(countMap.getOrDefault(c.getCode(), 0L));
}); });
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return seresData;
} }
private Object getLegendDataForJyTime() { private Object getLegendDataForJyTime() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment