diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/tsa/TtsAgent.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/tsa/TtsAgent.java index 62e02b5..90e0de4 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/tsa/TtsAgent.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/tsa/TtsAgent.java @@ -1,5 +1,11 @@ package com.chinaunicom.mall.ebtp.extend.timeService.tsa; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; + /** * CA 时间戳服务接口 * @@ -60,6 +66,10 @@ public interface TtsAgent { public class TtsParseResult { // 时间 private String timestamp; + // 时间 + private Date datestamp; + // 时间 + private LocalDateTime localDateTimestamp; // hash 值 private String hash; @@ -67,11 +77,19 @@ public interface TtsAgent { // 签名证书 private String cert; - public TtsParseResult(String timestamp, String hash, String cert) { + public TtsParseResult(String timestamp, String hash, String cert){ super(); this.timestamp = timestamp; this.hash = hash; this.cert = cert; + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + this.localDateTimestamp =LocalDateTime.parse(timestamp,dtf); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + this.datestamp = sdf.parse(timestamp); + } catch (ParseException e) { + e.printStackTrace(); + } } public String getTimestamp() {