浏览代码

Merge branch 'dailyReport'

zhangcl 2 天之前
父节点
当前提交
7c8768f97e

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

@@ -104,10 +104,12 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
             // 计算月进尺 年累计进尺 reportDate对应的前一天的 年-月份 对应的日报记录日进尺的累加值
             // 查询指定部门、指定时间段 填写的日报记录的 ’月进尺数据‘(逻辑细则:reportDate 所在的月份与数据表的字段 construction_start_date
             // 所在的月份相匹配 且 create_time < reportDate 的记录的 ’daily_footage‘ 字段值累加计算得出
+            BigDecimal historyMonthlyFootage = iotRyDailyReportMapper.monthlyFootages(createReqVO.getDeptId(), reportDate);
             BigDecimal monthStartFootage = iotRyDailyReportMapper.monthStartFootage(createReqVO.getDeptId(), reportDate);
 
             // 查询指定部门、指定时间段 填写的日报记录的 ’年进尺数据‘(逻辑细则:reportDate 所在的年份与数据表的字段 construction_start_date
             // 所在的年份相匹配 且 create_time < reportDate 的记录的 ’daily_footage‘ 字段值累加计算得出
+            BigDecimal historyAnnualFootage = iotRyDailyReportMapper.annualFootages(createReqVO.getDeptId(), reportDate);
             BigDecimal yearStartFootage = iotRyDailyReportMapper.yearStartFootage(createReqVO.getDeptId(), reportDate);
 
             // 当前井深 计算 日进尺 月进尺 年累计进尺
@@ -120,13 +122,13 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
                 BigDecimal dailyFootage = createReqVO.getCurrentDepth().subtract(lastReport.getCurrentDepth());
                 iotRyDailyReport.setDailyFootage(dailyFootage);
                 // 月进尺 = 当前井深 - 当前月份的最早记录天的井深
-                BigDecimal monthlyFootage = (monthStartFootage.compareTo(BigDecimal.ZERO) == 0)
-                        ? BigDecimal.ZERO : createReqVO.getCurrentDepth().subtract(monthStartFootage);
-                iotRyDailyReport.setMonthlyFootage(monthlyFootage);
+                /* BigDecimal monthlyFootage = (monthStartFootage.compareTo(BigDecimal.ZERO) == 0)
+                        ? BigDecimal.ZERO : createReqVO.getCurrentDepth().subtract(monthStartFootage); */
+                iotRyDailyReport.setMonthlyFootage(dailyFootage.add(historyMonthlyFootage));
                 // 年累计进尺 = 当前井深 - 当前年最早记录的井深
-                BigDecimal annualFootage = (yearStartFootage.compareTo(BigDecimal.ZERO) == 0)
-                        ? BigDecimal.ZERO : createReqVO.getCurrentDepth().subtract(yearStartFootage);
-                iotRyDailyReport.setAnnualFootage(annualFootage);
+                /* BigDecimal annualFootage = (yearStartFootage.compareTo(BigDecimal.ZERO) == 0)
+                        ? BigDecimal.ZERO : createReqVO.getCurrentDepth().subtract(yearStartFootage); */
+                iotRyDailyReport.setAnnualFootage(dailyFootage.add(historyAnnualFootage));
             } else {
                 // 如果没有查询到数据 则设置 日进尺 为0 后期可修复数据
                 iotRyDailyReport.setDailyFootage(BigDecimal.ZERO);