Browse Source

项目初始化

wangmiaomiao 8 months ago
parent
commit
54b86b5c70

+ 33 - 0
.gitignore

@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/

+ 2 - 0
.idea/encodings.xml

@@ -3,5 +3,7 @@
   <component name="Encoding">
     <file url="file://$PROJECT_DIR$/monitor/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/monitor/src/main/resources" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
   </component>
 </project>

+ 1 - 0
.idea/misc.xml

@@ -5,6 +5,7 @@
     <option name="originalFiles">
       <list>
         <option value="$PROJECT_DIR$/monitor/pom.xml" />
+        <option value="$PROJECT_DIR$/pom.xml" />
       </list>
     </option>
   </component>

+ 0 - 8
.idea/modules.xml

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectModuleManager">
-    <modules>
-      <module fileurl="file://$PROJECT_DIR$/.idea/slibra-monitor.iml" filepath="$PROJECT_DIR$/.idea/slibra-monitor.iml" />
-    </modules>
-  </component>
-</project>

+ 1 - 1
.idea/vcs.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="VcsDirectoryMappings">
-    <mapping directory="$PROJECT_DIR$/monitor" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
   </component>
 </project>

+ 100 - 0
pom.xml

@@ -0,0 +1,100 @@
+<?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>
+    <groupId>com.slibra</groupId>
+    <artifactId>monitor</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>monitor</name>
+    <description>红杉-监控项目</description>
+    <properties>
+        <java.version>1.8</java.version>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <spring-boot.version>2.6.13</spring-boot.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+
+        <!-- SpringBoot Web容器 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-core</artifactId>
+            <version>4.6.1</version>
+        </dependency>
+
+        <dependency>
+        <groupId>org.junit.platform</groupId>
+        <artifactId>junit-platform-launcher</artifactId>
+        <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-net</groupId>
+            <artifactId>commons-net</artifactId>
+            <version>3.9.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+    </dependencies>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring-boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.8.1</version>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
+                <configuration>
+                    <mainClass>com.slibra.monitor.MonitorApplication</mainClass>
+                    <skip>true</skip>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>repackage</id>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 16 - 0
src/main/java/com/slibra/monitor/MonitorApplication.java

@@ -0,0 +1,16 @@
+package com.slibra.monitor;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@EnableScheduling
+@SpringBootApplication
+public class MonitorApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(MonitorApplication.class, args);
+        System.out.println("(♥◠‿◠)ノ゙  slibra监控启动成功   ლ(´ڡ`ლ)゙  \n");
+    }
+
+}

+ 45 - 0
src/main/java/com/slibra/monitor/config/ApplicationProperties.java

@@ -0,0 +1,45 @@
+package com.slibra.monitor.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+
+/**
+ * Properties specific to Trade.
+ * <p>
+ * Properties are configured in the {@code application.yml} file.
+ */
+@Component
+@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
+public class ApplicationProperties {
+
+    private final AliCloud aliCloud = new AliCloud();
+    public AliCloud getAliCloud() {
+        return aliCloud;
+    }
+    @Data
+    public static class AliCloud {
+
+        private Boolean enableSms;
+        private String accessKeyId;
+        private String accessKeySecret;
+        private String signName;
+        private String templateCooperation;
+        private String templateCodeMessage;
+        private String templateSysRegistPassed;
+        private String templateRegistPassed;
+        private String templateRegistUnpassed;
+        private String templateAccountFreezed;
+        private String templateAccountUnfreezed;
+        private String templateAccountReset;
+        private String templateRegistBuyer;
+    }
+
+
+
+
+
+
+}

+ 20 - 0
src/main/java/com/slibra/monitor/controller/MonitorController.java

@@ -0,0 +1,20 @@
+package com.slibra.monitor.controller;
+
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RestController
+@RequestMapping("/monitor")
+public class MonitorController {
+
+    @GetMapping("/hello")
+    public String hello(){
+        return "success";
+    }
+
+
+}

