Skip to content

Commit

Permalink
Merge pull request #222 from rememberber/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rememberber committed Sep 15, 2019
2 parents 99ad1d3 + 21ce106 commit 2db3c7f
Show file tree
Hide file tree
Showing 28 changed files with 2,123 additions and 187 deletions.
3 changes: 3 additions & 0 deletions download.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<details>
<summary>Windows</summary>

[WePush-v3.9.0_190915-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v3.9.0_190915-x64-Setup.exe)
[WePush-v3.8.0_190909-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v3.8.0_190909-x64-Setup.exe)
[WePush-v3.7.0_190904-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v3.7.0_190904-x64-Setup.exe)
[WePush-v3.6.3_190825-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v3.6.3_190825-x64-Setup.exe)
Expand Down Expand Up @@ -69,6 +70,7 @@
<details>
<summary>Mac OS</summary>

[v_3.9.0_190915.app](http://download.zhoubochina.com/mac/3.9.0.zip)
[v_3.6.2_190811.app](http://download.zhoubochina.com/mac/3.6.2.zip)
[v_3.6.1_190728.app](http://download.zhoubochina.com/mac/3.6.1.zip)
[v_3.6.0_190721.app](http://download.zhoubochina.com/mac/3.6.0.zip)
Expand Down Expand Up @@ -109,6 +111,7 @@
<details>
<summary>Linux</summary>

[v3.9.0_190915](http://download.zhoubochina.com/linux/WePush-3.9.0.zip)
[v3.8.0_190909](http://download.zhoubochina.com/linux/WePush-3.8.0.zip)
[v3.7.0_190904](http://download.zhoubochina.com/linux/WePush-3.7.0.zip)
[v3.6.3_190825](http://download.zhoubochina.com/linux/WePush-3.6.3.zip)
Expand Down
84 changes: 84 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,90 @@
<version>${aliyun-java-sdk-dysmsapi.version}</version>
</dependency>

<dependency>
<groupId>com.baidubce</groupId>
<artifactId>bce-java-sdk</artifactId>
<version>0.10.75</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
<exclusion>
<artifactId>logback-core</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>commons-beanutils</artifactId>
<groupId>commons-beanutils</groupId>
</exclusion>
<exclusion>
<artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId>
</exclusion>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>jaxb-api</artifactId>
<groupId>javax.xml.bind</groupId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>commons-compress</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
<exclusion>
<artifactId>commons-math3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
<exclusion>
<artifactId>httpasyncclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public enum MessageTypeEnum {
EMAIL(11, "E-Mail"),
WX_CP(12, "微信企业号/企业微信"),
HTTP(13, "HTTP请求"),
DING(14, "钉钉");
DING(14, "钉钉"),
BD_YUN(15, "百度云短信");

private int code;

Expand All @@ -43,6 +44,7 @@ public enum MessageTypeEnum {
public static final int WX_CP_CODE = 12;
public static final int HTTP_CODE = 13;
public static final int DING_CODE = 14;
public static final int BD_YUN_CODE = 15;

MessageTypeEnum(int code, String name) {
this.code = code;
Expand Down Expand Up @@ -91,7 +93,11 @@ public static String getName(int code) {
case 14:
name = DING.name;
break;
case 15:
name = BD_YUN.name;
break;
default:
name = "";
}
return name;
}
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/fangxuele/tool/push/logic/PushControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,28 @@ public static boolean configCheck() {
return false;
}
break;
case MessageTypeEnum.BD_YUN_CODE:
String bdAccessKeyId = App.config.getBdAccessKeyId();
String bdSecretAccessKey = App.config.getBdSecretAccessKey();

if (StringUtils.isEmpty(bdAccessKeyId) || StringUtils.isEmpty(bdSecretAccessKey)) {
JOptionPane.showMessageDialog(settingForm.getSettingPanel(),
"请先在设置中填写并保存百度云短信相关配置!", "提示",
JOptionPane.INFORMATION_MESSAGE);
return false;
}
break;
case MessageTypeEnum.HW_YUN_CODE:
String hwAppKey = App.config.getHwAppKey();
String hwAppSecretPassword = App.config.getHwAppSecretPassword();

if (StringUtils.isEmpty(hwAppKey) || StringUtils.isEmpty(hwAppSecretPassword)) {
JOptionPane.showMessageDialog(settingForm.getSettingPanel(),
"请先在设置中填写并保存华为云短信相关配置!", "提示",
JOptionPane.INFORMATION_MESSAGE);
return false;
}
break;
case MessageTypeEnum.YUN_PIAN_CODE:
String yunpianApiKey = App.config.getYunpianApiKey();
if (StringUtils.isEmpty(yunpianApiKey)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.fangxuele.tool.push.logic.msgmaker;

import com.fangxuele.tool.push.ui.form.msg.BdYunMsgForm;
import com.fangxuele.tool.push.util.TemplateUtil;
import com.google.common.collect.Maps;
import org.apache.velocity.VelocityContext;

import javax.swing.table.DefaultTableModel;
import java.util.Map;

/**
* <pre>
* 百度云模板短信加工器
* </pre>
*
* @author <a href="https://github.com/rememberber">Zhou Bo</a>
* @since 2019/6/14.
*/
public class BdYunMsgMaker extends BaseMsgMaker implements IMsgMaker {

public static String templateId;

public static Map<String, String> paramMap;

/**
* 准备(界面字段等)
*/
@Override
public void prepare() {
templateId = BdYunMsgForm.getInstance().getMsgTemplateIdTextField().getText();

if (BdYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
BdYunMsgForm.initTemplateDataTable();
}

DefaultTableModel tableModel = (DefaultTableModel) BdYunMsgForm.getInstance().getTemplateMsgDataTable().getModel();
int rowCount = tableModel.getRowCount();
paramMap = Maps.newHashMap();
for (int i = 0; i < rowCount; i++) {
String key = ((String) tableModel.getValueAt(i, 0));
String value = ((String) tableModel.getValueAt(i, 1));
paramMap.put(key, value);
}
}

/**
* 组织百度云短信消息
*
* @param msgData 消息信息
* @return String[]
*/
@Override
public Map<String, String> makeMsg(String[] msgData) {

VelocityContext velocityContext = getVelocityContext(msgData);
for (Map.Entry<String, String> stringStringEntry : paramMap.entrySet()) {
stringStringEntry.setValue(TemplateUtil.evaluate(stringStringEntry.getValue(), velocityContext));
}
return paramMap;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.fangxuele.tool.push.logic.msgmaker;

import com.fangxuele.tool.push.ui.form.msg.HwYunMsgForm;
import com.fangxuele.tool.push.util.TemplateUtil;
import org.apache.commons.compress.utils.Lists;
import org.apache.velocity.VelocityContext;

import javax.swing.table.DefaultTableModel;
import java.util.List;

/**
* <pre>
* 华为云模板短信加工器
* </pre>
*
* @author <a href="https://github.com/rememberber">Zhou Bo</a>
* @since 2019/6/14.
*/
public class HwYunMsgMaker extends BaseMsgMaker implements IMsgMaker{

public static String templateId;

public static List<String> paramList;

/**
* 准备(界面字段等)
*/
@Override
public void prepare() {
templateId = HwYunMsgForm.getInstance().getMsgTemplateIdTextField().getText();

if (HwYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
HwYunMsgForm.initTemplateDataTable();
}

DefaultTableModel tableModel = (DefaultTableModel) HwYunMsgForm.getInstance().getTemplateMsgDataTable().getModel();
int rowCount = tableModel.getRowCount();
paramList = Lists.newArrayList();
for (int i = 0; i < rowCount; i++) {
String value = ((String) tableModel.getValueAt(i, 1));
paramList.add(value);
}
}

/**
* 组织华为云短信消息
*
* @param msgData 消息信息
* @return String[]
*/
@Override
public String[] makeMsg(String[] msgData) {

VelocityContext velocityContext = getVelocityContext(msgData);
for (int i = 0; i < paramList.size(); i++) {
paramList.set(i, TemplateUtil.evaluate(paramList.get(i), velocityContext));
}
String[] paramArray = new String[paramList.size()];
return paramList.toArray(paramArray);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public static IMsgMaker getMsgMaker() {
case MessageTypeEnum.TX_YUN_CODE:
iMsgMaker = new TxYunMsgMaker();
break;
case MessageTypeEnum.HW_YUN_CODE:
iMsgMaker = new HwYunMsgMaker();
break;
case MessageTypeEnum.YUN_PIAN_CODE:
iMsgMaker = new YunPianMsgMaker();
break;
Expand All @@ -51,6 +54,9 @@ public static IMsgMaker getMsgMaker() {
case MessageTypeEnum.DING_CODE:
iMsgMaker = new DingMsgMaker();
break;
case MessageTypeEnum.BD_YUN_CODE:
iMsgMaker = new BdYunMsgMaker();
break;
default:
}
return iMsgMaker;
Expand Down
Loading

0 comments on commit 2db3c7f

Please sign in to comment.