|
|
@@ -168,8 +168,23 @@ public class IotRyDailyReportController {
|
|
|
if (CollUtil.isNotEmpty(reportDetails)) {
|
|
|
List<IotRyDailyReportDetailRespVO> reportDetailsResp = BeanUtils.toBean(reportDetails, IotRyDailyReportDetailRespVO.class);
|
|
|
// 按照生产动态明细 的 日期 时间段 正序排列
|
|
|
- reportDetailsResp.sort(Comparator.comparing((IotRyDailyReportDetailRespVO detail) -> detail.getReportDate().toLocalDate())
|
|
|
- .thenComparing(IotRyDailyReportDetailRespVO::getStartTime));
|
|
|
+ reportDetailsResp.sort(Comparator.comparing(
|
|
|
+ // 处理 reportDate 为空的情况
|
|
|
+ (IotRyDailyReportDetailRespVO detail) -> {
|
|
|
+ if (detail.getReportDate() == null) {
|
|
|
+ return null; // null 值会排在前面
|
|
|
+ }
|
|
|
+ return detail.getReportDate().toLocalDate();
|
|
|
+ },
|
|
|
+ // 自定义 null 值比较器:null 排在非 null 前面
|
|
|
+ Comparator.nullsFirst(Comparator.naturalOrder())
|
|
|
+ )
|
|
|
+ .thenComparing(
|
|
|
+ // 处理 startTime 为空的情况
|
|
|
+ IotRyDailyReportDetailRespVO::getStartTime,
|
|
|
+ // 自定义 null 值比较器:null 排在非 null 前面
|
|
|
+ Comparator.nullsFirst(Comparator.naturalOrder())
|
|
|
+ ));
|
|
|
result.setReportDetails(reportDetailsResp);
|
|
|
}
|
|
|
// 按照创建时间倒序排列 取第2条记录对应的 当前井深 即 上次日报的当前井深
|
|
|
@@ -573,8 +588,23 @@ public class IotRyDailyReportController {
|
|
|
// 生产动态明细
|
|
|
findAndThen(reportDetailsPair, reportVO.getId(), details -> {
|
|
|
// 每个日报的明细 根据 reportDate+startTime 正序排列
|
|
|
- details.sort(Comparator.comparing((IotRyDailyReportDetailRespVO detail) -> detail.getReportDate().toLocalDate())
|
|
|
- .thenComparing(IotRyDailyReportDetailRespVO::getStartTime));
|
|
|
+ details.sort(Comparator.comparing(
|
|
|
+ // 处理 reportDate 为空的情况
|
|
|
+ (IotRyDailyReportDetailRespVO detail) -> {
|
|
|
+ if (detail.getReportDate() == null) {
|
|
|
+ return null; // null 值会排在前面
|
|
|
+ }
|
|
|
+ return detail.getReportDate().toLocalDate();
|
|
|
+ },
|
|
|
+ // 自定义 null 值比较器:null 排在非 null 前面
|
|
|
+ Comparator.nullsFirst(Comparator.naturalOrder())
|
|
|
+ )
|
|
|
+ .thenComparing(
|
|
|
+ // 处理 startTime 为空的情况
|
|
|
+ IotRyDailyReportDetailRespVO::getStartTime,
|
|
|
+ // 自定义 null 值比较器:null 排在非 null 前面
|
|
|
+ Comparator.nullsFirst(Comparator.naturalOrder())
|
|
|
+ ));
|
|
|
reportVO.setReportDetails(details);
|
|
|
});
|
|
|
// 施工工艺
|