|
@@ -63,8 +63,10 @@ public class FeedDayServiceImpl extends ServiceImpl<FeedDayMapper, FeedDay> impl
|
|
|
if (feedDays.size() < 2) {
|
|
|
todayRatioBd = BigDecimal.ZERO;
|
|
|
}
|
|
|
- BigDecimal yesterdayCountBd = feedDays.get(1).getConsumption();
|
|
|
- todayRatioBd = (todayCountBd.subtract(yesterdayCountBd)).divide(yesterdayCountBd);
|
|
|
+ if (feedDays.size()>=2) {
|
|
|
+ BigDecimal yesterdayCountBd = feedDays.get(1).getConsumption();
|
|
|
+ todayRatioBd = (todayCountBd.subtract(yesterdayCountBd)).divide(yesterdayCountBd);
|
|
|
+ }
|
|
|
} else {
|
|
|
todayCountBd = BigDecimal.ZERO;
|
|
|
todayRatioBd = BigDecimal.ZERO;
|
|
@@ -79,11 +81,13 @@ public class FeedDayServiceImpl extends ServiceImpl<FeedDayMapper, FeedDay> impl
|
|
|
List<FeedMonth> feedMonths = feedMonthMapper.selectList(queryWrapper1);
|
|
|
if (!feedMonths.isEmpty()) {
|
|
|
thisMonthCountBd = feedMonths.get(0).getConsumption();
|
|
|
- if (feedDays.size() < 2) {
|
|
|
+ if (feedMonths.size() < 2) {
|
|
|
thisMonthRatioBd = BigDecimal.ZERO;
|
|
|
}
|
|
|
- BigDecimal LastMonthCountBd = feedDays.get(1).getConsumption();
|
|
|
- thisMonthRatioBd = (thisMonthRatioBd.subtract(LastMonthCountBd)).divide(LastMonthCountBd);
|
|
|
+ if (feedMonths.size()>=2) {
|
|
|
+ BigDecimal LastMonthCountBd = feedMonths.get(1).getConsumption();
|
|
|
+ thisMonthRatioBd = (thisMonthCountBd.subtract(LastMonthCountBd)).divide(LastMonthCountBd);
|
|
|
+ }
|
|
|
} else {
|
|
|
thisMonthCountBd = BigDecimal.ZERO;
|
|
|
thisMonthRatioBd = BigDecimal.ZERO;
|