admin
2021-02-01 c6c5a8ce0f42d46ea2fe0312c9eda67a49fd3917
src/main/java/com/yeshi/buwan/service/imp/SearchService.java
@@ -5,6 +5,8 @@
import com.yeshi.buwan.domain.web.DetailSystemSelect;
import com.yeshi.buwan.domain.web.HotSearchAdmin;
import com.yeshi.buwan.dto.search.SolrResultDTO;
import com.yeshi.buwan.dto.search.SolrVideoSearchFilter;
import com.yeshi.buwan.service.inter.VideoResourceMapExtraInfoService;
import com.yeshi.buwan.service.manager.SolrAlbumDataManager;
import com.yeshi.buwan.util.*;
import com.yeshi.buwan.util.factory.VideoInfoFactory;
@@ -40,11 +42,14 @@
    @Resource
    private SolrAlbumDataManager solrAlbumDataManager;
    @Resource
    private VideoResourceMapExtraInfoService videoResourceMapExtraInfoService;
    @SuppressWarnings("rawtypes")
    @Cacheable(value = "userCache", key = "'suggestSearch'+'-'+#key+'-'+#system")
    public List<String> suggestSearch(String key, String system) {
        if (StringUtil.isNullOrEmpty(key) || key.startsWith("%"))
            return new ArrayList<String>();
            return new ArrayList<>();
        List<String> list;
        Session session = null;
@@ -55,7 +60,7 @@
            sql = "select name as result from wk_video_video where name like ?";
        }
        list = new ArrayList<String>();
        list = new ArrayList<>();
        List li = null;
        try {
@@ -81,7 +86,7 @@
        }
        Iterator<String> it = set.iterator();
        list = new ArrayList<String>();
        list = new ArrayList<>();
        while (it.hasNext()) {
            list.add(it.next());
            if (list.size() > 10)
@@ -123,7 +128,7 @@
                    .append(") order by REPLACE(v.name,?,'') ,v.watchCount desc").toString();
        else
            sql = "from VideoInfo v where v.show='1' and (v.name like ?) order by REPLACE(v.name,?,''),v.watchCount desc";// 改为sql
        List<Serializable> list = new ArrayList<Serializable>();
        List<Serializable> list = new ArrayList<>();
        BaiduVideoUtil util = new BaiduVideoUtil();
        List<VideoInfo> localList = videoInfoDao.list(sql, (page - 1) * Constant.pageCount, Constant.pageCount,
                new String[]{(new StringBuilder("")).append(key).append("%").toString(), key});
@@ -184,7 +189,7 @@
        searchDao.create(sh);
        // 查询数据库
        List<VideoInfo> list = new ArrayList<VideoInfo>();
        List<VideoInfo> list = new ArrayList<>();
        List<VideoInfo> localList = null;
        try {
            long startt = System.currentTimeMillis();
@@ -208,7 +213,7 @@
                sql = sql.substring(0, sql.length() - 9);
            List rlist = videoInfoDao.sqlList(sql);
            List<Integer> pList = new ArrayList<Integer>();
            List<Integer> pList = new ArrayList<>();
            for (int i = 0; i < localList.size(); i++) {
                if (Integer.parseInt(rlist.get(i) + "") < 1) {
                    pList.add(i);
@@ -263,7 +268,7 @@
        //专辑数量
        long albumCount = 0L;
        List<VideoInfo> list = new ArrayList<VideoInfo>();
        List<VideoInfo> list = new ArrayList<>();
        List<VideoInfo> localList = null;
        try {
            long startt = System.currentTimeMillis();
@@ -275,7 +280,12 @@
            //专辑视频集合
            Set<String> solrAlbumVids = new HashSet<>();
            SolrResultDTO solrResultDTO = solrAlbumDataManager.findByKey(key, 1, videoType == 0 ? null : videoType, page, pageSize);
            SolrVideoSearchFilter filter = new SolrVideoSearchFilter();
            filter.setKey(key);
            filter.setVideoType(videoType == 0 ? null : videoType);
            filter.setContentType(1);
            SolrResultDTO solrResultDTO = solrAlbumDataManager.find(filter, page, pageSize);
            if (solrResultDTO != null) {
                albumCount = solrResultDTO.getTotalCount();
@@ -335,7 +345,7 @@
                sql = sql.substring(0, sql.length() - 9);
            List rlist = StringUtil.isNullOrEmpty(sql) ? new ArrayList() : videoInfoDao.sqlList(sql);
            List<Integer> pList = new ArrayList<Integer>();
            List<Integer> pList = new ArrayList<>();
            for (int i = 0; i < localList.size(); i++) {
                if (Integer.parseInt(rlist.get(i) + "") < 1) {
                    pList.add(i);
@@ -360,6 +370,10 @@
                list.add(info);
            }
        }
        //获取附加信息
        list = videoResourceMapExtraInfoService.batchExtraInfo(list, resourceList);
        return new VideoListResultVO(list, videoType == 0 ? albumCount : 1000L);
    }
@@ -379,7 +393,7 @@
    @SuppressWarnings({"rawtypes"})
    @Cacheable(value = "userCache", key = "'getHotSearchList'+'-'+#system")
    public List<String> getHotSearchList(String system) {
        List<String> list = new ArrayList<String>();
        List<String> list = new ArrayList<>();
        try {
            List li = searchDao.sqlList(
                    "SELECT h.`name` FROM wk_video_super_hotsearch sh LEFT JOIN wk_video_hotsearch h ON sh.`hotsearchid`=h.`id`  WHERE sh.`detailsystem`=? ORDER BY h.`orderby` DESC",
@@ -453,7 +467,7 @@
    @SuppressWarnings("unchecked")
    public List<HotSearchAdmin> getHotSearchAdmin(String key, int detailSystem, int page) {
        List<HotSearchAdmin> zhiBoClassList = new ArrayList<HotSearchAdmin>();
        List<HotSearchAdmin> zhiBoClassList = new ArrayList<>();
        try {
            List<DetailSystem> detailSystemList = detailSystemDao.list("from DetailSystem");
            String sql = "";
@@ -469,7 +483,7 @@
                List<DetailSystem> detailSystemS = detailSystemDao
                        .list("select vb.detailSystem from SuperHotSearch vb where vb.hotSearch.id=" + vb.getId());
                List<DetailSystemSelect> dssList = new ArrayList<DetailSystemSelect>();
                List<DetailSystemSelect> dssList = new ArrayList<>();
                for (DetailSystem ds : detailSystemList) {
                    DetailSystemSelect dss = new DetailSystemSelect();