diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/annotation/DateTimeToMap.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/annotation/DateTimeToMap.java new file mode 100644 index 0000000..95c3f68 --- /dev/null +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/annotation/DateTimeToMap.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.ticket.annotation; + +import java.lang.annotation.*; + +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD}) +public @interface DateTimeToMap { + + String prefix() default ""; + + String split() default "_"; + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java index 826722e..9ad81ff 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java @@ -320,24 +320,22 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl fieldList = new ArrayList<>(); + Class clazz = obj.getClass(); + while(clazz != null) { + fieldList.addAll(Arrays.asList(clazz.getDeclaredFields())); + clazz = clazz.getSuperclass(); + } + fieldList.forEach(field -> { + field.setAccessible(true); + Object value; + try { + value = field.get(obj); + } catch (IllegalAccessException e) { + throw new ServiceException("获取属性性出错"); + } + if(value instanceof List) { + List list = ((List) value).stream().map(ObjectUtils::obj2Map).collect(Collectors.toList()); + result.put(field.getName(),list); + } + else if(value instanceof LocalDateTime) { + DateTimeToMap dateTimeToMap = field.getAnnotation(DateTimeToMap.class); + LocalDateTime time = (LocalDateTime) value; + if(ObjectUtil.isEmpty(dateTimeToMap)) { + result.put(field.getName(),time.format(DateUtil.TIME_FORMATTER)); + } + 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.getDayOfMonth()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"hour",time.getHour()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"minute",time.getMinute()); + result.put(dateTimeToMap.prefix()+dateTimeToMap.split()+"second",time.getSecond()); + } + } + }); + return result; + } + return null; + } + +} diff --git a/hzims-service/ticket/src/main/resources/License.xml b/hzims-service/ticket/src/main/resources/License.xml new file mode 100644 index 0000000..2cbce45 --- /dev/null +++ b/hzims-service/ticket/src/main/resources/License.xml @@ -0,0 +1,15 @@ + + + + Aspose.Total for Java + Aspose.Words for Java + + Enterprise + 20991231 + 20991231 + 8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7 + + + sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU= + + diff --git a/hzims-service/ticket/src/main/resources/template/电气第一种工作票模版新.docx b/hzims-service/ticket/src/main/resources/template/电气第一种工作票模版新.docx index e69de29..0f33d89 100644 Binary files a/hzims-service/ticket/src/main/resources/template/电气第一种工作票模版新.docx and b/hzims-service/ticket/src/main/resources/template/电气第一种工作票模版新.docx differ diff --git a/pom.xml b/pom.xml index 38bf367..edc678b 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ 5.0.1.RELEASE - 5.0.3.RELEASE + 5.1.0.RELEASE UTF-8 1.8