Commit d3b6a0ca6978025d3f69f1397f280895673ff04e
1 parent
423256c0
1. 修复 refund/index.vue 的报错
2. 优化 DateUtils 的工具类的方法命名
Showing
5 changed files
with
26 additions
and
14 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java
| ... | ... | @@ -30,16 +30,28 @@ public class DateUtils { |
| 30 | 30 | |
| 31 | 31 | public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss"; |
| 32 | 32 | |
| 33 | - public static Date localDateTimeToDate(LocalDateTime date){ | |
| 33 | + /** | |
| 34 | + * 将 LocalDateTime 转换成 Date | |
| 35 | + * | |
| 36 | + * @param date LocalDateTime | |
| 37 | + * @return LocalDateTime | |
| 38 | + */ | |
| 39 | + public static Date of(LocalDateTime date) { | |
| 34 | 40 | // 将此日期时间与时区相结合以创建 ZonedDateTime |
| 35 | 41 | ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault()); |
| 36 | - // 本地时间线LocalDateTime到即时时间线Instant时间戳 | |
| 42 | + // 本地时间线 LocalDateTime 到即时时间线 Instant 时间戳 | |
| 37 | 43 | Instant instant = zonedDateTime.toInstant(); |
| 38 | 44 | // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 |
| 39 | 45 | return Date.from(instant); |
| 40 | 46 | } |
| 41 | 47 | |
| 42 | - public static LocalDateTime dateToLocalDateTime(Date date){ | |
| 48 | + /** | |
| 49 | + * 将 Date 转换成 LocalDateTime | |
| 50 | + * | |
| 51 | + * @param date Date | |
| 52 | + * @return LocalDateTime | |
| 53 | + */ | |
| 54 | + public static LocalDateTime of(Date date) { | |
| 43 | 55 | // 转为时间戳 |
| 44 | 56 | Instant instant = date.toInstant(); |
| 45 | 57 | // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 |
| ... | ... | @@ -113,14 +125,14 @@ public class DateUtils { |
| 113 | 125 | return a.compareTo(b) > 0 ? a : b; |
| 114 | 126 | } |
| 115 | 127 | |
| 116 | - public static LocalDateTime maxLocalDateTime(LocalDateTime a, LocalDateTime b) { | |
| 128 | + public static LocalDateTime max(LocalDateTime a, LocalDateTime b) { | |
| 117 | 129 | if (a == null) { |
| 118 | 130 | return b; |
| 119 | 131 | } |
| 120 | 132 | if (b == null) { |
| 121 | 133 | return a; |
| 122 | 134 | } |
| 123 | - return a.compareTo(b) > 0 ? a : b; | |
| 135 | + return a.isAfter(b) ? a : b; | |
| 124 | 136 | } |
| 125 | 137 | |
| 126 | 138 | public static boolean beforeNow(Date date) { | ... | ... |
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 { |
| 66 | 66 | // 写入到错误码的缓存 |
| 67 | 67 | putErrorCode(errorCodeRespDTO.getCode(), errorCodeRespDTO.getMessage()); |
| 68 | 68 | // 记录下更新时间,方便增量更新 |
| 69 | - maxUpdateTime = DateUtils.maxLocalDateTime(maxUpdateTime, errorCodeRespDTO.getUpdateTime()); | |
| 69 | + maxUpdateTime = DateUtils.max(maxUpdateTime, errorCodeRespDTO.getUpdateTime()); | |
| 70 | 70 | }); |
| 71 | 71 | } |
| 72 | 72 | ... | ... |
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 { |
| 45 | 45 | default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, Deployment deployment, ProcessDefinition processDefinition) { |
| 46 | 46 | BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO(); |
| 47 | 47 | modelRespVO.setId(model.getId()); |
| 48 | - modelRespVO.setCreateTime(DateUtils.dateToLocalDateTime(model.getCreateTime())); | |
| 48 | + modelRespVO.setCreateTime(DateUtils.of(model.getCreateTime())); | |
| 49 | 49 | // 通用 copy |
| 50 | 50 | copyTo(model, modelRespVO); |
| 51 | 51 | // Form |
| ... | ... | @@ -58,7 +58,7 @@ public interface BpmModelConvert { |
| 58 | 58 | if (modelRespVO.getProcessDefinition() != null) { |
| 59 | 59 | modelRespVO.getProcessDefinition().setSuspensionState(processDefinition.isSuspended() ? |
| 60 | 60 | SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); |
| 61 | - modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.dateToLocalDateTime(deployment.getDeploymentTime())); | |
| 61 | + modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.of(deployment.getDeploymentTime())); | |
| 62 | 62 | } |
| 63 | 63 | return modelRespVO; |
| 64 | 64 | } |
| ... | ... | @@ -66,7 +66,7 @@ public interface BpmModelConvert { |
| 66 | 66 | default BpmModelRespVO convert(Model model) { |
| 67 | 67 | BpmModelRespVO modelRespVO = new BpmModelRespVO(); |
| 68 | 68 | modelRespVO.setId(model.getId()); |
| 69 | - modelRespVO.setCreateTime(DateUtils.dateToLocalDateTime(model.getCreateTime())); | |
| 69 | + modelRespVO.setCreateTime(DateUtils.of(model.getCreateTime())); | |
| 70 | 70 | // 通用 copy |
| 71 | 71 | copyTo(model, modelRespVO); |
| 72 | 72 | return modelRespVO; | ... | ... |
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 { |
| 76 | 76 | taskQuery.taskNameLike("%" + pageVO.getName() + "%"); |
| 77 | 77 | } |
| 78 | 78 | if (pageVO.getBeginCreateTime() != null) { |
| 79 | - taskQuery.taskCreatedAfter(DateUtils.localDateTimeToDate(pageVO.getBeginCreateTime())); | |
| 79 | + taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime())); | |
| 80 | 80 | } |
| 81 | 81 | if (pageVO.getEndCreateTime() != null) { |
| 82 | - taskQuery.taskCreatedBefore(DateUtils.localDateTimeToDate(pageVO.getEndCreateTime())); | |
| 82 | + taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime())); | |
| 83 | 83 | } |
| 84 | 84 | // 执行查询 |
| 85 | 85 | List<Task> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); |
| ... | ... | @@ -108,10 +108,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { |
| 108 | 108 | taskQuery.taskNameLike("%" + pageVO.getName() + "%"); |
| 109 | 109 | } |
| 110 | 110 | if (pageVO.getBeginCreateTime() != null) { |
| 111 | - taskQuery.taskCreatedAfter(DateUtils.localDateTimeToDate(pageVO.getBeginCreateTime())); | |
| 111 | + taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime())); | |
| 112 | 112 | } |
| 113 | 113 | if (pageVO.getEndCreateTime() != null) { |
| 114 | - taskQuery.taskCreatedBefore(DateUtils.localDateTimeToDate(pageVO.getEndCreateTime())); | |
| 114 | + taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime())); | |
| 115 | 115 | } |
| 116 | 116 | // 执行查询 |
| 117 | 117 | List<HistoricTaskInstance> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); | ... | ... |
yudao-ui-admin/src/views/pay/refund/index.vue
| ... | ... | @@ -111,7 +111,7 @@ |
| 111 | 111 | </template> |
| 112 | 112 | </el-table-column> |
| 113 | 113 | <el-table-column label="退款金额(元)" align="center" prop="refundAmount" width="100"> |
| 114 | - <template scope="scope"> | |
| 114 | + <template v-slot="scope"> | |
| 115 | 115 | ¥{{ parseFloat(scope.row.refundAmount / 100).toFixed(2) }} |
| 116 | 116 | </template> |
| 117 | 117 | </el-table-column> | ... | ... |