jiang
2022-08-18 8f77d0c25cdd37d4cc96c923b46ae28607bae51d
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
@@ -4,9 +4,12 @@
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.VManageBootstrap;
import com.genersoft.iot.vmp.common.VersionPo;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.VersionInfo;
import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe;
import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.service.IMediaServerService;
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
@@ -27,6 +30,7 @@
import javax.sip.SipProvider;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@SuppressWarnings("rawtypes")
@Api(tags = "服务控制")
@@ -36,19 +40,22 @@
public class ServerController {
    @Autowired
    private ConfigurableApplicationContext context;
    private ZLMHttpHookSubscribe zlmHttpHookSubscribe;
    @Autowired
    private IMediaServerService mediaServerService;
    @Autowired
    VersionInfo versionInfo;
    private VersionInfo versionInfo;
    @Autowired
    SipConfig sipConfig;
    private SipConfig sipConfig;
    @Autowired
    UserSetting userSetting;
    private UserSetting userSetting;
    @Autowired
    private DynamicTask dynamicTask;
    @Value("${server.port}")
    private int serverPort;
@@ -248,4 +255,47 @@
        result.setData(jsonObject);
        return result;
    }
    @ApiOperation("获取当前所有hook")
    @GetMapping(value = "/hooks")
    @ResponseBody
    public WVPResult<List<IHookSubscribe>> getHooks(){
        WVPResult<List<IHookSubscribe>> result = new WVPResult<>();
        result.setCode(0);
        result.setMsg("success");
        List<IHookSubscribe> all = zlmHttpHookSubscribe.getAll();
        result.setData(all);
        return result;
    }
//    @ApiOperation("当前进行中的动态任务")
//    @GetMapping(value = "/dynamicTask")
//    @ResponseBody
//    public WVPResult<JSONObject> getDynamicTask(){
//        WVPResult<JSONObject> result = new WVPResult<>();
//        result.setCode(0);
//        result.setMsg("success");
//
//        JSONObject jsonObject = new JSONObject();
//
//        Set<String> allKeys = dynamicTask.getAllKeys();
//        jsonObject.put("server.port", serverPort);
//        if (StringUtils.isEmpty(type)) {
//            jsonObject.put("sip", JSON.toJSON(sipConfig));
//            jsonObject.put("base", JSON.toJSON(userSetting));
//        }else {
//            switch (type){
//                case "sip":
//                    jsonObject.put("sip", sipConfig);
//                    break;
//                case "base":
//                    jsonObject.put("base", userSetting);
//                    break;
//                default:
//                    break;
//            }
//        }
//        result.setData(jsonObject);
//        return result;
//    }
}