|
@@ -104,11 +104,11 @@ 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);
|
|
|
|
|
|
// 当前井深 计算 日进尺 月进尺 年累计进尺
|
|
|
// (当前井深 - 前一天日报中填写的 ‘当前井深’)= 日进尺
|
|
@@ -119,16 +119,21 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
// 当前井深-前一天日报的当前井深 = 日进尺
|
|
|
BigDecimal dailyFootage = createReqVO.getCurrentDepth().subtract(lastReport.getCurrentDepth());
|
|
|
iotRyDailyReport.setDailyFootage(dailyFootage);
|
|
|
- // 日进尺+历史的当前月进尺 = 总的月进尺
|
|
|
- iotRyDailyReport.setMonthlyFootage(dailyFootage.add(historyMonthlyFootage));
|
|
|
- // 日进尺+历史的当前年进尺 = 总的年进尺
|
|
|
- iotRyDailyReport.setAnnualFootage(dailyFootage.add(historyAnnualFootage));
|
|
|
+ // 月进尺 = 当前井深 - 当前月份的最早记录天的井深
|
|
|
+ BigDecimal monthlyFootage = (monthStartFootage.compareTo(BigDecimal.ZERO) == 0)
|
|
|
+ ? BigDecimal.ZERO : createReqVO.getCurrentDepth().subtract(monthStartFootage);
|
|
|
+ iotRyDailyReport.setMonthlyFootage(monthlyFootage);
|
|
|
+ // 年累计进尺 = 当前井深 - 当前年最早记录的井深
|
|
|
+ BigDecimal annualFootage = (yearStartFootage.compareTo(BigDecimal.ZERO) == 0)
|
|
|
+ ? BigDecimal.ZERO : createReqVO.getCurrentDepth().subtract(yearStartFootage);
|
|
|
+ iotRyDailyReport.setAnnualFootage(annualFootage);
|
|
|
} else {
|
|
|
- // 如果没有查询到数据 则当前井深 就是日进尺
|
|
|
- iotRyDailyReport.setDailyFootage(createReqVO.getCurrentDepth());
|
|
|
- iotRyDailyReport.setMonthlyFootage(createReqVO.getCurrentDepth().add(historyMonthlyFootage));
|
|
|
- // 日进尺+历史的当前年进尺 = 总的年进尺
|
|
|
- iotRyDailyReport.setAnnualFootage(createReqVO.getCurrentDepth().add(historyAnnualFootage));
|
|
|
+ // 如果没有查询到数据 则设置 日进尺 为0 后期可修复数据
|
|
|
+ iotRyDailyReport.setDailyFootage(BigDecimal.ZERO);
|
|
|
+ // 月进尺 = 当前井深 - 当前月份的最早记录天的井深
|
|
|
+ iotRyDailyReport.setMonthlyFootage(BigDecimal.ZERO);
|
|
|
+ // 年累计进尺 = 当前井深 - 当前年最早记录的井深
|
|
|
+ iotRyDailyReport.setAnnualFootage(BigDecimal.ZERO);
|
|
|
}
|
|
|
}
|
|
|
|