package com.weiqi.mis.contorller;

import com.weiqi.mis.SpAddr;
import com.weiqi.mis.StringUtils;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;

import java.net.InetAddress;
import java.util.*;


@Controller
//@LoginType
public class CheckController {



    /**
     * docker 验证使用
     *
     * @return
     */
    @RequestMapping(value = "/check")
    @ResponseBody
    public Object list() {

        return "success";
    }

    /**
     * docker 验证使用
     *
     * @return
     */
    @RequestMapping(value = "/mis/check")
    @ResponseBody
    public Object mislist() {

        return "mis success";
    }



    /**
     * docker 设置检查点
     *
     * @return
     */
    @RequestMapping(value = "/testdly")
    @ResponseBody
    public Object dly() {
        Map<String ,String > map = new HashMap<>();
        String path1 = this.getClass().getClassLoader().getResource("/").getPath();

        map.put("path1",path1);

        String jdlj = this.getClass().getClassLoader().getResource(".").getPath();
        map.put("jdlj",jdlj);


        if(SpAddr.path.equals("")){
            StringUtils.getPath(this.getClass().getClassLoader().getResource("/").getPath());
        }
        InetAddress ia=null;
        try {
            ia=ia.getLocalHost();

            String localname=ia.getHostName();
            String localip=ia.getHostAddress();
            System.out.println("本机名称是："+ localname);
            System.out.println("本机的ip是 ："+localip);
            map.put("localname",localname);
            map.put("localip",localip);
//            map.put("getLocalIPList", IPUtil.getLocalIPList().toString());
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }




        return map;
    }





}