+ 19 - 0
src/main/java/com/slibra/monitor/controller/ScheduledTasks.java

@@ -0,0 +1,19 @@
+package com.slibra.monitor.controller;
+
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ScheduledTasks {
+
+    @Scheduled(fixedRate = 5000) // 每5秒执行一次
+    public void reportCurrentTime() {
+        System.out.println("现在时间: " + System.currentTimeMillis() / 1000);
+    }
+
+    // 使用cron表达式
+    @Scheduled(cron = "0 0/5 15,18 * * ?") // 每天的15点和18点,每隔5分钟执行一次
+    public void fixedRateWithInitialDelay() {
+        System.out.println("通过cron表达式执行的定时任务: " + System.currentTimeMillis() / 1000);
+    }
+}

+ 66 - 0
src/main/java/com/slibra/monitor/util/AliSMSUtil.java

@@ -0,0 +1,66 @@
+package com.slibra.monitor.util;
+
+import com.aliyuncs.CommonRequest;
+import com.aliyuncs.CommonResponse;
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.http.MethodType;
+import com.aliyuncs.profile.DefaultProfile;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.slibra.monitor.config.ApplicationProperties;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Slf4j
+@Component
+public class AliSMSUtil {
+
+    private static ApplicationProperties.AliCloud aliCloud;
+
+    public AliSMSUtil(ApplicationProperties applicationProperties) {
+        AliSMSUtil.aliCloud = applicationProperties.getAliCloud();
+    }
+
+    /**
+     * 发送短信
+     *
+     * @param templateCode 模板代码
+     * @param phoneNumber  手机号
+     * @param paramMap     变量Map
+     */
+    public static String sendMsg(String templateCode, String phoneNumber, Map<String, Object> paramMap) {
+        String accessKeyId = aliCloud.getAccessKeyId();
+        String accessKeySecret = aliCloud.getAccessKeySecret();
+        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
+        IAcsClient client = new DefaultAcsClient(profile);
+
+        CommonRequest request = new CommonRequest();
+        request.setSysMethod(MethodType.POST);
+        request.setSysDomain("dysmsapi.aliyuncs.com");
+        request.setSysVersion("2017-05-25");
+        request.setSysAction("SendSms");
+        request.putQueryParameter("PhoneNumbers", phoneNumber);
+        request.putQueryParameter("SignName", aliCloud.getSignName());
+        request.putQueryParameter("TemplateCode", templateCode); // 短信模板code- 根据不同业务场景获取
+        String paramValueStr = JsonUtil.toJsonStr(paramMap, "阿里短信参数封装");
+        request.putQueryParameter("TemplateParam", paramValueStr); // 模板参数赋值
+
+        CommonResponse response;
+        try {
+            response = client.getCommonResponse(request);
+        } catch (ClientException e) {
+            throw new RuntimeException("调用平台发送短信失败");
+        }
+        Map<String, Object> resultMap = JsonUtil.toEntity(response.getData(), new TypeReference<Map<String, Object>>() {
+        }, "短信结果解析");
+        if (!"OK".equals(resultMap.get("Code"))) {
+            log.error("发送短信通知未成功,返回错误码为{},错误信息为{}", resultMap.get("Code"), resultMap.get("Message"));
+//            throw new BadRequestProblem("调用平台发送短信失败", resultMap.get("Message").toString());
+            throw new RuntimeException("调用平台发送短信失败:" + resultMap.get("Message").toString());
+        }
+        return JsonUtil.toJsonStr(response, "aliMessage response");
+    }
+}

+ 117 - 0
src/main/java/com/slibra/monitor/util/DESUtil.java

