!859 update 优化日期处理方法,简化时间格式化逻辑

* update 优化日期处理方法,简化时间格式化逻辑
This commit is contained in:
AprilWind
2026-06-11 06:26:50 +00:00
committed by 疯狂的狮子Li
parent 415a72b7c6
commit 0cab98bc8a
10 changed files with 81 additions and 485 deletions
@@ -102,7 +102,7 @@ public class TemplateEngineUtils {
context.put("basePackage", getPackagePrefix(packageName));
context.put("packageName", packageName);
context.put("author", genTable.getFunctionAuthor());
context.put("datetime", DateUtils.getDate());
context.put("datetime", DateUtils.now());
context.put("pkColumn", genTable.getPkColumn());
context.put("importList", getImportList(genTable));
context.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
@@ -33,7 +33,7 @@ public class AlipayBillTask {
// 设置清算日期
String settlementDate = (String) jobArgs.getWfContext().get("settlementDate");
if (StringUtils.equals(settlementDate, "sysdate")) {
settlementDate = DateUtils.getDate();
settlementDate = DateUtils.now();
}
BillDTO billDTO = new BillDTO(23456789L, "alipay", settlementDate, new BigDecimal("2345.67"));
// 把billDTO对象放入上下文进行传递
@@ -34,7 +34,7 @@ public class WechatBillTask {
// 是sysdate设置为当前日期;否则取管理页面设置的值
String settlementDate = (String) jobArgs.getWfContext().get("settlementDate");
if (StringUtils.equals(settlementDate, "sysdate")) {
settlementDate = DateUtils.getDate();
settlementDate = DateUtils.now();
}
BillDTO billDTO = new BillDTO(123456789L, "wechat", settlementDate, new BigDecimal("1234.56"));
// 把billDTO对象放入上下文进行传递
@@ -239,7 +239,7 @@ public class FlowHisTaskVo implements Serializable {
private void updateRunDuration() {
// 如果创建时间和更新时间均不为空,计算它们之间的时长
if (this.updateTime != null && this.createTime != null) {
this.runDuration = DateUtils.getTimeDifference(this.updateTime, this.createTime);
this.runDuration = DateUtils.formatBetweenBySecond(this.updateTime, this.createTime);
}
}
@@ -164,11 +164,11 @@ public class FlwChartExtServiceImpl implements ChartExtService {
/**
* 处理节点的扩展信息,构建用于流程图悬浮提示的内容
*
* @param nodeJson 当前流程节点对象,包含节点基础信息和提示内容容器
* @param taskList 当前节点关联的历史审批任务列表,用于生成提示信息
* @param userMap 用户信息映射表,key 为用户ID,value 为用户DTO对象,用于获取审批人信息
* @param nodeJson 当前流程节点对象,包含节点基础信息和提示内容容器
* @param taskList 当前节点关联的历史审批任务列表,用于生成提示信息
* @param userMap 用户信息映射表,key 为用户ID,value 为用户DTO对象,用于获取审批人信息
* @param deptNameMap 部门名称映射表,key 为部门ID,value 为部门名称
* @param dictType 数据字典映射表,key 为字典项编码,value 为对应显示值,用于翻译审批状态等
* @param dictType 数据字典映射表,key 为字典项编码,value 为对应显示值,用于翻译审批状态等
*/
private void processNodeExtInfo(NodeJson nodeJson, List<FlowHisTask> taskList, Map<Long, UserDTO> userMap,
Map<Long, String> deptNameMap, Map<String, String> dictType) {
@@ -202,7 +202,7 @@ public class FlwChartExtServiceImpl implements ChartExtService {
// 添加具体信息项:账号、耗时、时间
info.add(buildInfoItem("用户账号", userDTO.getUserName()));
info.add(buildInfoItem("审批状态", dictType.get(task.getFlowStatus())));
info.add(buildInfoItem("审批耗时", DateUtils.getTimeDifference(task.getUpdateTime(), task.getCreateTime())));
info.add(buildInfoItem("审批耗时", DateUtils.formatBetweenBySecond(task.getUpdateTime(), task.getCreateTime())));
info.add(buildInfoItem("办理时间", DateUtils.formatDateTime(task.getUpdateTime())));
}
}
@@ -189,7 +189,7 @@ public class FlwTaskAssigneeServiceImpl implements IFlwTaskAssigneeService, Hand
.setHandlerCode(assignee -> StringUtils.blankToDefault(assignee.getHandlerCode(), ""))
.setHandlerName(assignee -> StringUtils.blankToDefault(assignee.getHandlerName(), ""))
.setGroupName(assignee -> this.getGroupName(type, assignee.getGroupName()))
.setCreateTime(assignee -> DateUtils.formatDateTime(assignee.getCreateTime()));
.setCreateTime(assignee -> DateUtils.formatLocalDateTime(assignee.getCreateTime()));
}
/**