From 0a18a8cb0a7a57bf1f82df425251334c57f8c39a Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 23 一月 2021 15:40:37 +0800 Subject: [PATCH] 新增手机号/qq/微信绑定 --- src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java | 54 +++++++++++++++++++++++++++++++++--------------------- 1 files changed, 33 insertions(+), 21 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 c6ecec0..0e6d786 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/HomeTypeService.java @@ -1,30 +1,19 @@ package com.yeshi.buwan.service.imp; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; +import java.util.*; import javax.annotation.Resource; +import com.yeshi.buwan.dao.*; +import com.yeshi.buwan.domain.*; +import com.yeshi.buwan.service.inter.VideoResourceMapExtraInfoService; import org.hibernate.HibernateException; import org.hibernate.Session; import org.springframework.cache.annotation.Cacheable; import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; -import com.yeshi.buwan.dao.DetailSystemDao; -import com.yeshi.buwan.dao.HomeTypeDao; -import com.yeshi.buwan.dao.HomeVideoDao; -import com.yeshi.buwan.dao.SuperHomeTypeDao; -import com.yeshi.buwan.dao.VideoInfoDao; -import com.yeshi.buwan.domain.DetailSystem; -import com.yeshi.buwan.domain.HomeType; -import com.yeshi.buwan.domain.HomeVideo; -import com.yeshi.buwan.domain.SuperHomeType; -import com.yeshi.buwan.domain.VideoInfo; import com.yeshi.buwan.domain.web.DetailSystemSelect; import com.yeshi.buwan.domain.web.HomeTypeAdmin; import com.yeshi.buwan.util.Constant; @@ -43,6 +32,9 @@ @Resource private DetailSystemDao detailSystemDao; + @Resource + private VideoResourceMapExtraInfoService videoResourceMapExtraInfoService; + public List<HomeType> getHomeType() { List<HomeType> list = homeTypeDao.list("from HomeType h order by h.orderby desc"); @@ -53,7 +45,7 @@ @Cacheable(value = "homeCache", key = "'getHomeType'+'-'+#detailSystem+'-'+#cacheMd5+'-'+#maxNumber+'-'+#vtid") public List<HomeType> getHomeType(final String detailSystem, final List<Long> resourceIds, String cacheMd5, final int maxNumber, final long vtid) { - return (List<HomeType>) homeTypeDao.excute(new HibernateCallback<List<HomeType>>() { + List<HomeType> homeTypeList = (List<HomeType>) homeTypeDao.excute(new HibernateCallback<List<HomeType>>() { public List<HomeType> doInHibernate(Session session) throws HibernateException { return (List<HomeType>) homeTypeDao.excute(new HibernateCallback<List<HomeType>>() { @@ -72,7 +64,7 @@ + vtid + "' AND (" + resourceWhere + " ) AND bv.`videoid` IS NULL ) GROUP BY (hv.`id`) ORDER BY hv.`orderby` desc,v.createtime DESC ) hvideo LEFT JOIN `wk_video_super_hometype` sht ON sht.`hometypeid`=hvideo.hometype LEFT JOIN `wk_video_hometype` ht ON sht.`hometypeid` =ht.`id` LEFT JOIN wk_video_video v ON v.`id`=hvideo.videoid WHERE sht.`detailsystemid` =" + detailSystem + " ORDER BY hvideo.`orderby` DESC,v.orderby desc,v.updatetime desc") .list(); - List<HomeType> homeTypeList = new ArrayList<HomeType>(); + List<HomeType> homeTypeList = new ArrayList<>(); for (int i = 0; i < resultList.size(); i++) { Object[] obj = (Object[]) resultList.get(i); HomeType ht = new HomeType(); @@ -133,7 +125,7 @@ } } else { - List<HomeVideo> videolist = new ArrayList<HomeVideo>(); + List<HomeVideo> videolist = new ArrayList<>(); videolist.add(hv); ht.setHomeVideoList(videolist); homeTypeList.add(ht); @@ -158,6 +150,26 @@ } }); + List<String> videoIdList = new ArrayList<>(); + for (HomeType ht : homeTypeList) { + if (ht.getHomeVideoList() != null) + for (HomeVideo hv : ht.getHomeVideoList()) { + if (hv.getVideo() != null) + videoIdList.add(hv.getVideo().getId()); + } + } + + Map<String, VideoResourceMapExtraInfo> videoMap = videoResourceMapExtraInfoService.listMap(videoIdList, resourceIds); + for (HomeType ht : homeTypeList) { + if (ht.getHomeVideoList() != null) + for (HomeVideo hv : ht.getHomeVideoList()) { + if (hv.getVideo() != null) + hv.getVideo().setVideoResourceMapExtraInfo(videoMap.get(hv.getVideo().getId())); + } + } + + + return homeTypeList; } private void orderByType(List<HomeType> homeTypeList) { @@ -240,7 +252,7 @@ } public List<DetailSystemSelect> getDetailSystemSelectByType(String homeType) { - List<DetailSystemSelect> li = new ArrayList<DetailSystemSelect>(); + List<DetailSystemSelect> li = new ArrayList<>(); List<DetailSystem> list = detailSystemDao .list("select sht.detailSystem from SuperHomeType sht where sht.homeType.id=" + homeType); List<DetailSystem> sdList = detailSystemDao.list("from DetailSystem"); @@ -426,7 +438,7 @@ return (List<HomeTypeAdmin>) homeTypeDao.excute(new HibernateCallback<List<HomeTypeAdmin>>() { public List<HomeTypeAdmin> doInHibernate(Session session) throws HibernateException { - List<HomeTypeAdmin> zhiBoClassList = new ArrayList<HomeTypeAdmin>(); + List<HomeTypeAdmin> zhiBoClassList = new ArrayList<>(); try { List<DetailSystem> detailSystemList = session.createQuery("from DetailSystem").list(); String sql = ""; @@ -443,7 +455,7 @@ .createQuery("select vb.detailSystem from SuperHomeType vb where vb.homeType.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