From 39c387dbed3017049a48b8ec2a23cb13be296d13 Mon Sep 17 00:00:00 2001 From: zhangqinbin <181961702@qq.com> Date: Tue, 13 Apr 2021 09:49:43 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=88=B3=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1BUG=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../timeService/TimeServiceConstant.java | 21 ++++++++++++++----- .../controller/TimeServiceController.java | 8 +++---- 2 files changed, 20 insertions(+), 9 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 3f300f2..bfd086d 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 @@ -64,7 +64,21 @@ public class TimeServiceConstant { * @param timestamp 时间戳加密原文 * @return 时间戳对象 */ - public TSAVerifyResult verifyTimeStamp(String timestamp){ + public TtsAgent.TtsParseResult verifyTimeStamp2(String timestamp){ + try{ + log.info("timestamp -->"+timestamp); + TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp); + String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime()); + TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(time, HelperUtil.bytesToHexString(verifyResult.getData()), + verifyResult.getSignerSubject()); + return ttsParseResult; + }catch (Exception e){ + log.error("解析时间戳", e); + } + return null; + } + + private TSAVerifyResult verifyTimeStamp(String timestamp){ try{ log.info("timestamp -->"+timestamp); TSAVerifyResult verifyResult = client.verifyTimeStamp(Base64.decodeBase64(timestamp)); @@ -83,10 +97,7 @@ public class TimeServiceConstant { public TtsAgent.TtsParseResult getServiceTimeObj(String data){ try{ String timestamp = this.signTimeStamp(data); - TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp); - String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime()); - TtsAgent.TtsParseResult ttsParseResult = new TtsAgent.TtsParseResult(time, HelperUtil.bytesToHexString(verifyResult.getData()), - verifyResult.getSignerSubject()); + TtsAgent.TtsParseResult ttsParseResult = this.verifyTimeStamp2(timestamp); return ttsParseResult; }catch (Exception e){ log.error("获取时间戳异常", e); diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/controller/TimeServiceController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/controller/TimeServiceController.java index d2e8503..3720306 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/controller/TimeServiceController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/timeService/controller/TimeServiceController.java @@ -39,10 +39,10 @@ public class TimeServiceController { * @return 时间戳对象 */ @ApiOperation("解析时间戳加密原文") - @GetMapping(value = "/verifyTimeStamp") - public BaseResponse verifyTimeStamp(@ApiParam(value = "时间戳加密原文", required = true) @RequestBody String timestamp) { + @PostMapping(value = "/verifyTimeStamp") + public BaseResponse verifyTimeStamp(@ApiParam(value = "时间戳加密原文", required = true) @RequestBody String timestamp) { TimeServiceConstant constant = new TimeServiceConstant(); - return BaseResponse.success(constant.verifyTimeStamp(timestamp)); + return BaseResponse.success(constant.verifyTimeStamp2(timestamp)); } /** @@ -51,7 +51,7 @@ public class TimeServiceController { * @return 时间戳对象 */ @ApiOperation("直接获取时间戳对象(内涵日期)") - @PostMapping(value = "/getServiceTimeObj") + @GetMapping(value = "/getServiceTimeObj") public BaseResponse getServiceTimeObj(@ApiParam(value = "待申请时间戳的原文", required = false) @RequestParam(name = "data",required = false) String data) { TimeServiceConstant constant = new TimeServiceConstant(); return BaseResponse.success(constant.getServiceTimeObj(data)); From 17b964fef06cee35b9d6d8ae339893934e18c8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=87=E5=AE=B8=E8=88=9C?= Date: Thu, 22 Apr 2021 14:18:33 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0JVM=E5=A0=86=E5=86=85?= =?UTF-8?q?=E5=AD=98=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pro.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pro.yaml b/pro.yaml index ba8569a..7046d70 100644 --- a/pro.yaml +++ b/pro.yaml @@ -84,6 +84,14 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP + - name: JAVA_TOOL_OPTIONS + value: + -XX:+UnlockExperimentalVMOptions + -XX:+UseContainerSupport + -XX:+UseCGroupMemoryLimitForHeap + -XX:InitialRAMPercentage=40.0 + -XX:MinRAMPercentage=20.0 + -XX:MaxRAMPercentage=80.0 --- kind: Service apiVersion: v1 From 8a7a4dae15bfead28c230e51f14660ede6896008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=87=E5=AE=B8=E8=88=9C?= Date: Thu, 22 Apr 2021 14:19:45 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/logback.xml | 115 +++++++++++---------------------- 1 file changed, 36 insertions(+), 79 deletions(-) diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index ab31609..0c4c923 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,89 +1,46 @@ - - + + ${logback.appname} - - - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{50} - %msg%n - - - + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} ${MY_POD_IP} %contextName [%thread] %-5level %logger{50}  - [ppTraceId: %X{PtxId}, ppSpanId: %X{PspanId}] - %msg%n + + + - - - - - ERROR - - DENY - - ACCEPT - - - ${logback.logdir}/info.${logback.appname}.log - - - - ${logback.logdir}/info.${logback.appname}.%d{yyyy-MM-dd}.log - - 3 - - true - - - - - - UTF-8 - %d [%thread] %-5level %logger{64} %line - %msg%n - - + - - - - Error - - - ${logback.logdir}/error.${logback.appname}.log - - - - ${logback.logdir}/error.${logback.appname}.%d{yyyy-MM-dd}.log - - 3 - - true - - - - - - UTF-8 - %d [%thread] %-5level %logger{128} %line - %msg%n - - - - - - - - - - + ${logback.logdir}/${logback.appname}-${MY_POD_IP}.log + + + + ${logback.logdir}/${logback.appname}-${MY_POD_IP}.%d{yyyy-MM-dd}.log + + 3 + + true + + + + + + UTF-8 + %d ${MY_POD_IP} [%thread] %-5level %logger{64} %line  - [ppTraceId: %X{PtxId}, ppSpanId: %X{PspanId}] - %msg%n + + + + + + + + From 4103d833cc55ebb96383eb67ccf37ab6744ea6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=87=E5=AE=B8=E8=88=9C?= Date: Thu, 22 Apr 2021 14:43:19 +0800 Subject: [PATCH 4/4] Update logback.xml --- src/main/resources/logback.xml | 78 ++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 0c4c923..cf6d74b 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,46 +1,50 @@ - - + + ${logback.appname} - - - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} ${MY_POD_IP} %contextName [%thread] %-5level %logger{50}  - [ppTraceId: %X{PtxId}, ppSpanId: %X{PspanId}] - %msg%n - - - + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} ${MY_POD_IP} %contextName [%thread] %-5level %logger{50}  - [ppTraceId: %X{PtxId}, ppSpanId: %X{PspanId}] - %msg%n + + + - - - ${logback.logdir}/${logback.appname}-${MY_POD_IP}.log - - - - ${logback.logdir}/${logback.appname}-${MY_POD_IP}.%d{yyyy-MM-dd}.log - - 3 - - true - - - - - - UTF-8 - %d ${MY_POD_IP} [%thread] %-5level %logger{64} %line  - [ppTraceId: %X{PtxId}, ppSpanId: %X{PspanId}] - %msg%n - - - - - - - - + + + ${logback.logdir}/${logback.appname}-${MY_POD_IP}.log + + + + ${logback.logdir}/${logback.appname}-${MY_POD_IP}.%d{yyyy-MM-dd}.log + + 3 + + true + + + + + + UTF-8 + %d ${MY_POD_IP} [%thread] %-5level %logger{64} %line - [ppTraceId: %X{PtxId}, ppSpanId: %X{PspanId}] - %msg%n + + + + + + + + +