admin
2020-09-05 d3ebf5b103d4deebd6ffb75f4471a6fddab8d764
src/main/java/com/yeshi/buwan/controller/parser/UserParser.java
@@ -2,10 +2,12 @@
import com.yeshi.buwan.domain.*;
import com.yeshi.buwan.service.imp.*;
import com.yeshi.buwan.service.manager.SolrDataManager;
import com.yeshi.buwan.util.*;
import com.yeshi.buwan.util.JuHe.VideoResourceUtil;
import com.yeshi.buwan.util.annotation.RequireUid;
import com.yeshi.buwan.util.email.MailSenderUtil;
import com.yeshi.buwan.util.video.VideoCategoryConstant;
import com.yeshi.buwan.vo.AcceptData;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -18,6 +20,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Controller
public class UserParser {
@@ -44,6 +47,9 @@
    @Resource
    private VideoInfoService videoInfoService;
    @Resource
    private SolrDataManager solrDataManager;
    public void getUid(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        String uid = userService.getUid(acceptData.getDevice(), acceptData.getSystem(), acceptData.getImei(), acceptData.getMac(), acceptData.getLat(), acceptData.getLng());
@@ -53,7 +59,7 @@
            out.print(JsonUtil.loadFalseJson("获取uid失败"));
            return;
        } else {
            Map<String, String> map = configService.getConfigAsMap(detailSystem,acceptData.getVersion());
            Map<String, String> map = configService.getConfigAsMap(detailSystem, acceptData.getVersion());
            ShareContent share = shareService.getShareContent(detailSystem.getId());
            JSONObject object = new JSONObject();
            object.put("Uid", uid);
@@ -138,10 +144,10 @@
            return;
        }
        List<String> list = searchService.suggestSearch(key, acceptData.getSystem());
        List<String> list = solrDataManager.getSuggestKeyList(key); //searchService.suggestSearch(key, acceptData.getSystem());
        if (acceptData.getPlatform().equalsIgnoreCase("ios")) {
            if (Constant.IOSTest) {
                if (acceptData.getVersion()== 1) {
                if (acceptData.getVersion() == 1) {
                    list = new ArrayList<String>();
                }
            }
@@ -157,6 +163,34 @@
        out.print(JsonUtil.loadTrueJson(object.toString()));
    }
    private List<VideoDetailInfo> createSearchVideoDetailsVO(VideoInfo video) {
        List<VideoDetailInfo> detailList = new ArrayList<>();
        if (video.getVideoType() != null && (Integer.parseInt(video.getVideoType().getId() + "") == VideoCategoryConstant.CATEGORY_DIANSHIJU || Integer.parseInt(video.getVideoType().getId() + "") == VideoCategoryConstant.CATEGORY_DONGMAN)) {
            if (video.getVideocount() <= 5) {
                for (int i = 0; i < video.getVideocount(); i++) {
                    VideoDetailInfo detail = new VideoDetailInfo();
                    detail.setTag((i + 1) + "");
                    detailList.add(detail);
                }
            } else {
                for (int i = 0; i < 3; i++) {
                    VideoDetailInfo detail = new VideoDetailInfo();
                    detail.setTag((i + 1) + "");
                    detailList.add(detail);
                }
                for (int i = video.getVideocount() - 3; i < video.getVideocount(); i++) {
                    VideoDetailInfo detail = new VideoDetailInfo();
                    detail.setTag((i + 1) + "");
                    detailList.add(detail);
                }
            }
        }
        return detailList;
    }
    // 搜索
    public void search(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
@@ -208,6 +242,20 @@
            List<VideoInfo> list = searchService.search(detailSystem.getId(), request.getRemoteAddr(),
                    acceptData.getUid(), key, pageIndex, (StringUtil.isNullOrEmpty(contentType) ? 0 : Integer.parseInt(contentType)),
                    acceptData.getSystem(), resourceList, cacheMD5);
            //组织数据
            Set<Integer> albumCategorys = VideoCategoryConstant.getAlbumCategorys();
            for (VideoInfo video : list) {
                //如果是正片,且为5大分类 就采用竖条展示
                /**
                 * 是专辑,并且为正片
                 */
                //video.getVideoType() != null && albumCategorys.contains(Integer.parseInt(video.getVideoType().getId() + "")) &&
                if (video.getContentType() == 0) {
                    video.setVideoDetailList(createSearchVideoDetailsVO(video));
                    video.setShowType(1);
                } else
                    video.setShowType(0);
            }
            cacheMD5 = "0";
            if (list != null) {
                for (VideoInfo info : list) {