| | |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | |
| | | import com.yeshi.buwan.service.inter.recommend.HomeVideoService; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.video.VideoUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.buwan.domain.CategoryContry; |
| | | import com.yeshi.buwan.domain.DetailSystem; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.HomeType; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | |
| | | import com.yeshi.buwan.service.imp.HomeTypeService; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.imp.recommend.CategoryRecommendVideoService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.EhcacheUtil; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.web.tag.PageEntity; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/new/api/class") |
| | | public class ClassController { |
| | | |
| | | @Resource |
| | | private ClassService classService; |
| | | @Resource |
| | | private ClassService classService; |
| | | |
| | | @Resource |
| | | private HomeTypeService homeTypeService; |
| | | @Resource |
| | | private HomeTypeService homeTypeService; |
| | | |
| | | @Resource |
| | | private CategoryRecommendVideoService categoryRecommendVideoService; |
| | | @Resource |
| | | private HomeVideoService homeVideoService; |
| | | |
| | | @Resource |
| | | private SystemService systemService; |
| | | |
| | | @Resource |
| | | private CategoryAreaService categoryAreaService; |
| | | @Resource |
| | | private CategoryRecommendVideoService categoryRecommendVideoService; |
| | | |
| | | @RequestMapping(value = "/getnextclass", method = RequestMethod.POST) |
| | | public void getNextClass(int pid, PrintWriter out) { |
| | | System.out.println("pid--" + pid); |
| | | List<VideoType> list; |
| | | if (pid <= 0) |
| | | list = classService.getNextTypeList(""); |
| | | else |
| | | list = classService.getNextTypeList(pid + ""); |
| | | @Resource |
| | | private SystemService systemService; |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | if (list != null) |
| | | for (VideoType type : list) { |
| | | JSONObject obj = new JSONObject(); |
| | | obj.put("id", type.getId()); |
| | | obj.put("name", type.getName()); |
| | | array.add(obj); |
| | | } |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", 0); |
| | | object.put("data", array); |
| | | out.print(object); |
| | | } |
| | | @RequestMapping("getAllFirstClass") |
| | | public void getAllFirstClass(PrintWriter out){ |
| | | List<VideoType> list = classService.getAllVideoType(); |
| | | JSONArray array = new JSONArray(); |
| | | if (list != null) |
| | | for (VideoType type : list) { |
| | | JSONObject obj = new JSONObject(); |
| | | obj.put("id", type.getId()); |
| | | obj.put("name", type.getName()); |
| | | array.add(obj); |
| | | } |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", 0); |
| | | object.put("data", array); |
| | | out.print(object); |
| | | } |
| | | @Resource |
| | | private CategoryAreaService categoryAreaService; |
| | | |
| | | @RequestMapping(value = "/gethometypelist", method = RequestMethod.POST) |
| | | public void getHomeTypeList(int pid, PrintWriter out) { |
| | | List<HomeType> list = homeTypeService.getHomeType(); |
| | | @RequestMapping(value = "/getnextclass", method = RequestMethod.POST) |
| | | public void getNextClass(int pid, PrintWriter out) { |
| | | System.out.println("pid--" + pid); |
| | | List<VideoType> list; |
| | | if (pid <= 0) |
| | | list = classService.getNextTypeList(""); |
| | | else |
| | | list = classService.getNextTypeList(pid + ""); |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | if (list != null) |
| | | for (HomeType type : list) { |
| | | JSONObject obj = new JSONObject(); |
| | | obj.put("id", type.getId()); |
| | | obj.put("name", type.getName()); |
| | | array.add(obj); |
| | | } |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", 0); |
| | | object.put("data", array); |
| | | out.print(object); |
| | | } |
| | | JSONArray array = new JSONArray(); |
| | | if (list != null) |
| | | for (VideoType type : list) { |
| | | JSONObject obj = new JSONObject(); |
| | | obj.put("id", type.getId()); |
| | | obj.put("name", type.getName()); |
| | | array.add(obj); |
| | | } |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", 0); |
| | | object.put("data", array); |
| | | out.print(object); |
| | | } |
| | | |
| | | @RequestMapping(value = "/addhomevideos", method = RequestMethod.POST) |
| | | public void addHomeVideos(int hometypeid, String videos, String pictures, |
| | | String tags, PrintWriter out) { |
| | | String[] videoStr = videos.split(","); |
| | | String[] pictureStr = pictures.split(","); |
| | | String[] tagStr = tags.split(","); |
| | | @RequestMapping("getAllFirstClass") |
| | | public void getAllFirstClass(PrintWriter out) { |
| | | List<VideoType> list = classService.getAllVideoType(); |
| | | JSONArray array = new JSONArray(); |
| | | if (list != null) |
| | | for (VideoType type : list) { |
| | | JSONObject obj = new JSONObject(); |
| | | obj.put("id", type.getId()); |
| | | obj.put("name", type.getName()); |
| | | array.add(obj); |
| | | } |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", 0); |
| | | object.put("data", array); |
| | | out.print(object); |
| | | } |
| | | |
| | | List<HomeVideo> list = new ArrayList<HomeVideo>(); |
| | | for (int i = 0; i < videoStr.length; i++) { |
| | | HomeVideo hv = new HomeVideo(); |
| | | hv.setCreatetime(System.currentTimeMillis() + ""); |
| | | hv.setTag(tagStr[i]); |
| | | hv.setPicture(pictureStr[i]); |
| | | hv.setType(new HomeType(hometypeid + "")); |
| | | hv.setVideo(new VideoInfo(videoStr[i])); |
| | | } |
| | | @RequestMapping(value = "/gethometypelist", method = RequestMethod.POST) |
| | | public void getHomeTypeList(int pid, HttpSession session, PrintWriter out) { |
| | | List<HomeType> list = homeTypeService.getHomeTypeList(SystemUtil.getAdminSelectedSystemId(session)); |
| | | |
| | | homeTypeService.addHomeTypeVideo(list); |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", 0); |
| | | object.put("msg", "添加成功"); |
| | | out.print(object); |
| | | } |
| | | |
| | | /** |
| | | * 搜索 |
| | | * @param key |
| | | * @param detailsystem |
| | | * @param videotype |
| | | * @param page |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "/getseachList",method=RequestMethod.POST) |
| | | public void categoryRecommendVideoList(String key, String detailsystem, |
| | | String videotype, String page, PrintWriter out) { |
| | | |
| | | if(detailsystem==null || "".equals(detailsystem.trim())){ |
| | | detailsystem="0"; |
| | | } |
| | | |
| | | if(page==null || "".equals(page.trim())){ |
| | | page="1"; |
| | | } |
| | | |
| | | int pageIndex = Integer.parseInt(page); |
| | | if (pageIndex == 0) |
| | | pageIndex = 1; |
| | | JSONArray array = new JSONArray(); |
| | | if (list != null) |
| | | for (HomeType type : list) { |
| | | JSONObject obj = new JSONObject(); |
| | | obj.put("id", type.getId()); |
| | | obj.put("name", type.getName()); |
| | | array.add(obj); |
| | | } |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", 0); |
| | | object.put("data", array); |
| | | out.print(object); |
| | | } |
| | | |
| | | videotype = StringUtil.isNullOrEmpty(videotype) ? "150" : videotype; |
| | | |
| | | List<CategoryRecommendVideoAdmin> list = categoryRecommendVideoService |
| | | .getCategoryRecommendVideoAdmin(key, |
| | | Integer.parseInt(videotype), Integer.parseInt(detailsystem), pageIndex); |
| | | long count = categoryRecommendVideoService |
| | | .getCategoryRecommendVideoAdminCount(key, |
| | | Integer.parseInt(videotype), Integer.parseInt(detailsystem)); |
| | | PageEntity pe = new PageEntity(); |
| | | pe.setPageIndex(pageIndex); |
| | | pe.setPageSize(Constant.pageCount); |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | map.put("key", key); |
| | | map.put("detailsystem", detailsystem + ""); |
| | | map.put("videotype", videotype + ""); |
| | | pe.setParams(map); |
| | | pe.setTotalCount((int) count); |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation() |
| | | .create(); |
| | | JSONObject root = new JSONObject(); |
| | | root.put("code", "0"); |
| | | root.put("pageEntity", pe); |
| | | String json = gson.toJson(list); |
| | | root.put("crv", json); |
| | | // for (CategoryRecommendVideoAdmin categoryRecommendVideoAdmin : list) |
| | | // { |
| | | // System.out.println(categoryRecommendVideoAdmin.getCategoryRecommendVideo().getCategoryRecommendVideo()); |
| | | // root.put("categoryRecommendVideoAdmin", |
| | | // gson.toJson(categoryRecommendVideoAdmin.getCategoryRecommendVideo().getCategoryRecommendVideo())); |
| | | // } |
| | | System.out.println(root.toString()); |
| | | out.print(root); |
| | | // dataMap.put("categoryRecommendVideoAdminList", list); |
| | | // List<DetailSystem> detailSystemList = systemService |
| | | // .getDetailSystemList(); |
| | | // dataMap.put("detailSystemList", detailSystemList); |
| | | // List<VideoType> typeList = classService.getFirstTypeList(""); |
| | | // dataMap.put("videoTypeList", typeList); |
| | | // json.put("data", data); |
| | | // System.out.println("jsonStr---------"+jsonStr); |
| | | // out.print(jsonStr); |
| | | } |
| | | |
| | | @RequestMapping(value="/deleteCategoryRecommendVideo",method=RequestMethod.POST) |
| | | public void deleteCategoryRecommendVideo(String ids,PrintWriter out) { |
| | | |
| | | if(ids == null || ids.trim().length()==0){ |
| | | return; |
| | | } |
| | | String[] idArr = ids.split(","); |
| | | for (String id : idArr) { |
| | | System.out.println(id); |
| | | categoryRecommendVideoService.deleteCategoryRecommendVideo(new CategoryRecommendVideo(id)); |
| | | } |
| | | out.print("yes"); |
| | | } |
| | | |
| | | @RequestMapping(value="/getCategoryRecommendVideo",method=RequestMethod.POST) |
| | | public void getCategoryRecommendVideo(String id,PrintWriter out) { |
| | | @RequestMapping(value = "/addhomevideos", method = RequestMethod.POST) |
| | | public void addHomeVideos(int hometypeid, String videos, String pictures, |
| | | String tags, PrintWriter out) { |
| | | String[] videoStr = videos.split(","); |
| | | String[] pictureStr = pictures.split(","); |
| | | String[] tagStr = tags.split(","); |
| | | |
| | | List<HomeVideo> list = new ArrayList<HomeVideo>(); |
| | | for (int i = 0; i < videoStr.length; i++) { |
| | | HomeVideo hv = new HomeVideo(); |
| | | hv.setCreatetime(System.currentTimeMillis() + ""); |
| | | hv.setTag(tagStr[i]); |
| | | hv.setPicture(pictureStr[i]); |
| | | hv.setType(new HomeType(hometypeid + "")); |
| | | hv.setVideoId(videoStr[i]); |
| | | hv.setFromType(VideoUtil.getVideoFromType(hv.getVideoId())); |
| | | hv.setBigPicture(false); |
| | | } |
| | | |
| | | homeVideoService.addHomeVideo(list); |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", 0); |
| | | object.put("msg", "添加成功"); |
| | | out.print(object); |
| | | } |
| | | |
| | | /** |
| | | * 搜索 |
| | | * |
| | | * @param key |
| | | * @param detailsystem |
| | | * @param videotype |
| | | * @param page |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "/getseachList", method = RequestMethod.POST) |
| | | public void categoryRecommendVideoList(String key, String detailsystem, |
| | | String videotype, String page, HttpSession session, PrintWriter out) { |
| | | |
| | | if (detailsystem == null || "".equals(detailsystem.trim())) { |
| | | detailsystem = "0"; |
| | | } |
| | | |
| | | if (page == null || "".equals(page.trim())) { |
| | | page = "1"; |
| | | } |
| | | |
| | | int pageIndex = Integer.parseInt(page); |
| | | if (pageIndex == 0) |
| | | pageIndex = 1; |
| | | |
| | | videotype = StringUtil.isNullOrEmpty(videotype) ? "150" : videotype; |
| | | |
| | | List<CategoryRecommendVideoAdmin> list = categoryRecommendVideoService |
| | | .getCategoryRecommendVideoAdmin(key, |
| | | Integer.parseInt(videotype), SystemUtil.getAdminSelectedSystemId(session), Integer.parseInt(detailsystem), pageIndex); |
| | | long count = categoryRecommendVideoService |
| | | .getCategoryRecommendVideoAdminCount(key, |
| | | Integer.parseInt(videotype), SystemUtil.getAdminSelectedSystemId(session), Integer.parseInt(detailsystem)); |
| | | PageEntity pe = new PageEntity(); |
| | | pe.setPageIndex(pageIndex); |
| | | pe.setPageSize(Constant.pageCount); |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | map.put("key", key); |
| | | map.put("detailsystem", detailsystem + ""); |
| | | map.put("videotype", videotype + ""); |
| | | pe.setParams(map); |
| | | pe.setTotalCount((int) count); |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation() |
| | | .create(); |
| | | JSONObject root = new JSONObject(); |
| | | root.put("code", "0"); |
| | | root.put("pageEntity", pe); |
| | | String json = gson.toJson(list); |
| | | root.put("crv", json); |
| | | System.out.println(root.toString()); |
| | | out.print(root); |
| | | } |
| | | |
| | | @RequestMapping(value = "/deleteCategoryRecommendVideo", method = RequestMethod.POST) |
| | | public void deleteCategoryRecommendVideo(String ids, PrintWriter out) { |
| | | |
| | | if (ids == null || ids.trim().length() == 0) { |
| | | return; |
| | | } |
| | | String[] idArr = ids.split(","); |
| | | for (String id : idArr) { |
| | | System.out.println(id); |
| | | categoryRecommendVideoService.deleteCategoryRecommendVideo(new CategoryRecommendVideo(id)); |
| | | } |
| | | out.print("yes"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getCategoryRecommendVideo", method = RequestMethod.POST) |
| | | public void getCategoryRecommendVideo(String id, PrintWriter out) { |
| | | |
| | | // id = StringUtil.isNullOrEmpty(id) ? request.getAttribute("id").toString() : id; |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation() |
| | | .create(); |
| | | JSONObject root = new JSONObject(); |
| | | CategoryRecommendVideo categoryRecommendVideo = categoryRecommendVideoService.getCategoryRecommendVideoById(id); |
| | | if(categoryRecommendVideo != null){ |
| | | String json = gson.toJson(categoryRecommendVideo); |
| | | root.put("code", "0"); |
| | | root.put("crv", json); |
| | | }else{ |
| | | root.put("code", "1"); |
| | | root.put("crv", null); |
| | | } |
| | | out.print(root); |
| | | |
| | | //request.setAttribute("videoTypeList", classService.getFirstTypeList("")); |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation() |
| | | .create(); |
| | | JSONObject root = new JSONObject(); |
| | | CategoryRecommendVideo categoryRecommendVideo = categoryRecommendVideoService.getCategoryRecommendVideoById(id); |
| | | if (categoryRecommendVideo != null) { |
| | | String json = gson.toJson(categoryRecommendVideo); |
| | | root.put("code", "0"); |
| | | root.put("crv", json); |
| | | } else { |
| | | root.put("code", "1"); |
| | | root.put("crv", null); |
| | | } |
| | | out.print(root); |
| | | |
| | | //request.setAttribute("videoTypeList", classService.getFirstTypeList("")); |
| | | // request.setAttribute("systemList", systemService.getSystemList()); |
| | | // request.setAttribute("categoryRecommendVideo", categoryRecommendVideo); |
| | | return ; |
| | | } |
| | | |
| | | @RequestMapping(value="/setCategoryRecommendVideo",method=RequestMethod.POST) |
| | | public void updateCategoryRecommendVideo(String id,String beizhu,String desc,int orderby,String picture,String videoid,String videotype,PrintWriter out) { |
| | | |
| | | //id为空则新加 |
| | | if(id == null || "".equals(id.trim())){ |
| | | CategoryRecommendVideo newCategoryRecommendVideo=new CategoryRecommendVideo(); |
| | | newCategoryRecommendVideo.setBeizhu(beizhu); |
| | | newCategoryRecommendVideo.setCreatetime(System.currentTimeMillis() + ""); |
| | | newCategoryRecommendVideo.setDesc(desc); |
| | | // categoryRecommendVideo.setJpos(jpos); |
| | | newCategoryRecommendVideo.setOrderby(orderby); |
| | | newCategoryRecommendVideo.setPicture(picture); |
| | | newCategoryRecommendVideo.setVideoInfo(new VideoInfo(videoid)); |
| | | newCategoryRecommendVideo.setVideoType(new VideoType(Long.parseLong(videotype))); |
| | | categoryRecommendVideoService.addCategoryRecommendVideo(newCategoryRecommendVideo); |
| | | |
| | | SuperCategoryRecommendVideo sz=null; |
| | | List<DetailSystem> list = systemService.getDetailSystemList(); |
| | | for (DetailSystem ds : list) { |
| | | sz= new SuperCategoryRecommendVideo(); |
| | | sz.setDetailSystem(new DetailSystem(ds.getId())); |
| | | sz.setCategoryRecommendVideo(newCategoryRecommendVideo); |
| | | categoryRecommendVideoService.addSuperCategoryRecommendVideo(sz); |
| | | } |
| | | |
| | | out.print("yes"); |
| | | return; |
| | | } |
| | | CategoryRecommendVideo categoryRecommendVideo = categoryRecommendVideoService.getCategoryRecommendVideoById(id); |
| | | categoryRecommendVideo.setBeizhu(beizhu); |
| | | categoryRecommendVideo.setCreatetime(System.currentTimeMillis() + ""); |
| | | categoryRecommendVideo.setDesc(desc); |
| | | return; |
| | | } |
| | | |
| | | @RequestMapping(value = "/setCategoryRecommendVideo", method = RequestMethod.POST) |
| | | public void updateCategoryRecommendVideo(String id, String beizhu, String desc, int orderby, String picture, String videoid, String videotype, HttpSession session, PrintWriter out) { |
| | | |
| | | //id为空则新加 |
| | | if (id == null || "".equals(id.trim())) { |
| | | CategoryRecommendVideo newCategoryRecommendVideo = new CategoryRecommendVideo(); |
| | | newCategoryRecommendVideo.setBeizhu(beizhu); |
| | | newCategoryRecommendVideo.setCreatetime(System.currentTimeMillis() + ""); |
| | | newCategoryRecommendVideo.setDesc(desc); |
| | | newCategoryRecommendVideo.setOrderby(orderby); |
| | | newCategoryRecommendVideo.setPicture(picture); |
| | | newCategoryRecommendVideo.setVideoInfo(new VideoInfo(videoid)); |
| | | newCategoryRecommendVideo.setVideoType(new VideoType(Long.parseLong(videotype))); |
| | | newCategoryRecommendVideo.setSystem(SystemUtil.getAdminSelectedSystem(session)); |
| | | |
| | | categoryRecommendVideoService.addCategoryRecommendVideo(newCategoryRecommendVideo); |
| | | |
| | | SuperCategoryRecommendVideo sz = null; |
| | | List<DetailSystem> list = systemService.getDetailSystemList(SystemUtil.getAdminSelectedSystem(session).getId()); |
| | | for (DetailSystem ds : list) { |
| | | sz = new SuperCategoryRecommendVideo(); |
| | | sz.setDetailSystem(new DetailSystem(ds.getId())); |
| | | sz.setCategoryRecommendVideo(newCategoryRecommendVideo); |
| | | categoryRecommendVideoService.addSuperCategoryRecommendVideo(sz); |
| | | } |
| | | |
| | | out.print("yes"); |
| | | return; |
| | | } |
| | | CategoryRecommendVideo categoryRecommendVideo = categoryRecommendVideoService.getCategoryRecommendVideoById(id); |
| | | categoryRecommendVideo.setBeizhu(beizhu); |
| | | categoryRecommendVideo.setCreatetime(System.currentTimeMillis() + ""); |
| | | categoryRecommendVideo.setDesc(desc); |
| | | // categoryRecommendVideo.setJpos(jpos); |
| | | categoryRecommendVideo.setOrderby(orderby); |
| | | categoryRecommendVideo.setPicture(picture); |
| | | categoryRecommendVideo.setVideoInfo(new VideoInfo(videoid)); |
| | | categoryRecommendVideo.setVideoType(new VideoType(Long.parseLong(videotype))); |
| | | categoryRecommendVideoService.updateCategoryRecommendVideo(categoryRecommendVideo); |
| | | out.print("yes"); |
| | | return ; |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/CategoryRecommendVideoAdminServlet", method = RequestMethod.POST) |
| | | public void set(String type, String id, String systemid,PrintWriter out) { |
| | | |
| | | System.out.println("type--"+type); |
| | | System.out.println("id--"+id); |
| | | System.out.println("systemid--"+systemid); |
| | | |
| | | if ("add".equalsIgnoreCase(type)) {// 获取来源列表 |
| | | if (!StringUtil.isNullOrEmpty(systemid) && !StringUtil.isNullOrEmpty(id)) { |
| | | SuperCategoryRecommendVideo sz=new SuperCategoryRecommendVideo(); |
| | | sz.setDetailSystem(new DetailSystem(systemid)); |
| | | sz.setCategoryRecommendVideo(new CategoryRecommendVideo(id)); |
| | | categoryRecommendVideoService.addSuperCategoryRecommendVideo(sz); |
| | | } |
| | | out.print("yes"); |
| | | } else if ("delete".equalsIgnoreCase(type)) { |
| | | if (!StringUtil.isNullOrEmpty(systemid) && !StringUtil.isNullOrEmpty(id)) { |
| | | categoryRecommendVideoService.deleteCategoryRecommendVideoAdmin(id, systemid); |
| | | } |
| | | out.print("yes"); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping("getAreaList") |
| | | public void getAreaList(long cid,PrintWriter out){ |
| | | List<CategoryContry> list = categoryAreaService.getCategoryContryListByCid(cid+""); |
| | | if(list.size() ==0){ |
| | | out.print( JsonUtil.loadFalseAdmin("加载错误")); |
| | | return; |
| | | } |
| | | List<CategoryContry> categoryContryList = categoryAreaService.categoryContryList(list.get(0).getId()+""); |
| | | PageEntity pe = new PageEntity(); |
| | | pe.setPageIndex(1); |
| | | pe.setPageSize(categoryContryList.size()); |
| | | pe.setTotalCount(categoryContryList.size()); |
| | | JSONObject data = new JSONObject(); |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); |
| | | data.put("pe", pe); |
| | | data.put("list", gson.toJson(categoryContryList)); |
| | | String json = JsonUtil.loadTrueAdmin(data); |
| | | out.print(json); |
| | | } |
| | | |
| | | @RequestMapping("getArea") |
| | | public void getArea(long id,PrintWriter out){ |
| | | CategoryContry area = categoryAreaService.getCategoryArea(id+""); |
| | | if(area == null){ |
| | | out.print(JsonUtil.loadFalseAdmin("")); |
| | | return; |
| | | } |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); |
| | | out.print(JsonUtil.loadTrueAdmin(gson.toJson(area))); |
| | | } |
| | | |
| | | @RequestMapping("updateArea") |
| | | public void updateArea(long id,int orderBy,PrintWriter out){ |
| | | CategoryContry area = categoryAreaService.getCategoryArea(id+""); |
| | | if(area == null){ |
| | | out.print(JsonUtil.loadFalseAdmin("")); |
| | | return; |
| | | } |
| | | area.setOrderby(orderBy); |
| | | categoryAreaService.updateArea(area); |
| | | out.print(JsonUtil.loadTrueAdmin("")); |
| | | } |
| | | |
| | | |
| | | categoryRecommendVideo.setOrderby(orderby); |
| | | categoryRecommendVideo.setPicture(picture); |
| | | categoryRecommendVideo.setVideoInfo(new VideoInfo(videoid)); |
| | | categoryRecommendVideo.setVideoType(new VideoType(Long.parseLong(videotype))); |
| | | categoryRecommendVideoService.updateCategoryRecommendVideo(categoryRecommendVideo); |
| | | out.print("yes"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/CategoryRecommendVideoAdminServlet", method = RequestMethod.POST) |
| | | public void set(String type, String id, String systemid, PrintWriter out) { |
| | | |
| | | System.out.println("type--" + type); |
| | | System.out.println("id--" + id); |
| | | System.out.println("systemid--" + systemid); |
| | | |
| | | if ("add".equalsIgnoreCase(type)) {// 获取来源列表 |
| | | if (!StringUtil.isNullOrEmpty(systemid) && !StringUtil.isNullOrEmpty(id)) { |
| | | SuperCategoryRecommendVideo sz = new SuperCategoryRecommendVideo(); |
| | | sz.setDetailSystem(new DetailSystem(systemid)); |
| | | sz.setCategoryRecommendVideo(new CategoryRecommendVideo(id)); |
| | | categoryRecommendVideoService.addSuperCategoryRecommendVideo(sz); |
| | | } |
| | | out.print("yes"); |
| | | } else if ("delete".equalsIgnoreCase(type)) { |
| | | if (!StringUtil.isNullOrEmpty(systemid) && !StringUtil.isNullOrEmpty(id)) { |
| | | categoryRecommendVideoService.deleteCategoryRecommendVideoAdmin(id, systemid); |
| | | } |
| | | out.print("yes"); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping("getAreaList") |
| | | public void getAreaList(long cid, PrintWriter out) { |
| | | List<CategoryContry> list = categoryAreaService.getCategoryContryListByCid(cid + ""); |
| | | if (list.size() == 0) { |
| | | out.print(JsonUtil.loadFalseAdmin("加载错误")); |
| | | return; |
| | | } |
| | | List<CategoryContry> categoryContryList = categoryAreaService.categoryContryList(list.get(0).getId() + ""); |
| | | PageEntity pe = new PageEntity(); |
| | | pe.setPageIndex(1); |
| | | pe.setPageSize(categoryContryList.size()); |
| | | pe.setTotalCount(categoryContryList.size()); |
| | | JSONObject data = new JSONObject(); |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); |
| | | data.put("pe", pe); |
| | | data.put("list", gson.toJson(categoryContryList)); |
| | | String json = JsonUtil.loadTrueAdmin(data); |
| | | out.print(json); |
| | | } |
| | | |
| | | @RequestMapping("getArea") |
| | | public void getArea(long id, PrintWriter out) { |
| | | CategoryContry area = categoryAreaService.getCategoryArea(id + ""); |
| | | if (area == null) { |
| | | out.print(JsonUtil.loadFalseAdmin("")); |
| | | return; |
| | | } |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); |
| | | out.print(JsonUtil.loadTrueAdmin(gson.toJson(area))); |
| | | } |
| | | |
| | | @RequestMapping("updateArea") |
| | | public void updateArea(long id, int orderBy, PrintWriter out) { |
| | | CategoryContry area = categoryAreaService.getCategoryArea(id + ""); |
| | | if (area == null) { |
| | | out.print(JsonUtil.loadFalseAdmin("")); |
| | | return; |
| | | } |
| | | area.setOrderby(orderBy); |
| | | categoryAreaService.updateArea(area); |
| | | out.print(JsonUtil.loadTrueAdmin("")); |
| | | } |
| | | |
| | | |
| | | } |