DiscoverChannelLiveController.java
3.97 KB
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
package cn.com.glsx.busassistant.controller;
import cn.com.glsx.busassistant.request.DiscoverChannelLiveRequest;
import cn.com.glsx.busassistant.response.DiscoverChannelLiveResponse;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.scrm.shopmall.enums.DiscoverChannelTypeEnum;
import com.google.common.collect.Lists;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import java.util.List;
@Slf4j
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
@Api("发现-频道直播(视频)")
public class DiscoverChannelLiveController {
@Autowired
private Environment env;
@ApiOperation("频道视频")
@ServiceMethod(method = "scrm.api.busassistant.discover.channel.live", needInSession = NeedInSessionType.NO)
public RopResponse<List<DiscoverChannelLiveResponse>> getLive(DiscoverChannelLiveRequest request) {
List<DiscoverChannelLiveResponse> responseList = Lists.newLinkedList();
DiscoverChannelLiveResponse liveResponse1 = new DiscoverChannelLiveResponse(DiscoverChannelTypeEnum.NEW_CARS.getValue());
String mediaTypeStr1 = env.getProperty("discover.channel.mediaType" + liveResponse1.getChannelType());
if (StringUtils.isNotEmpty(mediaTypeStr1)) {
String mediaList1 = env.getProperty("discover.channel.mediaList" + liveResponse1.getChannelType());
liveResponse1.setMediaType(Integer.valueOf(mediaTypeStr1));
if (StringUtils.isNotEmpty(mediaList1)) {
liveResponse1.setMediaList(mediaList1.split(","));
}
responseList.add(liveResponse1);
}
DiscoverChannelLiveResponse liveResponse2 = new DiscoverChannelLiveResponse(DiscoverChannelTypeEnum.MEMBRANES.getValue());
String mediaTypeStr2 = env.getProperty("discover.channel.mediaType" + liveResponse2.getChannelType());
if (StringUtils.isNotEmpty(mediaTypeStr2)) {
String mediaList2 = env.getProperty("discover.channel.mediaList" + liveResponse2.getChannelType());
liveResponse2.setMediaType(Integer.valueOf(mediaTypeStr2));
if (StringUtils.isNotEmpty(mediaList2)) {
liveResponse2.setMediaList(mediaList2.split(","));
}
responseList.add(liveResponse2);
}
DiscoverChannelLiveResponse liveResponse3 = new DiscoverChannelLiveResponse(DiscoverChannelTypeEnum.CROWD_FUNDING.getValue());
String mediaTypeStr3 = env.getProperty("discover.channel.mediaType" + liveResponse3.getChannelType());
if (StringUtils.isNotEmpty(mediaTypeStr3)) {
String mediaList3 = env.getProperty("discover.channel.mediaList" + liveResponse3.getChannelType());
liveResponse3.setMediaType(Integer.valueOf(mediaTypeStr3));
if (StringUtils.isNotEmpty(mediaList3)) {
liveResponse3.setMediaList(mediaList3.split(","));
}
responseList.add(liveResponse3);
}
DiscoverChannelLiveResponse liveResponse4 = new DiscoverChannelLiveResponse(DiscoverChannelTypeEnum.FIXED_INSURANCE.getValue());
String mediaTypeStr4 = env.getProperty("discover.channel.mediaType" + liveResponse4.getChannelType());
if (StringUtils.isNotEmpty(mediaTypeStr4)) {
String mediaList4 = env.getProperty("discover.channel.mediaList" + liveResponse4.getChannelType());
liveResponse4.setMediaType(Integer.valueOf(mediaTypeStr4));
if (StringUtils.isNotEmpty(mediaList4)) {
liveResponse4.setMediaList(mediaList4.split(","));
}
responseList.add(liveResponse4);
}
return RopResponse.success(responseList);
}
}