Ver código fonte

Merge remote-tracking branch 'origin/master'

Zimo 2 dias atrás
pai
commit
033b69cfba

+ 4 - 5
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrydailyreport/IotRyDailyReportServiceImpl.java

@@ -284,11 +284,10 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
                 if (ObjUtil.isNotEmpty(detail.getStartDateTime())) {
                     tempDetail.setReportDate(detail.getStartDateTime());
                 }
-                // 计算定额时效 = 1-((时长-定额时长)/定额时长)
-                if (ObjUtil.isNotEmpty(detail.getAllocatedTime()) && detail.getAllocatedTime().compareTo(BigDecimal.ZERO) > 0) {
-                    BigDecimal subtrahend = (detail.getDuration().subtract(detail.getAllocatedTime())).divide(detail.getAllocatedTime(), 2, RoundingMode.HALF_UP);
-                    BigDecimal minuend = new BigDecimal("1");
-                    tempDetail.setAllocatedEfficiency(minuend.subtract(subtrahend));
+                // 计算定额时效 = 定额时长/实际时长
+                if (ObjUtil.isNotEmpty(detail.getAllocatedTime()) && ObjUtil.isNotEmpty(detail.getDuration()) && detail.getDuration().compareTo(BigDecimal.ZERO) > 0) {
+                    BigDecimal subtrahend = detail.getAllocatedTime().divide(detail.getDuration(), 4, RoundingMode.HALF_UP);
+                    tempDetail.setAllocatedEfficiency(subtrahend);
                 }
                 reportDOs.add(tempDetail);
             });