mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 12:09:13 +08:00
fix(项目设置): 分享报告时间检验
--user=郭雨琦 分享报告时间检验
This commit is contained in:
parent
c4d7514bd0
commit
723178b2f0
@ -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(shareInfo.getId());
|
||||
private void millisCheck(long compareMillis, long millis,String shareInfoId) {
|
||||
if (compareMillis>millis) {
|
||||
shareInfoMapper.deleteByPrimaryKey(shareInfoId);
|
||||
MSException.throwException("连接已失效,请重新获取!");
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user