diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechRecognitionWebSocketHandler.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechRecognitionWebSocketHandler.java
index b1c15fd..f0f92a6 100644
--- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechRecognitionWebSocketHandler.java
+++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechRecognitionWebSocketHandler.java
@@ -1,6 +1,6 @@
//package com.ruoyi.cms.handler;
//
-//import com.ruoyi.cms.util.AliyunNlsUtils;
+//import com.ruoyi.common.utils.aliyun.AliyunNlsUtils;
//import org.springframework.stereotype.Component;
//
//import javax.websocket.*;
diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechRecognizerAI.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechRecognizerAI.java
index 3425af2..ac5dba2 100644
--- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechRecognizerAI.java
+++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechRecognizerAI.java
@@ -7,7 +7,7 @@ import com.alibaba.nls.client.protocol.SampleRateEnum;
import com.alibaba.nls.client.protocol.asr.SpeechRecognizer;
import com.alibaba.nls.client.protocol.asr.SpeechRecognizerListener;
import com.alibaba.nls.client.protocol.asr.SpeechRecognizerResponse;
-import com.ruoyi.cms.util.AliyunNlsUtils;
+import com.ruoyi.common.utils.aliyun.AliyunNlsUtils;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechSynthesisWebSocketHandler.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechSynthesisWebSocketHandler.java
index 87a3b13..77349f3 100644
--- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechSynthesisWebSocketHandler.java
+++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/handler/SpeechSynthesisWebSocketHandler.java
@@ -7,7 +7,7 @@
//import com.alibaba.nls.client.protocol.tts.SpeechSynthesizer;
//import com.alibaba.nls.client.protocol.tts.SpeechSynthesizerListener;
//import com.alibaba.nls.client.protocol.tts.SpeechSynthesizerResponse;
-//import com.ruoyi.cms.util.AliyunNlsUtils;
+//import com.ruoyi.common.utils.aliyun.AliyunNlsUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Component;
diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/WechatUtil.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/WechatUtil.java
index 4f7fda6..51d15d8 100644
--- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/WechatUtil.java
+++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/WechatUtil.java
@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.aliyun.AliyunNlsUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Value;
diff --git a/ruoyi-bussiness/src/main/resources/mapper/app/BussinessOperLogMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/app/BussinessOperLogMapper.xml
index 4770ece..49a6358 100644
--- a/ruoyi-bussiness/src/main/resources/mapper/app/BussinessOperLogMapper.xml
+++ b/ruoyi-bussiness/src/main/resources/mapper/app/BussinessOperLogMapper.xml
@@ -40,10 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- AND oper_ip like concat('%', #{operIp}, '%')
+ AND oper_ip like concat('%', CAST(#{operIp} AS VARCHAR), '%')
- AND title like concat('%', #{title}, '%')
+ AND title like concat('%', CAST(#{title} AS VARCHAR), '%')
AND business_type = #{businessType}
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND status = #{status}
- AND oper_name like concat('%', #{operName}, '%')
+ AND oper_name like concat('%', CAST(#{operName} AS VARCHAR), '%')
AND oper_time >= #{params.beginTime}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SmsRequestDTO.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SmsRequestDTO.java
new file mode 100644
index 0000000..182a1d6
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SmsRequestDTO.java
@@ -0,0 +1,37 @@
+package com.ruoyi.common.core.domain.entity;
+
+import lombok.Data;
+
+@Data
+public class SmsRequestDTO {
+ /**
+ * name
+ */
+ private String secretName;
+ /**
+ * key
+ */
+ private String secretKey;
+ /**
+ * 手机号码,多个号码请用英文逗号隔开
+ */
+ private String mobile;
+ /**
+ * 短信内容,请保持在500字以内。注意:使用短信模板进行提交时,请填写模板拼接后的完整内容。
+ * 方式一:
+ * {"SecretName":"API","SecretKey":"000000","TimeStamp":null,"Mobile":"13000000000","Content":"你好,你的验证码是541254,有效期5分钟。","TemplateId":"","ExtCode":"","SignName":"","Timing":"","CustomId":""}
+ * 方式二:
+ * {"SecretName":"API","SecretKey":"000000","TimeStamp":null,"Mobile":"13000000000","Content":"","TemplateId":"000000","TemplateVars":["541254","5"],"ExtCode":"","SignName":"","Timing":"","CustomId":""}
+ */
+ private String content;
+
+ /**
+ * 模板id
+ */
+ private String templateId;
+
+ /**
+ * 短信模板变量集合,集合中数据类型为String
+ */
+ private String[] templateVars;
+}
diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/AliyunNlsUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/aliyun/AliyunNlsUtils.java
similarity index 70%
rename from ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/AliyunNlsUtils.java
rename to ruoyi-common/src/main/java/com/ruoyi/common/utils/aliyun/AliyunNlsUtils.java
index 8c331c1..e6b7665 100644
--- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/AliyunNlsUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/aliyun/AliyunNlsUtils.java
@@ -1,4 +1,4 @@
-package com.ruoyi.cms.util;
+package com.ruoyi.common.utils.aliyun;
/**
* 阿里云配置
@@ -22,6 +22,11 @@ public class AliyunNlsUtils {
*/
public static final String NLS_FORMAL_URL="http://192.168.2.102:10044";
+ /**
+ * 测试短短地址
+ */
+ public static final String SMS_TEST_URL="https://api.028lk.com/Sms/Api/Send";
+
/**
* 根据环境判断正式还是测试
* @return
@@ -41,4 +46,14 @@ public class AliyunNlsUtils {
System.out.println("微信授权登录当前环境:" + (USE_TEST_ENV ? "测试" : "正式") + ",获取oppenid地址:" + url);
return url;
}
+
+ /**
+ * 短信验证码地址
+ * @return
+ */
+ public static String getSmsUrl(){
+ String url = USE_TEST_ENV ? SMS_TEST_URL : NLS_FORMAL_URL+"/ksSend";
+ System.out.println("短信地址当前环境:" + (USE_TEST_ENV ? "测试" : "正式") + ",sms地址:" + url);
+ return url;
+ }
}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
index ef5eb28..e106a7d 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java
@@ -1,14 +1,7 @@
package com.ruoyi.common.utils.http;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.net.ConnectException;
-import java.net.SocketTimeoutException;
-import java.net.URL;
-import java.net.URLConnection;
+import java.io.*;
+import java.net.*;
import java.nio.charset.StandardCharsets;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
@@ -244,6 +237,78 @@ public class HttpUtils
return result.toString();
}
+ public static String snedSmsPost(String httpUrl, String data) {
+
+ HttpURLConnection connection = null;
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ BufferedReader bufferedReader = null;
+ String result = null;
+ try {
+ URL url = new URL(httpUrl);
+ // 通过远程url连接对象打开连接
+ connection = (HttpURLConnection) url.openConnection();
+ // 设置连接请求方式
+ connection.setRequestMethod("POST");
+ // 设置连接主机服务器超时时间:15000毫秒
+ connection.setConnectTimeout(15000);
+ // 设置读取主机服务器返回数据超时时间:60000毫秒
+ connection.setReadTimeout(60000);
+ // 默认值为:false,当向远程服务器传送数据/写数据时,需要设置为true
+ connection.setDoOutput(true);
+ // 设置传入参数的格式:请求参数应该是 name1=value1&name2=value2 的形式。
+ connection.setRequestProperty("Content-Type", "application/json");
+ // 通过连接对象获取一个输出流
+ outputStream = connection.getOutputStream();
+ // 通过输出流对象将参数写出去/传输出去,它是通过字节数组写出的
+ outputStream.write(data.getBytes());
+ // 通过连接对象获取一个输入流,向远程读取
+ if (connection.getResponseCode() == 200) {
+ inputStream = connection.getInputStream();
+ // 对输入流对象进行包装:charset根据工作项目组的要求来设置
+ bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
+ StringBuffer stringBuffer = new StringBuffer();
+ String temp = null;
+ // 循环遍历一行一行读取数据
+ while ((temp = bufferedReader.readLine()) != null) {
+ stringBuffer.append(temp);
+ stringBuffer.append("\r\n");
+ }
+ result = stringBuffer.toString();
+ }
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ // 关闭资源
+ if (null != bufferedReader) {
+ try {
+ bufferedReader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (null != outputStream) {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (null != inputStream) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ // 断开与远程地址url的连接
+ connection.disconnect();
+ }
+ return result;
+ }
+
private static class TrustAnyTrustManager implements X509TrustManager
{
@Override
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java
index 32d2f58..4e1a7a5 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java
@@ -48,7 +48,7 @@ public class SysJobServiceImpl implements ISysJobService
public void init() throws SchedulerException, TaskException
{
try (DistributedLockUtil.AutoReleaseLock autoLock =
- distributedLockUtil.tryLockJob(JOB_INIT_LOCK_KEY, LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
+ distributedLockUtil.tryLock(JOB_INIT_LOCK_KEY, LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
if (autoLock == null || !autoLock.isLocked()) {
System.out.println("【定时任务初始化】其他实例已持有锁,当前实例跳过初始化");
return;
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
index f9ea9c7..644c5c6 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
@@ -25,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time,login_time_cipher,user_name_cipher from sys_logininfor
- AND ipaddr like concat('%', #{ipaddr}, '%')
+ AND ipaddr like concat('%', CAST(#{ipaddr} AS VARCHAR), '%')
AND status = #{status}
- AND user_name like concat('%', #{userName}, '%')
+ AND user_name like concat('%', CAST(#{userName} AS VARCHAR), '%')
AND login_time >= #{params.beginTime}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
index a8ee055..ae44eb4 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml
@@ -40,10 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- AND oper_ip like concat('%', #{operIp}, '%')
+ AND oper_ip like concat('%', CAST(#{operIp} AS VARCHAR), '%')
- AND title like concat('%', #{title}, '%')
+ AND title like concat('%', CAST(#{title} AS VARCHAR), '%')
AND business_type = #{businessType}
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND status = #{status}
- AND oper_name like concat('%', #{operName}, '%')
+ AND oper_name like concat('%', CAST(#{operName} AS VARCHAR), '%')
AND oper_time >= #{params.beginTime}