格式化时间

20230922-ljl-fixBug
daixiaogang 1 year ago
parent 9d341f66e5
commit bcc827814a

@ -1,8 +1,11 @@
package com.ms.api.common; package com.ms.api.common;
import lombok.Data; import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.Set;
import cn.hutool.core.date.DateUtil;
import lombok.Data;
/** /**
* *
@ -38,6 +41,11 @@ public class Ret {
} }
public static Ret success(Map data) { public static Ret success(Map data) {
for (Object key : data.keySet()) {
if (data.get(key) instanceof Date){
data.put(key,DateUtil.formatDateTime((Date) data.get(key)));
}
}
return new Ret("success", data); return new Ret("success", data);
} }
@ -52,10 +60,10 @@ public class Ret {
@Override @Override
public String toString() { public String toString() {
return "Ret{" + return "Ret{" +
"result='" + result + '\'' + "result='" + result + '\'' +
", reason='" + reason + '\'' + ", reason='" + reason + '\'' +
", code='" + code + '\'' + ", code='" + code + '\'' +
", data=" + data + ", data=" + data +
'}'; '}';
} }
} }

Loading…
Cancel
Save