From ad3ac53da1c3a11a96ae62d790aa61a81b9eab91 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 20 三月 2021 18:47:23 +0800 Subject: [PATCH] 完善APP首页顶部标签栏兼容,初步处理推送 --- src/main/java/com/yeshi/buwan/service/imp/ClassService.java | 37 +++++++++++++++++++------------------ 1 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/service/imp/ClassService.java b/src/main/java/com/yeshi/buwan/service/imp/ClassService.java index 4c94e05..740d12e 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/ClassService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/ClassService.java @@ -6,7 +6,7 @@ import javax.annotation.Resource; -import com.yeshi.buwan.service.inter.VideoResourceMapExtraInfoService; +import com.yeshi.buwan.service.inter.video.VideoInfoExtraService; import org.hibernate.CacheMode; import org.hibernate.HibernateException; import org.hibernate.Session; @@ -18,7 +18,7 @@ import com.yeshi.buwan.dao.VideoInfoDao; import com.yeshi.buwan.dao.VideoTypeDao; import com.yeshi.buwan.domain.CategoryVideo; -import com.yeshi.buwan.domain.DetailSystem; +import com.yeshi.buwan.domain.system.DetailSystem; import com.yeshi.buwan.domain.SuperHotType; import com.yeshi.buwan.domain.SuperVideoType; import com.yeshi.buwan.domain.VideoInfo; @@ -36,8 +36,9 @@ private VideoInfoDao videoInfoDao; @Resource private SuperVideoTypeDao superVideoTypeDao; + @Resource - private VideoResourceMapExtraInfoService videoResourceMapExtraInfoService; + private VideoInfoExtraService videoInfoExtraService; public List<VideoType> getTypeList() { List<VideoType> list = videoTypeDao.list("from VideoType v where v.show='1' and v.parent=null"); @@ -234,10 +235,10 @@ if (StringUtil.isNullOrEmpty(type)) { return getVideoInfoData(videoInfoDao.sqlList( "select v.id,v.`name`,v.`tag`,v.`picture`,v.`hpicture`,v.`latest_hpicture`,v.watchcount,v.commentcount from wk_video_video v INNER JOIN (SELECT DISTINCT(v.id) FROM wk_category_video ca LEFT JOIN wk_video_video v ON v.id= ca.videoid LEFT JOIN wk_resource_video rv ON rv.`videoid`= v.`id` AND( ? ) WHERE v.show= 1 and ca.id is not null AND rv.`resourceid` IS NOT NULL ? ) a using(id)", - (page - 1) * pageCount, pageCount, new Serializable[]{resourceWhere, orderby,}),resourceList); + (page - 1) * pageCount, pageCount, new Serializable[]{resourceWhere, orderby,}), resourceList); } - List<VideoInfo> list = new ArrayList<VideoInfo>(); + List<VideoInfo> list = new ArrayList<>(); long startTime = System.currentTimeMillis(); @@ -246,7 +247,7 @@ final String orderbyNew = orderby; list = (List<VideoInfo>) videoTypeDao.excute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { - List<VideoInfo> list = new ArrayList<VideoInfo>(); + List<VideoInfo> list = new ArrayList<>(); try { session.setCacheMode(CacheMode.GET); String sql = String.format( @@ -264,11 +265,11 @@ }); System.out.println("鏌ヨSQL璐规椂:" + (System.currentTimeMillis() - startTime)); - return getVideoInfoData(list,resourceList); + return getVideoInfoData(list, resourceList); } public List<VideoInfo> getVideoInfoData(List list, List<Long> resourceIdList) { - List<VideoInfo> dataList = new ArrayList<VideoInfo>(); + List<VideoInfo> dataList = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { Object[] obj = (Object[]) list.get(i); VideoInfo info = new VideoInfo(); @@ -279,10 +280,10 @@ info.setHpicture(obj[4] + ""); info.setLatestHpicture(obj[5] + ""); info.setWatchCount(obj[6] + ""); - info.setCommentCount(Integer.parseInt(obj[7] + "")); + info.setCommentCount(obj[7]!=null? Integer.parseInt(obj[7] + ""):0); if (obj.length > 8) { String[] resourceIds = (obj[8] + "").split(","); - List<VideoResource> resourceList = new ArrayList<VideoResource>(); + List<VideoResource> resourceList = new ArrayList<>(); for (String rid : resourceIds) resourceList.add(new VideoResource(rid)); info.setResourceList(resourceList); @@ -293,7 +294,7 @@ dataList.add(info); } - dataList = videoResourceMapExtraInfoService.batchExtraInfo(dataList, resourceIdList); + dataList = videoInfoExtraService.batchExtra(dataList, resourceIdList); return dataList; } @@ -355,14 +356,14 @@ if (wheres.startsWith("or")) wheres = wheres.substring(2, wheres.length()); - List<VideoInfo> list = new ArrayList<VideoInfo>(); + List<VideoInfo> list = new ArrayList<>(); final String wheresNew = wheres; final String yearWhereNew = yearWhere; final String orderbyNew = orderby; list = (List<VideoInfo>) videoTypeDao.excute(new HibernateCallback<List<VideoInfo>>() { public List<VideoInfo> doInHibernate(Session session) throws HibernateException { - List<VideoInfo> list = new ArrayList<VideoInfo>(); + List<VideoInfo> list = new ArrayList<>(); try { list = session .createSQLQuery( @@ -381,7 +382,7 @@ } private List<VideoInfo> parseVideoListAmin(List list) { - List<VideoInfo> resultList = new ArrayList<VideoInfo>(); + List<VideoInfo> resultList = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { Object[] objs = (Object[]) list.get(i); VideoInfo video = new VideoInfo(); @@ -579,15 +580,15 @@ */ @SuppressWarnings("unchecked") - public List<com.yeshi.buwan.domain.web.VideoTypeAdmin> getVideoTypeAdmin(final int detailSystem, final int pid, + public List<com.yeshi.buwan.domain.web.VideoTypeAdmin> getVideoTypeAdmin(final String systemId, final int detailSystem, final int pid, final int page) { return (List<com.yeshi.buwan.domain.web.VideoTypeAdmin>) videoTypeDao .excute(new HibernateCallback<List<com.yeshi.buwan.domain.web.VideoTypeAdmin>>() { public List<com.yeshi.buwan.domain.web.VideoTypeAdmin> doInHibernate(Session session) throws HibernateException { - List<com.yeshi.buwan.domain.web.VideoTypeAdmin> hotTypeList = new ArrayList<com.yeshi.buwan.domain.web.VideoTypeAdmin>(); + List<com.yeshi.buwan.domain.web.VideoTypeAdmin> hotTypeList = new ArrayList<>(); try { - List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem").list(); + List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem ds where ds.system.id=" + systemId).list(); String where = ""; List<VideoType> list = null; @@ -627,7 +628,7 @@ .createQuery("select vb.detailSystem from SuperVideoType vb where vb.type.id=?") .setParameter(0, vb.getId()).list(); - List<DetailSystemSelect> dssList = new ArrayList<DetailSystemSelect>(); + List<DetailSystemSelect> dssList = new ArrayList<>(); for (DetailSystem ds : detailSystemList) { DetailSystemSelect dss = new DetailSystemSelect(); -- Gitblit v1.8.0