diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java index 2df53bff05..97c32e1994 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java @@ -25,5 +25,9 @@ public class AblityListResultDTO implements Serializable { * 各项指标对应key值(index_dict字典表) */ private String key; + /** + * 指标值类型 无:none;整数:integer;小数: decimal;百分比:percent + */ + private String showType; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java index 24efaa35c1..3793986f00 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java @@ -113,6 +113,10 @@ public class FactIndexServiceImpl implements FactIndexService { throw new RenException(String.format("能力指数查询,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } + if(djList.size()!=zlList.size()||djList.size()!=fwList.size()){ + throw new RenException(String.format("能力指数查询,查询出来的三大能力数据条数不一致,orgId:%s,orgType:%s,monthId:%s", formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getMonthId())); + } + //6.遍历计算每个月能力指数 LinkedList nlList = new LinkedList<>(); for (int i = 0; i < djList.size(); i++) { @@ -357,11 +361,9 @@ public class FactIndexServiceImpl implements FactIndexService { //4.查询指标字典表数据 List list = indexDictDao.selectList(); //5.遍历数据,判断数据类型并处理 - /*NumberFormat nf = NumberFormat.getPercentInstance(); - nf.setMaximumFractionDigits(1);*/ resultList.forEach(result -> { - list.forEach(l -> { - if (result.getKey().equals(l.getIndexCode())) { + list.stream().filter(dto -> dto.getIndexCode().equals(result.getKey())).forEach(l -> { + result.setShowType(l.getValueType()); //小数类型,四舍五入保留小数点后一位 if (FactConstant.DECIMAL.equals(l.getValueType())) { BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); @@ -372,7 +374,6 @@ public class FactIndexServiceImpl implements FactIndexService { BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); result.setValue(num+"%"); } - } }); }); @@ -422,22 +423,13 @@ public class FactIndexServiceImpl implements FactIndexService { } //7.遍历数据,判断数据类型并处理 - /*NumberFormat nf = NumberFormat.getPercentInstance(); - nf.setMaximumFractionDigits(1);*/ - //小数类型,四舍五入保留小数点后一位 - if (FactConstant.DECIMAL.equals(dictDTO.getValueType())) { + //小数或百分数类型,四舍五入保留小数点后一位 + if (FactConstant.DECIMAL.equals(dictDTO.getValueType()) || FactConstant.PERCENT.equals(dictDTO.getValueType())) { resultList.forEach(result -> { BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP); result.setAblity(num.toString()); }); } - //百分数类型,四舍五入保留小数点后一位并转成百分比 - if (FactConstant.PERCENT.equals(dictDTO.getValueType())) { - resultList.forEach(result -> { - BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP); - result.setAblity(num+"%"); - }); - } return resultList; } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml index 0784877dda..fffd0604bf 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml @@ -12,7 +12,6 @@ index_dict WHERE del_flag = '0' - AND value_type != 'none'