Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
xingyu4j 2022-11-10 13:01:29 +08:00
commit 55405afe94
5 changed files with 26 additions and 14 deletions

View File

@ -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 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 zonedDateTime = date.atZone(ZoneId.systemDefault()); ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault());
// 本地时间线LocalDateTime到即时时间线Instant时间戳 // 本地时间线 LocalDateTime 到即时时间线 Instant 时间戳
Instant instant = zonedDateTime.toInstant(); Instant instant = zonedDateTime.toInstant();
// UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间
return Date.from(instant); 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(); Instant instant = date.toInstant();
// UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间
@ -113,14 +125,14 @@ public class DateUtils {
return a.compareTo(b) > 0 ? a : b; 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) { if (a == null) {
return b; return b;
} }
if (b == null) { if (b == null) {
return a; return a;
} }
return a.compareTo(b) > 0 ? a : b; return a.isAfter(b) ? a : b;
} }
public static boolean beforeNow(Date date) { public static boolean beforeNow(Date date) {

View File

@ -66,7 +66,7 @@ public class ErrorCodeLoaderImpl implements ErrorCodeLoader {
// 写入到错误码的缓存 // 写入到错误码的缓存
putErrorCode(errorCodeRespDTO.getCode(), errorCodeRespDTO.getMessage()); putErrorCode(errorCodeRespDTO.getCode(), errorCodeRespDTO.getMessage());
// 记录下更新时间方便增量更新 // 记录下更新时间方便增量更新
maxUpdateTime = DateUtils.maxLocalDateTime(maxUpdateTime, errorCodeRespDTO.getUpdateTime()); maxUpdateTime = DateUtils.max(maxUpdateTime, errorCodeRespDTO.getUpdateTime());
}); });
} }

View File

@ -45,7 +45,7 @@ public interface BpmModelConvert {
default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, Deployment deployment, ProcessDefinition processDefinition) { default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, Deployment deployment, ProcessDefinition processDefinition) {
BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO(); BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO();
modelRespVO.setId(model.getId()); modelRespVO.setId(model.getId());
modelRespVO.setCreateTime(DateUtils.dateToLocalDateTime(model.getCreateTime())); modelRespVO.setCreateTime(DateUtils.of(model.getCreateTime()));
// 通用 copy // 通用 copy
copyTo(model, modelRespVO); copyTo(model, modelRespVO);
// Form // Form
@ -58,7 +58,7 @@ public interface BpmModelConvert {
if (modelRespVO.getProcessDefinition() != null) { if (modelRespVO.getProcessDefinition() != null) {
modelRespVO.getProcessDefinition().setSuspensionState(processDefinition.isSuspended() ? modelRespVO.getProcessDefinition().setSuspensionState(processDefinition.isSuspended() ?
SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode());
modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.dateToLocalDateTime(deployment.getDeploymentTime())); modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.of(deployment.getDeploymentTime()));
} }
return modelRespVO; return modelRespVO;
} }
@ -66,7 +66,7 @@ public interface BpmModelConvert {
default BpmModelRespVO convert(Model model) { default BpmModelRespVO convert(Model model) {
BpmModelRespVO modelRespVO = new BpmModelRespVO(); BpmModelRespVO modelRespVO = new BpmModelRespVO();
modelRespVO.setId(model.getId()); modelRespVO.setId(model.getId());
modelRespVO.setCreateTime(DateUtils.dateToLocalDateTime(model.getCreateTime())); modelRespVO.setCreateTime(DateUtils.of(model.getCreateTime()));
// 通用 copy // 通用 copy
copyTo(model, modelRespVO); copyTo(model, modelRespVO);
return modelRespVO; return modelRespVO;

View File

@ -76,10 +76,10 @@ public class BpmTaskServiceImpl implements BpmTaskService {
taskQuery.taskNameLike("%" + pageVO.getName() + "%"); taskQuery.taskNameLike("%" + pageVO.getName() + "%");
} }
if (pageVO.getBeginCreateTime() != null) { if (pageVO.getBeginCreateTime() != null) {
taskQuery.taskCreatedAfter(DateUtils.localDateTimeToDate(pageVO.getBeginCreateTime())); taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime()));
} }
if (pageVO.getEndCreateTime() != null) { if (pageVO.getEndCreateTime() != null) {
taskQuery.taskCreatedBefore(DateUtils.localDateTimeToDate(pageVO.getEndCreateTime())); taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime()));
} }
// 执行查询 // 执行查询
List<Task> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); List<Task> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
@ -108,10 +108,10 @@ public class BpmTaskServiceImpl implements BpmTaskService {
taskQuery.taskNameLike("%" + pageVO.getName() + "%"); taskQuery.taskNameLike("%" + pageVO.getName() + "%");
} }
if (pageVO.getBeginCreateTime() != null) { if (pageVO.getBeginCreateTime() != null) {
taskQuery.taskCreatedAfter(DateUtils.localDateTimeToDate(pageVO.getBeginCreateTime())); taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime()));
} }
if (pageVO.getEndCreateTime() != null) { if (pageVO.getEndCreateTime() != null) {
taskQuery.taskCreatedBefore(DateUtils.localDateTimeToDate(pageVO.getEndCreateTime())); taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime()));
} }
// 执行查询 // 执行查询
List<HistoricTaskInstance> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); List<HistoricTaskInstance> tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());

View File

@ -111,7 +111,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="退款金额(元)" align="center" prop="refundAmount" width="100"> <el-table-column label="退款金额(元)" align="center" prop="refundAmount" width="100">
<template scope="scope"> <template v-slot="scope">
{{ parseFloat(scope.row.refundAmount / 100).toFixed(2) }} {{ parseFloat(scope.row.refundAmount / 100).toFixed(2) }}
</template> </template>
</el-table-column> </el-table-column>