| | |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMessage())); |
| | | return; |
| | | } |
| | | }else if (Integer.parseInt(resourceId) == BilibiliUtil.RESOURCE_ID) { |
| | | } else if (Integer.parseInt(resourceId) == BilibiliUtil.RESOURCE_ID) { |
| | | try { |
| | | info = bilibiliUtil.getVideoInfo(internetSearchVideo, pageSize); |
| | | } catch (Exception e) { |
| | |
| | | public void run() { |
| | | //每天展示一次广告 |
| | | long showTime = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd"); |
| | | |
| | | deviceAdStrategyService.setVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), showTime, null); |
| | | } |
| | | }); |
| | |
| | | if (VersionUtil.isGraterThan390(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | String sessionId = createVideoDetailSessionId(acceptData, loginUid, info.getName(), videoId, resourceId); |
| | | |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), deviceAdStrategyService.getVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), loginUid,videoId,from), attention, sessionId)), array.toString(), |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(new VideoDetailVO(Utils.convertVideo(info), deviceAdStrategyService.getVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), loginUid, videoId, from), attention, sessionId)), array.toString(), |
| | | obj.toString())); |
| | | } else { |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), |
| | | obj.toString())); |
| | | } |
| | | |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | long showTime = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd"); |
| | | deviceAdStrategyService.setShortVideoAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), videoId, from, showTime, null); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | if (bean.getDetailPVAExpireTime() != null) { |
| | | update.set("detailPVAExpireTime", bean.getDetailPVAExpireTime()); |
| | | } |
| | | |
| | | |
| | | if (bean.getDetailShortVideoFSAExpireTime() != null) { |
| | | update.set("detailShortVideoFSAExpireTime", bean.getDetailShortVideoFSAExpireTime()); |
| | | } |
| | | if (bean.getDetailShortVideoPVAExpireTime() != null) { |
| | | update.set("detailShortVideoPVAExpireTime", bean.getDetailShortVideoPVAExpireTime()); |
| | | } |
| | | |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.SuperTVLiveCategory; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.query.BaseQuery; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class SuperTVLiveCategoryDao extends MongodbBaseDao<SuperTVLiveCategory> { |
| | | |
| | | public void updateSelective(SuperTVLiveCategory bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getCid() != null) { |
| | | update.set("cid", bean.getCid()); |
| | | } |
| | | if (bean.getDetailSystemId() != null) { |
| | | update.set("detailSystemId", bean.getDetailSystemId()); |
| | | } |
| | | if (bean.getWeight() != null) { |
| | | update.set("weight", bean.getWeight()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | public List<SuperTVLiveCategory> listByDetailSystemId(String detailSystemId, int start, int count) { |
| | | BaseQuery baseQuery = new BaseQuery(); |
| | | baseQuery.start = start; |
| | | baseQuery.count = count; |
| | | Query query = BaseQuery.createBaseMongoQuery(baseQuery, Arrays.asList(new Sort.Order[]{new Sort.Order(Sort.Direction.DESC, "weight"), new Sort.Order(Sort.Direction.DESC, "createTime")})); |
| | | query.addCriteria(Criteria.where("detailSystemId").is(detailSystemId)); |
| | | return findList(query); |
| | | } |
| | | |
| | | |
| | | public long countByDetailSystemId(String detailSystemId) { |
| | | BaseQuery baseQuery = new BaseQuery(); |
| | | Query query = BaseQuery.createBaseMongoQuery(baseQuery, Arrays.asList(new Sort.Order[]{new Sort.Order(Sort.Direction.DESC, "weight"), new Sort.Order(Sort.Direction.DESC, "createTime")})); |
| | | query.addCriteria(Criteria.where("detailSystemId").is(detailSystemId)); |
| | | return count(query); |
| | | } |
| | | |
| | | public List<SuperTVLiveCategory> listByCid(String cid) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("cid").is(cid)); |
| | | return findList(query); |
| | | } |
| | | |
| | | public SuperTVLiveCategory selectByCidAndDetailsystemId(String cid, String detailSystemId) { |
| | | |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("cid").is(cid).and("detailSystemId").is(detailSystemId)); |
| | | return findOne(query); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveCategoryChannelMap; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.query.BaseQuery; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class TVLiveCategoryChannelMapDao extends MongodbBaseDao<TVLiveCategoryChannelMap> { |
| | | |
| | | public void updateSelective(TVLiveCategoryChannelMap bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getChannelId() != null) { |
| | | update.set("channelId", bean.getChannelId()); |
| | | } |
| | | if (bean.getCategoryId() != null) { |
| | | update.set("categoryId", bean.getCategoryId()); |
| | | } |
| | | if (bean.getWeight() != null) { |
| | | update.set("weight", bean.getWeight()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | public List<TVLiveCategoryChannelMap> listByCid(String cid, int start, int count) { |
| | | BaseQuery baseQuery = new BaseQuery(); |
| | | baseQuery.start = start; |
| | | baseQuery.count = count; |
| | | Query query = BaseQuery.createBaseMongoQuery(baseQuery, Arrays.asList(new Sort.Order[]{new Sort.Order(Sort.Direction.DESC, "weight"), new Sort.Order(Sort.Direction.DESC, "createTime")})); |
| | | query.addCriteria(Criteria.where("categoryId").is(cid)); |
| | | return findList(query); |
| | | } |
| | | |
| | | |
| | | public long countByCid(String cid) { |
| | | BaseQuery baseQuery = new BaseQuery(); |
| | | Query query = BaseQuery.createBaseMongoQuery(baseQuery, null); |
| | | query.addCriteria(Criteria.where("categoryId").is(cid)); |
| | | return count(query); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveCategory; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.query.BaseQuery; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class TVLiveCategoryDao extends MongodbBaseDao<TVLiveCategory> { |
| | | |
| | | public void updateSelective(TVLiveCategory bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getName() != null) { |
| | | update.set("name", bean.getName()); |
| | | } |
| | | if (bean.getIcon() != null) { |
| | | update.set("icon", bean.getIcon()); |
| | | } |
| | | if (bean.getWeight() != null) { |
| | | update.set("weight", bean.getWeight()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | Query query = BaseQuery.createBaseMongoQuery(daoQuery, daoQuery.sortList); |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.name != null) { |
| | | andList.add(Criteria.where("name").regex(daoQuery.name)); |
| | | } |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | return query; |
| | | } |
| | | |
| | | public List<TVLiveCategory> list(DaoQuery daoQuery) { |
| | | |
| | | return findList(getQuery(daoQuery)); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | |
| | | return count(daoQuery); |
| | | } |
| | | |
| | | |
| | | public List<TVLiveCategory> listByIds(List<String> ids) { |
| | | if (ids == null || ids.size() == 0) |
| | | return null; |
| | | Criteria[] ors = new Criteria[ids.size()]; |
| | | for (int i = 0; i < ors.length; i++) { |
| | | ors[i] = Criteria.where("id").is(ids.get(i)); |
| | | } |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().orOperator(ors)); |
| | | return findList(query); |
| | | } |
| | | |
| | | public static class DaoQuery extends BaseQuery { |
| | | public String name; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveCategory; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.query.BaseQuery; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class TVLiveChannelDao extends MongodbBaseDao<TVLiveChannel> { |
| | | |
| | | public void updateSelective(TVLiveChannel bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getName() != null) { |
| | | update.set("name", bean.getName()); |
| | | } |
| | | if (bean.gethPicture() != null) { |
| | | update.set("hPicture", bean.gethPicture()); |
| | | } |
| | | if (bean.getvPicture() != null) { |
| | | update.set("vPicture", bean.getvPicture()); |
| | | } |
| | | if (bean.getNowProgram() != null) { |
| | | update.set("nowProgram", bean.getNowProgram()); |
| | | } |
| | | if (bean.getNowProgramTime() != null) { |
| | | update.set("nowProgramTime", bean.getNowProgramTime()); |
| | | } |
| | | if (bean.getNextProgram() != null) { |
| | | update.set("nextProgram", bean.getNextProgram()); |
| | | } |
| | | if (bean.getNextProgramTime() != null) { |
| | | update.set("nextProgramTime", bean.getNextProgramTime()); |
| | | } |
| | | if (bean.getState() != null) { |
| | | update.set("state", bean.getState()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | |
| | | public List<TVLiveChannel> listByIds(List<String> ids) { |
| | | if (ids == null || ids.size() == 0) |
| | | return null; |
| | | Criteria[] ors = new Criteria[ids.size()]; |
| | | for (int i = 0; i < ors.length; i++) { |
| | | ors[i] = Criteria.where("_id").is(ids.get(i)); |
| | | } |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().orOperator(ors)); |
| | | return findList(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | Query query = BaseQuery.createBaseMongoQuery(daoQuery, daoQuery.sortList); |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.name != null) { |
| | | andList.add(Criteria.where("name").regex(daoQuery.name)); |
| | | } |
| | | if (daoQuery.state != null) { |
| | | andList.add(Criteria.where("state").is(daoQuery.state)); |
| | | } |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | return query; |
| | | |
| | | } |
| | | |
| | | |
| | | public List<TVLiveChannel> list(DaoQuery daoQuery) { |
| | | return findList(getQuery(daoQuery)); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | return count(getQuery(daoQuery)); |
| | | } |
| | | |
| | | |
| | | public static class DaoQuery extends BaseQuery { |
| | | public String name; |
| | | public Integer state; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import com.yeshi.buwan.domain.live.TVLiveResource; |
| | | import com.yeshi.buwan.query.BaseQuery; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class TVLiveChannelResourceMapDao extends MongodbBaseDao<TVLiveChannelResourceMap> { |
| | | |
| | | public void updateSelective(TVLiveChannelResourceMap bean) { |
| | | Query query = new Query(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if (bean.getChannelId() != null) { |
| | | update.set("channelId", bean.getChannelId()); |
| | | } |
| | | if (bean.getResource() != null) { |
| | | update.set("resource", bean.getResource()); |
| | | } |
| | | if (bean.getRid() != null) { |
| | | update.set("rid", bean.getRid()); |
| | | } |
| | | if (bean.getWeight() != null) { |
| | | update.set("weight", bean.getWeight()); |
| | | } |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | Query query = BaseQuery.createBaseMongoQuery(daoQuery, Arrays.asList(new Sort.Order[]{new Sort.Order(Sort.Direction.DESC, "weight"), new Sort.Order(Sort.Direction.ASC, "createTime")})); |
| | | |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | |
| | | if (daoQuery.channelId != null) { |
| | | andList.add(Criteria.where("channelId").is(daoQuery.channelId)); |
| | | } |
| | | |
| | | if (daoQuery.resource != null) { |
| | | andList.add(Criteria.where("resource").is(daoQuery.resource.name())); |
| | | } |
| | | |
| | | if (daoQuery.rid != null) { |
| | | andList.add(Criteria.where("rid").is(daoQuery.rid)); |
| | | } |
| | | |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | |
| | | return query; |
| | | } |
| | | |
| | | public List<TVLiveChannelResourceMap> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | return count(getQuery(daoQuery)); |
| | | } |
| | | |
| | | |
| | | public static class DaoQuery extends BaseQuery { |
| | | public String channelId; |
| | | public TVLiveResource resource; |
| | | //第三方主键 |
| | | public String rid; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.dao.live.migu; |
| | | |
| | | import com.yeshi.buwan.live.migu.MiGuLiveListInfo; |
| | | import com.yeshi.buwan.dao.base.MongodbBaseDao; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Repository |
| | | public class MiGuLiveListInfoDao extends MongodbBaseDao<MiGuLiveListInfo>{ |
| | | |
| | | public void updateSelective(MiGuLiveListInfo bean) { |
| | | Query query = new Query(); |
| | | Update update=new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if(bean.getName() != null) { |
| | | update.set("name", bean.getName()); |
| | | } |
| | | if(bean.getPID() != null) { |
| | | update.set("pID", bean.getPID()); |
| | | } |
| | | if(bean.getAssetID() != null) { |
| | | update.set("assetID", bean.getAssetID()); |
| | | } |
| | | if(bean.getVideoType() != null) { |
| | | update.set("videoType", bean.getVideoType()); |
| | | } |
| | | if(bean.getNowPlaying() != null) { |
| | | update.set("nowPlaying", bean.getNowPlaying()); |
| | | } |
| | | if(bean.getStartTime() != null) { |
| | | update.set("startTime", bean.getStartTime()); |
| | | } |
| | | if(bean.getEndTime() != null) { |
| | | update.set("endTime", bean.getEndTime()); |
| | | } |
| | | if(bean.getPics() != null) { |
| | | update.set("pics", bean.getPics()); |
| | | } |
| | | if(bean.getH5pics() != null) { |
| | | update.set("h5pics", bean.getH5pics()); |
| | | } |
| | | if(bean.getNow() != null) { |
| | | update.set("now", bean.getNow()); |
| | | } |
| | | if(bean.getNext() != null) { |
| | | update.set("next", bean.getNext()); |
| | | } |
| | | if(bean.getHdFlag() != null) { |
| | | update.set("hdFlag", bean.getHdFlag()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | } |
| | |
| | | //下次详情页视频前贴展示的时间 |
| | | private Long detailPVAExpireTime; |
| | | |
| | | |
| | | //下次详情页小视频 全屏视频广告的展示时间 |
| | | private Long detailShortVideoFSAExpireTime; |
| | | |
| | | //下次详情页小视频视频前贴展示的时间 |
| | | private Long detailShortVideoPVAExpireTime; |
| | | |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public Long getDetailShortVideoFSAExpireTime() { |
| | | return detailShortVideoFSAExpireTime; |
| | | } |
| | | |
| | | public void setDetailShortVideoFSAExpireTime(Long detailShortVideoFSAExpireTime) { |
| | | this.detailShortVideoFSAExpireTime = detailShortVideoFSAExpireTime; |
| | | } |
| | | |
| | | public Long getDetailShortVideoPVAExpireTime() { |
| | | return detailShortVideoPVAExpireTime; |
| | | } |
| | | |
| | | public void setDetailShortVideoPVAExpireTime(Long detailShortVideoPVAExpireTime) { |
| | | this.detailShortVideoPVAExpireTime = detailShortVideoPVAExpireTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.domain.live; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 电视直播分类 |
| | | */ |
| | | @Document(collection = "superTVLiveCategory") |
| | | public class SuperTVLiveCategory { |
| | | @Id |
| | | private String id; |
| | | private String cid; |
| | | @Indexed |
| | | private String detailSystemId; |
| | | private Integer weight; |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | public static String createId(String cid, String detailSystemId) { |
| | | return cid + "-" + detailSystemId; |
| | | } |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getCid() { |
| | | return cid; |
| | | } |
| | | |
| | | public void setCid(String cid) { |
| | | this.cid = cid; |
| | | } |
| | | |
| | | public String getDetailSystemId() { |
| | | return detailSystemId; |
| | | } |
| | | |
| | | public void setDetailSystemId(String detailSystemId) { |
| | | this.detailSystemId = detailSystemId; |
| | | } |
| | | |
| | | public Integer getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Integer weight) { |
| | | this.weight = weight; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.buwan.domain.live; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 电视直播分类 |
| | | */ |
| | | @Document(collection = "tvLiveCategory") |
| | | public class TVLiveCategory { |
| | | |
| | | @Id |
| | | private String id; |
| | | private String name; |
| | | private String icon; |
| | |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | | } |
| | | |
| | | public void setIcon(String icon) { |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public Integer getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Integer weight) { |
| | | this.weight = weight; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.buwan.domain.live; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Document(collection = "tvLiveCategoryChannelMap") |
| | | public class TVLiveCategoryChannelMap { |
| | | |
| | | private String id; |
| | | @Id |
| | | private String id; |
| | | private String channelId; |
| | | private String categoryId; |
| | | private Integer weight; |
| | |
| | | private Date updateTime; |
| | | |
| | | |
| | | public static String createId(String channelId, String categoryId) { |
| | | return categoryId + "-" + channelId; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getChannelId() { |
| | | return channelId; |
| | | } |
| | | |
| | | public void setChannelId(String channelId) { |
| | | this.channelId = channelId; |
| | | } |
| | | |
| | | public String getCategoryId() { |
| | | return categoryId; |
| | | } |
| | | |
| | | public void setCategoryId(String categoryId) { |
| | | this.categoryId = categoryId; |
| | | } |
| | | |
| | | public Integer getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Integer weight) { |
| | | this.weight = weight; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Document(collection = "tvLiveChannel") |
| | | public class TVLiveChannel { |
| | | |
| | | //正常 |
| | | public final static int STATE_NORMAL = 1; |
| | | //隐藏 |
| | | public final static int STATE_HIDDEN = 0; |
| | | |
| | | @Id |
| | | private String id; |
| | | private String name; |
| | |
| | | private String nowProgramTime; |
| | | private String nextProgram; |
| | | private String nextProgramTime; |
| | | private Integer state; |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String gethPicture() { |
| | | return hPicture; |
| | | } |
| | | |
| | | public void sethPicture(String hPicture) { |
| | | this.hPicture = hPicture; |
| | | } |
| | | |
| | | public String getvPicture() { |
| | | return vPicture; |
| | | } |
| | | |
| | | public void setvPicture(String vPicture) { |
| | | this.vPicture = vPicture; |
| | | } |
| | | |
| | | public String getNowProgram() { |
| | | return nowProgram; |
| | | } |
| | | |
| | | public void setNowProgram(String nowProgram) { |
| | | this.nowProgram = nowProgram; |
| | | } |
| | | |
| | | public String getNowProgramTime() { |
| | | return nowProgramTime; |
| | | } |
| | | |
| | | public void setNowProgramTime(String nowProgramTime) { |
| | | this.nowProgramTime = nowProgramTime; |
| | | } |
| | | |
| | | public String getNextProgram() { |
| | | return nextProgram; |
| | | } |
| | | |
| | | public void setNextProgram(String nextProgram) { |
| | | this.nextProgram = nextProgram; |
| | | } |
| | | |
| | | public String getNextProgramTime() { |
| | | return nextProgramTime; |
| | | } |
| | | |
| | | public void setNextProgramTime(String nextProgramTime) { |
| | | this.nextProgramTime = nextProgramTime; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.buwan.domain.live; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Document(collection = "tvLiveChannelResourceMap") |
| | | public class TVLiveChannelResourceMap { |
| | | |
| | | @Id |
| | | private String id; |
| | | private String channelId; |
| | | private TVLiveResource resource; |
| | | //第三方主键 |
| | | private String rid; |
| | | |
| | | private Integer weight; |
| | | |
| | | private Date createTime; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public static String createId(String channelId, TVLiveResource resource) { |
| | | return channelId + "-" + resource.name(); |
| | | } |
| | | |
| | | public String getChannelId() { |
| | | return channelId; |
| | | } |
| | | |
| | | public void setChannelId(String channelId) { |
| | | this.channelId = channelId; |
| | | } |
| | | |
| | | public TVLiveResource getResource() { |
| | | return resource; |
| | | } |
| | | |
| | | public void setResource(TVLiveResource resource) { |
| | | this.resource = resource; |
| | | } |
| | | |
| | | public String getRid() { |
| | | return rid; |
| | | } |
| | | |
| | | public void setRid(String rid) { |
| | | this.rid = rid; |
| | | } |
| | | |
| | | public Integer getWeight() { |
| | | return weight; |
| | | } |
| | | |
| | | public void setWeight(Integer weight) { |
| | | this.weight = weight; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.exception.live; |
| | | |
| | | import com.yeshi.buwan.exception.BaseException; |
| | | |
| | | public class TVLiveCategoryException extends BaseException { |
| | | |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public TVLiveCategoryException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.job; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap; |
| | | import com.yeshi.buwan.domain.live.TVLiveResource; |
| | | import com.yeshi.buwan.live.migu.MiGuLiveListInfo; |
| | | import com.yeshi.buwan.live.migu.MiguLiveApiUtil; |
| | | import com.yeshi.buwan.service.inter.live.MiGuLiveService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.factory.live.TVLiveChannelFactory; |
| | | import net.sf.json.JSONArray; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | //10409568 |
| | | @Component |
| | | public class LiveJob { |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | @Resource |
| | | private MiGuLiveService miGuLiveService; |
| | | |
| | | @Resource |
| | | private TVLiveChannelService tvLiveService; |
| | | |
| | | @Resource |
| | | private TVLiveChannelResourceService tvLiveChannelResourceService; |
| | | |
| | | //打开华为应用市场的广告 |
| | | @XxlJob("live-update-migu") |
| | | public ReturnT<String> updateMiGu(String params) throws Exception { |
| | | String value = systemConfigService.getConfigValueByKeyCache("miguLiveCategory"); |
| | | JSONArray array = JSONArray.fromObject(value); |
| | | for (int i = 0; i < array.size(); i++) { |
| | | String vomsID = array.optJSONObject(i).optString("vomsID"); |
| | | List<MiGuLiveListInfo> mList = MiguLiveApiUtil.getLiveList(vomsID); |
| | | for (MiGuLiveListInfo info : mList) { |
| | | miGuLiveService.saveChannelInfo(info); |
| | | TVLiveChannel channel = TVLiveChannelFactory.create(info); |
| | | //添加到频道 |
| | | tvLiveService.save(channel); |
| | | |
| | | TVLiveChannelResourceMap map = new TVLiveChannelResourceMap(); |
| | | map.setChannelId(channel.getId()); |
| | | map.setId(TVLiveChannelResourceMap.createId(channel.getId(), TVLiveResource.migu)); |
| | | map.setResource(TVLiveResource.migu); |
| | | map.setRid(info.getId()); |
| | | map.setWeight(1); |
| | | tvLiveChannelResourceService.add(map); |
| | | } |
| | | } |
| | | |
| | | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.buwan.live.migu; |
| | | |
| | | import java.io.Serializable; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Document(collection = "miguTVLiveChannel") |
| | | public class MiGuLiveListInfo implements Serializable { |
| | | |
| | | |
| | |
| | | * hdFlag : 0 |
| | | */ |
| | | |
| | | @Id |
| | | private String id; |
| | | private String name; |
| | | private String pID; |
| | |
| | | private ProgramBean next; |
| | | private String hdFlag; |
| | | |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getpID() { |
| | | return pID; |
| | | } |
| | | |
| | | public void setpID(String pID) { |
| | | this.pID = pID; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | |
| | | package com.yeshi.buwan.query; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class BaseQuery { |
| | | public long start; |
| | | public int count; |
| | | |
| | | public static Query createBaseMongoQuery(BaseQuery baseQuery, List<Sort.Order> sortList) { |
| | | Query query = new Query(); |
| | | query.skip((int) baseQuery.start); |
| | | query.limit(baseQuery.count); |
| | | if (sortList != null) { |
| | | query.with(new Sort(sortList)); |
| | | } |
| | | return query; |
| | | } |
| | | } |
| | |
| | | strategy.setCreateTime(new Date()); |
| | | strategy.setDetailFSAExpireTime(DeviceAdStrategy.ALWAYS_DISPLAY); |
| | | strategy.setDetailPVAExpireTime(DeviceAdStrategy.ALWAYS_DISPLAY); |
| | | |
| | | strategy.setDetailShortVideoFSAExpireTime(DeviceAdStrategy.ALWAYS_DISPLAY); |
| | | strategy.setDetailShortVideoPVAExpireTime(DeviceAdStrategy.ALWAYS_DISPLAY); |
| | | deviceAdStrategyDao.save(strategy); |
| | | return strategy; |
| | | } |
| | |
| | | return new VideoDetailVO.VideoAdInfo(strategy.getDetailPVAExpireTime() < now, strategy.getDetailFSAExpireTime() < now); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取小视频广告展示策略 |
| | | * |
| | | * @param deviceId |
| | | * @param detailSystemId |
| | | * @return |
| | | */ |
| | | public VideoDetailVO.VideoAdInfo getVideoDetailShortVideoAdStrategy(String deviceId, String detailSystemId) { |
| | | |
| | | if (StringUtil.isNullOrEmpty(deviceId) || StringUtil.isNullOrEmpty(detailSystemId)) { |
| | | return new VideoDetailVO.VideoAdInfo(true, true); |
| | | } |
| | | String id = DeviceAdStrategy.createId(deviceId, detailSystemId); |
| | | DeviceAdStrategy strategy = deviceAdStrategyDao.get(id); |
| | | if (strategy == null) { |
| | | strategy = init(id, deviceId, detailSystemId); |
| | | } |
| | | |
| | | if(strategy.getDetailShortVideoPVAExpireTime()==null){ |
| | | strategy.setDetailShortVideoPVAExpireTime(DeviceAdStrategy.ALWAYS_DISPLAY); |
| | | } |
| | | |
| | | if(strategy.getDetailShortVideoFSAExpireTime()==null){ |
| | | strategy.setDetailShortVideoFSAExpireTime(DeviceAdStrategy.ALWAYS_DISPLAY); |
| | | } |
| | | |
| | | long now = System.currentTimeMillis(); |
| | | return new VideoDetailVO.VideoAdInfo(strategy.getDetailShortVideoPVAExpireTime() < now, strategy.getDetailShortVideoFSAExpireTime() < now); |
| | | } |
| | | |
| | | @Override |
| | | public VideoDetailVO.VideoAdInfo getVideoDetailAdStrategy(String deviceId, String detailSystemId, String loginUid, String videoId, String from) { |
| | | |
| | |
| | | if (videoAdInfo.isFullVideo() && "recommend".equalsIgnoreCase(from)) { |
| | | //是否为4大分类 |
| | | VideoInfo videoInfo = videoInfoService.getVideoInfoCache(videoId); |
| | | //除开四大分类外不展示全屏视频广告 |
| | | //除正片外不展示全屏视频广告 |
| | | if (videoInfo != null && videoInfo.getContentType() != null && videoInfo.getContentType() != 1) { |
| | | videoAdInfo.setFullVideo(false); |
| | | VideoDetailVO.VideoAdInfo shortVideo = getVideoDetailShortVideoAdStrategy(deviceId, detailSystemId); |
| | | videoAdInfo.setFullVideo(videoAdInfo.isFullVideo() && shortVideo.isFullVideo()); |
| | | } |
| | | } |
| | | return videoAdInfo; |
| | |
| | | update.setDetailPVAExpireTime(pvaExpireTime); |
| | | deviceAdStrategyDao.updateSelective(update); |
| | | } |
| | | |
| | | @Override |
| | | public void setShortVideoAdStrategy(String deviceId, String detailSystemId, String videoId, String from, Long fsaExpireTime, Long pvaExpireTime) { |
| | | //只有首页推荐小视频才设置 |
| | | if (!"recommend".equalsIgnoreCase(from)) |
| | | return; |
| | | |
| | | if (StringUtil.isNullOrEmpty(deviceId) || StringUtil.isNullOrEmpty(detailSystemId)) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | VideoInfo videoInfo = videoInfoService.getVideoInfoCache(videoId); |
| | | //除正片外不展示全屏视频广告 |
| | | if (videoInfo != null && videoInfo.getContentType() != null && videoInfo.getContentType() != 1) { |
| | | |
| | | String id = DeviceAdStrategy.createId(deviceId, detailSystemId); |
| | | DeviceAdStrategy strategy = deviceAdStrategyDao.get(id); |
| | | if (strategy == null) { |
| | | init(id, deviceId, detailSystemId); |
| | | } |
| | | DeviceAdStrategy update = new DeviceAdStrategy(); |
| | | update.setId(id); |
| | | if (fsaExpireTime != null) |
| | | update.setDetailShortVideoFSAExpireTime(fsaExpireTime); |
| | | if (pvaExpireTime != null) |
| | | update.setDetailShortVideoPVAExpireTime(pvaExpireTime); |
| | | deviceAdStrategyDao.updateSelective(update); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.live; |
| | | |
| | | import com.yeshi.buwan.dao.live.migu.MiGuLiveListInfoDao; |
| | | import com.yeshi.buwan.live.migu.MiGuLiveListInfo; |
| | | import com.yeshi.buwan.service.inter.live.MiGuLiveService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | @Service |
| | | public class MiGuLiveServiceImpl implements MiGuLiveService { |
| | | |
| | | @Resource |
| | | private MiGuLiveListInfoDao miGuLiveListInfoDao; |
| | | |
| | | @Override |
| | | public void saveChannelInfo(MiGuLiveListInfo info) { |
| | | if (info.getId() == null) { |
| | | info.setId(info.getpID()); |
| | | } |
| | | |
| | | if (info.getCreateTime() == null) { |
| | | info.setCreateTime(new Date()); |
| | | } |
| | | |
| | | if (info.getUpdateTime() == null) { |
| | | info.setUpdateTime(new Date()); |
| | | } |
| | | miGuLiveListInfoDao.save(info); |
| | | } |
| | | |
| | | @Override |
| | | public MiGuLiveListInfo selectByPrimaryKey(String id) { |
| | | return miGuLiveListInfoDao.get(id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.live; |
| | | |
| | | import com.yeshi.buwan.dao.live.TVLiveCategoryChannelMapDao; |
| | | import com.yeshi.buwan.dao.live.TVLiveChannelDao; |
| | | import com.yeshi.buwan.domain.live.TVLiveCategoryChannelMap; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveCategoryChannelService; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class TVLiveCategoryChannelServiceImpl implements TVLiveCategoryChannelService { |
| | | |
| | | @Resource |
| | | private TVLiveCategoryChannelMapDao tvLiveCategoryChannelMapDao; |
| | | |
| | | @Resource |
| | | private TVLiveChannelDao tvLiveChannelDao; |
| | | |
| | | @Override |
| | | public void addMap(TVLiveCategoryChannelMap map) { |
| | | if (map.getId() == null) |
| | | map.setId(TVLiveCategoryChannelMap.createId(map.getCategoryId(), map.getChannelId())); |
| | | if (tvLiveCategoryChannelMapDao.get(map.getId()) != null) |
| | | return; |
| | | |
| | | if (map.getCreateTime() == null) |
| | | map.setCreateTime(new Date()); |
| | | tvLiveCategoryChannelMapDao.save(map); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByPrimaryKey(String id) { |
| | | |
| | | tvLiveCategoryChannelMapDao.deleteByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public void update(TVLiveCategoryChannelMap map) { |
| | | if (map == null) |
| | | return; |
| | | tvLiveCategoryChannelMapDao.updateSelective(map); |
| | | } |
| | | |
| | | @Override |
| | | public List<TVLiveChannel> listChannelByCid(String cid, String nameKey, int page, int pageSize) { |
| | | //查询Map |
| | | List<TVLiveCategoryChannelMap> mapList = tvLiveCategoryChannelMapDao.listByCid(cid, page, pageSize); |
| | | if (mapList == null || mapList.size() == 0) |
| | | return null; |
| | | List<String> cids = new ArrayList<>(); |
| | | |
| | | for (TVLiveCategoryChannelMap sc : mapList) { |
| | | cids.add(sc.getChannelId()); |
| | | } |
| | | List<TVLiveChannel> categoryList = tvLiveChannelDao.listByIds(cids); |
| | | Map<String, TVLiveChannel> map = new HashMap<>(); |
| | | for (TVLiveChannel tc : categoryList) { |
| | | map.put(tc.getId(), tc); |
| | | } |
| | | |
| | | |
| | | List<TVLiveChannel> resultList = new ArrayList<>(); |
| | | for (TVLiveCategoryChannelMap sc : mapList) { |
| | | resultList.add(map.get(sc.getChannelId())); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | | public long countChannelByCid(String cid, String nameKey) { |
| | | return tvLiveCategoryChannelMapDao.countByCid(cid); |
| | | } |
| | | |
| | | @Override |
| | | public List<TVLiveCategoryChannelMap> listByChannelId(String channelId) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("channelId").is(channelId)); |
| | | |
| | | return tvLiveCategoryChannelMapDao.findList(query); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.live; |
| | | |
| | | import com.yeshi.buwan.dao.live.SuperTVLiveCategoryDao; |
| | | import com.yeshi.buwan.dao.live.TVLiveCategoryDao; |
| | | import com.yeshi.buwan.domain.live.SuperTVLiveCategory; |
| | | import com.yeshi.buwan.domain.live.TVLiveCategory; |
| | | import com.yeshi.buwan.exception.live.TVLiveCategoryException; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveCategoryService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class TVLiveCategoryServiceImpl implements TVLiveCategoryService { |
| | | @Resource |
| | | private SuperTVLiveCategoryDao superTVLiveCategoryDao; |
| | | |
| | | @Resource |
| | | private TVLiveCategoryDao tvLiveCategoryDao; |
| | | |
| | | |
| | | @Override |
| | | public void addCategory(TVLiveCategory category, List<String> detailSystemList) throws TVLiveCategoryException { |
| | | //查询分类名称是否存在 |
| | | category.setId(StringUtil.Md5(category.getName())); |
| | | TVLiveCategory old = tvLiveCategoryDao.get(category.getId()); |
| | | if (old != null) |
| | | throw new TVLiveCategoryException(1, "分类已经存在"); |
| | | |
| | | if (category.getCreateTime() == null) |
| | | category.setCreateTime(new Date()); |
| | | |
| | | tvLiveCategoryDao.save(category); |
| | | |
| | | for (String detailSystemId : detailSystemList) { |
| | | SuperTVLiveCategory superTVLiveCategory = new SuperTVLiveCategory(); |
| | | superTVLiveCategory.setCid(category.getId()); |
| | | superTVLiveCategory.setDetailSystemId(detailSystemId); |
| | | superTVLiveCategory.setCreateTime(new Date()); |
| | | superTVLiveCategory.setWeight(1); |
| | | addSuperCategory(superTVLiveCategory); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteCateogry(List<String> ids) { |
| | | for (String cid : ids) { |
| | | List<SuperTVLiveCategory> scList = superTVLiveCategoryDao.listByCid(cid); |
| | | for (SuperTVLiveCategory sc : scList) { |
| | | superTVLiveCategoryDao.delete(sc.getId()); |
| | | } |
| | | tvLiveCategoryDao.delete(cid); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateCategory(TVLiveCategory category) { |
| | | tvLiveCategoryDao.updateSelective(category); |
| | | } |
| | | |
| | | @Override |
| | | public List<TVLiveCategory> list(String detailSystemId, String nameKey, int page, int pageSize) { |
| | | if (detailSystemId != null) { |
| | | List<SuperTVLiveCategory> superTVLiveCategoryList = superTVLiveCategoryDao.listByDetailSystemId(detailSystemId, page, pageSize); |
| | | if (superTVLiveCategoryList == null || superTVLiveCategoryList.size() == 0) |
| | | return null; |
| | | List<String> cids = new ArrayList<>(); |
| | | |
| | | for (SuperTVLiveCategory sc : superTVLiveCategoryList) { |
| | | cids.add(sc.getCid()); |
| | | } |
| | | List<TVLiveCategory> categoryList = tvLiveCategoryDao.listByIds(cids); |
| | | Map<String, TVLiveCategory> map = new HashMap<>(); |
| | | for (TVLiveCategory tc : categoryList) { |
| | | map.put(tc.getId(), tc); |
| | | } |
| | | |
| | | |
| | | List<TVLiveCategory> resultList = new ArrayList<>(); |
| | | for (SuperTVLiveCategory sc : superTVLiveCategoryList) { |
| | | resultList.add(map.get(sc.getCid())); |
| | | } |
| | | return resultList; |
| | | } else { |
| | | TVLiveCategoryDao.DaoQuery daoQuery = new TVLiveCategoryDao.DaoQuery(); |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | | daoQuery.name = nameKey; |
| | | daoQuery.sortList = Arrays.asList(new Sort.Order(Sort.Direction.DESC, "createTime")); |
| | | return tvLiveCategoryDao.list(daoQuery); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public long count(String detailSystemId, String nameKey) { |
| | | if (detailSystemId != null) { |
| | | return superTVLiveCategoryDao.countByDetailSystemId(detailSystemId); |
| | | } else { |
| | | TVLiveCategoryDao.DaoQuery daoQuery = new TVLiveCategoryDao.DaoQuery(); |
| | | daoQuery.name = nameKey; |
| | | return tvLiveCategoryDao.count(daoQuery); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void addSuperCategory(SuperTVLiveCategory superCategory) { |
| | | if (superCategory == null) |
| | | return; |
| | | superCategory.setId(SuperTVLiveCategory.createId(superCategory.getCid(), superCategory.getDetailSystemId())); |
| | | |
| | | if (superTVLiveCategoryDao.get(superCategory.getId()) != null) |
| | | return; |
| | | |
| | | if (superCategory.getCreateTime() == null) |
| | | superCategory.setCreateTime(new Date()); |
| | | superTVLiveCategoryDao.save(superCategory); |
| | | } |
| | | |
| | | @Override |
| | | public void updateSuperCategory(SuperTVLiveCategory superCategory) { |
| | | superTVLiveCategoryDao.updateSelective(superCategory); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteSuperCategory(String id) { |
| | | superTVLiveCategoryDao.deleteByPrimaryKey(id); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteSuperCategory(String categoryId, String detailSystemId) { |
| | | SuperTVLiveCategory sc = superTVLiveCategoryDao.selectByCidAndDetailsystemId(categoryId, detailSystemId); |
| | | if (sc != null) |
| | | deleteSuperCategory(sc.getId()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.live; |
| | | |
| | | import com.yeshi.buwan.dao.live.TVLiveChannelResourceMapDao; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class TVLiveChannelResourceServiceImpl implements TVLiveChannelResourceService { |
| | | |
| | | |
| | | @Resource |
| | | private TVLiveChannelResourceMapDao tvLiveChannelResourceMapDao; |
| | | |
| | | @Override |
| | | public List<TVLiveChannelResourceMap> listByChannelId(String channelId) { |
| | | TVLiveChannelResourceMapDao.DaoQuery daoQuery = new TVLiveChannelResourceMapDao.DaoQuery(); |
| | | daoQuery.count = 100; |
| | | daoQuery.channelId = channelId; |
| | | return tvLiveChannelResourceMapDao.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public long countByChannelId(String channelId) { |
| | | TVLiveChannelResourceMapDao.DaoQuery daoQuery = new TVLiveChannelResourceMapDao.DaoQuery(); |
| | | daoQuery.channelId = channelId; |
| | | return tvLiveChannelResourceMapDao.count(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public void update(TVLiveChannelResourceMap map) { |
| | | if (map == null) |
| | | return; |
| | | tvLiveChannelResourceMapDao.updateSelective(map); |
| | | } |
| | | |
| | | @Override |
| | | public void add(TVLiveChannelResourceMap map) { |
| | | if (map == null) |
| | | return; |
| | | if (map.getId() == null) { |
| | | map.setId(TVLiveChannelResourceMap.createId(map.getChannelId(), map.getResource())); |
| | | } |
| | | if (tvLiveChannelResourceMapDao.get(map.getId()) != null) |
| | | return; |
| | | |
| | | if (map.getCreateTime() == null) { |
| | | map.setCreateTime(new Date()); |
| | | } |
| | | tvLiveChannelResourceMapDao.save(map); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | tvLiveChannelResourceMapDao.delete(id); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.live; |
| | | |
| | | import com.yeshi.buwan.dao.live.TVLiveChannelDao; |
| | | import com.yeshi.buwan.domain.live.TVLiveCategoryChannelMap; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap; |
| | | import com.yeshi.buwan.exception.ParamsException; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveCategoryChannelService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService; |
| | | import com.yeshi.buwan.service.inter.live.TVLiveChannelService; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class TVLiveChannelServiceImpl implements TVLiveChannelService { |
| | | |
| | | @Resource |
| | | private TVLiveChannelDao tvLiveChannelDao; |
| | | |
| | | @Resource |
| | | private TVLiveChannelResourceService tvLiveChannelResourceService; |
| | | |
| | | @Resource |
| | | private TVLiveCategoryChannelService tvLiveCategoryChannelService; |
| | | |
| | | @Override |
| | | public TVLiveChannel save(TVLiveChannel channel) throws ParamsException { |
| | | if (channel.getId() == null) { |
| | | channel.setId(StringUtil.Md5(channel.getName())); |
| | | } |
| | | |
| | | if (channel.getCreateTime() == null) { |
| | | channel.setCreateTime(new Date()); |
| | | } |
| | | |
| | | if (channel.getUpdateTime() == null) { |
| | | channel.setUpdateTime(new Date()); |
| | | } |
| | | |
| | | tvLiveChannelDao.save(channel); |
| | | return channel; |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | //删除来源 |
| | | List<TVLiveChannelResourceMap> resourceMapList = tvLiveChannelResourceService.listByChannelId(id); |
| | | for (TVLiveChannelResourceMap map : resourceMapList) { |
| | | tvLiveChannelResourceService.delete(map.getId()); |
| | | } |
| | | //删除分类 |
| | | List<TVLiveCategoryChannelMap> cmapList = tvLiveCategoryChannelService.listByChannelId(id); |
| | | for (TVLiveCategoryChannelMap map : cmapList) { |
| | | tvLiveCategoryChannelService.deleteByPrimaryKey(map.getId()); |
| | | } |
| | | |
| | | tvLiveChannelDao.delete(id); |
| | | } |
| | | |
| | | @Override |
| | | public void update(TVLiveChannel channel) { |
| | | if (channel == null) |
| | | return; |
| | | tvLiveChannelDao.updateSelective(channel); |
| | | } |
| | | |
| | | @Override |
| | | public List<TVLiveChannel> list(String name, Integer state, int page, int pageSize) { |
| | | TVLiveChannelDao.DaoQuery daoQuery = new TVLiveChannelDao.DaoQuery(); |
| | | daoQuery.state = state; |
| | | daoQuery.name = name; |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | | daoQuery.sortList = Arrays.asList(new Sort.Order[]{new Sort.Order(Sort.Direction.DESC, "createTime")}); |
| | | return tvLiveChannelDao.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public long count(String name, Integer state) { |
| | | TVLiveChannelDao.DaoQuery daoQuery = new TVLiveChannelDao.DaoQuery(); |
| | | daoQuery.state = state; |
| | | daoQuery.name = name; |
| | | return tvLiveChannelDao.count(daoQuery); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 获取视频详情页的广告展示策略(含单视频策略) |
| | | * |
| | | * @param deviceId |
| | | * @param detailSystemId |
| | | * @param loginUid |
| | |
| | | * @param from |
| | | * @return |
| | | */ |
| | | public VideoDetailVO.VideoAdInfo getVideoDetailAdStrategy(String deviceId, String detailSystemId, String loginUid,String videoId,String from); |
| | | public VideoDetailVO.VideoAdInfo getVideoDetailAdStrategy(String deviceId, String detailSystemId, String loginUid, String videoId, String from); |
| | | |
| | | |
| | | /** |
| | | * 设置详情页广告展示策略 |
| | | * |
| | | * @param deviceId |
| | | * @param detailSystemId |
| | | * @param fsaExpireTime |
| | | * @param pvaExpireTime |
| | | */ |
| | | public void setVideoDetailAdStrategy(String deviceId, String detailSystemId,Long fsaExpireTime,Long pvaExpireTime); |
| | | public void setVideoDetailAdStrategy(String deviceId, String detailSystemId, Long fsaExpireTime, Long pvaExpireTime); |
| | | |
| | | |
| | | /** |
| | | * 设置小视频详情页广告策略 |
| | | * |
| | | * @param deviceId |
| | | * @param detailSystemId |
| | | * @param fsaExpireTime |
| | | * @param pvaExpireTime |
| | | */ |
| | | public void setShortVideoAdStrategy(String deviceId, String detailSystemId, String videoId, String from, Long fsaExpireTime, Long pvaExpireTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.live; |
| | | |
| | | import com.yeshi.buwan.live.migu.MiGuLiveListInfo; |
| | | |
| | | public interface MiGuLiveService { |
| | | |
| | | /** |
| | | * 保存频道信息 |
| | | * |
| | | * @param info |
| | | */ |
| | | public void saveChannelInfo(MiGuLiveListInfo info); |
| | | |
| | | |
| | | /** |
| | | * 根据主键查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public MiGuLiveListInfo selectByPrimaryKey(String id); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveCategoryChannelMap; |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 直播分类频道服务 |
| | | */ |
| | | public interface TVLiveCategoryChannelService { |
| | | |
| | | |
| | | /** |
| | | * 添加频道 |
| | | * |
| | | * @param map |
| | | */ |
| | | public void addMap(TVLiveCategoryChannelMap map); |
| | | |
| | | |
| | | public void deleteByPrimaryKey(String id); |
| | | |
| | | |
| | | public void update(TVLiveCategoryChannelMap map); |
| | | |
| | | |
| | | public List<TVLiveChannel> listChannelByCid(String cid, String nameKey, int page, int pageSize); |
| | | |
| | | public long countChannelByCid(String cid, String nameKey); |
| | | |
| | | |
| | | public List<TVLiveCategoryChannelMap> listByChannelId(String channelId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.SuperTVLiveCategory; |
| | | import com.yeshi.buwan.domain.live.TVLiveCategory; |
| | | import com.yeshi.buwan.exception.live.TVLiveCategoryException; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 直播分类服务 |
| | | */ |
| | | public interface TVLiveCategoryService { |
| | | |
| | | |
| | | public void addCategory(TVLiveCategory category, List<String> detailSystemList) throws TVLiveCategoryException; |
| | | |
| | | public void deleteCateogry(List<String> ids); |
| | | |
| | | public void updateCategory(TVLiveCategory category); |
| | | |
| | | |
| | | /** |
| | | * 列表查询 |
| | | * |
| | | * @param detailSystemId |
| | | * @param nameKey |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<TVLiveCategory> list(String detailSystemId, String nameKey, int page, int pageSize); |
| | | |
| | | public long count(String detailSystemId, String nameKey); |
| | | |
| | | |
| | | //系统分类映射 |
| | | |
| | | /** |
| | | * @param superCategory |
| | | */ |
| | | |
| | | public void addSuperCategory(SuperTVLiveCategory superCategory); |
| | | |
| | | public void updateSuperCategory(SuperTVLiveCategory superCategory); |
| | | |
| | | public void deleteSuperCategory(String id); |
| | | |
| | | public void deleteSuperCategory(String categoryId, String detailSystemId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 直播分类服务 |
| | | */ |
| | | public interface TVLiveChannelResourceService { |
| | | |
| | | |
| | | public List<TVLiveChannelResourceMap> listByChannelId(String channelId); |
| | | |
| | | public long countByChannelId(String channelId); |
| | | |
| | | public void update(TVLiveChannelResourceMap map); |
| | | |
| | | public void add(TVLiveChannelResourceMap map); |
| | | |
| | | public void delete(String id); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.exception.ParamsException; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | public interface TVLiveChannelService { |
| | | |
| | | /** |
| | | * 保存频道 |
| | | * |
| | | * @param channel |
| | | * @throws ParamsException |
| | | */ |
| | | public TVLiveChannel save(@Valid TVLiveChannel channel) throws ParamsException; |
| | | |
| | | |
| | | public void delete(String id); |
| | | |
| | | public void update(TVLiveChannel channel); |
| | | |
| | | public List<TVLiveChannel> list(String name, Integer state, int page, int pageSize); |
| | | |
| | | public long count(String name, Integer state); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.util.factory.live; |
| | | |
| | | import com.yeshi.buwan.domain.live.TVLiveChannel; |
| | | import com.yeshi.buwan.live.migu.MiGuLiveListInfo; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | |
| | | public class TVLiveChannelFactory { |
| | | |
| | | public static TVLiveChannel create(MiGuLiveListInfo miGuLiveListInfo) { |
| | | TVLiveChannel channel = new TVLiveChannel(); |
| | | channel.sethPicture(miGuLiveListInfo.getH5pics().getHighResolutionH()); |
| | | channel.setvPicture(miGuLiveListInfo.getH5pics().getHighResolutionV()); |
| | | channel.setName(miGuLiveListInfo.getName()); |
| | | channel.setId(StringUtil.Md5(channel.getName())); |
| | | if (miGuLiveListInfo.getNow() != null) { |
| | | channel.setNowProgram(miGuLiveListInfo.getNow().getPlayName()); |
| | | channel.setNowProgramTime(miGuLiveListInfo.getNow().getStartTime() + "-" + miGuLiveListInfo.getNow().getEndTime()); |
| | | } |
| | | if (miGuLiveListInfo.getNext() != null) { |
| | | channel.setNextProgram(miGuLiveListInfo.getNext().getPlayName()); |
| | | channel.setNextProgramTime(miGuLiveListInfo.getNext().getStartTime() + "-" + miGuLiveListInfo.getNext().getEndTime()); |
| | | } |
| | | channel.setState(TVLiveChannel.STATE_NORMAL); |
| | | return channel; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | systemConfig = new SystemConfig(); |
| | | systemConfig.setBeizhu(""); |
| | | systemConfig.setKey("buyRecordUrl"); |
| | | systemConfig.setName("购买记录链接"); |
| | | systemConfig.setKey("miguLiveCategory"); |
| | | systemConfig.setName("咪咕直播解析分类"); |
| | | try { |
| | | systemConfig.setValue("http://vip.ysdq.yeshitv.com/order.html"); |
| | | |
| | | String LIVE_CATE = "[{\"name\":\"热门\",\"vomsID\":\"e7716fea6aa1483c80cfc10b7795fcb8\"},{\"name\":\"央视\",\"vomsID\":\"a5f78af9d160418eb679a6dd0429c920\"},{\"name\":\"卫视\",\"vomsID\":\"0847b3f6c08a4ca28f85ba5701268424\"},{\"name\":\"地方\",\"vomsID\":\"855e9adc91b04ea18ef3f2dbd43f495b\"},{\"name\":\"追剧\",\"vomsID\":\"dd5311d848b54c56acba186ff1107236\"},{\"name\":\"影视\",\"vomsID\":\"10b0d04cb23d4ac5945c4bc77c7ac44e\"},{\"name\":\"体育\",\"vomsID\":\"7538163cdac044398cb292ecf75db4e0\"},{\"name\":\"新闻\",\"vomsID\":\"c584f67ad63f4bc983c31de3a9be977c\"},{\"name\":\"教育\",\"vomsID\":\"af72267483d94275995a4498b2799ecd\"},{\"name\":\"娱乐\",\"vomsID\":\"192a12edfef04b5eb616b878f031f32f\"},{\"name\":\"少儿\",\"vomsID\":\"fc2f5b8fd7db43ff88c4243e731ecede\"},{\"name\":\"纪实\",\"vomsID\":\"e1165138bdaa44b9a3138d74af6c6673\"}]"; |
| | | systemConfig.setValue(LIVE_CATE); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | import com.yeshi.buwan.dao.goldcorn.GoldCornTaskActionDetailDao; |
| | | import com.yeshi.buwan.dao.video.VideoResourceVersionMapDao; |
| | | import com.yeshi.buwan.domain.goldcorn.GoldCornTaskActionDetail; |
| | | import com.yeshi.buwan.domain.live.*; |
| | | import com.yeshi.buwan.domain.pptv.PPTVPlayProcessRecord; |
| | | import com.yeshi.buwan.domain.tb.YouZhiHaoHuoGoods; |
| | | import com.yeshi.buwan.domain.video.VideoResourceVersionMap; |
| | | import com.yeshi.buwan.domain.vip.VideoBuyRecord; |
| | | import com.yeshi.buwan.live.migu.MiGuLiveListInfo; |
| | | import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; |
| | | import com.yeshi.buwan.videos.bilibili.entity.BilibiliEpInfo; |
| | | import com.yeshi.buwan.videos.bilibili.entity.BilibiliMediaInfo; |
| | |
| | | @org.junit.Test |
| | | public void createDao() { |
| | | try { |
| | | SpringComponentGenerater.createMongoDao(new MongoDBDaoData.Builder().setBaseDaoClass(MongodbBaseDao.class).setDaoPackageName("com.yeshi.buwan.dao.juhe.bilibili").setEntityClass(BilibiliSearchVideoMap.class).create(), "D:\\workspace\\BuWan\\src\\main\\java\\com\\yeshi\\buwan\\dao\\juhe\\bilibili\\"); |
| | | SpringComponentGenerater.createMongoDao(new MongoDBDaoData.Builder().setBaseDaoClass(MongodbBaseDao.class).setDaoPackageName("com.yeshi.buwan.dao.live.migu").setEntityClass(MiGuLiveListInfo.class).create(), "D:\\workspace\\BuWan\\src\\main\\java\\com\\yeshi\\buwan\\dao\\live\\migu\\"); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // |
| | | // |
| | | @org.junit.Test |
| | | public void createService() { |
| | | try { |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | // |
| | | |
| | | // |
| | | // |
| | | @org.junit.Test |
| | | public void createServiceImpl() { |
New file |
| | |
| | | package com.hxh.spring.test.live; |
| | | |
| | | import com.yeshi.buwan.job.LiveJob; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | import org.springframework.test.context.web.WebAppConfiguration; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试 |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | public class TVLiveTest { |
| | | |
| | | @Resource |
| | | private LiveJob liveJob; |
| | | |
| | | @Test |
| | | public void syncMiGu() throws Exception { |
| | | liveJob.updateMiGu(""); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @Test |
| | | public void test2() throws Exception { |
| | | BilibiliApiUtil.MediaUrlResult result = BilibiliApiUtil.getMediaList(BilibiliUtil.TYPE_DIANSHIJU, 2, 1); |
| | | BilibiliApiUtil.MediaUrlResult result = BilibiliApiUtil.getMediaList(BilibiliUtil.TYPE_JILUPIAN, 2, 1); |
| | | int page = result.getTotal() % 20 == 0 ? result.getTotal() / 20 : result.getTotal() / 20 + 1; |
| | | for (int i = 30; i < 40; i++) { |
| | | for (int i = 0; i < 10; i++) { |
| | | System.out.println("page:" + i); |
| | | result = BilibiliApiUtil.getMediaList(BilibiliUtil.TYPE_DIANSHIJU, 2, i + 1); |
| | | if (result.getResult() != null) |