新增短信

This commit is contained in:
zhangchenbiao
2024-04-10 16:05:10 +08:00
parent 0a1bf9773d
commit e59da5aa86
8 changed files with 82 additions and 27 deletions

View File

@@ -9,20 +9,6 @@ public enum SMSMsgEnum {
INTENTION_APPLY_PASS("意向申请通过","【沪上阿姨】恭喜您通过了加盟意向申请审核,请务必于{$var}前登录沪姨合伙人小程序完成面试预约时间申请,感谢您对沪上阿姨的关注与支持!点击转跳沪姨合伙人小程序:{$var}", "c8e0770d78d61a832c49afa828f683ee"),
INTERVIEW_APPOINTMENT_PASS("预约面试通过通知","【沪上阿姨】你已成功预约{$var}进行沪上阿姨加盟资格面试届时请通过沪姨合伙人小程序进行面试面试时间约40分钟请提前仔细阅读面试准备材料以及观看加盟说明视频做好面试相应准备。请务必提前安排好您的时间。点击转跳沪姨合伙人小程序{$var}", "9a0f2fd5d594047515f8ce6ce8d92b74"),
INTERVIEW_PASS("面试通过通知","【沪上阿姨】恭喜您通过了加盟资格面试,接下来我们会为您安排专业的选址开发顾问协助您进行选址,请保持电话畅通,祝您早日选址成功!点击转跳沪姨合伙人小程序:{$var}", "00a005aa218c2f3320cd27244b97efb9"),
INTERVIEW_REJECT("面试未通过通知", "【沪上阿姨】抱歉,您本次加盟资格面试暂未通过,原因为{$var},若有任何疑问,可联系客户经理沟通。再次感谢您对沪上阿姨的认可与支持!点击转跳沪姨合伙人小程序:{$var}", "fdca82a8b6b3c8055aafbc787b773493"),
INTERVIEW_BEGIN_IN_DAY("面试开始前一天", "【沪上阿姨】您预约的沪上阿姨加盟资格面试将于明天 {$var}{$var})开始,为保证您能够更加顺利的通过面试,请提前通过沪上阿姨合伙人小程序仔细阅读面试准备材料并做好相应准备。点击转跳小程序:{$var}", "657880fb2614fe70e579a06883dff57b"),
INTERVIEW_BEGIN_IN_MINUTES("面试开始前30分钟", "【沪上阿姨】您预约的沪上阿姨加盟资格面试将在30分钟后开始。面试预计持续40分钟请务必提前安排好您的时间。点击跳转沪上阿姨小程序快速进入面试房间{$var}", "07790f743a22d961afb8a3902e691404"),
SMS_INVATE("短信邀约", "【沪上阿姨】感谢您对沪上阿姨品牌的关注与支持,您可通过链接登记加盟申请信息,我们的客户经理将在第一时间与您联系。{$var}", "d7772108bb7d9767494818bcd39d2ec1"),
EXHIBITION_INFO_UPDATE("展会信息变更","【沪上阿姨】亲爱的伙伴,您好!您近期报名的加盟推介会信息有更新。名称为:{$var},日期为:{$var},地址为:{$var}。感谢您的关注,期待早日与您合作!{$var}","0750a8e1d9da68160e356e97bb71d4c4"),
EXHIBITION_CLOSE("展会结束","【沪上阿姨】亲爱的伙伴,您好!非常感谢您报名和参加我们的加盟推介会,若您想继续咨询合作事项,仍可微信联系您的客户经理为您解答。沪上阿姨祝您返程顺利,早日开店!","2acc290f100a5880d79ee3e265ec9d7a")
;
private String title;

View File

@@ -113,6 +113,10 @@
<groupId>com.github.wechatpay-apiv3</groupId>
<artifactId>wechatpay-java</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibabacloud-dysmsapi20170525</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,22 +1,19 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.aliyun.auth.credentials.Credential;
import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
import com.aliyun.sdk.service.dysmsapi20170525.models.*;
import com.aliyun.sdk.service.dysmsapi20170525.*;
import com.aliyun.sdk.service.dysmsapi20170525.AsyncClient;
import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dto.message.SendMessageDTO;
import com.cool.store.enums.*;
import com.cool.store.exception.ServiceException;
import com.cool.store.mq.producer.SimpleMessageService;
import com.cool.store.response.ResponseResult;
import com.cool.store.utils.UUIDUtils;
import com.cool.store.utils.poi.constant.Constants;
import com.google.gson.Gson;
import darabonba.core.client.ClientOverrideConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -32,6 +29,9 @@ import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
@@ -56,6 +56,12 @@ public class CommonService {
private String enterpriseId;
@Value("${enterprise.dingCorpId}")
private String dingCorpId;
@Value("${aliyun.sms.accessKeyId}")
private String smsAccessKeyId;
@Value("${aliyun.sms.accessKeySecret}")
private String smsAccessKeySecret;
@Value("${aliyun.sms.signName}")
private String signName;
public LineFlowService getLineFlowService(Integer workflowSubStage){
WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(workflowSubStage);
@@ -95,4 +101,43 @@ public class CommonService {
}
}
public void sendSms(String poneNumber, SMSMsgEnum templateCode, JSONObject templateParam){
sendSms(Arrays.asList(poneNumber), templateCode, templateParam);
}
public void sendSms(List<String> poneNumbers, SMSMsgEnum templateCode, JSONObject templateParam){
AsyncClient client = null;
try {
StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
.accessKeyId(smsAccessKeyId)
.accessKeySecret(smsAccessKeySecret)
.build());
client = AsyncClient.builder()
.region("cn-hangzhou")
.credentialsProvider(provider)
.overrideConfiguration(
ClientOverrideConfiguration.create()
.setEndpointOverride("dysmsapi.aliyuncs.com")
)
.build();
SendBatchSmsRequest sendBatchSmsRequest = SendBatchSmsRequest.builder()
.phoneNumberJson(JSONObject.toJSONString(poneNumbers))
.signNameJson(JSONObject.toJSONString(Arrays.asList(signName)))
.templateCode(templateCode.getTemplateCode())
.templateParamJson(templateParam.toJSONString())
.build();
CompletableFuture<SendBatchSmsResponse> response = client.sendBatchSms(sendBatchSmsRequest);
SendBatchSmsResponse resp = response.get();
log.info("短信发送response:{}", JSONObject.toJSONString(resp));
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} finally {
if(Objects.isNull(client)){
client.close();
}
}
}
}

