Forráskód Böngészése

饲料部分-解决divide问题

zhuoning 2 éve
szülő
commit
58f7f9d54c

+ 2 - 2
huimv-env-platform/huimv-env-produce/src/main/java/com/huimv/env/produce/service/impl/FeedDayServiceImpl.java

@@ -65,7 +65,7 @@ public class FeedDayServiceImpl extends ServiceImpl<FeedDayMapper, FeedDay> impl
             }
             if (feedDays.size()>=2) {
                 BigDecimal yesterdayCountBd = feedDays.get(1).getConsumption();
-                todayRatioBd = (todayCountBd.subtract(yesterdayCountBd)).divide(yesterdayCountBd);
+                todayRatioBd = (todayCountBd.subtract(yesterdayCountBd)).divide(yesterdayCountBd,1,BigDecimal.ROUND_HALF_UP);
             }
         } else {
             todayCountBd = BigDecimal.ZERO;
@@ -86,7 +86,7 @@ public class FeedDayServiceImpl extends ServiceImpl<FeedDayMapper, FeedDay> impl
             }
             if (feedMonths.size()>=2) {
                 BigDecimal LastMonthCountBd = feedMonths.get(1).getConsumption();
-                thisMonthRatioBd = (thisMonthCountBd.subtract(LastMonthCountBd)).divide(LastMonthCountBd);
+                thisMonthRatioBd = (thisMonthCountBd.subtract(LastMonthCountBd)).divide(LastMonthCountBd,1,BigDecimal.ROUND_HALF_UP);
             }
         } else {
             thisMonthCountBd = BigDecimal.ZERO;

+ 2 - 2
huimv-env-platform/huimv-env-produce/src/main/resources/application.properties

@@ -1,5 +1,5 @@
-spring.profiles.active=dev
-#spring.profiles.active=prod
+#spring.profiles.active=dev
+spring.profiles.active=prod
 
 # mysql:/cache:
 device.online.access_mode=mysql