diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java index 8377391764..f72dab9d9a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/GovernRankDataExtractServiceImpl.java @@ -375,7 +375,11 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); entity.setResponseCount(dto.getCount()); entity.setTransferCount(dto.getSum()); } @@ -444,7 +448,11 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); entity.setResponseCount(dto.getCount()); entity.setTransferCount(dto.getSum()); } @@ -525,7 +533,11 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); entity.setResponseCount(dto.getCount()); entity.setTransferCount(dto.getSum()); } @@ -606,7 +618,11 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResponseRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResponseRatio(ratio); entity.setResponseCount(dto.getCount()); entity.setTransferCount(dto.getSum()); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml index b5a2fe362f..32a1e56b98 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -297,8 +297,7 @@ SELECT a.AGENCY_ID, a.count AS "sum", - IFNULL( b.count, - 0 ) AS "count" + IFNULL( b.count, 0 ) + IFNULL( c.count, 0 ) AS "count" FROM (SELECT da.ID AS AGENCY_ID, COUNT( f.ID ) AS "count" @@ -599,12 +620,24 @@ AND f.DATE_ID <= #{dateId} GROUP BY da.ID ) b ON a.AGENCY_ID = b.AGENCY_ID + LEFT JOIN + (SELECT da.ID AS AGENCY_ID, + COUNT(DISTINCT f.ID ) AS "count" + FROM fact_origin_project_log_daily f + INNER JOIN dim_agency da ON f.PIDS LIKE CONCAT( '%', da.ID, '%' ) + AND da.`LEVEL` = #{level} + WHERE + ACTION_CODE = 'response' + AND f.IS_ACTIVE = 1 + AND f.CUSTOMER_ID = #{customerId} + AND f.DATE_ID <= #{dateId} + GROUP BY da.ID ) c + ON a.AGENCY_ID = c.AGENCY_ID