parent
b4480e0ba6
commit
e606ce895a
|
@ -534,14 +534,14 @@ public class ShareInfoService {
|
||||||
millisCheck(shareInfo,1000 * 60 * 60 * 24);
|
millisCheck(shareInfo,1000 * 60 * 60 * 24);
|
||||||
}else {
|
}else {
|
||||||
String expr= projectApplication.getShareReportExpr();
|
String expr= projectApplication.getShareReportExpr();
|
||||||
long timeMills = getTimeMills(expr);
|
long timeMills = getTimeMills(shareInfo.getUpdateTime(),expr);
|
||||||
millisCheck(shareInfo,timeMills);
|
millisCheck(shareInfo,timeMills);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void millisCheck(ShareInfo shareInfo, long millis) {
|
private void millisCheck(ShareInfo shareInfo, long millis) {
|
||||||
if (System.currentTimeMillis() - shareInfo.getUpdateTime() > millis) {
|
if (shareInfo.getUpdateTime()<millis) {
|
||||||
shareInfoMapper.deleteByPrimaryKey(shareInfo.getId());
|
shareInfoMapper.deleteByPrimaryKey(shareInfo.getId());
|
||||||
MSException.throwException("连接已失效,请重新获取!");
|
MSException.throwException("连接已失效,请重新获取!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package io.metersphere.api.service.utils;
|
package io.metersphere.api.service.utils;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.*;
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
|
|
||||||
public class ShareUtill {
|
public class ShareUtill {
|
||||||
|
|
||||||
|
@ -13,8 +11,10 @@ public class ShareUtill {
|
||||||
private static final String UNIT_MONTH = "M";
|
private static final String UNIT_MONTH = "M";
|
||||||
private static final String UNIT_YEAR = "Y";
|
private static final String UNIT_YEAR = "Y";
|
||||||
|
|
||||||
public static long getTimeMills(String expr) {
|
public static long getTimeMills(long time,String expr) {
|
||||||
LocalDateTime localDateTime = LocalDateTime.of(LocalDate.now(), LocalTime.now().withMinute(0).withSecond(0).withNano(0));
|
Instant instant = Instant.ofEpochMilli(time);
|
||||||
|
ZoneId zone = ZoneId.systemDefault();
|
||||||
|
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
|
||||||
long timeMills = 0;
|
long timeMills = 0;
|
||||||
LocalDateTime date = exprToLocalDateTime(localDateTime, expr);
|
LocalDateTime date = exprToLocalDateTime(localDateTime, expr);
|
||||||
if (date != null) {
|
if (date != null) {
|
||||||
|
|
|
@ -10,6 +10,17 @@ CREATE TABLE `operating_log_resource`
|
||||||
KEY `source_id_index` (`source_id`)
|
KEY `source_id_index` (`source_id`)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci;
|
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `project_application`
|
||||||
|
(
|
||||||
|
`project_id` varchar(50) DEFAULT NULL,
|
||||||
|
`type` varchar(50) DEFAULT NULL,
|
||||||
|
`share_report_expr`varchar(50) NOT NULL DEFAULT '24H',
|
||||||
|
UNIQUE KEY `project_application_pk` (`project_id`, `type`),
|
||||||
|
KEY `project_application_project_id_index` (`project_id`),
|
||||||
|
KEY `project_application_type` (`type`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci;
|
||||||
|
|
||||||
-- permission
|
-- permission
|
||||||
DROP PROCEDURE IF EXISTS test_personal;
|
DROP PROCEDURE IF EXISTS test_personal;
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
|
|
Loading…
Reference in New Issue