ReceiveDataController.java 1.54 KB
package com.viontech.controller;

import com.alibaba.fastjson.JSONObject;
import com.viontech.service.adapter.IRedisService;
import com.viontech.vo.VideoVo;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ReceiveDataController extends BaseController {
    @Autowired
    IRedisService iRedisService;

    @PostMapping({"/recv/datas"})
    @ResponseBody
    public Object recvData(@RequestBody JSONObject data) {
        Map<Object, Object> result = new HashMap<>(2);
        this.iRedisService.recvData(data);
        result.put("ecode", "200");
        result.put("enote", "OK");
        return result;
    }

    @PostMapping({"/recv/video"})
    @ResponseBody
    public Object recvVideo(VideoVo videoVo) {
        Map<Object, Object> result = new HashMap<>(2);
        try {
            this.iRedisService.uploadVideo(videoVo);
        } catch (Exception e) {
            e.printStackTrace();
        }
        result.put("ecode", "200");
        result.put("enote", "OK");
        return result;
    }

    @PostMapping({"/recv/upload"})
    @ResponseBody
    public Object upload(VideoVo videoVo) {
        Map<Object, Object> result = new HashMap<>(2);
        result.put("ecode", "200");
        result.put("enote", "OK");
        return result;
    }
}