zhuyifan

fix(payment): 修复支付回调中的时间格式转换问题

...@@ -54,8 +54,10 @@ import java.net.URLEncoder; ...@@ -54,8 +54,10 @@ import java.net.URLEncoder;
54 import java.nio.charset.StandardCharsets; 54 import java.nio.charset.StandardCharsets;
55 import java.text.MessageFormat; 55 import java.text.MessageFormat;
56 import java.text.ParseException; 56 import java.text.ParseException;
57 +import java.time.Instant;
57 import java.time.LocalDate; 58 import java.time.LocalDate;
58 import java.time.LocalDateTime; 59 import java.time.LocalDateTime;
60 +import java.time.ZoneOffset;
59 import java.util.ArrayList; 61 import java.util.ArrayList;
60 import java.util.List; 62 import java.util.List;
61 import java.util.stream.Collectors; 63 import java.util.stream.Collectors;
...@@ -161,6 +163,7 @@ public class PayServiceClient { ...@@ -161,6 +163,7 @@ public class PayServiceClient {
161 log.error("Order not found, orderId: {}", orderId); 163 log.error("Order not found, orderId: {}", orderId);
162 return false; 164 return false;
163 } 165 }
166 + log.info("Order callback, orderId: {}", orderId);
164 167
165 final var transType = paymentCallbackResult.getTransType(); 168 final var transType = paymentCallbackResult.getTransType();
166 if (transType.equals("00")) { 169 if (transType.equals("00")) {
...@@ -205,12 +208,18 @@ public class PayServiceClient { ...@@ -205,12 +208,18 @@ public class PayServiceClient {
205 orderServiceRpcClient.updateClientCustomerOrderPaymentResult(orderById, build); 208 orderServiceRpcClient.updateClientCustomerOrderPaymentResult(orderById, build);
206 log.info("callback updateClientCustomerOrder result: {}", updateResponse.getIsUpdated()); 209 log.info("callback updateClientCustomerOrder result: {}", updateResponse.getIsUpdated());
207 if (updateResponse.getIsUpdated()) { 210 if (updateResponse.getIsUpdated()) {
211 + String createdAt = Instant.ofEpochMilli(orderById.getCreatedAt())
212 + .atZone(ZoneOffset.UTC)
213 + .format(DateUtil.Y_M_D_H_M_S);
214 + String payTimed = Instant.ofEpochMilli(orderById.getPayTime())
215 + .atZone(ZoneOffset.UTC)
216 + .format(DateUtil.Y_M_D_H_M_S);
208 final var orderPaymentSuccessData = 217 final var orderPaymentSuccessData =
209 OrderPaymentSuccessData.builder() 218 OrderPaymentSuccessData.builder()
210 .orderId(orderById.getId()) 219 .orderId(orderById.getId())
211 .orderCode(orderById.getOrderCode()) 220 .orderCode(orderById.getOrderCode())
212 - .createTime(DateUtil.formatDate(orderById.getCreatedAt(), DateUtil.Y_M_D_H_M_S)) 221 + .createTime(createdAt)
213 - .payTime(DateUtil.formatDate(orderById.getPayTime(), DateUtil.Y_M_D_H_M_S)) 222 + .payTime(payTimed)
214 .build(); 223 .build();
215 final var data = 224 final var data =
216 SocketMessage.<OrderPaymentSuccessData>builder() 225 SocketMessage.<OrderPaymentSuccessData>builder()
...@@ -340,7 +349,9 @@ public class PayServiceClient { ...@@ -340,7 +349,9 @@ public class PayServiceClient {
340 String appId = businessConfig.getPayClientId(); 349 String appId = businessConfig.getPayClientId();
341 350
342 // 构建paycontent 351 // 构建paycontent
343 - String payTime = DateUtil.formatDate(orderById.getPayTime(), DateUtil.YMDHMS); 352 + String payTime = Instant.ofEpochMilli(orderById.getPayTime())
353 + .atZone(ZoneOffset.UTC)
354 + .format(DateUtil.YMDHMS);
344 355
345 BigDecimal price = 356 BigDecimal price =
346 new BigDecimal(orderById.getPayPrice()) 357 new BigDecimal(orderById.getPayPrice())
......