src/main/java/com/yeshi/buwan/controller/admin/api/VipAdminController.java
@@ -1,12 +1,15 @@ package com.yeshi.buwan.controller.admin.api; import com.google.gson.*; import com.yeshi.buwan.domain.user.LoginUser; import com.yeshi.buwan.domain.vip.UserVIPInfo; import com.yeshi.buwan.domain.vip.VIPOrderRecord; import com.yeshi.buwan.service.inter.LoginUserService; import com.yeshi.buwan.service.inter.vip.VIPService; import com.yeshi.buwan.util.Constant; import com.yeshi.buwan.util.StringUtil; import com.yeshi.buwan.util.TimeUtil; import com.yeshi.buwan.vo.vip.UserVIPInfoVO; import com.yeshi.buwan.web.tag.PageEntity; import net.sf.json.JSONObject; import org.springframework.stereotype.Controller; @@ -16,7 +19,9 @@ import org.yeshi.utils.JsonUtil; import javax.annotation.Resource; import java.io.PrintWriter; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -27,9 +32,12 @@ @Resource private VIPService vipService; @Resource private LoginUserService loginUserService; private Gson getGson() { Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { @Override public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) { if (value == null) { @@ -46,7 +54,7 @@ @ResponseBody @RequestMapping(value = "/vipUserList", method = RequestMethod.POST) public String vipUserList(Boolean vip,String uid, int page) { public void vipUserList(Boolean vip, String uid, int page, PrintWriter out) { Date minDate = null; Date maxDate = null; if (vip != null) { @@ -57,19 +65,41 @@ maxDate = new Date(); } } List<UserVIPInfo> list = new ArrayList<>(); long count = 0; if (!StringUtil.isNullOrEmpty(uid)) { UserVIPInfo vipInfo = vipService.getVIPInfo(uid); if (vipInfo != null) { list.add(vipInfo); count = 1; } } else { list = vipService.listVIPUser(minDate, maxDate, page, Constant.pageCount); count = vipService.countVIPUser(minDate, maxDate); } List<UserVIPInfo> list = vipService.listVIPUser(minDate, maxDate, page, Constant.pageCount); long count = vipService.countVIPUser(minDate, maxDate); List<UserVIPInfoVO> voList = new ArrayList<>(); for (UserVIPInfo vipInfo : list) { UserVIPInfoVO vo = new UserVIPInfoVO(); vo.setCreateTime(vipInfo.getCreateTime()); vo.setExpireDate(vipInfo.getExpireDate()); vo.setUpdateTime(vipInfo.getUpdateTime()); LoginUser loginUser = loginUserService.getLoginUser(vipInfo.getUid()); vo.setUser(loginUser); voList.add(vo); } JSONObject data = new JSONObject(); data.put("pageEntity", new PageEntity(page, Constant.pageCount,(int)count)); data.put("list", getGson().toJson(list)); return JsonUtil.loadTrueResult(data); data.put("pageEntity", new PageEntity(page, Constant.pageCount, (int) count)); data.put("list", getGson().toJson(voList)); out.print(JsonUtil.loadTrueResult(data)); } @ResponseBody @RequestMapping(value = "/vipOrderList", method = RequestMethod.POST) public String vipOrderList(Boolean pay, String uid, int page) { public void vipOrderList(Boolean pay, String uid, int page, PrintWriter out) { if (StringUtil.isNullOrEmpty(uid)) { uid = null; } @@ -85,9 +115,9 @@ List<VIPOrderRecord> list = vipService.listOrderRecord(uid, state, page, Constant.pageCount); long count = vipService.countOrderRecord(uid, state); JSONObject data = new JSONObject(); data.put("pageEntity", new PageEntity(page, Constant.pageCount,(int)count)); data.put("pageEntity", new PageEntity(page, Constant.pageCount, (int) count)); data.put("list", getGson().toJson(list)); return JsonUtil.loadTrueResult(data); out.print(JsonUtil.loadTrueResult(data)); } src/main/java/com/yeshi/buwan/controller/api/ApiControllerV3.java
@@ -424,7 +424,7 @@ if (StringUtil.isNullOrEmpty(method)) return; if (method.equalsIgnoreCase("getConfig")) {// 获取用户编号 if (method.equalsIgnoreCase("getConfig")) {// 获取配置信息 configParser.getConfig(acceptData, request, out); } src/main/java/com/yeshi/buwan/controller/api/VIPController.java
@@ -116,9 +116,10 @@ VIPOrderRecord record = new VIPOrderRecord(); record.setUid(loginUid); record.setType(vipPrice.getType()); record.setMoney(vipPrice.getPrice()); record.setMoney(vipPrice.getActualPrice()); record.setPayWay(payWay); record.setState(VIPOrderRecord.STATE_NOT_PAY); record.setIpInfo(IPUtil.getRemotIP(request) + ":" + IPUtil.getRemotePort(request)); try { vipService.addVIPRecord(record); } catch (VIPException e) { @@ -146,7 +147,7 @@ .PAY_WAY_WX: { //生成微信支付订单 try { String payUrl = VipUtil.createWXOrder(record.getId(), ip, orderNo, vipPrice.getPrice(), "影视大全VIP-" + vipPrice.getType().getName()); String payUrl = VipUtil.createWXOrder(record.getId(), ip, orderNo, vipPrice.getActualPrice(), "影视大全VIP-" + vipPrice.getType().getName()); org.json.JSONObject data = new org.json.JSONObject(); data.put("payUrl", payUrl); data.put("payWay", payWay); src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java
@@ -184,7 +184,7 @@ VideoType vt = new VideoType(Constant.VIDEO_TYPE_VIP); vt.setName("VIP"); vt.setShow("1"); vt.setIcon("https://hbimg.huabanimg.com/12834704bb4aa39342c2fb51e0c644181b13997b70eb-CqlE1I_fw658/format/webp"); vt.setIcon("https://hbimg.huabanimg.com/4690ea8f8144f3d46c11e417c77daa5debcb71f9201f-WpAbfw_fw658/format/jpg"); sty.setType(vt); boolean isC = false; for (SuperVideoType svt : list) { @@ -622,6 +622,14 @@ String parentId = request.getParameter("ParentId"); //是否包含VIP的分类 boolean containsVIPType = false; try { List<Integer> vipTypeList = Arrays.asList(Constant.vipTypes); containsVIPType = vipTypeList.contains(Integer.parseInt(parentId)); } catch (Exception e) { } if (StringUtil.isNullOrEmpty(parentId)) { out.print(JsonUtil.loadFalseJson("请上传ParentId")); return; @@ -681,39 +689,50 @@ list.remove(0); } } else if ((Constant.VIDEO_TYPE_VIP + "").equalsIgnoreCase(parentId)) { } else if (containsVIPType) { //VIP分类 VideoType type = new VideoType(Constant.VIDEO_TYPE_VIP); type.setName("全部"); type.setShow("1"); type.setCategoryType("area"); list.add(type); //VIP根分类 if (Constant.VIDEO_TYPE_VIP == Integer.parseInt(parentId)) { VideoType type = new VideoType(Constant.VIDEO_TYPE_VIP); type.setName("全部"); type.setShow("1"); type.setCategoryType("area"); list.add(type); type = new VideoType(Constant.VIDEO_TYPE_VIP_MOVIE); type.setName("电影"); type.setShow("1"); type.setCategoryType("area"); list.add(type); type = new VideoType(Constant.VIDEO_TYPE_VIP_MOVIE); type.setName("电影"); type.setShow("1"); type.setCategoryType("area"); list.add(type); type = new VideoType(Constant.VIDEO_TYPE_VIP_TV); type.setName("电视剧"); type.setShow("1"); type.setCategoryType("area"); list.add(type); type = new VideoType(Constant.VIDEO_TYPE_VIP_TV); type.setName("电视剧"); type.setShow("1"); type.setCategoryType("area"); list.add(type); type = new VideoType(Constant.VIDEO_TYPE_VIP_CARTOON); type.setName("动漫"); type.setShow("1"); type.setCategoryType("area"); list.add(type); type = new VideoType(Constant.VIDEO_TYPE_VIP_CARTOON); type.setName("动漫"); type.setShow("1"); type.setCategoryType("area"); list.add(type); // type = new VideoType(Constant.VIDEO_TYPE_VIP_SHOW); // type.setName("综艺"); // type.setShow("1"); // type.setCategoryType("area"); // list.add(type); } else { VideoType type = new VideoType(Integer.parseInt(parentId)); type.setName("全部"); type.setShow("1"); type.setCategoryType("area"); list.add(type); } } else { List<VideoType> clist = classService.getFirstTypeList(parentId); @@ -850,6 +869,8 @@ if ("310".equals(typeid)) { // 310做的特殊处理:前端处理的是HomeAd,所有需要返回homeAD的形式 Object vi = json.get("VideoInfo"); json.put("Video", vi); //设置banner的比例 object.put("bannerSizeRate", "0.56"); } json.put("LinkType", "1"); array.add(json); src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java
@@ -202,8 +202,18 @@ ad.put("videoSearch", adConfig == null ? "" : adConfig.getType()); adNew.put("videoSearch", gson.toJson(adConfig)); //pptv免广告激励视频 adConfig = getAdShowType("pptv_no_ad_reward", acceptData.getChannel(), acceptData.getVersion(), map); if (hiddenAll) adConfig = null; adNew.put("pptvNoAdReward", gson.toJson(adConfig)); data.put("ad", ad); data.put("adNew", adNew); //PPTV免广告权益时长,暂时设置为3小时 data.put("pptvNoAdRewardHour", 3); out.print(JsonUtil.loadTrueJson(data.toString())); } src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
@@ -125,14 +125,6 @@ if (!StringUtil.isNullOrEmpty(ad.getParams())) { ad.setParams(ad.getParams().replace("\"", "\\" + "\"")); } // 3.4.7以上的版本才可以用 // com.weikou.beibeivideo.ui.mine.FXBrowserActivity if ("com.weikou.beibeivideo.ui.mine.FXBrowserActivity".equalsIgnoreCase(ad.getClazz()) && acceptData.getVersion() < 71) ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity"); else ad.setClazz("com.weikou.beibeivideo.ui.mine.FXBrowserActivity"); } object.put("count", (new StringBuilder(String.valueOf(list.size()))).toString()); JSONArray array = new JSONArray(); @@ -246,6 +238,7 @@ } public HomeType convertHomeVideoList(HomeType type) { List<VideoInfo> vlist = new ArrayList<VideoInfo>(); List<HomeVideo> list = type.getHomeVideoList(); src/main/java/com/yeshi/buwan/dao/vip/VIPOrderRecordDao.java
@@ -21,6 +21,8 @@ if (daoQuery.uid != null) { hql += " and r.uid=" + daoQuery.uid; } hql += " order by r.createTime desc"; return hql; } src/main/java/com/yeshi/buwan/domain/HomeType.java
@@ -37,6 +37,11 @@ private String params; @Expose private boolean hasMore; //是否需要填充广告 @Expose private boolean needAd; @Expose private String iosControl; @Expose @@ -51,6 +56,15 @@ @Expose private int number;// 显示多少个 public boolean isNeedAd() { return needAd; } public void setNeedAd(boolean needAd) { this.needAd = needAd; } private SystemInfo system; private VideoType videoType; //20170914 src/main/java/com/yeshi/buwan/domain/VideoInfo.java
@@ -123,6 +123,12 @@ @Transient private int free; //0-普清 1-高清 @Expose @Transient private int definition; @Transient private VideoResourceMapExtraInfo videoResourceMapExtraInfo; @@ -537,4 +543,13 @@ public void setFree(int free) { this.free = free; } public int getDefinition() { return definition; } public void setDefinition(int definition) { this.definition = definition; } } src/main/java/com/yeshi/buwan/domain/video/AlbumVideoMap.java
@@ -1,12 +1,15 @@ package com.yeshi.buwan.domain.video; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import java.util.Date; //专辑视频映射 @Document(collection="albumVideoMap") @Document(collection = "albumVideoMap") public class AlbumVideoMap { @Id private String id; private String videoId;//视频ID private long rootVideoType;//根视频类型 private int videoCount;//视频数量 @@ -43,4 +46,12 @@ public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getId() { return id; } public void setId(String id) { this.id = id; } } src/main/java/com/yeshi/buwan/domain/vip/VIPOrderRecord.java
@@ -33,10 +33,15 @@ private Integer payWay; //支付金额 private BigDecimal payMoney; private String ipInfo; //付款时间 private Date payTime; private Date createTime; private Date updateTime; //会员开始时间 private Date vipStartTime; @@ -139,4 +144,13 @@ public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getIpInfo() { return ipInfo; } public void setIpInfo(String ipInfo) { this.ipInfo = ipInfo; } } src/main/java/com/yeshi/buwan/domain/vip/VIPPrice.java
@@ -14,6 +14,9 @@ private VIPPriceType type; @Expose private BigDecimal price; //原始价格 @Expose private BigDecimal actualPrice; private Date createTime; private Date updateTime; @@ -32,7 +35,6 @@ public void setShow(Boolean show) { this.show = show; } public String getId() { @@ -90,4 +92,12 @@ public void setPptvGoodsNo(String pptvGoodsNo) { this.pptvGoodsNo = pptvGoodsNo; } public BigDecimal getActualPrice() { return actualPrice; } public void setActualPrice(BigDecimal actualPrice) { this.actualPrice = actualPrice; } } src/main/java/com/yeshi/buwan/domain/web/StatisticXY.java
@@ -1,6 +1,8 @@ package com.yeshi.buwan.domain.web; public class StatisticXY { import java.io.Serializable; public class StatisticXY implements Serializable { private long y; private String time; src/main/java/com/yeshi/buwan/pptv/PPTVUtil.java
@@ -39,6 +39,7 @@ videoType = VideoConstant.VIDEO_CATEGORY_DONGMAN; break; default: return null; } return (long) videoType; @@ -61,7 +62,11 @@ String score = series.getScore(); String tag = ""; VideoType videoType = new VideoType(getVideoType(series)); Long videoTypeId = getVideoType(series); if (videoTypeId == null) return null; VideoType videoType = new VideoType(videoTypeId); //电影 if (videoType.getId() == VideoConstant.VIDEO_CATEGORY_DIANYING) { src/main/java/com/yeshi/buwan/service/imp/ClearService.java
@@ -2,6 +2,7 @@ import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.annotation.Resource; @@ -23,6 +24,14 @@ //清除数据库中的死数据 @Service public class ClearService { private final String[] videoTables = new String[]{"wk_category_video", "wk_resource_video", "wk_video_attention", "wk_video_banquan_video", "wk_video_banquan_webvideo", "wk_video_collection", "wk_video_comment", "wk_video_comment2", "wk_video_getscore_collect", "wk_video_homead", "wk_video_homevideo", "wk_video_hotstar_video", "wk_video_iqiyi", "wk_video_letv", "wk_video_play_statistics", "wk_video_pptv", "wk_video_sohu", "wk_video_special_video", "wk_video_youku", "wk_video_youku_dj"}; @Resource private VideoInfoDao videoInfoDao; @@ -75,13 +84,9 @@ // 清楚依赖VideoInfo的数据 @SuppressWarnings("rawtypes") public void clearDependVideo() { String[] tables = new String[]{"wk_category_video", "wk_resource_video", "wk_video_attention", "wk_video_banquan_video", "wk_video_banquan_webvideo", "wk_video_collection", "wk_video_comment", "wk_video_comment2", "wk_video_getscore_collect", "wk_video_homead", "wk_video_homevideo", "wk_video_hotstar_video", "wk_video_iqiyi", "wk_video_letv", "wk_video_play_statistics", "wk_video_pptv", "wk_video_sohu", "wk_video_special_video", "wk_video_youku", "wk_video_youku_dj"}; for (String table : tables) { for (String table : videoTables) { final String sql = String.format( "SELECT vv.id FROM `%s` vv LEFT JOIN wk_video_video v ON v.`id`=vv.`videoid` WHERE v.`id` IS NULL", table); @@ -126,6 +131,36 @@ } /** * 清理SQL数据库依赖视频 * * @param videoId */ public void clearDependVideo(final String videoId) { clearDependVideo(Arrays.asList(new String[]{videoId})); } public void clearDependVideo(final List<String> videoIds) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { session.getTransaction().begin(); List<String> ors = new ArrayList<>(); for (String videoId : videoIds) { ors.add("videoid=" + videoId); } for (String table : videoTables) session.createSQLQuery( String.format("delete from %s where %s", table, org.yeshi.utils.StringUtil.concat(ors, " or "))) .executeUpdate(); session.flush(); session.getTransaction().commit(); return null; } }); } /** * 清除无效的爱奇艺视频 */ @SuppressWarnings("unchecked") src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java
@@ -65,7 +65,7 @@ resourceWhere = resourceWhere.substring(0, resourceWhere.length() - 2); List resultList = session .createSQLQuery( "SELECT ht.`id` as htid,ht.`name` as htname,ht.`columns` as htcolumns ,ht.`hasmore`,ht.`activity` ,ht.`params` ,ht.`ioscontrol`,ht.number,hvideo.id as hvid,hvideo.`videoid` AS hvvideoid,hvideo.`picture`as hvpicture ,hvideo.`tag` as hvtag, v.`id` as vid ,v.`picture` as vpicture ,v.`name` as vname ,v.`tag` as vtag ,v.`hpicture` as vhpicture ,v.`latest_hpicture` as vlatest_hpicture ,v.`watchcount` as vwatchcount,v.commentcount,ht.icon as hicon,ht.orderby as htorder,hvideo.orderby as hvorder FROM (SELECT hv.* FROM `wk_resource_video` rv LEFT JOIN `wk_video_homevideo` hv ON rv.`videoid` =hv.`videoid` LEFT JOIN `wk_video_video` v ON v.`id` =hv.`videoid` LEFT JOIN `wk_video_banquan_video` bv ON bv.`videoid`=hv.`videoid` AND bv.`detailsystemid`=" "SELECT ht.`id` as htid,ht.`name` as htname,ht.`columns` as htcolumns ,ht.`hasmore`,ht.`activity` ,ht.`params` ,ht.`ioscontrol`,ht.number,hvideo.id as hvid,hvideo.`videoid` AS hvvideoid,hvideo.`picture`as hvpicture ,hvideo.`tag` as hvtag, v.`id` as vid ,v.`picture` as vpicture ,v.`name` as vname ,v.`tag` as vtag ,v.`hpicture` as vhpicture ,v.`latest_hpicture` as vlatest_hpicture ,v.`watchcount` as vwatchcount,v.commentcount,ht.icon as hicon,ht.orderby as htorder,hvideo.orderby as hvorder,need_ad FROM (SELECT hv.* FROM `wk_resource_video` rv LEFT JOIN `wk_video_homevideo` hv ON rv.`videoid` =hv.`videoid` LEFT JOIN `wk_video_video` v ON v.`id` =hv.`videoid` LEFT JOIN `wk_video_banquan_video` bv ON bv.`videoid`=hv.`videoid` AND bv.`detailsystemid`=" + detailSystem + " AND bv.`show`=1 LEFT JOIN `wk_video_hometype` ht ON ht.id=hv.hometype WHERE (hv.`id`>0 AND v.`show` =1 AND ht.vtid='" + vtid + "' AND (" + resourceWhere @@ -85,6 +85,7 @@ ht.setNumber(Integer.parseInt(obj[7] + "")); ht.setOrderby(obj[21] + ""); ht.setNeedAd(Boolean.parseBoolean(obj[23]+"")); HomeVideo hv = new HomeVideo(); hv.setId(obj[8] + ""); src/main/java/com/yeshi/buwan/service/imp/SearchService.java
@@ -328,11 +328,15 @@ if (videoType == 0 && commonSolrPage > 0) { //搜索原始的 List<VideoInfo> solrList = SolrUtil.search(key, commonSolrPage); for (VideoInfo vi : solrList) { if (!solrAlbumVids.contains(vi.getId())) { localList.add(vi); try { List<VideoInfo> solrList = SolrUtil.search(key, commonSolrPage); for (VideoInfo vi : solrList) { if (!solrAlbumVids.contains(vi.getId())) { localList.add(vi); } } }catch(Exception e){ } } System.out.println("搜索耗时:" + (System.currentTimeMillis() - startt)); src/main/java/com/yeshi/buwan/service/imp/VideoInfoService.java
@@ -44,6 +44,9 @@ @Resource private VideoResourceService videoResourceService; @Resource private ClearService clearService; public VideoInfo getVideoInfo(String vid) { return videoInfoDao.find(VideoInfo.class, vid); } @@ -184,6 +187,7 @@ return null; } /** * 根据名称与主演 * src/main/java/com/yeshi/buwan/service/imp/VideoManager.java
@@ -7,6 +7,9 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import com.yeshi.buwan.domain.video.AlbumVideoMap; import com.yeshi.buwan.service.inter.juhe.AlbumVideoMapService; import com.yeshi.buwan.util.mq.CMQManager; import org.hibernate.HibernateException; import org.hibernate.Session; import org.springframework.orm.hibernate4.HibernateCallback; @@ -34,596 +37,527 @@ @Service public class VideoManager { @Resource private VideoInfoDao videoInfoDao; @Resource private VideoTypeDao videoTypeDao; @Resource private VideoDetailInfoDao videoDetailInfoDao; @Resource private VideoInfoDao videoInfoDao; @Resource private VideoTypeDao videoTypeDao; @Resource private VideoDetailInfoDao videoDetailInfoDao; /** * 主键查询某一个视频的信息 * * @param id * @return */ public VideoInfo getVideoInfo(String id) { VideoInfo info = videoInfoDao.find(VideoInfo.class, id); info.setVideoDetailList(getVideoDetail(info.getId())); return info; } @Resource private ClearService clearService; /** * 添加一个视频信息 * * @param info * @return */ public VideoInfo addVideoInfo(VideoInfo info) { info.setUpdatetime(System.currentTimeMillis() + ""); /** * 主键查询某一个视频的信息 * * @param id * @return */ public VideoInfo getVideoInfo(String id) { VideoInfo info = videoInfoDao.find(VideoInfo.class, id); info.setVideoDetailList(getVideoDetail(info.getId())); return info; } videoInfoDao.save(info); List<VideoInfo> list = videoInfoDao.list("from VideoInfo v where v.createtime=? and v.name=?", new String[] { info.getCreatetime() + "", info.getName() }); return list.get(0); } /** * 添加一个视频信息 * * @param info * @return */ public VideoInfo addVideoInfo(VideoInfo info) { info.setUpdatetime(System.currentTimeMillis() + ""); String[] sts = { "彼得兔", "铁扇公主", "过猴山", "骄傲的将军", "夸口的青蛙", "小猫钓鱼", "好朋友", "神笔马良", "木头公主", "猪八戒吃西瓜", "小鲤鱼", "我知道", "老小阿凡提", "阿狸通话日记" }; videoInfoDao.save(info); List<VideoInfo> list = videoInfoDao.list("from VideoInfo v where v.createtime=? and v.name=?", new String[]{info.getCreatetime() + "", info.getName()}); return list.get(0); } boolean isContains(String st) { for (String s : sts) { if (st.contains(s)) { return true; } } return false; } String[] sts = {"彼得兔", "铁扇公主", "过猴山", "骄傲的将军", "夸口的青蛙", "小猫钓鱼", "好朋友", "神笔马良", "木头公主", "猪八戒吃西瓜", "小鲤鱼", "我知道", "老小阿凡提", "阿狸通话日记"}; // 获取大分类 public String getRootType(long id) { VideoType type = videoTypeDao.find(VideoType.class, id); while (type.getParent() != null) type = type.getParent(); return type.getId() + ""; } boolean isContains(String st) { for (String s : sts) { if (st.contains(s)) { return true; } } return false; } // 添加视频 @SuppressWarnings("unchecked") public void addVideoInfo(List<VideoInfo> list) { for (VideoInfo in : list) { final VideoInfo info = in; LogUtil.i("视频名称:" + info.getName()); // if (!info.getName().contains("三个奶爸")) continue; final String parentId = getRootType(info.getVideoType().getId()); videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { List<VideoInfo> vList = session .createQuery("from VideoInfo v where v.name=? and v.show=1 and (v.videoType.id=" + parentId + " or v.videoType.parent.id=" + parentId + ")") .setParameter(0, info.getName()).list(); session.getTransaction().begin(); if (vList.size() <= 0) {// 不存在视频--可以添加进去 info.setUpdatetime(System.currentTimeMillis() + ""); session.persist(info); List<VideoInfo> viList = session .createQuery("from VideoInfo v where v.name=? and v.createtime=?") .setParameter(0, info.getName()).setParameter(1, info.getCreatetime()).list();// 查询出刚刚添加的视频 if (viList != null && viList.size() > 0) { VideoInfo newVideo = new VideoInfo(viList.get(0).getId()); LogUtil.i("查出的VideoId为:" + newVideo.getId()); for (int i = 0; i < info.getVideoDetailList().size(); i++) { VideoDetailInfo detail = info.getVideoDetailList().get(i); detail.setVideo(newVideo); session.persist(detail); session.createSQLQuery( "update wk_video_video_detail d set d.videoid=? where d.name=? and d.tag=? and d.createtime=?") .setParameter(0, newVideo.getId()).setParameter(1, detail.getName()) .setParameter(2, detail.getTag()).setParameter(3, detail.getCreatetime()) .executeUpdate(); } } else { LogUtil.i("videoId没有查出来"); } // 获取大分类 public String getRootType(long id) { VideoType type = videoTypeDao.find(VideoType.class, id); while (type.getParent() != null) type = type.getParent(); return type.getId() + ""; } } else {// 存在的视频,添加进UrlList // 获取videoDetail; vList.get(0).setTag(info.getTag()); session.update(vList.get(0)); vList.get(0).setNowNumber(info.getNowNumber()); vList.get(0).setTotalNumber(info.getTotalNumber()); // 添加视频 @SuppressWarnings("unchecked") public void addVideoInfo(List<VideoInfo> list) { for (VideoInfo in : list) { final VideoInfo info = in; LogUtil.i("视频名称:" + info.getName()); // if (!info.getName().contains("三个奶爸")) continue; final String parentId = getRootType(info.getVideoType().getId()); videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { List<VideoInfo> vList = session .createQuery("from VideoInfo v where v.name=? and v.show=1 and (v.videoType.id=" + parentId + " or v.videoType.parent.id=" + parentId + ")") .setParameter(0, info.getName()).list(); session.getTransaction().begin(); if (vList.size() <= 0) {// 不存在视频--可以添加进去 info.setUpdatetime(System.currentTimeMillis() + ""); session.persist(info); List<VideoInfo> viList = session .createQuery("from VideoInfo v where v.name=? and v.createtime=?") .setParameter(0, info.getName()).setParameter(1, info.getCreatetime()).list();// 查询出刚刚添加的视频 if (viList != null && viList.size() > 0) { VideoInfo newVideo = new VideoInfo(viList.get(0).getId()); LogUtil.i("查出的VideoId为:" + newVideo.getId()); for (int i = 0; i < info.getVideoDetailList().size(); i++) { VideoDetailInfo detail = info.getVideoDetailList().get(i); detail.setVideo(newVideo); session.persist(detail); session.createSQLQuery( "update wk_video_video_detail d set d.videoid=? where d.name=? and d.tag=? and d.createtime=?") .setParameter(0, newVideo.getId()).setParameter(1, detail.getName()) .setParameter(2, detail.getTag()).setParameter(3, detail.getCreatetime()) .executeUpdate(); } } else { LogUtil.i("videoId没有查出来"); } List<VideoDetailInfo> detailList = getVideoDetail(session, vList.get(0).getId());// 获取原来的detailList for (int n = 0; n < info.getVideoDetailList().size(); n++) { if (n + 1 > detailList.size()) {// 原来不存在这一集 VideoInfo newVideo = vList.get(0); // 保存详情 VideoDetailInfo detail = info.getVideoDetailList().get(n); detail.setVideo(newVideo); session.persist(detail); session.createSQLQuery( "update wk_video_video_detail d set d.videoid=? where d.name=? and d.tag=? and d.createtime=?") .setParameter(0, newVideo.getId()).setParameter(1, detail.getName()) .setParameter(2, detail.getTag()).setParameter(3, detail.getCreatetime()) .executeUpdate(); } else {// 存在的视频,添加进UrlList // 获取videoDetail; vList.get(0).setTag(info.getTag()); session.update(vList.get(0)); vList.get(0).setNowNumber(info.getNowNumber()); vList.get(0).setTotalNumber(info.getTotalNumber()); } else {// 原来存在这个detail VideoDetailInfo detail = detailList.get(n);// 获取原来那个url List<VideoUrl> urlList = detail.getUrls(); VideoUrl vurl = null; List<VideoDetailInfo> detailList = getVideoDetail(session, vList.get(0).getId());// 获取原来的detailList for (int n = 0; n < info.getVideoDetailList().size(); n++) { if (n + 1 > detailList.size()) {// 原来不存在这一集 VideoInfo newVideo = vList.get(0); // 保存详情 VideoDetailInfo detail = info.getVideoDetailList().get(n); detail.setVideo(newVideo); session.persist(detail); session.createSQLQuery( "update wk_video_video_detail d set d.videoid=? where d.name=? and d.tag=? and d.createtime=?") .setParameter(0, newVideo.getId()).setParameter(1, detail.getName()) .setParameter(2, detail.getTag()).setParameter(3, detail.getCreatetime()) .executeUpdate(); for (VideoUrl videoUrl : urlList) { if (videoUrl.getResource().getId().equalsIgnoreCase(info.getVideoDetailList() .get(n).getUrls().get(0).getResource().getId())) {// 存在 vurl = videoUrl; } } } else {// 原来存在这个detail VideoDetailInfo detail = detailList.get(n);// 获取原来那个url List<VideoUrl> urlList = detail.getUrls(); VideoUrl vurl = null; if (vurl == null) {// 不存在--往里面添加 VideoUrl vu = null; try { vu = info.getVideoDetailList().get(n).getUrls().get(0); } catch (Exception e) { vu = info.getVideoDetailList().get(n).getUrls().get(0); } vu.setVideoDetail(detail); // 更新url session.createSQLQuery( "insert into wk_video_video_url (videodetailid,resourceid,vdetailurl,createtime,adminid,beizhu,baseurl) values(?,?,?,?,?,?,?)") .setParameter(0, detail.getId()) .setParameter(1, vu.getResource().getId()).setParameter(2, vu.getUrl()) .setParameter(3, vu.getCreatetime()) .setParameter(4, vu.getAdmin().getId()).setParameter(5, vu.getBeizhu()) .setParameter(6, vu.getBaseUrl()).executeUpdate(); } else {// 原来存在该URL VideoUrl newUrl = info.getVideoDetailList().get(n).getUrls().get(0); if (!newUrl.getUrl().equals(vurl.getUrl())) { vurl.setUrl(newUrl.getUrl()); session.update(vurl); detail.setTag(info.getVideoDetailList().get(n).getTag()); session.update(detail); } } } } } session.flush(); session.getTransaction().commit(); } catch (Exception e) { LogUtil.i("视频名称:" + info.getName()); e.printStackTrace(); session.getTransaction().rollback(); } for (VideoUrl videoUrl : urlList) { if (videoUrl.getResource().getId().equalsIgnoreCase(info.getVideoDetailList() .get(n).getUrls().get(0).getResource().getId())) {// 存在 vurl = videoUrl; } } return null; } }); if (vurl == null) {// 不存在--往里面添加 VideoUrl vu = null; try { vu = info.getVideoDetailList().get(n).getUrls().get(0); } catch (Exception e) { vu = info.getVideoDetailList().get(n).getUrls().get(0); } vu.setVideoDetail(detail); // 更新url session.createSQLQuery( "insert into wk_video_video_url (videodetailid,resourceid,vdetailurl,createtime,adminid,beizhu,baseurl) values(?,?,?,?,?,?,?)") .setParameter(0, detail.getId()) .setParameter(1, vu.getResource().getId()).setParameter(2, vu.getUrl()) .setParameter(3, vu.getCreatetime()) .setParameter(4, vu.getAdmin().getId()).setParameter(5, vu.getBeizhu()) .setParameter(6, vu.getBaseUrl()).executeUpdate(); } else {// 原来存在该URL VideoUrl newUrl = info.getVideoDetailList().get(n).getUrls().get(0); if (!newUrl.getUrl().equals(vurl.getUrl())) { vurl.setUrl(newUrl.getUrl()); session.update(vurl); detail.setTag(info.getVideoDetailList().get(n).getTag()); session.update(detail); } } } } } session.flush(); session.getTransaction().commit(); } catch (Exception e) { LogUtil.i("视频名称:" + info.getName()); e.printStackTrace(); session.getTransaction().rollback(); } } } return null; } }); public void updateVideoInfo(VideoInfo info) { videoInfoDao.update(info); } } } public void updateVideoInfo(List<VideoInfo> list) { for (VideoInfo vi : list) videoInfoDao.update(vi); } public void updateVideoInfo(VideoInfo info) { videoInfoDao.update(info); } @ManyToOne private AdminInfo getAdmin() { AdminInfo info = new AdminInfo(); info.setId("1"); return info; } public void updateVideoInfo(List<VideoInfo> list) { for (VideoInfo vi : list) videoInfoDao.update(vi); } /** * 添加视频详情 * * @param list */ public void addVideoDetail(final VideoInfo info, final List<VideoDetailInfo> list) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); for (int i = 0; i < list.size(); i++) { VideoInfo video = new VideoInfo(info.getId()); list.get(i).setVideo(video); session.persist(list.get(i)); } session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); @ManyToOne private AdminInfo getAdmin() { AdminInfo info = new AdminInfo(); info.setId("1"); return info; } } /** * 添加视频详情 * * @param list */ public void addVideoDetail(final VideoInfo info, final List<VideoDetailInfo> list) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); for (int i = 0; i < list.size(); i++) { VideoInfo video = new VideoInfo(info.getId()); list.get(i).setVideo(video); session.persist(list.get(i)); } session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); /** * 添加视频详情 * * @param list */ public void addVideoDetail(final List<VideoDetailInfo> list) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); for (int i = 0; i < list.size(); i++) { session.persist(list.get(i)); } session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); } } /** * 添加视频详情 * * @param list */ public void addVideoDetail(final List<VideoDetailInfo> list) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); for (int i = 0; i < list.size(); i++) { session.persist(list.get(i)); } session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); public VideoDetailInfo addVideoDetail(final VideoDetailInfo detail) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); session.persist(detail); session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } return null; } }); } List<VideoDetailInfo> list = getVideoDetail(detail.getVideo().getId()); if (list != null && list.size() > 0) return list.get(0); else return null; } public VideoDetailInfo addVideoDetail(final VideoDetailInfo detail) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); session.persist(detail); session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } return null; } }); public List<VideoDetailInfo> getVideoDetail(String videoId) { LogUtil.i("请求开始:" + System.currentTimeMillis()); List<VideoDetailInfo> list = videoDetailInfoDao.list("from VideoDetailInfo d where d.video.id=?", new String[] { videoId }); LogUtil.i("请求结束:" + System.currentTimeMillis()); return list; } List<VideoDetailInfo> list = getVideoDetail(detail.getVideo().getId()); if (list != null && list.size() > 0) return list.get(0); else return null; } public VideoDetailInfo getVideoDetailById(long videoDetailId) { return videoDetailInfoDao.find(VideoDetailInfo.class, videoDetailId); } public List<VideoDetailInfo> getVideoDetail(String videoId) { LogUtil.i("请求开始:" + System.currentTimeMillis()); List<VideoDetailInfo> list = videoDetailInfoDao.list("from VideoDetailInfo d where d.video.id=?", new String[]{videoId}); LogUtil.i("请求结束:" + System.currentTimeMillis()); return list; } public List<VideoDetailInfo> getVideoDetailByVideoName(String name) { LogUtil.i("请求开始:" + System.currentTimeMillis()); public VideoDetailInfo getVideoDetailById(long videoDetailId) { return videoDetailInfoDao.find(VideoDetailInfo.class, videoDetailId); } List<VideoDetailInfo> list = videoDetailInfoDao.list("from VideoDetailInfo d where d.name=?", new String[] { name }); LogUtil.i("请求结束:" + System.currentTimeMillis()); return list; } public List<VideoDetailInfo> getVideoDetailByVideoName(String name) { LogUtil.i("请求开始:" + System.currentTimeMillis()); public List<VideoDetailInfo> getVideoDetail(Session session, String videoId) { @SuppressWarnings("unchecked") List<VideoDetailInfo> list = session.createQuery("from VideoDetailInfo d where d.video.id=?") .setParameter(0, videoId).list(); LogUtil.i("请求结束:" + System.currentTimeMillis()); return list; } List<VideoDetailInfo> list = videoDetailInfoDao.list("from VideoDetailInfo d where d.name=?", new String[]{name}); LogUtil.i("请求结束:" + System.currentTimeMillis()); return list; } /** * 更新视频的详情 * * @param list */ public void updateVideoDetail(final List<VideoDetailInfo> list) { public List<VideoDetailInfo> getVideoDetail(Session session, String videoId) { @SuppressWarnings("unchecked") List<VideoDetailInfo> list = session.createQuery("from VideoDetailInfo d where d.video.id=?") .setParameter(0, videoId).list(); LogUtil.i("请求结束:" + System.currentTimeMillis()); return list; } videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { /** * 更新视频的详情 * * @param list */ public void updateVideoDetail(final List<VideoDetailInfo> list) { // BaseDao<VideoDetailInfo> dao = new // BaseDao<VideoDetailInfo>(); // /BaseDao<VideoUrl> urlDao = new BaseDao<VideoUrl>(); // BaseDao<VideoDetailInfo> dao = new // BaseDao<VideoDetailInfo>(); session.getTransaction().begin(); for (int i = 0; i < list.size(); i++) { for (int j = 0; j < list.get(i).getUrls().size(); j++) { session.createSQLQuery("update wk_video_video_url set vdetailurl=? where id=?") .setParameter(0, list.get(i).getUrls().get(j).getUrl()) .setParameter(1, list.get(i).getUrls().get(j).getId() + "").executeUpdate(); } } session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { } // BaseDao<VideoDetailInfo> dao = new // BaseDao<VideoDetailInfo>(); // /BaseDao<VideoUrl> urlDao = new BaseDao<VideoUrl>(); // BaseDao<VideoDetailInfo> dao = new // BaseDao<VideoDetailInfo>(); session.getTransaction().begin(); for (int i = 0; i < list.size(); i++) { for (int j = 0; j < list.get(i).getUrls().size(); j++) { session.createSQLQuery("update wk_video_video_url set vdetailurl=? where id=?") .setParameter(0, list.get(i).getUrls().get(j).getUrl()) .setParameter(1, list.get(i).getUrls().get(j).getId() + "").executeUpdate(); } } session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); public void updateVideoDetail(final VideoDetailInfo detail) { if (detail.getUrls() == null || detail.getUrls().size() < 1) return; } videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); session.createQuery("delete from VideoUrl vu where vu.videoDetail.id=?") .setParameter(0, detail.getId()).executeUpdate(); for (VideoUrl vu : detail.getUrls()) session.save(vu); session.update(detail); session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); public void updateVideoDetail(final VideoDetailInfo detail) { if (detail.getUrls() == null || detail.getUrls().size() < 1) return; } videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); session.createQuery("delete from VideoUrl vu where vu.videoDetail.id=?") .setParameter(0, detail.getId()).executeUpdate(); for (VideoUrl vu : detail.getUrls()) session.save(vu); session.update(detail); session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); public void deleteVideoDetail(VideoDetailInfo detail) { videoDetailInfoDao.delete(detail); } } /** * 更新视频的详情 * * @param list */ public void updateVideoDetailByAdmin(final List<VideoDetailInfo> list) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); for (int i = 0; i < list.size(); i++) { try { session.persist(list.get(i)); } catch (Exception e) { session.update(list.get(i)); } } session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); LogUtil.i("事物回滚"); session.getTransaction().rollback(); } return null; } }); public void deleteVideoDetail(VideoDetailInfo detail) { videoDetailInfoDao.delete(detail); } } /** * 更新视频的详情 * * @param list */ public void updateVideoDetailByAdmin(final List<VideoDetailInfo> list) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); for (int i = 0; i < list.size(); i++) { try { session.persist(list.get(i)); } catch (Exception e) { session.update(list.get(i)); } } session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); LogUtil.i("事物回滚"); session.getTransaction().rollback(); } return null; } }); @SuppressWarnings("unchecked") public void deleteVideo(final String videoId) { try { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { List<HomeVideo> hlist = session.createQuery("from HomeVideo v where v.video.id=?") .setParameter(0, videoId).list(); session.getTransaction().begin(); JuheVideoUtil.clearData(session, videoId); if (hlist != null && hlist.size() > 0) { for (HomeVideo hv : hlist) { session.delete(hv); } } // 删除收藏 session.createSQLQuery("delete from wk_video_collection where videoid=" + videoId) .executeUpdate(); } List<VideoBanQuanVideo> qlist = session .createQuery("from VideoBanQuanVideo c where c.info.id=?").setParameter(0, videoId) .list(); if (qlist != null && qlist.size() > 0) { for (VideoBanQuanVideo c : qlist) session.delete(c); } List<HomeAd> hdList = session .createQuery("from HomeAd ha where ha.linkType=1 and ha.video.id=?") .setParameter(0, videoId).list(); @Resource private AlbumVideoMapService albumVideoMapService; for (HomeAd had : hdList) { List<SuperHomeAd> shadL = session .createQuery("from SuperHomeAd shad where shad.homeAd.id=?") .setParameter(0, had.getId()).list(); for (SuperHomeAd shad : shadL) session.delete(shad); session.delete(had); } /** * 删除视频 * * @param videoId */ public void deleteVideo(final String videoId) { //清除sql数据表相关依赖 clearService.clearDependVideo(videoId); //清除MongoDB相关依赖 albumVideoMapService.deleteByVideoId(videoId); //更新搜索引擎数据 CMQManager.getInstance().addSolrMsg(videoId); videoInfoDao.delete(new VideoInfo(videoId)); } // 专题视频删除 List<SpecialVideo> svList = session.createQuery("from SpecialVideo ha where ha.video.id=?") .setParameter(0, videoId).list(); // 更新视频的观看数 public void updateVideoWatchCount(final String videoId) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); session.createSQLQuery("update wk_video_video set watchcount=(watchcount+1) where id=" + videoId) .executeUpdate(); session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); for (SpecialVideo sv : svList) { List<SuperSpecial> shadL = session .createQuery("from SuperSpecial shad where shad.special.id=?") .setParameter(0, sv.getSpecial().getId()).list(); for (SuperSpecial shad : shadL) session.delete(shad); session.delete(sv); } } // 合集视频删除 List<VideoIntersectionVideo> viList = session .createQuery("from VideoIntersectionVideo ha where ha.video.id=?") .setParameter(0, videoId).list(); for (VideoIntersectionVideo sv : viList) { session.delete(sv); } @OneToMany private List<VideoDetailInfo> getVideoDetailList() { List<VideoDetailInfo> list = new ArrayList<VideoDetailInfo>(); VideoDetailInfo info = new VideoDetailInfo(); info.setAdmin(getAdmin()); info.setBeizhu("测试信息"); info.setCreatetime(System.currentTimeMillis() + ""); info.setName("功夫"); info.setTag(""); List<VideoUrl> urlList = info.getUrls(); VideoUrl url = new VideoUrl(); url.setAdmin(getAdmin()); url.setBeizhu("测试"); url.setCreatetime(System.currentTimeMillis() + ""); VideoResource resource = new VideoResource(); resource.setId("1"); url.setResource(resource); url.setUrl("http://123333.mp4"); urlList.add(url); info.setUrls(urlList); list.add(info); return list; } // 视频删除 List<VideoDetailInfo> list = session.createQuery("from VideoDetailInfo v where v.video.id=?") .setParameter(0, videoId).list(); // 删除视频的详细信息 for (VideoDetailInfo object : list) { // 删除链接信息 for (VideoUrl vu : object.getUrls()) session.delete(vu); // 删除详情 session.delete(object); } @SuppressWarnings("finally") public boolean changeVideoShow(final VideoInfo info) { return (Boolean) videoInfoDao.excute(new HibernateCallback<Boolean>() { public Boolean doInHibernate(Session session) throws HibernateException { int result = 0; try { session.getTransaction().begin(); result = session.createSQLQuery("update wk_video_video set `show`=? where `id`=?") .setParameter(0, info.getShow()).setParameter(1, info.getId()).executeUpdate(); session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } finally { if (result > 0) return true; else return false; } // 删除视频源信息 session.createSQLQuery("delete from wk_video_video where id=?").setParameter(0, videoId) .executeUpdate(); session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); } catch (Exception e) { e.printStackTrace(); } } }); } } // 更新视频的观看数 public void updateVideoWatchCount(final String videoId) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { try { session.getTransaction().begin(); session.createSQLQuery("update wk_video_video set watchcount=(watchcount+1) where id=" + videoId) .executeUpdate(); session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } return null; } }); /** * 生成视频的名称--唯一 * * @return */ public String getVideoPathName(String type, String oldName) { String src = (long) (Math.random() * 100000000) + StringUtil.Md5(System.currentTimeMillis() + (long) (Math.random() * 100000000) + ""); return StringUtil.getBase64(src) + "_" + StringUtil.getBase64(oldName) + "." + type; } } @ManyToOne private VideoType getVideoType() { VideoType type = new VideoType(); type.setId(1); return type; } @OneToMany private List<VideoDetailInfo> getVideoDetailList() { List<VideoDetailInfo> list = new ArrayList<VideoDetailInfo>(); VideoDetailInfo info = new VideoDetailInfo(); info.setAdmin(getAdmin()); info.setBeizhu("测试信息"); info.setCreatetime(System.currentTimeMillis() + ""); info.setName("功夫"); info.setTag(""); List<VideoUrl> urlList = info.getUrls(); VideoUrl url = new VideoUrl(); url.setAdmin(getAdmin()); url.setBeizhu("测试"); url.setCreatetime(System.currentTimeMillis() + ""); VideoResource resource = new VideoResource(); resource.setId("1"); url.setResource(resource); url.setUrl("http://123333.mp4"); urlList.add(url); info.setUrls(urlList); list.add(info); return list; } // 隐藏视频 public void setVideoHidden(final String urlKey) { @SuppressWarnings("finally") public boolean changeVideoShow(final VideoInfo info) { return (Boolean) videoInfoDao.excute(new HibernateCallback<Boolean>() { public Boolean doInHibernate(Session session) throws HibernateException { int result = 0; try { session.getTransaction().begin(); result = session.createSQLQuery("update wk_video_video set `show`=? where `id`=?") .setParameter(0, info.getShow()).setParameter(1, info.getId()).executeUpdate(); session.flush(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } finally { if (result > 0) return true; else return false; } videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { List<String> listSt = new ArrayList<String>(); try { List list = session .createSQLQuery( "select d.videoid from wk_video_video_url u left join wk_video_video_detail d on d.id=u.videodetailid where vdetailurl like ?") .setParameter(0, "%" + urlKey + "%").list(); for (int i = 0; i < list.size(); i++) { Object obj = (Object) list.get(i); listSt.add(obj.toString()); LogUtil.i(obj.toString()); } LogUtil.i(list.size()); for (int j = 0; j < listSt.size(); j++) { VideoInfo vi = videoInfoDao.find(VideoInfo.class, listSt.get(j)); vi.setShow("0"); videoInfoDao.update(vi); } } }); } catch (Exception e) { e.printStackTrace(); } return null; } }); } /** * 生成视频的名称--唯一 * * @return */ public String getVideoPathName(String type, String oldName) { String src = (long) (Math.random() * 100000000) + StringUtil.Md5(System.currentTimeMillis() + (long) (Math.random() * 100000000) + ""); return StringUtil.getBase64(src) + "_" + StringUtil.getBase64(oldName) + "." + type; } @ManyToOne private VideoType getVideoType() { VideoType type = new VideoType(); type.setId(1); return type; } // 隐藏视频 public void setVideoHidden(final String urlKey) { videoInfoDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { List<String> listSt = new ArrayList<String>(); try { List list = session .createSQLQuery( "select d.videoid from wk_video_video_url u left join wk_video_video_detail d on d.id=u.videodetailid where vdetailurl like ?") .setParameter(0, "%" + urlKey + "%").list(); for (int i = 0; i < list.size(); i++) { Object obj = (Object) list.get(i); listSt.add(obj.toString()); LogUtil.i(obj.toString()); } LogUtil.i(list.size()); for (int j = 0; j < listSt.size(); j++) { VideoInfo vi = videoInfoDao.find(VideoInfo.class, listSt.get(j)); vi.setShow("0"); videoInfoDao.update(vi); } } catch (Exception e) { e.printStackTrace(); } return null; } }); } } } src/main/java/com/yeshi/buwan/service/imp/juhe/AlbumVideoMapServiceImpl.java
@@ -29,4 +29,9 @@ public AlbumVideoMap selectByVideoId(String videoId) { return albumVideoMapDao.selectByVideoId(videoId); } @Override public void deleteByVideoId(String videoId) { albumVideoMapDao.deleteByPrimaryKey(videoId); } } src/main/java/com/yeshi/buwan/service/imp/juhe/FunTV2ServiceImpl.java
@@ -127,6 +127,7 @@ //加入专辑视频映射 AlbumVideoMap map = new AlbumVideoMap(); map.setId(newVideoInfo.getId()); map.setCreateTime(new Date()); map.setVideoId(newVideoInfo.getId()); map.setRootVideoType(newVideoInfo.getVideoType().getId()); src/main/java/com/yeshi/buwan/service/imp/juhe/Iqiyi2ServiceImpl.java
@@ -217,6 +217,7 @@ //加入专辑视频映射 AlbumVideoMap map = new AlbumVideoMap(); map.setId(newVideoInfo.getId()); map.setCreateTime(new Date()); map.setVideoId(newVideoInfo.getId()); map.setRootVideoType(newVideoInfo.getVideoType().getId()); src/main/java/com/yeshi/buwan/service/imp/juhe/PPTVServiceImpl.java
@@ -2,6 +2,7 @@ import com.yeshi.buwan.dao.VideoInfoDao; import com.yeshi.buwan.dao.VideoResourceMapExtraInfoDao; import com.yeshi.buwan.dao.VideoTypeDao; import com.yeshi.buwan.dao.juhe.pptv.PPTVProgramDao; import com.yeshi.buwan.dao.juhe.pptv.PPTVSeriesDao; import com.yeshi.buwan.dao.juhe.pptv.PPTVSeriesProgramMapDao; @@ -9,6 +10,7 @@ import com.yeshi.buwan.dao.video.AlbumVideoMapDao; import com.yeshi.buwan.domain.VideoInfo; import com.yeshi.buwan.domain.VideoResourceMapExtraInfo; import com.yeshi.buwan.domain.VideoType; import com.yeshi.buwan.domain.video.AlbumVideoMap; import com.yeshi.buwan.dto.mq.PPTVMQMsg; import com.yeshi.buwan.pptv.PPTVQuery; @@ -20,6 +22,7 @@ import com.yeshi.buwan.service.imp.CategoryVideoService; import com.yeshi.buwan.service.imp.ResourceVideoService; import com.yeshi.buwan.service.imp.VideoInfoService; import com.yeshi.buwan.service.imp.VideoTypeService; import com.yeshi.buwan.service.inter.juhe.PPTVService; import com.yeshi.buwan.util.mq.CMQManager; import org.springframework.stereotype.Service; @@ -50,6 +53,9 @@ private CategoryVideoService categoryVideoService; @Resource private VideoTypeService videoTypeService; @Resource private VideoResourceMapExtraInfoDao videoResourceMapExtraInfoDao; @@ -60,6 +66,11 @@ return; VideoInfo newVideoInfo = PPTVUtil.convertToVideoInfo(series); if (newVideoInfo == null) return; // if (newVideoInfo.getVideoType() != null) { // newVideoInfo.setVideoType(videoTypeService.getVideoType(newVideoInfo.getVideoType().getId())); // } VideoPPTVMap videoPPTV = videoPPTVMapDao.selectByInfoId(series.getInfoID()); if (videoPPTV != null) {//渠道视频已经存在 VideoInfo videoInfo = videoInfoService.getVideoInfo(videoPPTV.getVideoId() + ""); @@ -100,6 +111,7 @@ //加入专辑视频映射 AlbumVideoMap map = new AlbumVideoMap(); map.setId(newVideoInfo.getId()); map.setCreateTime(new Date()); map.setVideoId(newVideoInfo.getId()); map.setRootVideoType(newVideoInfo.getVideoType().getId()); src/main/java/com/yeshi/buwan/service/imp/vip/VIPPriceServiceImpl.java
@@ -21,7 +21,7 @@ @Override public void addPrice(VIPPrice price) throws VIPException { if (price == null || price.getPrice() == null || price.getType() == null) { if (price == null || price.getActualPrice() == null || price.getType() == null) { throw new VIPException(1, "参数不完整"); } @@ -30,7 +30,7 @@ } if (price.getOrder() == null) { price.setOrder(price.getPrice().multiply(new BigDecimal(100)).intValue()); price.setOrder(price.getActualPrice().multiply(new BigDecimal(100)).intValue()); } src/main/java/com/yeshi/buwan/service/inter/juhe/AlbumVideoMapService.java
@@ -2,6 +2,7 @@ import com.yeshi.buwan.domain.video.AlbumVideoMap; import javax.annotation.Resource; import java.util.List; public interface AlbumVideoMapService { @@ -32,4 +33,8 @@ */ public AlbumVideoMap selectByVideoId(String videoId); @Resource public void deleteByVideoId(String videoId); } src/main/java/com/yeshi/buwan/util/Constant.java
@@ -17,7 +17,7 @@ public static boolean IsOutNet = true;// 是否为外网 public static boolean JobTasker = true; public static boolean JobTasker = false; public static int pageCount = 20; public static int HOT_SEARCH_COUNT = 20; src/main/java/com/yeshi/buwan/util/HttpUtil.java
@@ -104,6 +104,7 @@ public static InputStream getAsInputStream(String url) { HttpClient client = new HttpClient(); client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); GetMethod method = new GetMethod(url); try { client.executeMethod(method); src/main/java/com/yeshi/buwan/util/IPUtil.java
@@ -261,6 +261,17 @@ return ip; } /** * 获取远程端口 * * @param request * @return */ public static int getRemotePort(HttpServletRequest request) { return request.getRemotePort(); } public static String getIPContry(String ip) { IPInfo ipInfo = getIPInfo(ip); return ipInfo == null ? "" : ipInfo.getCountry(); src/main/java/com/yeshi/buwan/util/SpringContext.java
@@ -104,6 +104,8 @@ solrDataManager.saveOrUpdate(videoInfo); } else solrDataManager.deleteById(videoInfo.getId()); } else {//视频已经删除 solrDataManager.deleteById(solrVideo.getId()); } CMQManager.getInstance().deleteSolrMsg(solrVideo.getHandler()); } catch (Exception e) { @@ -190,6 +192,7 @@ } CMQManager.getInstance().deletePPTVSeriesUpdateMsg(pptvmqMsg.getHandler()); } catch (Exception e) { e.printStackTrace(); logger.error("PPTV添加到视频出错:" + e.getMessage()); logger.error("infoId:" + pptvmqMsg.getInfoId()); } src/main/java/com/yeshi/buwan/util/Utils.java
@@ -192,7 +192,7 @@ de.setWatchCount(info.getWatchCount()); de.setYear(info.getYear()); de.setShare(info.getShare()); de.setCanSave(info.getCanSave()); de.setCanSave(info.getCanSave()==null?false:info.getCanSave()); de.setResourceList(info.getResourceList()); de.setPlayPicture(info.getPlayPicture()); de.setShowType(info.getShowType()); src/main/java/com/yeshi/buwan/util/factory/VideoInfoFactory.java
@@ -3,6 +3,7 @@ import com.yeshi.buwan.domain.solr.SolrAlbumVideo; import com.yeshi.buwan.domain.VideoInfo; import com.yeshi.buwan.domain.VideoType; import com.yeshi.buwan.pptv.PPTVUtil; public class VideoInfoFactory { @@ -30,6 +31,11 @@ video.setName(solrVideo.getName()); video.setUpdatetime(solrVideo.getUpdatetime()); video.setVideoType(new VideoType(solrVideo.getRootVideoType())); //PPTV来源需要返回高清标识 if (solrVideo.getResourceIds()!=null&&solrVideo.getResourceIds().contains(PPTVUtil.RESOURCE_ID + "")) video.setDefinition(1); else video.setDefinition(0); return video; } src/main/java/com/yeshi/buwan/vo/vip/UserVIPInfoVO.java
New file @@ -0,0 +1,45 @@ package com.yeshi.buwan.vo.vip; import com.yeshi.buwan.domain.user.LoginUser; import java.util.Date; public class UserVIPInfoVO { private LoginUser user; //到期时间 private Date expireDate; private Date createTime; private Date updateTime; public LoginUser getUser() { return user; } public void setUser(LoginUser user) { this.user = user; } public Date getExpireDate() { return expireDate; } public void setExpireDate(Date expireDate) { this.expireDate = expireDate; } 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; } } src/main/resources/domain/HomeType.hbm.xml
@@ -19,6 +19,7 @@ <property name="iosControl" column="ioscontrol" type="string"></property> <property name="params" type="string"></property> <property name="hasMore" column="hasmore" type="boolean"></property> <property name="needAd" column="need_ad" type="boolean"></property> <property name="number" column="number" type="int"></property> <many-to-one name="admin" column="adminid"></many-to-one> <property name="icon" type="string"></property> src/main/resources/domain/vip/VIPOrderRecord.hbm.xml
@@ -27,6 +27,8 @@ <property name="vipStartTime" column="vip_start_time" type="timestamp"></property> <property name="vipEndTime" column="vip_end_time" type="timestamp"></property> <property name="ipInfo" column="ip_info" type="string"></property> </class> src/main/resources/solr.xml
@@ -2,8 +2,10 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:solr="http://www.springframework.org/schema/data/solr" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/solr http://www.springframework.org/schema/data/solr/spring-solr-2.0.xsd"> xsi:schemaLocation="http://www.springframework.org/schema/data/solr http://www.springframework.org/schema/data/solr/spring-solr-2.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <solr:solr-client id="client" url="${solr.url}"></solr:solr-client> src/main/webapp/admin/new/vip-order-list.html
@@ -1,299 +1,281 @@ <html lang="zh-cn"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>评论管理</title> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/maincontent.css" rel="stylesheet"> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>会员订单</title> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/maincontent.css" rel="stylesheet"> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <style> td { line-height: 105px; } tr { line-height: 105px !important; } </style> <![endif]--> </head> <body> <nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#"> 视 频 后 台 管 理 系 统 </a> </div> <nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#"> 视 频 后 台 管 理 系 统 </a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <!-- <ul class="nav navbar-nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">布丸视频<span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="#">布丸视频</a></li> <li class="divider"></li> <li><a href="#">布丸影视大全</a></li> </ul> </li> </ul>--> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <!-- <ul class="nav navbar-nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">布丸视频<span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="#">布丸视频</a></li> <li class="divider"></li> <li><a href="#">布丸影视大全</a></li> </ul> </li> </ul>--> <ul class="nav navbar-nav navbar-left"> <li><a href="shuju.html">数据</a></li> <li><a href="tuijian-lanmuneirong.html">推荐</a></li> <li><a href="fenqu.html">分区</a></li> <li class="active"><a href="faxian.html">发现</a></li> <li><a href="shezhi.html">设置</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li class="hover"><a href="#">账户</a></li> <li><a href="#">退出登录</a></li> </ul> </div> <!-- /.navbar-collapse --> </div> <!-- /.container-fluid --> </nav> <div id="mainbody"> <div id="sidebar"> <dl> <!-- <dt> <div class="tubiao"><span class="glyphicon glyphicon-pencil"></span></div> 数据</dt>--> </dl> </div> <div id="neirong"> <div class="erjidh"> <table class="table"> <tbody> <tr> <td> <form class="form-inline" role="form"> <div class="form-group" role="search"> <input type="text" class="form-control" style="width: 200px;" placeholder="用户昵称/评论关键字"> </div> <button type="button" class="btn btn-default search">搜索</button> </form> </td> <td> <div class="tianjia"></div> </td> </tr> </tbody> </table> </div> <div class="zhuti"> <div class="zhutisousuo"> <table class="table"> <thead> <tr> <th width="7%">选择</th> <th width="7%">编号</th> <th width="15%">用户ID</th> <th width="30%">内容</th> <th width="10%">视频ID</th> <th width="15%">创建时间</th> <th width="7%">删除</th> </tr> </thead> </table> </div> <div class="liebiao"> <table class="table"> <tbody> <tr style="display: none;"> <td width="7%"> <div class="xuanze"> <label> <input type="checkbox" value="#"> </label> </div> </td> <td width="7%"> <div class="bianhao">623</div> </td> <td width="15%" style="text-align: center; line-height: 105px;"> <div class="uid">123123</div> </td> <td width="31%"> <div class="content">内容</div> </td> <ul class="nav navbar-nav navbar-left"> <li><a href="shuju.html">数据</a></li> <li><a href="tuijian-lanmuneirong.html">推荐</a></li> <li><a href="fenqu.html">分区</a></li> <li class="active"><a href="faxian.html">发现</a></li> <li><a href="shezhi.html">设置</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li class="hover"><a href="#">账户</a></li> <li><a href="#">退出登录</a></li> </ul> </div> <!-- /.navbar-collapse --> </div> <!-- /.container-fluid --> </nav> <div id="mainbody"> <div id="sidebar"> <dl> <!-- <dt> <div class="tubiao"><span class="glyphicon glyphicon-pencil"></span></div> 数据</dt>--> </dl> </div> <div id="neirong"> <div class="erjidh"> <table class="table"> <tbody> <tr> <td> <form class="form-inline" role="form"> <div class="form-group" role="search"> <select class="form-control vip-type"> <option value="0">全部</option> <option value="1" selected>已支付</option> <option value="2">未支付</option> </select> <td width="11%"> <div class=videoId>视频ID</div> </td> <td width="15%" style="text-align: center; line-height: 105px;" class="createtime">2016-09-27 12:20</td> <td width="7%"> <div class="anniu" name="del"> <img src="image/dustbin.png" data-toggle="modal" data-target="#myModal"> </div> </td> </tr> </tbody> </table> </div> </div> <div class="bottom"> <div class="qx"> <div class="checkbox"> <label> <input type="checkbox" class="checkAll"> 全选 </label> </div> </div> <button class="btn btn-warning delAll" type="button">批量删除</button> <div class="page"> <ul class="pagination"> <li class="disabled pre"><a href="#">«</a></li> <li><a href="#" class="next">»</a></li> </ul> <div class="form-group"> <div class="tzan"> <button type="button" class="btn btn-primary">跳转</button> </div> <div class="tz"> <input class="form-control" type="text" id="customPage" placeholder="页数"> </div> </div> </div> </div> </div> </div> <script src="js/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/page.js"></script> <script src="js/nav.js"></script> <script src="js/common.js"></script> <script src="layer/layer.js"></script> <input type="text" class="form-control" style="width: 200px;" placeholder="用户ID"> <script> var trHTML; var appHTML; $(function(){ var $tbody = $(".liebiao > .table > tbody"); trHTML = $tbody.html(); appHTML = $tbody.find(".appnametd").html(); getData(1); $(".checkAll").bind("click",function(){ if(this.checked) { $(".xuanze > label >input ").prop('checked', true) } else { $(".xuanze > label >input ").prop('checked', false) } }); $(".search").bind("click",function(){ getData(1); }); $(".delAll").bind("click", function() { var arr=""; var selectAll = $(".xuanze label input").each(function(){ var cur = $(this); var ck= cur.context.checked; if (ck) { var val = cur.attr("key"); arr += val + ","; } }); if(arr==""){ layer.msg("请先选择数据!"); return; } layer.confirm('是否批量删除?', { btn: ['否','是'] }, function(index){ layer.close(index); return false; }, function(){ delComment(arr); }); }); }); </script> <script> function delComment(ids){ $.post("api/comment/delComment", { "ids":ids}, function(data) { if(data == "yes") { layer.msg("删除成功!"); getData(1); }else{ layer.msg("删除失败!"); } }, 'text'); } function getData(pageIndex) { var index= layer.load(1, { shade: false }); var key = $(".form-inline > .form-group >input").val(); var detailsystemId= $("select[name='select']").find("option:checked").attr("key"); $.post("api/comment/commentList", { "pageIndex": pageIndex , "key":key }, function(data) { layer.close(index); if(data.code == 0) { setData(data,pageIndex); fillPage(data.pageEntity, function(page) { getData(page); }); } }, 'json'); } function setData(data,pageIndex){ pageIndex = pageIndex - 1; var $tbody = $(".liebiao > .table > tbody"); $(".liebiao tbody").empty(); var pageSize = data.pageEntity.pageSize; var totalCount = data.pageEntity.totalCount; var len = (pageSize < totalCount - (pageIndex * pageSize)) ? pageSize : totalCount - (pageIndex * pageSize); len = (pageIndex * pageSize) + len; var ii = pageIndex * pageSize; for(var mm = 0; ii < len && ii < totalCount; ii++,mm++) { var id = data.commentList[mm].id; var name = data.commentList[mm].user.Nickname+"("+data.commentList[mm].user.id+")"; var content = data.commentList[mm].content; var videoName= data.commentList[mm].video.name+"("+data.commentList[mm].video.id+")";; var createtime = data.commentList[mm].createtime; $tbody.append(trHTML); $tbody.find("tr").eq(mm).css("display","table-row"); var $curCheck = $tbody.find(".xuanze label input").eq(mm); $curCheck.attr("key",id); var $curCode = $tbody.find(".bianhao").eq(mm); $curCode.text(id); $tbody.find(".uid").eq(mm).text(name); $tbody.find(".content").eq(mm).text(content); $tbody.find(".videoId").eq(mm).text(videoName); var mydate = new Date(parseInt(createtime)).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " "); $tbody.find(".createtime").eq(mm).text(mydate); $tbody.find("tr").eq(mm).find(".anniu").attr("key",id); } $("div[name='del']").bind("click",function(){ var $obj=$(this); layer.confirm('您确定要删除?', { btn: ['否','是'] //按钮 }, function(index){ layer.close(index); return false; }, function(){ var id = $obj.attr("key"); delComment(id); }); }); } </script> </div> <button type="button" class="btn btn-default search" v-on:click="search">搜索</button> </form> </td> <td> <div class="tianjia"></div> </td> </tr> </tbody> </table> </div> <div class="bottom"> <div class="page"> <ul class="pagination"> <li class="disabled pre"><a href="#">«</a></li> <li><a href="#" class="next">1</a></li> <li><a href="#" class="next">»</a></li> </ul> <div class="form-group"> <div class="tzan"> <button type="button" class="btn btn-primary">跳转</button> </div> <div class="tz"> <input class="form-control" type="text" id="customPage" placeholder="页数"> </div> </div> </div> </div> <div class="zhuti"> <div class="zhutisousuo"> <table class="table"> <thead> <tr> <th width="5%">订单ID</th> <th width="5%">用户ID</th> <th width="5%">订单金额</th> <th width="5%">订单状态</th> <th width="8%">付款金额</th> <th width="8%">付款方式</th> <th width="10%">付款时间</th> <th width="10%">会员开始时间</th> <th width="10%">会员结束时间</th> <th width="10%">订单创建时间</th> <th width="10%">订单修改时间</th> </tr> </thead> </table> </div> <div class="liebiao"> <table class="table"> <tbody> <tr v-for="(item,index) in list" style="text-align: center; height: 105px;line-height: 105px;" v-bind:style="{'background':index%2==0?'#EEEEEE':'#FFFFFF'}"> <td width="5%"> <div class="uid">{{item.id}}</div> </td> <td width="5%"> <div>{{item.uid}}</div> </td> <td width="5%"> <div>¥{{item.money}}</div> </td> <td width="5%"> <div v-bind:style="{'color': item.state==1?'green':'red' }">{{item.state==1?'已支付':'未支付'}} </div> </td> <td width="8%"> <div v-if="item.payMoney>0">¥{{item.payMoney}}</div> </td> <td width="10%"> <div v-if="item.payWay>0">{{item.payWay==1?'支付宝':'微信'}}</div> </td> <td width="10%"> <div>{{item.payTime}}</div> </td> <td width="10%"> <div>{{item.vipStartTime}}</div> </td> <td width="10%"> <div>{{item.vipEndTime}}</div> </td> <td width="10%"> <div>{{item.createTime}}</div> </td> <td width="10%"> <div>{{item.updateTime}}</div> </td> </tr> </tbody> </table> </div> </div> <div class="bottom"> <div class="page"> <ul class="pagination"> <li class="disabled pre"><a href="#">«</a></li> <li><a href="#" class="next">1</a></li> <li><a href="#" class="next">»</a></li> </ul> <div class="form-group"> <div class="tzan"> <button type="button" class="btn btn-primary">跳转</button> </div> <div class="tz"> <input class="form-control" type="text" id="customPage" placeholder="页数"> </div> </div> </div> </div> </div> </div> <script src="js/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/page.js"></script> <script src="js/nav.js"></script> <script src="js/common.js"></script> <script src="js/vue.min.js"></script> <script src="layer/layer.js"></script> <script> $(function () { var app = new Vue({ el: "#neirong", data: { list: [], count: 0, pageEntity: { pageIndex: 0, totalCount: 0, pageSize: 20, }, }, methods: { search: function () { app.pageEntity.pageIndex = 0; app.requestData(app.pageEntity.pageIndex + 1); }, requestData(page) { var pay = $(".vip-type").val(); if (pay == 0) { pay = null; } else if (pay == 1) { pay = true; } else { pay = false; } var uid = $("input[type=text]").val(); if (uid == '') uid = null; $.post("api/vip/vipOrderList", {"page": page, "pay": pay, "uid": uid}, function (data) { if (data.code == 0) { fillPage(data.data.pageEntity, function (pageIndex) { app.requestData(pageIndex); }); app.list = data.data.list; app.pageEntity = data.data.pageEntity; } }, 'json'); }, } }); app.requestData(1); }); </script> <script> </script> </body> </html> src/main/webapp/admin/new/vip-user-list.html
@@ -10,6 +10,16 @@ <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <style> td{ line-height: 105px; } tr{ line-height: 105px !important; } </style> <![endif]--> </head> @@ -72,7 +82,7 @@ <td> <form class="form-inline" role="form"> <div class="form-group" role="search"> <select class="form-control"> <select class="form-control vip-type"> <option value="0">全部</option> <option value="1" selected>会员</option> <option value="2">会员过期</option> @@ -92,12 +102,34 @@ </tbody> </table> </div> <div class="bottom"> <div class="page"> <ul class="pagination"> <li class="disabled pre"><a href="#">«</a></li> <li><a href="#" class="next">1</a></li> <li><a href="#" class="next">»</a></li> </ul> <div class="form-group"> <div class="tzan"> <button type="button" class="btn btn-primary">跳转</button> </div> <div class="tz"> <input class="form-control" type="text" id="customPage" placeholder="页数"> </div> </div> </div> </div> <div class="zhuti"> <div class="zhutisousuo"> <table class="table"> <thead> <tr> <th width="15%">用户ID</th> <th width="10%">用户ID</th> <th width="10%">昵称</th> <th width="10%">头像</th> <th width="30%">会员到期时间</th> <th width="10%">创建时间</th> <th width="15%">更新时间</th> @@ -108,18 +140,25 @@ <div class="liebiao"> <table class="table"> <tbody> <tr style="display: none;" v-for="item in list"> <td width="15%" style="text-align: center; line-height: 105px;"> <div class="uid">{{item.id}}</div> <tr v-for="(item,index) in list" v-bind:style="{'background':index%2==0?'#EEEEEE':'#FFFFFF'}" style="text-align: center; height: 105px;line-height: 105px;"> <td width="10%"> <div class="uid">{{item.user.id}}</div> </td> <td width="31%"> <div class="vipExpireDate">{{item.vipExpireDate}}</div> <td width="10%"> <div>{{item.user.Nickname}}</div> </td> <td width="10%"> <div><img v-bind:src="item.user.portrait" style="width:60px;height: 60px;border-radius: 60px;"/></div> </td> <td width="30%"> <div class="vipExpireDate">{{item.expireDate}}</div> </td> <td width="11%"> <td width="10%"> <div class="createTime">{{item.createTime}}</div> </td> <td width="11%"> <td width="15%"> <div class="updateTime">{{item.updateTime}}</div> </td> @@ -132,6 +171,7 @@ <div class="page"> <ul class="pagination"> <li class="disabled pre"><a href="#">«</a></li> <li><a href="#" class="next">1</a></li> <li><a href="#" class="next">»</a></li> </ul> <div class="form-group"> @@ -171,11 +211,11 @@ }, methods: { search: function () { app.pageEntity.pageIndex = 0; app.requestData(app.pageEntity.pageIndex + 1); }, requestData(page) { var vip = $("select").val(); var vip = $(".vip-type").val(); if (vip == 0) { vip = null; } else if (vip == 1) { @@ -188,13 +228,14 @@ uid = null; $.post("api/vip/vipUserList", {"page": page, "vip": vip, "uid": uid}, function (data) { layer.close(index); if (data.code == 0) { if (page == 1) app.list = data.data.list; else { app.list = app.list.concat(data.data.list); } fillPage(data.data.pageEntity, function (pageIndex) { app.requestData(pageIndex); }); app.list = data.data.list; app.pageEntity = data.data.pageEntity; } }, 'json'); @@ -202,6 +243,8 @@ } }); app.requestData(1); }); </script> <script> src/test/java/com/hxh/spring/test/Iqiyi2.java
@@ -118,7 +118,7 @@ // iqiyi2Service.addToVideoInfo(album2); // } Long qikuID = 8354256491713801L; Long qikuID = 6376917677133701L; IqiyiAlbum2 album2 = iqiyi2Service.selectAlbumById(qikuID); if (album2 != null) { @@ -145,7 +145,7 @@ @Test public void test6() { try { iqiyi2VideoUpdate.updateVideoByPlayerUrl("https://www.iqiyi.com/v_wy9ak8ezio.html?vfrm=pcw_dianshiju&vfrmblk=B&vfrmrst=fcs_2_p3"); iqiyi2VideoUpdate.updateVideoByPlayerUrl("https://www.iqiyi.com/v_1nwrspklijs.html?vfrm=pcw_dianshiju&vfrmblk=B&vfrmrst=fcs_2_p1"); } catch (Exception e) { e.printStackTrace(); } src/test/java/com/hxh/spring/test/SolrTest.java
@@ -1,18 +1,25 @@ package com.hxh.spring.test; import com.yeshi.buwan.dao.HomeNoticeDao; import com.yeshi.buwan.dao.video.AlbumVideoMapDao; import com.yeshi.buwan.domain.video.AlbumVideoMap; import com.yeshi.buwan.dto.search.SolrResultDTO; import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; import com.yeshi.buwan.service.imp.VideoInfoService; import com.yeshi.buwan.service.inter.juhe.AlbumVideoMapService; import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager; import com.yeshi.buwan.service.manager.SolrCommonVideoDataManager; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import javax.annotation.Resource; import java.util.Date; import java.util.List; @RunWith(SpringJUnit4ClassRunner.class) @@ -31,6 +38,8 @@ @Resource private HomeNoticeDao homeNoticeDao; @Resource private AlbumVideoMapService albumVideoMapService; @Test public void test1() { @@ -57,4 +66,36 @@ } @Resource private AlbumVideoMapDao albumVideoMapDao; @Test public void test2() { for(int i=0;i<100;i++) { Query query = new Query(); query.addCriteria(Criteria.where("id").type(7)); query.limit(100); List<AlbumVideoMap> list = albumVideoMapDao.findList(query); for (AlbumVideoMap map : list) { AlbumVideoMap newMap = new AlbumVideoMap(); newMap.setVideoCount(map.getVideoCount()); newMap.setRootVideoType(map.getRootVideoType()); newMap.setVideoId(map.getVideoId()); newMap.setCreateTime(new Date()); newMap.setId(map.getVideoId()); albumVideoMapDao.save(newMap); albumVideoMapDao.deleteByPrimaryKey(map.getId()); } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } } src/test/java/com/hxh/spring/test/VideoTest.java
@@ -16,13 +16,22 @@ import org.hibernate.HibernateException; import org.hibernate.Session; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.yeshi.utils.HttpUtil; import javax.annotation.Resource; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:spring.xml"}) @WebAppConfiguration public class VideoTest { public static void main(String[] args) { @@ -32,7 +41,6 @@ videoService.addNOAddToCategoryVideo(); } } @SuppressWarnings("unchecked") @@ -90,7 +98,7 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage("com.doudou.ysvideo"); PlayUrl pu = videoDeailUtil.getPlayUrl(null,detailSystem.getId(), 3357160 + "", "acFunVideo", PlayUrl pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), 3357160 + "", "acFunVideo", Integer.parseInt(21 + ""), 3357160 + ""); } @@ -146,4 +154,15 @@ System.out.println(isMatch); } @Resource private VideoManager videoManager; @Test public void deleteVideo() { videoManager.deleteVideo("8234976"); videoManager.deleteVideo("8254725"); videoManager.deleteVideo("8254726"); } } src/test/java/com/hxh/spring/test/vip/VIPTest.java
@@ -53,6 +53,8 @@ @Test public void addVIPPrice() { VIPPrice price = new VIPPrice(); // price.setActualPrice(new BigDecimal("8.8")); price.setActualPrice(new BigDecimal("14.8")); price.setPrice(new BigDecimal("14.8")); price.setType(VIPPriceType.month); price.setPptvGoodsNo("DA7559531560894"); @@ -64,6 +66,8 @@ } price = new VIPPrice(); // price.setActualPrice(new BigDecimal("22.8")); price.setActualPrice(new BigDecimal("37.8")); price.setPrice(new BigDecimal("37.8")); price.setType(VIPPriceType.season); price.setPptvGoodsNo("DA7559574625089"); @@ -76,6 +80,8 @@ price = new VIPPrice(); // price.setActualPrice(new BigDecimal("42")); price.setActualPrice(new BigDecimal("68.8")); price.setPrice(new BigDecimal("68.8")); price.setType(VIPPriceType.halfYear); price.setPptvGoodsNo("DA6989580247516"); @@ -88,6 +94,8 @@ price = new VIPPrice(); // price.setActualPrice(new BigDecimal("77.8")); price.setActualPrice(new BigDecimal("128.8")); price.setPrice(new BigDecimal("128.8")); price.setType(VIPPriceType.year); price.setPptvGoodsNo("DA8129574268091"); @@ -111,7 +119,7 @@ public void addOrderRecord() { VIPPrice price = vipPriceService.selectByPrimaryKey("172a8327fcd3685ab3c0f740d031da09"); VIPOrderRecord record = new VIPOrderRecord(); record.setMoney(price.getPrice()); record.setMoney(price.getActualPrice()); record.setType(price.getType()); record.setUid(766693 + "");