|
@@ -64,7 +64,9 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
if (ObjUtil.isEmpty(createReqVO.getDeptId())) {
|
|
|
throw exception(IOT_RH_DAILY_REPORT_NO_DEPT);
|
|
|
}
|
|
|
- if (ObjUtil.isEmpty(createReqVO.getCurrentDepth())) {
|
|
|
+ if ((StrUtil.isBlank(createReqVO.getProjectClassification())||"1".equals(createReqVO.getProjectClassification()))
|
|
|
+ && ObjUtil.isEmpty(createReqVO.getCurrentDepth())) {
|
|
|
+ // 钻井类型日报必须 填写当前井深
|
|
|
throw exception(IOT_RY_DAILY_REPORT_CURRENT_DEPTH_NOT_EXISTS);
|
|
|
}
|
|
|
|
|
@@ -96,34 +98,43 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
|
|
|
// throw exception(IOT_PROJECT_TASK_NOT_RELATED);
|
|
|
}
|
|
|
|
|
|
- // 计算月进尺 年累计进尺 reportDate对应的前一天的 年-月份 对应的日报记录日进尺的累加值
|
|
|
- // 查询指定部门、指定时间段 填写的日报记录的 ’月进尺数据‘(逻辑细则:reportDate 所在的月份与数据表的字段 construction_start_date
|
|
|
- // 所在的月份相匹配 且 create_time < reportDate 的记录的 ’daily_footage‘ 字段值累加计算得出
|
|
|
- BigDecimal historyMonthlyFootage = iotRyDailyReportMapper.monthlyFootages(createReqVO.getDeptId(), reportDate);
|
|
|
-
|
|
|
- // 查询指定部门、指定时间段 填写的日报记录的 ’月进尺数据‘(逻辑细则:reportDate 所在的月份与数据表的字段 construction_start_date
|
|
|
- // 所在的月份相匹配 且 create_time < reportDate 的记录的 ’daily_footage‘ 字段值累加计算得出
|
|
|
- BigDecimal historyAnnualFootage = iotRyDailyReportMapper.annualFootages(createReqVO.getDeptId(), reportDate);
|
|
|
-
|
|
|
- // 当前井深 计算 日进尺 月进尺 年累计进尺
|
|
|
- // (当前井深 - 前一天日报中填写的 ‘当前井深’)= 日进尺
|
|
|
- // 将 reportDate 减去1天 得到日期 date(yyyy-MM-dd) 查询date对应的日报记录
|
|
|
- IotRyDailyReportDO lastReport = iotRyDailyReportMapper.selectLatestReportBeforeDate(
|
|
|
- createReqVO.getDeptId(), null, reportDate);
|
|
|
- if (ObjUtil.isNotEmpty(lastReport) && ObjUtil.isNotEmpty(lastReport.getCurrentDepth())) {
|
|
|
- // 当前井深-前一天日报的当前井深 = 日进尺
|
|
|
- BigDecimal dailyFootage = createReqVO.getCurrentDepth().subtract(lastReport.getCurrentDepth());
|
|
|
- iotRyDailyReport.setDailyFootage(dailyFootage);
|
|
|
- // 日进尺+历史的当前月进尺 = 总的月进尺
|
|
|
- iotRyDailyReport.setMonthlyFootage(dailyFootage.add(historyMonthlyFootage));
|
|
|
- // 日进尺+历史的当前年进尺 = 总的年进尺
|
|
|
- iotRyDailyReport.setAnnualFootage(dailyFootage.add(historyAnnualFootage));
|
|
|
- } else {
|
|
|
- // 如果没有查询到数据 则当前井深 就是日进尺
|
|
|
- iotRyDailyReport.setDailyFootage(createReqVO.getCurrentDepth());
|
|
|
- iotRyDailyReport.setMonthlyFootage(createReqVO.getCurrentDepth().add(historyMonthlyFootage));
|
|
|
- // 日进尺+历史的当前年进尺 = 总的年进尺
|
|
|
- iotRyDailyReport.setAnnualFootage(createReqVO.getCurrentDepth().add(historyAnnualFootage));
|
|
|
+ if (StrUtil.isBlank(createReqVO.getProjectClassification()) || "1".equals(createReqVO.getProjectClassification())) {
|
|
|
+ // 钻井类型日报 需要根据当前井深 计算 日进尺 月进尺 年累计进尺
|
|
|
+
|
|
|
+ // 计算月进尺 年累计进尺 reportDate对应的前一天的 年-月份 对应的日报记录日进尺的累加值
|
|
|
+ // 查询指定部门、指定时间段 填写的日报记录的 ’月进尺数据‘(逻辑细则:reportDate 所在的月份与数据表的字段 construction_start_date
|
|
|
+ // 所在的月份相匹配 且 create_time < reportDate 的记录的 ’daily_footage‘ 字段值累加计算得出
|
|
|
+ BigDecimal historyMonthlyFootage = iotRyDailyReportMapper.monthlyFootages(createReqVO.getDeptId(), reportDate);
|
|
|
+
|
|
|
+ // 查询指定部门、指定时间段 填写的日报记录的 ’年进尺数据‘(逻辑细则:reportDate 所在的年份与数据表的字段 construction_start_date
|
|
|
+ // 所在的年份相匹配 且 create_time < reportDate 的记录的 ’daily_footage‘ 字段值累加计算得出
|
|
|
+ BigDecimal historyAnnualFootage = iotRyDailyReportMapper.annualFootages(createReqVO.getDeptId(), reportDate);
|
|
|
+
|
|
|
+ // 当前井深 计算 日进尺 月进尺 年累计进尺
|
|
|
+ // (当前井深 - 前一天日报中填写的 ‘当前井深’)= 日进尺
|
|
|
+ // 将 reportDate 减去1天 得到日期 date(yyyy-MM-dd) 查询date对应的日报记录
|
|
|
+ IotRyDailyReportDO lastReport = iotRyDailyReportMapper.selectLatestReportBeforeDate(
|
|
|
+ createReqVO.getDeptId(), null, reportDate);
|
|
|
+ if (ObjUtil.isNotEmpty(lastReport) && ObjUtil.isNotEmpty(lastReport.getCurrentDepth())) {
|
|
|
+ // 当前井深-前一天日报的当前井深 = 日进尺
|
|
|
+ BigDecimal dailyFootage = createReqVO.getCurrentDepth().subtract(lastReport.getCurrentDepth());
|
|
|
+ iotRyDailyReport.setDailyFootage(dailyFootage);
|
|
|
+ // 日进尺+历史的当前月进尺 = 总的月进尺
|
|
|
+ iotRyDailyReport.setMonthlyFootage(dailyFootage.add(historyMonthlyFootage));
|
|
|
+ // 日进尺+历史的当前年进尺 = 总的年进尺
|
|
|
+ iotRyDailyReport.setAnnualFootage(dailyFootage.add(historyAnnualFootage));
|
|
|
+ } else {
|
|
|
+ // 如果没有查询到数据 则当前井深 就是日进尺
|
|
|
+ iotRyDailyReport.setDailyFootage(createReqVO.getCurrentDepth());
|
|
|
+ iotRyDailyReport.setMonthlyFootage(createReqVO.getCurrentDepth().add(historyMonthlyFootage));
|
|
|
+ // 日进尺+历史的当前年进尺 = 总的年进尺
|
|
|
+ iotRyDailyReport.setAnnualFootage(createReqVO.getCurrentDepth().add(historyAnnualFootage));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置瑞鹰日报类型 钻井 修井
|
|
|
+ if (StrUtil.isBlank(createReqVO.getProjectClassification())) {
|
|
|
+ iotRyDailyReport.setProjectClassification("1");
|
|
|
}
|
|
|
|
|
|
// 当天如果已经有此小队的记录 新增 当天如果没有此小队的日报记录 修改
|