Browse Source

Merge remote-tracking branch 'origin/test' into test

yuanchao 1 week ago
parent
commit
9bf470ff46

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/vo/IotRyDailyReportPageReqVO.java

@@ -66,7 +66,7 @@ public class IotRyDailyReportPageReqVO extends PageParam {
     private BigDecimal[] nonProductionTime;
 
     @Schema(description = "非生产时间原因", example = "不香")
-    private String nptReason;
+    private String ryNptReason;
 
     @Schema(description = "施工开始日期")
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/vo/IotRyDailyReportRespVO.java

@@ -79,7 +79,7 @@ public class IotRyDailyReportRespVO {
 
     @Schema(description = "非生产时间原因", example = "不香")
     @ExcelProperty("非生产时间原因")
-    private String nptReason;
+    private String ryNptReason;
 
 
     @Schema(description = "进尺工作时间(H)")

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/vo/IotRyDailyReportSaveReqVO.java

@@ -59,7 +59,7 @@ public class IotRyDailyReportSaveReqVO {
     private BigDecimal nonProductionTime;
 
     @Schema(description = "非生产时间原因", example = "不香")
-    private String nptReason;
+    private String ryNptReason;
 
 
     @Schema(description = "进尺工作时间(H)")

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotrydailyreport/IotRyDailyReportDO.java

@@ -92,7 +92,7 @@ public class IotRyDailyReportDO extends BaseDO {
     /**
      * 非生产时间原因
      */
-    private String nptReason;
+    private String ryNptReason;
 
     /**
      * 进尺工作时间(H)

+ 8 - 6
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotrydailyreport/IotRyDailyReportMapper.java

@@ -43,7 +43,7 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
                 .eqIfPresent(IotRyDailyReportDO::getDailyFuel, reqVO.getDailyFuel())
                 .eqIfPresent(IotRyDailyReportDO::getMonthlyFuel, reqVO.getMonthlyFuel())
                 .betweenIfPresent(IotRyDailyReportDO::getNonProductionTime, reqVO.getNonProductionTime())
-                .eqIfPresent(IotRyDailyReportDO::getNptReason, reqVO.getNptReason())
+                .eqIfPresent(IotRyDailyReportDO::getRyNptReason, reqVO.getRyNptReason())
                 .betweenIfPresent(IotRyDailyReportDO::getConstructionStartDate, reqVO.getConstructionStartDate())
                 .betweenIfPresent(IotRyDailyReportDO::getConstructionEndDate, reqVO.getConstructionEndDate())
                 .eqIfPresent(IotRyDailyReportDO::getProductionStatus, reqVO.getProductionStatus())
@@ -128,9 +128,10 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
         if (reportDate == null) {
             return BigDecimal.ZERO;
         }
-
-        int year = reportDate.getYear();
-        int month = reportDate.getMonthValue();
+        // 获取 reportDate 的前一天日期
+        LocalDateTime previousDay = reportDate.minusDays(1);
+        int year = previousDay.getYear();
+        int month = previousDay.getMonthValue();
 
         List<IotRyDailyReportDO> list = selectList(new LambdaQueryWrapperX<IotRyDailyReportDO>()
                 .eq(ObjUtil.isNotNull(deptId), IotRyDailyReportDO::getDeptId, deptId)
@@ -154,8 +155,9 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
         if (reportDate == null) {
             return BigDecimal.ZERO;
         }
-
-        int year = reportDate.getYear();
+        // 获取 reportDate 的前一天日期
+        LocalDateTime previousDay = reportDate.minusDays(1);
+        int year = previousDay.getYear();
 
         List<IotRyDailyReportDO> list = selectList(new LambdaQueryWrapperX<IotRyDailyReportDO>()
                 .eq(ObjUtil.isNotNull(deptId), IotRyDailyReportDO::getDeptId, deptId)

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

@@ -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");
         }
 
         // 当天如果已经有此小队的记录 新增 当天如果没有此小队的日报记录 修改