Commit fe1136a4cb8a7c53e1385e3a0634664aa258aa05
1 parent
02a320f9
优化跟进池
Showing
8 changed files
with
20 additions
and
192 deletions
fw-shirasawa-server/src/main/java/cn/fw/shirasawa/server/config/LocalDateTimeSerializerConfig.java deleted
1 | -package cn.fw.shirasawa.server.config; | |
2 | - | |
3 | -import com.fasterxml.jackson.core.JsonGenerator; | |
4 | -import com.fasterxml.jackson.core.JsonParser; | |
5 | -import com.fasterxml.jackson.databind.DeserializationContext; | |
6 | -import com.fasterxml.jackson.databind.JsonDeserializer; | |
7 | -import com.fasterxml.jackson.databind.JsonSerializer; | |
8 | -import com.fasterxml.jackson.databind.SerializerProvider; | |
9 | -import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; | |
10 | -import org.springframework.context.annotation.Bean; | |
11 | -import org.springframework.context.annotation.Configuration; | |
12 | - | |
13 | -import java.io.IOException; | |
14 | -import java.time.Instant; | |
15 | -import java.time.LocalDate; | |
16 | -import java.time.LocalDateTime; | |
17 | -import java.time.ZoneId; | |
18 | - | |
19 | -/** | |
20 | - * @author : kurisu | |
21 | - * @className : LocalDateTimeSerializerConfig | |
22 | - * @description : LocalDateTime序列化和反序列化配置 | |
23 | - * @date: 2021-01-19 10:04 | |
24 | - */ | |
25 | -@Configuration | |
26 | -public class LocalDateTimeSerializerConfig { | |
27 | - | |
28 | - | |
29 | - @Bean | |
30 | - public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { | |
31 | - return builder -> { | |
32 | - builder.serializerByType(LocalDateTime.class, new LocalDateTimeSerializer()); | |
33 | - builder.deserializerByType(LocalDateTime.class, new LocalDateTimeDeserializer()); | |
34 | - builder.serializerByType(LocalDate.class, new LocalDateSerializer()); | |
35 | - builder.deserializerByType(LocalDate.class, new LocalDateDeserializer()); | |
36 | - }; | |
37 | - } | |
38 | - | |
39 | - /** | |
40 | - * 序列化 | |
41 | - */ | |
42 | - public static class LocalDateTimeSerializer extends JsonSerializer<LocalDateTime> { | |
43 | - @Override | |
44 | - public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) | |
45 | - throws IOException { | |
46 | - if (value != null) { | |
47 | - long timestamp = value.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); | |
48 | - gen.writeNumber(timestamp); | |
49 | - } | |
50 | - } | |
51 | - } | |
52 | - | |
53 | - /** | |
54 | - * 反序列化 | |
55 | - */ | |
56 | - public static class LocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> { | |
57 | - @Override | |
58 | - public LocalDateTime deserialize(JsonParser p, DeserializationContext deserializationContext) | |
59 | - throws IOException { | |
60 | - long timestamp = p.getValueAsLong(); | |
61 | - if (timestamp > 0) { | |
62 | - return LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault()); | |
63 | - } else { | |
64 | - return null; | |
65 | - } | |
66 | - } | |
67 | - } | |
68 | - | |
69 | - /** | |
70 | - * 序列化 | |
71 | - */ | |
72 | - public static class LocalDateSerializer extends JsonSerializer<LocalDate> { | |
73 | - @Override | |
74 | - public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider serializers) | |
75 | - throws IOException { | |
76 | - if (value != null) { | |
77 | - long timestamp = value.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); | |
78 | - gen.writeNumber(timestamp); | |
79 | - } | |
80 | - } | |
81 | - } | |
82 | - | |
83 | - /** | |
84 | - * 反序列化 | |
85 | - */ | |
86 | - public static class LocalDateDeserializer extends JsonDeserializer<LocalDate> { | |
87 | - @Override | |
88 | - public LocalDate deserialize(JsonParser p, DeserializationContext deserializationContext) | |
89 | - throws IOException { | |
90 | - long timestamp = p.getValueAsLong(); | |
91 | - if (timestamp > 0) { | |
92 | - return LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault()).toLocalDate(); | |
93 | - } else { | |
94 | - return null; | |
95 | - } | |
96 | - } | |
97 | - } | |
98 | -} | |
99 | 0 | \ No newline at end of file |
fw-shirasawa-server/src/main/java/cn/fw/shirasawa/server/converter/Timestamp2DateConverter.java deleted
1 | -package cn.fw.shirasawa.server.converter; | |
2 | - | |
3 | -import org.apache.commons.lang3.StringUtils; | |
4 | -import org.apache.commons.lang3.math.NumberUtils; | |
5 | -import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; | |
6 | -import org.springframework.core.convert.converter.Converter; | |
7 | -import org.springframework.lang.Nullable; | |
8 | -import org.springframework.stereotype.Component; | |
9 | - | |
10 | -import java.util.Date; | |
11 | - | |
12 | -/** | |
13 | - * @author : kurisu | |
14 | - * @className : Timestamp2DateConverter | |
15 | - * @description : {@link String} to {@link Date} | |
16 | - * @date: 2021-01-19 10:04 | |
17 | - */ | |
18 | -@Component | |
19 | -@ConfigurationPropertiesBinding | |
20 | -public class Timestamp2DateConverter implements Converter<String, Date> { | |
21 | - @Override | |
22 | - @Nullable | |
23 | - public Date convert(@Nullable final String value) { | |
24 | - if (StringUtils.isNotBlank(value) && NumberUtils.isDigits(value)) { | |
25 | - return new Date(new Long(value)); | |
26 | - } | |
27 | - return null; | |
28 | - } | |
29 | -} |
fw-shirasawa-server/src/main/java/cn/fw/shirasawa/server/converter/Timestamp2LocalDateConverter.java deleted
1 | -package cn.fw.shirasawa.server.converter; | |
2 | - | |
3 | -import org.apache.commons.lang3.StringUtils; | |
4 | -import org.apache.commons.lang3.math.NumberUtils; | |
5 | -import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; | |
6 | -import org.springframework.core.convert.converter.Converter; | |
7 | -import org.springframework.lang.Nullable; | |
8 | -import org.springframework.stereotype.Component; | |
9 | - | |
10 | -import java.time.Instant; | |
11 | -import java.time.LocalDate; | |
12 | -import java.time.ZoneId; | |
13 | - | |
14 | -/** | |
15 | - * @author : kurisu | |
16 | - * @className : Timestamp2LocalDateConverter | |
17 | - * @description : {@link String} to {@link LocalDate} | |
18 | - * @date: 2021-01-19 10:04 | |
19 | - */ | |
20 | -@Component | |
21 | -@ConfigurationPropertiesBinding | |
22 | -public class Timestamp2LocalDateConverter implements Converter<String, LocalDate> { | |
23 | - @Override | |
24 | - @Nullable | |
25 | - public LocalDate convert(@Nullable final String value) { | |
26 | - if (StringUtils.isNotBlank(value) && NumberUtils.isDigits(value)) { | |
27 | - return Instant.ofEpochMilli(NumberUtils.toLong(value)).atZone(ZoneId.systemDefault()).toLocalDate(); | |
28 | - } | |
29 | - return null; | |
30 | - } | |
31 | -} |
fw-shirasawa-server/src/main/java/cn/fw/shirasawa/server/converter/Timestamp2LocalDateTimeConverter.java deleted
1 | -package cn.fw.shirasawa.server.converter; | |
2 | - | |
3 | -import org.apache.commons.lang3.StringUtils; | |
4 | -import org.apache.commons.lang3.math.NumberUtils; | |
5 | -import org.springframework.boot.context.properties.ConfigurationPropertiesBinding; | |
6 | -import org.springframework.core.convert.converter.Converter; | |
7 | -import org.springframework.lang.Nullable; | |
8 | -import org.springframework.stereotype.Component; | |
9 | - | |
10 | -import java.time.Instant; | |
11 | -import java.time.LocalDateTime; | |
12 | -import java.time.ZoneId; | |
13 | - | |
14 | -/** | |
15 | - * @author : kurisu | |
16 | - * @className : Timestamp2LocalDateTimeConverter | |
17 | - * @description : {@link String} to {@link LocalDateTime} | |
18 | - * @date: 2021-01-19 10:04 | |
19 | - */ | |
20 | -@Component | |
21 | -@ConfigurationPropertiesBinding | |
22 | -public class Timestamp2LocalDateTimeConverter implements Converter<String, LocalDateTime> { | |
23 | - @Override | |
24 | - @Nullable | |
25 | - public LocalDateTime convert(@Nullable final String value) { | |
26 | - if (StringUtils.isNotBlank(value) && NumberUtils.isDigits(value)) { | |
27 | - return Instant.ofEpochMilli(NumberUtils.toLong(value)).atZone(ZoneId.systemDefault()).toLocalDateTime(); | |
28 | - } | |
29 | - return null; | |
30 | - } | |
31 | -} |
fw-shirasawa-server/src/main/resources/application-gray.yml
... | ... | @@ -50,7 +50,11 @@ follow: |
50 | 50 | RMCode: 'Zb33mjtjVy' |
51 | 51 | IRCode: 'RsavIrkhZm' |
52 | 52 | ACCode: 'gWPMkrjkjH' |
53 | - leave2do: 'uF08Vd38fi' | |
53 | + AFCode: '9pidnWCBOT,8WMxLm2zT3' | |
54 | + CFCode: '9gW2DIWfBN' | |
55 | + PFCode: 'O6zZjZ17st' | |
56 | + FACode: '' | |
57 | + RVCode: '' | |
54 | 58 | FmTemplateCode: 'SMS_215116996' |
55 | 59 | RmTemplateCode: 'SMS_215072079' |
56 | 60 | IrTemplateCode: '' | ... | ... |
fw-shirasawa-server/src/main/resources/application-prd.yml
... | ... | @@ -49,7 +49,11 @@ follow: |
49 | 49 | RMCode: 'Zb33mjtjVy' |
50 | 50 | IRCode: 'RsavIrkhZm' |
51 | 51 | ACCode: 'gWPMkrjkjH' |
52 | - leave2do: 'uF08Vd38fi' | |
52 | + AFCode: '9pidnWCBOT,8WMxLm2zT3' | |
53 | + CFCode: '9gW2DIWfBN' | |
54 | + PFCode: 'O6zZjZ17st' | |
55 | + FACode: '' | |
56 | + RVCode: '' | |
53 | 57 | FmTemplateCode: 'SMS_215116996' |
54 | 58 | RmTemplateCode: 'SMS_215072079' |
55 | 59 | IrTemplateCode: '' | ... | ... |
fw-shirasawa-server/src/main/resources/application-test.yml
... | ... | @@ -53,4 +53,11 @@ follow: |
53 | 53 | RMCode: 'Zb33mjtjVy' |
54 | 54 | IRCode: 'RsavIrkhZm' |
55 | 55 | ACCode: 'gWPMkrjkjH' |
56 | - leave2do: 'kLKIpyNNQf' | |
57 | 56 | \ No newline at end of file |
57 | + AFCode: '9pidnWCBOT,8WMxLm2zT3' | |
58 | + CFCode: '9gW2DIWfBN' | |
59 | + PFCode: 'O6zZjZ17st' | |
60 | + FACode: '' | |
61 | + RVCode: '' | |
62 | + FmTemplateCode: '' | |
63 | + RmTemplateCode: '' | |
64 | + IrTemplateCode: '' | |
58 | 65 | \ No newline at end of file | ... | ... |