个人中心 我的收藏 三天内显示 时间排序
This commit is contained in:
+19
@@ -21,7 +21,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -142,6 +144,7 @@ public class PersonCollectEOServiceImpl extends ServiceImpl<PersonCollectEODao,
|
||||
List<String> ids = new ArrayList<>(Arrays.asList(modeType.split(",")));
|
||||
wrapper.in("collect_type",ids);
|
||||
}
|
||||
wrapper.orderByDesc("creation_Time");
|
||||
|
||||
if (pageNo != null) {
|
||||
basePage.setPage(pageNo);
|
||||
@@ -156,6 +159,22 @@ public class PersonCollectEOServiceImpl extends ServiceImpl<PersonCollectEODao,
|
||||
|
||||
|
||||
IPage<TsPersonCollect> page = this.page(new Page<>(basePage.getPage(), basePage.getPageSize()), wrapper);
|
||||
//三天以内收藏的 标题名称后面加 new 一小时3600000 一天时间戳 为 86400000
|
||||
long newTime = 86400000;
|
||||
Date date = new Date();
|
||||
long time = date.getTime();
|
||||
|
||||
|
||||
for (TsPersonCollect data : page.getRecords()){
|
||||
long creationTime = data.getCreationTime().getTime();
|
||||
if(creationTime + newTime == time || creationTime + newTime > time){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("<span style=\'color:red\'>"+"(new)"+"</span>").append(data.getCollectTitle());
|
||||
data.setCollectTitle(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Result.success(page);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user