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; }