diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index d8c9efc155..b4076d39d6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java @@ -393,8 +393,15 @@ public class AgencyServiceImpl implements AgencyService { ScreenCustomerAgencyDTO rootAgency=screenCustomerAgencyDao.selectCustomerRootAgency(formDTO.getCustomerId()); agencysResultDTO.setRootlevel(rootAgency.getLevel()); agencysResultDTO.setRootAgencyId(rootAgency.getAgencyId()); + //3、当前登录用户所属客户,是否开启了area_code开关 - agencysResultDTO.setAreaCodeSwitch(govOrgOpenFeignClient.getAreaCodeSwitch(formDTO.getCustomerId()).getData()); + Result govOrgRes=govOrgOpenFeignClient.getAreaCodeSwitch(formDTO.getCustomerId()); + log.info("当前登录用户所属客户,是否开启了area_code开关,返参:"+ JSON.toJSONString(govOrgRes)); + if(govOrgRes.success()&&StringUtils.isNotBlank(govOrgRes.getData())){ + agencysResultDTO.setAreaCodeSwitch(govOrgRes.getData()); + }else{ + agencysResultDTO.setAreaCodeSwitch("closed"); + } //4、如果当前客户不存在子客户则areaCode置为空 Result> crmRes=operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId()); 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