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