admin
2020-10-22 cba071db4529097598095e2971949dfd109f12b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
package com.yeshi.buwan.controller.parser.web;
 
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.stereotype.Controller;
 
import com.yeshi.buwan.domain.DetailSystem;
import com.yeshi.buwan.domain.HotStar;
import com.yeshi.buwan.domain.VideoInfo;
import com.yeshi.buwan.domain.special.Special;
import com.yeshi.buwan.service.imp.SpecialService;
import com.yeshi.buwan.service.imp.StarService;
import com.yeshi.buwan.service.imp.SystemService;
import com.yeshi.buwan.util.CacheUtil;
import com.yeshi.buwan.util.JsonUtil;
import com.yeshi.buwan.util.StringUtil;
import com.yeshi.buwan.util.VideoPictureUtil;
import com.yeshi.buwan.util.JuHe.VideoResourceUtil;
 
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
 
@Controller
public class WebFindParser {
 
    @Resource
    private SystemService systemService;
 
    @Resource
    private SpecialService specialService;
 
    @Resource
    private StarService starService;
 
    @Resource
    private VideoResourceUtil videoResouceUtil;
 
    // 获取专辑详情
    public void getSpecialDetail(String uid, HttpServletRequest request, PrintWriter out) {
        String method = request.getParameter("Method");
        String system = request.getParameter("System");
        String sign = request.getParameter("Sign");
        String platform = request.getParameter("Platform");
        String packageName = request.getParameter("Package");
        String specialId = request.getParameter("Id");
 
        if (StringUtil.isNullOrEmpty(method)) {
            out.print(JsonUtil.loadFalseJson("请上传Method"));
            return;
        }
        if (StringUtil.isNullOrEmpty(uid)) {
            out.print(JsonUtil.loadFalseJson("请上传Uid"));
            return;
        }
        if (StringUtil.isNullOrEmpty(system)) {
            out.print(JsonUtil.loadFalseJson("请上传System"));
            return;
        }
        if (StringUtil.isNullOrEmpty(sign)) {
            out.print(JsonUtil.loadFalseJson("请上传Sign"));
            return;
        }
        if (StringUtil.isNullOrEmpty(platform)) {
            out.print(JsonUtil.loadFalseJson("请上传Platform"));
            return;
        }
 
        if (StringUtil.isNullOrEmpty(packageName)) {
            out.print(JsonUtil.loadFalseJson("请上传Package"));
            return;
        }
 
        Special special = specialService.getSpecial(specialId);
        List<VideoInfo> list = specialService.getSpecialVideoList(specialId);
 
        JSONObject object = new JSONObject();
        object.put("count", list.size());
        JSONArray array = new JSONArray();
        for (int i = 0; i < list.size(); i++) {
            list.get(i).setPicture(VideoPictureUtil.getShowPicture(list.get(i), platform, "0"));
            array.add(StringUtil.outPutResultJson(list.get(i)));
        }
        object.put("data", array);
 
        object.put("special", StringUtil.outPutResultJson(special));
        out.print(JsonUtil.loadTrueJsonNoencript(object.toString()));
 
    }
 
    // 获取专辑详情
    public void getStarDetail(String uid, HttpServletRequest request, PrintWriter out) {
        String method = request.getParameter("Method");
        String system = request.getParameter("System");
        String sign = request.getParameter("Sign");
        String platform = request.getParameter("Platform");
        String packageName = request.getParameter("Package");
        String starId = request.getParameter("Id");
        String page = request.getParameter("Page");
 
        if (StringUtil.isNullOrEmpty(method)) {
            out.print(JsonUtil.loadFalseJson("请上传Method"));
            return;
        }
        if (StringUtil.isNullOrEmpty(uid)) {
            out.print(JsonUtil.loadFalseJson("请上传Uid"));
            return;
        }
        if (StringUtil.isNullOrEmpty(system)) {
            out.print(JsonUtil.loadFalseJson("请上传System"));
            return;
        }
        if (StringUtil.isNullOrEmpty(sign)) {
            out.print(JsonUtil.loadFalseJson("请上传Sign"));
            return;
        }
        if (StringUtil.isNullOrEmpty(platform)) {
            out.print(JsonUtil.loadFalseJson("请上传Platform"));
            return;
        }
 
        if (StringUtil.isNullOrEmpty(packageName)) {
            out.print(JsonUtil.loadFalseJson("请上传Package"));
            return;
        }
 
        if (StringUtil.isNullOrEmpty(page)) {
            out.print(JsonUtil.loadFalseJson("请上传Page"));
            return;
        }
 
        int pageIndex = Integer.parseInt(page);
 
        HotStar hot = starService.getHotStarDetail(starId);
 
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(platform, Integer.parseInt("0"));
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName);
        List<VideoInfo> list1 = starService.getStarVideo(detailSystem.getId(), starId, pageIndex, resourceList,
                CacheUtil.getMD5Long(resourceList));
 
        for (VideoInfo info : list1) {
            info.setIntroduction("");
            info.setPicture(VideoPictureUtil.getShowPicture(info, platform, "0"));
        }
        List<VideoInfo> list = new ArrayList<VideoInfo>();
        list.addAll(list1);
        JSONArray array = new JSONArray();
        for (VideoInfo v : list)
            array.add(StringUtil.outPutResultJson(v));
        JSONObject object = new JSONObject();
        object.put("star", StringUtil.outPutResultJson(hot));
        object.put("videos", array);
        out.print(JsonUtil.loadTrueJsonNoencript(object.toString()));
    }
 
}