修改时间格式

master
leijx 5 years ago
parent 4e1cba8106
commit d8ad086f8e

@ -62,9 +62,9 @@ public class XMLUtils {
doctorDataPath = doctorDataPathTemp; doctorDataPath = doctorDataPathTemp;
} }
private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss"); // private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
// 病案首页独享 // 病案首页独享
private static SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss"); // private static SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
/** /**
* xml * xml
@ -149,6 +149,8 @@ public class XMLUtils {
PropertyDescriptor descriptor = new PropertyDescriptor(key, obj.getClass()); PropertyDescriptor descriptor = new PropertyDescriptor(key, obj.getClass());
if (("class java.util.Date").equals(objField)) { if (("class java.util.Date").equals(objField)) {
if (value != null && value.length() > 0) { if (value != null && value.length() > 0) {
// 20200526 将时间格式定义成局部变量
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
Date parse = simpleDateFormat.parse(value, new ParsePosition(0)); Date parse = simpleDateFormat.parse(value, new ParsePosition(0));
descriptor.getWriteMethod().invoke(obj, parse); descriptor.getWriteMethod().invoke(obj, parse);
} }
@ -162,6 +164,8 @@ public class XMLUtils {
// 给messageDto赋值 // 给messageDto赋值
if (("class java.util.Date").equals(messageField)) { if (("class java.util.Date").equals(messageField)) {
if (value != null && value.length() > 0) { if (value != null && value.length() > 0) {
// 20200526 将时间格式定义成局部变量
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddhhmmss");
propertyDescriptor.getWriteMethod().invoke(messageDto, simpleDateFormat.parse(value, new ParsePosition(0))); propertyDescriptor.getWriteMethod().invoke(messageDto, simpleDateFormat.parse(value, new ParsePosition(0)));
} }
} else { } else {

Loading…
Cancel
Save