private int synProgrammeSiteHd() { int count = 0; try { // 获取所有hd=0的节目-站点 Criteria crit = new Criteria(); crit.add(ProgrammeSitePeer.HD, 0); List<ProgrammeSite> psList = ProgrammeSitePeer.doSelect(crit); if (null == psList || psList.size() == 0) return count; for (ProgrammeSite ps : psList) { // 获取节目-站点的所有剧集 Criteria allcrit = new Criteria(); allcrit.add(ProgrammeEpisodePeer.FK_PROGRAMME_SITE_ID, ps.getId()); List<ProgrammeEpisode> allpe = ProgrammeEpisodePeer.doSelect(allcrit); // 获取节目-站点的所有高清剧集 Criteria hdcrit = new Criteria(); hdcrit.add(ProgrammeEpisodePeer.FK_PROGRAMME_SITE_ID, ps.getId()); hdcrit.add(ProgrammeEpisodePeer.HD, 1); List<ProgrammeEpisode> hdpe = ProgrammeEpisodePeer.doSelect(hdcrit); // 若所有剧集和高清剧集大于1且二者size()相当,则该节目-站点的hd为1 if (allpe != null && hdpe != null && allpe.size() > 0 && allpe.size() == hdpe.size()) { ps.setHd(1); count++; } else ps.setHd(0); ProgrammeSitePeer.doUpdate(ps); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return count; }
// 重点关注的剧集取出全部剧集链接 private static AuditEpisodeLogBo.SiteEpisodeLog processConcernProgramme(int psId, int siteId) throws Exception { Criteria peCrit = new Criteria(); peCrit.add(ProgrammeEpisodePeer.FK_PROGRAMME_SITE_ID, psId); List<ProgrammeEpisode> peList = ProgrammeEpisodePeer.doSelect(peCrit); List<EpisodeLog> logList = new ArrayList<EpisodeLog>(); log.info("peList size" + peList.size()); if (peList != null && !peList.isEmpty()) { for (ProgrammeEpisode pe : peList) { EpisodeLog el = new EpisodeLog(); el.setTitle(pe.getTitle()); el.setHd(pe.getHd()); el.setOrderId(pe.getOrderId()); el.setUrl(pe.getUrl()); el.setSeconds(pe.getSeconds()); el.setId(-1); logList.add(el); } } AuditEpisodeLogBo.SiteEpisodeLog siteLog = new AuditEpisodeLogBo.SiteEpisodeLog(); siteLog.setSiteId(siteId); siteLog.setSiteName(SiteService.getSiteName(siteId)); log.info("siteName" + siteLog.getSiteName()); siteLog.setEpisodeLogList(logList); return siteLog; }
private static AuditEpisodeLogBo.SiteEpisodeLog getHasEpisodeSite(int psId, int siteId) throws Exception { Criteria peCrit = new Criteria(); peCrit.add(ProgrammeEpisodePeer.FK_PROGRAMME_SITE_ID, psId); List<ProgrammeEpisode> peList = ProgrammeEpisodePeer.doSelect(peCrit); if (peList != null && !peList.isEmpty()) { AuditEpisodeLogBo.SiteEpisodeLog siteLog = new AuditEpisodeLogBo.SiteEpisodeLog(); siteLog.setSiteId(psId); siteLog.setSiteName(SiteService.getSiteName(siteId)); return siteLog; } return null; }