Commit 9f99f04a12dc01d2567c4bd295a5f449fc11c65b
1 parent
5359d0ff
创建项目结构性文件
Showing
14 changed files
with
504 additions
and
2 deletions
fw-hestia-common/pom.xml
@@ -19,6 +19,10 @@ | @@ -19,6 +19,10 @@ | ||
19 | <groupId>com.alibaba</groupId> | 19 | <groupId>com.alibaba</groupId> |
20 | <artifactId>fastjson</artifactId> | 20 | <artifactId>fastjson</artifactId> |
21 | </dependency> | 21 | </dependency> |
22 | + <dependency> | ||
23 | + <groupId>cn.fw</groupId> | ||
24 | + <artifactId>fw-common-data</artifactId> | ||
25 | + </dependency> | ||
22 | </dependencies> | 26 | </dependencies> |
23 | 27 | ||
24 | <build> | 28 | <build> |
fw-hestia-rpc/pom.xml
@@ -23,6 +23,10 @@ | @@ -23,6 +23,10 @@ | ||
23 | <groupId>cn.fw</groupId> | 23 | <groupId>cn.fw</groupId> |
24 | <artifactId>fw-hestia-common</artifactId> | 24 | <artifactId>fw-hestia-common</artifactId> |
25 | </dependency> | 25 | </dependency> |
26 | + <dependency> | ||
27 | + <groupId>cn.fw</groupId> | ||
28 | + <artifactId>fw-passport-sdk</artifactId> | ||
29 | + </dependency> | ||
26 | <!-- fw common --> | 30 | <!-- fw common --> |
27 | <dependency> | 31 | <dependency> |
28 | <groupId>cn.fw</groupId> | 32 | <groupId>cn.fw</groupId> |
fw-hestia-rpc/src/main/java/cn/fw/hestia/rpc/passport/PassportService.java
0 → 100644
1 | +package cn.fw.hestia.rpc.passport; | ||
2 | + | ||
3 | +import cn.fw.common.exception.BusinessException; | ||
4 | +import cn.fw.data.base.domain.common.Message; | ||
5 | +import cn.fw.passport.sdk.api.MiniQrCodeApi; | ||
6 | +import cn.fw.passport.sdk.api.param.WxBCodeParam; | ||
7 | +import lombok.extern.slf4j.Slf4j; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +/** | ||
12 | + * 会员外部服务 | ||
13 | + * @author kurisu | ||
14 | + */ | ||
15 | +@Slf4j | ||
16 | +@Service | ||
17 | +public class PassportService { | ||
18 | + | ||
19 | + @Autowired | ||
20 | + private MiniQrCodeApi miniQrCodeApi; | ||
21 | + | ||
22 | + /** | ||
23 | + * 获取小程序二维码 | ||
24 | + * | ||
25 | + * @param param | ||
26 | + * @return | ||
27 | + */ | ||
28 | + public byte[] getWxBCode(WxBCodeParam param){ | ||
29 | + try { | ||
30 | + Message<byte[]> message = miniQrCodeApi.getWxBCode(param); | ||
31 | + if (!message.isSuccess()) { | ||
32 | + log.error("调用passport api 生成小程序码业务异常:{}", message.getResult()); | ||
33 | + throw new BusinessException(message.getCode(), message.getResult()); | ||
34 | + } | ||
35 | + return message.getData(); | ||
36 | + }catch (Exception e){ | ||
37 | + log.error("会员系统调用失败",e); | ||
38 | + throw new BusinessException("调用会员系统异常"); | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | + | ||
43 | +} |
fw-hestia-rpc/src/main/java/cn/fw/hestia/rpc/passport/TemplateMessageService.java
0 → 100644
1 | +package cn.fw.hestia.rpc.passport; | ||
2 | + | ||
3 | +import cn.fw.data.base.domain.common.Message; | ||
4 | +import cn.fw.hestia.rpc.passport.dto.TemplateMessageParam; | ||
5 | +import cn.fw.passport.sdk.api.WxMpTemplateMessageApi; | ||
6 | +import cn.fw.passport.sdk.api.param.WxMpTempMessageData; | ||
7 | +import cn.fw.passport.sdk.api.param.WxMpTempMessageParam; | ||
8 | +import cn.fw.hestia.rpc.passport.dto.RenewInsurNoticeMessageParam; | ||
9 | +import lombok.Getter; | ||
10 | +import lombok.extern.slf4j.Slf4j; | ||
11 | +import org.springframework.beans.factory.annotation.Value; | ||
12 | +import org.springframework.stereotype.Service; | ||
13 | + | ||
14 | +import java.text.MessageFormat; | ||
15 | +import java.util.ArrayList; | ||
16 | +import java.util.Arrays; | ||
17 | +import java.util.List; | ||
18 | + | ||
19 | +/** | ||
20 | + * passport系统-模板消息服务 | ||
21 | + * <p> | ||
22 | + * create at 2019-05-15 | ||
23 | + * | ||
24 | + * @author kurisu | ||
25 | + */ | ||
26 | +@Slf4j | ||
27 | +@Service | ||
28 | +public class TemplateMessageService { | ||
29 | + | ||
30 | + private final WxMpTemplateMessageApi wxMpTemplateMessageApi; | ||
31 | + | ||
32 | + public TemplateMessageService(final WxMpTemplateMessageApi wxMpTemplateMessageApi) { | ||
33 | + this.wxMpTemplateMessageApi = wxMpTemplateMessageApi; | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * 消息模板Code | ||
38 | + */ | ||
39 | + @Value("${templateCode}") | ||
40 | + @Getter | ||
41 | + private String templateCode = ""; | ||
42 | + | ||
43 | + | ||
44 | + /** | ||
45 | + * 小程序页面--续保提醒/保险估算 | ||
46 | + */ | ||
47 | + private static final String PAGE_PATH_INSU = "/pgCas/Insurance/Append/index?bizType={0}"; | ||
48 | + /** | ||
49 | + * 保养预约页面 | ||
50 | + */ | ||
51 | + private static final String RESE_URL = "/pgCas/Appoint/Index/index"; | ||
52 | + | ||
53 | + /** | ||
54 | + * 发送续保提醒通知 | ||
55 | + * | ||
56 | + * @param messageParam | ||
57 | + */ | ||
58 | + public String sendTemplateMessage(TemplateMessageParam messageParam) { | ||
59 | + log.info("开始发送续保提醒通知,senderId:{}", messageParam); | ||
60 | + try { | ||
61 | + WxMpTempMessageParam param = new WxMpTempMessageParam(); | ||
62 | + param.setCusId(messageParam.getMemberId()); | ||
63 | + param.setTempCode(getTemplateCode()); | ||
64 | + WxMpTempMessageData remark = new WxMpTempMessageData(); | ||
65 | + remark.setValue("点击“详情”进行保险估价⬇"); | ||
66 | + remark.setColor("#a61b29"); | ||
67 | + param.setRemark(remark); | ||
68 | + WxMpTempMessageData title = new WxMpTempMessageData(); | ||
69 | + title.setValue("您好!您购买的车险即将到期,现在预约续保可享养车大礼包!"); | ||
70 | + param.setTitle(title); | ||
71 | + List<WxMpTempMessageData> keywords = new ArrayList<>(); | ||
72 | + //车牌号 | ||
73 | + WxMpTempMessageData keyword1 = new WxMpTempMessageData(); | ||
74 | + keyword1.setValue(""); | ||
75 | + keywords.add(keyword1); | ||
76 | + | ||
77 | + param.setKeyWordList(keywords); | ||
78 | + param.setPagePath(MessageFormat.format(PAGE_PATH_INSU, 2)); | ||
79 | + Message msg = wxMpTemplateMessageApi.send(param); | ||
80 | + if (!msg.isSuccess()) { | ||
81 | + log.error("【passport系统】发送续保提醒模板消息失败:{}", msg.getResult()); | ||
82 | + return msg.getResult(); | ||
83 | + } | ||
84 | + return ""; | ||
85 | + } catch (Exception e) { | ||
86 | + log.error("发送续保提醒模板消息失败", e); | ||
87 | + return "系统异常"; | ||
88 | + } | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * 发送首保消息提醒 | ||
93 | + * | ||
94 | + * @param messageParam | ||
95 | + * @return | ||
96 | + */ | ||
97 | + public String sendFMNotice(RenewInsurNoticeMessageParam messageParam) { | ||
98 | + log.info("开始发送首保消息提醒,senderId:{}", messageParam); | ||
99 | + try { | ||
100 | + WxMpTempMessageParam param = new WxMpTempMessageParam(); | ||
101 | + param.setCusId(messageParam.getMemberId()); | ||
102 | + param.setTempCode(getTemplateCode()); | ||
103 | + | ||
104 | + param.setRemark(new WxMpTempMessageData("点击“详情”可在线预约保养", "a61b29")); | ||
105 | + param.setTitle(new WxMpTempMessageData("您好!您的爱车的首次保养即将到期,请尽快进店进行保养!")); | ||
106 | + | ||
107 | + List<WxMpTempMessageData> keywords = Arrays.asList( | ||
108 | + new WxMpTempMessageData("首保提醒"), | ||
109 | + //门店 | ||
110 | + new WxMpTempMessageData(messageParam.getShopName()), | ||
111 | + //到期时间 | ||
112 | + new WxMpTempMessageData(messageParam.getExpireDate()) | ||
113 | + ); | ||
114 | + | ||
115 | + param.setKeyWordList(keywords); | ||
116 | + param.setPagePath(RESE_URL); | ||
117 | + Message<?> msg = wxMpTemplateMessageApi.send(param); | ||
118 | + if (!msg.isSuccess()) { | ||
119 | + log.error("【passport系统】发送首保提醒模板消息失败:{}", msg.getResult()); | ||
120 | + return msg.getResult(); | ||
121 | + } | ||
122 | + return ""; | ||
123 | + } catch (Exception e) { | ||
124 | + log.error("发送首保提醒模板消息失败", e); | ||
125 | + return "系统异常"; | ||
126 | + } | ||
127 | + } | ||
128 | + | ||
129 | + /** | ||
130 | + * 发送例保消息提醒 | ||
131 | + * | ||
132 | + * @param messageParam | ||
133 | + * @return | ||
134 | + */ | ||
135 | + public String sendRMNotice(RenewInsurNoticeMessageParam messageParam) { | ||
136 | + log.info("开始发送例保消息提醒,senderId:{}", messageParam); | ||
137 | + try { | ||
138 | + WxMpTempMessageParam param = new WxMpTempMessageParam(); | ||
139 | + param.setCusId(messageParam.getMemberId()); | ||
140 | + param.setTempCode(getTemplateCode()); | ||
141 | + | ||
142 | + param.setRemark(new WxMpTempMessageData("点击“详情”可在线预约保养", "a61b29")); | ||
143 | + param.setTitle(new WxMpTempMessageData("您好!您的爱车的下次保养即将到期,请尽快进店进行保养!")); | ||
144 | + | ||
145 | + List<WxMpTempMessageData> keywords = Arrays.asList( | ||
146 | + new WxMpTempMessageData("保养提醒"), | ||
147 | + //门店 | ||
148 | + new WxMpTempMessageData(messageParam.getShopName()), | ||
149 | + //到期时间 | ||
150 | + new WxMpTempMessageData(messageParam.getExpireDate()) | ||
151 | + ); | ||
152 | + | ||
153 | + param.setKeyWordList(keywords); | ||
154 | + param.setPagePath(RESE_URL); | ||
155 | + Message<?> msg = wxMpTemplateMessageApi.send(param); | ||
156 | + if (!msg.isSuccess()) { | ||
157 | + log.error("【passport系统】发送例保提醒模板消息失败:{}", msg.getResult()); | ||
158 | + return msg.getResult(); | ||
159 | + } | ||
160 | + return ""; | ||
161 | + } catch (Exception e) { | ||
162 | + log.error("发送例保提醒模板消息失败", e); | ||
163 | + return "系统异常"; | ||
164 | + } | ||
165 | + } | ||
166 | +} |
fw-hestia-rpc/src/main/java/cn/fw/hestia/rpc/passport/dto/OrderConfirmMessageParam.java
0 → 100644
1 | +package cn.fw.hestia.rpc.passport.dto; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +/** | ||
6 | + * 订单确认模板消息param | ||
7 | + * <p> | ||
8 | + * create at 2019-05-15 | ||
9 | + * | ||
10 | + * @author kurisu | ||
11 | + */ | ||
12 | +@Data | ||
13 | +public class OrderConfirmMessageParam { | ||
14 | + /** | ||
15 | + * 客户ID | ||
16 | + */ | ||
17 | + private Long cusId; | ||
18 | + /** | ||
19 | + * 工单号 | ||
20 | + */ | ||
21 | + private String orderNo; | ||
22 | + /** | ||
23 | + * 车牌号 | ||
24 | + */ | ||
25 | + private String carPlateNo; | ||
26 | + /** | ||
27 | + * 商家名称 | ||
28 | + */ | ||
29 | + private String dealerName; | ||
30 | + /** | ||
31 | + * 工单总金额 | ||
32 | + */ | ||
33 | + private Double totalValue; | ||
34 | +} |
fw-hestia-rpc/src/main/java/cn/fw/hestia/rpc/passport/dto/RenewInsurNoticeMessageParam.java
0 → 100644
1 | +package cn.fw.hestia.rpc.passport.dto; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import lombok.ToString; | ||
5 | + | ||
6 | +/** | ||
7 | + * 续保提醒模板消息param | ||
8 | + * <p> | ||
9 | + * create at 2019-05-15 | ||
10 | + * | ||
11 | + * @author kurisu | ||
12 | + */ | ||
13 | +@Data | ||
14 | +@ToString | ||
15 | +public class RenewInsurNoticeMessageParam { | ||
16 | + /** | ||
17 | + * 客户ID | ||
18 | + */ | ||
19 | + private Long memberId; | ||
20 | + /** | ||
21 | + * 保险公司名称 | ||
22 | + */ | ||
23 | + private String insurCompanyName; | ||
24 | + /** | ||
25 | + * 服务站 | ||
26 | + */ | ||
27 | + private String shopName; | ||
28 | + /** | ||
29 | + * 保险到期时间 | ||
30 | + */ | ||
31 | + private String expireDate; | ||
32 | +} |
fw-hestia-rpc/src/main/java/cn/fw/hestia/rpc/passport/dto/TemplateMessageParam.java
0 → 100644
1 | +package cn.fw.hestia.rpc.passport.dto; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import lombok.ToString; | ||
5 | + | ||
6 | +import java.util.Map; | ||
7 | + | ||
8 | +/** | ||
9 | + * 续保提醒模板消息param | ||
10 | + * <p> | ||
11 | + * create at 2019-05-15 | ||
12 | + * | ||
13 | + * @author kurisu | ||
14 | + */ | ||
15 | +@Data | ||
16 | +@ToString | ||
17 | +public class TemplateMessageParam { | ||
18 | + private Long memberId; | ||
19 | + private String path; | ||
20 | + private Map<String, String> paramMap; | ||
21 | +} |
fw-hestia-server/src/main/java/cn/fw/hestia/server/Application.java
@@ -11,6 +11,7 @@ import org.springframework.context.annotation.ComponentScan; | @@ -11,6 +11,7 @@ import org.springframework.context.annotation.ComponentScan; | ||
11 | import org.springframework.context.annotation.Configuration; | 11 | import org.springframework.context.annotation.Configuration; |
12 | import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; | 12 | import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; |
13 | import org.springframework.scheduling.annotation.EnableScheduling; | 13 | import org.springframework.scheduling.annotation.EnableScheduling; |
14 | +import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
14 | 15 | ||
15 | /** | 16 | /** |
16 | * 启动类 | 17 | * 启动类 |
@@ -21,6 +22,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; | @@ -21,6 +22,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; | ||
21 | @EnableAuthClient | 22 | @EnableAuthClient |
22 | @EnableScheduling | 23 | @EnableScheduling |
23 | @EnableDiscoveryClient | 24 | @EnableDiscoveryClient |
25 | +@EnableTransactionManagement | ||
24 | @EnableAutoConfiguration | 26 | @EnableAutoConfiguration |
25 | @Configuration | 27 | @Configuration |
26 | @EnableRedisRepositories | 28 | @EnableRedisRepositories |
fw-hestia-server/src/main/java/cn/fw/hestia/server/config/LocalDateTimeSerializerConfig.java
0 → 100644
1 | +package cn.fw.hestia.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 | +} | ||
0 | \ No newline at end of file | 99 | \ No newline at end of file |
fw-hestia-server/src/main/java/cn/fw/hestia/server/converter/Timestamp2DateConverter.java
0 → 100644
1 | +package cn.fw.hestia.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-hestia-server/src/main/java/cn/fw/hestia/server/converter/Timestamp2LocalDateConverter.java
0 → 100644
1 | +package cn.fw.hestia.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-hestia-server/src/main/java/cn/fw/hestia/server/converter/Timestamp2LocalDateTimeConverter.java
0 → 100644
1 | +package cn.fw.hestia.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-hestia-server/src/main/resources/application.yml
@@ -119,4 +119,6 @@ server: | @@ -119,4 +119,6 @@ server: | ||
119 | worker-threads: 50 | 119 | worker-threads: 50 |
120 | 120 | ||
121 | task: | 121 | task: |
122 | - switch: 'on' | ||
123 | \ No newline at end of file | 122 | \ No newline at end of file |
123 | + switch: 'on' | ||
124 | + | ||
125 | +templateCode: 'OPENTM408237350' | ||
124 | \ No newline at end of file | 126 | \ No newline at end of file |
pom.xml
@@ -23,7 +23,6 @@ | @@ -23,7 +23,6 @@ | ||
23 | <module>fw-hestia-domain</module> | 23 | <module>fw-hestia-domain</module> |
24 | <module>fw-hestia-sdk</module> | 24 | <module>fw-hestia-sdk</module> |
25 | <module>fw-hestia-rpc</module> | 25 | <module>fw-hestia-rpc</module> |
26 | - <module>fw-hestia-rpc</module> | ||
27 | </modules> | 26 | </modules> |
28 | 27 | ||
29 | <properties> | 28 | <properties> |
@@ -37,6 +36,7 @@ | @@ -37,6 +36,7 @@ | ||
37 | <rocketmq-spring-boot-starter.version>2.1.0</rocketmq-spring-boot-starter.version> | 36 | <rocketmq-spring-boot-starter.version>2.1.0</rocketmq-spring-boot-starter.version> |
38 | <redis.spring.boot.starter>1.0</redis.spring.boot.starter> | 37 | <redis.spring.boot.starter>1.0</redis.spring.boot.starter> |
39 | <fastjson>1.2.51</fastjson> | 38 | <fastjson>1.2.51</fastjson> |
39 | + <fw-passport-sdk.version>2.2.0</fw-passport-sdk.version> | ||
40 | </properties> | 40 | </properties> |
41 | 41 | ||
42 | <dependencyManagement> | 42 | <dependencyManagement> |
@@ -87,6 +87,11 @@ | @@ -87,6 +87,11 @@ | ||
87 | </dependency> | 87 | </dependency> |
88 | <dependency> | 88 | <dependency> |
89 | <groupId>cn.fw</groupId> | 89 | <groupId>cn.fw</groupId> |
90 | + <artifactId>fw-passport-sdk</artifactId> | ||
91 | + <version>${fw-passport-sdk.version}</version> | ||
92 | + </dependency> | ||
93 | + <dependency> | ||
94 | + <groupId>cn.fw</groupId> | ||
90 | <artifactId>fw-hestia-sdk</artifactId> | 95 | <artifactId>fw-hestia-sdk</artifactId> |
91 | <version>${fw.hestia.sdk.version}</version> | 96 | <version>${fw.hestia.sdk.version}</version> |
92 | </dependency> | 97 | </dependency> |