View File

@@ -83,4 +83,8 @@ coolstore.page.domain=https://t2store.coolstore.cn/
xfsg.url=https://inf-test.xianfengsg.com/InfService
aliyun.sms.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
aliyun.sms.signName=酷店掌
mybatis.configuration.variables.enterpriseId=e17cd2dc350541df8a8b0af9bd27f77d

View File

@@ -1,6 +1,6 @@
#mysql config
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_36?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_69?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
@@ -78,4 +78,8 @@ coolstore.page.domain=https://t2store.coolstore.cn/
xfsg.url=https://inf-test.xianfengsg.com/InfService
mybatis.configuration.variables.enterpriseId=e17cd2dc350541df8a8b0af9bd27f77d
aliyun.sms.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
aliyun.sms.signName=酷店掌
mybatis.configuration.variables.enterpriseId=28c20a7b42b94171acb1ab3f631d69e1

View File

@@ -81,4 +81,8 @@ recommended.channel.id=52400
xfsg.url=https://inf-test.xianfengsg.com/InfService
aliyun.sms.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
aliyun.sms.signName=酷店掌
mybatis.configuration.variables.enterpriseId=9ee7b8b48e2447f9a2075b5a46e94d08

View File

@@ -83,4 +83,8 @@ coolstore.page.domain=https://t2store.coolstore.cn/
xfsg.url=https://inf-test.xianfengsg.com/InfService
aliyun.sms.accessKeyId=LTAI5tAVZ3r9UtSpLGcmGoQn
aliyun.sms.accessKeySecret=WIMjO4BjVg3YAHwmplq86yOyS2HMpa
aliyun.sms.signName=酷店掌
mybatis.configuration.variables.enterpriseId=28c20a7b42b94171acb1ab3f631d69e1

View File

@@ -227,7 +227,11 @@
<artifactId>wechatpay-java</artifactId>
<version>0.2.11</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibabacloud-dysmsapi20170525</artifactId>
<version>2.0.24</version>
</dependency>
</dependencies>
</dependencyManagement>