@@ -0,0 +1,117 @@
+package com.slibra.monitor.util;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESKeySpec;
+import java.security.SecureRandom;
+
+public final class DESUtil {
+
+    /**
+     * 加密、解密key.
+     */
+    private static final String PASSWORD_CRYPT_KEY = "v5nNtkKfezyJxRuq4W2m";
+    /**
+     * 加密算法,可用 DES,DESede,Blowfish.
+     */
+    private static final String ALGORITHM = "DES";
+
+    /**
+     * 对数据进行DES加密.
+     *
+     * @param data 待进行DES加密的数据
+     * @return 返回经过DES加密后的数据
+     */
+    public static String decrypt(String data) throws Exception {
+        return new String(decrypt(hex2byte(data.getBytes()), PASSWORD_CRYPT_KEY.getBytes()));
+    }
+
+    /**
+     * 对用DES加密过的数据进行解密.
+     *
+     * @param data DES加密数据
+     * @return 返回解密后的数据
+     */
+    public static String encrypt(String data) throws Exception {
+        return byte2hex(encrypt(data.getBytes(), PASSWORD_CRYPT_KEY.getBytes()));
+    }
+
+    /**
+     * 用指定的key对数据进行DES加密.
+     *
+     * @param data 待加密的数据
+     * @param key  DES加密的key
+     * @return 返回DES加密后的数据
+     */
+    private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
+        // DES算法要求有一个可信任的随机数源
+        SecureRandom sr = new SecureRandom();
+        // 从原始密匙数据创建DESKeySpec对象
+        DESKeySpec dks = new DESKeySpec(key);
+        // 创建一个密匙工厂,然后用它把DESKeySpec转换成
+        // 一个SecretKey对象
+        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
+        SecretKey securekey = keyFactory.generateSecret(dks);
+        // Cipher对象实际完成加密操作
+        Cipher cipher = Cipher.getInstance(ALGORITHM);
+        // 用密匙初始化Cipher对象
+        cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
+        // 现在,获取数据并加密
+        // 正式执行加密操作
+        return cipher.doFinal(data);
+    }
+
+    /**
+     * 用指定的key对数据进行DES解密.
+     *
+     * @param data 待解密的数据
+     * @param key  DES解密的key
+     * @return 返回DES解密后的数据
+     */
+    private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
+        // DES算法要求有一个可信任的随机数源
+        SecureRandom sr = new SecureRandom();
+        // 从原始密匙数据创建一个DESKeySpec对象
+        DESKeySpec dks = new DESKeySpec(key);
+        // 创建一个密匙工厂,然后用它把DESKeySpec对象转换成
+        // 一个SecretKey对象
+        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
+        SecretKey securekey = keyFactory.generateSecret(dks);
+        // Cipher对象实际完成解密操作
+        Cipher cipher = Cipher.getInstance(ALGORITHM);
+        // 用密匙初始化Cipher对象
+        cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
+        // 现在,获取数据并解密
+        // 正式执行解密操作
+        return cipher.doFinal(data);
+    }
+
+    public static byte[] hex2byte(byte[] b) {
+        if ((b.length % 2) != 0) throw new IllegalArgumentException("长度不是偶数");
+        byte[] b2 = new byte[b.length / 2];
+        for (int n = 0; n < b.length; n += 2) {
+            String item = new String(b, n, 2);
+            b2[n / 2] = (byte) Integer.parseInt(item, 16);
+        }
+        return b2;
+    }
+
+    public static String byte2hex(byte[] b) {
+        StringBuilder hs = new StringBuilder();
+        String stmp;
+        for (byte value : b) {
+            stmp = (Integer.toHexString(value & 0XFF));
+            if (stmp.length() == 1) hs.append("0").append(stmp); else hs.append(stmp);
+        }
+        return hs.toString().toUpperCase();
+    }
+
+    public static void main(String[] args) throws Exception {
+        String md5Password = "这是一个例子,测试用!hello,world!";
+        String str = DESUtil.encrypt(md5Password);
+        System.out.println("str: " + str);
+        str = DESUtil.decrypt(str);
+        System.out.println("str: " + str);
+    }
+}

+ 169 - 0
src/main/java/com/slibra/monitor/util/JsonUtil.java

