Commit 8be0d8ad authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 49ae2857 cecbaebe
......@@ -118,8 +118,9 @@
FROM
tz_alert_called
WHERE
biz_org_code like concat(#{orgCode}, '%')
and (alarm_type_code = '960' or alarm_type_code = '961')
is_delete = 0
and biz_org_code like concat(#{orgCode}, '%')
and (alarm_type_code = '960' or alarm_type_code = '961' or alarm_type_code = '962')
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(call_time as date),#{dto.beginDate})
</if>
......
......@@ -631,14 +631,25 @@ public class JGDPStatisticsServiceImpl {
this.setDefaultFilter(dpFilterParamDto);
result.put("xdata", Arrays.asList("安装告知", "监督检验", "使用登记", "定期检验", "变更登记", "注销报废"));
List<Long> ydata = this.countBizFinishedNum(dpFilterParamDto);
Long allFinishedCount = ydata.stream().mapToLong(e -> e).sum();
result.put("ydata", ydata);
Long allFinishedCount = this.calEveryAll(dpFilterParamDto, ydata).stream().mapToLong(e -> e).sum();
result.put("ydata", this.calEveryAll(dpFilterParamDto, ydata));
result.put("allCount", allFinishedCount);
result.put("percentData", this.calEveryPercent(dpFilterParamDto, ydata));
result.put("completionRate", this.calPercentForBizCycleData(dpFilterParamDto, allFinishedCount));
return result;
}
private List<Long> calEveryAll(DPFilterParamDto dpFilterParamDto, List<Long> everyFinished) {
List<Long> everyInFlow = countBizDataInFlowing(dpFilterParamDto);
List<Long> allArray = new ArrayList<>();
for (int i = 0; i < everyInFlow.size(); i++) {
Long flowIng = everyInFlow.get(i);
Long finished = everyFinished.get(i);
allArray.add(flowIng+finished);
}
return allArray;
}
private List<String> calEveryPercent(DPFilterParamDto dpFilterParamDto, List<Long> everyFinished) {
List<Long> everyInFlow = countBizDataInFlowing(dpFilterParamDto);
List<String> percentArray = new ArrayList<>();
......@@ -650,8 +661,7 @@ public class JGDPStatisticsServiceImpl {
BigDecimal all = flowIngBig.add(finishedBig);
if (all.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal percent = finishedBig.divide(all, 2, RoundingMode.HALF_UP);
BigDecimal percentX100 = percent.multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP);
percentArray.add(percentX100.toPlainString());
percentArray.add(percent.toPlainString());
} else {
percentArray.add("0");
}
......@@ -717,7 +727,7 @@ public class JGDPStatisticsServiceImpl {
boolMust.must(QueryBuilders.termsQuery("EQU_LIST_CODE", StCommonServiceImpl.getEquipmentCategory().stream().map(EquipmentCategoryDto::getCode).collect(Collectors.toList())));
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.query(boolMust);
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("EQU_STATE_COUNT").field("EQU_STATE").size(20);
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("EQU_STATE_COUNT").field("EQU_STATE").size(20).missing(EquimentEnum.WEIDENGJI.getCode());
builder.aggregation(aggregationBuilder);
builder.size(0);
request.source(builder);
......@@ -730,7 +740,7 @@ public class JGDPStatisticsServiceImpl {
long docCount = bucket.getDocCount();
dataMap.put(category, docCount);
}
resultList = Arrays.stream(EquimentEnum.values()).filter(e -> e.getCode() > 0).map(e -> {
resultList = Arrays.stream(EquimentEnum.values()).map(e -> {
Map<String, Object> map = new HashMap<>();
map.put("name", e.getName());
map.put("value", dataMap.getOrDefault(e.getCode().toString(), 0L));
......@@ -1562,12 +1572,11 @@ public class JGDPStatisticsServiceImpl {
BigDecimal all = everyNum.add(finishedNum);
if (all.compareTo(BigDecimal.ZERO) > 0) {
BigDecimal percent = finishedNum.divide(all, 2, RoundingMode.HALF_UP);
BigDecimal percentX100 = percent.multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP);
itemResult.put("percentData", percentX100.toPlainString());
itemResult.put("percentData", percent.toPlainString());
} else {
itemResult.put("percentData", "0");
}
itemResult.put("finishedNum", finishedNum);
itemResult.put("finishedNum", all);
return itemResult;
}).collect(Collectors.toList());
......
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