Browse Source

接口逻辑调整

dev_shibei_match
sunyuchao 5 years ago
parent
commit
2d255320e7
  1. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AblityListResultDTO.java
  2. 24
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java
  3. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml

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

24
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<AblityIndexResultDTO.ScoreListResultDTO> nlList = new LinkedList<>();
for (int i = 0; i < djList.size(); i++) {
@ -357,11 +361,9 @@ public class FactIndexServiceImpl implements FactIndexService {
//4.查询指标字典表数据
List<IndexDictResultDTO> 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;
}

1
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'
</select>
<select id="selectIndexDict" resultType="com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO">

Loading…
Cancel
Save