From 6ff89d16933d1088c504e7134cd9978c4820e946 Mon Sep 17 00:00:00 2001 From: 10001392 <1055202292@qq.com> Date: Tue, 5 Nov 2024 15:58:52 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=89=A9=E6=96=99=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E3=80=91=E6=97=B6=E9=97=B4=E5=AD=97=E6=AE=B5=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/pojo/vo/MaterialMainVO.java | 3 +++ .../material/service/MaterialMainService.java | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/nflg_project_dev/material/src/main/java/com/nflg/product/material/pojo/vo/MaterialMainVO.java b/nflg_project_dev/material/src/main/java/com/nflg/product/material/pojo/vo/MaterialMainVO.java index 0c8ffbf9..b7d64eda 100644 --- a/nflg_project_dev/material/src/main/java/com/nflg/product/material/pojo/vo/MaterialMainVO.java +++ b/nflg_project_dev/material/src/main/java/com/nflg/product/material/pojo/vo/MaterialMainVO.java @@ -304,6 +304,7 @@ public class MaterialMainVO implements Serializable { @ApiModelProperty(value = "变更审请人") private String updatedByUserCode; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime lastApplyTime; /** @@ -323,6 +324,7 @@ public class MaterialMainVO implements Serializable { * 创建时间 */ @ApiModelProperty(value = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime createdTime; /** @@ -335,6 +337,7 @@ public class MaterialMainVO implements Serializable { * 更新时间 */ @ApiModelProperty(value = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime updatedTime; /** diff --git a/nflg_project_dev/material/src/main/java/com/nflg/product/material/service/MaterialMainService.java b/nflg_project_dev/material/src/main/java/com/nflg/product/material/service/MaterialMainService.java index 9cd8b8a0..89292981 100644 --- a/nflg_project_dev/material/src/main/java/com/nflg/product/material/service/MaterialMainService.java +++ b/nflg_project_dev/material/src/main/java/com/nflg/product/material/service/MaterialMainService.java @@ -62,6 +62,7 @@ import java.math.RoundingMode; import java.nio.file.Path; import java.nio.file.Paths; import java.sql.*; +import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.ZoneId; @@ -221,6 +222,7 @@ public class MaterialMainService extends ServiceImpl 0) { initMaterialAttrsMapForPageList(result, childList); + formatTimeField(result); } dataResult.setRecords(result); @@ -237,6 +239,25 @@ public class MaterialMainService extends ServiceImpl> result) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + result.forEach(item -> { + if (ObjectUtil.isNotEmpty(item.get("createdTime"))) { + item.put("createdTime", formatter.format((Timestamp) item.get("createdTime"))); + } + if (ObjectUtil.isNotEmpty(item.get("updatedTime"))) { + item.put("updatedTime", formatter.format((Timestamp) item.get("updatedTime"))); + } + if (ObjectUtil.isNotEmpty(item.get("lastApplyTime"))) { + item.put("lastApplyTime", formatter.format((Timestamp) item.get("lastApplyTime"))); + } + }); + } + /** * 获取总页数 *