1.修改日志报错问题

2.移动公用地址到common下
This commit is contained in:
sh
2026-04-09 19:19:47 +08:00
parent a1b880f817
commit fd4ab146e0
11 changed files with 140 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
//package com.ruoyi.cms.handler; //package com.ruoyi.cms.handler;
// //
//import com.ruoyi.cms.util.AliyunNlsUtils; //import com.ruoyi.common.utils.aliyun.AliyunNlsUtils;
//import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
// //
//import javax.websocket.*; //import javax.websocket.*;

View File

@@ -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.SpeechRecognizer;
import com.alibaba.nls.client.protocol.asr.SpeechRecognizerListener; import com.alibaba.nls.client.protocol.asr.SpeechRecognizerListener;
import com.alibaba.nls.client.protocol.asr.SpeechRecognizerResponse; 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 lombok.Data;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@@ -7,7 +7,7 @@
//import com.alibaba.nls.client.protocol.tts.SpeechSynthesizer; //import com.alibaba.nls.client.protocol.tts.SpeechSynthesizer;
//import com.alibaba.nls.client.protocol.tts.SpeechSynthesizerListener; //import com.alibaba.nls.client.protocol.tts.SpeechSynthesizerListener;
//import com.alibaba.nls.client.protocol.tts.SpeechSynthesizerResponse; //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.Logger;
//import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;

View File

@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.aliyun.AliyunNlsUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;

View File

@@ -40,10 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectOperLogVo"/> <include refid="selectOperLogVo"/>
<where> <where>
<if test="operIp != null and operIp != ''"> <if test="operIp != null and operIp != ''">
AND oper_ip like concat('%', #{operIp}, '%') AND oper_ip like concat('%', CAST(#{operIp} AS VARCHAR), '%')
</if> </if>
<if test="title != null and title != ''"> <if test="title != null and title != ''">
AND title like concat('%', #{title}, '%') AND title like concat('%', CAST(#{title} AS VARCHAR), '%')
</if> </if>
<if test="businessType != null"> <if test="businessType != null">
AND business_type = #{businessType} AND business_type = #{businessType}
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND status = #{status} AND status = #{status}
</if> </if>
<if test="operName != null and operName != ''"> <if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%') AND oper_name like concat('%', CAST(#{operName} AS VARCHAR), '%')
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND oper_time &gt;= #{params.beginTime} AND oper_time &gt;= #{params.beginTime}

View File

@@ -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;
}

View File

@@ -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 NLS_FORMAL_URL="http://192.168.2.102:10044";
/**
* 测试短短地址
*/
public static final String SMS_TEST_URL="https://api.028lk.com/Sms/Api/Send";
/** /**
* 根据环境判断正式还是测试 * 根据环境判断正式还是测试
* @return * @return
@@ -41,4 +46,14 @@ public class AliyunNlsUtils {
System.out.println("微信授权登录当前环境:" + (USE_TEST_ENV ? "测试" : "正式") + "获取oppenid地址" + url); System.out.println("微信授权登录当前环境:" + (USE_TEST_ENV ? "测试" : "正式") + "获取oppenid地址" + url);
return 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;
}
} }

View File

@@ -1,14 +1,7 @@
package com.ruoyi.common.utils.http; package com.ruoyi.common.utils.http;
import java.io.BufferedReader; import java.io.*;
import java.io.IOException; import java.net.*;
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.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HostnameVerifier;
@@ -244,6 +237,78 @@ public class HttpUtils
return result.toString(); 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 private static class TrustAnyTrustManager implements X509TrustManager
{ {
@Override @Override

View File

@@ -48,7 +48,7 @@ public class SysJobServiceImpl implements ISysJobService
public void init() throws SchedulerException, TaskException public void init() throws SchedulerException, TaskException
{ {
try (DistributedLockUtil.AutoReleaseLock autoLock = 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()) { if (autoLock == null || !autoLock.isLocked()) {
System.out.println("【定时任务初始化】其他实例已持有锁,当前实例跳过初始化"); System.out.println("【定时任务初始化】其他实例已持有锁,当前实例跳过初始化");
return; return;

View File

@@ -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 select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time,login_time_cipher,user_name_cipher from sys_logininfor
<where> <where>
<if test="ipaddr != null and ipaddr != ''"> <if test="ipaddr != null and ipaddr != ''">
AND ipaddr like concat('%', #{ipaddr}, '%') AND ipaddr like concat('%', CAST(#{ipaddr} AS VARCHAR), '%')
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
AND user_name like concat('%', #{userName}, '%') AND user_name like concat('%', CAST(#{userName} AS VARCHAR), '%')
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND login_time &gt;= #{params.beginTime} AND login_time &gt;= #{params.beginTime}

View File

@@ -40,10 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectOperLogVo"/> <include refid="selectOperLogVo"/>
<where> <where>
<if test="operIp != null and operIp != ''"> <if test="operIp != null and operIp != ''">
AND oper_ip like concat('%', #{operIp}, '%') AND oper_ip like concat('%', CAST(#{operIp} AS VARCHAR), '%')
</if> </if>
<if test="title != null and title != ''"> <if test="title != null and title != ''">
AND title like concat('%', #{title}, '%') AND title like concat('%', CAST(#{title} AS VARCHAR), '%')
</if> </if>
<if test="businessType != null"> <if test="businessType != null">
AND business_type = #{businessType} AND business_type = #{businessType}
@@ -58,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND status = #{status} AND status = #{status}
</if> </if>
<if test="operName != null and operName != ''"> <if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%') AND oper_name like concat('%', CAST(#{operName} AS VARCHAR), '%')
</if> </if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND oper_time &gt;= #{params.beginTime} AND oper_time &gt;= #{params.beginTime}