Browse Source

orglevel枚举类型

dev_shibei_match
jianjun 4 years ago
parent
commit
4e9ff4fe5f
  1. 51
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/OrgLevelEnum.java
  2. 20
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java
  3. 9
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml

51
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;
}
}

20
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.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.OrgLevelEnum;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.constant.IndexConstant; import com.epmet.datareport.constant.IndexConstant;
@ -129,9 +130,9 @@ public class IndexExplainServiceImpl implements IndexExplainService {
ablityListFormDTO.setOrgId(formDTO.getOrgId()); ablityListFormDTO.setOrgId(formDTO.getOrgId());
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath); ablityListFormDTO.setAllParentIndexCode(allIndexCodePath);
ablityListFormDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId()); ablityListFormDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId());
switch (orgLevel) { OrgLevelEnum anEnum = OrgLevelEnum.getEnum(orgLevel);
case "grid": switch (anEnum) {
case GRID:
if (IndexConstant.ZI_SHEN.equals(type)) { if (IndexConstant.ZI_SHEN.equals(type)) {
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null);
//不下钻 //不下钻
@ -144,20 +145,18 @@ public class IndexExplainServiceImpl implements IndexExplainService {
realScoreList = factIndexCpcSubScoreDao.selecCpcAvgScore(ablityListFormDTO); realScoreList = factIndexCpcSubScoreDao.selecCpcAvgScore(ablityListFormDTO);
} }
break; break;
case "community": case COMMUNITY:
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null);
//不下钻 //不下钻
realScoreList = communitySubScoreDao.selectSubScore(ablityListFormDTO); realScoreList = communitySubScoreDao.selectSubScore(ablityListFormDTO);
break; break;
case "street": case STREET:
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null);
//不下钻 //不下钻
realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO);
break; break;
case "district": case DISTRICT:
System.out.println("========" + allIndexCodePath);
if (allIndexCodePath.contains(IndexConstant.ZHI_LI_NENG_LI)) { if (allIndexCodePath.contains(IndexConstant.ZHI_LI_NENG_LI)) {
List<IndexGroupDetailResult> detailResults = detailEntityMap.get(allIndexCodePath); List<IndexGroupDetailResult> detailResults = detailEntityMap.get(allIndexCodePath);
@ -171,7 +170,7 @@ public class IndexExplainServiceImpl implements IndexExplainService {
realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO);
break; break;
} else { } else {
//下钻 //下钻到区直部门
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null); setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath, null);
ablityListFormDTO.setPid(formDTO.getOrgId()); ablityListFormDTO.setPid(formDTO.getOrgId());
realScoreList = deptSubScoreDao.selecDeptAvgScore(ablityListFormDTO); realScoreList = deptSubScoreDao.selecDeptAvgScore(ablityListFormDTO);
@ -183,10 +182,9 @@ public class IndexExplainServiceImpl implements IndexExplainService {
realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO); realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO);
} }
break; break;
default: default:
log.error("暂不支持更高级别的查询,level:{}",orgLevel);
} }
setRealValue(result.getTableDataList(), realScoreList); setRealValue(result.getTableDataList(), realScoreList);

9
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml

@ -53,14 +53,7 @@
fact.del_flag = '0' fact.del_flag = '0'
AND fact.all_parent_index_code = #{allParentIndexCode} AND fact.all_parent_index_code = #{allParentIndexCode}
AND customer_id = #{customerId} AND customer_id = #{customerId}
<choose> AND agency_id = #{orgId}
<when test="pid != null and pid != ''">
AND PARENT_AGENCY_ID = #{pid}
</when>
<otherwise>
AND agency_id = #{orgId}
</otherwise>
</choose>
AND month_id = #{monthId} AND month_id = #{monthId}
</select> </select>

Loading…
Cancel
Save