From d3b6a0ca6978025d3f69f1397f280895673ff04e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 10 Nov 2022 12:55:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E5=A4=8D=20refund/index.vue=20?= =?UTF-8?q?=E7=9A=84=E6=8A=A5=E9=94=99=202.=20=E4=BC=98=E5=8C=96=20DateUti?= =?UTF-8?q?ls=20=E7=9A=84=E5=B7=A5=E5=85=B7=E7=B1=BB=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/common/util/date/DateUtils.java | 22 ++++++++++++++----- .../core/loader/ErrorCodeLoaderImpl.java | 2 +- .../convert/definition/BpmModelConvert.java | 6 ++--- .../bpm/service/task/BpmTaskServiceImpl.java | 8 +++---- yudao-ui-admin/src/views/pay/refund/index.vue | 2 +- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java index 674dfb049..fd7bb85c4 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java @@ -30,16 +30,28 @@ public class DateUtils { public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss"; - public static Date localDateTimeToDate(LocalDateTime date){ + /** + * 将 LocalDateTime 转换成 Date + * + * @param date LocalDateTime + * @return LocalDateTime + */ + public static Date of(LocalDateTime date) { // 将此日期时间与时区相结合以创建 ZonedDateTime ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault()); - // 本地时间线LocalDateTime到即时时间线Instant时间戳 + // 本地时间线 LocalDateTime 到即时时间线 Instant 时间戳 Instant instant = zonedDateTime.toInstant(); // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 return Date.from(instant); } - public static LocalDateTime dateToLocalDateTime(Date date){ + /** + * 将 Date 转换成 LocalDateTime + * + * @param date Date + * @return LocalDateTime + */ + public static LocalDateTime of(Date date) { // 转为时间戳 Instant instant = date.toInstant(); // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 @@ -113,14 +125,14 @@ public class DateUtils { return a.compareTo(b) > 0 ? a : b; } - public static LocalDateTime maxLocalDateTime(LocalDateTime a, LocalDateTime b) { + public static LocalDateTime max(LocalDateTime a, LocalDateTime b) { if (a == null) { return b; } if (b == null) { return a; } - return a.compareTo(b) > 0 ? a : b; + return a.isAfter(b) ? a : b; } public static boolean beforeNow(Date date) { diff --git a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java index b3c85382b..c1e8b3ef2 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java @@ -66,7 +66,7 @@ public class ErrorCodeLoaderImpl implements ErrorCodeLoader { // 写入到错误码的缓存 putErrorCode(errorCodeRespDTO.getCode(), errorCodeRespDTO.getMessage()); // 记录下更新时间,方便增量更新 - maxUpdateTime = DateUtils.maxLocalDateTime(maxUpdateTime, errorCodeRespDTO.getUpdateTime()); + maxUpdateTime = DateUtils.max(maxUpdateTime, errorCodeRespDTO.getUpdateTime()); }); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java index d93b2eee3..9f79032f6 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java @@ -45,7 +45,7 @@ public interface BpmModelConvert { default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, Deployment deployment, ProcessDefinition processDefinition) { BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO(); modelRespVO.setId(model.getId()); - modelRespVO.setCreateTime(DateUtils.dateToLocalDateTime(model.getCreateTime())); + modelRespVO.setCreateTime(DateUtils.of(model.getCreateTime())); // 通用 copy copyTo(model, modelRespVO); // Form @@ -58,7 +58,7 @@ public interface BpmModelConvert { if (modelRespVO.getProcessDefinition() != null) { modelRespVO.getProcessDefinition().setSuspensionState(processDefinition.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); - modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.dateToLocalDateTime(deployment.getDeploymentTime())); + modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.of(deployment.getDeploymentTime())); } return modelRespVO; } @@ -66,7 +66,7 @@ public interface BpmModelConvert { default BpmModelRespVO convert(Model model) { BpmModelRespVO modelRespVO = new BpmModelRespVO(); modelRespVO.setId(model.getId()); - modelRespVO.setCreateTime(DateUtils.dateToLocalDateTime(model.getCreateTime())); + modelRespVO.setCreateTime(DateUtils.of(model.getCreateTime())); // 通用 copy copyTo(model, modelRespVO); return modelRespVO; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java index 534a47e5f..929eb0137 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java @@ -76,10 +76,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { taskQuery.taskNameLike("%" + pageVO.getName() + "%"); } if (pageVO.getBeginCreateTime() != null) { - taskQuery.taskCreatedAfter(DateUtils.localDateTimeToDate(pageVO.getBeginCreateTime())); + taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime())); } if (pageVO.getEndCreateTime() != null) { - taskQuery.taskCreatedBefore(DateUtils.localDateTimeToDate(pageVO.getEndCreateTime())); + taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime())); } // 执行查询 List tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); @@ -108,10 +108,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { taskQuery.taskNameLike("%" + pageVO.getName() + "%"); } if (pageVO.getBeginCreateTime() != null) { - taskQuery.taskCreatedAfter(DateUtils.localDateTimeToDate(pageVO.getBeginCreateTime())); + taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime())); } if (pageVO.getEndCreateTime() != null) { - taskQuery.taskCreatedBefore(DateUtils.localDateTimeToDate(pageVO.getEndCreateTime())); + taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime())); } // 执行查询 List tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); diff --git a/yudao-ui-admin/src/views/pay/refund/index.vue b/yudao-ui-admin/src/views/pay/refund/index.vue index dbc8cb387..4a719d1a1 100755 --- a/yudao-ui-admin/src/views/pay/refund/index.vue +++ b/yudao-ui-admin/src/views/pay/refund/index.vue @@ -111,7 +111,7 @@ -