From 723178b2f0c7fcca9aaa94ebe8abc199281de805 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 16 Feb 2022 14:09:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A1=B9=E7=9B=AE=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E6=8A=A5=E5=91=8A=E6=97=B6=E9=97=B4=E6=A3=80?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 分享报告时间检验 --- .../io/metersphere/api/service/ShareInfoService.java | 12 ++++++------ .../io/metersphere/api/service/utils/ShareUtill.java | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java b/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java index 91a9d074c4..2be912449b 100644 --- a/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java +++ b/backend/src/main/java/io/metersphere/api/service/ShareInfoService.java @@ -527,22 +527,22 @@ public class ShareInfoService { type = "TRACK"; } if(StringUtils.isBlank(type)){ - millisCheck(shareInfo,1000 * 60 * 60 * 24); + millisCheck(System.currentTimeMillis() - shareInfo.getUpdateTime() ,1000 * 60 * 60 * 24,shareInfo.getId()); }else{ ProjectApplication projectApplication = projectApplicationService.getProjectApplication(SessionUtils.getCurrentProjectId(),type); if(projectApplication.getProjectId()==null){ - millisCheck(shareInfo,1000 * 60 * 60 * 24); + millisCheck(System.currentTimeMillis() - shareInfo.getUpdateTime() ,1000 * 60 * 60 * 24,shareInfo.getId()); }else { String expr= projectApplication.getShareReportExpr(); long timeMills = getTimeMills(shareInfo.getUpdateTime(),expr); - millisCheck(shareInfo,timeMills); + millisCheck(System.currentTimeMillis(),timeMills,shareInfo.getId()); } } } - private void millisCheck(ShareInfo shareInfo, long millis) { - if (shareInfo.getUpdateTime()millis) { + shareInfoMapper.deleteByPrimaryKey(shareInfoId); MSException.throwException("连接已失效,请重新获取!"); } } diff --git a/backend/src/main/java/io/metersphere/api/service/utils/ShareUtill.java b/backend/src/main/java/io/metersphere/api/service/utils/ShareUtill.java index 16cc933f27..937f09fa5f 100644 --- a/backend/src/main/java/io/metersphere/api/service/utils/ShareUtill.java +++ b/backend/src/main/java/io/metersphere/api/service/utils/ShareUtill.java @@ -28,13 +28,13 @@ public class ShareUtill { String unit = expr.substring(expr.length() - 1); int quantity = Integer.parseInt(expr.substring(0, expr.length() - 1)); if(StringUtils.equals(unit,UNIT_HOUR)){ - date = localDateTime.minusHours(quantity); + date = localDateTime.plusHours(quantity); } else if (StringUtils.equals(unit, UNIT_DAY)) { - date = localDateTime.minusDays(quantity); + date = localDateTime.plusDays(quantity); } else if (StringUtils.equals(unit, UNIT_MONTH)) { - date = localDateTime.minusMonths(quantity); + date = localDateTime.plusMonths(quantity); } else if (StringUtils.equals(unit, UNIT_YEAR)) { - date = localDateTime.minusYears(quantity); + date = localDateTime.plusYears(quantity); } return date; }