From e7f69605957f83648785783e95e13f1d02f21ada Mon Sep 17 00:00:00 2001 From: zhn <947514737@qq.com> Date: Mon, 21 Aug 2023 15:14:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/OtaManageApplyEOServiceImpl.java | 54 +++++++------------ 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java index a51b8e89b..d49d6fcec 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/ota/service/impl/OtaManageApplyEOServiceImpl.java @@ -457,21 +457,15 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl { - if (e1.getAttestationStartTime() != null && e2.getAttestationStartTime() != null) { - String e1AttestationStartTime = DateUtils.formatDate(e1.getAttestationStartTime()); - String e2AttestationStartTime = DateUtils.formatDate(e2.getAttestationStartTime()); - return comparator.compare(e1AttestationStartTime, e2AttestationStartTime); - } - return -1; + String e1AttestationStartTime = ObjectUtils.isNotEmpty(e1.getAttestationStartTime()) ? DateUtils.formatDate(e1.getAttestationStartTime()) : ""; + String e2AttestationStartTime = ObjectUtils.isNotEmpty(e2.getAttestationStartTime()) ? DateUtils.formatDate(e2.getAttestationStartTime()) : ""; + return comparator.compare(e1AttestationStartTime, e2AttestationStartTime); }); } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { Collections.sort(otaManageApplyEOList, (e1, e2) -> { - if (e1.getAttestationStartTime() != null && e2.getAttestationStartTime() != null) { - String e1AttestationStartTime = DateUtils.formatDate(e1.getAttestationStartTime()); - String e2AttestationStartTime = DateUtils.formatDate(e2.getAttestationStartTime()); - return comparator.compare(e2AttestationStartTime, e1AttestationStartTime); - } - return -1; + String e1AttestationStartTime = ObjectUtils.isNotEmpty(e1.getAttestationStartTime()) ? DateUtils.formatDate(e1.getAttestationStartTime()) : ""; + String e2AttestationStartTime = ObjectUtils.isNotEmpty(e2.getAttestationStartTime()) ? DateUtils.formatDate(e2.getAttestationStartTime()) : ""; + return comparator.compare(e2AttestationStartTime, e1AttestationStartTime); }); } } @@ -479,21 +473,15 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl { - if (e1.getCertificationSubmission() != null && e2.getCertificationSubmission() != null) { - String e1CertificationSubmission = DateUtils.formatDate(e1.getCertificationSubmission()); - String e2CertificationSubmission = DateUtils.formatDate(e2.getCertificationSubmission()); - return comparator.compare(e1CertificationSubmission, e2CertificationSubmission); - } - return -1; + String e1CertificationSubmission = ObjectUtils.isNotEmpty(e1.getCertificationSubmission()) ? DateUtils.formatDate(e1.getCertificationSubmission()) : ""; + String e2CertificationSubmission = ObjectUtils.isNotEmpty(e2.getCertificationSubmission()) ? DateUtils.formatDate(e2.getCertificationSubmission()) : ""; + return comparator.compare(e1CertificationSubmission, e2CertificationSubmission); }); } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { Collections.sort(otaManageApplyEOList, (e1, e2) -> { - if (e1.getCertificationSubmission() != null && e2.getCertificationSubmission() != null) { - String e1CertificationSubmission = DateUtils.formatDate(e1.getCertificationSubmission()); - String e2CertificationSubmission = DateUtils.formatDate(e2.getCertificationSubmission()); - return comparator.compare(e2CertificationSubmission, e1CertificationSubmission); - } - return -1; + String e1CertificationSubmission = ObjectUtils.isNotEmpty(e1.getCertificationSubmission()) ? DateUtils.formatDate(e1.getCertificationSubmission()) : ""; + String e2CertificationSubmission = ObjectUtils.isNotEmpty(e2.getCertificationSubmission()) ? DateUtils.formatDate(e2.getCertificationSubmission()) : ""; + return comparator.compare(e2CertificationSubmission, e1CertificationSubmission); }); } } @@ -501,21 +489,15 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl { - if (e1.getAttestationEndTime() != null && e2.getAttestationEndTime() != null) { - String e1AttestationEndTime = DateUtils.formatDate(e1.getAttestationEndTime()); - String e2AttestationEndTime = DateUtils.formatDate(e2.getAttestationEndTime()); - return comparator.compare(e1AttestationEndTime, e2AttestationEndTime); - } - return -1; + String e1AttestationEndTime = ObjectUtils.isNotEmpty(e1.getAttestationEndTime()) ? DateUtils.formatDate(e1.getAttestationEndTime()) : ""; + String e2AttestationEndTime = ObjectUtils.isNotEmpty(e2.getAttestationEndTime()) ? DateUtils.formatDate(e2.getAttestationEndTime()) : ""; + return comparator.compare(e1AttestationEndTime, e2AttestationEndTime); }); } else if (OrderEnum.REVERSE.getValue().equals(otaManageApplyEO.getOrderBy())) { Collections.sort(otaManageApplyEOList, (e1, e2) -> { - if (e1.getAttestationEndTime() != null && e2.getAttestationEndTime() != null) { - String e1AttestationEndTime = DateUtils.formatDate(e1.getAttestationEndTime()); - String e2AttestationEndTime = DateUtils.formatDate(e2.getAttestationEndTime()); - return comparator.compare(e2AttestationEndTime, e1AttestationEndTime); - } - return -1; + String e1AttestationEndTime = ObjectUtils.isNotEmpty(e1.getAttestationEndTime()) ? DateUtils.formatDate(e1.getAttestationEndTime()) : ""; + String e2AttestationEndTime = ObjectUtils.isNotEmpty(e2.getAttestationEndTime()) ? DateUtils.formatDate(e2.getAttestationEndTime()) : ""; + return comparator.compare(e2AttestationEndTime, e1AttestationEndTime); }); } }