selectByMsgTypeAndMsgId(@Param("msgType") int msgType, @Param("msgId") int msgId);
+
+ int deleteByMsgTypeAndMsgId(@Param("msgType") int msgType, @Param("msgId") int msgId);
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/dao/TWxMpUserMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TWxMpUserMapper.java
new file mode 100644
index 00000000..381239a9
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/dao/TWxMpUserMapper.java
@@ -0,0 +1,19 @@
+package com.fangxuele.tool.push.dao;
+
+import com.fangxuele.tool.push.domain.TWxMpUser;
+
+public interface TWxMpUserMapper {
+ int deleteByPrimaryKey(String openId);
+
+ int insert(TWxMpUser record);
+
+ int insertSelective(TWxMpUser record);
+
+ TWxMpUser selectByPrimaryKey(String openId);
+
+ int updateByPrimaryKeySelective(TWxMpUser record);
+
+ int updateByPrimaryKey(TWxMpUser record);
+
+ int deleteAll();
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgKefu.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgKefu.java
new file mode 100644
index 00000000..cdc246e3
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgKefu.java
@@ -0,0 +1,117 @@
+package com.fangxuele.tool.push.domain;
+
+import java.io.Serializable;
+
+public class TMsgKefu implements Serializable {
+ private Integer id;
+
+ private Integer msgType;
+
+ private String msgName;
+
+ private String kefuMsgType;
+
+ private String content;
+
+ private String title;
+
+ private String imgUrl;
+
+ private String describe;
+
+ private String url;
+
+ private String createTime;
+
+ private String modifiedTime;
+
+ private static final long serialVersionUID = 1L;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getMsgType() {
+ return msgType;
+ }
+
+ public void setMsgType(Integer msgType) {
+ this.msgType = msgType;
+ }
+
+ public String getMsgName() {
+ return msgName;
+ }
+
+ public void setMsgName(String msgName) {
+ this.msgName = msgName == null ? null : msgName.trim();
+ }
+
+ public String getKefuMsgType() {
+ return kefuMsgType;
+ }
+
+ public void setKefuMsgType(String kefuMsgType) {
+ this.kefuMsgType = kefuMsgType == null ? null : kefuMsgType.trim();
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content == null ? null : content.trim();
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title == null ? null : title.trim();
+ }
+
+ public String getImgUrl() {
+ return imgUrl;
+ }
+
+ public void setImgUrl(String imgUrl) {
+ this.imgUrl = imgUrl == null ? null : imgUrl.trim();
+ }
+
+ public String getDescribe() {
+ return describe;
+ }
+
+ public void setDescribe(String describe) {
+ this.describe = describe == null ? null : describe.trim();
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url == null ? null : url.trim();
+ }
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime == null ? null : createTime.trim();
+ }
+
+ public String getModifiedTime() {
+ return modifiedTime;
+ }
+
+ public void setModifiedTime(String modifiedTime) {
+ this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgKefuPriority.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgKefuPriority.java
new file mode 100644
index 00000000..fa3c90a6
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgKefuPriority.java
@@ -0,0 +1,157 @@
+package com.fangxuele.tool.push.domain;
+
+import java.io.Serializable;
+
+public class TMsgKefuPriority implements Serializable {
+ private Integer id;
+
+ private Integer msgType;
+
+ private String msgName;
+
+ private String templateId;
+
+ private String url;
+
+ private String maAppid;
+
+ private String maPagePath;
+
+ private String kefuMsgType;
+
+ private String content;
+
+ private String title;
+
+ private String imgUrl;
+
+ private String describe;
+
+ private String kefuUrl;
+
+ private String createTime;
+
+ private String modifiedTime;
+
+ private static final long serialVersionUID = 1L;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getMsgType() {
+ return msgType;
+ }
+
+ public void setMsgType(Integer msgType) {
+ this.msgType = msgType;
+ }
+
+ public String getMsgName() {
+ return msgName;
+ }
+
+ public void setMsgName(String msgName) {
+ this.msgName = msgName == null ? null : msgName.trim();
+ }
+
+ public String getTemplateId() {
+ return templateId;
+ }
+
+ public void setTemplateId(String templateId) {
+ this.templateId = templateId == null ? null : templateId.trim();
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url == null ? null : url.trim();
+ }
+
+ public String getMaAppid() {
+ return maAppid;
+ }
+
+ public void setMaAppid(String maAppid) {
+ this.maAppid = maAppid == null ? null : maAppid.trim();
+ }
+
+ public String getMaPagePath() {
+ return maPagePath;
+ }
+
+ public void setMaPagePath(String maPagePath) {
+ this.maPagePath = maPagePath == null ? null : maPagePath.trim();
+ }
+
+ public String getKefuMsgType() {
+ return kefuMsgType;
+ }
+
+ public void setKefuMsgType(String kefuMsgType) {
+ this.kefuMsgType = kefuMsgType == null ? null : kefuMsgType.trim();
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content == null ? null : content.trim();
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title == null ? null : title.trim();
+ }
+
+ public String getImgUrl() {
+ return imgUrl;
+ }
+
+ public void setImgUrl(String imgUrl) {
+ this.imgUrl = imgUrl == null ? null : imgUrl.trim();
+ }
+
+ public String getDescribe() {
+ return describe;
+ }
+
+ public void setDescribe(String describe) {
+ this.describe = describe == null ? null : describe.trim();
+ }
+
+ public String getKefuUrl() {
+ return kefuUrl;
+ }
+
+ public void setKefuUrl(String kefuUrl) {
+ this.kefuUrl = kefuUrl == null ? null : kefuUrl.trim();
+ }
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime == null ? null : createTime.trim();
+ }
+
+ public String getModifiedTime() {
+ return modifiedTime;
+ }
+
+ public void setModifiedTime(String modifiedTime) {
+ this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgMaTemplate.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgMaTemplate.java
new file mode 100644
index 00000000..3914f85d
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgMaTemplate.java
@@ -0,0 +1,87 @@
+package com.fangxuele.tool.push.domain;
+
+import java.io.Serializable;
+
+public class TMsgMaTemplate implements Serializable {
+ private Integer id;
+
+ private Integer msgType;
+
+ private String msgName;
+
+ private String templateId;
+
+ private String page;
+
+ private String emphasisKeyword;
+
+ private String createTime;
+
+ private String modifiedTime;
+
+ private static final long serialVersionUID = 1L;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getMsgType() {
+ return msgType;
+ }
+
+ public void setMsgType(Integer msgType) {
+ this.msgType = msgType;
+ }
+
+ public String getMsgName() {
+ return msgName;
+ }
+
+ public void setMsgName(String msgName) {
+ this.msgName = msgName == null ? null : msgName.trim();
+ }
+
+ public String getTemplateId() {
+ return templateId;
+ }
+
+ public void setTemplateId(String templateId) {
+ this.templateId = templateId == null ? null : templateId.trim();
+ }
+
+ public String getPage() {
+ return page;
+ }
+
+ public void setPage(String page) {
+ this.page = page == null ? null : page.trim();
+ }
+
+ public String getEmphasisKeyword() {
+ return emphasisKeyword;
+ }
+
+ public void setEmphasisKeyword(String emphasisKeyword) {
+ this.emphasisKeyword = emphasisKeyword == null ? null : emphasisKeyword.trim();
+ }
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime == null ? null : createTime.trim();
+ }
+
+ public String getModifiedTime() {
+ return modifiedTime;
+ }
+
+ public void setModifiedTime(String modifiedTime) {
+ this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgMpTemplate.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgMpTemplate.java
new file mode 100644
index 00000000..c981b0fa
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgMpTemplate.java
@@ -0,0 +1,97 @@
+package com.fangxuele.tool.push.domain;
+
+import java.io.Serializable;
+
+public class TMsgMpTemplate implements Serializable {
+ private Integer id;
+
+ private Integer msgType;
+
+ private String msgName;
+
+ private String templateId;
+
+ private String url;
+
+ private String maAppid;
+
+ private String maPagePath;
+
+ private String createTime;
+
+ private String modifiedTime;
+
+ private static final long serialVersionUID = 1L;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getMsgType() {
+ return msgType;
+ }
+
+ public void setMsgType(Integer msgType) {
+ this.msgType = msgType;
+ }
+
+ public String getMsgName() {
+ return msgName;
+ }
+
+ public void setMsgName(String msgName) {
+ this.msgName = msgName == null ? null : msgName.trim();
+ }
+
+ public String getTemplateId() {
+ return templateId;
+ }
+
+ public void setTemplateId(String templateId) {
+ this.templateId = templateId == null ? null : templateId.trim();
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url == null ? null : url.trim();
+ }
+
+ public String getMaAppid() {
+ return maAppid;
+ }
+
+ public void setMaAppid(String maAppid) {
+ this.maAppid = maAppid == null ? null : maAppid.trim();
+ }
+
+ public String getMaPagePath() {
+ return maPagePath;
+ }
+
+ public void setMaPagePath(String maPagePath) {
+ this.maPagePath = maPagePath == null ? null : maPagePath.trim();
+ }
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime == null ? null : createTime.trim();
+ }
+
+ public String getModifiedTime() {
+ return modifiedTime;
+ }
+
+ public void setModifiedTime(String modifiedTime) {
+ this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgSms.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgSms.java
new file mode 100644
index 00000000..f6c9745d
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgSms.java
@@ -0,0 +1,77 @@
+package com.fangxuele.tool.push.domain;
+
+import java.io.Serializable;
+
+public class TMsgSms implements Serializable {
+ private Integer id;
+
+ private Integer msgType;
+
+ private String msgName;
+
+ private String templateId;
+
+ private String content;
+
+ private String createTime;
+
+ private String modifiedTime;
+
+ private static final long serialVersionUID = 1L;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getMsgType() {
+ return msgType;
+ }
+
+ public void setMsgType(Integer msgType) {
+ this.msgType = msgType;
+ }
+
+ public String getMsgName() {
+ return msgName;
+ }
+
+ public void setMsgName(String msgName) {
+ this.msgName = msgName == null ? null : msgName.trim();
+ }
+
+ public String getTemplateId() {
+ return templateId;
+ }
+
+ public void setTemplateId(String templateId) {
+ this.templateId = templateId == null ? null : templateId.trim();
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content == null ? null : content.trim();
+ }
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime == null ? null : createTime.trim();
+ }
+
+ public String getModifiedTime() {
+ return modifiedTime;
+ }
+
+ public void setModifiedTime(String modifiedTime) {
+ this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TPushHistory.java b/src/main/java/com/fangxuele/tool/push/domain/TPushHistory.java
new file mode 100644
index 00000000..ef6d17a0
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/domain/TPushHistory.java
@@ -0,0 +1,87 @@
+package com.fangxuele.tool.push.domain;
+
+import java.io.Serializable;
+
+public class TPushHistory implements Serializable {
+ private Integer id;
+
+ private Integer msgId;
+
+ private Integer msgType;
+
+ private String msgName;
+
+ private String result;
+
+ private String csvFile;
+
+ private String createTime;
+
+ private String modifiedTime;
+
+ private static final long serialVersionUID = 1L;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getMsgId() {
+ return msgId;
+ }
+
+ public void setMsgId(Integer msgId) {
+ this.msgId = msgId;
+ }
+
+ public Integer getMsgType() {
+ return msgType;
+ }
+
+ public void setMsgType(Integer msgType) {
+ this.msgType = msgType;
+ }
+
+ public String getMsgName() {
+ return msgName;
+ }
+
+ public void setMsgName(String msgName) {
+ this.msgName = msgName == null ? null : msgName.trim();
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result == null ? null : result.trim();
+ }
+
+ public String getCsvFile() {
+ return csvFile;
+ }
+
+ public void setCsvFile(String csvFile) {
+ this.csvFile = csvFile == null ? null : csvFile.trim();
+ }
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime == null ? null : createTime.trim();
+ }
+
+ public String getModifiedTime() {
+ return modifiedTime;
+ }
+
+ public void setModifiedTime(String modifiedTime) {
+ this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TTemplateData.java b/src/main/java/com/fangxuele/tool/push/domain/TTemplateData.java
new file mode 100644
index 00000000..fd07a7d0
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/domain/TTemplateData.java
@@ -0,0 +1,87 @@
+package com.fangxuele.tool.push.domain;
+
+import java.io.Serializable;
+
+public class TTemplateData implements Serializable {
+ private Integer id;
+
+ private Integer msgType;
+
+ private Integer msgId;
+
+ private String name;
+
+ private String value;
+
+ private String color;
+
+ private String createTime;
+
+ private String modifiedTime;
+
+ private static final long serialVersionUID = 1L;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getMsgType() {
+ return msgType;
+ }
+
+ public void setMsgType(Integer msgType) {
+ this.msgType = msgType;
+ }
+
+ public Integer getMsgId() {
+ return msgId;
+ }
+
+ public void setMsgId(Integer msgId) {
+ this.msgId = msgId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name == null ? null : name.trim();
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value == null ? null : value.trim();
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color == null ? null : color.trim();
+ }
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime == null ? null : createTime.trim();
+ }
+
+ public String getModifiedTime() {
+ return modifiedTime;
+ }
+
+ public void setModifiedTime(String modifiedTime) {
+ this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TWxMpUser.java b/src/main/java/com/fangxuele/tool/push/domain/TWxMpUser.java
new file mode 100644
index 00000000..5b63d772
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/domain/TWxMpUser.java
@@ -0,0 +1,187 @@
+package com.fangxuele.tool.push.domain;
+
+import java.io.Serializable;
+
+public class TWxMpUser implements Serializable {
+ private String openId;
+
+ private String nickname;
+
+ private String sexDesc;
+
+ private Integer sex;
+
+ private String language;
+
+ private String city;
+
+ private String province;
+
+ private String country;
+
+ private String headImgUrl;
+
+ private String subscribeTime;
+
+ private String unionId;
+
+ private String remark;
+
+ private Integer groupId;
+
+ private String subscribeScene;
+
+ private String qrScene;
+
+ private String qrSceneStr;
+
+ private String createTime;
+
+ private String modifiedTime;
+
+ private static final long serialVersionUID = 1L;
+
+ public String getOpenId() {
+ return openId;
+ }
+
+ public void setOpenId(String openId) {
+ this.openId = openId == null ? null : openId.trim();
+ }
+
+ public String getNickname() {
+ return nickname;
+ }
+
+ public void setNickname(String nickname) {
+ this.nickname = nickname == null ? null : nickname.trim();
+ }
+
+ public String getSexDesc() {
+ return sexDesc;
+ }
+
+ public void setSexDesc(String sexDesc) {
+ this.sexDesc = sexDesc == null ? null : sexDesc.trim();
+ }
+
+ public Integer getSex() {
+ return sex;
+ }
+
+ public void setSex(Integer sex) {
+ this.sex = sex;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language == null ? null : language.trim();
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city == null ? null : city.trim();
+ }
+
+ public String getProvince() {
+ return province;
+ }
+
+ public void setProvince(String province) {
+ this.province = province == null ? null : province.trim();
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country == null ? null : country.trim();
+ }
+
+ public String getHeadImgUrl() {
+ return headImgUrl;
+ }
+
+ public void setHeadImgUrl(String headImgUrl) {
+ this.headImgUrl = headImgUrl == null ? null : headImgUrl.trim();
+ }
+
+ public String getSubscribeTime() {
+ return subscribeTime;
+ }
+
+ public void setSubscribeTime(String subscribeTime) {
+ this.subscribeTime = subscribeTime == null ? null : subscribeTime.trim();
+ }
+
+ public String getUnionId() {
+ return unionId;
+ }
+
+ public void setUnionId(String unionId) {
+ this.unionId = unionId == null ? null : unionId.trim();
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark == null ? null : remark.trim();
+ }
+
+ public Integer getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(Integer groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getSubscribeScene() {
+ return subscribeScene;
+ }
+
+ public void setSubscribeScene(String subscribeScene) {
+ this.subscribeScene = subscribeScene == null ? null : subscribeScene.trim();
+ }
+
+ public String getQrScene() {
+ return qrScene;
+ }
+
+ public void setQrScene(String qrScene) {
+ this.qrScene = qrScene == null ? null : qrScene.trim();
+ }
+
+ public String getQrSceneStr() {
+ return qrSceneStr;
+ }
+
+ public void setQrSceneStr(String qrSceneStr) {
+ this.qrSceneStr = qrSceneStr == null ? null : qrSceneStr.trim();
+ }
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime == null ? null : createTime.trim();
+ }
+
+ public String getModifiedTime() {
+ return modifiedTime;
+ }
+
+ public void setModifiedTime(String modifiedTime) {
+ this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/logic/AliDayuTemplateSmsMsgServiceThread.java b/src/main/java/com/fangxuele/tool/push/logic/AliDayuTemplateSmsMsgServiceThread.java
index 83a24ba9..2a2d2259 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/AliDayuTemplateSmsMsgServiceThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/AliDayuTemplateSmsMsgServiceThread.java
@@ -1,14 +1,11 @@
package com.fangxuele.tool.push.logic;
import com.fangxuele.tool.push.ui.Init;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.PushForm;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
import com.taobao.api.response.AlibabaAliqinFcSmsNumSendResponse;
-import org.apache.commons.lang3.StringUtils;
-
-import javax.swing.*;
/**
*
@@ -23,12 +20,11 @@ public class AliDayuTemplateSmsMsgServiceThread extends BaseMsgServiceThread {
/**
* 构造函数
*
- * @param pageFrom 起始页
- * @param pageTo 截止页
- * @param pageSize 页大小
+ * @param startIndex 起始索引
+ * @param endIndex 截止索引
*/
- public AliDayuTemplateSmsMsgServiceThread(int pageFrom, int pageTo, int pageSize) {
- super(pageFrom, pageTo, pageSize);
+ public AliDayuTemplateSmsMsgServiceThread(int startIndex, int endIndex) {
+ super(startIndex, endIndex);
}
@Override
@@ -37,16 +33,9 @@ public void run() {
// 初始化当前线程
initCurrentThread();
- String aliServerUrl = Init.configer.getAliServerUrl();
- String aliAppKey = Init.configer.getAliAppKey();
- String aliAppSecret = Init.configer.getAliAppSecret();
-
- if (StringUtils.isEmpty(aliServerUrl) || StringUtils.isEmpty(aliAppKey)
- || StringUtils.isEmpty(aliAppSecret)) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(),
- "请先在设置中填写并保存阿里大于相关配置!", "提示",
- JOptionPane.INFORMATION_MESSAGE);
- }
+ String aliServerUrl = Init.config.getAliServerUrl();
+ String aliAppKey = Init.config.getAliAppKey();
+ String aliAppSecret = Init.config.getAliAppSecret();
TaobaoClient client = new DefaultTaobaoClient(aliServerUrl, aliAppKey, aliAppSecret);
@@ -70,12 +59,12 @@ public void run() {
alibabaAliqinFcSmsNumSendRequest.setRecNum(telNum);
// 空跑控制
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
response = client.execute(alibabaAliqinFcSmsNumSendRequest);
if (response.getResult() != null && response.getResult().getSuccess()) {
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -86,7 +75,7 @@ public void run() {
} else {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -102,7 +91,7 @@ public void run() {
} else {
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -115,7 +104,7 @@ public void run() {
} catch (Exception e) {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -131,7 +120,7 @@ public void run() {
tableModel.setValueAt((int) ((double) (i + 1) / list.size() * 100), tableRow, 5);
// 总进度条
- MainWindow.mainWindow.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
+ PushForm.pushForm.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
}
// 当前线程结束
diff --git a/src/main/java/com/fangxuele/tool/push/logic/AliYunSmsMsgServiceThread.java b/src/main/java/com/fangxuele/tool/push/logic/AliYunSmsMsgServiceThread.java
index 55962ebb..faf98a5d 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/AliYunSmsMsgServiceThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/AliYunSmsMsgServiceThread.java
@@ -7,10 +7,7 @@
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.fangxuele.tool.push.ui.Init;
-import com.fangxuele.tool.push.ui.form.MainWindow;
-import org.apache.commons.lang3.StringUtils;
-
-import javax.swing.*;
+import com.fangxuele.tool.push.ui.form.PushForm;
/**
*
@@ -25,12 +22,11 @@ public class AliYunSmsMsgServiceThread extends BaseMsgServiceThread {
/**
* 构造函数
*
- * @param pageFrom 起始页
- * @param pageTo 截止页
- * @param pageSize 页大小
+ * @param startIndex 起始索引
+ * @param endIndex 截止索引
*/
- public AliYunSmsMsgServiceThread(int pageFrom, int pageTo, int pageSize) {
- super(pageFrom, pageTo, pageSize);
+ public AliYunSmsMsgServiceThread(int startIndex, int endIndex) {
+ super(startIndex, endIndex);
}
@Override
@@ -39,14 +35,8 @@ public void run() {
// 初始化当前线程
initCurrentThread();
- String aliyunAccessKeyId = Init.configer.getAliyunAccessKeyId();
- String aliyunAccessKeySecret = Init.configer.getAliyunAccessKeySecret();
-
- if (StringUtils.isEmpty(aliyunAccessKeyId) || StringUtils.isEmpty(aliyunAccessKeySecret)) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(),
- "请先在设置中填写并保存阿里云短信相关配置!", "提示",
- JOptionPane.INFORMATION_MESSAGE);
- }
+ String aliyunAccessKeyId = Init.config.getAliyunAccessKeyId();
+ String aliyunAccessKeySecret = Init.config.getAliyunAccessKeySecret();
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", aliyunAccessKeyId, aliyunAccessKeySecret);
@@ -73,12 +63,12 @@ public void run() {
sendSmsRequest.setPhoneNumbers(telNum);
// 空跑控制
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
response = acsClient.getAcsResponse(sendSmsRequest);
if (response.getCode() != null && "OK".equals(response.getCode())) {
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -89,7 +79,7 @@ public void run() {
} else {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -105,7 +95,7 @@ public void run() {
} else {
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -118,7 +108,7 @@ public void run() {
} catch (Exception e) {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -134,7 +124,7 @@ public void run() {
tableModel.setValueAt((int) ((double) (i + 1) / list.size() * 100), tableRow, 5);
// 总进度条
- MainWindow.mainWindow.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
+ PushForm.pushForm.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
}
// 当前线程结束
diff --git a/src/main/java/com/fangxuele/tool/push/logic/BaseMsgServiceThread.java b/src/main/java/com/fangxuele/tool/push/logic/BaseMsgServiceThread.java
index a75918af..fc07c1dc 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/BaseMsgServiceThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/BaseMsgServiceThread.java
@@ -2,7 +2,7 @@
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.PushForm;
import me.chanjar.weixin.mp.api.WxMpService;
import javax.swing.table.DefaultTableModel;
@@ -21,14 +21,14 @@ public class BaseMsgServiceThread extends Thread {
public static final Log logger = LogFactory.get();
/**
- * 起始页号
+ * 起始索引
*/
- private int pageFrom;
+ private int startIndex;
/**
- * 截至页号
+ * 截止索引
*/
- private int pageTo;
+ private int endIndex;
/**
* 页大小
@@ -68,14 +68,12 @@ public class BaseMsgServiceThread extends Thread {
/**
* 构造函数
*
- * @param pageFrom 起始页
- * @param pageTo 截止页
- * @param pageSize 页大小
+ * @param start 起始页
+ * @param end 截止页
*/
- public BaseMsgServiceThread(int pageFrom, int pageTo, int pageSize) {
- this.pageFrom = pageFrom;
- this.pageTo = pageTo;
- this.pageSize = pageSize;
+ public BaseMsgServiceThread(int start, int end) {
+ this.startIndex = start;
+ this.endIndex = end;
}
@Override
@@ -87,20 +85,13 @@ public void run() {
* 初始化当前线程
*/
void initCurrentThread() {
- PushManage.console("线程" + this.getName() + "负责处理:" + pageFrom + "-" +
- pageTo + "页的数据");
-
- int end = pageTo * pageSize + pageSize;
- if (PushData.totalRecords < end) {
- end = (int) PushData.totalRecords;
- }
-
- int start = pageFrom * pageSize;
+ PushManage.console("线程" + this.getName() + "负责处理:" + startIndex + "-" +
+ endIndex + "的分片数据");
- list = PushData.toSendList.subList(start, end);
+ list = PushData.toSendList.subList(startIndex, endIndex);
// 初始化线程列表行
- tableModel = (DefaultTableModel) MainWindow.mainWindow.getPushThreadTable().getModel();
+ tableModel = (DefaultTableModel) PushForm.pushForm.getPushThreadTable().getModel();
currentThreadSuccessCount = 0;
currentThreadFailCount = 0;
tableModel.setValueAt(currentThreadSuccessCount, tableRow, 2);
@@ -113,8 +104,8 @@ void initCurrentThread() {
* 当前线程结束
*/
void currentThreadFinish() {
- PushManage.console(this.getName() + "已处理完第" + pageFrom + "-" +
- pageTo + "页的数据");
+ PushManage.console(this.getName() + "已处理完第" + startIndex + "-" +
+ endIndex + "页的数据");
PushData.increaseStopedThread();
}
@@ -135,20 +126,20 @@ public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
- public int getPageFrom() {
- return pageFrom;
+ public int getStartIndex() {
+ return startIndex;
}
- public void setPageFrom(int pageFrom) {
- this.pageFrom = pageFrom;
+ public void setStartIndex(int startIndex) {
+ this.startIndex = startIndex;
}
- public int getPageTo() {
- return pageTo;
+ public int getEndIndex() {
+ return endIndex;
}
- public void setPageTo(int pageTo) {
- this.pageTo = pageTo;
+ public void setEndIndex(int endIndex) {
+ this.endIndex = endIndex;
}
public int getTableRow() {
diff --git a/src/main/java/com/fangxuele/tool/push/logic/KeFuMsgServiceThread.java b/src/main/java/com/fangxuele/tool/push/logic/KeFuMsgServiceThread.java
index a007220b..8a349773 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/KeFuMsgServiceThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/KeFuMsgServiceThread.java
@@ -1,6 +1,6 @@
package com.fangxuele.tool.push.logic;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.PushForm;
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
/**
@@ -16,12 +16,11 @@ public class KeFuMsgServiceThread extends BaseMsgServiceThread {
/**
* 构造函数
*
- * @param pageFrom 起始页
- * @param pageTo 截止页
- * @param pageSize 页大小
+ * @param pageFrom 开始索引
+ * @param pageTo 截止索引
*/
- KeFuMsgServiceThread(int pageFrom, int pageTo, int pageSize) {
- super(pageFrom, pageTo, pageSize);
+ KeFuMsgServiceThread(int pageFrom, int pageTo) {
+ super(pageFrom, pageTo);
}
@Override
@@ -47,13 +46,13 @@ public void run() {
wxMpKefuMessage = MessageMaker.makeKefuMessage(msgData);
wxMpKefuMessage.setToUser(openId);
// 空跑控制
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
wxMpService.getKefuService().sendKefuMessage(wxMpKefuMessage);
}
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -64,7 +63,7 @@ public void run() {
} catch (Exception e) {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -80,7 +79,7 @@ public void run() {
tableModel.setValueAt((int) ((double) (i + 1) / list.size() * 100), tableRow, 5);
// 总进度条
- MainWindow.mainWindow.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
+ PushForm.pushForm.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
}
// 当前线程结束
diff --git a/src/main/java/com/fangxuele/tool/push/logic/KeFuPriorMsgServiceThread.java b/src/main/java/com/fangxuele/tool/push/logic/KeFuPriorMsgServiceThread.java
index 59f2f95e..24c89f16 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/KeFuPriorMsgServiceThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/KeFuPriorMsgServiceThread.java
@@ -1,6 +1,6 @@
package com.fangxuele.tool.push.logic;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.PushForm;
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
@@ -17,12 +17,11 @@ public class KeFuPriorMsgServiceThread extends BaseMsgServiceThread {
/**
* 构造函数
*
- * @param pageFrom 起始页
- * @param pageTo 截止页
- * @param pageSize 页大小
+ * @param pageFrom 起始索引
+ * @param pageTo 截止索引
*/
- public KeFuPriorMsgServiceThread(int pageFrom, int pageTo, int pageSize) {
- super(pageFrom, pageTo, pageSize);
+ public KeFuPriorMsgServiceThread(int pageFrom, int pageTo) {
+ super(pageFrom, pageTo);
}
@Override
@@ -52,18 +51,18 @@ public void run() {
wxMpKefuMessage.setToUser(openId);
wxMpTemplateMessage.setToUser(openId);
try {// 空跑控制
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
wxMpService.getKefuService().sendKefuMessage(wxMpKefuMessage);
}
} catch (Exception e) {
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
wxMpService.getTemplateMsgService().sendTemplateMsg(wxMpTemplateMessage);
}
}
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -74,7 +73,7 @@ public void run() {
} catch (Exception e) {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -90,7 +89,7 @@ public void run() {
tableModel.setValueAt((int) ((double) (i + 1) / list.size() * 100), tableRow, 5);
// 总进度条
- MainWindow.mainWindow.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
+ PushForm.pushForm.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
}
// 当前线程结束
diff --git a/src/main/java/com/fangxuele/tool/push/logic/MessageMaker.java b/src/main/java/com/fangxuele/tool/push/logic/MessageMaker.java
index 843e9304..005ab539 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/MessageMaker.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/MessageMaker.java
@@ -6,7 +6,7 @@
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.http.MethodType;
import com.fangxuele.tool.push.ui.Init;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.MessageEditForm;
import com.fangxuele.tool.push.util.TemplateUtil;
import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
import com.yunpian.sdk.YunpianClient;
@@ -38,11 +38,11 @@ public class MessageMaker {
synchronized static WxMpTemplateMessage makeMpTemplateMessage(String[] msgData) {
// 拼模板
WxMpTemplateMessage wxMessageTemplate = WxMpTemplateMessage.builder().build();
- wxMessageTemplate.setTemplateId(MainWindow.mainWindow.getMsgTemplateIdTextField().getText().trim());
- wxMessageTemplate.setUrl(MainWindow.mainWindow.getMsgTemplateUrlTextField().getText().trim());
+ wxMessageTemplate.setTemplateId(MessageEditForm.messageEditForm.getMsgTemplateIdTextField().getText().trim());
+ wxMessageTemplate.setUrl(MessageEditForm.messageEditForm.getMsgTemplateUrlTextField().getText().trim());
- String appid = MainWindow.mainWindow.getMsgTemplateMiniAppidTextField().getText().trim();
- String pagePath = MainWindow.mainWindow.getMsgTemplateMiniPagePathTextField().getText().trim();
+ String appid = MessageEditForm.messageEditForm.getMsgTemplateMiniAppidTextField().getText().trim();
+ String pagePath = MessageEditForm.messageEditForm.getMsgTemplateMiniPagePathTextField().getText().trim();
VelocityContext velocityContext = new VelocityContext();
for (int i = 0; i < msgData.length; i++) {
@@ -52,11 +52,11 @@ synchronized static WxMpTemplateMessage makeMpTemplateMessage(String[] msgData)
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram(appid, pagePath, true);
wxMessageTemplate.setMiniProgram(miniProgram);
- if (MainWindow.mainWindow.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
- Init.initTemplateDataTable();
+ if (MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
+ MessageEditForm.initTemplateDataTable();
}
- DefaultTableModel tableModel = (DefaultTableModel) MainWindow.mainWindow.getTemplateMsgDataTable().getModel();
+ DefaultTableModel tableModel = (DefaultTableModel) MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel();
int rowCount = tableModel.getRowCount();
for (int i = 0; i < rowCount; i++) {
String name = ((String) tableModel.getValueAt(i, 0)).trim();
@@ -81,15 +81,15 @@ synchronized static WxMpTemplateMessage makeMpTemplateMessage(String[] msgData)
synchronized static WxMaTemplateMessage makeMaTemplateMessage(String[] msgData) {
// 拼模板
WxMaTemplateMessage wxMessageTemplate = WxMaTemplateMessage.builder().build();
- wxMessageTemplate.setTemplateId(MainWindow.mainWindow.getMsgTemplateIdTextField().getText().trim());
- wxMessageTemplate.setPage(MainWindow.mainWindow.getMsgTemplateUrlTextField().getText().trim());
- wxMessageTemplate.setEmphasisKeyword(MainWindow.mainWindow.getMsgTemplateKeyWordTextField().getText().trim() + ".DATA");
+ wxMessageTemplate.setTemplateId(MessageEditForm.messageEditForm.getMsgTemplateIdTextField().getText().trim());
+ wxMessageTemplate.setPage(MessageEditForm.messageEditForm.getMsgTemplateUrlTextField().getText().trim());
+ wxMessageTemplate.setEmphasisKeyword(MessageEditForm.messageEditForm.getMsgTemplateKeyWordTextField().getText().trim() + ".DATA");
- if (MainWindow.mainWindow.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
- Init.initTemplateDataTable();
+ if (MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
+ MessageEditForm.initTemplateDataTable();
}
- DefaultTableModel tableModel = (DefaultTableModel) MainWindow.mainWindow.getTemplateMsgDataTable().getModel();
+ DefaultTableModel tableModel = (DefaultTableModel) MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel();
int rowCount = tableModel.getRowCount();
VelocityContext velocityContext = new VelocityContext();
@@ -123,28 +123,28 @@ synchronized static WxMpKefuMessage makeKefuMessage(String[] msgData) {
for (int i = 0; i < msgData.length; i++) {
velocityContext.put(PushManage.TEMPLATE_VAR_PREFIX + i, msgData[i]);
}
- if ("图文消息".equals(Objects.requireNonNull(MainWindow.mainWindow.getMsgKefuMsgTypeComboBox().getSelectedItem()).toString())) {
+ if ("图文消息".equals(Objects.requireNonNull(MessageEditForm.messageEditForm.getMsgKefuMsgTypeComboBox().getSelectedItem()).toString())) {
WxMpKefuMessage.WxArticle article = new WxMpKefuMessage.WxArticle();
// 标题
- String title = MainWindow.mainWindow.getMsgKefuMsgTitleTextField().getText();
+ String title = MessageEditForm.messageEditForm.getMsgKefuMsgTitleTextField().getText();
title = TemplateUtil.evaluate(title, velocityContext);
article.setTitle(title);
// 图片url
- article.setPicUrl(MainWindow.mainWindow.getMsgKefuPicUrlTextField().getText());
+ article.setPicUrl(MessageEditForm.messageEditForm.getMsgKefuPicUrlTextField().getText());
// 描述
- String description = MainWindow.mainWindow.getMsgKefuDescTextField().getText();
+ String description = MessageEditForm.messageEditForm.getMsgKefuDescTextField().getText();
description = TemplateUtil.evaluate(description, velocityContext);
article.setDescription(description);
// 跳转url
- article.setUrl(MainWindow.mainWindow.getMsgKefuUrlTextField().getText());
+ article.setUrl(MessageEditForm.messageEditForm.getMsgKefuUrlTextField().getText());
kefuMessage = WxMpKefuMessage.NEWS().addArticle(article).build();
- } else if ("文本消息".equals(MainWindow.mainWindow.getMsgKefuMsgTypeComboBox().getSelectedItem().toString())) {
- String content = MainWindow.mainWindow.getMsgKefuMsgTitleTextField().getText();
+ } else if ("文本消息".equals(MessageEditForm.messageEditForm.getMsgKefuMsgTypeComboBox().getSelectedItem().toString())) {
+ String content = MessageEditForm.messageEditForm.getMsgKefuMsgTitleTextField().getText();
content = TemplateUtil.evaluate(content, velocityContext);
kefuMessage = WxMpKefuMessage.TEXT().content(content).build();
}
@@ -163,16 +163,16 @@ synchronized static SendSmsRequest makeAliyunMessage(String[] msgData) {
//使用post提交
request.setMethod(MethodType.POST);
//必填:短信签名-可在短信控制台中找到
- request.setSignName(Init.configer.getAliyunSign());
+ request.setSignName(Init.config.getAliyunSign());
// 模板参数
Map paramMap = new HashMap();
- if (MainWindow.mainWindow.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
- Init.initTemplateDataTable();
+ if (MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
+ MessageEditForm.initTemplateDataTable();
}
- DefaultTableModel tableModel = (DefaultTableModel) MainWindow.mainWindow.getTemplateMsgDataTable().getModel();
+ DefaultTableModel tableModel = (DefaultTableModel) MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel();
int rowCount = tableModel.getRowCount();
VelocityContext velocityContext = new VelocityContext();
@@ -190,7 +190,7 @@ synchronized static SendSmsRequest makeAliyunMessage(String[] msgData) {
request.setTemplateParam(JSONUtil.parseFromMap(paramMap).toJSONString(0));
// 短信模板ID,传入的模板必须是在阿里阿里云短信中的可用模板。示例:SMS_585014
- request.setTemplateCode(MainWindow.mainWindow.getMsgTemplateIdTextField().getText());
+ request.setTemplateCode(MessageEditForm.messageEditForm.getMsgTemplateIdTextField().getText());
return request;
}
@@ -211,11 +211,11 @@ synchronized static AlibabaAliqinFcSmsNumSendRequest makeAliTemplateMessage(Stri
// 模板参数
Map paramMap = new HashMap();
- if (MainWindow.mainWindow.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
- Init.initTemplateDataTable();
+ if (MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
+ MessageEditForm.initTemplateDataTable();
}
- DefaultTableModel tableModel = (DefaultTableModel) MainWindow.mainWindow.getTemplateMsgDataTable().getModel();
+ DefaultTableModel tableModel = (DefaultTableModel) MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel();
int rowCount = tableModel.getRowCount();
VelocityContext velocityContext = new VelocityContext();
for (int i = 0; i < msgData.length; i++) {
@@ -233,9 +233,9 @@ synchronized static AlibabaAliqinFcSmsNumSendRequest makeAliTemplateMessage(Stri
// 短信签名,传入的短信签名必须是在阿里大鱼“管理中心-短信签名管理”中的可用签名。如“阿里大鱼”已在短信签名管理中通过审核,
// 则可传入”阿里大鱼“(传参时去掉引号)作为短信签名。短信效果示例:【阿里大鱼】欢迎使用阿里大鱼服务。
- request.setSmsFreeSignName(Init.configer.getAliSign());
+ request.setSmsFreeSignName(Init.config.getAliSign());
// 短信模板ID,传入的模板必须是在阿里大鱼“管理中心-短信模板管理”中的可用模板。示例:SMS_585014
- request.setSmsTemplateCode(MainWindow.mainWindow.getMsgTemplateIdTextField().getText());
+ request.setSmsTemplateCode(MessageEditForm.messageEditForm.getMsgTemplateIdTextField().getText());
return request;
}
@@ -247,11 +247,11 @@ synchronized static AlibabaAliqinFcSmsNumSendRequest makeAliTemplateMessage(Stri
* @return String[]
*/
synchronized static String[] makeTxyunMessage(String[] msgData) {
- if (MainWindow.mainWindow.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
- Init.initTemplateDataTable();
+ if (MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
+ MessageEditForm.initTemplateDataTable();
}
- DefaultTableModel tableModel = (DefaultTableModel) MainWindow.mainWindow.getTemplateMsgDataTable().getModel();
+ DefaultTableModel tableModel = (DefaultTableModel) MessageEditForm.messageEditForm.getTemplateMsgDataTable().getModel();
int rowCount = tableModel.getRowCount();
String[] params = new String[rowCount];
@@ -283,7 +283,7 @@ synchronized static Map makeYunpianMessage(String[] msgData) {
velocityContext.put(PushManage.TEMPLATE_VAR_PREFIX + i, msgData[i]);
}
- String text = MainWindow.mainWindow.getMsgYunpianMsgContentTextField().getText();
+ String text = MessageEditForm.messageEditForm.getMsgYunpianMsgContentTextField().getText();
text = TemplateUtil.evaluate(text, velocityContext);
params.put(YunpianClient.TEXT, text);
diff --git a/src/main/java/com/fangxuele/tool/push/logic/MessageTypeConsts.java b/src/main/java/com/fangxuele/tool/push/logic/MessageTypeConsts.java
deleted file mode 100644
index 2a0a0ae2..00000000
--- a/src/main/java/com/fangxuele/tool/push/logic/MessageTypeConsts.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.fangxuele.tool.push.logic;
-
-/**
- *
- * 消息类型常量
- *
- *
- * @author Zhou Bo
- * @since 2019/3/26.
- */
-public interface MessageTypeConsts {
- String MP_TEMPLATE = "模板消息";
- String MA_TEMPLATE = "模板消息-小程序";
- String KEFU = "客服消息";
- String KEFU_PRIORITY = "客服消息优先";
- String ALI_TEMPLATE = "阿里大于模板短信";
- String ALI_YUN = "阿里云短信";
- String TX_YUN = "腾讯云短信";
- String YUN_PIAN = "云片网短信";
-}
diff --git a/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java b/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java
new file mode 100644
index 00000000..e7829f3d
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java
@@ -0,0 +1,88 @@
+package com.fangxuele.tool.push.logic;
+
+/**
+ *
+ * 消息类型常量
+ *
+ *
+ * @author Zhou Bo
+ * @since 2019/3/26.
+ */
+public enum MessageTypeEnum {
+ /**
+ * 消息类型
+ */
+ MP_TEMPLATE(1, "公众号-模板消息"),
+ MA_TEMPLATE(2, "小程序-模板消息"),
+ KEFU(3, "公众号-客服消息"),
+ KEFU_PRIORITY(4, "公众号-客服消息优先"),
+ ALI_YUN(5, "阿里云短信"),
+ ALI_TEMPLATE(6, "阿里大于模板短信"),
+ TX_YUN(7, "腾讯云短信"),
+ YUN_PIAN(8, "云片网短信"),
+ UP_YUN(9, "又拍云短信"),
+ HW_YUN(10, "华为云短信"),
+ EMAIL(11, "E-Mail");
+
+ private int code;
+
+ private String name;
+
+ public static final int MP_TEMPLATE_CODE = 1;
+ public static final int MA_TEMPLATE_CODE = 2;
+ public static final int KEFU_CODE = 3;
+ public static final int KEFU_PRIORITY_CODE = 4;
+ public static final int ALI_YUN_CODE = 5;
+ public static final int ALI_TEMPLATE_CODE = 6;
+ public static final int TX_YUN_CODE = 7;
+ public static final int YUN_PIAN_CODE = 8;
+ public static final int UP_YUN_CODE = 9;
+ public static final int HW_YUN_CODE = 10;
+ public static final int EMAIL_CODE = 11;
+
+ MessageTypeEnum(int code, String name) {
+ this.code = code;
+ this.name = name;
+ }
+
+ public static String getName(int code) {
+ String name = "";
+ switch (code) {
+ case 1:
+ name = MP_TEMPLATE.name;
+ break;
+ case 2:
+ name = MA_TEMPLATE.name;
+ break;
+ case 3:
+ name = KEFU.name;
+ break;
+ case 4:
+ name = KEFU_PRIORITY.name;
+ break;
+ case 5:
+ name = ALI_YUN.name;
+ break;
+ case 6:
+ name = ALI_TEMPLATE.name;
+ break;
+ case 7:
+ name = TX_YUN.name;
+ break;
+ case 8:
+ name = YUN_PIAN.name;
+ break;
+ case 9:
+ name = UP_YUN.name;
+ break;
+ case 10:
+ name = HW_YUN.name;
+ break;
+ case 11:
+ name = EMAIL.name;
+ break;
+ default:
+ }
+ return name;
+ }
+}
diff --git a/src/main/java/com/fangxuele/tool/push/logic/MsgHisManage.java b/src/main/java/com/fangxuele/tool/push/logic/MsgHisManage.java
deleted file mode 100644
index aec252a4..00000000
--- a/src/main/java/com/fangxuele/tool/push/logic/MsgHisManage.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package com.fangxuele.tool.push.logic;
-
-import cn.hutool.log.Log;
-import cn.hutool.log.LogFactory;
-import com.fangxuele.tool.push.ui.Init;
-import com.fangxuele.tool.push.ui.form.MainWindow;
-import com.fangxuele.tool.push.util.SystemUtil;
-import com.opencsv.CSVReader;
-import com.opencsv.CSVWriter;
-
-import javax.swing.table.DefaultTableModel;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- * 历史消息管理(单例)
- *
- *
- * @author RememBerBer
- * @since 2017/6/17.
- */
-public class MsgHisManage {
- private static final Log logger = LogFactory.get();
-
- private static MsgHisManage ourInstance = new MsgHisManage();
-
- private File msgHisFile;
-
- /**
- * 历史消息保存的csv的列数
- */
- public static final int ARRAY_LENGTH = 15;
-
- public static MsgHisManage getInstance() {
- return ourInstance;
- }
-
- private MsgHisManage() {
- try {
- msgHisFile = new File(SystemUtil.configHome + "data" + File.separator + "msg_his.csv");
- File msgHisDir = new File(SystemUtil.configHome + "data" + File.separator);
- if (!msgHisFile.exists()) {
- msgHisDir.mkdirs();
- msgHisFile.createNewFile();
- CSVWriter writer = new CSVWriter(new FileWriter(msgHisFile));
- String[] entries = new String[]{"消息名称", "消息类型", "模板ID", "跳转URL", "客服消息类型", "客服消息标题/内容", "客服消息图片URL", "客服消息描述", "客服消息跳转URL"};
- writer.writeNext(entries);
- writer.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- logger.error(e);
- }
- }
-
- /**
- * 读取历史消息
- *
- * @return key:消息名称 value:消息详情
- */
- public Map readMsgHis() {
- Map map = new LinkedHashMap<>();
- CSVReader reader = null;
- try {
- reader = new CSVReader(new FileReader(msgHisFile));
-
- String[] nextLine;
- reader.readNext();// 第一行header
- while ((nextLine = reader.readNext()) != null) {
- map.put(nextLine[0], nextLine);
- }
- } catch (IOException e) {
- e.printStackTrace();
- logger.error(e);
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- e.printStackTrace();
- logger.error(e);
- }
- }
- }
- return map;
- }
-
- /**
- * (根据消息名称)读取模板数据
- *
- * @param msgName 消息名称
- * @return {name,value,color}
- */
- public List readTemplateData(String msgName) {
- CSVReader reader = null;
- List list = new ArrayList<>();
- File dir = new File(SystemUtil.configHome + "data" + File.separator + "template_data" + File.separator);
- File file = new File(SystemUtil.configHome + "data" + File.separator + "template_data" + File.separator + msgName + ".csv");
- try {
- if (!file.exists()) {
- dir.mkdirs();
- file.createNewFile();
- }
- reader = new CSVReader(new FileReader(file));
- list = reader.readAll();
- } catch (IOException e) {
- e.printStackTrace();
- logger.error(e);
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- e.printStackTrace();
- logger.error(e);
- }
- }
- }
- return list;
- }
-
- /**
- * 写入(保存)消息历史
- *
- * @param map key:消息名称 value:消息详情
- * @throws IOException io异常
- */
- public void writeMsgHis(Map map) throws IOException {
- CSVWriter writer = new CSVWriter(new FileWriter(msgHisFile));
- String[] entries = new String[]{"消息名称", "消息类型", "模板ID", "跳转URL", "客服消息类型", "客服消息标题/内容", "客服消息图片URL", "客服消息描述", "客服消息跳转URL"};
- writer.writeNext(entries);
- writer.writeAll(map.values());
- writer.close();
- }
-
- /**
- * 保持模板数据
- *
- * @param msgName 消息名称
- * @throws IOException
- */
- public void writeTemplateData(String msgName) throws IOException {
- File dir = new File(SystemUtil.configHome + "data" + File.separator + "template_data" + File.separator);
- File file = new File(SystemUtil.configHome + "data" + File.separator + "template_data" + File.separator
- + msgName + ".csv");
- if (!file.exists()) {
- dir.mkdirs();
- file.createNewFile();
- }
-
- CSVWriter writer = new CSVWriter(new FileWriter(file));
-
- List records = new ArrayList();
-
- // 如果table为空,则初始化
- if (MainWindow.mainWindow.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
- Init.initTemplateDataTable();
- }
-
- // 逐行读取
- DefaultTableModel tableModel = (DefaultTableModel) MainWindow.mainWindow.getTemplateMsgDataTable()
- .getModel();
- int rowCount = tableModel.getRowCount();
- String[] arryData;
- for (int i = 0; i < rowCount; i++) {
- arryData = new String[3];
- arryData[0] = (String) tableModel.getValueAt(i, 0);
- arryData[1] = (String) tableModel.getValueAt(i, 1);
- arryData[2] = ((String) tableModel.getValueAt(i, 2)).trim();
- records.add(arryData);
- }
-
- // 写入文件
- writer.writeAll(records);
- writer.close();
- }
-
-}
diff --git a/src/main/java/com/fangxuele/tool/push/logic/PushData.java b/src/main/java/com/fangxuele/tool/push/logic/PushData.java
index 2e2dcfc8..ce935f09 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/PushData.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/PushData.java
@@ -1,5 +1,7 @@
package com.fangxuele.tool.push.logic;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.LongAdder;
@@ -16,7 +18,7 @@ public class PushData {
/**
* 导入的用户
*/
- public static List allUser;
+ public static List allUser = Collections.synchronizedList(new ArrayList<>());
/**
* 总记录数
@@ -32,7 +34,6 @@ public class PushData {
* 发送失败数
*/
public static LongAdder failRecords = new LongAdder();
- ;
/**
* 准备发送的列表
diff --git a/src/main/java/com/fangxuele/tool/push/logic/PushManage.java b/src/main/java/com/fangxuele/tool/push/logic/PushManage.java
index a5d90327..fe8d5606 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/PushManage.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/PushManage.java
@@ -13,8 +13,16 @@
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
+import com.fangxuele.tool.push.dao.TPushHistoryMapper;
+import com.fangxuele.tool.push.domain.TPushHistory;
import com.fangxuele.tool.push.ui.Init;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.MessageEditForm;
+import com.fangxuele.tool.push.ui.form.PushForm;
+import com.fangxuele.tool.push.ui.form.PushHisForm;
+import com.fangxuele.tool.push.ui.form.SettingForm;
+import com.fangxuele.tool.push.ui.listener.MemberListener;
+import com.fangxuele.tool.push.util.MybatisUtil;
+import com.fangxuele.tool.push.util.SqliteUtil;
import com.fangxuele.tool.push.util.SystemUtil;
import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult;
@@ -26,7 +34,6 @@
import com.yunpian.sdk.YunpianClient;
import com.yunpian.sdk.model.Result;
import com.yunpian.sdk.model.SmsSingleSend;
-import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
@@ -38,7 +45,9 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
/**
*
@@ -52,11 +61,21 @@ public class PushManage {
private static final Log logger = LogFactory.get();
+ private static TPushHistoryMapper pushHistoryMapper = MybatisUtil.getSqlSession().getMapper(TPushHistoryMapper.class);
+
/**
* 模板变量前缀
*/
public static final String TEMPLATE_VAR_PREFIX = "var";
+ private volatile static WxMpService wxMpService;
+
+ private volatile static WxMpInMemoryConfigStorage wxMpConfigStorage;
+
+ private volatile static WxMaService wxMaService;
+
+ private volatile static WxMaInMemoryConfig wxMaConfigStorage;
+
/**
* 预览消息
*
@@ -65,12 +84,12 @@ public class PushManage {
public static boolean preview() throws Exception {
List msgDataList = new ArrayList<>();
- for (String data : MainWindow.mainWindow.getPreviewUserField().getText().split(";")) {
- msgDataList.add(data.split(","));
+ for (String data : MessageEditForm.messageEditForm.getPreviewUserField().getText().split(";")) {
+ msgDataList.add(data.split(MemberListener.TXT_FILE_DATA_SEPERATOR_REGEX));
}
- switch (Objects.requireNonNull(MainWindow.mainWindow.getMsgTypeComboBox().getSelectedItem()).toString()) {
- case MessageTypeConsts.MP_TEMPLATE:
+ switch (Init.config.getMsgType()) {
+ case MessageTypeEnum.MP_TEMPLATE_CODE:
WxMpTemplateMessage wxMessageTemplate;
WxMpService wxMpService = getWxMpService();
if (wxMpService.getWxMpConfigStorage() == null) {
@@ -84,7 +103,7 @@ public static boolean preview() throws Exception {
wxMpService.getTemplateMsgService().sendTemplateMsg(wxMessageTemplate);
}
break;
- case MessageTypeConsts.MA_TEMPLATE:
+ case MessageTypeEnum.MA_TEMPLATE_CODE:
WxMaTemplateMessage wxMaMessageTemplate;
WxMaService wxMaService = getWxMaService();
if (wxMaService.getWxMaConfig() == null) {
@@ -99,7 +118,7 @@ public static boolean preview() throws Exception {
wxMaService.getMsgService().sendTemplateMsg(wxMaMessageTemplate);
}
break;
- case MessageTypeConsts.KEFU:
+ case MessageTypeEnum.KEFU_CODE:
wxMpService = getWxMpService();
WxMpKefuMessage wxMpKefuMessage;
if (wxMpService.getWxMpConfigStorage() == null) {
@@ -113,7 +132,7 @@ public static boolean preview() throws Exception {
wxMpService.getKefuService().sendKefuMessage(wxMpKefuMessage);
}
break;
- case MessageTypeConsts.KEFU_PRIORITY:
+ case MessageTypeEnum.KEFU_PRIORITY_CODE:
wxMpService = getWxMpService();
if (wxMpService.getWxMpConfigStorage() == null) {
return false;
@@ -133,12 +152,12 @@ public static boolean preview() throws Exception {
}
}
break;
- case MessageTypeConsts.ALI_YUN:
- String aliyunAccessKeyId = Init.configer.getAliyunAccessKeyId();
- String aliyunAccessKeySecret = Init.configer.getAliyunAccessKeySecret();
+ case MessageTypeEnum.ALI_YUN_CODE:
+ String aliyunAccessKeyId = Init.config.getAliyunAccessKeyId();
+ String aliyunAccessKeySecret = Init.config.getAliyunAccessKeySecret();
if (StringUtils.isEmpty(aliyunAccessKeyId) || StringUtils.isEmpty(aliyunAccessKeySecret)) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(),
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(),
"请先在设置中填写并保存阿里云短信相关配置!", "提示",
JOptionPane.INFORMATION_MESSAGE);
return false;
@@ -160,12 +179,12 @@ public static boolean preview() throws Exception {
}
}
break;
- case MessageTypeConsts.TX_YUN:
- String txyunAppId = Init.configer.getTxyunAppId();
- String txyunAppKey = Init.configer.getTxyunAppKey();
+ case MessageTypeEnum.TX_YUN_CODE:
+ String txyunAppId = Init.config.getTxyunAppId();
+ String txyunAppKey = Init.config.getTxyunAppKey();
if (StringUtils.isEmpty(txyunAppId) || StringUtils.isEmpty(txyunAppKey)) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(),
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(),
"请先在设置中填写并保存腾讯云短信相关配置!", "提示",
JOptionPane.INFORMATION_MESSAGE);
return false;
@@ -176,21 +195,21 @@ public static boolean preview() throws Exception {
for (String[] msgData : msgDataList) {
String[] params = MessageMaker.makeTxyunMessage(msgData);
SmsSingleSenderResult result = ssender.sendWithParam("86", msgData[0],
- Integer.valueOf(MainWindow.mainWindow.getMsgTemplateIdTextField().getText()),
- params, Init.configer.getAliyunSign(), "", "");
+ Integer.valueOf(MessageEditForm.messageEditForm.getMsgTemplateIdTextField().getText()),
+ params, Init.config.getAliyunSign(), "", "");
if (result.result != 0) {
throw new Exception(result.toString());
}
}
break;
- case MessageTypeConsts.ALI_TEMPLATE:
- String aliServerUrl = Init.configer.getAliServerUrl();
- String aliAppKey = Init.configer.getAliAppKey();
- String aliAppSecret = Init.configer.getAliAppSecret();
+ case MessageTypeEnum.ALI_TEMPLATE_CODE:
+ String aliServerUrl = Init.config.getAliServerUrl();
+ String aliAppKey = Init.config.getAliAppKey();
+ String aliAppSecret = Init.config.getAliAppSecret();
if (StringUtils.isEmpty(aliServerUrl) || StringUtils.isEmpty(aliAppKey)
|| StringUtils.isEmpty(aliAppSecret)) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(),
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(),
"请先在设置中填写并保存阿里大于相关配置!", "提示",
JOptionPane.INFORMATION_MESSAGE);
return false;
@@ -207,11 +226,11 @@ public static boolean preview() throws Exception {
}
}
break;
- case MessageTypeConsts.YUN_PIAN:
- String yunpianApiKey = Init.configer.getYunpianApiKey();
+ case MessageTypeEnum.YUN_PIAN_CODE:
+ String yunpianApiKey = Init.config.getYunpianApiKey();
if (StringUtils.isEmpty(yunpianApiKey)) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(),
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(),
"请先在设置中填写并保存云片网短信相关配置!", "提示",
JOptionPane.INFORMATION_MESSAGE);
return false;
@@ -240,21 +259,21 @@ public static boolean preview() throws Exception {
*
* @return WxMpConfigStorage
*/
- private static WxMpConfigStorage wxMpConfigStorage() {
- WxMpInMemoryConfigStorage configStorage = new WxMpInMemoryConfigStorage();
- if (StringUtils.isEmpty(Init.configer.getWechatAppId()) || StringUtils.isEmpty(Init.configer.getWechatAppSecret())) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(), "请先在设置中填写并保存公众号相关配置!", "提示",
+ private static WxMpInMemoryConfigStorage wxMpConfigStorage() {
+ if (StringUtils.isEmpty(Init.config.getWechatAppId()) || StringUtils.isEmpty(Init.config.getWechatAppSecret())) {
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(), "请先在设置中填写并保存公众号相关配置!", "提示",
JOptionPane.INFORMATION_MESSAGE);
- MainWindow.mainWindow.getScheduleRunButton().setEnabled(true);
- MainWindow.mainWindow.getPushStartButton().setEnabled(true);
- MainWindow.mainWindow.getPushStopButton().setEnabled(false);
- MainWindow.mainWindow.getPushTotalProgressBar().setIndeterminate(false);
+ PushForm.pushForm.getScheduleRunButton().setEnabled(true);
+ PushForm.pushForm.getPushStartButton().setEnabled(true);
+ PushForm.pushForm.getPushStopButton().setEnabled(false);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(false);
return null;
}
- configStorage.setAppId(Init.configer.getWechatAppId());
- configStorage.setSecret(Init.configer.getWechatAppSecret());
- configStorage.setToken(Init.configer.getWechatToken());
- configStorage.setAesKey(Init.configer.getWechatAesKey());
+ WxMpInMemoryConfigStorage configStorage = new WxMpInMemoryConfigStorage();
+ configStorage.setAppId(Init.config.getWechatAppId());
+ configStorage.setSecret(Init.config.getWechatAppSecret());
+ configStorage.setToken(Init.config.getWechatToken());
+ configStorage.setAesKey(Init.config.getWechatAesKey());
return configStorage;
}
@@ -265,20 +284,20 @@ private static WxMpConfigStorage wxMpConfigStorage() {
*/
private static WxMaInMemoryConfig wxMaConfigStorage() {
WxMaInMemoryConfig configStorage = new WxMaInMemoryConfig();
- if (StringUtils.isEmpty(Init.configer.getMiniAppAppId()) || StringUtils.isEmpty(Init.configer.getMiniAppAppSecret())
- || StringUtils.isEmpty(Init.configer.getMiniAppToken()) || StringUtils.isEmpty(Init.configer.getMiniAppAesKey())) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(), "请先在设置中填写并保存小程序相关配置!", "提示",
+ if (StringUtils.isEmpty(Init.config.getMiniAppAppId()) || StringUtils.isEmpty(Init.config.getMiniAppAppSecret())
+ || StringUtils.isEmpty(Init.config.getMiniAppToken()) || StringUtils.isEmpty(Init.config.getMiniAppAesKey())) {
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(), "请先在设置中填写并保存小程序相关配置!", "提示",
JOptionPane.INFORMATION_MESSAGE);
- MainWindow.mainWindow.getScheduleRunButton().setEnabled(true);
- MainWindow.mainWindow.getPushStartButton().setEnabled(true);
- MainWindow.mainWindow.getPushStopButton().setEnabled(false);
- MainWindow.mainWindow.getPushTotalProgressBar().setIndeterminate(false);
+ PushForm.pushForm.getScheduleRunButton().setEnabled(true);
+ PushForm.pushForm.getPushStartButton().setEnabled(true);
+ PushForm.pushForm.getPushStopButton().setEnabled(false);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(false);
return null;
}
- configStorage.setAppid(Init.configer.getMiniAppAppId());
- configStorage.setSecret(Init.configer.getMiniAppAppSecret());
- configStorage.setToken(Init.configer.getMiniAppToken());
- configStorage.setAesKey(Init.configer.getMiniAppAesKey());
+ configStorage.setAppid(Init.config.getMiniAppAppId());
+ configStorage.setSecret(Init.config.getMiniAppAppSecret());
+ configStorage.setToken(Init.config.getMiniAppToken());
+ configStorage.setAesKey(Init.config.getMiniAppAesKey());
configStorage.setMsgDataFormat("JSON");
return configStorage;
}
@@ -289,10 +308,22 @@ private static WxMaInMemoryConfig wxMaConfigStorage() {
* @return WxMpService
*/
public static WxMpService getWxMpService() {
- WxMpService wxMpService = new WxMpServiceImpl();
- WxMpConfigStorage wxMpConfigStorage = wxMpConfigStorage();
- if (wxMpConfigStorage != null) {
- wxMpService.setWxMpConfigStorage(wxMpConfigStorage);
+ if (wxMpService == null) {
+ synchronized (PushManage.class) {
+ if (wxMpService == null) {
+ wxMpService = new WxMpServiceImpl();
+ }
+ }
+ }
+ if (wxMpConfigStorage == null) {
+ synchronized (PushManage.class) {
+ if (wxMpConfigStorage == null) {
+ wxMpConfigStorage = wxMpConfigStorage();
+ if (wxMpConfigStorage != null) {
+ wxMpService.setWxMpConfigStorage(wxMpConfigStorage);
+ }
+ }
+ }
}
return wxMpService;
}
@@ -303,8 +334,23 @@ public static WxMpService getWxMpService() {
* @return WxMaService
*/
static WxMaService getWxMaService() {
- WxMaService wxMaService = new WxMaServiceImpl();
- wxMaService.setWxMaConfig(wxMaConfigStorage());
+ if (wxMaService == null) {
+ synchronized (PushManage.class) {
+ if (wxMaService == null) {
+ wxMaService = new WxMaServiceImpl();
+ }
+ }
+ }
+ if (wxMaConfigStorage == null) {
+ synchronized (PushManage.class) {
+ if (wxMaConfigStorage == null) {
+ wxMaConfigStorage = wxMaConfigStorage();
+ if (wxMaConfigStorage != null) {
+ wxMaService.setWxMaConfig(wxMaConfigStorage);
+ }
+ }
+ }
+ }
return wxMaService;
}
@@ -317,26 +363,37 @@ static void savePushData() throws IOException {
pushHisDir.mkdirs();
}
- String msgName = MainWindow.mainWindow.getMsgNameField().getText();
- String nowTime = DateUtil.now().replaceAll(":", "_");
-
- String[] strArray;
+ String msgName = MessageEditForm.messageEditForm.getMsgNameField().getText();
+ String nowTime = DateUtil.now().replace(":", "_").replace(" ", "_");
CSVWriter writer;
+ int msgType = Init.config.getMsgType();
+ String now = SqliteUtil.nowDateForSqlite();
// 保存已发送
if (PushData.sendSuccessList.size() > 0) {
- File toSendFile = new File(SystemUtil.configHome + "data" +
- File.separator + "push_his" + File.separator + msgName +
+ File sendSuccessFile = new File(SystemUtil.configHome + "data" +
+ File.separator + "push_his" + File.separator + MessageTypeEnum.getName(msgType) + "-" + msgName +
"-发送成功-" + nowTime + ".csv");
- if (!toSendFile.exists()) {
- toSendFile.createNewFile();
+ if (!sendSuccessFile.exists()) {
+ sendSuccessFile.createNewFile();
}
- writer = new CSVWriter(new FileWriter(toSendFile));
+ writer = new CSVWriter(new FileWriter(sendSuccessFile));
for (String[] str : PushData.sendSuccessList) {
writer.writeNext(str);
}
writer.close();
+
+ TPushHistory tPushHistory = new TPushHistory();
+// TODO tPushHistory.setMsgId(0);
+ tPushHistory.setMsgType(msgType);
+ tPushHistory.setMsgName(msgName);
+ tPushHistory.setResult("发送成功");
+ tPushHistory.setCsvFile(sendSuccessFile.getAbsolutePath());
+ tPushHistory.setCreateTime(now);
+ tPushHistory.setModifiedTime(now);
+
+ pushHistoryMapper.insertSelective(tPushHistory);
}
// 保存未发送
@@ -348,7 +405,7 @@ static void savePushData() throws IOException {
}
if (PushData.toSendList.size() > 0) {
File unSendFile = new File(SystemUtil.configHome + "data" + File.separator +
- "push_his" + File.separator + msgName + "-未发送-" + nowTime +
+ "push_his" + File.separator + MessageTypeEnum.getName(msgType) + "-" + msgName + "-未发送-" + nowTime +
".csv");
if (!unSendFile.exists()) {
unSendFile.createNewFile();
@@ -358,12 +415,23 @@ static void savePushData() throws IOException {
writer.writeNext(str);
}
writer.close();
+
+ TPushHistory tPushHistory = new TPushHistory();
+// TODO tPushHistory.setMsgId(0);
+ tPushHistory.setMsgType(msgType);
+ tPushHistory.setMsgName(msgName);
+ tPushHistory.setResult("未发送");
+ tPushHistory.setCsvFile(unSendFile.getAbsolutePath());
+ tPushHistory.setCreateTime(now);
+ tPushHistory.setModifiedTime(now);
+
+ pushHistoryMapper.insertSelective(tPushHistory);
}
// 保存发送失败
if (PushData.sendFailList.size() > 0) {
File failSendFile = new File(SystemUtil.configHome + "data" + File.separator +
- "push_his" + File.separator + msgName + "-发送失败-" + nowTime + ".csv");
+ "push_his" + File.separator + MessageTypeEnum.getName(msgType) + "-" + msgName + "-发送失败-" + nowTime + ".csv");
if (!failSendFile.exists()) {
failSendFile.createNewFile();
}
@@ -372,10 +440,20 @@ static void savePushData() throws IOException {
writer.writeNext(str);
}
writer.close();
+
+ TPushHistory tPushHistory = new TPushHistory();
+// TODO tPushHistory.setMsgId(0);
+ tPushHistory.setMsgType(msgType);
+ tPushHistory.setMsgName(msgName);
+ tPushHistory.setResult("发送失败");
+ tPushHistory.setCsvFile(failSendFile.getAbsolutePath());
+ tPushHistory.setCreateTime(now);
+ tPushHistory.setModifiedTime(now);
+
+ pushHistoryMapper.insertSelective(tPushHistory);
}
- Init.initMemberTab();
- Init.initSettingTab();
+ PushHisForm.init();
}
/**
@@ -384,8 +462,8 @@ static void savePushData() throws IOException {
* @param log
*/
public static void console(String log) {
- MainWindow.mainWindow.getPushConsoleTextArea().append(log + "\n");
- MainWindow.mainWindow.getPushConsoleTextArea().setCaretPosition(MainWindow.mainWindow.getPushConsoleTextArea().getText().length());
+ PushForm.pushForm.getPushConsoleTextArea().append(log + "\n");
+ PushForm.pushForm.getPushConsoleTextArea().setCaretPosition(PushForm.pushForm.getPushConsoleTextArea().getText().length());
logger.warn(log);
}
diff --git a/src/main/java/com/fangxuele/tool/push/logic/RunPushThread.java b/src/main/java/com/fangxuele/tool/push/logic/RunPushThread.java
index fc2e8047..eb9a8606 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/RunPushThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/RunPushThread.java
@@ -3,13 +3,16 @@
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.FileUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.fangxuele.tool.push.ui.Init;
import com.fangxuele.tool.push.ui.component.TableInCellProgressBarRenderer;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.PushForm;
+import com.fangxuele.tool.push.ui.form.SettingForm;
import me.chanjar.weixin.mp.api.WxMpService;
+import org.apache.commons.lang3.StringUtils;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
@@ -17,7 +20,6 @@
import java.io.IOException;
import java.util.Collections;
import java.util.LinkedList;
-import java.util.Objects;
import java.util.concurrent.ThreadPoolExecutor;
/**
@@ -34,18 +36,18 @@ public class RunPushThread extends Thread {
@Override
public void run() {
- MainWindow.mainWindow.getPushStopButton().setText("停止");
+ PushForm.pushForm.getPushStopButton().setText("停止");
// 初始化
- MainWindow.mainWindow.getPushTotalProgressBar().setIndeterminate(true);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(true);
PushData.running = true;
PushData.successRecords.reset();
PushData.failRecords.reset();
PushData.stopedThreadCount.reset();
PushData.threadCount = 0;
- MainWindow.mainWindow.getPushSuccessCount().setText("0");
- MainWindow.mainWindow.getPushFailCount().setText("0");
+ PushForm.pushForm.getPushSuccessCount().setText("0");
+ PushForm.pushForm.getPushFailCount().setText("0");
PushData.toSendList = Collections.synchronizedList(new LinkedList<>());
PushData.sendSuccessList = Collections.synchronizedList(new LinkedList<>());
@@ -53,104 +55,158 @@ public void run() {
PushManage.console("推送开始……");
- // 页大小
- int pageSize = Integer.parseInt(MainWindow.mainWindow.getPushPageSizeTextField().getText());
- Init.configer.setRecordPerPage(pageSize);
- Init.configer.save();
- PushManage.console("页大小:" + pageSize);
-
// 拷贝准备的目标用户
PushData.toSendList.addAll(PushData.allUser);
// 总记录数
long totalCount = PushData.toSendList.size();
PushData.totalRecords = totalCount;
- MainWindow.mainWindow.getPushTotalCountLabel().setText("总用户数:" + totalCount);
- MainWindow.mainWindow.getPushTotalProgressBar().setMaximum((int) totalCount);
- PushManage.console("总用户数:" + totalCount);
- // 总页数
- int totalPage = Long.valueOf((totalCount + pageSize - 1) / pageSize).intValue();
- MainWindow.mainWindow.getPushTotalPageLabel().setText("总页数:" + totalPage);
- PushManage.console("总页数:" + totalPage);
-
- // 每个线程分配多少页
- int pagePerThread = Integer.parseInt(MainWindow.mainWindow.getPushPagePerThreadTextField().getText());
- Init.configer.setPagePerThread(pagePerThread);
- Init.configer.save();
- PushManage.console("每个线程分配:" + pagePerThread + "页");
-
- // 需要多少个线程
- int threadCount = (totalPage + pagePerThread - 1) / pagePerThread;
+ PushForm.pushForm.getPushTotalCountLabel().setText("消息总数:" + totalCount);
+ PushForm.pushForm.getPushTotalProgressBar().setMaximum((int) totalCount);
+ PushManage.console("消息总数:" + totalCount);
+ // 可用处理器核心数量
+ PushForm.pushForm.getAvailableProcessorLabel().setText("可用处理器核心:" + Runtime.getRuntime().availableProcessors());
+ PushManage.console("可用处理器核心:" + Runtime.getRuntime().availableProcessors());
+
+ // 线程数
+ Init.config.setThreadCount(Integer.parseInt(PushForm.pushForm.getThreadCountTextField().getText()));
+ Init.config.save();
+ PushManage.console("线程数:" + PushForm.pushForm.getThreadCountTextField().getText());
+
+ // 线程池大小
+ Init.config.setMaxThreadPool(Integer.parseInt(PushForm.pushForm.getMaxThreadPoolTextField().getText()));
+ Init.config.save();
+ PushManage.console("线程池大小:" + PushForm.pushForm.getMaxThreadPoolTextField().getText());
+
+ // JVM内存占用
+ PushForm.pushForm.getJvmMemoryLabel().setText("JVM内存占用:" + FileUtil.readableFileSize(Runtime.getRuntime().totalMemory()) + "/" + FileUtil.readableFileSize(Runtime.getRuntime().maxMemory()));
+ // 线程数
+ int threadCount = Integer.parseInt(PushForm.pushForm.getThreadCountTextField().getText());
PushData.threadCount = threadCount;
- MainWindow.mainWindow.getPushTotalThreadLabel().setText("需要线程宝宝个数:" + threadCount);
- PushManage.console("需要:" + threadCount + "个线程宝宝齐力合作");
// 初始化线程table
- String[] headerNames = {"线程", "页数区间", "成功", "失败", "总数", "当前进度"};
+ String[] headerNames = {"线程", "分片区间", "成功", "失败", "总数", "当前进度"};
DefaultTableModel tableModel = new DefaultTableModel(null, headerNames);
- MainWindow.mainWindow.getPushThreadTable().setModel(tableModel);
- MainWindow.mainWindow.getPushThreadTable().getColumn("当前进度").setCellRenderer(new TableInCellProgressBarRenderer());
+ PushForm.pushForm.getPushThreadTable().setModel(tableModel);
+ PushForm.pushForm.getPushThreadTable().getColumn("当前进度").setCellRenderer(new TableInCellProgressBarRenderer());
- DefaultTableCellRenderer hr = (DefaultTableCellRenderer) MainWindow.mainWindow.getPushThreadTable().getTableHeader()
+ DefaultTableCellRenderer hr = (DefaultTableCellRenderer) PushForm.pushForm.getPushThreadTable().getTableHeader()
.getDefaultRenderer();
- // 表头列名居中
+ // 表头列名居左
hr.setHorizontalAlignment(DefaultTableCellRenderer.LEFT);
- MainWindow.mainWindow.getPushThreadTable().updateUI();
+ PushForm.pushForm.getPushThreadTable().updateUI();
Object[] data;
- String msgType = Objects.requireNonNull(MainWindow.mainWindow.getMsgTypeComboBox().getSelectedItem()).toString();
+ int msgType = Init.config.getMsgType();
- ThreadPoolExecutor threadPoolExecutor = ThreadUtil.newExecutor(20, 100 * Runtime.getRuntime().availableProcessors());
+ int maxThreadPoolSize = Integer.parseInt(PushForm.pushForm.getMaxThreadPoolTextField().getText());
+ ThreadPoolExecutor threadPoolExecutor = ThreadUtil.newExecutor(maxThreadPoolSize, maxThreadPoolSize);
BaseMsgServiceThread thread = null;
+ // 每个线程分配
+ int perThread = (int) (totalCount / threadCount) + 1;
for (int i = 0; i < threadCount; i++) {
- if (MessageTypeConsts.MP_TEMPLATE.equals(msgType)) {
- thread = new TemplateMsgMpServiceThread(i * pagePerThread,
- i * pagePerThread + pagePerThread - 1, pageSize);
+ int startIndex = i * perThread;
+ if (startIndex > totalCount - 1) {
+ threadCount = i;
+ break;
+ }
+ int endIndex = i * perThread + perThread;
+ if (endIndex > totalCount - 1) {
+ endIndex = (int) (totalCount);
+ }
+ if (MessageTypeEnum.MP_TEMPLATE_CODE == msgType) {
+ thread = new TemplateMsgMpServiceThread(startIndex, endIndex);
WxMpService wxMpService = PushManage.getWxMpService();
if (wxMpService.getWxMpConfigStorage() == null) {
return;
}
thread.setWxMpService(wxMpService);
- } else if (MessageTypeConsts.MA_TEMPLATE.equals(msgType)) {
- thread = new TemplateMsgMaServiceThread(i * pagePerThread,
- i * pagePerThread + pagePerThread - 1, pageSize);
+ } else if (MessageTypeEnum.MA_TEMPLATE_CODE == msgType) {
+ thread = new TemplateMsgMaServiceThread(startIndex, endIndex);
WxMaService wxMaService = PushManage.getWxMaService();
if (wxMaService.getWxMaConfig() == null) {
return;
}
((TemplateMsgMaServiceThread) thread).setWxMaService(wxMaService);
- } else if (MessageTypeConsts.KEFU.equals(msgType)) {
- thread = new KeFuMsgServiceThread(i * pagePerThread,
- i * pagePerThread + pagePerThread - 1, pageSize);
+ } else if (MessageTypeEnum.KEFU_CODE == msgType) {
+ thread = new KeFuMsgServiceThread(startIndex, endIndex);
WxMpService wxMpService = PushManage.getWxMpService();
if (wxMpService.getWxMpConfigStorage() == null) {
return;
}
thread.setWxMpService(wxMpService);
- } else if (MessageTypeConsts.KEFU_PRIORITY.equals(msgType)) {
- thread = new KeFuPriorMsgServiceThread(i * pagePerThread,
- i * pagePerThread + pagePerThread - 1, pageSize);
+ } else if (MessageTypeEnum.KEFU_PRIORITY_CODE == msgType) {
+ thread = new KeFuPriorMsgServiceThread(startIndex, endIndex);
WxMpService wxMpService = PushManage.getWxMpService();
if (wxMpService.getWxMpConfigStorage() == null) {
return;
}
thread.setWxMpService(wxMpService);
- } else if (MessageTypeConsts.ALI_TEMPLATE.equals(msgType)) {
- thread = new AliDayuTemplateSmsMsgServiceThread(i * pagePerThread,
- i * pagePerThread + pagePerThread - 1, pageSize);
- } else if (MessageTypeConsts.ALI_YUN.equals(msgType)) {
- thread = new AliYunSmsMsgServiceThread(i * pagePerThread,
- i * pagePerThread + pagePerThread - 1, pageSize);
- } else if (MessageTypeConsts.TX_YUN.equals(msgType)) {
- thread = new TxYunSmsMsgServiceThread(i * pagePerThread,
- i * pagePerThread + pagePerThread - 1, pageSize);
- } else if (MessageTypeConsts.YUN_PIAN.equals(msgType)) {
- thread = new YunpianSmsMsgServiceThread(i * pagePerThread,
- i * pagePerThread + pagePerThread - 1, pageSize);
+ } else if (MessageTypeEnum.ALI_TEMPLATE_CODE == msgType) {
+ String aliServerUrl = Init.config.getAliServerUrl();
+ String aliAppKey = Init.config.getAliAppKey();
+ String aliAppSecret = Init.config.getAliAppSecret();
+
+ if (StringUtils.isEmpty(aliServerUrl) || StringUtils.isEmpty(aliAppKey)
+ || StringUtils.isEmpty(aliAppSecret)) {
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(),
+ "请先在设置中填写并保存阿里大于相关配置!", "提示",
+ JOptionPane.INFORMATION_MESSAGE);
+ PushForm.pushForm.getScheduleRunButton().setEnabled(true);
+ PushForm.pushForm.getPushStartButton().setEnabled(true);
+ PushForm.pushForm.getPushStopButton().setEnabled(false);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(false);
+ return;
+ }
+ thread = new AliDayuTemplateSmsMsgServiceThread(startIndex, endIndex);
+ } else if (MessageTypeEnum.ALI_YUN_CODE == msgType) {
+ String aliyunAccessKeyId = Init.config.getAliyunAccessKeyId();
+ String aliyunAccessKeySecret = Init.config.getAliyunAccessKeySecret();
+
+ if (StringUtils.isEmpty(aliyunAccessKeyId) || StringUtils.isEmpty(aliyunAccessKeySecret)) {
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(),
+ "请先在设置中填写并保存阿里云短信相关配置!", "提示",
+ JOptionPane.INFORMATION_MESSAGE);
+ PushForm.pushForm.getScheduleRunButton().setEnabled(true);
+ PushForm.pushForm.getPushStartButton().setEnabled(true);
+ PushForm.pushForm.getPushStopButton().setEnabled(false);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(false);
+ return;
+ }
+ thread = new AliYunSmsMsgServiceThread(startIndex, endIndex);
+ } else if (MessageTypeEnum.TX_YUN_CODE == msgType) {
+ String txyunAppId = Init.config.getTxyunAppId();
+ String txyunAppKey = Init.config.getTxyunAppKey();
+
+ if (StringUtils.isEmpty(txyunAppId) || StringUtils.isEmpty(txyunAppKey)) {
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(),
+ "请先在设置中填写并保存腾讯云短信相关配置!", "提示",
+ JOptionPane.INFORMATION_MESSAGE);
+ PushForm.pushForm.getScheduleRunButton().setEnabled(true);
+ PushForm.pushForm.getPushStartButton().setEnabled(true);
+ PushForm.pushForm.getPushStopButton().setEnabled(false);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(false);
+ return;
+ }
+ thread = new TxYunSmsMsgServiceThread(startIndex, endIndex);
+ } else if (MessageTypeEnum.YUN_PIAN_CODE == msgType) {
+ String yunpianApiKey = Init.config.getYunpianApiKey();
+ if (StringUtils.isEmpty(yunpianApiKey)) {
+ JOptionPane.showMessageDialog(SettingForm.settingForm.getSettingPanel(),
+ "请先在设置中填写并保存云片网短信相关配置!", "提示",
+ JOptionPane.INFORMATION_MESSAGE);
+ PushForm.pushForm.getScheduleRunButton().setEnabled(true);
+ PushForm.pushForm.getPushStartButton().setEnabled(true);
+ PushForm.pushForm.getPushStopButton().setEnabled(false);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(false);
+ return;
+ }
+
+ thread = new YunpianSmsMsgServiceThread(startIndex, endIndex);
}
thread.setTableRow(i);
@@ -158,13 +214,13 @@ public void run() {
data = new Object[6];
data[0] = thread.getName();
- data[1] = i * pagePerThread + "-" + (i * pagePerThread + pagePerThread - 1);
+ data[1] = startIndex + "-" + endIndex;
data[5] = 0;
tableModel.addRow(data);
threadPoolExecutor.execute(thread);
}
- MainWindow.mainWindow.getPushTotalProgressBar().setIndeterminate(false);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(false);
PushManage.console("所有线程宝宝启动完毕……");
long startTimeMillis = System.currentTimeMillis();
@@ -172,43 +228,43 @@ public void run() {
while (true) {
if (PushData.stopedThreadCount.intValue() == threadCount) {
if (!PushData.fixRateScheduling) {
- MainWindow.mainWindow.getPushStopButton().setEnabled(false);
- MainWindow.mainWindow.getPushStopButton().updateUI();
+ PushForm.pushForm.getPushStopButton().setEnabled(false);
+ PushForm.pushForm.getPushStopButton().updateUI();
}
String finishTip = "发送完毕!\n\n";
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
finishTip = "发送完毕!\n\n接下来将保存结果数据,请等待……\n\n";
}
if (!PushData.fixRateScheduling) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getPushPanel(), finishTip, "提示",
+ JOptionPane.showMessageDialog(PushForm.pushForm.getPushPanel(), finishTip, "提示",
JOptionPane.INFORMATION_MESSAGE);
}
// 保存停止前的数据
try {
PushManage.console("正在保存结果数据……");
- MainWindow.mainWindow.getPushTotalProgressBar().setIndeterminate(true);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(true);
// 空跑控制
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
PushManage.savePushData();
}
PushManage.console("结果数据保存完毕!");
} catch (IOException e) {
logger.error(e);
} finally {
- MainWindow.mainWindow.getPushTotalProgressBar().setIndeterminate(false);
+ PushForm.pushForm.getPushTotalProgressBar().setIndeterminate(false);
}
if (!PushData.fixRateScheduling) {
- MainWindow.mainWindow.getPushStartButton().setEnabled(true);
- MainWindow.mainWindow.getScheduleRunButton().setEnabled(true);
- MainWindow.mainWindow.getPushStartButton().updateUI();
- MainWindow.mainWindow.getScheduleRunButton().updateUI();
+ PushForm.pushForm.getPushStartButton().setEnabled(true);
+ PushForm.pushForm.getScheduleRunButton().setEnabled(true);
+ PushForm.pushForm.getPushStartButton().updateUI();
+ PushForm.pushForm.getScheduleRunButton().updateUI();
- MainWindow.mainWindow.getScheduleDetailLabel().setText("");
+ PushForm.pushForm.getScheduleDetailLabel().setText("");
} else {
- MainWindow.mainWindow.getPushStopButton().setText("停止计划任务");
+ PushForm.pushForm.getPushStopButton().setText("停止计划任务");
}
break;
@@ -219,10 +275,12 @@ public void run() {
long leftTimeMillis = (long) ((double) lastTimeMillis / (PushData.sendSuccessList.size() + PushData.sendFailList.size()) * (PushData.allUser.size() - PushData.sendSuccessList.size() - PushData.sendFailList.size()));
String formatBetweenLast = DateUtil.formatBetween(lastTimeMillis, BetweenFormater.Level.SECOND);
- MainWindow.mainWindow.getPushLastTimeLabel().setText("".equals(formatBetweenLast) ? "0s" : formatBetweenLast);
+ PushForm.pushForm.getPushLastTimeLabel().setText("".equals(formatBetweenLast) ? "0s" : formatBetweenLast);
String formatBetweenLeft = DateUtil.formatBetween(leftTimeMillis, BetweenFormater.Level.SECOND);
- MainWindow.mainWindow.getPushLeftTimeLabel().setText("".equals(formatBetweenLeft) ? "0s" : formatBetweenLeft);
+ PushForm.pushForm.getPushLeftTimeLabel().setText("".equals(formatBetweenLeft) ? "0s" : formatBetweenLeft);
+
+ PushForm.pushForm.getJvmMemoryLabel().setText("JVM内存占用:" + FileUtil.readableFileSize(Runtime.getRuntime().totalMemory()) + "/" + FileUtil.readableFileSize(Runtime.getRuntime().maxMemory()));
try {
Thread.sleep(100);
diff --git a/src/main/java/com/fangxuele/tool/push/logic/TemplateMsgMaServiceThread.java b/src/main/java/com/fangxuele/tool/push/logic/TemplateMsgMaServiceThread.java
index fc947c04..8abae6ce 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/TemplateMsgMaServiceThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/TemplateMsgMaServiceThread.java
@@ -2,7 +2,7 @@
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.PushForm;
/**
*
@@ -22,12 +22,11 @@ public class TemplateMsgMaServiceThread extends BaseMsgServiceThread {
/**
* 构造函数
*
- * @param pageFrom 起始页
- * @param pageTo 截止页
- * @param pageSize 页大小
+ * @param startIndex 开始索引
+ * @param endIndex 截止索引
*/
- TemplateMsgMaServiceThread(int pageFrom, int pageTo, int pageSize) {
- super(pageFrom, pageTo, pageSize);
+ TemplateMsgMaServiceThread(int startIndex, int endIndex) {
+ super(startIndex, endIndex);
}
@Override
@@ -55,13 +54,13 @@ public void run() {
wxMaTemplateMessage.setToUser(openId);
wxMaTemplateMessage.setFormId(msgData[1]);
// 空跑控制
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
wxMaService.getMsgService().sendTemplateMsg(wxMaTemplateMessage);
}
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -72,7 +71,7 @@ public void run() {
} catch (Exception e) {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -88,7 +87,7 @@ public void run() {
tableModel.setValueAt((int) ((double) (i + 1) / list.size() * 100), tableRow, 5);
// 总进度条
- MainWindow.mainWindow.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
+ PushForm.pushForm.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
}
// 当前线程结束
diff --git a/src/main/java/com/fangxuele/tool/push/logic/TemplateMsgMpServiceThread.java b/src/main/java/com/fangxuele/tool/push/logic/TemplateMsgMpServiceThread.java
index c7816064..2bdab2a3 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/TemplateMsgMpServiceThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/TemplateMsgMpServiceThread.java
@@ -1,6 +1,6 @@
package com.fangxuele.tool.push.logic;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.PushForm;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
/**
@@ -16,12 +16,11 @@ public class TemplateMsgMpServiceThread extends BaseMsgServiceThread {
/**
* 构造函数
*
- * @param pageFrom 起始页
- * @param pageTo 截止页
- * @param pageSize 页大小
+ * @param startIndex 起始页
+ * @param endIndex 截止页
*/
- TemplateMsgMpServiceThread(int pageFrom, int pageTo, int pageSize) {
- super(pageFrom, pageTo, pageSize);
+ TemplateMsgMpServiceThread(int startIndex, int endIndex) {
+ super(startIndex, endIndex);
}
@Override
@@ -48,13 +47,13 @@ public void run() {
wxMessageTemplate = MessageMaker.makeMpTemplateMessage(msgData);
wxMessageTemplate.setToUser(openId);
// 空跑控制
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
wxMpService.getTemplateMsgService().sendTemplateMsg(wxMessageTemplate);
}
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -65,7 +64,7 @@ public void run() {
} catch (Exception e) {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -81,7 +80,7 @@ public void run() {
tableModel.setValueAt((int) ((double) (i + 1) / list.size() * 100), tableRow, 5);
// 总进度条
- MainWindow.mainWindow.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
+ PushForm.pushForm.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
}
// 当前线程结束
diff --git a/src/main/java/com/fangxuele/tool/push/logic/TxYunSmsMsgServiceThread.java b/src/main/java/com/fangxuele/tool/push/logic/TxYunSmsMsgServiceThread.java
index b8a02563..e490e82e 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/TxYunSmsMsgServiceThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/TxYunSmsMsgServiceThread.java
@@ -1,12 +1,10 @@
package com.fangxuele.tool.push.logic;
import com.fangxuele.tool.push.ui.Init;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.MessageEditForm;
+import com.fangxuele.tool.push.ui.form.PushForm;
import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult;
-import org.apache.commons.lang3.StringUtils;
-
-import javax.swing.*;
/**
*
@@ -21,12 +19,11 @@ public class TxYunSmsMsgServiceThread extends BaseMsgServiceThread {
/**
* 构造函数
*
- * @param pageFrom 起始页
- * @param pageTo 截止页
- * @param pageSize 页大小
+ * @param startIndex 起始页
+ * @param endIndex 截止页
*/
- TxYunSmsMsgServiceThread(int pageFrom, int pageTo, int pageSize) {
- super(pageFrom, pageTo, pageSize);
+ TxYunSmsMsgServiceThread(int startIndex, int endIndex) {
+ super(startIndex, endIndex);
}
@Override
@@ -35,18 +32,12 @@ public void run() {
// 初始化当前线程
initCurrentThread();
- String txyunAppId = Init.configer.getTxyunAppId();
- String txyunAppKey = Init.configer.getTxyunAppKey();
-
- if (StringUtils.isEmpty(txyunAppId) || StringUtils.isEmpty(txyunAppKey)) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(),
- "请先在设置中填写并保存腾讯云短信相关配置!", "提示",
- JOptionPane.INFORMATION_MESSAGE);
- }
+ String txyunAppId = Init.config.getTxyunAppId();
+ String txyunAppKey = Init.config.getTxyunAppKey();
SmsSingleSender ssender = new SmsSingleSender(Integer.valueOf(txyunAppId), txyunAppKey);
- int templateId = Integer.parseInt(MainWindow.mainWindow.getMsgTemplateIdTextField().getText());
- String smsSign = Init.configer.getAliyunSign();
+ int templateId = Integer.parseInt(MessageEditForm.messageEditForm.getMsgTemplateIdTextField().getText());
+ String smsSign = Init.config.getAliyunSign();
for (int i = 0; i < list.size(); i++) {
if (!PushData.running) {
@@ -62,14 +53,14 @@ public void run() {
String[] params = MessageMaker.makeTxyunMessage(msgData);
// 空跑控制
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
SmsSingleSenderResult result = ssender.sendWithParam("86", telNum,
templateId, params, smsSign, "", "");
if (result.result == 0) {
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -80,7 +71,7 @@ public void run() {
} else {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -96,7 +87,7 @@ public void run() {
} else {
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -109,7 +100,7 @@ public void run() {
} catch (Exception e) {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -125,7 +116,7 @@ public void run() {
tableModel.setValueAt((int) ((double) (i + 1) / list.size() * 100), tableRow, 5);
// 总进度条
- MainWindow.mainWindow.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
+ PushForm.pushForm.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
}
// 当前线程结束
diff --git a/src/main/java/com/fangxuele/tool/push/logic/YunpianSmsMsgServiceThread.java b/src/main/java/com/fangxuele/tool/push/logic/YunpianSmsMsgServiceThread.java
index 8cfab9bc..ac0da19b 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/YunpianSmsMsgServiceThread.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/YunpianSmsMsgServiceThread.java
@@ -1,13 +1,11 @@
package com.fangxuele.tool.push.logic;
import com.fangxuele.tool.push.ui.Init;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.PushForm;
import com.yunpian.sdk.YunpianClient;
import com.yunpian.sdk.model.Result;
import com.yunpian.sdk.model.SmsSingleSend;
-import org.apache.commons.lang3.StringUtils;
-import javax.swing.*;
import java.util.Map;
/**
@@ -23,12 +21,11 @@ public class YunpianSmsMsgServiceThread extends BaseMsgServiceThread {
/**
* 构造函数
*
- * @param pageFrom 起始页
- * @param pageTo 截止页
- * @param pageSize 页大小
+ * @param startIndex 起始索引
+ * @param endIndex 截止索引
*/
- YunpianSmsMsgServiceThread(int pageFrom, int pageTo, int pageSize) {
- super(pageFrom, pageTo, pageSize);
+ YunpianSmsMsgServiceThread(int startIndex, int endIndex) {
+ super(startIndex, endIndex);
}
@Override
@@ -37,13 +34,7 @@ public void run() {
// 初始化当前线程
initCurrentThread();
- String yunpianApiKey = Init.configer.getYunpianApiKey();
-
- if (StringUtils.isEmpty(yunpianApiKey)) {
- JOptionPane.showMessageDialog(MainWindow.mainWindow.getSettingPanel(),
- "请先在设置中填写并保存云片网短信相关配置!", "提示",
- JOptionPane.INFORMATION_MESSAGE);
- }
+ String yunpianApiKey = Init.config.getYunpianApiKey();
YunpianClient clnt = new YunpianClient(yunpianApiKey).init();
@@ -62,13 +53,13 @@ public void run() {
params.put(YunpianClient.MOBILE, telNum);
// 空跑控制
- if (!MainWindow.mainWindow.getDryRunCheckBox().isSelected()) {
+ if (!PushForm.pushForm.getDryRunCheckBox().isSelected()) {
Result result = clnt.sms().single_send(params);
if (result.getCode() == 0) {
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -79,7 +70,7 @@ public void run() {
} else {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -95,7 +86,7 @@ public void run() {
} else {
// 总发送成功+1
PushData.increaseSuccess();
- MainWindow.mainWindow.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
+ PushForm.pushForm.getPushSuccessCount().setText(String.valueOf(PushData.successRecords));
// 当前线程发送成功+1
currentThreadSuccessCount++;
@@ -108,7 +99,7 @@ public void run() {
} catch (Exception e) {
// 总发送失败+1
PushData.increaseFail();
- MainWindow.mainWindow.getPushFailCount().setText(String.valueOf(PushData.failRecords));
+ PushForm.pushForm.getPushFailCount().setText(String.valueOf(PushData.failRecords));
// 保存发送失败
PushData.sendFailList.add(msgData);
@@ -124,7 +115,7 @@ public void run() {
tableModel.setValueAt((int) ((double) (i + 1) / list.size() * 100), tableRow, 5);
// 总进度条
- MainWindow.mainWindow.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
+ PushForm.pushForm.getPushTotalProgressBar().setValue(PushData.successRecords.intValue() + PushData.failRecords.intValue());
}
// 当前线程结束
diff --git a/src/main/java/com/fangxuele/tool/push/ui/Init.java b/src/main/java/com/fangxuele/tool/push/ui/Init.java
index 74b545e9..c910f290 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/Init.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/Init.java
@@ -1,42 +1,30 @@
package com.fangxuele.tool.push.ui;
import cn.hutool.core.thread.ThreadUtil;
-import cn.hutool.http.HttpUtil;
-import cn.hutool.json.JSONUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.alee.laf.WebLookAndFeel;
-import com.fangxuele.tool.push.bean.UserCase;
-import com.fangxuele.tool.push.logic.MessageTypeConsts;
-import com.fangxuele.tool.push.logic.MsgHisManage;
-import com.fangxuele.tool.push.ui.component.TableInCellButtonColumn;
-import com.fangxuele.tool.push.ui.component.TableInCellCheckBoxRenderer;
-import com.fangxuele.tool.push.ui.form.MainWindow;
+import com.fangxuele.tool.push.ui.form.AboutForm;
+import com.fangxuele.tool.push.ui.form.HelpForm;
+import com.fangxuele.tool.push.ui.form.MemberForm;
+import com.fangxuele.tool.push.ui.form.MessageEditForm;
+import com.fangxuele.tool.push.ui.form.MessageManageForm;
+import com.fangxuele.tool.push.ui.form.MessageTypeForm;
+import com.fangxuele.tool.push.ui.form.PushForm;
+import com.fangxuele.tool.push.ui.form.PushHisForm;
+import com.fangxuele.tool.push.ui.form.ScheduleForm;
+import com.fangxuele.tool.push.ui.form.SettingForm;
+import com.fangxuele.tool.push.ui.form.UserCaseForm;
import com.fangxuele.tool.push.ui.listener.AboutListener;
import com.fangxuele.tool.push.util.ConfigUtil;
import com.fangxuele.tool.push.util.SystemUtil;
-import com.intellij.uiDesigner.core.GridConstraints;
-import com.intellij.uiDesigner.core.GridLayoutManager;
-import com.intellij.uiDesigner.core.Spacer;
import org.apache.commons.lang3.StringUtils;
import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper;
-import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.plaf.FontUIResource;
-import javax.swing.table.DefaultTableCellRenderer;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.text.html.HTMLEditorKit;
-import javax.swing.text.html.StyleSheet;
import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
/**
*
@@ -53,12 +41,7 @@ public class Init {
/**
* 配置文件管理器对象
*/
- public static ConfigUtil configer = ConfigUtil.getInstance();
-
- /**
- * 消息管理
- */
- public static MsgHisManage msgHisManager = MsgHisManage.getInstance();
+ public static ConfigUtil config = ConfigUtil.getInstance();
/**
* 设置全局字体
@@ -69,21 +52,21 @@ public static void initGlobalFont() {
String lowDpiKey = "lowDpiInit";
// 得到屏幕的尺寸
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- if (screenSize.width <= 1366 && StringUtils.isEmpty(configer.getProps(lowDpiKey))) {
- configer.setFontSize(13);
- configer.setProps(lowDpiKey, "true");
- configer.save();
+ if (screenSize.width <= 1366 && StringUtils.isEmpty(config.getProps(lowDpiKey))) {
+ config.setFontSize(13);
+ config.setProps(lowDpiKey, "true");
+ config.save();
}
// Mac高分辨率屏幕字号初始化
String highDpiKey = "highDpiInit";
- if (SystemUtil.isMacOs() && StringUtils.isEmpty(configer.getProps(highDpiKey))) {
- configer.setFontSize(15);
- configer.setProps(highDpiKey, "true");
- configer.save();
+ if (SystemUtil.isMacOs() && StringUtils.isEmpty(config.getProps(highDpiKey))) {
+ config.setFontSize(15);
+ config.setProps(highDpiKey, "true");
+ config.save();
}
- Font fnt = new Font(configer.getFont(), Font.PLAIN, configer.getFontSize());
+ Font fnt = new Font(config.getFont(), Font.PLAIN, config.getFontSize());
FontUIResource fontRes = new FontUIResource(fnt);
for (Enumeration