cleanup code
This commit is contained in:
@@ -50,6 +50,12 @@
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-common3</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>*</artifactId>
|
||||
<groupId>io.netty</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!--集成springmvc框架并实现自动配置 -->
|
||||
<dependency>
|
||||
@@ -67,14 +73,14 @@
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<!-- websocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-websocket</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-mail</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
@@ -89,10 +95,10 @@
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<!--springboot2.6+解决metrics端点不显示jvm信息的问题-->
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>io.micrometer</groupId>-->
|
||||
<!-- <artifactId>micrometer-registry-prometheus</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- commons -->
|
||||
<dependency>
|
||||
@@ -141,51 +147,51 @@
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- sqlserver-->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>${sqljdbc4.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.microsoft.sqlserver</groupId>-->
|
||||
<!-- <artifactId>sqljdbc4</artifactId>-->
|
||||
<!-- <version>${sqljdbc4.version}</version>-->
|
||||
<!-- <scope>runtime</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- oracle驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>${ojdbc6.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.oracle</groupId>-->
|
||||
<!-- <artifactId>ojdbc6</artifactId>-->
|
||||
<!-- <version>${ojdbc6.version}</version>-->
|
||||
<!-- <scope>runtime</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- postgresql驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.postgresql</groupId>-->
|
||||
<!-- <artifactId>postgresql</artifactId>-->
|
||||
<!-- <version>${postgresql.version}</version>-->
|
||||
<!-- <scope>runtime</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!--人大金仓驱动 版本号V008R006C005B0013 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>kingbase8</artifactId>
|
||||
<version>${kingbase8.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.jeecgframework</groupId>-->
|
||||
<!-- <artifactId>kingbase8</artifactId>-->
|
||||
<!-- <version>${kingbase8.version}</version>-->
|
||||
<!-- <scope>runtime</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!--达梦数据库驱动 版本号1-3-26-2023.07.26-197096-20046-ENT -->
|
||||
<dependency>
|
||||
<groupId>com.dameng</groupId>
|
||||
<artifactId>Dm8JdbcDriver18</artifactId>
|
||||
<version>${dm8.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.dameng</groupId>
|
||||
<artifactId>DmDialect-for-hibernate5.0</artifactId>
|
||||
<version>${dm8.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.dameng</groupId>-->
|
||||
<!-- <artifactId>Dm8JdbcDriver18</artifactId>-->
|
||||
<!-- <version>${dm8.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.dameng</groupId>-->
|
||||
<!-- <artifactId>DmDialect-for-hibernate5.0</artifactId>-->
|
||||
<!-- <version>${dm8.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
<!-- Quartz定时任务 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-quartz</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-quartz</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!--JWT-->
|
||||
<dependency>
|
||||
@@ -280,19 +286,19 @@
|
||||
|
||||
<!-- 代码生成器 -->
|
||||
<!-- 如下载失败,请参考此文档 https://help.jeecg.com/java/setup/maven.html -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>codegenerate</artifactId>
|
||||
<version>${codegenerate.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.jeecgframework.boot</groupId>-->
|
||||
<!-- <artifactId>codegenerate</artifactId>-->
|
||||
<!-- <version>${codegenerate.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- AutoPoi Excel工具类-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot3</groupId>
|
||||
<artifactId>autopoi-web</artifactId>
|
||||
<version>${autopoi-web.version}</version>
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>lib/autopoi-web-3.7.0.jar</systemPath>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>lib/autopoi-web-3.7.0.jar</systemPath>-->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
@@ -318,32 +324,32 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云短信 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
<version>${aliyun-java-sdk-dysmsapi.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.aliyun</groupId>-->
|
||||
<!-- <artifactId>aliyun-java-sdk-dysmsapi</artifactId>-->
|
||||
<!-- <version>${aliyun-java-sdk-dysmsapi.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- aliyun oss -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>${aliyun.oss.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.aliyun.oss</groupId>-->
|
||||
<!-- <artifactId>aliyun-sdk-oss</artifactId>-->
|
||||
<!-- <version>${aliyun.oss.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- 第三方登录 -->
|
||||
<dependency>
|
||||
<groupId>com.xkcoding.justauth</groupId>
|
||||
<artifactId>justauth-spring-boot-starter</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.xkcoding.justauth</groupId>-->
|
||||
<!-- <artifactId>justauth-spring-boot-starter</artifactId>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-autoconfigure</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-configuration-processor</artifactId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
@@ -370,8 +376,8 @@
|
||||
<groupId>org.jeecgframework.boot3</groupId>
|
||||
<artifactId>autopoi</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>lib/autopoi-3.7.0.jar</systemPath>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>lib/autopoi-3.7.0.jar</systemPath>-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.deepoove</groupId>
|
||||
|
||||
@@ -1,133 +1,133 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyuncs.DefaultAcsClient;
|
||||
import com.aliyuncs.IAcsClient;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
import com.aliyuncs.profile.IClientProfile;
|
||||
import org.jeecg.common.constant.enums.DySmsEnum;
|
||||
import org.jeecg.config.StaticConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Created on 17/6/7.
|
||||
* 短信API产品的DEMO程序,工程中包含了一个SmsDemo类,直接通过
|
||||
* 执行main函数即可体验短信产品API功能(只需要将AK替换成开通了云通信-短信产品功能的AK即可)
|
||||
* 工程依赖了2个jar包(存放在工程的libs目录下)
|
||||
* 1:aliyun-java-sdk-core.jar
|
||||
* 2:aliyun-java-sdk-dysmsapi.jar
|
||||
* <p>
|
||||
* 备注:Demo工程编码采用UTF-8
|
||||
* 国际短信发送请勿参照此DEMO
|
||||
*
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
public class DySmsHelper {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(DySmsHelper.class);
|
||||
|
||||
/**
|
||||
* 产品名称:云通信短信API产品,开发者无需替换
|
||||
*/
|
||||
static final String PRODUCT = "Dysmsapi";
|
||||
/**
|
||||
* 产品域名,开发者无需替换
|
||||
*/
|
||||
static final String DOMAIN = "dysmsapi.aliyuncs.com";
|
||||
|
||||
/**
|
||||
* TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
|
||||
*/
|
||||
static String accessKeyId;
|
||||
static String accessKeySecret;
|
||||
|
||||
public static void setAccessKeyId(String accessKeyId) {
|
||||
DySmsHelper.accessKeyId = accessKeyId;
|
||||
}
|
||||
|
||||
public static void setAccessKeySecret(String accessKeySecret) {
|
||||
DySmsHelper.accessKeySecret = accessKeySecret;
|
||||
}
|
||||
|
||||
public static String getAccessKeyId() {
|
||||
return accessKeyId;
|
||||
}
|
||||
|
||||
public static String getAccessKeySecret() {
|
||||
return accessKeySecret;
|
||||
}
|
||||
|
||||
|
||||
public static boolean sendSms(String phone, JSONObject templateParamJson, DySmsEnum dySmsEnum) throws ClientException {
|
||||
//可自助调整超时时间
|
||||
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
||||
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
|
||||
|
||||
//update-begin-author:taoyan date:20200811 for:配置类数据获取
|
||||
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||
//logger.info("阿里大鱼短信秘钥 accessKeyId:" + staticConfig.getAccessKeyId());
|
||||
//logger.info("阿里大鱼短信秘钥 accessKeySecret:"+ staticConfig.getAccessKeySecret());
|
||||
setAccessKeyId(staticConfig.getAccessKeyId());
|
||||
setAccessKeySecret(staticConfig.getAccessKeySecret());
|
||||
//update-end-author:taoyan date:20200811 for:配置类数据获取
|
||||
|
||||
//初始化acsClient,暂不支持region化
|
||||
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
|
||||
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", PRODUCT, DOMAIN);
|
||||
IAcsClient acsClient = new DefaultAcsClient(profile);
|
||||
|
||||
//验证json参数
|
||||
validateParam(templateParamJson, dySmsEnum);
|
||||
|
||||
//组装请求对象-具体描述见控制台-文档部分内容
|
||||
SendSmsRequest request = new SendSmsRequest();
|
||||
//必填:待发送手机号
|
||||
request.setPhoneNumbers(phone);
|
||||
//必填:短信签名-可在短信控制台中找到
|
||||
request.setSignName(dySmsEnum.getSignName());
|
||||
//必填:短信模板-可在短信控制台中找到
|
||||
request.setTemplateCode(dySmsEnum.getTemplateCode());
|
||||
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
||||
request.setTemplateParam(templateParamJson.toJSONString());
|
||||
|
||||
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
|
||||
//request.setSmsUpExtendCode("90997");
|
||||
|
||||
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
|
||||
//request.setOutId("yourOutId");
|
||||
|
||||
boolean result = false;
|
||||
|
||||
//hint 此处可能会抛出异常,注意catch
|
||||
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
|
||||
logger.info("短信接口返回的数据----------------");
|
||||
logger.info("{Code:" + sendSmsResponse.getCode() + ",Message:" + sendSmsResponse.getMessage() + ",RequestId:" + sendSmsResponse.getRequestId() + ",BizId:" + sendSmsResponse.getBizId() + "}");
|
||||
String ok = "OK";
|
||||
if (ok.equals(sendSmsResponse.getCode())) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static void validateParam(JSONObject templateParamJson, DySmsEnum dySmsEnum) {
|
||||
String keys = dySmsEnum.getKeys();
|
||||
String[] keyArr = keys.split(",");
|
||||
for (String item : keyArr) {
|
||||
if (!templateParamJson.containsKey(item)) {
|
||||
throw new RuntimeException("模板缺少参数:" + item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public static void main(String[] args) throws ClientException, InterruptedException {
|
||||
// JSONObject obj = new JSONObject();
|
||||
// obj.put("code", "1234");
|
||||
// sendSms("13800138000", obj, DySmsEnum.FORGET_PASSWORD_TEMPLATE_CODE);
|
||||
//package org.jeecg.common.util;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import com.aliyuncs.DefaultAcsClient;
|
||||
//import com.aliyuncs.IAcsClient;
|
||||
//import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
|
||||
//import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||
//import com.aliyuncs.exceptions.ClientException;
|
||||
//import com.aliyuncs.profile.DefaultProfile;
|
||||
//import com.aliyuncs.profile.IClientProfile;
|
||||
//import org.jeecg.common.constant.enums.DySmsEnum;
|
||||
//import org.jeecg.config.StaticConfig;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//
|
||||
///**
|
||||
// * Created on 17/6/7.
|
||||
// * 短信API产品的DEMO程序,工程中包含了一个SmsDemo类,直接通过
|
||||
// * 执行main函数即可体验短信产品API功能(只需要将AK替换成开通了云通信-短信产品功能的AK即可)
|
||||
// * 工程依赖了2个jar包(存放在工程的libs目录下)
|
||||
// * 1:aliyun-java-sdk-core.jar
|
||||
// * 2:aliyun-java-sdk-dysmsapi.jar
|
||||
// * <p>
|
||||
// * 备注:Demo工程编码采用UTF-8
|
||||
// * 国际短信发送请勿参照此DEMO
|
||||
// *
|
||||
// * @author: jeecg-boot
|
||||
// */
|
||||
//public class DySmsHelper {
|
||||
//
|
||||
// private final static Logger logger = LoggerFactory.getLogger(DySmsHelper.class);
|
||||
//
|
||||
// /**
|
||||
// * 产品名称:云通信短信API产品,开发者无需替换
|
||||
// */
|
||||
// static final String PRODUCT = "Dysmsapi";
|
||||
// /**
|
||||
// * 产品域名,开发者无需替换
|
||||
// */
|
||||
// static final String DOMAIN = "dysmsapi.aliyuncs.com";
|
||||
//
|
||||
// /**
|
||||
// * TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
|
||||
// */
|
||||
// static String accessKeyId;
|
||||
// static String accessKeySecret;
|
||||
//
|
||||
// public static void setAccessKeyId(String accessKeyId) {
|
||||
// DySmsHelper.accessKeyId = accessKeyId;
|
||||
// }
|
||||
}
|
||||
//
|
||||
// public static void setAccessKeySecret(String accessKeySecret) {
|
||||
// DySmsHelper.accessKeySecret = accessKeySecret;
|
||||
// }
|
||||
//
|
||||
// public static String getAccessKeyId() {
|
||||
// return accessKeyId;
|
||||
// }
|
||||
//
|
||||
// public static String getAccessKeySecret() {
|
||||
// return accessKeySecret;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static boolean sendSms(String phone, JSONObject templateParamJson, DySmsEnum dySmsEnum) throws ClientException {
|
||||
// //可自助调整超时时间
|
||||
// System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
|
||||
// System.setProperty("sun.net.client.defaultReadTimeout", "10000");
|
||||
//
|
||||
// //update-begin-author:taoyan date:20200811 for:配置类数据获取
|
||||
// StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||
// //logger.info("阿里大鱼短信秘钥 accessKeyId:" + staticConfig.getAccessKeyId());
|
||||
// //logger.info("阿里大鱼短信秘钥 accessKeySecret:"+ staticConfig.getAccessKeySecret());
|
||||
// setAccessKeyId(staticConfig.getAccessKeyId());
|
||||
// setAccessKeySecret(staticConfig.getAccessKeySecret());
|
||||
// //update-end-author:taoyan date:20200811 for:配置类数据获取
|
||||
//
|
||||
// //初始化acsClient,暂不支持region化
|
||||
// IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
|
||||
// DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", PRODUCT, DOMAIN);
|
||||
// IAcsClient acsClient = new DefaultAcsClient(profile);
|
||||
//
|
||||
// //验证json参数
|
||||
// validateParam(templateParamJson, dySmsEnum);
|
||||
//
|
||||
// //组装请求对象-具体描述见控制台-文档部分内容
|
||||
// SendSmsRequest request = new SendSmsRequest();
|
||||
// //必填:待发送手机号
|
||||
// request.setPhoneNumbers(phone);
|
||||
// //必填:短信签名-可在短信控制台中找到
|
||||
// request.setSignName(dySmsEnum.getSignName());
|
||||
// //必填:短信模板-可在短信控制台中找到
|
||||
// request.setTemplateCode(dySmsEnum.getTemplateCode());
|
||||
// //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
||||
// request.setTemplateParam(templateParamJson.toJSONString());
|
||||
//
|
||||
// //选填-上行短信扩展码(无特殊需求用户请忽略此字段)
|
||||
// //request.setSmsUpExtendCode("90997");
|
||||
//
|
||||
// //可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
|
||||
// //request.setOutId("yourOutId");
|
||||
//
|
||||
// boolean result = false;
|
||||
//
|
||||
// //hint 此处可能会抛出异常,注意catch
|
||||
// SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
|
||||
// logger.info("短信接口返回的数据----------------");
|
||||
// logger.info("{Code:" + sendSmsResponse.getCode() + ",Message:" + sendSmsResponse.getMessage() + ",RequestId:" + sendSmsResponse.getRequestId() + ",BizId:" + sendSmsResponse.getBizId() + "}");
|
||||
// String ok = "OK";
|
||||
// if (ok.equals(sendSmsResponse.getCode())) {
|
||||
// result = true;
|
||||
// }
|
||||
// return result;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private static void validateParam(JSONObject templateParamJson, DySmsEnum dySmsEnum) {
|
||||
// String keys = dySmsEnum.getKeys();
|
||||
// String[] keyArr = keys.split(",");
|
||||
// for (String item : keyArr) {
|
||||
// if (!templateParamJson.containsKey(item)) {
|
||||
// throw new RuntimeException("模板缺少参数:" + item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//// public static void main(String[] args) throws ClientException, InterruptedException {
|
||||
//// JSONObject obj = new JSONObject();
|
||||
//// obj.put("code", "1234");
|
||||
//// sendSms("13800138000", obj, DySmsEnum.FORGET_PASSWORD_TEMPLATE_CODE);
|
||||
//// }
|
||||
//}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.jeecg.common.util;
|
||||
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 流水号生成规则(按默认规则递增,数字从1-99开始递增,数字到99,递增字母;位数不够增加位数)
|
||||
@@ -158,7 +158,7 @@ public class YouBianCodeUtil {
|
||||
}
|
||||
|
||||
public static String[] cutYouBianCode(String code) {
|
||||
if (code == null || StringUtil.isNullOrEmpty(code)) {
|
||||
if (code == null || StringUtils.isBlank(code)) {
|
||||
return null;
|
||||
} else {
|
||||
//获取标准长度为numLength+1,截取的数量为code.length/numLength+1
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.DataBaseConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecgframework.codegenerate.generate.util.SimpleFormat;
|
||||
//import org.jeecgframework.codegenerate.generate.util.SimpleFormat;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.util.Map;
|
||||
@@ -102,7 +102,7 @@ public class FreemarkerParseFactory {
|
||||
if (paras.containsKey(MINI_DAO_FORMAT)) {
|
||||
throw new RuntimeException("DaoFormat 是 minidao 保留关键字,不允许使用 ,请更改参数定义!");
|
||||
}
|
||||
paras.put(MINI_DAO_FORMAT, new SimpleFormat());
|
||||
//paras.put(MINI_DAO_FORMAT, new SimpleFormat());
|
||||
mytpl.process(paras, swriter);
|
||||
String sql = getSqlText(swriter.toString());
|
||||
paras.remove(MINI_DAO_FORMAT);
|
||||
@@ -138,7 +138,7 @@ public class FreemarkerParseFactory {
|
||||
if (paras.containsKey(MINI_DAO_FORMAT)) {
|
||||
throw new RuntimeException("DaoFormat 是 minidao 保留关键字,不允许使用 ,请更改参数定义!");
|
||||
}
|
||||
paras.put(MINI_DAO_FORMAT, new SimpleFormat());
|
||||
//paras.put(MINI_DAO_FORMAT, new SimpleFormat());
|
||||
mytpl.process(paras, swriter);
|
||||
String sql = getSqlText(swriter.toString(), keepSpace);
|
||||
paras.remove(MINI_DAO_FORMAT);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.jeecg.common.util.oss;
|
||||
|
||||
import com.aliyun.oss.ClientConfiguration;
|
||||
import com.aliyun.oss.OSSClient;
|
||||
import com.aliyun.oss.common.auth.DefaultCredentialProvider;
|
||||
import com.aliyun.oss.model.CannedAccessControlList;
|
||||
import com.aliyun.oss.model.OSSObject;
|
||||
import com.aliyun.oss.model.PutObjectResult;
|
||||
//import com.aliyun.oss.ClientConfiguration;
|
||||
//import com.aliyun.oss.OSSClient;
|
||||
//import com.aliyun.oss.common.auth.DefaultCredentialProvider;
|
||||
//import com.aliyun.oss.model.CannedAccessControlList;
|
||||
//import com.aliyun.oss.model.OSSObject;
|
||||
//import com.aliyun.oss.model.PutObjectResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.fileupload.FileItemStream;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
@@ -77,14 +77,14 @@ public class OssBootUtil {
|
||||
return bucketName;
|
||||
}
|
||||
|
||||
public static OSSClient getOssClient() {
|
||||
return ossClient;
|
||||
}
|
||||
//public static OSSClient getOssClient() {
|
||||
// return ossClient;
|
||||
//}
|
||||
|
||||
/**
|
||||
* oss 工具客户端
|
||||
*/
|
||||
private static OSSClient ossClient = null;
|
||||
//private static OSSClient ossClient = null;
|
||||
|
||||
/**
|
||||
* 上传文件至阿里云 OSS
|
||||
@@ -96,7 +96,7 @@ public class OssBootUtil {
|
||||
* @return oss 中的相对文件路径
|
||||
*/
|
||||
public static String upload(MultipartFile file, String fileDir, String customBucket) throws Exception {
|
||||
//update-begin-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
/*//update-begin-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
SsrfFileTypeFilter.checkUploadFileType(file);
|
||||
//update-end-author:liusq date:20210809 for: 过滤上传文件类型
|
||||
|
||||
@@ -146,8 +146,8 @@ public class OssBootUtil {
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
return filePath;
|
||||
}*/
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +186,7 @@ public class OssBootUtil {
|
||||
*/
|
||||
public static String upload(FileItemStream file, String fileDir) {
|
||||
String filePath = null;
|
||||
initOss(endPoint, accessKeyId, accessKeySecret);
|
||||
/*initOss(endPoint, accessKeyId, accessKeySecret);
|
||||
StringBuilder fileUrl = new StringBuilder();
|
||||
try {
|
||||
String suffix = file.getName().substring(file.getName().lastIndexOf('.'));
|
||||
@@ -210,7 +210,7 @@ public class OssBootUtil {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
return filePath;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ public class OssBootUtil {
|
||||
* @param url
|
||||
*/
|
||||
public static void deleteUrl(String url, String bucket) {
|
||||
String newBucket = bucketName;
|
||||
/* String newBucket = bucketName;
|
||||
if (oConvertUtils.isNotEmpty(bucket)) {
|
||||
newBucket = bucket;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ public class OssBootUtil {
|
||||
//TODO 暂时不允许删除云存储的文件
|
||||
//initOss(endPoint, accessKeyId, accessKeySecret);
|
||||
url = url.replace(bucketUrl, "");
|
||||
ossClient.deleteObject(newBucket, url);
|
||||
ossClient.deleteObject(newBucket, url);*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,7 +251,7 @@ public class OssBootUtil {
|
||||
* @param fileName
|
||||
*/
|
||||
public static void delete(String fileName) {
|
||||
ossClient.deleteObject(bucketName, fileName);
|
||||
//ossClient.deleteObject(bucketName, fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,7 +263,7 @@ public class OssBootUtil {
|
||||
*/
|
||||
public static InputStream getOssFile(String objectName, String bucket) {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
/*try {
|
||||
String newBucket = bucketName;
|
||||
if (oConvertUtils.isNotEmpty(bucket)) {
|
||||
newBucket = bucket;
|
||||
@@ -276,7 +276,7 @@ public class OssBootUtil {
|
||||
inputStream = new BufferedInputStream(ossObject.getObjectContent());
|
||||
} catch (Exception e) {
|
||||
log.info("文件获取失败" + e.getMessage());
|
||||
}
|
||||
}*/
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public class OssBootUtil {
|
||||
* @return
|
||||
*/
|
||||
public static String getObjectUrl(String bucketName, String objectName, Date expires) {
|
||||
initOss(endPoint, accessKeyId, accessKeySecret);
|
||||
/* initOss(endPoint, accessKeyId, accessKeySecret);
|
||||
try {
|
||||
//update-begin---author:liusq Date:20220120 for:替换objectName前缀,防止key不一致导致获取不到文件----
|
||||
objectName = OssBootUtil.replacePrefix(objectName, bucketName);
|
||||
@@ -312,7 +312,7 @@ public class OssBootUtil {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("文件路径获取失败" + e.getMessage());
|
||||
}
|
||||
}*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -321,14 +321,14 @@ public class OssBootUtil {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static OSSClient initOss(String endpoint, String accessKeyId, String accessKeySecret) {
|
||||
if (ossClient == null) {
|
||||
ossClient = new OSSClient(endpoint,
|
||||
new DefaultCredentialProvider(accessKeyId, accessKeySecret),
|
||||
new ClientConfiguration());
|
||||
}
|
||||
return ossClient;
|
||||
}
|
||||
//private static OSSClient initOss(String endpoint, String accessKeyId, String accessKeySecret) {
|
||||
// if (ossClient == null) {
|
||||
// ossClient = new OSSClient(endpoint,
|
||||
// new DefaultCredentialProvider(accessKeyId, accessKeySecret),
|
||||
// new ClientConfiguration());
|
||||
// }
|
||||
// return ossClient;
|
||||
//}
|
||||
|
||||
|
||||
/**
|
||||
@@ -340,7 +340,7 @@ public class OssBootUtil {
|
||||
*/
|
||||
public static String upload(InputStream stream, String relativePath) {
|
||||
String filePath = null;
|
||||
String fileUrl = relativePath;
|
||||
/*String fileUrl = relativePath;
|
||||
initOss(endPoint, accessKeyId, accessKeySecret);
|
||||
if (oConvertUtils.isNotEmpty(staticDomain) && staticDomain.toLowerCase().startsWith(CommonConstant.STR_HTTP)) {
|
||||
filePath = staticDomain + SymbolConstant.SINGLE_SLASH + relativePath;
|
||||
@@ -352,7 +352,7 @@ public class OssBootUtil {
|
||||
ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead);
|
||||
if (result != null) {
|
||||
log.info("------OSS文件上传成功------" + fileUrl);
|
||||
}
|
||||
}*/
|
||||
return filePath;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
import io.micrometer.prometheus.PrometheusMeterRegistry;
|
||||
//import io.micrometer.prometheus.PrometheusMeterRegistry;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
@@ -54,8 +54,8 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
|
||||
@Value("${spring.resource.static-locations:}")
|
||||
private String staticLocations;
|
||||
|
||||
@Autowired(required = false)
|
||||
private PrometheusMeterRegistry prometheusMeterRegistry;
|
||||
//@Autowired(required = false)
|
||||
//private PrometheusMeterRegistry prometheusMeterRegistry;
|
||||
|
||||
@Autowired
|
||||
private ObjectProvider<Jackson2ObjectMapperBuilder> builderProvider;
|
||||
@@ -158,10 +158,10 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
|
||||
/**
|
||||
* 解决metrics端点不显示jvm信息的问题(zyf)
|
||||
*/
|
||||
@Bean
|
||||
InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor) {
|
||||
return () -> meterRegistryPostProcessor.postProcessAfterInitialization(prometheusMeterRegistry, "");
|
||||
}
|
||||
//@Bean
|
||||
//InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor) {
|
||||
// return () -> meterRegistryPostProcessor.postProcessAfterInitialization(prometheusMeterRegistry, "");
|
||||
//}
|
||||
|
||||
// /**
|
||||
// * 注册拦截器【拦截器拦截参数,自动切换数据源——后期实现多租户切换数据源功能】
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import org.jeecg.config.filter.WebsocketFilter;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
/**
|
||||
* @Description: WebSocketConfig
|
||||
* @author: jeecg-boot
|
||||
*/
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
/**
|
||||
* 注入ServerEndpointExporter,
|
||||
* 这个bean会自动注册使用了@ServerEndpoint注解声明的Websocket endpoint
|
||||
*/
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebsocketFilter websocketFilter() {
|
||||
return new WebsocketFilter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean getFilterRegistrationBean() {
|
||||
FilterRegistrationBean bean = new FilterRegistrationBean();
|
||||
bean.setFilter(websocketFilter());
|
||||
//TODO 临时注释掉,测试下线上socket总断的问题
|
||||
bean.addUrlPatterns("/taskCountSocket/*", "/websocket/*", "/eoaSocket/*", "/eoaNewChatSocket/*", "/newsWebsocket/*", "/vxeSocket/*");
|
||||
return bean;
|
||||
}
|
||||
|
||||
}
|
||||
//package org.jeecg.config;
|
||||
//
|
||||
//import org.jeecg.config.filter.WebsocketFilter;
|
||||
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
//
|
||||
///**
|
||||
// * @Description: WebSocketConfig
|
||||
// * @author: jeecg-boot
|
||||
// */
|
||||
//@Configuration
|
||||
//public class WebSocketConfig {
|
||||
// /**
|
||||
// * 注入ServerEndpointExporter,
|
||||
// * 这个bean会自动注册使用了@ServerEndpoint注解声明的Websocket endpoint
|
||||
// */
|
||||
// @Bean
|
||||
// public ServerEndpointExporter serverEndpointExporter() {
|
||||
// return new ServerEndpointExporter();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public WebsocketFilter websocketFilter() {
|
||||
// return new WebsocketFilter();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public FilterRegistrationBean getFilterRegistrationBean() {
|
||||
// FilterRegistrationBean bean = new FilterRegistrationBean();
|
||||
// bean.setFilter(websocketFilter());
|
||||
// //TODO 临时注释掉,测试下线上socket总断的问题
|
||||
// bean.addUrlPatterns("/taskCountSocket/*", "/websocket/*", "/eoaSocket/*", "/eoaNewChatSocket/*", "/newsWebsocket/*", "/vxeSocket/*");
|
||||
// return bean;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user