管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-14 616db59ed7fce7f0b4332c6d61e4fb3f173390f3
1
已添加2个文件
已修改4个文件
293 ■■■■■ 文件已修改
src/main/java/com/lf/server/config/InitConfig.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/other/FloatServerController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/show/ReqParamFloatServer.java 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/helper/HttpHelper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/helper/LicHelper.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
说明.txt 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/config/InitConfig.java
@@ -1,5 +1,6 @@
package com.lf.server.config;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
@@ -8,10 +9,8 @@
import com.lf.server.entity.all.PermsAuthEntity;
import com.lf.server.entity.all.ResAuthEntity;
import com.lf.server.entity.bd.DlgAgnpEntity;
import com.lf.server.helper.AesHelper;
import com.lf.server.helper.FileHelper;
import com.lf.server.helper.GdalHelper;
import com.lf.server.helper.PathHelper;
import com.lf.server.entity.show.ReqParamFloatServer;
import com.lf.server.helper.*;
import com.lf.server.mapper.bd.DlgAgnpMapper;
import com.lf.server.service.all.BaseQueryService;
import com.lf.server.service.all.PermsService;
@@ -79,6 +78,7 @@
            //boolean f2 = ZipHelper.zip("D:\\LF\\data\\res.zip", "D:\\LF\\data\\unzip\\resources");
            //boolean f3 = Zip4jHelper.zip("D:\\LF\\data\\zip\\resources.zip", "D:\\LF\\data\\zip\\resources", "12345");
            //boolean f4 = Zip4jHelper.unzip("D:\\LF\\data\\zip\\resources.zip", "D:\\LF\\data\\zip\\res", "12345");
            //testFloatServer();
            // åˆå§‹åŒ–
            GdalHelper.init();
@@ -185,4 +185,20 @@
        blacklistService.clearCache();
        List<String> list5 = blacklistService.selectIpList(1);
    }
    private void testFloatServer() {
        try {
            ReqParamFloatServer reqParam = new ReqParamFloatServer("192.168.20.106", "12316");
            String json = JSON.toJSONString(reqParam);
            LicHelper helper = new LicHelper();
            helper.d("&kdaow$IEW.##%5-");
            helper.c("*y91z72a;pclfleoqc20161v$DSP&%3+");
            String str = helper.a(json);
            System.out.println("ReqParamFloatServer: " + str);
        } catch (Exception ex) {
            //
        }
    }
}
src/main/java/com/lf/server/controller/other/FloatServerController.java
@@ -9,6 +9,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * FloatServer
 * @author WWW
 */
@Api(tags = "FloatServer")
@RestController
@RequestMapping("/floatserver")
@@ -16,10 +20,14 @@
    @RequestMapping({"/checkout/license"})
    public void license(HttpServletRequest req, HttpServletResponse res) {
        try {
            HttpHelper httpHelper = new HttpHelper();
            httpHelper.service(req, res, "http://192.168.20.43:38080/floatserver/checkout/license", null);
        } catch (Exception ex) {
            if (false) {
                HttpHelper httpHelper = new HttpHelper();
                httpHelper.service(req, res, "http://192.168.20.43:38080/floatserver/checkout/license", null);
            }
            res.getWriter().write("8dfb75298185cbcc4b2d485fdb4f25627f7aeb4dd41329076b5015586e4d56cfe2c56f12cd9852c447904210117b41fe2672b24d7e82fd581ad5a0983b501b5bcbe97d65dbbe770dbdc4a98e80d2966a71ecd0041a5282283bff853d70caf7aed671bc9c9d4bedf6d1d0294394861af40f195d68a965d957d53c78aa50ada3afc65d1a526c54648e6e081e8f7f7ab1c31b9f75916170e638b0b9216d30204864afe3a7a1bc8a6563bf44daf6a29e27c19f798c4f82dbb904ea4aa4fcc87a82226d9bf3e891ecb97b94263064fec025e3aa7c440d7c0e8ed559b84ae2438ec0fc438444a03c992883170ecdde20e08552efcf9d584de469930b27c81f946548d5c6e63e815671182b03b5e6e622ddb10a3f6a35ad3f44ec247a3b2dee0e936020d48efb7abc2d2abfb555f61d54c85eca");
        } catch (Exception ex) {
            //
        }
    }
}
src/main/java/com/lf/server/entity/show/ReqParamFloatServer.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,138 @@
package com.lf.server.entity.show;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
/**
 * ReqParamFloatServer
 * @author WWW
 */
