"eladmin-tools/vscode:/vscode.git/clone" did not exist on "48570fcb7fda88665b7faf1223af50b8e806826b"
Unverified Commit 1c91d8af authored by linlinjava's avatar linlinjava Committed by GitHub
Browse files

Merge pull request #25 from menethil/master

修改通知类逻辑,添加微信模版通知,修改配置为yaml
parents 6b236a70 15af17aa
...@@ -47,6 +47,15 @@ ...@@ -47,6 +47,15 @@
<artifactId>qcloudsms</artifactId> <artifactId>qcloudsms</artifactId>
<version>1.0.5</version> <version>1.0.5</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -19,11 +19,11 @@ import java.util.concurrent.ThreadPoolExecutor; ...@@ -19,11 +19,11 @@ import java.util.concurrent.ThreadPoolExecutor;
@EnableAsync @EnableAsync
class ExecutorConfig { class ExecutorConfig {
@Value("${spring.notify.corePoolSize}") @Value("${NotifyPoolConfig.corePoolSize}")
private int corePoolSize; private int corePoolSize;
@Value("${spring.notify.maxPoolSize}") @Value("${NotifyPoolConfig.maxPoolSize}")
private int maxPoolSize; private int maxPoolSize;
@Value("${spring.notify.queueCapacity}") @Value("${NotifyPoolConfig.queueCapacity}")
private int queueCapacity; private int queueCapacity;
@Bean(name = "notifyAsync") @Bean(name = "notifyAsync")
......
package org.linlinjava.litemall.core.notify; package org.linlinjava.litemall.core.notify;
import org.linlinjava.litemall.core.notify.util.ConfigUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
* Litemall商城通知服务类 * Litemall商城通知服务类
*/ */
@PropertySource(value = "classpath:notify.properties")
@Service("litemallNotifyService") @Service("litemallNotifyService")
public class LitemallNotifyService { public class LitemallNotifyService {
@Autowired @Autowired
MailSendService mailSendService; private MailSendService mailSendService;
@Autowired @Autowired
SMSSendService smsSendService; private SMSSendService smsSendService;
@Autowired @Autowired
Environment environment; private WXTemplateSendService wxTemplateSendService;
@Value("${sprint.mail.enable}") @Async("notifyAsync")
private boolean sendMailEnable; public void notifySMSMessage(String phoneNumber, String message) {
@Value("${spring.sms.enable}") if (!smsSendService.config.isEnable())
private boolean sendSMSEnable;
public void notifySMSMessage(String phoneNumber,String message) {
if (!sendSMSEnable)
return; return;
smsSendService.sendSMS(phoneNumber, message); smsSendService.sendSMS(phoneNumber, message);
} }
/**
* 微信模版消息通知
* @param token 通过wxMAService获取token或者通过url请求token
* @param touser 接收者openId
* @param formId 表单ID或者 prepayId
* @param notifyType 通知类别,通过该枚举值在配置文件中获取相应的模版ID
* @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值
*/
@Async("notifyAsync")
public void notifyWXTemplate(String token,String touser, String formId, ConfigUtil.NotifyType notifyType, String[] params) {
if (!wxTemplateSendService.config.isEnable())
return;
String templateId = ConfigUtil.getTemplateId(notifyType, wxTemplateSendService.config.getTemplate());
if (templateId != "")
wxTemplateSendService.sendWechatMsg(token,touser, templateId, formId, "", "", params);
}
/** /**
* 短信模版通知 * 短信模版通知
*
* @param phoneNumber 接收通知的电话号码 * @param phoneNumber 接收通知的电话号码
* @param notifyType 通知类别,通过该枚举值在配置文件中获取相应的模版ID * @param notifyType 通知类别,通过该枚举值在配置文件中获取相应的模版ID
* @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值 * @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值
*/ */
public void notifySMSTemplate(String phoneNumber, NotifyUtils.NotifyType notifyType, String[] params) { @Async("notifyAsync")
if (!sendSMSEnable) public void notifySMSTemplate(String phoneNumber, ConfigUtil.NotifyType notifyType, String[] params) {
if (!smsSendService.config.isEnable())
return; return;
int templateId = -1; int templateId = Integer.parseInt(ConfigUtil.getTemplateId(notifyType, smsSendService.config.getTemplate()));
switch (notifyType) {
case PAY_SUCCEED:
templateId = Integer.parseInt(environment.getProperty("spring.sms.template.paySucceed"));
break;
case CAPTCHA:
templateId = Integer.parseInt(environment.getProperty("spring.sms.template.captcha"));
break;
}
if (templateId != -1) if (templateId != -1)
smsSendService.sendSMSWithTemplate(phoneNumber, templateId, params); smsSendService.sendSMSWithTemplate(phoneNumber, templateId, params);
...@@ -57,12 +64,14 @@ public class LitemallNotifyService { ...@@ -57,12 +64,14 @@ public class LitemallNotifyService {
/** /**
* 短信模版通知 * 短信模版通知
*
* @param phoneNumber 接收通知的电话号码 * @param phoneNumber 接收通知的电话号码
* @param templateId 模板ID * @param templateId 模板ID
* @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值 * @param params 通知模版内容里的参数,类似"您的验证码为{1}"中{1}的值
*/ */
@Async("notifyAsync")
public void notifySMSTemplate(String phoneNumber, int templateId, String[] params) { public void notifySMSTemplate(String phoneNumber, int templateId, String[] params) {
if (!sendSMSEnable) if (!smsSendService.config.isEnable())
return; return;
smsSendService.sendSMSWithTemplate(phoneNumber, templateId, params); smsSendService.sendSMSWithTemplate(phoneNumber, templateId, params);
...@@ -70,11 +79,13 @@ public class LitemallNotifyService { ...@@ -70,11 +79,13 @@ public class LitemallNotifyService {
/** /**
* 发送邮件通知,接收者在spring.mail.sendto中指定 * 发送邮件通知,接收者在spring.mail.sendto中指定
*
* @param setSubject 邮件标题 * @param setSubject 邮件标题
* @param setText 邮件内容 * @param setText 邮件内容
*/ */
@Async("notifyAsync")
public void notifyMailMessage(String setSubject, String setText) { public void notifyMailMessage(String setSubject, String setText) {
if(!sendMailEnable) if (!mailSendService.config.isEnable())
return; return;
mailSendService.sendEmail(setSubject, setText); mailSendService.sendEmail(setSubject, setText);
......
package org.linlinjava.litemall.core.notify; package org.linlinjava.litemall.core.notify;
import org.springframework.beans.factory.annotation.Value; import org.linlinjava.litemall.core.notify.config.MailNotifyConfig;
import org.springframework.context.annotation.PropertySource; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
@PropertySource(value = "classpath:notify.properties")
@Service("mailSendService") @Service("mailSendService")
class MailSendService { class MailSendService {
@Resource @Autowired
private JavaMailSender mailSender; MailNotifyConfig config;
@Value("${spring.mail.username}") private JavaMailSenderImpl mailSender;
private String from;
@Value("${spring.mail.sendto}") private JavaMailSenderImpl getMailSender() {
private String sendto; if (mailSender == null) {
mailSender = new JavaMailSenderImpl();
mailSender.setHost(config.getHost());
mailSender.setUsername(config.getUsername());
mailSender.setPassword(config.getPassword());
}
return mailSender;
}
/** /**
* 异步发送邮件通知 * 发送邮件通知
*
* @param setSubject 邮件标题 * @param setSubject 邮件标题
* @param setText 邮件内容 * @param setText 邮件内容
*/ */
@Async("notifyAsync")
public void sendEmail(String setSubject, String setText) { public void sendEmail(String setSubject, String setText) {
try { try {
final MimeMessage mimeMessage = mailSender.createMimeMessage(); final MimeMessage mimeMessage = getMailSender().createMimeMessage();
final MimeMessageHelper message = new MimeMessageHelper(mimeMessage); final MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
message.setFrom(from); message.setFrom(config.getUsername());
message.setTo(sendto); message.setTo(config.getSendto());
message.setSubject(setSubject); message.setSubject(setSubject);
message.setText(setText); message.setText(setText);
mailSender.send(mimeMessage); getMailSender().send(mimeMessage);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
......
package org.linlinjava.litemall.core.notify;
public class NotifyUtils {
/**
* 该枚举定义了所有的需要通知的事件,调用通知时作为参数
*
* PAY_SUCCEED 支付成功,通常用于用户支付成功
* CAPTCHA 验证码,通常用于登录、注册、找回密码
*/
public enum NotifyType {
PAY_SUCCEED,
CAPTCHA
}
}
...@@ -4,29 +4,21 @@ import com.github.qcloudsms.SmsSingleSender; ...@@ -4,29 +4,21 @@ import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult; import com.github.qcloudsms.SmsSingleSenderResult;
import com.github.qcloudsms.httpclient.HTTPException; import com.github.qcloudsms.httpclient.HTTPException;
import org.json.JSONException; import org.json.JSONException;
import org.springframework.beans.factory.annotation.Value; import org.linlinjava.litemall.core.notify.config.SMSNotifyConfig;
import org.springframework.context.annotation.PropertySource; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException; import java.io.IOException;
@PropertySource(value = "classpath:notify.properties")
@Service("smsSendService") @Service("smsSendService")
class SMSSendService { class SMSSendService {
@Value("${spring.sms.appid}") @Autowired
private int appid; SMSNotifyConfig config;
@Value("${spring.sms.appkey}")
private String appkey;
@Value("${spring.sms.sign}")
private String smsSign;
@Async("notifyAsync")
public void sendSMS(String phoneNumber, String content) { public void sendSMS(String phoneNumber, String content) {
try { try {
SmsSingleSender ssender = new SmsSingleSender(appid, appkey); SmsSingleSender ssender = new SmsSingleSender(config.getAppid(), config.getAppkey());
SmsSingleSenderResult result = ssender.send(0, "86", phoneNumber, SmsSingleSenderResult result = ssender.send(0, "86", phoneNumber,
content, "", ""); content, "", "");
...@@ -43,12 +35,17 @@ class SMSSendService { ...@@ -43,12 +35,17 @@ class SMSSendService {
} }
} }
@Async("notifyAsync") /**
* 通过模版发送短信息
* @param phoneNumber
* @param templateId
* @param params
*/
public void sendSMSWithTemplate(String phoneNumber, int templateId, String[] params) { public void sendSMSWithTemplate(String phoneNumber, int templateId, String[] params) {
try { try {
SmsSingleSender ssender = new SmsSingleSender(appid, appkey); SmsSingleSender ssender = new SmsSingleSender(config.getAppid(), config.getAppkey());
SmsSingleSenderResult result = ssender.sendWithParam("86", phoneNumber, SmsSingleSenderResult result = ssender.sendWithParam("86", phoneNumber,
templateId, params, smsSign, "", ""); // 签名参数未提供或者为空时,会使用默认签名发送短信 templateId, params, config.getSign(), "", ""); // 签名参数未提供或者为空时,会使用默认签名发送短信
// System.out.println(result); // System.out.println(result);
} catch (HTTPException e) { } catch (HTTPException e) {
// HTTP响应码错误 // HTTP响应码错误
......
package org.linlinjava.litemall.core.notify; package org.linlinjava.litemall.core.notify;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.context.annotation.PropertySource; import org.linlinjava.litemall.core.notify.config.WXNotifyConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.net.ssl.*; import javax.net.ssl.*;
...@@ -16,11 +17,13 @@ import java.security.cert.CertificateException; ...@@ -16,11 +17,13 @@ import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
/** /**
* 微信模版消息通知,未完成 * 微信模版消息通知
*/ */
@PropertySource(value = "classpath:notify.properties")
@Service("wxTemplateMsgSendService") @Service("wxTemplateMsgSendService")
public class WXTemplateMsgSendService { class WXTemplateSendService {
@Autowired
WXNotifyConfig config;
/** /**
* 发送微信消息(模板消息) * 发送微信消息(模板消息)
* *
...@@ -29,10 +32,11 @@ public class WXTemplateMsgSendService { ...@@ -29,10 +32,11 @@ public class WXTemplateMsgSendService {
* @param formId payId或者表单ID * @param formId payId或者表单ID
* @param clickurl URL置空,则在发送后,点击模板消息会进入一个空白页面(ios),或无法点击(android)。 * @param clickurl URL置空,则在发送后,点击模板消息会进入一个空白页面(ios),或无法点击(android)。
* @param topcolor 标题颜色 * @param topcolor 标题颜色
* @param data 详细内容 * @param parms 详细内容
* @return * @return
*/ */
public String sendWechatMsgToUser(String token, String touser, String templatId, String formId, String clickurl, String topcolor, JSONObject data) { public String sendWechatMsg(String token, String touser, String templatId, String formId, String clickurl, String topcolor, String[] parms) {
try {
String tmpurl = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" + token; String tmpurl = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" + token;
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("touser", touser); json.put("touser", touser);
...@@ -40,8 +44,8 @@ public class WXTemplateMsgSendService { ...@@ -40,8 +44,8 @@ public class WXTemplateMsgSendService {
json.put("form_id", formId); json.put("form_id", formId);
json.put("url", clickurl); json.put("url", clickurl);
json.put("topcolor", topcolor); json.put("topcolor", topcolor);
json.put("data", data); json.put("data", createParmData(parms));
try {
JSONObject result = httpsRequest(tmpurl, "POST", json.toString()); JSONObject result = httpsRequest(tmpurl, "POST", json.toString());
// log.info("发送微信消息返回信息:" + resultJson.get("errcode")); // log.info("发送微信消息返回信息:" + resultJson.get("errcode"));
String errmsg = (String) result.get("errmsg"); String errmsg = (String) result.get("errmsg");
...@@ -55,6 +59,23 @@ public class WXTemplateMsgSendService { ...@@ -55,6 +59,23 @@ public class WXTemplateMsgSendService {
return "success"; return "success";
} }
/**
* 根据参数生成对应的 json 数据
* @param parms
* @return
*/
private JSONObject createParmData(String[] parms) {
JSONObject json = new JSONObject();
for (int i = 1; i <= parms.length; i++) {
JSONObject json2 = new JSONObject();
json2.put("value", parms[i-1]);
json.put("keyword" + i, json2);
}
return json;
}
/** /**
* 发送https请求 * 发送https请求
* *
...@@ -125,7 +146,6 @@ public class WXTemplateMsgSendService { ...@@ -125,7 +146,6 @@ public class WXTemplateMsgSendService {
@Override @Override
public X509Certificate[] getAcceptedIssuers() { public X509Certificate[] getAcceptedIssuers() {
// return new X509Certificate[0];
return null; return null;
} }
} }
......
package org.linlinjava.litemall.core.notify.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "MailNotifyConfig")
public class MailNotifyConfig {
private boolean enable;
private String host;
private String username;
private String password;
private String sendto;
public boolean isEnable() {
return enable;
}
public void setEnable(boolean enable) {
this.enable = enable;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSendto() {
return sendto;
}
public void setSendto(String sendto) {
this.sendto = sendto;
}
}
package org.linlinjava.litemall.core.notify.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
@ConfigurationProperties(prefix = "SMSNotifyConfig")
public class SMSNotifyConfig {
private boolean enable;
private int appid;
private String appkey;
private String sign;
private List<Map<String,String>> template = new ArrayList<>();
public boolean isEnable() {
return enable;
}
public void setEnable(boolean enable) {
this.enable = enable;
}
public int getAppid() {
return appid;
}
public void setAppid(int appid) {
this.appid = appid;
}
public String getAppkey() {
return appkey;
}
public void setAppkey(String appkey) {
this.appkey = appkey;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public List<Map<String, String>> getTemplate() {
return template;
}
public void setTemplate(List<Map<String, String>> template) {
this.template = template;
}
}
package org.linlinjava.litemall.core.notify.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
@ConfigurationProperties(prefix = "WXNotifyConfig")
public class WXNotifyConfig {
private boolean enable;
private List<Map<String,String>> template = new ArrayList<>();
public boolean isEnable() {
return enable;
}
public void setEnable(boolean enable) {
this.enable = enable;
}
public List<Map<String, String>> getTemplate() {
return template;
}
public void setTemplate(List<Map<String, String>> template) {
this.template = template;
}
}
package org.linlinjava.litemall.core.notify.util;
import java.util.List;
import java.util.Map;
public class ConfigUtil {
/**
* 通过枚举获取对应的 templateId,注意 application.yaml 里字段名必须一致
* @param notifyType
* @param values
* @return
*/
public static String getTemplateId(NotifyType notifyType, List<Map<String, String>> values) {
for (Map<String, String> item : values) {
String notifyTypeStr = getNotifyType(notifyType);
if (item.get("name").equals(notifyTypeStr))
return item.get("templateId");
}
return "";
}
/**
* 该处字符串对应 application.yaml 里 template.name 的值,请注意
* @param notifyType
* @return
*/
private static String getNotifyType(NotifyType notifyType)
{
switch (notifyType) {
case PAY_SUCCEED:
return "paySucceed";
case CAPTCHA:
return "captcha";
}
return "";
}
/**
* 该枚举定义了所有的需要通知的事件,调用通知时作为参数
*
* PAY_SUCCEED 支付成功,通常用于用户支付成功
* CAPTCHA 验证码,通常用于登录、注册、找回密码
*/
public enum NotifyType {
PAY_SUCCEED,
CAPTCHA
}
}
# 邮件通知配置,邮箱一般用于接收业务通知例如收到新的订单,sendto 定义邮件接收者,通常为商城运营人员
MailNotifyConfig:
enable: false
host: smtp.exmail.qq.com
username: ex@ex.com.cn
password: XXXXXXXXXXXXX
sendto: ex@qq.com
# 短消息模版通知配置
# 短信息用于通知客户,例如发货短信通知,注意配置格式;template-name,template-templateId 请参考 ConfigUtil 内枚举值
SMSNotifyConfig:
enable: false
appid: 111111111
appkey: xxxxxxxxxxxxxx
sign: xxxxxxxxx
template:
- name: paySucceed
templateId: 156349
- name: captcha
templateId: 156433
# 微信模版通知配置
# 微信模版用于通知客户或者运营者,注意配置格式;template-name,template-templateId 请参考 ConfigUtil 内枚举值
WXNotifyConfig:
enable: false
template:
- name: paySucceed
templateId: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- name: captcha
templateId: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# 发送线程池配置
NotifyPoolConfig:
corePoolSize: 5
maxPoolSize: 100
queueCapacity: 50
\ No newline at end of file
# 邮件发送配置
sprint.mail.enable=false
spring.mail.host=smtp.exmail.qq.com
spring.mail.username=xxxxxx
spring.mail.password=xxxxxx
spring.mail.sendto=example@qq.com
# 短信发送配置
spring.sms.enable=false
spring.sms.appid=111111
spring.sms.appkey=xxxxxx
spring.sms.sign=xxxxxx
# 短信模板消息配置
# 请在腾讯短信平台配置通知消息模板,然后这里设置不同短信模板ID
# 请参考LitemallNotifyService.notifySMSTemplate
spring.sms.template.paySucceed=111111
spring.sms.template.captcha=222222
# \u53D1\u9001\u7EBF\u7A0B\u6C60\u914D\u7F6E
spring.notify.corePoolSize=5
spring.notify.maxPoolSize=100
spring.notify.queueCapacity=50
\ No newline at end of file
...@@ -3,7 +3,7 @@ package org.linlinjava.litemall.core; ...@@ -3,7 +3,7 @@ package org.linlinjava.litemall.core;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.linlinjava.litemall.core.notify.LitemallNotifyService; import org.linlinjava.litemall.core.notify.LitemallNotifyService;
import org.linlinjava.litemall.core.notify.NotifyUtils; import org.linlinjava.litemall.core.notify.util.ConfigUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
...@@ -47,7 +47,7 @@ public class SmsTest { ...@@ -47,7 +47,7 @@ public class SmsTest {
String phone = "xxxxxxxxxxx"; String phone = "xxxxxxxxxxx";
String[] params = new String[] {"123456"}; String[] params = new String[] {"123456"};
litemallNotifyService.notifySMSTemplate(phone, NotifyUtils.NotifyType.CAPTCHA, params); litemallNotifyService.notifySMSTemplate(phone, ConfigUtil.NotifyType.CAPTCHA, params);
try { try {
Thread.sleep(5000); Thread.sleep(5000);
...@@ -61,7 +61,7 @@ public class SmsTest { ...@@ -61,7 +61,7 @@ public class SmsTest {
String phone = "xxxxxxxxxxx"; String phone = "xxxxxxxxxxx";
String[] params = new String[] {"123456"}; String[] params = new String[] {"123456"};
litemallNotifyService.notifySMSTemplate(phone, NotifyUtils.NotifyType.PAY_SUCCEED, params); litemallNotifyService.notifySMSTemplate(phone, ConfigUtil.NotifyType.PAY_SUCCEED, params);
try { try {
Thread.sleep(5000); Thread.sleep(5000);
......
...@@ -10,7 +10,7 @@ import org.apache.commons.io.IOUtils; ...@@ -10,7 +10,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.linlinjava.litemall.core.notify.LitemallNotifyService; import org.linlinjava.litemall.core.notify.LitemallNotifyService;
import org.linlinjava.litemall.core.notify.NotifyUtils; import org.linlinjava.litemall.core.notify.util.ConfigUtil;
import org.linlinjava.litemall.core.util.JacksonUtil; import org.linlinjava.litemall.core.util.JacksonUtil;
import org.linlinjava.litemall.core.util.ResponseUtil; import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.*; import org.linlinjava.litemall.db.domain.*;
...@@ -554,7 +554,7 @@ public class WxOrderController { ...@@ -554,7 +554,7 @@ public class WxOrderController {
//TODO 发送邮件和短信通知,这里采用异步发送 //TODO 发送邮件和短信通知,这里采用异步发送
// 订单支付成功以后,会发送短信给用户,以及发送邮件给管理员 // 订单支付成功以后,会发送短信给用户,以及发送邮件给管理员
litemallNotifyService.notifyMailMessage("新订单通知", order.toString()); litemallNotifyService.notifyMailMessage("新订单通知", order.toString());
litemallNotifyService.notifySMSTemplate(order.getMobile(), NotifyUtils.NotifyType.PAY_SUCCEED, new String[]{orderSn}); litemallNotifyService.notifySMSTemplate(order.getMobile(), ConfigUtil.NotifyType.PAY_SUCCEED, new String[]{orderSn});
return WxPayNotifyResponse.success("处理成功!"); return WxPayNotifyResponse.success("处理成功!");
} catch (Exception e) { } catch (Exception e) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment