| | |
| | | BigDecimal result = new BigDecimal(0); |
| | | |
| | | if (listData != null) { |
| | | BigDecimal totalDay = new BigDecimal(0); |
| | | BigDecimal totalValid = new BigDecimal(0); |
| | | |
| | | for (DailyCountUser history: listData) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | if (!history.isRate()) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } else { |
| | | totalDay = MoneyBigDecimalUtil.add(totalDay, history.getTotalDay()); |
| | | totalValid = MoneyBigDecimalUtil.add(totalValid, history.getTotalValid()); |
| | | } |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | if (!history.isRate()) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } else { |
| | | totalDay = MoneyBigDecimalUtil.add(totalDay, history.getTotalDay()); |
| | | totalValid = MoneyBigDecimalUtil.add(totalValid, history.getTotalValid()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 判断是否计算比例 |
| | | if ((dateType == 2 || dateType == 3) && totalDay.compareTo(BigDecimal.valueOf(0)) > 0){ |
| | | result = MoneyBigDecimalUtil.div(totalValid, totalDay); |
| | | result = MoneyBigDecimalUtil.mul(result, BigDecimal.valueOf(100)); |
| | | } |
| | | } |
| | | list.add(result); |
| | |
| | | BigDecimal result = new BigDecimal(0); |
| | | |
| | | if (listData != null) { |
| | | BigDecimal totalDay = new BigDecimal(0); |
| | | BigDecimal totalValid = new BigDecimal(0); |
| | | |
| | | for (DailyCountOrder history: listData) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | if (!history.isRate()) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } else { |
| | | totalDay = MoneyBigDecimalUtil.add(totalDay, history.getTotalDay()); |
| | | totalValid = MoneyBigDecimalUtil.add(totalValid, history.getTotalValid()); |
| | | } |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | if (!history.isRate()) { |
| | | result = MoneyBigDecimalUtil.add(result, history.getTotal()); |
| | | } else { |
| | | totalDay = MoneyBigDecimalUtil.add(totalDay, history.getTotalDay()); |
| | | totalValid = MoneyBigDecimalUtil.add(totalValid, history.getTotalValid()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 判断是否计算比例 |
| | | if ((dateType == 2 || dateType == 3) && totalDay.compareTo(BigDecimal.valueOf(0)) > 0){ |
| | | result = MoneyBigDecimalUtil.div(totalValid, totalDay); |
| | | result = MoneyBigDecimalUtil.mul(result, BigDecimal.valueOf(100)); |
| | | } |
| | | } |
| | | list.add(result); |
| | | } |