kongdeqiang
8 天以前 c5d77a67a20575dc9754dec40947ad652376f0cc
src/main/java/com/wgcloud/controller/dp/DpController.java
@@ -2,13 +2,16 @@
import com.wgcloud.entity.OspfErrorLog;
import com.wgcloud.entity.OspfInfo;
import com.wgcloud.entity.OspfMonitor;
import com.wgcloud.entity.SnmpInfo;
import com.wgcloud.service.OspfErrorLogService;
import com.wgcloud.service.OspfInfoService;
import com.wgcloud.service.OspfMonitorService;
import com.wgcloud.service.SnmpInfoService;
import com.wgcloud.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -29,6 +32,8 @@
    @Autowired
    private OspfInfoService ospfInfoService;
    @Autowired
    private OspfMonitorService ospfMonitorService;
    @Autowired
    private OspfErrorLogService ospfErrorLogService;
@@ -54,14 +59,12 @@
    @GetMapping("/getWb")
    public R getWb() throws Exception {
        List<Map<String,Object>> list = new ArrayList<>();
        List<OspfInfo> ospfInfos = ospfInfoService.selectAllByParams(null);
        for (OspfInfo ospfInfo : ospfInfos) {
        List<OspfMonitor> ospfMonitors = ospfMonitorService.selectAllByParams(null);
        for (OspfMonitor ospfInfo : ospfMonitors) {
            HashMap<String, Object> map = new HashMap<>();
            map.put("name",ospfInfo.getInfoContent());
            map.put("ipaddress",ospfInfo.getHostname());
            map.put("type",1);
            map.put("status",1);
            map.put("remoteType",ospfInfo.getRemoteType());
            list.add(map);
        }
        return R.ok(list);
@@ -84,6 +87,7 @@
            HashMap<String, Object> map = new HashMap<>();
            map.put("date",sdf.format(ospfInfo.getCreateTime()));
            map.put("name",ospfInfo.getInfoContent());
            map.put("id",ospfInfo.getId());
            map.put("ipaddress",ospfInfo.getHostname());
            map.put("status",ospfInfo.getState());
            list.add(map);
@@ -114,8 +118,8 @@
        List<Map<String,Object>> list = new ArrayList<>();
        List<OspfInfo> ospfInfos = ospfInfoService.selectAllByParams(null);
        HashMap<String, Object> hxMap = new HashMap<>();
        hxMap.put("ipAddress","\n电信:192.168.1.1\n 联通:192.168.2.1\n 移动:192.168.3.1");
        hxMap.put("name","北国核心");
        hxMap.put("ipAddress","主监测设备IP");
        hxMap.put("name","主监测设备");
        hxMap.put("status","0");
        list.add(hxMap);
        for (OspfInfo ospfInfo : ospfInfos) {
@@ -128,5 +132,17 @@
        return R.ok(list);
    }
    @GetMapping("/handle")
    public R handle(String id) throws Exception {
        OspfErrorLog ospfErrorLog = ospfErrorLogService.selectById(id);
        if(ospfErrorLog.getState().equals("1")){
            ospfErrorLog.setState("0");
            ospfErrorLogService.updateById(ospfErrorLog);
            return R.ok();
        }else {
            return R.ok();
        }
    }
}