public static void fixAuditFlag() throws Exception { List<Programme> pList = ProgrammePeer.doSelect(new Criteria()); for (Programme p : pList) { Criteria pCrit = new Criteria(); pCrit.add(ProgrammeSitePeer.FK_PROGRAMME_ID, p.getId()); pCrit.add(ProgrammeSitePeer.SOURCE_SITE, Constants.YOUKU_SITE_ID); List<ProgrammeSite> psList = ProgrammeSitePeer.doSelect(pCrit); if (psList != null) { for (ProgrammeSite ps : psList) { ProgrammeSiteService.updateEpisodeCollected(ps.getId()); Criteria peCrit = new Criteria(); peCrit.add(EpisodeLogPeer.FK_PROGRAMME_SITE_ID, ps.getId()); peCrit.add(EpisodeLogPeer.STATUS, 0); List<EpisodeLog> elList = EpisodeLogPeer.doSelect(peCrit); if (elList == null || elList.isEmpty()) { p.setAuditAll(1); } else { p.setAuditAll(0); } ProgrammePeer.doUpdate(p); log.info("update programm audit flag" + p.getName() + " " + p.getId()); } } } }
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 void wrapSiteEpisodeLog(AuditEpisodeLogBo auditEpisodeLogBo, int siteId) throws Exception { Criteria crit = new Criteria(); crit.add(ProgrammeSitePeer.FK_PROGRAMME_ID, auditEpisodeLogBo.getId()); List<ProgrammeSite> psList = ProgrammeSitePeer.doSelect(crit); List<AuditEpisodeLogBo.SiteEpisodeLog> siteEpisodeLogList = new ArrayList<AuditEpisodeLogBo.SiteEpisodeLog>(); List<AuditEpisodeLogBo.SiteEpisodeLog> hasEpisodeSiteList = new ArrayList<AuditEpisodeLogBo.SiteEpisodeLog>(); if (psList != null && !psList.isEmpty()) { for (ProgrammeSite ps : psList) { // log.info("siteId" + siteId); if (siteId > 0 && ps.getSourceSite() != siteId) { continue; } AuditEpisodeLogBo.SiteEpisodeLog siteEpisode = getSiteEpisodeLog(ps.getId(), ps.getSourceSite()); hasEpisodeSiteList.add(getHasEpisodeSite(ps.getId(), ps.getSourceSite())); /*//审核特殊显示全剧情况 if(auditEpisodeLogBo.getConcernLevel() == Constants.CONCERN_FLAG) { AuditEpisodeLogBo.SiteEpisodeLog allEpisode = processConcernProgramme(ps.getId(), siteId); if(allEpisode.getEpisodeLogList() != null) { siteEpisode.getEpisodeLogList().addAll(allEpisode.getEpisodeLogList()); } Collections.sort(siteEpisode.getEpisodeLogList(), new Comparator<EpisodeLog>() { @Override public int compare(EpisodeLog o1, EpisodeLog o2) { return o1.getOrderId() - o2.getOrderId(); } }); }*/ siteEpisodeLogList.add(siteEpisode); } } auditEpisodeLogBo.setHasEpisodeSiteIds(hasEpisodeSiteList); auditEpisodeLogBo.setSiteEpisodeLogList(siteEpisodeLogList); auditEpisodeLogBo.setCateName( CategoryService.getCategoryMap().get(auditEpisodeLogBo.getCateId())); }
public static void checkProgrammeAuditAll(int programmeSiteId) throws Exception { ProgrammeSite programmeSite = ProgrammeSitePeer.retrieveByPK(programmeSiteId); Programme p = ProgrammePeer.retrieveByPK(programmeSite.getFkProgrammeId()); Criteria pCrit = new Criteria(); pCrit.add(ProgrammeSitePeer.FK_PROGRAMME_ID, p.getId()); pCrit.add(ProgrammeSitePeer.SOURCE_SITE, Constants.YOUKU_SITE_ID); List<ProgrammeSite> psList = ProgrammeSitePeer.doSelect(pCrit); if (psList != null) { for (ProgrammeSite ps : psList) { Criteria peCrit = new Criteria(); peCrit.add(EpisodeLogPeer.FK_PROGRAMME_SITE_ID, ps.getId()); peCrit.add(EpisodeLogPeer.STATUS, 0); List<EpisodeLog> elList = EpisodeLogPeer.doSelect(peCrit); if (elList == null || elList.isEmpty()) { p.setAuditAll(1); ProgrammePeer.doUpdate(p); log.info("update programm audit flag" + p.getName() + " " + p.getId()); } } } }