yantian yue
2023-10-17 487b2f2a353b89ab46cd9b784226b600b7b915b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package cn.stylefeng.guns.modular.zsx.kb.formula.controller;
 
import cn.stylefeng.guns.modular.zsx.kb.utils.IPUtil;
import cn.stylefeng.guns.modular.zsx.pm.salesOrder.service.SalesOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
 
import javax.servlet.http.HttpServletRequest;
import java.net.*;
import java.util.Enumeration;
import java.util.Set;
 
 
@Controller
@RequestMapping("/kb/formulaView")
public class FormulaKbController {
    private String PREFIX = "/modular/kb/formula";
 
    /**
     * 跳转到主页面
     *
     * @author ruimin
     * @Date 2023-08-26
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/formulaView.html";
    }
 
    public static void main(String[] args) {
        try {
            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            while (networkInterfaces.hasMoreElements()) {
                NetworkInterface networkInterface = networkInterfaces.nextElement();
                Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
                while (inetAddresses.hasMoreElements()) {
                    InetAddress inetAddress = inetAddresses.nextElement();
                    if (inetAddress instanceof Inet4Address) { // 过滤IPv4地址
                        System.out.println(inetAddress.getHostAddress());
                    }
                }
            }
        } catch (SocketException e) {
            throw new RuntimeException(e);
        }
    }
}