From 586bde7001dac24376668b8d5e0f9458c57098f3 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 6 Dec 2023 09:11:11 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E7=AC=AC=E4=B8=80=E7=A7=8D=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E7=A5=A8=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/ticket/utils/ObjectUtils.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/ObjectUtils.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/ObjectUtils.java index dd508bb..ac273f5 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/ObjectUtils.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/ObjectUtils.java @@ -48,6 +48,21 @@ public class ObjectUtils { result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"second",time.getSecond()); } } + else if(value instanceof Date) { + DateTimeToMap dateTimeToMap = field.getAnnotation(DateTimeToMap.class); + Date time = (Date) value; + if(ObjectUtil.isEmpty(dateTimeToMap)) { + result.put(field.getName(),DateUtil.format(time,DateUtil.PATTERN_DATETIME)); + } + else { + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"year",time.getYear()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"month",time.getMonth()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"day",time.getDay()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"hour",time.getHours()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"minute",time.getMinutes()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"second",time.getSeconds()); + } + } }); return result; }