diff --git a/RuoYi-Vue/ruoyi-admin/src/main/resources/application-druid.yml b/RuoYi-Vue/ruoyi-admin/src/main/resources/application-druid.yml index ce94fb1..717d999 100644 --- a/RuoYi-Vue/ruoyi-admin/src/main/resources/application-druid.yml +++ b/RuoYi-Vue/ruoyi-admin/src/main/resources/application-druid.yml @@ -48,7 +48,7 @@ spring: url-pattern: /druid/* # 控制台管理用户名和密码 login-username: ruoyi - login-password: 123456 + login-password: jichuang@123 filter: stat: enabled: true diff --git a/alarm/pom.xml b/alarm/pom.xml index 123dcc1..9ef63ba 100644 --- a/alarm/pom.xml +++ b/alarm/pom.xml @@ -17,6 +17,14 @@ UTF-8 + + + + com.yingji + utils + + + alarm diff --git a/alarm/src/main/resources/application-dev.yml b/alarm/src/main/resources/application-dev.yml index 39bad05..aaa5063 100644 --- a/alarm/src/main/resources/application-dev.yml +++ b/alarm/src/main/resources/application-dev.yml @@ -3,7 +3,7 @@ spring: datasource: url: jdbc:mysql://localhost:3306/algorithms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: 123456 + password: jichuang@123 driverClassName: com.mysql.cj.jdbc.Driver diff --git a/fire/pom.xml b/fire/pom.xml index 478aa18..608d744 100644 --- a/fire/pom.xml +++ b/fire/pom.xml @@ -17,6 +17,14 @@ UTF-8 + + + + com.yingji + utils + + + fire diff --git a/page/pom.xml b/page/pom.xml index dff778d..d278003 100644 --- a/page/pom.xml +++ b/page/pom.xml @@ -16,6 +16,15 @@ 8 UTF-8 + + + + + com.yingji + utils + + + page diff --git a/page/src/main/resources/application-dev.yml b/page/src/main/resources/application-dev.yml index 1226d25..e8402b7 100644 --- a/page/src/main/resources/application-dev.yml +++ b/page/src/main/resources/application-dev.yml @@ -3,7 +3,7 @@ spring: datasource: url: jdbc:mysql://localhost:3306/algorithms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: 123456 + password: jichuang@123 driverClassName: com.mysql.cj.jdbc.Driver diff --git a/pom.xml b/pom.xml index 4dbd5b4..b694479 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ rescue page fire + utils 1.8 diff --git a/rescue/pom.xml b/rescue/pom.xml index aadfc63..a8a4777 100644 --- a/rescue/pom.xml +++ b/rescue/pom.xml @@ -17,6 +17,14 @@ UTF-8 + + + + com.yingji + utils + + + rescue diff --git a/utils/pom.xml b/utils/pom.xml new file mode 100644 index 0000000..155d365 --- /dev/null +++ b/utils/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + com.yingji + yingjiAlgorithms + 0.0.1-SNAPSHOT + + + utils + + + 8 + 8 + UTF-8 + + + + \ No newline at end of file diff --git a/utils/src/main/java/com/utils/SmsUtil.java b/utils/src/main/java/com/utils/SmsUtil.java new file mode 100644 index 0000000..f9dd42c --- /dev/null +++ b/utils/src/main/java/com/utils/SmsUtil.java @@ -0,0 +1,64 @@ +package com.utils; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; + +import java.util.HashMap; +import java.util.Map; + +/** + * 短信通知工具类 + * + * @author wu + * @since 2024/9/24 10:18 + */ +public class SmsUtil { + + /** + * 获取短信接口token + * + * @return token + */ + public static String getSmsToken() { + Map bodyMap = new HashMap<>(); + bodyMap.put("uid", "yjglj_yjjyszzh"); + bodyMap.put("pwd", "f604d2d6de51573b5cef5c95c11ffabe"); + String bodyJson = JSONUtil.toJsonStr(bodyMap); + String responseStr = HttpRequest.post("http://2.46.42.43:80/admin-api/sms/token") + .body(bodyJson) + .execute() + .body(); + JSONObject responseJson = JSONUtil.parseObj(responseStr); + return (String) responseJson.get("data"); + } + + /** + * 发送短信 + * + * @param content 短信内容 + * @param tel 手机号多个使用,拼接 + * @return 响应类 + */ + public static Object sendSms(String content, String tel) { + String token = getSmsToken(); + Map bodyMap = new HashMap<>(); + bodyMap.put("uid", "yjglj_yjjyszzh"); + bodyMap.put("pwd", "f604d2d6de51573b5cef5c95c11ffabe"); + bodyMap.put("extensionNo", "2559"); + if (StrUtil.isNotEmpty(tel)) { + bodyMap.put("tel", tel); + } else { + bodyMap.put("tel", "18870257135,18261462112,15850922852,18112760590"); + } + bodyMap.put("content", "市应急局提醒: " + content); + String bodyJson = JSONUtil.toJsonStr(bodyMap); + String responseStr = HttpRequest.post("http://2.46.42.43:80/admin-api/sms/send") + .header("Authorization", token) + .body(bodyJson) + .execute() + .body(); + return JSONUtil.parseObj(responseStr); + } +}