@@ -0,0 +1,169 @@
+package com.slibra.monitor.util;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+@Component
+@Slf4j
+public class JsonUtil {
+
+    // new ObjectMapper and allow the JSON-origin-data has more data than entity needed!
+    private static ObjectMapper mapper;
+
+    public JsonUtil(ObjectMapper mapper) {
+        JsonUtil.mapper = mapper;
+        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+    }
+
+    //    public static ForestDataEncDTO getEncodedTransUnit(Object o, String title) {
+    //        return new ForestDataEncDTO(encode(o, title));
+    //    }
+
+    public static String encode(Object obj, String title) {
+        String encodeStr = toJsonStr(obj, title);
+        String result = null;
+        try {
+            result = DESUtil.encrypt(encodeStr);
+        } catch (Exception e) {
+//            AssertUtil.logError(e, title);
+            throw new RuntimeException(e + "-" + title);
+        }
+        return result;
+    }
+
+    /**
+     * @param obj
+     * @param title
+     * @return
+     * @apiNote author: czz; 转化实体为JSON字符串
+     */
+    public static String toJsonStr(Object obj, String title) {
+        String result = null;
+        if (obj == null) {
+            return result;
+        }
+        title = "实体: " + title + " 转化为JSON字符串失败!";
+        try {
+            result = mapper.writeValueAsString(obj);
+        } catch (Exception e) {
+//            AssertUtil.logError(e, title);
+            throw new RuntimeException(e + "-" + title);
+        }
+        return result;
+    }
+
+    /**
+     * @param str
+     * @param clazz
+     * @param title
+     * @param <T>
+     * @return
+     * @apiNote author: czz; 转化JSON字符串为实体
+     */
+    public static <T> T toEntity(String str, Class<T> clazz, String title) {
+        T result = null;
+        if (str == null) {
+            return result;
+        }
+        //        title = "JSON字符串转化为实体: " + title + " 失败!";
+        try {
+            result = mapper.readValue(str, clazz);
+        } catch (Exception e) {
+//            AssertUtil.logError(e, title);
+            throw new RuntimeException(e + "-" + title);
+        }
+        return result;
+    }
+
+    /**
+     * @param str
+     * @param clazz
+     * @param title
+     * @param detail
+     * @param <T>
+     * @return
+     * @apiNote author: czz; 核算时VM转为后台计算实体, 用来提示页面输入缺失的信息!
+     */
+    public static <T> T toEntity(String str, Class<T> clazz, String title, String detail) {
+        T result = null;
+        if (str == null) {
+            return result;
+        }
+        title = title != null ? title : "核算失败";
+        try {
+            result = mapper.readValue(str, clazz);
+        } catch (Exception e) {
+//            AssertUtil.logError(e, title, detail);
+            throw new RuntimeException(e + "-" + title);
+        }
+        return result;
+    }
+
+    //    public static <T> T toCalEntity(String str, Class<T> clazz, String detail) {
+    //        AssertUtil.thenThrow(StringUtil.symbolArrayStrBlank(str), CAL_FAIL, detail);
+    //        return toEntity(str, clazz, null, detail);
+    //    }
+    //
+    //    public static <T> T toCalEntity(String str, TypeReference<T> type, String detail) {
+    //        com.ruowei.util.AssertUtil.thenThrow(com.ruowei.util.StringUtil.symbolArrayStrBlank(str), CAL_FAIL,
+    // detail);
+    //        return toEntity(str, type, CAL_FAIL, detail);
+    //    }
+    //
+    //    public static <T> List<T> toExcelEntity(String str, TypeReference<List<T>> type, String detail) {
+    //        if (com.ruowei.util.StringUtil.symbolArrayStrBlank(str)) {
+    //            return new ArrayList<>();
+    //        }
+    //        return toEntity(str, type, "Excel下载失败", detail);
+    //    }
+    //
+    //    public static <T> T toEntity(String str, TypeReference<T> type, String title, String detail) {
+    //        T result = null;
+    //        if (str == null) {
+    //            return result;
+    //        }
+    //        try {
+    //            result = mapper.readValue(str, type);
+    //        } catch (Exception e) {
+    //            com.ruowei.util.AssertUtil.logError(e, title, detail);
+    //        }
+    //        return result;
+    //    }
+
+    public static <T> T toEntity(String str, TypeReference<T> type, String title) {
+        T result = null;
+        if (str == null) {
+            return result;
+        }
+        title = "JSON字符串转化为实体: " + title + " 失败!";
+        try {
+            result = mapper.readValue(str, type);
+        } catch (Exception e) {
+            log.error("JSON转化失败的字符串: " + str);
+//            AssertUtil.logError(e, title);
+            throw new RuntimeException(e + "-" + title);
+        }
+        return result;
+    }
+
+    /**
+     * @param source
+     * @param tClass
+     * @param title
+     * @param <T>
+     * @return
+     * @apiNote author: czz; 通过JSON实现实体的深拷贝.
+     */
+    public static <T> T copy(T source, Class<T> tClass, String title) {
+        // 一千万次  15.3秒
+        return toEntity(toJsonStr(source, title), tClass, title);
+    }
+
+    public static JsonNode toJsonNode(Object paramObject) {
+        return mapper.valueToTree(paramObject);
+    }
+}