public class ReqParamFloatServer {
    private String id;
    private String port;
    private String modules;
    private int availableNum;
    private long time;
    private String localId;
    private String cmdType;
    public ReqParamFloatServer() {
        this.localId = a();
    }
    public ReqParamFloatServer(String id,String port) {
        this.id = id;
        this.port = port;
        this.localId = a();
    }
    public String getPort() {
        return this.port;
    }
    public void setPort(final String port) {
        this.port = port;
    }
    public String getId() {
        return this.id;
    }
    public void setId(final String id) {
        this.id = id;
    }
    public String getModules() {
        return this.modules;
    }
    public void setModules(final String modules) {
        this.modules = modules;
    }
    public int getAvailableNum() {
        return this.availableNum;
    }
    public void setAvailableNum(final int availableNum) {
        this.availableNum = availableNum;
    }
    public long getTime() {
        return this.time;
    }
    public void setTime(final long time) {
        this.time = time;
    }
    public String getLocalId() {
        return this.localId;
    }
    public String getCmdType() {
        return this.cmdType;
    }
    public void setCmdType(final String cmdType) {
        this.cmdType = cmdType;
    }
    public static String a() {
        String string = "";
        try {
            final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            while (networkInterfaces.hasMoreElements()) {
                final NetworkInterface networkInterface;
                if (!(networkInterface = networkInterfaces.nextElement()).isLoopback() && !networkInterface.isVirtual() && networkInterface.isUp()) {
                    final Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
                    final byte[] hardwareAddress;
                    if ((hardwareAddress = networkInterface.getHardwareAddress()) == null || networkInterface.getName().contains("docker")) {
                        continue;
                    }
                    while (inetAddresses.hasMoreElements()) {
                        final InetAddress inetAddress;
                        if ((inetAddress = inetAddresses.nextElement()) != null && inetAddress instanceof Inet4Address) {
                            final String a = a(inetAddress);
                            string = String.valueOf(inetAddress.getHostAddress()) + "|" + a;
                            if (!a.isEmpty()) {
                                return string;
                            }
                            continue;
                        }
                    }
                }
            }
        } catch (SocketException ex) {
            //
        }
        return string;
    }
    private static String a(final InetAddress addr) {
        String upperCase = "";
        try {
            final byte[] hardwareAddress = NetworkInterface.getByInetAddress(addr).getHardwareAddress();
            final StringBuffer sb = new StringBuffer("");
            for (int i = 0; i < hardwareAddress.length; ++i) {
                if (i != 0) {
                    sb.append("-");
                }
                final String hexString;
                if ((hexString = Integer.toHexString(hardwareAddress[i] & 0xFF)).length() == 1) {
                    sb.append("0".concat(String.valueOf(hexString)));
                } else {
                    sb.append(hexString);
                }
            }
            upperCase = sb.toString().toUpperCase();
        } catch (Exception ex) {
            //
        }
        return upperCase;
    }
}
src/main/java/com/lf/server/helper/HttpHelper.java
@@ -101,6 +101,7 @@
        String method = request.getMethod();
        HttpEntityEnclosingRequest proxyRequest = new BasicHttpEntityEnclosingRequest(method, url);
        proxyRequest.setEntity(new InputStreamEntity(request.getInputStream(), getContentLength(request)));
        //String str = EntityUtils.toString(proxyRequest.getEntity(), "UTF-8")
        return proxyRequest;
    }
