admin
2022-04-16 04f09e52ffd4681bdfd85e51acd3da0d1280c3d3
src/main/java/com/yeshi/buwan/controller/admin/api/CommonController.java
@@ -6,6 +6,9 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import com.google.gson.Gson;
import com.yeshi.buwan.domain.VideoResource;
import com.yeshi.buwan.service.imp.VideoResourceService;
import com.yeshi.buwan.util.SystemUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -23,47 +26,59 @@
@RequestMapping("admin/new/api/common")
public class CommonController {
   @Resource
   private VideoService videoService;
   @Resource
   private SystemService systemService;
    @Resource
    private VideoService videoService;
    @Resource
    private SystemService systemService;
   @RequestMapping(value = "/searchvideo", method = RequestMethod.POST)
   public void searchVideo(String key, PrintWriter out) {
    @Resource
    private VideoResourceService videoResourceService;
      List<VideoInfo> list = videoService.searchVideoUsedByAdmin(key);
      JSONArray array = new JSONArray();
      if (list != null)
         for (VideoInfo info : list) {
            JSONObject obj = new JSONObject();
            obj.put("id", info.getId());
            obj.put("name", info.getName());
            obj.put("picture", info.getPicture());
            obj.put("show", info.getShow());
            array.add(obj);
         }
      JSONObject object = new JSONObject();
      object.put("code", 0);
      object.put("data", array);
      out.print(object);
   }
    @RequestMapping(value = "/searchvideo", method = RequestMethod.POST)
    public void searchVideo(String key, PrintWriter out) {
   @RequestMapping(value = "/detailsystemlist", method = RequestMethod.POST)
   public void detailSystemList(String key, HttpSession session, PrintWriter out) {
      List<DetailSystem> list = systemService.getDetailSystemList(SystemUtil.getAdminSelectedSystem(session).getId());
      JSONArray array = new JSONArray();
      if (list != null)
         for (DetailSystem system : list) {
            JSONObject obj = new JSONObject();
            obj.put("id", system.getId());
            obj.put("name", system.getAppName());
            obj.put("platform", system.getPlatform());
            array.add(obj);
         }
      JSONObject object = new JSONObject();
      object.put("code", 0);
      object.put("data", array);
      out.print(object);
   }
        List<VideoInfo> list = videoService.searchVideoUsedByAdmin(key);
        JSONArray array = new JSONArray();
        if (list != null)
            for (VideoInfo info : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", info.getId());
                obj.put("name", info.getName());
                obj.put("picture", info.getPicture());
                obj.put("show", info.getShow());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
    @RequestMapping(value = "/detailsystemlist", method = RequestMethod.POST)
    public void detailSystemList(String key, HttpSession session, PrintWriter out) {
        List<DetailSystem> list = systemService.getDetailSystemList(SystemUtil.getAdminSelectedSystem(session).getId());
        JSONArray array = new JSONArray();
        if (list != null)
            for (DetailSystem system : list) {
                JSONObject obj = new JSONObject();
                obj.put("id", system.getId());
                obj.put("name", system.getAppName());
                obj.put("platform", system.getPlatform());
                array.add(obj);
            }
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", array);
        out.print(object);
    }
    @RequestMapping(value = "/resourceList", method = RequestMethod.POST)
    public void resourceList(String key, HttpSession session, PrintWriter out) {
        List<VideoResource> videoResources = videoResourceService.getResourceList();
        JSONObject object = new JSONObject();
        object.put("code", 0);
        object.put("data", new Gson().toJson(videoResources));
        out.print(object);
    }
}