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); }); } }