|
@ -22,6 +22,7 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.enums.OrgLevelEnum; |
|
|
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.FactConstant; |
|
|
import com.epmet.datareport.constant.IndexConstant; |
|
|
import com.epmet.datareport.constant.IndexConstant; |
|
|
import com.epmet.datareport.dao.evaluationindex.index.IndexExplainDao; |
|
|
import com.epmet.datareport.dao.evaluationindex.index.IndexExplainDao; |
|
|
import com.epmet.datareport.dao.evaluationindex.index.IndexGroupDetailDao; |
|
|
import com.epmet.datareport.dao.evaluationindex.index.IndexGroupDetailDao; |
|
@ -187,7 +188,7 @@ public class IndexExplainServiceImpl implements IndexExplainService { |
|
|
log.error("暂不支持更高级别的查询,level:{}", orgLevel); |
|
|
log.error("暂不支持更高级别的查询,level:{}", orgLevel); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setRealValue(result.getTableDataList(), realScoreList); |
|
|
setRealValue(result.getTableDataList(), realScoreList, tableHeaders); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -196,11 +197,12 @@ public class IndexExplainServiceImpl implements IndexExplainService { |
|
|
* |
|
|
* |
|
|
* @param tableList |
|
|
* @param tableList |
|
|
* @param scoreList |
|
|
* @param scoreList |
|
|
|
|
|
* @param tableHeaders |
|
|
* @return void |
|
|
* @return void |
|
|
* @author LiuJanJun |
|
|
* @author LiuJanJun |
|
|
* @date 2021/5/19 2:07 下午 |
|
|
* @date 2021/5/19 2:07 下午 |
|
|
*/ |
|
|
*/ |
|
|
private void setRealValue(List<IndexScoreDetailResult> tableList, List<IndexScoreResult> scoreList) { |
|
|
private void setRealValue(List<IndexScoreDetailResult> tableList, List<IndexScoreResult> scoreList, List<String> tableHeaders) { |
|
|
if (CollectionUtils.isEmpty(tableList) || CollectionUtils.isEmpty(scoreList)) { |
|
|
if (CollectionUtils.isEmpty(tableList) || CollectionUtils.isEmpty(scoreList)) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -209,19 +211,37 @@ public class IndexExplainServiceImpl implements IndexExplainService { |
|
|
if (!tb.getIndexCode().equals(score.getIndexCode())) { |
|
|
if (!tb.getIndexCode().equals(score.getIndexCode())) { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
tb.setOriginValue(score.getOriginValue()); |
|
|
|
|
|
tb.setScore(String.valueOf(score.getScore())); |
|
|
tb.setScore(String.valueOf(score.getScore())); |
|
|
if (StringUtils.isNotBlank(score.getQuantity())) { |
|
|
tb.setWeight(score.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(0, BigDecimal.ROUND_HALF_UP) + "%"); |
|
|
tb.setQuantity(score.getQuantity()); |
|
|
if (tableHeaders.contains("平均值")) { |
|
|
|
|
|
if (StringUtils.isNotBlank(score.getSampleCount())) { |
|
|
|
|
|
tb.setOriginValue(score.getSampleCount()); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
tb.setOriginValue(score.getOriginValue()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//小数类型,四舍五入保留小数点后一位
|
|
|
|
|
|
if (FactConstant.INTEGER.equals(score.getValueType())) { |
|
|
|
|
|
BigDecimal num = new BigDecimal(tb.getOriginValue()).setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
|
|
tb.setOriginValue(num.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (FactConstant.DECIMAL.equals(score.getValueType())) { |
|
|
|
|
|
BigDecimal num = new BigDecimal(tb.getOriginValue()).setScale(1, BigDecimal.ROUND_HALF_UP); |
|
|
|
|
|
tb.setOriginValue(num.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
//百分数类型,四舍五入保留小数点后一位并转成百分比
|
|
|
|
|
|
if (FactConstant.PERCENT.equals(score.getValueType())) { |
|
|
|
|
|
BigDecimal num = new BigDecimal(tb.getOriginValue()).setScale(1, BigDecimal.ROUND_HALF_UP); |
|
|
|
|
|
tb.setOriginValue(num + "%"); |
|
|
} |
|
|
} |
|
|
tb.setWeight(score.getWeight().multiply(new BigDecimal(NumConstant.ONE_HUNDRED)) + "%"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private List<IndexScoreDetailResult> setDefaultTableData(String orgLevel, String type, Map<String, List<IndexGroupDetailResult>> detailEntityMap, |
|
|
private List<IndexScoreDetailResult> setDefaultTableData(String orgLevel, String type, Map<String, List<IndexGroupDetailResult>> detailEntityMap, |
|
|
IndexExplainResult result, String allIndexCodePath, List<IndexGroupDetailResult> indexGroupDetailEntities) { |
|
|
IndexExplainResult result, String allIndexCodePath, List<IndexGroupDetailResult> indexGroupDetailEntities) { |
|
|
|
|
|
|
|
|
if (indexGroupDetailEntities == null) { |
|
|
if (indexGroupDetailEntities == null) { |
|
|
indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath); |
|
|
indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath); |
|
|
} |
|
|
} |
|
@ -236,15 +256,18 @@ public class IndexExplainServiceImpl implements IndexExplainService { |
|
|
if ("grid".equals(orgLevel) && IndexConstant.ZI_SHEN.equals(type) && index.getAllIndexCodePath().contains(IndexConstant.XIA_JI)) { |
|
|
if ("grid".equals(orgLevel) && IndexConstant.ZI_SHEN.equals(type) && index.getAllIndexCodePath().contains(IndexConstant.XIA_JI)) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if ((!"grid".equals(orgLevel) && !"district".equals(orgLevel)) && !index.getAllIndexCodePath().contains(type)) { |
|
|
if ("district".equals(orgLevel) && !index.getAllIndexCodePath().contains(type) && !index.getAllIndexCodePath().contains(IndexConstant.ZHI_LI_NENG_LI)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!"grid".equals(orgLevel) && !"district".equals(orgLevel) && !index.getAllIndexCodePath().contains(type)) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
table.setIndexCode(index.getIndexCode()); |
|
|
table.setIndexCode(index.getIndexCode()); |
|
|
table.setIndexName(index.getIndexName()); |
|
|
table.setIndexName(index.getIndexName()); |
|
|
table.setOriginValue(NumConstant.ZERO_STR); |
|
|
table.setOriginValue(NumConstant.ZERO_STR); |
|
|
table.setScore(NumConstant.ZERO_STR); |
|
|
table.setScore(NumConstant.ZERO_STR); |
|
|
table.setWeight(index.getWeight().multiply(new BigDecimal(100)).setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP) + "%"); |
|
|
table.setWeight(index.getWeight().multiply(new BigDecimal(100)).setScale(0, BigDecimal.ROUND_HALF_UP) + "%"); |
|
|
table.setQuantity(NumConstant.ZERO_STR); |
|
|
table.setType(type); |
|
|
tableList.add(table); |
|
|
tableList.add(table); |
|
|
if (new BigDecimal(-1).compareTo(index.getThreshold()) != 0) { |
|
|
if (new BigDecimal(-1).compareTo(index.getThreshold()) != 0) { |
|
|
threlodList.add(index.getIndexName().concat(String.format(IndexConstant.THRESHOLD_TEXT, index.getThreshold().intValue()))); |
|
|
threlodList.add(index.getIndexName().concat(String.format(IndexConstant.THRESHOLD_TEXT, index.getThreshold().intValue()))); |
|
|