+ 40 - 0
src/main/resources/application.yml

@@ -0,0 +1,40 @@
+# 开发环境配置
+server:
+  # 服务器的HTTP端口,默认为8080
+  port: 8080
+  servlet:
+    # 应用的访问路径
+    context-path: /
+  tomcat:
+    # tomcat的URI编码
+    uri-encoding: UTF-8
+    # 连接数满后的排队数,默认为100
+    accept-count: 1000
+    threads:
+      # tomcat最大线程数,默认为200
+      max: 800
+      # Tomcat启动初始化的线程数,默认值10
+      min-spare: 100
+
+# 日志配置
+logging:
+  level:
+    com.slibra: debug
+    org.springframework: warn
+
+application:
+  ali-cloud:
+    enable-sms: true
+    access-key-id: LTAI5tMYjV29Hy1XKn3d79YD
+    access-key-secret: 48we5KZdx9Bu2OiJ9hmXhQTf2aCut0
+    sign-name: 伏羲碳惠交易平台
+    templateCooperation: SMS_264860508
+    templateCodeMessage: SMS_461080515
+    templateSysRegistPassed: SMS_461065541
+    templateRegistPassed: SMS_461025520
+    templateRegistUnpassed: SMS_460935564
+    templateAccountFreezed: SMS_264190885
+    templateAccountUnfreezed: SMS_264030916
+    templateAccountReset: SMS_264030920
+    templateRegistBuyer: SMS_462425424
+

+ 49 - 0
src/test/java/com/slibra/monitor/MonitorApplicationTests.java

@@ -0,0 +1,49 @@
+package com.slibra.monitor;
+
+import com.slibra.monitor.config.ApplicationProperties;
+import com.slibra.monitor.util.AliSMSUtil;
+import org.apache.commons.net.telnet.TelnetClient;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@SpringBootTest
+class MonitorApplicationTests {
+
+    @Autowired
+    private ApplicationProperties applicationProperties;
+
+    @Test
+    void contextLoads() {
+    }
+
+    /**
+     * 测试注册短信发送
+     */
+    @Test
+    public void testSMSLogin(){
+        Map<String, Object> paramMap = new HashMap<>();
+        paramMap.put("login", "王苗面");
+        String result = AliSMSUtil.sendMsg(applicationProperties.getAliCloud().getTemplateRegistBuyer(), "15075275358", paramMap);
+//        String result = AliSMSUtil.sendMsg("SMS_462425424", "15075275358", paramMap);
+        System.out.println("result = " + result);
+    }
+
+    @Test
+    public void testTelnet(){
+        String server = "192.168.9.54";
+        int port = 3307;
+        try {
+            TelnetClient telnetClient = new TelnetClient();
+            telnetClient.connect(server, port);
+            // 发送命令、读取响应等操作
+            telnetClient.disconnect();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+}