微信支付回调日期格式化

This commit is contained in:
gong
2026-01-15 15:17:57 +08:00
parent 9834c59fc7
commit aca48f84d9

View File

@@ -5,6 +5,9 @@ import com.czg.PayCst;
import com.czg.pay.PayNotifyRespDTO; import com.czg.pay.PayNotifyRespDTO;
import lombok.Data; import lombok.Data;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
/** /**
* @author yjjie * @author yjjie
* @date 2025/12/23 22:21 * @date 2025/12/23 22:21
@@ -119,13 +122,16 @@ public class WechatPayNotifyDataDto {
} }
public PayNotifyRespDTO convertToPayNotifyRespDTO() { public PayNotifyRespDTO convertToPayNotifyRespDTO() {
ZonedDateTime zonedDateTime = ZonedDateTime.parse(successTime);
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String time = zonedDateTime.format(outputFormatter);
PayNotifyRespDTO respDTO = new PayNotifyRespDTO() PayNotifyRespDTO respDTO = new PayNotifyRespDTO()
.setMchOrderNo(outTradeNo) .setMchOrderNo(outTradeNo)
.setThirdOrderNo(transactionId) .setThirdOrderNo(transactionId)
.setAmount(getPayAmount()) .setAmount(getPayAmount())
.setPlatform(PayCst.Platform.WECHAT) .setPlatform(PayCst.Platform.WECHAT)
.setExtData(attach) .setExtData(attach)
.setPaySuccessTime(successTime) .setPaySuccessTime(time)
.setErrorMsg(tradeStateDesc); .setErrorMsg(tradeStateDesc);
switch (tradeState) { switch (tradeState) {