Browse Source

/ by zero

dev_shibei_match
yinzuomei 4 years ago
parent
commit
5a6d64e5e1
  1. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java

@ -155,21 +155,21 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
// 总参与数6月份比5月份增加了?
int incrTotal = latest.getTotal() - beforeTwoMonth.getTotal();
// 总参与数月增长:增加的占5月份的占比???
BigDecimal monthIncr = BigDecimal.valueOf(incrTotal / beforeTwoMonth.getTotal());
BigDecimal monthIncr = NumConstant.ZERO == beforeTwoMonth.getTotal() ? BigDecimal.ZERO : BigDecimal.valueOf(incrTotal / beforeTwoMonth.getTotal());
latest.setMonthIncr(monthIncr);
latest.setMonthTrend(monthIncr.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr");
//人均议题数6月份比五月份增加了?
BigDecimal issueIncrTotal = latest.getAverageIssue().subtract(beforeTwoMonth.getAverageIssue());
//人均议题数月增长:增加的占5月份的占比???
BigDecimal issueCompareLatestMonth = issueIncrTotal.divide(beforeTwoMonth.getAverageIssue(),2, RoundingMode.HALF_UP);
BigDecimal issueCompareLatestMonth = BigDecimal.ZERO.compareTo(beforeTwoMonth.getAverageIssue()) == 0 ? BigDecimal.ZERO : issueIncrTotal.divide(beforeTwoMonth.getAverageIssue(), 2, RoundingMode.HALF_UP);
latest.setIssueCompareLatestMonth(issueCompareLatestMonth);
latest.setIssueCompareLatestTrend(issueCompareLatestMonth.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr");
// 平均参与度6月份比5月份增加了?
BigDecimal incrJoinCompareLatestMonth=latest.getJoinCompareLatestMonth().subtract(beforeTwoMonth.getJoinCompareLatestMonth());
//平均参与度月增长:增加的占5月份的占比???
BigDecimal joinCompareLatestMonth=incrJoinCompareLatestMonth.divide(beforeTwoMonth.getJoinCompareLatestMonth(),2,RoundingMode.HALF_UP);
BigDecimal joinCompareLatestMonth = BigDecimal.ZERO.compareTo(beforeTwoMonth.getJoinCompareLatestMonth()) == 0 ? BigDecimal.ZERO : incrJoinCompareLatestMonth.divide(beforeTwoMonth.getJoinCompareLatestMonth(), 2, RoundingMode.HALF_UP);
latest.setJoinCompareLatestMonth(joinCompareLatestMonth);
latest.setJoinCompareLatestTrend(joinCompareLatestMonth.compareTo(BigDecimal.ZERO) > 0 ? "incr" : "decr");
}

Loading…
Cancel
Save