Browse Source

最大值最小值加上了判断

dev_shibei_match
zxc 5 years ago
parent
commit
141a414a2b
  1. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/MaxAndMinBigDecimalResultDTO.java
  2. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/MaxAndMinBigDecimalResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.screen.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
@ -18,4 +19,8 @@ public class MaxAndMinBigDecimalResultDTO implements Serializable {
private BigDecimal max;
public MaxAndMinBigDecimalResultDTO() {
this.min = new BigDecimal(NumConstant.ZERO);
this.max = new BigDecimal(NumConstant.ZERO);
}
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java

@ -451,11 +451,13 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
* @date 2020/8/27 1:30 下午
*/
public MaxAndMinBigDecimalResultDTO getMaxAndMinBigDecimal(List<BigDecimal> list) {
BigDecimal max = Collections.max(list);
BigDecimal min = Collections.min(list);
MaxAndMinBigDecimalResultDTO result = new MaxAndMinBigDecimalResultDTO();
result.setMax(max);
result.setMin(min);
if(!CollectionUtils.isEmpty(list)) {
BigDecimal max = Collections.max(list);
BigDecimal min = Collections.min(list);
result.setMax(max);
result.setMin(min);
}
return result;
}

Loading…
Cancel
Save