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/controller/admin/api/VideoAdminController.java | 220 +++++++++++++++++++++++++++++++----------------------- 1 files changed, 125 insertions(+), 95 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/controller/admin/api/VideoAdminController.java b/src/main/java/com/yeshi/buwan/controller/admin/api/VideoAdminController.java index 69c0750..5ccdcbb 100644 --- a/src/main/java/com/yeshi/buwan/controller/admin/api/VideoAdminController.java +++ b/src/main/java/com/yeshi/buwan/controller/admin/api/VideoAdminController.java @@ -1,11 +1,19 @@ package com.yeshi.buwan.controller.admin.api; import java.io.PrintWriter; +import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; +import com.google.gson.Gson; +import com.yeshi.buwan.domain.SolrVideo; +import com.yeshi.buwan.dto.search.SolrResultDTO; +import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; import com.yeshi.buwan.iqiyi.IqiYiNewAPI; +import com.yeshi.buwan.service.manager.SolrAlbumDataManager; +import com.yeshi.buwan.util.Constant; +import com.yeshi.buwan.vo.video.VideoAdminInfoVO; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -30,101 +38,123 @@ @RequestMapping("admin/new/api/video") public class VideoAdminController { - @Resource - private VideoManager videoManager; + @Resource + private VideoManager videoManager; - @Resource - private ClassService classService; + @Resource + private ClassService classService; - @Resource - private ResourceVideoService resourceVideoService; + @Resource + private ResourceVideoService resourceVideoService; - @Resource - private IqiyiUtil iqiyiUtil; + @Resource + private IqiyiUtil iqiyiUtil; - @Resource - private AcFunUtil acFunUtil; + @Resource + private AcFunUtil acFunUtil; - @Resource - private ThreadPoolTaskExecutor taskExecutor; + @Resource + private ThreadPoolTaskExecutor taskExecutor; - @RequestMapping(value = "/changevideoshow", method = RequestMethod.POST) - public void changeVideoShow(String id, int show, PrintWriter out) { - VideoInfo vi = videoManager.getVideoInfo(id); - if (vi != null) { - vi.setShow(show + ""); - videoManager.changeVideoShow(vi); - } - JSONObject object = new JSONObject(); - object.put("code", 0); - object.put("msg", "淇敼鎴愬姛"); - out.print(object); - } + @Resource + private SolrAlbumDataManager solrAlbumDataManager; - @RequestMapping(value = "/deletevideo", method = RequestMethod.POST) - public void deleteVideo(String id, PrintWriter out) { - String[] ids = id.split(","); - for (String idStr : ids) - videoManager.deleteVideo(idStr); + @RequestMapping(value = "/changevideoshow", method = RequestMethod.POST) + public void changeVideoShow(String id, int show, PrintWriter out) { + VideoInfo vi = videoManager.getVideoInfo(id); + if (vi != null) { + vi.setShow(show + ""); + videoManager.changeVideoShow(vi); + } + JSONObject object = new JSONObject(); + object.put("code", 0); + object.put("msg", "淇敼鎴愬姛"); + out.print(object); + } - JSONObject object = new JSONObject(); - object.put("code", 0); - object.put("msg", "鍒犻櫎鎴愬姛"); - out.print(object); - } + @RequestMapping(value = "/deletevideo", method = RequestMethod.POST) + public void deleteVideo(String id, PrintWriter out) { + String[] ids = id.split(","); + for (String idStr : ids) + videoManager.deleteVideo(idStr); - @RequestMapping(value = "/videolist", method = RequestMethod.POST) - public void videoList(int videotype, int page, String key, int contenttype, PrintWriter out) { - List<VideoInfo> list = classService.getTypeVideoListAdmin(videotype == 0 ? "" : videotype + "", page, key, - contenttype); - long count = classService.getTypeVideoListAdminCount(videotype == 0 ? "" : videotype + "", key, contenttype); - JSONObject object = new JSONObject(); - object.put("code", 0); - JSONObject data = new JSONObject(); - JSONArray array = new JSONArray(); - for (VideoInfo vi : list) { - JSONObject item = new JSONObject(); - item.put("id", vi.getId()); - item.put("name", vi.getName()); - item.put("picture", vi.getHpicture()); - item.put("updatetime", - TimeUtil.getGernalTime( - Long.parseLong( - StringUtil.isNullOrEmpty(vi.getCreatetime() + "") ? "0" : vi.getCreatetime() + ""), - "yyyy-MM-dd")); - item.put("show", vi.getShow()); - array.add(item); - } - PageEntity entity = new PageEntity(); - entity.setPageIndex(page); - entity.setPageSize(20); - entity.setTotalCount((int) count); + JSONObject object = new JSONObject(); + object.put("code", 0); + object.put("msg", "鍒犻櫎鎴愬姛"); + out.print(object); + } - data.put("pageEntity", new GsonBuilder().create().toJson(entity)); - data.put("data", array); - object.put("data", data); - out.println(object); - } + @RequestMapping(value = "/videolist", method = RequestMethod.POST) + public void videoList(int videotype, int page, String key, String resourceIds, int contenttype, PrintWriter out) { - @RequestMapping("updateVideos") - public void updateVideos(PrintWriter out) { - iqiyiUtil.updateAll(""); - out.print(JsonUtil.loadTrueAdmin("鎵ц鎴愬姛")); - } + List<VideoInfo> list = null; + long count = 0; + List<VideoAdminInfoVO> voList = new ArrayList<>(); + //姝g墖鎼滅储 + if (contenttype == 1) { + SolrVideoSearchFilter filter = new SolrVideoSearchFilter(); + filter.setKey(key); + filter.setVideoType(videotype == 0 ? null : videotype); + filter.setContentType(1); + if (!StringUtil.isNullOrEmpty(resourceIds)) { + JSONArray array = JSONArray.fromObject(resourceIds); + String[] rids = new String[array.size()]; + for (int i = 0; i < array.size(); i++) { + rids[i] = array.optString(i); + } + filter.setResourceIds(rids); + } - @RequestMapping("updateIqiyiAlbum") - public void updateIqiyiAlbum(String url, PrintWriter out) { - String aid = IqiYiNewAPI.getAidByUrl(url); - if (StringUtil.isNullOrEmpty(aid)) { - out.print(JsonUtil.loadFalseAdmin("鏈兘鑾峰彇鍒颁笓杈�")); - } else { - iqiyiUtil.updateAlbum(aid); - out.print(JsonUtil.loadTrueAdmin("涓撹緫鏇存柊鎴愬姛")); - } - } + filter.setSortKey("updateTime"); - @RequestMapping("addIqiyiShortVideo") - public void addIqiyiShortVideo(String urlJson, PrintWriter out) { + SolrResultDTO dto = solrAlbumDataManager.find(filter, page, Constant.pageCount); + if (dto.getVideoList() != null) + for (SolrVideo videoInfo : dto.getVideoList()) + voList.add(VideoAdminInfoVO.create(videoInfo)); + count = dto.getTotalCount(); + } else { + list = classService.getTypeVideoListAdmin(videotype == 0 ? "" : videotype + "", page, key, + contenttype); + count = classService.getTypeVideoListAdminCount(videotype == 0 ? "" : videotype + "", key, contenttype); + if (list != null) + for (VideoInfo videoInfo : list) + voList.add(VideoAdminInfoVO.create(videoInfo)); + } + JSONObject object = new JSONObject(); + object.put("code", 0); + JSONObject data = new JSONObject(); + JSONArray array = new JSONArray(); + + PageEntity entity = new PageEntity(); + entity.setPageIndex(page); + entity.setPageSize(20); + entity.setTotalCount((int) count); + + data.put("pageEntity", new GsonBuilder().create().toJson(entity)); + data.put("data", new Gson().toJson(voList)); + object.put("data", data); + out.println(object); + } + + @RequestMapping("updateVideos") + public void updateVideos(PrintWriter out) { + iqiyiUtil.updateAll(""); + out.print(JsonUtil.loadTrueAdmin("鎵ц鎴愬姛")); + } + + @RequestMapping("updateIqiyiAlbum") + public void updateIqiyiAlbum(String url, PrintWriter out) { + String aid = IqiYiNewAPI.getAidByUrl(url); + if (StringUtil.isNullOrEmpty(aid)) { + out.print(JsonUtil.loadFalseAdmin("鏈兘鑾峰彇鍒颁笓杈�")); + } else { + iqiyiUtil.updateAlbum(aid); + out.print(JsonUtil.loadTrueAdmin("涓撹緫鏇存柊鎴愬姛")); + } + } + + @RequestMapping("addIqiyiShortVideo") + public void addIqiyiShortVideo(String urlJson, PrintWriter out) { // JSONArray array = JSONArray.fromObject(urlJson); // int count = 0; // for (int i = 0; i < array.size(); i++) { @@ -143,20 +173,20 @@ // iqiyiUtil.updateAlbum(aid); // out.print(JsonUtil.loadTrueAdmin("涓撹緫鏇存柊鎴愬姛")); // } - } + } - @RequestMapping("iqiyiUpdate") - public void iqiyiUpdate(PrintWriter out) { - taskExecutor.execute(new Runnable() { - @Override - public void run() { - iqiyiUtil.updateAll(""); - } - }); - JSONObject data = new JSONObject(); - data.put("msg", "姝e湪鍚庡彴鏇存柊涓�"); - out.print(data); - } + @RequestMapping("iqiyiUpdate") + public void iqiyiUpdate(PrintWriter out) { + taskExecutor.execute(new Runnable() { + @Override + public void run() { + iqiyiUtil.updateAll(""); + } + }); + JSONObject data = new JSONObject(); + data.put("msg", "姝e湪鍚庡彴鏇存柊涓�"); + out.print(data); + } } -- Gitblit v1.8.0