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 f72dab9d9a..c18a0e4c08 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 @@ -348,9 +348,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setSatisfactionCount(dto.getCount()); entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -358,12 +362,16 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe List gridList = factOriginProjectLogDailyService.getGridSelfDaily(customerId, dateId); if (CollectionUtils.isNotEmpty(gridList)) { list.forEach(entity -> gridList.stream().filter(gridAbility -> entity.getOrgId().equals(gridAbility.getOrgId())).forEach(grid -> { - BigDecimal resolveCount = new BigDecimal(grid.getSum()); - BigDecimal selfCount = new BigDecimal(grid.getCount()); if (grid.getSum() != NumConstant.ZERO) { - entity.setGovernRatio(selfCount.multiply(hundred).divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setGovernCount(grid.getCount()); entity.setClosedCount(grid.getSum()); + BigDecimal resolveCount = new BigDecimal(grid.getSum()); + BigDecimal selfCount = new BigDecimal(grid.getCount()); + BigDecimal ratio = selfCount.multiply(hundred).divide(resolveCount, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -375,13 +383,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); + entity.setResponseCount(dto.getCount()); + entity.setTransferCount(dto.getSum()); 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()); } })); } @@ -393,9 +401,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedCount(dto.getCount()); entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } @@ -434,9 +446,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setSatisfactionCount(dto.getCount()); entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -465,9 +481,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setGovernCount(dto.getCount()); entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -479,9 +499,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedCount(dto.getCount()); entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } @@ -519,9 +543,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setSatisfactionCount(dto.getCount()); entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -550,9 +578,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setGovernCount(dto.getCount()); entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -564,9 +596,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedCount(dto.getCount()); entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } @@ -604,9 +640,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setSatisfactionRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setSatisfactionCount(dto.getCount()); entity.setClosedProjectCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setSatisfactionRatio(ratio); } })); } @@ -635,9 +675,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setGovernRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setGovernCount(dto.getCount()); entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setGovernRatio(ratio); } })); } @@ -649,9 +693,13 @@ public class GovernRankDataExtractServiceImpl implements GovernRankDataExtractSe if (dto.getSum() != NumConstant.ZERO) { BigDecimal sum = new BigDecimal(dto.getSum()); BigDecimal count = new BigDecimal(dto.getCount()); - entity.setResolvedRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP)); entity.setResolvedCount(dto.getCount()); entity.setClosedCount(dto.getSum()); + BigDecimal ratio = count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP); + if (ratio.compareTo(hundred) > 0) { + ratio = hundred; + } + entity.setResolvedRatio(ratio); } })); } 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 d98b98f8b9..280de575cf 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 @@ -694,7 +694,10 @@ DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId} AND ( ACTION_CODE = 'response' OR ACTION_CODE = 'close' OR ACTION_CODE = 'transfer' OR ACTION_CODE = 'created' ) - AND PROJECT_ID IN ( SELECT ID FROM fact_origin_project_main_daily WHERE DEL_FLAG = 0 AND PROJECT_STATUS = 'closed' AND ORIGIN = "issue") + AND PROJECT_ID IN ( + SELECT ID FROM fact_origin_project_main_daily WHERE DEL_FLAG = 0 AND PROJECT_STATUS = 'closed' AND ORIGIN = 'issue' + AND CUSTOMER_ID = #{customerId} + AND DATE_ID <= #{dateId}) GROUP BY PROJECT_ID HAVING @@ -761,7 +764,9 @@ DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId} AND ( ACTION_CODE = 'response' OR ACTION_CODE = 'close' OR ACTION_CODE = 'transfer' OR ACTION_CODE = 'created' ) - AND PROJECT_ID IN ( SELECT ID FROM fact_origin_project_main_daily WHERE DEL_FLAG = 0 AND PROJECT_STATUS = 'closed' AND ORIGIN = "issue" ) + AND PROJECT_ID IN ( SELECT ID FROM fact_origin_project_main_daily WHERE DEL_FLAG = 0 AND PROJECT_STATUS = 'closed' AND ORIGIN = 'issue' + AND CUSTOMER_ID = #{customerId} + AND DATE_ID <= #{dateId}) GROUP BY PROJECT_ID HAVING