package com.jiayue.ipfcst.console.controller;

import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
import com.jiayue.ipfcst.console.service.InspectionReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class InspectionReportController {
  @Autowired
  InspectionReportService inspectionReportService;

  @RequestMapping("/inspectionReport/get")
  public ResponseVO get(){
    System.out.println("进入。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。");
    Map<String,List<String>> check = inspectionReportService.check();

    List<String> list = check.get("ip");
//    List<String> list1 = check.get("ping");
//    List<String> list2 = check.get("nestat");

    for (String s : list) {
      System.out.println(s);
    }
//    for (String s : list1) {
//      System.out.println(s);
//    }
//    for (String s : list2) {
//      System.out.println(s);
//    }


    System.out.println("返回。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。");
    return ResponseVO.success(check);
  }


  @RequestMapping("/inspectionReport/getIp")
  public ResponseVO getIp(){
    return ResponseVO.success(inspectionReportService.checkIp());
  }

  @RequestMapping("/inspectionReport/getPing/{rmId}")
  public ResponseVO getPing(@PathVariable String rmId){
    return ResponseVO.success(inspectionReportService.checkPing(rmId));
  }

  @RequestMapping("/inspectionReport/getNetstat/{lcId}")
  public ResponseVO getNetstat(@PathVariable String lcId){
    return ResponseVO.success(inspectionReportService.checkNetstat(lcId));
  }

  @RequestMapping("/inspectionReport/getLsof/{lcId}")
  public ResponseVO getLsof(@PathVariable String lcId){
    return ResponseVO.success(inspectionReportService.checkLsof(lcId));
  }

}
