From d5408d137ec2b15c9b9fdd22ef4cdf5b6c078b1c Mon Sep 17 00:00:00 2001 From: Lanlan Date: Thu, 13 Jun 2019 16:36:46 +0800 Subject: [PATCH] Initial Commit --- build.xml | 118 ++++++++++++++++++ plugin.xml | 15 +++ pom.xml | 18 +++ .../java/com/fr/plugin/third/sms/SRGT.java | 66 ++++++++++ 4 files changed, 217 insertions(+) create mode 100755 build.xml create mode 100755 plugin.xml create mode 100644 pom.xml create mode 100644 src/main/java/com/fr/plugin/third/sms/SRGT.java diff --git a/build.xml b/build.xml new file mode 100755 index 0000000..c5d3582 --- /dev/null +++ b/build.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugin.xml b/plugin.xml new file mode 100755 index 0000000..cb92daa --- /dev/null +++ b/plugin.xml @@ -0,0 +1,15 @@ + + + com.fr.plugin.third.sms.v10 + + yes + 1.0 + 10.0 + 2017-11-17 + Lanlan + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..21143b8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + + com.fr.plugin + starter + 10.0 + + jar + demo-third-sms + + + ${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.third.sms-1.0/classes + + \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/third/sms/SRGT.java b/src/main/java/com/fr/plugin/third/sms/SRGT.java new file mode 100644 index 0000000..f4d60c4 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/sms/SRGT.java @@ -0,0 +1,66 @@ +package com.fr.plugin.third.sms; + +import com.fr.base.sms.SMSContext; +import com.fr.base.top.impl.AbstractSMSServiceProcessor; +import com.fr.base.top.impl.SMSListenerAdapter; +import com.fr.base.top.impl.ThirdResponse; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.transform.ExecuteFunctionRecord; +import com.fr.plugin.transform.FunctionRecorder; +import java.util.List; + +/** + * @author Lanlan + * @date 2019/1/29 + */ +@FunctionRecorder +public class SRGT extends AbstractSMSServiceProcessor { + + public SRGT() { + startListener(); + } + + @Override + public ThirdResponse sendTest(String mobile) { + System.out.println("发送测试短信成功"); + FineLoggerFactory.getLogger().info("发送测试短信成功"); + return ThirdResponse.create(ThirdResponse.RES_STATUS_SUCCESS, "发送测试短信成功", JSONObject.create()); + } + + @Override + @ExecuteFunctionRecord + public ThirdResponse send(String template, String mobile, JSONObject para, String receiver) throws Exception { + System.out.println("发送普通短信成功"); + FineLoggerFactory.getLogger().info("发送普通短信成功"); + return ThirdResponse.create(ThirdResponse.RES_STATUS_SUCCESS, "发送普通短信成功", JSONObject.create()); + } + + @Override + public ThirdResponse batchSendSMS(String template, List mobiles, JSONArray params, List receivers) throws Exception { + System.out.println("发送批量短信成功"); + FineLoggerFactory.getLogger().info("发送批量短信成功"); + return ThirdResponse.create(ThirdResponse.RES_STATUS_SUCCESS, "发送批量短信成功", JSONObject.create()); + } + + /** + * 启动发送短信的监听器 + */ + private void startListener() { + SMSContext.addSmsListener(new SMSListenerAdapter() { + + @Override + public void beforeSend(String text, List mobiles, JSONArray params, List receivers) { + System.out.println("发送短信前监听事件"); + FineLoggerFactory.getLogger().info("发送短信前监听事件"); + } + + @Override + public void afterSend(String text, List mobiles, JSONArray params, List receivers, ThirdResponse response) { + System.out.println("发送短信后监听事件"); + FineLoggerFactory.getLogger().info("发送短信后监听事件"); + } + }); + } +} \ No newline at end of file