From 8f4d51938689a5ce77ca839b802f1c150faf8f2c Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 16 七月 2024 10:47:19 +0800
Subject: [PATCH] 初始化项目代码

---
 src/main/java/com/se/simu/helper/WebHelper.java           |  424 +++++++++++++++
 src/main/java/com/se/simu/helper/StringHelper.java        |  253 +++++++++
 src/test/java/com/se/simu/SimuApplicationTests.java       |   13 
 .gitignore                                                |   42 +
 src/main/java/com/se/simu/controller/WaterController.java |   25 
 src/main/java/com/se/simu/config/Knife4jConfig.java       |   69 ++
 src/main/resources/logback-spring.xml                     |  104 +++
 src/main/java/com/se/simu/SimuApplication.java            |   12 
 pom.xml                                                   |  133 ++++
 src/main/java/com/se/simu/config/InitConfig.java          |   46 +
 src/main/resources/application.yml                        |   26 
 src/main/java/com/se/simu/helper/FileHelper.java          |  444 ++++++++++++++++
 12 files changed, 1,580 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7e4646b..3323170 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,35 @@
-*.class
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
 
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
 
-# Package Files #
-*.jar
-*.war
-*.ear
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
 
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+/data
 /logs
-/.idea
-/target
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..24dec46
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.7.18</version>
+        <relativePath/>
+    </parent>
+
+    <groupId>com.se</groupId>
+    <artifactId>simu</artifactId>
+    <version>1.0.0</version>
+    <name>simuserver</name>
+    <description>鍐呮稘浠跨湡鏈嶅姟</description>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <!--web-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <!--lombok-->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <!--aop-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <!--mybatis-plus
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.5.7</version>
+        </dependency>-->
+        <!--redis-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <!--postgresql
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>-->
+        <!--鏁村悎druid鏁版嵁婧�
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>1.1.22</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.22</version>
+        </dependency>-->
+        <!--test-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <version>3.3.1</version>
+            <scope>test</scope>
+        </dependency>
+        <!--text-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-text</artifactId>
+            <version>1.12.0</version>
+        </dependency>
+        <!--hutool-->
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.8.29</version>
+        </dependency>
+        <!--httpclient-->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
+        <!--knife4j-->
+        <dependency>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>knife4j-spring-boot-starter</artifactId>
+            <version>3.0.3</version>
+        </dependency>
+        <!--fast-md5-->
+        <dependency>
+            <groupId>com.joyent.util</groupId>
+            <artifactId>fast-md5</artifactId>
+            <version>2.7.1</version>
+        </dependency>
+        <!--gdal-->
+        <dependency>
+            <groupId>org.gdal</groupId>
+            <artifactId>gdal</artifactId>
+            <version>3.9.0</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                        </exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/src/main/java/com/se/simu/SimuApplication.java b/src/main/java/com/se/simu/SimuApplication.java
new file mode 100644
index 0000000..144e60b
--- /dev/null
+++ b/src/main/java/com/se/simu/SimuApplication.java
@@ -0,0 +1,12 @@
+package com.se.simu;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.se.simu"})
+public class SimuApplication {
+	public static void main(String[] args) {
+		SpringApplication.run(SimuApplication.class, args);
+	}
+}
diff --git a/src/main/java/com/se/simu/config/InitConfig.java b/src/main/java/com/se/simu/config/InitConfig.java
new file mode 100644
index 0000000..9b9ed0b
--- /dev/null
+++ b/src/main/java/com/se/simu/config/InitConfig.java
@@ -0,0 +1,46 @@
+package com.se.simu.config;
+
+import com.se.simu.helper.WebHelper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * 鍒濆鍖栭厤缃被
+ *
+ * @author WWW
+ * @date 2024-07-16
+ */
+@Slf4j
+@Component
+public class InitConfig implements ApplicationRunner {
+    @Resource
+    Environment env;
+
+    @Value("${server.port}")
+    String serverPort;
+
+    @Value("${server.servlet.context-path}")
+    String contextPath;
+
+    @Override
+    public void run(ApplicationArguments args) {
+        // noinspection AlibabaRemoveCommentedCode
+        try {
+            //GdalHelper.init(env.getProperty("sys.gdal_path"));
+
+            log.info("***************** 绯荤粺鍚姩瀹屾瘯 *****************" + "\n");
+
+            String path = null != contextPath && contextPath.length() > 1 ? contextPath : "";
+            log.info("API鏂囨。:http://localhost:" + serverPort + path + "/doc.html");
+            log.info("API鏂囨。:http://{}:{}{}/doc.html", WebHelper.getHostIp(), serverPort, path);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+        }
+    }
+}
diff --git a/src/main/java/com/se/simu/config/Knife4jConfig.java b/src/main/java/com/se/simu/config/Knife4jConfig.java
new file mode 100644
index 0000000..a1468a4
--- /dev/null
+++ b/src/main/java/com/se/simu/config/Knife4jConfig.java
@@ -0,0 +1,69 @@
+package com.se.simu.config;
+
+import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+
+/**
+ * Knife4j閰嶇疆绫�
+ *
+ * @author WWW
+ * @date 2024-07-16
+ */
+@Configuration
+@EnableKnife4j
+public class Knife4jConfig {
+    @Value("${server.port}")
+    String serverPort;
+
+    @Value("${knife4j.enabled}")
+    private boolean enabled;
+
+    @Value("${knife4j.pathMapping}")
+    private String pathMapping;
+
+    @Value("${server.servlet.context-path}")
+    String contextPath;
+
+    @Bean
+    public Docket createRestApi() {
+        return new Docket(new DocumentationType("openApi", "3.0"))
+                // 鏄惁鍚敤Swagger
+                .enable(enabled)
+                // 鐢ㄦ潵鍒涘缓璇PI鐨勫熀鏈俊鎭紝灞曠ず鍦ㄦ枃妗g殑椤甸潰涓紙鑷畾涔夊睍绀虹殑淇℃伅锛�
+                .apiInfo(apiInfo())
+                // 鍒嗙粍鍚嶇О
+                .groupName("鏈嶅姟")
+                // 璁剧疆鍝簺鎺ュ彛鏆撮湶缁橲wagger灞曠ず
+                .select()
+                // 鎵弿鎵�鏈夋湁娉ㄨВ鐨刟pi锛岀敤杩欑鏂瑰紡鏇寸伒娲�
+                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
+                // 鎵弿鎸囧畾鍖呬腑鐨剆wagger娉ㄨВ
+                // .apis(RequestHandlerSelectors.basePackage("com.cn.project.tool.swagger"))
+                // 鎵弿鎵�鏈� .apis(RequestHandlerSelectors.any())
+                .paths(PathSelectors.any())
+                .build()
+                /* 璁剧疆瀹夊叏妯″紡锛宻wagger鍙互璁剧疆璁块棶token */
+                // .securitySchemes(securitySchemes())
+                .pathMapping(pathMapping);
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder()
+                //鎻忚堪瀛楁鏀寔Markdown璇硶
+                .description("鎺ュ彛鏂囨。")
+                .contact(new Contact("WuWeiwei", "http://127.0.0.1:" + serverPort + contextPath + "/doc.html", "252740454@qq.com"))
+                .version("1.0.0")
+                .title("鍐呮稘浠跨湡娓叉煋鏈嶅姟API鎺ュ彛鏂囨。")
+                .build();
+    }
+}
diff --git a/src/main/java/com/se/simu/controller/WaterController.java b/src/main/java/com/se/simu/controller/WaterController.java
new file mode 100644
index 0000000..03e3a8f
--- /dev/null
+++ b/src/main/java/com/se/simu/controller/WaterController.java
@@ -0,0 +1,25 @@
+package com.se.simu.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 鍐呮稘鎺у埗鍣�
+ *
+ * @author WWW
+ * @date   2024-07-16
+ */
+@Api(tags = "鍐呮稘绠$悊")
+@RestController
+@RequestMapping("/waterlogging")
+public class WaterController {
+    @ApiOperation(value = "鑾峰彇褰撳墠鏃堕棿")
+    @GetMapping("/getTime")
+    public Object getTime() {
+        return System.currentTimeMillis();
+    }
+
+}
diff --git a/src/main/java/com/se/simu/helper/FileHelper.java b/src/main/java/com/se/simu/helper/FileHelper.java
new file mode 100644
index 0000000..1b142a4
--- /dev/null
+++ b/src/main/java/com/se/simu/helper/FileHelper.java
@@ -0,0 +1,444 @@
+package com.se.simu.helper;
+
+import com.twmacinta.util.MD5;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.digest.DigestUtils;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.text.DecimalFormat;
+import java.util.List;
+
+/**
+ * 鏂囦欢甯姪绫�
+ * 
+ * @author WWW
+ * @date 2024-07-16
+ */
+@Slf4j
+public class FileHelper {
+    public final static String POINT = ".";
+
+    public final static int I16 = 16;
+
+    public static final double D1024 = 1024.0;
+
+    public static final double D1050 = 1050.0;
+
+    public final static int I1000000 = 1000000;
+
+    public static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+    /**
+     * 鑾峰彇鏂囦欢鍚�
+     */
+    public static String getFileName(String file) {
+        int idx = file.lastIndexOf(File.separator);
+        if (idx > -1) {
+            return file.substring(idx + 1);
+        }
+
+        return "";
+    }
+
+    /**
+     * 鑾峰彇鏂囦欢鍚嶇О
+     */
+    public static String getName(String file) {
+        String fileName = getFileName(file);
+        int idx = fileName.lastIndexOf(".");
+        if (idx > -1) {
+            return fileName.substring(0, idx);
+        }
+
+        return fileName;
+    }
+
+    /**
+     * 鑾峰彇鏂囦欢鎵╁睍鍚�
+     */
+    public static String getExtension(File file) {
+        if (file == null) {
+            return null;
+        }
+
+        String fileName = file.getName().toLowerCase();
+
+        int idx = fileName.indexOf(POINT);
+        if (idx == -1) {
+            return "";
+        }
+
+        return fileName.substring(idx);
+    }
+
+    /**
+     * 鑾峰彇鏂囦欢鎵╁睍鍚�
+     */
+    public static String getExtension(String fileName) {
+        if (StringHelper.isEmpty(fileName)) {
+            return "";
+        }
+
+        int idx = fileName.lastIndexOf(POINT);
+        if (idx == -1) {
+            return "";
+        }
+
+        return fileName.substring(idx).toLowerCase();
+    }
+
+    /**
+     * 鑾峰彇澶氱敤閫斾簰鑱旂綉閭欢鎵╁睍绫诲瀷
+     */
+    public static String getMime(String ext) {
+        switch (ext) {
+            // 鍥剧墖
+            case ".tif":
+            case ".tiff":
+                return "image/tiff";
+            case ".img":
+                return "application/x-img";
+            case ".gif":
+                return "image/gif";
+            case ".jpg":
+            case ".jpeg":
+                return "image/jpeg";
+            case ".png":
+                return "image/png";
+            // 闊�/瑙嗛
+            case ".mp3":
+                return "audio/mp3";
+            case ".mp4":
+                return "video/mpeg4";
+            case ".avi":
+                return "video/avi";
+            case ".mpg":
+            case ".mpeg":
+                return "video/mpg";
+            case ".wav":
+                return "audio/wav";
+            case ".wma":
+                return "audio/x-ms-wma";
+            case ".swf":
+                return "application/x-shockwave-flash";
+            case ".wmv":
+                return "video/x-ms-wmv";
+            case ".rm":
+                return "application/vnd.rn-realmedia";
+            case ".rmvb":
+                return "application/vnd.rn-realmedia-vbr";
+            // 缃戦〉
+            case ".js":
+                return "application/x-javascript";
+            case ".css":
+                return "text/css";
+            case ".asp":
+                return "text/asp";
+            case ".mht":
+                return "message/rfc822";
+            case ".jsp":
+            case ".htm":
+            case ".html":
+            case ".xhtml":
+                return "text/html";
+            case ".xml":
+            case ".svg":
+                return "text/xml";
+            // 鏂囦欢
+            case ".txt":
+                return "text/plain";
+            case ".dbf":
+                return "application/x-dbf";
+            case ".mdb":
+                return "application/msaccess";
+            case ".pdf":
+                return "application/pdf";
+            case ".ppt":
+            case ".pptx":
+                return "application/x-ppt";
+            case ".doc":
+            case ".docx":
+                return "application/msword";
+            case ".xls":
+            case ".xlsx":
+                return "application/vnd.ms-excel";
+            case ".dgn":
+                return "application/x-dgn";
+            case ".dwg":
+                return "application/x-dwg";
+            case ".ext":
+                return "application/x-msdownload";
+            // 榛樿
+            default:
+                return "application/octet-stream";
+        }
+    }
+
+    /**
+     * 瀛楄妭鍗曚綅鎹㈢畻
+     */
+    public static String formatByte(long byteNumber) {
+        double kbNumber = byteNumber / D1024;
+        if (kbNumber < D1024) {
+            return new DecimalFormat("#.##KB").format(kbNumber);
+        }
+        double mbNumber = kbNumber / D1024;
+        if (mbNumber < D1024) {
+            return new DecimalFormat("#.##MB").format(mbNumber);
+        }
+        double gbNumber = mbNumber / D1024;
+        if (gbNumber < D1024) {
+            return new DecimalFormat("#.##GB").format(gbNumber);
+        }
+        double tbNumber = gbNumber / D1024;
+
+        return new DecimalFormat("#.##TB").format(tbNumber);
+    }
+
+    /**
+     * 鑾峰彇骞虫柟绫�
+     */
+    public static String getSquareMeter(double num) {
+        if (num < I1000000) {
+            return new DecimalFormat("#.##骞虫柟绫�").format(num);
+        }
+
+        double knum = num / I1000000;
+
+        return new DecimalFormat("#.##骞虫柟鍗冪背").format(knum);
+    }
+
+    /**
+     * byte杞琈B
+     */
+    public static double sizeToMb(long size) {
+        if (size < D1050) {
+            return 0.001;
+        }
+
+        String str = String.format("%.3f", size / D1024 / D1024);
+
+        return Double.parseDouble(str);
+    }
+
+    /**
+     * 3.鑾峰彇鏂囦欢MD5鐮侊紙JDK锛�
+     */
+    public static String getMd5ByJdk(String filePath) throws IOException {
+        FileInputStream fileStream = new FileInputStream(filePath);
+        String md5 = DigestUtils.md5Hex(fileStream);
+        fileStream.close();
+
+        return md5;
+    }
+
+    /**
+     * 2.鑾峰彇蹇�� MD5 鐮�
+     */
+    public static String getFastMd5(String filePath) throws IOException {
+        String hash = MD5.asHex(MD5.getHash(new File(filePath)));
+
+        MD5 md5 = new MD5();
+        md5.Update(hash, null);
+
+        return md5.asHex();
+    }
+
+    /**
+     * 鍒犻櫎鏂囦欢澶�
+     *
+     * @param dir 鏂囦欢澶�
+     */
+    public static void deleteDir(String dir) {
+        File file = new File(dir);
+
+        deleteFiles(file);
+    }
+
+    /**
+     * 绾ц仈鍒犻櫎鏂囦欢
+     *
+     * @param file 鏂囦欢
+     */
+    public static void deleteFiles(File file) {
+        if (null == file || !file.exists()) {
+            return;
+        }
+
+        if (file.isDirectory()) {
+            File[] files = file.listFiles();
+            if (null != files && files.length > 0) {
+                for (File f : files) {
+                    if (f.isDirectory()) {
+                        deleteFiles(f);
+                    } else {
+                        f.delete();
+                    }
+                }
+            }
+        }
+
+        file.delete();
+    }
+
+    /**
+     * 鑾峰彇鐩稿璺緞
+     *
+     * @param file 鏂囦欢
+     * @return 鐩稿璺緞
+     */
+    public static String getRelativePath(String file) {
+        if (StringHelper.isEmpty(file)) {
+            return null;
+        }
+
+        int idx = file.lastIndexOf(File.separator);
+        int start = file.lastIndexOf(File.separator, idx - 1);
+
+        return file.substring(start + 1);
+    }
+
+    /**
+     * 鑾峰彇璺緞
+     *
+     * @param file 鏂囦欢
+     * @return 鏂囦欢璺緞
+     */
+    public static String getPath(String file) {
+        if (StringHelper.isEmpty(file)) {
+            return null;
+        }
+
+        int end = file.lastIndexOf(File.separator);
+
+        return file.substring(0, end);
+    }
+
+    /**
+     * 1.鑾峰彇鏂囦欢鐨凪D5
+     */
+    @SuppressWarnings("unused")
+    public static String getFileMd5(String filePath) {
+        FileInputStream fis = null;
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+
+            fis = new FileInputStream(new File(filePath));
+            FileChannel fChannel = fis.getChannel();
+            ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 1024);
+
+            while (fChannel.read(buffer) != -1) {
+                buffer.flip();
+                md.update(buffer);
+                buffer.compact();
+            }
+            byte[] b = md.digest();
+
+            return byteToHexString(b);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return null;
+        } finally {
+            try {
+                if (null != fis) {
+                    fis.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * 瀛楄妭鐮佽浆16杩涘埗
+     */
+    public static String byteToHexString(byte[] tmp) {
+        // 姣忎釜瀛楄妭鐢� 16 杩涘埗琛ㄧず鐨勮瘽锛屼娇鐢ㄤ袱涓瓧绗︼紝
+        char[] str = new char[16 * 2];
+
+        // 鎵�浠ヨ〃绀烘垚 16 杩涘埗闇�瑕� 32 涓瓧绗︼紝琛ㄧず杞崲缁撴灉涓搴旂殑瀛楃浣嶇疆
+        int k = 0;
+        // 浠庣涓�涓瓧鑺傚紑濮嬶紝瀵� MD5 鐨勬瘡涓�涓瓧鑺�
+        for (int i = 0; i < I16; i++) {
+            // 杞崲鎴� 16 杩涘埗瀛楃鐨勮浆鎹�
+            byte byte0 = tmp[i];
+            // 鍙栧瓧鑺備腑楂� 4 浣嶇殑鏁板瓧杞崲
+            str[k++] = HEX_DIGITS[byte0 >>> 4 & 0xf];
+            // >>> 涓洪�昏緫鍙崇Щ锛屽皢绗﹀彿浣嶄竴璧峰彸绉伙紝 鍙栧瓧鑺備腑浣� 4 浣嶇殑鏁板瓧杞崲
+            str[k++] = HEX_DIGITS[byte0 & 0xf];
+        }
+        // 鎹㈠悗鐨勭粨鏋滆浆鎹负瀛楃涓�
+        return new String(str);
+    }
+
+    /**
+     * 鑾峰彇瀛楃涓茬殑MD5鐮�
+     */
+    public static String getStringMd5(String text) {
+        StringBuilder builder = new StringBuilder();
+        try {
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
+
+            byte[] bytes = md5.digest(text.getBytes(StandardCharsets.UTF_8));
+            for (byte aByte : bytes) {
+                builder.append(Integer.toHexString((0x000000FF & aByte) | 0xFFFFFF00).substring(6));
+            }
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+        }
+
+        return builder.toString();
+    }
+
+    /**
+     * 鏍规嵁璺緞鑾峰彇鏂囦欢
+     */
+    public static void getFilesByPath(List<String> list, String path) {
+        File file = new File(path);
+        if (file.isDirectory()) {
+            File[] files = file.listFiles();
+            if (null == files) {
+                return;
+            }
+
+            for (File f : files) {
+                if (f.isDirectory()) {
+                    getFilesByPath(list, f.getPath());
+                } else {
+                    list.add(f.getPath());
+                }
+            }
+        } else {
+            list.add(file.getPath());
+        }
+    }
+
+    /**
+     * 澶嶅埗鏂囦欢
+     *
+     * @param src  婧愭枃浠�
+     * @param dest 鐩綍鏂囦欢
+     */
+    public static void copyFile(File src, File dest) throws IOException {
+        InputStream is = null;
+        OutputStream os = null;
+        try {
+            is = new FileInputStream(src);
+            os = new FileOutputStream(dest);
+
+            byte[] buffer = new byte[1024];
+
+            int length;
+            while ((length = is.read(buffer)) > 0) {
+                os.write(buffer, 0, length);
+            }
+        } finally {
+            os.close();
+            is.close();
+        }
+    }
+}
diff --git a/src/main/java/com/se/simu/helper/StringHelper.java b/src/main/java/com/se/simu/helper/StringHelper.java
new file mode 100644
index 0000000..cd22752
--- /dev/null
+++ b/src/main/java/com/se/simu/helper/StringHelper.java
@@ -0,0 +1,253 @@
+package com.se.simu.helper;
+
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 瀛楃涓插府鍔╃被
+ *
+ * @author WWW
+ * @date 2024-07-16
+ */
+public class StringHelper {
+    public final static String COMMA = ",";
+
+    public final static String PWD_REG = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![a-z0-9]+$)(?![a-z\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![0-9\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)[a-zA-Z0-9\\W!@#$%^&*`~()\\-_+=,.?;<>]{12,20}$";
+
+    /**
+     * 鏁板瓧姝e垯
+     */
+    public static final Pattern NUMBER_PATTERN = Pattern.compile("-?\\d+(\\.\\d+)?");
+
+    /**
+     * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 1
+     */
+    public static final SimpleDateFormat YMD_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
+
+    /**
+     * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 2
+     */
+    public static final SimpleDateFormat YMDHMS_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+    /**
+     * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 3
+     */
+    public static final SimpleDateFormat YMD2_FORMAT = new SimpleDateFormat("yyyyMMdd");
+
+    /**
+     * 鏍煎紡鍖栧綋鍓嶇郴缁熸棩鏈� 4
+     */
+    public static final SimpleDateFormat YMDHMS2_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss");
+
+    /**
+     * 鍒ゆ柇瀛楃涓�,鏄惁涓烘暣鏁�
+     */
+    public static boolean isInteger(String str) {
+        return str != null && str.matches("[0-9]+");
+    }
+
+    /**
+     * 鍒ゆ柇瀛楃涓�,鏄惁涓烘诞鐐规暟
+     */
+    public static boolean isNumeric(String str) {
+        return str != null && str.matches("-?\\d+(\\.\\d+)?");
+    }
+
+    /**
+     * 鍒ゆ柇瀛楃涓�,鏄惁涓烘诞鐐规暟
+     */
+    public static boolean isNumeric2(String str) {
+        return str != null && NUMBER_PATTERN.matcher(str).matches();
+    }
+
+    /**
+     * 鏃ユ湡姝e垯
+     */
+    public static Pattern datePattern = Pattern.compile("^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/]((((0?[13578])|(1[02]))[\\-\\/]((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/]((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/]((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/]((((0?[13578])|(1[02]))[\\-\\/]((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/]((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/]((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s(((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$");
+
+    /**
+     * SQL姝e垯
+     */
+    public static Pattern sqlPattern = Pattern.compile("|and|exec|execute|insert|select|delete|update|count|drop|\\*|%|chr|mid|master|truncate|char|declare|sitename|net user|xp_cmdshell|;|or|-|\\+|,|like");
+
+    /**
+     * 瀛楃涓茶浆涓烘棩鏈�
+     */
+    public static Date parseDate(String str) {
+        try {
+            return YMD_FORMAT.parse(str);
+        } catch (Exception ex) {
+            return null;
+        }
+    }
+
+    /**
+     * 瀛楃涓茶浆涓烘棩鏈熸椂闂�
+     */
+    public static Date parseTime(String str) {
+        try {
+            return YMDHMS_FORMAT.parse(str);
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    /**
+     * 鍒ゆ柇鍊兼槸鍚︿负鏃ユ湡鏍煎紡
+     */
+    public static boolean isDate(String strDate) {
+        Matcher m = datePattern.matcher(strDate);
+
+        return m.matches();
+    }
+
+    /**
+     * 瀛楃涓诧紝鏄惁涓簄ull 鎴� ""
+     */
+    public static boolean isNull(String str) {
+        return null == str || str.length() == 0;
+    }
+
+    /**
+     * 瀛楃涓�,鏄惁涓虹┖null鍜岀┖鏍�
+     */
+    public static boolean isEmpty(String str) {
+        return null == str || "".equals(str.trim());
+    }
+
+    /**
+     * 鑾峰彇 like 瀛楃涓�
+     */
+    public static String getLikeStr(String str) {
+        return isEmpty(str) ? null : "%" + str.trim() + "%";
+    }
+
+    /**
+     * 鑾峰彇 like 瀛楃涓�
+     */
+    public static String getLikeUpperStr(String str) {
+        return isEmpty(str) ? null : "%" + str.trim().toUpperCase() + "%";
+    }
+
+    /**
+     * 鑾峰彇 鍙砽ike 瀛楃涓�
+     */
+    public static String getRightLike(String str) {
+        return isEmpty(str) ? null : str.trim() + "%";
+    }
+
+    /**
+     * 鑾峰彇鍥惧舰鐨刉KT瀛楃涓�
+     */
+    public static String getGeomWkt(String wkt) {
+        if (isEmpty(wkt)) {
+            return "null";
+        }
+
+        return String.format("ST_GeomFromText('%s')", wkt);
+    }
+
+    /**
+     * 棣栧瓧姣嶅ぇ鍐�
+     */
+    public static String firstCharToUpperCase(String str) {
+        return str.substring(0, 1).toUpperCase() + str.substring(1);
+    }
+
+    /**
+     * 棣栧瓧姣嶅皬鍐�
+     */
+    public static String firstCharToLowerCase(String str) {
+        return str.substring(0, 1).toLowerCase() + str.substring(1);
+    }
+
+    /**
+     * 鍒ゆ柇鍊兼槸鍚﹀瓨鍦⊿QL娉ㄥ叆
+     *
+     * @param str 瀛楃涓�
+     * @return 鏄�/鍚�
+     */
+    public static boolean isSqlInjection(String str) {
+        if (null == str) {
+            return false;
+        }
+
+        Matcher m = sqlPattern.matcher(str);
+
+        return m.matches();
+    }
+
+    /**
+     * 鏍¢獙瀵嗙爜鏄�/鍚﹀悎娉�
+     *
+     * @param pwd 瀵嗙爜
+     * @return 鏄�/鍚︿负鏃犳晥鐨�
+     */
+    public static boolean isPwdInvalid(String pwd) {
+        return !Pattern.matches(PWD_REG, pwd);
+    }
+
+    /**
+     * 鑾峰彇GUID
+     */
+    public static String getGuid() {
+        return UUID.randomUUID().toString();
+    }
+
+    /**
+     * 鑾峰彇鍒嗛挓宸暟
+     */
+    public static long getMinuteDifference(Timestamp ts) {
+        return (ts.getTime() - System.currentTimeMillis()) / 1000 / 60;
+    }
+
+    /**
+     * 杩炴帴List闆嗗悎
+     *
+     * @param list list 鏁存暟闆嗗悎
+     * @param join join 杩炴帴瀛楃
+     * @param <T>  娉涘瀷绫�
+     * @return 瀛楃涓�
+     */
+    public static <T> String join(List<T> list, String join) {
+        if (null == list || list.isEmpty()) {
+            return "";
+        }
+
+        StringBuilder sb = new StringBuilder();
+        for (T t : list) {
+            if (null != t) {
+                sb.append(t.toString()).append(join);
+            }
+        }
+
+        if (sb.length() > 0 && sb.lastIndexOf(join) == sb.length() - join.length()) {
+            // 鍒犻櫎浠庣储寮� start 寮�濮嬪埌 end 涔嬮棿鐨勫瓧绗︼紝鍗� 鍓嶅寘鎷� 鍚庝笉鍖呮嫭銆�
+            sb.delete(sb.length() - join.length(), sb.length());
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * 瀛楃涓茶浆鏁存暟闆嗗悎
+     */
+    public static List<Integer> strToIntegers(String str) {
+        if (isEmpty(str)) {
+            return null;
+        }
+
+        List<Integer> list = new ArrayList<>();
+        for (String s : str.split(COMMA)) {
+            list.add(Integer.parseInt(s));
+        }
+
+        return list;
+    }
+}
diff --git a/src/main/java/com/se/simu/helper/WebHelper.java b/src/main/java/com/se/simu/helper/WebHelper.java
new file mode 100644
index 0000000..074817e
--- /dev/null
+++ b/src/main/java/com/se/simu/helper/WebHelper.java
@@ -0,0 +1,424 @@
+package com.se.simu.helper;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.InetAddress;
+import java.net.URLEncoder;
+import java.net.UnknownHostException;
+import java.sql.Timestamp;
+import java.util.*;
+
+/**
+ * Web甯姪绫�
+ *
+ * @author WWW
+ * @date 2024-07-16
+ */
+@Slf4j
+public class WebHelper {
+    private final static String COMMA = ",";
+
+    private final static String UNKNOWN = "unknown";
+
+    public final static String TOKEN_KEY = "token";
+
+    public final static String TOKEN_COOKIE_KEY = "token";
+
+    public final static int COOKIE_MAX_AGE = 4 * 60 * 60;
+
+    /**
+     * 鑾峰彇GUID
+     */
+    public static String getGuid() {
+        return UUID.randomUUID().toString();
+    }
+
+    /**
+     * 鑾峰彇涓绘満IP
+     * @return
+     */
+    public static String getHostIp() {
+        try {
+            return InetAddress.getLocalHost().getHostAddress();
+        } catch (UnknownHostException e) {
+            //
+        }
+        return "127.0.0.1";
+    }
+
+    /**
+     * 鑾峰彇鐢ㄦ埛IP
+     */
+    public static String getIpAddress(HttpServletRequest request) {
+        String ip = request.getHeader("X-Forwarded-For");
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("Proxy-Client-IP");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("WL-Proxy-Client-IP");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_X_FORWARDED");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_X_CLUSTER_CLIENT_IP");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_CLIENT_IP");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_FORWARDED_FOR");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_FORWARDED");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_VIA");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("REMOTE_ADDR");
+        }
+        if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
+            ip = request.getRemoteAddr();
+        }
+        if (ip.contains(COMMA)) {
+            return ip.split(",")[0];
+        }
+
+        return ip;
+    }
+
+    /**
+     * 鑾峰彇褰撳墠鏃堕棿鐨凾imestamp
+     */
+    public static Timestamp getCurrentTimestamp() {
+        return new Timestamp(System.currentTimeMillis());
+    }
+
+    /**
+     * 鑾峰彇褰撳墠鏃堕棿鎸囧畾鍒嗛挓鏁板悗鐨凾imestamp
+     */
+    public static Timestamp getTimestamp(int min) {
+        Calendar now = Calendar.getInstance();
+        now.add(Calendar.MINUTE, min);
+
+        return new Timestamp(now.getTimeInMillis());
+    }
+
+    /**
+     * 浠嶤ookie涓幏鍙杢oken
+     */
+    public static String getTokenFromCookie(HttpServletRequest request) {
+        Cookie[] cookies = request.getCookies();
+        if (cookies == null || cookies.length == 0) {
+            return null;
+        }
+
+        for (Cookie cookie : cookies) {
+            switch (cookie.getName()) {
+                case TOKEN_COOKIE_KEY:
+                    return cookie.getValue();
+                default:
+                    break;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * 鍚慍ookie涓坊鍔爐oken
+     */
+    public static void saveToken2Cookie(String token, HttpServletRequest request, HttpServletResponse response) {
+        // 鍏堝垹闄�
+        deleteCookies(request, response);
+
+        // 鍐嶄繚瀛�
+        saveCookie(TOKEN_COOKIE_KEY, token, response);
+    }
+
+    /**
+     * 淇濆瓨Cookie
+     */
+    public static void saveCookie(String key, String value, HttpServletResponse response) {
+        Cookie cookie = new Cookie(key, value);
+        // 璁剧疆cookie澶辨晥鏃堕棿锛屽崟浣嶄负绉�
+        cookie.setMaxAge(COOKIE_MAX_AGE);
+        cookie.setHttpOnly(false);
+        cookie.setPath("/");
+        //cookie.setDomain("*")
+
+        response.setHeader("P3P", "CP=CAO PSA OUR");
+        response.addCookie(cookie);
+    }
+
+    /**
+     * 鍒犻櫎cookie涓殑鍊�
+     */
+    public static void deleteCookie(String cookieKey, HttpServletRequest request, HttpServletResponse response) {
+        Cookie[] cookies = request.getCookies();
+        if (cookies != null && cookies.length > 0) {
+            for (Cookie c : cookies) {
+                if (cookieKey.equalsIgnoreCase(c.getName())) {
+                    c.setMaxAge(0);
+                    c.setPath("/");
+                    response.addCookie(c);
+                }
+            }
+        }
+    }
+
+    /**
+     * 鍒犻櫎鎵�鏈塁ookie
+     */
+    public static void deleteCookies(HttpServletRequest request, HttpServletResponse response) {
+        Cookie[] cookies = request.getCookies();
+        if (cookies != null && cookies.length > 0) {
+            for (Cookie c : cookies) {
+                c.setMaxAge(0);
+                c.setPath("/");
+                response.addCookie(c);
+            }
+        }
+    }
+
+    /**
+     * 鏍规嵁閿幏鍙朇ookie鍊�
+     */
+    public static String getCookieByKey(String key, HttpServletRequest request) {
+        Cookie[] cookies = request.getCookies();
+        if (cookies == null || cookies.length == 0) {
+            return null;
+        }
+
+        for (Cookie c : cookies) {
+            if (key.equals(c.getName())) {
+                return c.getValue();
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * 鑾峰彇Token
+     */
+    public static String getToken(HttpServletRequest request) {
+        // 1.浠巙rl鍙傛暟涓紝鑾峰彇token
+        String token = request.getParameter(TOKEN_KEY);
+
+        // 2.涓虹┖锛屽垯浠巋eader閲岃幏鍙�
+        if (token == null) {
+            token = request.getHeader(TOKEN_KEY);
+        }
+
+        // 3.杩樹负绌猴紝鍒欎粠cookie閲岃幏鍙�
+        if (token == null) {
+            token = getTokenFromCookie(request);
+        }
+
+        return token;
+    }
+
+    /**
+     * 鑾峰彇Request
+     */
+    public static HttpServletRequest getRequest() {
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+
+        return servletRequestAttributes.getRequest();
+    }
+
+    /**
+     * 鑾峰彇Response
+     */
+    public static HttpServletResponse getResponse() {
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+
+        return servletRequestAttributes.getResponse();
+    }
+
+    /**
+     * 鑾峰彇Session
+     */
+    public static HttpSession getSession() {
+        return getRequest().getSession();
+    }
+
+    /**
+     * 鑾峰彇鐪熷疄璺緞
+     */
+    public static String getRealPath(String path) {
+        HttpServletRequest req = getRequest();
+        ServletContext ctx = req.getSession().getServletContext();
+
+        return ctx.getRealPath("/" + path);
+    }
+
+    /**
+     * 杈撳嚭str鑷冲墠绔�
+     */
+    public static boolean writeStr2Page(HttpServletResponse res, String str) {
+        try {
+            res.setContentType("application/json;charset=UTF-8");
+            res.setHeader("Cache-Control", "no-cache");
+            res.setHeader("Pragma", "No-cache");
+            res.setDateHeader("Expires", 0);
+
+            PrintWriter out = res.getWriter();
+            out.print(str);
+
+            out.flush();
+            out.close();
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+        }
+
+        return false;
+    }
+
+    /**
+     * 鑾峰彇闅忔満鏁存暟
+     */
+    public static int getRandomInt(int min, int max) {
+        return new Random().nextInt(max) % (max - min + 1) + min;
+    }
+
+    /**
+     * 涓嬭浇鏂囦欢
+     */
+    public static void download(String file, String fileName, HttpServletResponse res) throws Exception {
+        download(file, fileName, false, res);
+    }
+
+    /**
+     * 涓嬭浇鏂囦欢
+     *
+     * @param file     鏂囦欢
+     * @param fileName 鏂囦欢鍚�
+     * @param res      鍝嶅簲
+     * @throws Exception 寮傚父
+     */
+    public static void download(String file, String fileName, boolean inline, HttpServletResponse res) throws Exception {
+        if (StringHelper.isEmpty(fileName)) {
+            fileName = StringHelper.YMDHMS2_FORMAT.format(new Date());
+        }
+        fileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");
+        String dispose = inline ? "inline" : "attachment";
+
+        // 璁剧疆鍝嶅簲澶翠腑鏂囦欢鐨勪笅杞芥柟寮忎负闄勪欢鏂瑰紡锛屼互鍙婅缃枃浠跺悕
+        res.setHeader("Content-Disposition", dispose + "; filename*=UTF-8''" + fileName);
+        // 璁剧疆鍝嶅簲澶寸殑缂栫爜鏍煎紡涓� UTF-8
+        res.setCharacterEncoding("UTF-8");
+
+        // 閫氳繃response瀵硅薄璁剧疆鍝嶅簲鏁版嵁鏍煎紡(濡傦細"text/plain; charset=utf-8")
+        String ext = FileHelper.getExtension(file);
+        String mime = FileHelper.getMime(ext);
+        res.setContentType(mime);
+
+        // 閫氳繃response瀵硅薄锛岃幏鍙栧埌杈撳嚭娴�
+        ServletOutputStream outputStream = res.getOutputStream();
+        // 瀹氫箟杈撳叆娴侊紝閫氳繃杈撳叆娴佽鍙栨枃浠跺唴瀹�
+        FileInputStream fileInputStream = new FileInputStream(file);
+
+        int len = 0;
+        byte[] bytes = new byte[1024];
+        while ((len = fileInputStream.read(bytes)) != -1) {
+            // 閫氳繃杈撳叆娴佽鍙栨枃浠舵暟鎹紝鐒跺悗閫氳繃涓婅堪鐨勮緭鍑烘祦鍐欏洖娴忚鍣�
+            outputStream.write(bytes, 0, len);
+            outputStream.flush();
+        }
+
+        // 鍏抽棴璧勬簮
+        fileInputStream.close();
+        outputStream.close();
+    }
+
+    /**
+     * 鎵ц鍛戒护
+     *
+     * @param cmd 鍛戒护
+     */
+    public static void exec(String cmd) {
+        try {
+            Runtime.getRuntime().exec(cmd);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+        }
+    }
+
+    /**
+     * 鎵ц鍛戒护
+     *
+     * @param cmd 鍛戒护
+     */
+    public static String exec2(String cmd) {
+        try {
+            StringBuilder sb = new StringBuilder();
+            Process process = Runtime.getRuntime().exec(cmd);
+            BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+
+            String line;
+            while ((line = reader.readLine()) != null) {
+                sb.append(line).append("\n");
+            }
+            reader.close();
+
+            return sb.toString();
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            return null;
+        }
+    }
+
+    /**
+     * 鑾峰彇璇锋眰鐨勫弬鏁板��
+     *
+     * @param req 璇锋眰
+     * @param key 鍙傛暟鍚�
+     * @return 鍙傛暟鍊�
+     */
+    public static String getReqParamVal(HttpServletRequest req, String key) {
+        Map<String, String[]> maps = req.getParameterMap();
+        for (Map.Entry<String, String[]> entry : maps.entrySet()) {
+            if (entry.getKey().equalsIgnoreCase(key)) {
+                return null == entry.getValue() || 0 == entry.getValue().length ? null : entry.getValue()[0];
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * 鑾峰彇璇锋眰鐨勫弬鏁板��
+     *
+     * @param req 璇锋眰
+     * @param key 鍙傛暟鍚�
+     * @return 鍙傛暟鍊�
+     */
+    public static String[] getReqParamVals(HttpServletRequest req, String key) {
+        Map<String, String[]> maps = req.getParameterMap();
+        for (Map.Entry<String, String[]> entry : maps.entrySet()) {
+            if (entry.getKey().equalsIgnoreCase(key)) {
+                return entry.getValue();
+            }
+        }
+
+        return null;
+    }
+}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
new file mode 100644
index 0000000..1a85cef
--- /dev/null
+++ b/src/main/resources/application.yml
@@ -0,0 +1,26 @@
+server:
+  tomcat:
+    uri-encoding: UTF-8
+    max-connections: 5000
+    max-http-form-post-size: 50MB
+    threads:
+      max: 2000
+  port: 8079
+  servlet:
+    context-path: /simuserver
+
+spring:
+  mvc:
+    pathmatch:
+      # 瑙e喅Knife4j杩愯鎶ラ敊
+      matching-strategy: ant_path_matcher
+  application:
+    name: simuserver
+
+knife4j:
+  # 鏄惁寮�鍚�
+  enabled: true
+  # 璇锋眰鍓嶇紑
+  pathMapping:
+  # 鏄惁寮�鍚寮烘ā寮�
+  enable: true
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml
new file mode 100644
index 0000000..11c8ad2
--- /dev/null
+++ b/src/main/resources/logback-spring.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- scan 閰嶇疆鏂囦欢濡傛灉鍙戠敓鏀瑰彉锛屽皢浼氳閲嶆柊鍔犺浇  scanPeriod 妫�娴嬮棿闅旀椂闂�-->
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+    <contextName>LFServer</contextName>
+
+    <!-- 鏂囦欢鍚嶇О -->
+    <property name="log.name.info" value="info" />
+    <property name="log.name.error" value="error" />
+
+    <!-- info 鍦板潃 -->
+    <property name="log.path.info" value="logs/" />
+    <property name="log.file.info" value="logs/info.log" />
+
+    <!-- error,閿欒璺緞 -->
+    <property name="log.path.error" value="logs/" />
+    <property name="log.file.error" value="logs/error.log" />
+    <include resource="org/springframework/boot/logging/logback/base.xml"/>
+
+    <!-- 鏅�氭棩蹇� -->
+    <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.file.info}</file>
+        <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 鏃ュ織鍛藉悕:鍗曚釜鏂囦欢澶т簬256MB 鎸夌収鏃堕棿+鑷i 鐢熸垚log鏂囦欢 -->
+            <fileNamePattern>${log.path.info}${log.name.info}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>256MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+            <!-- 鏈�澶т繚瀛樻椂闂达細30澶�-->
+            <maxHistory>30</maxHistory>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <!-- 鏃ュ織绾у埆杩囨护鍣� -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 杩囨护鐨勭骇鍒� -->
+            <level>INFO</level>
+            <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 閿欒鏃ュ織 -->
+    <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.file.error}</file>
+        <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 鏃ュ織鍛藉悕:鍗曚釜鏂囦欢澶т簬128MB 鎸夌収鏃堕棿+鑷i 鐢熸垚log鏂囦欢 -->
+            <fileNamePattern>${log.path.error}${log.name.error}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>128MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+            <!-- 鏈�澶т繚瀛樻椂闂达細180澶�-->
+            <maxHistory>180</maxHistory>
+        </rollingPolicy>
+        <append>true</append>
+        <!-- 鏃ュ織鏍煎紡 -->
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <!-- 鏃ュ織绾у埆杩囨护鍣� -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 杩囨护鐨勭骇鍒� -->
+            <level>ERROR</level>
+            <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 鎺у埗鍙� -->
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!-- 鏃ュ織鏍煎紡 -->
+        <encoder>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger Line:%-3L - %msg%n</pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <!--姝ゆ棩蹇梐ppender鏄负寮�鍙戜娇鐢紝鍙厤缃渶搴曠骇鍒紝鎺у埗鍙拌緭鍑虹殑鏃ュ織绾у埆鏄ぇ浜庢垨绛変簬姝ょ骇鍒殑鏃ュ織淇℃伅-->
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <!-- 鍙湁杩欎釜鏃ュ織鏉冮檺鎵嶈兘鐪嬶紝sql璇彞 -->
+            <level>DEBUG</level>
+        </filter>
+    </appender>
+
+    <!-- 杈撳嚭sql鏃ュ織:ERROR,INFO,DEBUG -->
+    <logger name="com.apache.ibatis" level="INFO"/>
+
+    <!-- additivity:鏄惁鍦ㄧ埗(杩欓噷涓簉oot鑺傜偣)杈撳嚭, 榛樿 true; -->
+    <logger name="com.se.simu" level="INFO" additivity="true">
+        <appender-ref ref="INFO_FILE"/>
+        <appender-ref ref="ERROR_FILE"/>
+    </logger>
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+</configuration>
diff --git a/src/test/java/com/se/simu/SimuApplicationTests.java b/src/test/java/com/se/simu/SimuApplicationTests.java
new file mode 100644
index 0000000..415243b
--- /dev/null
+++ b/src/test/java/com/se/simu/SimuApplicationTests.java
@@ -0,0 +1,13 @@
+package com.se.simu;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.TestPropertySource;
+
+@SpringBootTest
+@TestPropertySource(properties = "spring.datasource.initialize=false")
+class SimuserverApplicationTests {
+	@Test
+	void contextLoads() {
+	}
+}

--
Gitblit v1.9.3