From 4e9ff4fe5f5ae04b83c031ab159b6167d5196581 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 20 May 2021 17:54:25 +0800 Subject: [PATCH] =?UTF-8?q?orglevel=E6=9E=9A=E4=B8=BE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/enums/OrgLevelEnum.java | 51 +++++++++++++++++++ .../index/impl/IndexExplainServiceImpl.java | 20 ++++---- .../fact/FactIndexAgencySubScoreDao.xml | 9 +--- 3 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/OrgLevelEnum.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/OrgLevelEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/OrgLevelEnum.java new file mode 100644 index 0000000000..3462ad772b --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/OrgLevelEnum.java @@ -0,0 +1,51 @@ +package com.epmet.commons.tools.enums; + +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; + +/** + * 组织级别枚举类 + * dev|test|prod + * + * @author jianjun liu + * @date 2020-07-03 11:14 + **/ +public enum OrgLevelEnum { + /** + * 组织等级枚举 + */ + GRID("grid"), + COMMUNITY("community"), + STREET("street"), + DISTRICT("district"), + CITY("city"), + PROVINCE("province"), + ; + + private String code; + + + + + OrgLevelEnum(String code) { + this.code = code; + + } + + public static OrgLevelEnum getEnum(String code) { + OrgLevelEnum[] values = OrgLevelEnum.values(); + for (OrgLevelEnum value : values) { + if (value.getCode().equals(code)) { + return value; + } + } + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode()); + } + + + + + public String getCode() { + return code; + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java index 6ca654a4ec..a08c32bc6e 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.datareport.service.evaluationindex.index.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.enums.OrgLevelEnum; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.constant.IndexConstant; @@ -129,9 +130,9 @@ public class IndexExplainServiceImpl implements IndexExplainService { ablityListFormDTO.setOrgId(formDTO.getOrgId()); ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); ablityListFormDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId()); - switch (orgLevel) { - case "grid": - + OrgLevelEnum anEnum = OrgLevelEnum.getEnum(orgLevel); + switch (anEnum) { + case GRID: if (IndexConstant.ZI_SHEN.equals(type)) { setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); //不下钻 @@ -144,20 +145,18 @@ public class IndexExplainServiceImpl implements IndexExplainService { realScoreList = factIndexCpcSubScoreDao.selecCpcAvgScore(ablityListFormDTO); } - break; - case "community": + case COMMUNITY: setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); //不下钻 realScoreList = communitySubScoreDao.selectSubScore(ablityListFormDTO); break; - case "street": + case STREET: setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); //不下钻 realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); break; - case "district": - System.out.println("========" + allIndexCodePath); + case DISTRICT: if (allIndexCodePath.contains(IndexConstant.ZHI_LI_NENG_LI)) { List detailResults = detailEntityMap.get(allIndexCodePath); @@ -171,7 +170,7 @@ public class IndexExplainServiceImpl implements IndexExplainService { realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); break; } else { - //下钻 + //下钻到区直部门 setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); ablityListFormDTO.setPid(formDTO.getOrgId()); realScoreList = deptSubScoreDao.selecDeptAvgScore(ablityListFormDTO); @@ -183,10 +182,9 @@ public class IndexExplainServiceImpl implements IndexExplainService { realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); } - break; default: - + log.error("暂不支持更高级别的查询,level:{}",orgLevel); } setRealValue(result.getTableDataList(), realScoreList); diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml index 481d5be0f1..954ce4c772 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml @@ -53,14 +53,7 @@ fact.del_flag = '0' AND fact.all_parent_index_code = #{allParentIndexCode} AND customer_id = #{customerId} - - - AND PARENT_AGENCY_ID = #{pid} - - - AND agency_id = #{orgId} - - + AND agency_id = #{orgId} AND month_id = #{monthId}