parent
c4d7514bd0
commit
723178b2f0
|
@ -527,22 +527,22 @@ public class ShareInfoService {
|
||||||
type = "TRACK";
|
type = "TRACK";
|
||||||
}
|
}
|
||||||
if(StringUtils.isBlank(type)){
|
if(StringUtils.isBlank(type)){
|
||||||
millisCheck(shareInfo,1000 * 60 * 60 * 24);
|
millisCheck(System.currentTimeMillis() - shareInfo.getUpdateTime() ,1000 * 60 * 60 * 24,shareInfo.getId());
|
||||||
}else{
|
}else{
|
||||||
ProjectApplication projectApplication = projectApplicationService.getProjectApplication(SessionUtils.getCurrentProjectId(),type);
|
ProjectApplication projectApplication = projectApplicationService.getProjectApplication(SessionUtils.getCurrentProjectId(),type);
|
||||||
if(projectApplication.getProjectId()==null){
|
if(projectApplication.getProjectId()==null){
|
||||||
millisCheck(shareInfo,1000 * 60 * 60 * 24);
|
millisCheck(System.currentTimeMillis() - shareInfo.getUpdateTime() ,1000 * 60 * 60 * 24,shareInfo.getId());
|
||||||
}else {
|
}else {
|
||||||
String expr= projectApplication.getShareReportExpr();
|
String expr= projectApplication.getShareReportExpr();
|
||||||
long timeMills = getTimeMills(shareInfo.getUpdateTime(),expr);
|
long timeMills = getTimeMills(shareInfo.getUpdateTime(),expr);
|
||||||
millisCheck(shareInfo,timeMills);
|
millisCheck(System.currentTimeMillis(),timeMills,shareInfo.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void millisCheck(ShareInfo shareInfo, long millis) {
|
private void millisCheck(long compareMillis, long millis,String shareInfoId) {
|
||||||
if (shareInfo.getUpdateTime()<millis) {
|
if (compareMillis>millis) {
|
||||||
shareInfoMapper.deleteByPrimaryKey(shareInfo.getId());
|
shareInfoMapper.deleteByPrimaryKey(shareInfoId);
|
||||||
MSException.throwException("连接已失效,请重新获取!");
|
MSException.throwException("连接已失效,请重新获取!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,13 @@ public class ShareUtill {
|
||||||
String unit = expr.substring(expr.length() - 1);
|
String unit = expr.substring(expr.length() - 1);
|
||||||
int quantity = Integer.parseInt(expr.substring(0, expr.length() - 1));
|
int quantity = Integer.parseInt(expr.substring(0, expr.length() - 1));
|
||||||
if(StringUtils.equals(unit,UNIT_HOUR)){
|
if(StringUtils.equals(unit,UNIT_HOUR)){
|
||||||
date = localDateTime.minusHours(quantity);
|
date = localDateTime.plusHours(quantity);
|
||||||
} else if (StringUtils.equals(unit, UNIT_DAY)) {
|
} else if (StringUtils.equals(unit, UNIT_DAY)) {
|
||||||
date = localDateTime.minusDays(quantity);
|
date = localDateTime.plusDays(quantity);
|
||||||
} else if (StringUtils.equals(unit, UNIT_MONTH)) {
|
} else if (StringUtils.equals(unit, UNIT_MONTH)) {
|
||||||
date = localDateTime.minusMonths(quantity);
|
date = localDateTime.plusMonths(quantity);
|
||||||
} else if (StringUtils.equals(unit, UNIT_YEAR)) {
|
} else if (StringUtils.equals(unit, UNIT_YEAR)) {
|
||||||
date = localDateTime.minusYears(quantity);
|
date = localDateTime.plusYears(quantity);
|
||||||
}
|
}
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue