zhuyifan

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

......@@ -54,8 +54,10 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.text.ParseException;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
......@@ -161,6 +163,7 @@ public class PayServiceClient {
log.error("Order not found, orderId: {}", orderId);
return false;
}
log.info("Order callback, orderId: {}", orderId);
final var transType = paymentCallbackResult.getTransType();
if (transType.equals("00")) {
......@@ -205,12 +208,18 @@ public class PayServiceClient {
orderServiceRpcClient.updateClientCustomerOrderPaymentResult(orderById, build);
log.info("callback updateClientCustomerOrder result: {}", updateResponse.getIsUpdated());
if (updateResponse.getIsUpdated()) {
String createdAt = Instant.ofEpochMilli(orderById.getCreatedAt())
.atZone(ZoneOffset.UTC)
.format(DateUtil.Y_M_D_H_M_S);
String payTimed = Instant.ofEpochMilli(orderById.getPayTime())
.atZone(ZoneOffset.UTC)
.format(DateUtil.Y_M_D_H_M_S);
final var orderPaymentSuccessData =
OrderPaymentSuccessData.builder()
.orderId(orderById.getId())
.orderCode(orderById.getOrderCode())
.createTime(DateUtil.formatDate(orderById.getCreatedAt(), DateUtil.Y_M_D_H_M_S))
.payTime(DateUtil.formatDate(orderById.getPayTime(), DateUtil.Y_M_D_H_M_S))
.createTime(createdAt)
.payTime(payTimed)
.build();
final var data =
SocketMessage.<OrderPaymentSuccessData>builder()
......@@ -340,7 +349,9 @@ public class PayServiceClient {
String appId = businessConfig.getPayClientId();
// 构建paycontent
String payTime = DateUtil.formatDate(orderById.getPayTime(), DateUtil.YMDHMS);
String payTime = Instant.ofEpochMilli(orderById.getPayTime())
.atZone(ZoneOffset.UTC)
.format(DateUtil.YMDHMS);
BigDecimal price =
new BigDecimal(orderById.getPayPrice())
......