From f06a592dd1a7e995bf313ccb5efe7dff73ccfc4e Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 12 四月 2023 18:25:52 +0800
Subject: [PATCH] 增加本地获取IP归属地/广告优化

---
 src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java |  115 ---------------------------------------------------------
 1 files changed, 1 insertions(+), 114 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java b/src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java
index e548bf1..7d9bae7 100644
--- a/src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java
+++ b/src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java
@@ -289,11 +289,6 @@
         homeTypeDao.update(type);
     }
 
-    public void updateHomeVideo(HomeVideo type) {
-
-        homeVideoDao.update(type);
-    }
-
     public List<DetailSystemSelect> getDetailSystemSelectByType(String homeType) {
         List<DetailSystemSelect> li = new ArrayList<>();
         List<DetailSystem> list = detailSystemDao
@@ -315,114 +310,6 @@
         return li;
     }
 
-    public void addHomeTypeVideo(HomeVideo video) {
-
-        long count = homeVideoDao.getCount("select count(*) from HomeVideo h where h.type.id=? and h.video.id=?",
-                new String[]{video.getType().getId(), video.getVideo().getId()});
-        if (count <= 0L)
-            homeVideoDao.create(video);
-    }
-
-    public void addHomeTypeVideo(List<HomeVideo> list) {
-        HomeVideo info;
-        for (Iterator<HomeVideo> iterator = list.iterator(); iterator.hasNext(); addHomeTypeVideo(info))
-            info = (HomeVideo) iterator.next();
-    }
-
-    public void deleteHomeVideo(HomeVideo video) {
-
-        homeVideoDao.delete(video);
-    }
-
-    public void deleteHomeTypeVideo(List<HomeVideo> list) {
-        HomeVideo video;
-        for (Iterator<HomeVideo> iterator = list.iterator(); iterator.hasNext(); deleteHomeVideo(video))
-            video = (HomeVideo) iterator.next();
-    }
-
-    public long getHomeVideoCount(String homeId) {
-
-        return homeVideoDao.getCount("from HomeVideo h where h.type.id=?", new String[]{homeId});
-    }
-
-    public long getHomeTypeVideoPage(String homeId) {
-        long count = getHomeVideoCount(homeId);
-        return count % (long) Constant.pageCount != 0L ? count / (long) Constant.pageCount + 1L
-                : count / (long) Constant.pageCount;
-    }
-
-    public List<HomeVideo> getHomeVideoList(String homeId, int page) {
-
-        return homeVideoDao.list(
-                "from HomeVideo h where h.type.id=? order by h.video.orderby desc,h.createtime desc",
-                (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{homeId});
-    }
-
-    public List<HomeVideo> getHomeVideoList(String homeId, String key, int page) {
-        return homeVideoDao.list(
-                "from HomeVideo h where h.type.id=? and h.video.name like ? order by h.bigPicture desc, h.video.orderby desc,h.video.watchCount desc,h.createtime desc",
-                (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{homeId, "%" + key + "%"});
-    }
-
-
-    @Cacheable(value = "homeCache", key = "'getHomeVideoList-'+#homeId+'-'+#resourceKey+'-'+#hasBigPicture+'-'+#page+'-'+#pageSize")
-    public List<HomeVideo> getHomeVideoList(String homeId, String resourceKey, List<Long> resourceIds, Boolean hasBigPicture, int page, int pageSize) {
-        List<HomeVideo> homeVideos = (List<HomeVideo>) homeVideoDao.excute(new HibernateCallback<List<HomeVideo>>() {
-            @Override
-            public List<HomeVideo> doInHibernate(Session session) throws HibernateException {
-
-                List<String> rids = new ArrayList<>();
-                for (Long rid : resourceIds) {
-                    rids.add("rv.`resourceid`=" + rid);
-                }
-
-                String sql = String.format("SELECT hv.* FROM wk_video_homevideo hv LEFT JOIN wk_resource_video rv ON rv.`videoid`=hv.`videoid` LEFT JOIN wk_video_video v ON v.`id`=hv.`videoid` WHERE v.show=1 and hv.`hometype`=%s AND (%s) ", homeId, org.yeshi.utils.StringUtil.concat(rids, " or "));
-
-//                if (bigPicture != null) {
-//                    sql += " and hv.big_picture=" + (bigPicture ? 1 : 0);
-//                }
-                sql += " GROUP BY hv.id ORDER BY hv.big_picture desc,hv.`orderby` DESC,hv.`createtime` DESC";
-
-                return session.createSQLQuery(sql).addEntity(HomeVideo.class).setFirstResult((page - 1) * pageSize + (hasBigPicture!=null&&hasBigPicture ? 1 : 0)).setMaxResults(pageSize).list();
-            }
-        });
-
-        List<VideoInfo> videoInfoList = new ArrayList<>();
-        for (HomeVideo hv : homeVideos) {
-            if (hv.getVideo() != null)
-                videoInfoList.add(hv.getVideo());
-        }
-        videoInfoExtraService.batchExtra(videoInfoList, resourceIds);
-        return homeVideos;
-    }
-
-    @Cacheable(value = "homeCache", key = "'getHomeVideoListCount-'+#homeId+'-'+#resourceKey+'-'+#bigPicture")
-    public long getHomeVideoListCount(String homeId, String resourceKey, List<Long> resourceIds, Boolean bigPicture) {
-        return (Long) homeVideoDao.excute(new HibernateCallback<Long>() {
-            @Override
-            public Long doInHibernate(Session session) throws HibernateException {
-
-                List<String> rids = new ArrayList<>();
-                for (Long rid : resourceIds) {
-                    rids.add("rv.`resourceid`=" + rid);
-                }
-
-                String sql = String.format("SELECT  count(distinct(hv.id)) FROM wk_video_homevideo hv LEFT JOIN wk_resource_video rv ON rv.`videoid`=hv.`videoid`  LEFT JOIN wk_video_video v ON v.`id`=hv.`videoid`  WHERE v.show=1 and hv.`hometype`=%s AND (%s)", homeId, org.yeshi.utils.StringUtil.concat(rids, " or "));
-
-                if (bigPicture != null) {
-                    sql += " and hv.big_picture=" + (bigPicture ? 1 : 0);
-
-                }
-
-                return Long.parseLong(session.createSQLQuery(sql).uniqueResult() + "");
-            }
-        });
-    }
-
-    public long getHomeVideoListCount(String homeId, String key) {
-        return homeVideoDao.getCount("select count(*)  from HomeVideo h where h.type.id=? and h.video.name like ? ",
-                new String[]{homeId, "%" + key + "%"});
-    }
 
     public Serializable addHomeType(HomeType type) {
         return homeTypeDao.save(type);
@@ -619,7 +506,7 @@
                 andList.add("c.special_data_key='" + dataKey + "'");
             }
 
-            sql = "select count(*) from  (select count(*) from wk_video_super_hometype zb left join wk_video_hometype c on c.id=zb.hometypeid where  " + org.yeshi.utils.StringUtil.concat(andList, " and ") + " group by zb.hometypeid) s";
+            sql = "select count(*) from  (select count(*) from wk_video_hometype c left join   wk_video_super_hometype zb on c.id=zb.hometypeid where  " + org.yeshi.utils.StringUtil.concat(andList, " and ") + " group by c.id) s";
         }
         return homeTypeDao.getCountSQL(sql);
     }

--
Gitblit v1.8.0