admin
2021-08-02 e89de9319d8f771f8e53cb5f876d06465a580c57
src/main/java/com/yeshi/buwan/controller/parser/UserParser.java
@@ -19,8 +19,8 @@
import com.yeshi.buwan.service.imp.*;
import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService;
import com.yeshi.buwan.service.inter.system.SystemConfigService;
import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager;
import com.yeshi.buwan.service.manager.SolrInternetSearchVideoDataManager;
import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager;
import com.yeshi.buwan.service.manager.search.SolrInternetSearchVideoDataManager;
import com.yeshi.buwan.util.*;
import com.yeshi.buwan.util.JuHe.VideoResourceUtil;
import com.yeshi.buwan.util.annotation.RequireUid;
@@ -28,7 +28,6 @@
import com.yeshi.buwan.util.factory.VideoInfoFactory;
import com.yeshi.buwan.util.log.LoggerUtil;
import com.yeshi.buwan.util.log.UserActiveLogFactory;
import com.yeshi.buwan.util.rank.IqiyiRankUtil;
import com.yeshi.buwan.util.video.VideoCategoryConstant;
import com.yeshi.buwan.util.video.VideoConstant;
import com.yeshi.buwan.vo.AcceptData;
@@ -38,18 +37,21 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import redis.clients.jedis.Jedis;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Type;
import java.util.*;
@Controller
public class UserParser {
    Logger searchKeyLogger = LoggerFactory.getLogger("searchKey");
    @Resource
    private SystemService systemService;
@@ -81,6 +83,9 @@
    private ConfigParser configParser;
    @Resource
    private SystemConfigService systemConfigService;
    @Resource
    private RedisManager redisManager;
    public void getUid(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
@@ -316,7 +321,7 @@
            object.put("data", array);
            out.print(JsonUtil.loadTrueJson(object.toString()));
        } else {
            List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(detailSystem, acceptData.getVersion(),acceptData.getChannel());
            List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(detailSystem, acceptData.getVersion(), acceptData.getChannel());
            String cacheMD5 = "0";
            if (resourceList != null && resourceList.size() > 0)
                for (Long l : resourceList)
@@ -403,6 +408,30 @@
            return;
        }
        final String id = StringUtil.Md5(String.format("%s#%s#%s#%s", acceptData.getDetailSystem().getId(), acceptData.getDevice(), key, type));
        ThreadUtil.run(new Runnable() {
            @Override
            public void run() {
                String redisKey = "search-" + id;
                Jedis jedis = redisManager.getJedis();
                try {
                    //重复请求过滤
                    if (jedis.setnx(redisKey, "1") <= 0) {
                        return;
                    }
                    jedis.expire(redisKey, 120);
                    JSONObject searchData = new JSONObject();
                    searchData.put("key", key);
                    searchData.put("type", type);
                    searchData.put("detailSystemId", acceptData.getDetailSystem().getId());
                    searchData.put("device", acceptData.getDevice());
                    searchData.put("createTime", System.currentTimeMillis());
                    searchKeyLogger.info(new Gson().toJson(searchData));
                } finally {
                    jedis.close();
                }
            }
        });
        LoggerUtil.getUserActiveLogger().info(UserActiveLogFactory.createSearch(new BaseLog(acceptData, ""), key, type));
        int pageIndex = StringUtil.getPage(page);
@@ -410,7 +439,7 @@
            pageIndex = 1;
        }
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel());
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel());
        String cacheMD5 = "0";
@@ -590,7 +619,7 @@
        DetailSystem ds = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel());
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel());
        List<VideoInfo> list1 = StringUtil.isNullOrEmpty(videoId)
                ? recommendService.guessLikeList(ds.getId(), 4, resourceList, CacheUtil.getMD5Long(resourceList))
                : recommendService.guessLikeList(ds.getId(), 4, videoId, resourceList,
@@ -894,7 +923,7 @@
            return;
        }
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel());
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel());
        DetailSystem ds = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        List<VideoInfo> list = recommendService.getRelativeVideoList(ds.getId(), 4, videoId, resourceList,
@@ -933,7 +962,7 @@
            return;
        }
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(),acceptData.getChannel());
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel());
        DetailSystem ds = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        List<VideoInfo> list1 = recommendService.peopleSee(ds.getId(), 4, videoId, resourceList,