@@ -269,6 +270,7 @@
    protected void copyResponseEntity(HttpResponse proxyResponse, HttpServletResponse response) throws IOException {
        HttpEntity entity = proxyResponse.getEntity();
        if (entity != null) {
            //String str = EntityUtils.toString(entity, "UTF-8")
            OutputStream servletOutputStream = response.getOutputStream();
            entity.writeTo(servletOutputStream);
        }
src/main/java/com/lf/server/helper/LicHelper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,105 @@
package com.lf.server.helper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.Charset;
/**
 * è®¸å¯å¸®åŠ©ç±»
 * @author WWW
 */
public class LicHelper {
    private String a;
    private String b;
    private static String c;
    private static String d;
    private static String e;
    private static final Logger f;
    static {
        c = "utf-8";
        d = "AES";
        e = "AES/CBC/PKCS5Padding";
        f = LoggerFactory.getLogger(LicHelper.class);
    }
    private IvParameterSpec a() {
        try {
            return new IvParameterSpec(this.b.getBytes(c));
        } catch (Exception ex) {
            return null;
        }
    }
    public final String a(final String s) {
        String str = null;
        try {
            // final Cipher instance
            // (instance = Cipher.getInstance(e)).init(1, new SecretKeySpec(this.a.getBytes(c), d), this.a())
            // str = a(instance.doFinal(s.getBytes(Charset.forName(c))))
            Cipher instance = Cipher.getInstance(e);
            IvParameterSpec ips = this.a();
            SecretKeySpec sks = new SecretKeySpec(this.a.getBytes(c), d);
            instance.init(1, sks, ips);
            byte[] bytes = s.getBytes(Charset.forName(c));
            str = a(instance.doFinal(bytes));
        } catch (Exception ex) {
            System.out.println(ex.getStackTrace());
        }
        return str;
    }
    public final String b(final String s) {
        String s2 = null;
        try {
            final Cipher instance;
            (instance = Cipher.getInstance(e)).init(2, new SecretKeySpec(this.a.getBytes(c), d), this.a());
            s2 = new String(instance.doFinal(this.e(s)), c);
        } catch (Exception ex) {
            //
        }
        return s2;
    }
    private static String a(final byte[] array) {
        final StringBuilder sb = new StringBuilder();
        for (int i = 0; i < array.length; ++i) {
            final String hexString;
            if ((hexString = Integer.toHexString(array[i] & 0xFF)).length() < 2) {
                sb.append("0");
            }
            sb.append(hexString);
        }
        return sb.toString();
    }
    private byte[] e(String upperCase) {
        final int n = (upperCase = upperCase.toUpperCase()).length() / 2;
        final char[] charArray = upperCase.toCharArray();
        final byte[] array = new byte[n];
        for (int i = 0; i < n; ++i) {
            final int n2 = i << 1;
            array[i] = (byte) ((byte) "0123456789ABCDEF".indexOf(charArray[n2]) << 4 | (byte) "0123456789ABCDEF".indexOf(charArray[n2 + 1]));
        }
        return array;
    }
    public final void c(String string) {
        final String substring = (string = string).substring(2, 5);
        final StringBuilder sb;
        (sb = new StringBuilder(string)).replace(2, 5, string.substring(7, 10));
        sb.replace(7, 10, substring);
        string = sb.toString();
        this.a = string;
    }
    public final void d(final String b) {
        this.b = b;
    }
}
˵Ã÷.txt
@@ -146,6 +146,16 @@
  è¡¨å•校验:validator
private static final String SQLSERVER_URL = "jdbc:sqlserver://192.168.0.77\\ZKZS;databaseName=xian";
---------------------------------------------------------------------------------------------------- floatserver
http://localhost:12316/floatserver/checkout/license
String str = EntityUtils.toString(entity, "UTF-8");
请求:
8dfb75298185cbcc4b2d485fdb4f25627f7aeb4dd41329076b5015586e4d56cf755f0dfd19be0d80e2573e0a2a22edca35215b390607b0ff68deab90c69296df60934315036bd8a64ee668a39502754b701be7534d0ca2e790161194d673d9454c44c570a1dbe604ac5952be731ca15809f9f4d43ad1b023f69981ce77abacc50e8e5217627eb236d5f6d114e00585d9a597f3a195b0b0c0ff8cf1e2445ca12e
响应:
8dfb75298185cbcc4b2d485fdb4f25627f7aeb4dd41329076b5015586e4d56cfe2c56f12cd9852c447904210117b41fe2672b24d7e82fd581ad5a0983b501b5bcbe97d65dbbe770dbdc4a98e80d2966a71ecd0041a5282283bff853d70caf7aed671bc9c9d4bedf6d1d0294394861af40f195d68a965d957d53c78aa50ada3afc65d1a526c54648e6e081e8f7f7ab1c31b9f75916170e638b0b9216d30204864afe3a7a1bc8a6563bf44daf6a29e27c19f798c4f82dbb904ea4aa4fcc87a82226d9bf3e891ecb97b94263064fec025e3aa7c440d7c0e8ed559b84ae2438ec0fc438444a03c992883170ecdde20e08552efcf9d584de469930b27c81f946548d5c6e63e815671182b03b5e6e622ddb10a3f6a35ad3f44ec247a3b2dee0e936020d48efb7abc2d2abfb555f61d54c85eca
{"machineId":"dba5c0f908f92fbdb6f0a3f58a5a3193","isRegistered":true,"registeredModules":[1,3,4,9,10,11,12,13,17,25,30,33,37],"modules":[{"id":1,"name":"wms","group":"GISServer","title":"动态地图服务"},{"id":3,"name":"tms","group":"GISServer","title":"瓦片地图服务"},{"id":9,"name":"wfs","group":"GISServer","title":"要素服务"},{"id":12,"name":"wns","group":"GISServer","title":"网络分析服务"},{"id":13,"name":"geocode","group":"GISServer","title":"地理编码服务"},{"id":17,"name":"wcs","group":"GISServer","title":"栅格服务"},{"id":25,"name":"c3d","group":"GISServer","title":"三维模型服务"},{"id":30,"name":"cts","group":"GISServer","title":"三维地形服务"},{"id":33,"name":"cimservice","group":"CIMSuite","title":"语义模型服务"},{"id":37,"name":"websdk","group":"WEBSDK","title":"WEBSDK"},{"id":38,"name":"pw","group":"Parallelworld","title":" Parallelworld"},{"id":50,"name":"ext","group":"extension","title":"extension"}],"expireDate":1668486201730,"isFloating":true,"floatServerIp":"192.168.20.106","floatServerPort":12316,"message":"OK","success":true}
------------------------------------------------------------------------------------------------ æƒé™
管道基础大数据平台:           åˆ é™¤
综合展示\综合展示\查询:       ä¸‹è½½ã€ä¸Šä¼