feat:修改书签时改变icon
This commit is contained in:
parent
8b2f36fb72
commit
ee499905b3
@ -13,10 +13,7 @@ import com.fanxb.bookmark.business.bookmark.service.PinYinService;
|
|||||||
import com.fanxb.bookmark.common.constant.EsConstant;
|
import com.fanxb.bookmark.common.constant.EsConstant;
|
||||||
import com.fanxb.bookmark.common.constant.RedisConstant;
|
import com.fanxb.bookmark.common.constant.RedisConstant;
|
||||||
import com.fanxb.bookmark.common.entity.Bookmark;
|
import com.fanxb.bookmark.common.entity.Bookmark;
|
||||||
import com.fanxb.bookmark.common.util.EsUtil;
|
import com.fanxb.bookmark.common.util.*;
|
||||||
import com.fanxb.bookmark.common.util.HttpUtil;
|
|
||||||
import com.fanxb.bookmark.common.util.RedisUtil;
|
|
||||||
import com.fanxb.bookmark.common.util.UserContextHolder;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
import org.elasticsearch.index.query.QueryBuilders;
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
@ -76,7 +73,7 @@ public class BookmarkServiceImpl implements BookmarkService {
|
|||||||
for (int i = 0, length = elements.size(); i < length; i++) {
|
for (int i = 0, length = elements.size(); i < length; i++) {
|
||||||
dealBookmark(userId, elements.get(i), path, sortBase + i, bookmarks);
|
dealBookmark(userId, elements.get(i), path, sortBase + i, bookmarks);
|
||||||
}
|
}
|
||||||
//每一千条处理插入一次
|
//每一千条处理插入一次,批量更新搜索字段
|
||||||
List<Bookmark> tempList = new ArrayList<>(1000);
|
List<Bookmark> tempList = new ArrayList<>(1000);
|
||||||
for (int i = 0; i < bookmarks.size(); i++) {
|
for (int i = 0; i < bookmarks.size(); i++) {
|
||||||
tempList.add(bookmarks.get(i));
|
tempList.add(bookmarks.get(i));
|
||||||
@ -87,6 +84,12 @@ public class BookmarkServiceImpl implements BookmarkService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
userApi.versionPlus(userId);
|
userApi.versionPlus(userId);
|
||||||
|
|
||||||
|
//异步更新icon
|
||||||
|
ThreadPoolUtil.execute(() -> {
|
||||||
|
updateUserBookmarkIcon(userId);
|
||||||
|
userApi.versionPlus(userId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -199,6 +202,7 @@ public class BookmarkServiceImpl implements BookmarkService {
|
|||||||
bookmark.setAddTime(bookmark.getCreateTime());
|
bookmark.setAddTime(bookmark.getCreateTime());
|
||||||
if (bookmark.getType() == Bookmark.BOOKMARK_TYPE) {
|
if (bookmark.getType() == Bookmark.BOOKMARK_TYPE) {
|
||||||
pinYinService.changeBookmark(bookmark);
|
pinYinService.changeBookmark(bookmark);
|
||||||
|
bookmark.setIcon(getIconBase64(bookmark.getUrl()));
|
||||||
}
|
}
|
||||||
bookmarkDao.insertOne(bookmark);
|
bookmarkDao.insertOne(bookmark);
|
||||||
userApi.versionPlus(userId);
|
userApi.versionPlus(userId);
|
||||||
@ -211,6 +215,7 @@ public class BookmarkServiceImpl implements BookmarkService {
|
|||||||
bookmark.setUserId(userId);
|
bookmark.setUserId(userId);
|
||||||
if (bookmark.getType() == 0) {
|
if (bookmark.getType() == 0) {
|
||||||
pinYinService.changeBookmark(bookmark);
|
pinYinService.changeBookmark(bookmark);
|
||||||
|
bookmark.setIcon(getIconBase64(bookmark.getUrl()));
|
||||||
}
|
}
|
||||||
bookmarkDao.editBookmark(bookmark);
|
bookmarkDao.editBookmark(bookmark);
|
||||||
userApi.versionPlus(userId);
|
userApi.versionPlus(userId);
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
<update id="editBookmark" parameterType="com.fanxb.bookmark.common.entity.Bookmark">
|
<update id="editBookmark" parameterType="com.fanxb.bookmark.common.entity.Bookmark">
|
||||||
update bookmark
|
update bookmark
|
||||||
set name = #{name}, url = #{url},searchKey = #{searchKey}
|
set name = #{name}, url = #{url},searchKey = #{searchKey},icon=#{icon}
|
||||||
where bookmarkId = #{bookmarkId} and userId = #{userId}
|
where bookmarkId = #{bookmarkId} and userId = #{userId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user