From 992991c25a5574387a12d81c1511640ac531e92c Mon Sep 17 00:00:00 2001 From: zhangqinbin <181961702@qq.com> Date: Thu, 1 Apr 2021 16:17:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=88=B3=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/ebtp/extend/timeService/TimeServiceConstant.java | 1 + .../timeService/controller/TiemServiceController.java | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/TimeServiceConstant.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/TimeServiceConstant.java index 8bfe14f..05c9516 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/TimeServiceConstant.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/TimeServiceConstant.java @@ -42,6 +42,7 @@ public class TimeServiceConstant { */ public String signTimeStamp(String data){ try{ + data = data!=null&&!"".equals(data)?data:"system"; //第三步:申请时间戳,向时间戳服务器发起申请时间戳请求,返回时间戳结果 TSASignedResult result = client.signTimeStamp("SHA1", data.getBytes("UTF-8")); //第四步:获取时间戳数据,tsaData为时间戳数据,验证时间戳时使用,如果不是实时验证,需要将时间戳数据保存在应用服务器 diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/controller/TiemServiceController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/controller/TiemServiceController.java index 9de8123..d643128 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/controller/TiemServiceController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/controller/TiemServiceController.java @@ -20,7 +20,7 @@ public class TiemServiceController { * @return 时间戳加密原文 */ @GetMapping(value = "/signTimeStamp") - public BaseResponse signTimeStamp(@ApiParam(value = "待申请时间戳的原文", required = true) @RequestParam(name = "data") String data) { + public BaseResponse signTimeStamp(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data") String data) { TimeServiceConstant constant = new TimeServiceConstant(); return BaseResponse.success(constant.signTimeStamp(data)); } @@ -42,7 +42,7 @@ public class TiemServiceController { * @return 时间戳对象 */ @PostMapping(value = "/getServiceTimeObj") - public BaseResponse getServiceTimeObj(@ApiParam(value = "待申请时间戳的原文", required = true) @RequestParam(name = "data") String data) { + public BaseResponse getServiceTimeObj(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data") String data) { TimeServiceConstant constant = new TimeServiceConstant(); return BaseResponse.success(constant.getServiceTimeObj(data)); } @@ -52,7 +52,7 @@ public class TiemServiceController { * @return 时间戳对象 */ @GetMapping(value = "/getServiceTime") - public BaseResponse getServiceTime(@ApiParam(value = "待申请时间戳的原文", required = true) @RequestParam(name = "data") String data) { + public BaseResponse getServiceTime(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data") String data) { TimeServiceConstant constant = new TimeServiceConstant(); return BaseResponse.success(constant.getServiceTime(data)); }