From bf6a944e891b226e88d0a4f6e86eb4ce79587e07 Mon Sep 17 00:00:00 2001 From: zhoubo9 Date: Mon, 11 May 2020 17:31:35 +0800 Subject: [PATCH 01/29] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/logic/PushControl.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java index 063716c0..df2916b6 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java +++ b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java @@ -30,6 +30,7 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; +import org.springframework.util.CollectionUtils; import javax.swing.*; import java.io.File; @@ -37,8 +38,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -110,7 +113,7 @@ public static boolean pushCheck() { return false; } - if (PushData.allUser == null || PushData.allUser.size() == 0) { + if (CollectionUtils.isEmpty(PushData.allUser)) { int msgType = App.config.getMsgType(); String tipsTitle = "请先准备目标用户!"; if (msgType == MessageTypeEnum.HTTP_CODE) { @@ -142,7 +145,7 @@ public static boolean pushCheck() { /** * 配置检查 * - * @return + * @return isConfig */ public static boolean configCheck() { SettingForm settingForm = SettingForm.getInstance(); @@ -287,7 +290,7 @@ static void savePushData() throws IOException { MessageEditForm messageEditForm = MessageEditForm.getInstance(); File pushHisDir = new File(SystemUtil.configHome + "data" + File.separator + "push_his"); if (!pushHisDir.exists()) { - pushHisDir.mkdirs(); + boolean mkdirs = pushHisDir.mkdirs(); } String msgName = messageEditForm.getMsgNameField().getText(); @@ -382,18 +385,18 @@ static void savePushData() throws IOException { + PushData.toSendList.size() + "未发送"; StringBuilder contentBuilder = new StringBuilder(); contentBuilder.append("

WePush推送结果

"); - contentBuilder.append("

消息类型:" + MessageTypeEnum.getName(App.config.getMsgType()) + "

"); - contentBuilder.append("

消息名称:" + messageEditForm.getMsgNameField().getText() + "

"); + contentBuilder.append("

消息类型:").append(MessageTypeEnum.getName(App.config.getMsgType())).append("

"); + contentBuilder.append("

消息名称:").append(messageEditForm.getMsgNameField().getText()).append("

"); contentBuilder.append("
"); - contentBuilder.append("

成功数:" + PushData.sendSuccessList.size() + "

"); - contentBuilder.append("

失败数:" + PushData.sendFailList.size() + "

"); - contentBuilder.append("

未推送数:" + PushData.toSendList.size() + "

"); + contentBuilder.append("

成功数:").append(PushData.sendSuccessList.size()).append("

"); + contentBuilder.append("

失败数:").append(PushData.sendFailList.size()).append("

"); + contentBuilder.append("

未推送数:").append(PushData.toSendList.size()).append("

"); contentBuilder.append("
"); - contentBuilder.append("

开始时间:" + DateFormatUtils.format(new Date(PushData.startTime), "yyyy-MM-dd HH:mm:ss") + "

"); - contentBuilder.append("

完毕时间:" + DateFormatUtils.format(new Date(PushData.endTime), "yyyy-MM-dd HH:mm:ss") + "

"); - contentBuilder.append("

总耗时:" + DateUtil.formatBetween(PushData.endTime - PushData.startTime, BetweenFormater.Level.SECOND) + "

"); + contentBuilder.append("

开始时间:").append(DateFormatUtils.format(new Date(PushData.startTime), "yyyy-MM-dd HH:mm:ss")).append("

"); + contentBuilder.append("

完毕时间:").append(DateFormatUtils.format(new Date(PushData.endTime), "yyyy-MM-dd HH:mm:ss")).append("

"); + contentBuilder.append("

总耗时:").append(DateUtil.formatBetween(PushData.endTime - PushData.startTime, BetweenFormater.Level.SECOND)).append("

"); contentBuilder.append("
"); contentBuilder.append("

详情请查看附件

"); @@ -413,9 +416,9 @@ static void savePushData() throws IOException { /** * 保存结果到DB * - * @param msgName - * @param resultInfo - * @param file + * @param msgName 消息名称 + * @param resultInfo 结果信息 + * @param file 文件 */ private static void savePushResult(String msgName, String resultInfo, File file) { TPushHistory tPushHistory = new TPushHistory(); @@ -447,7 +450,7 @@ static void prepareMsgMaker() { */ public static void reimportMembers() { if (PushData.fixRateScheduling && ScheduleForm.getInstance().getReimportCheckBox().isSelected()) { - switch ((String) ScheduleForm.getInstance().getReimportComboBox().getSelectedItem()) { + switch ((String) Objects.requireNonNull(ScheduleForm.getInstance().getReimportComboBox().getSelectedItem())) { case "通过SQL导入": MemberListener.importFromSql(); break; From b6e06ba58733701305b0bb0856e6c0940f0bec6a Mon Sep 17 00:00:00 2001 From: zhoubo9 Date: Mon, 25 May 2020 10:04:57 +0800 Subject: [PATCH 02/29] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index ca7f2587..54151998 100644 --- a/pom.xml +++ b/pom.xml @@ -20,9 +20,9 @@ 1.8 1.2.3 - 3.7.0 - 3.7.0 - 3.7.0 + 3.8.0 + 3.8.0 + 3.8.0 4.0.0 4.6.2 4.6 @@ -38,7 +38,7 @@ 2.1 1.18.8 3.5.3 - 3.28.0 + 3.31.1 4.12 4.1.4 3.3.1 From ac5c8f5e4270175a3c8c2a5d1a6888d9d42afdf5 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Tue, 13 Oct 2020 15:25:48 +0800 Subject: [PATCH 03/29] =?UTF-8?q?1.=E6=89=B9=E9=87=8F=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC=202.=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=A8=A1=E6=9D=BF=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=B6=88=E6=81=AF=E6=9E=84=E9=80=A0=E5=99=A8?= =?UTF-8?q?=E5=92=8C=E5=8F=91=E9=80=81=E5=99=A8=203.=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=BB=9F=E4=B8=80=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 32 +- .../tool/push/logic/PushControl.java | 4 +- .../push/logic/msgmaker/MsgMakerFactory.java | 3 - .../logic/msgmaker/WxMaTemplateMsgMaker.java | 85 ----- .../push/logic/msgsender/MailMsgSender.java | 2 +- .../logic/msgsender/MsgSenderFactory.java | 3 - .../msgsender/WxMaSubscribeMsgSender.java | 75 +++- .../msgsender/WxMaTemplateMsgSender.java | 131 ------- .../logic/msgsender/WxUniformMsgSender.java | 32 +- .../tool/push/ui/form/MessageEditForm.java | 4 +- .../push/ui/form/msg/MaTemplateMsgForm.form | 175 --------- .../push/ui/form/msg/MaTemplateMsgForm.java | 359 ------------------ .../tool/push/ui/form/msg/MsgFormFactory.java | 4 +- .../push/ui/form/msg/WxUniformMsgForm.java | 29 +- .../push/ui/listener/SettingListener.java | 4 +- .../tool/push/util/WeWxMpServiceImpl.java | 2 +- 16 files changed, 133 insertions(+), 811 deletions(-) delete mode 100644 src/main/java/com/fangxuele/tool/push/logic/msgmaker/WxMaTemplateMsgMaker.java delete mode 100644 src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMaTemplateMsgSender.java delete mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/MaTemplateMsgForm.form delete mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/MaTemplateMsgForm.java diff --git a/pom.xml b/pom.xml index 54151998..21a0c322 100644 --- a/pom.xml +++ b/pom.xml @@ -20,30 +20,30 @@ 1.8 1.2.3 - 3.8.0 - 3.8.0 - 3.8.0 - 4.0.0 - 4.6.2 - 4.6 + 3.9.0 + 3.9.0 + 3.9.0 + 5.1.1 + 5.4.4 + 5.2 5.1.47 7.0.3 - 1.2.58 + 1.2.74 1.6.2 4.4.2 - 4.1.0 + 4.1.2 1.4 1.0.6 1.2.7 - 2.1 - 1.18.8 - 3.5.3 - 3.31.1 - 4.12 + 2.2 + 1.18.14 + 3.5.6 + 3.32.3.2 + 4.13.1 4.1.4 - 3.3.1 - 2.3.1 - 4.0.1 + 3.4.5 + 2.3.2 + 4.9.0 1.1.0 0.10.75 7.2.25 diff --git a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java index df2916b6..a512b048 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java +++ b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java @@ -8,7 +8,7 @@ import com.fangxuele.tool.push.dao.TPushHistoryMapper; import com.fangxuele.tool.push.domain.TPushHistory; import com.fangxuele.tool.push.logic.msgmaker.MsgMakerFactory; -import com.fangxuele.tool.push.logic.msgmaker.WxMaTemplateMsgMaker; +import com.fangxuele.tool.push.logic.msgmaker.WxMaSubscribeMsgMaker; import com.fangxuele.tool.push.logic.msgmaker.WxMpTemplateMsgMaker; import com.fangxuele.tool.push.logic.msgsender.IMsgSender; import com.fangxuele.tool.push.logic.msgsender.MailMsgSender; @@ -439,7 +439,7 @@ private static void savePushResult(String msgName, String resultInfo, File file) static void prepareMsgMaker() { if (App.config.getMsgType() == MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE) { new WxMpTemplateMsgMaker().prepare(); - new WxMaTemplateMsgMaker().prepare(); + new WxMaSubscribeMsgMaker().prepare(); } else { MsgMakerFactory.getMsgMaker().prepare(); } diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/MsgMakerFactory.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/MsgMakerFactory.java index 1695c815..3a06042b 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/MsgMakerFactory.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/MsgMakerFactory.java @@ -24,9 +24,6 @@ public static IMsgMaker getMsgMaker() { case MessageTypeEnum.MP_TEMPLATE_CODE: iMsgMaker = new WxMpTemplateMsgMaker(); break; - case MessageTypeEnum.MA_TEMPLATE_CODE: - iMsgMaker = new WxMaTemplateMsgMaker(); - break; case MessageTypeEnum.MA_SUBSCRIBE_CODE: iMsgMaker = new WxMaSubscribeMsgMaker(); break; diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/WxMaTemplateMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/WxMaTemplateMsgMaker.java deleted file mode 100644 index 2a06efa2..00000000 --- a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/WxMaTemplateMsgMaker.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.fangxuele.tool.push.logic.msgmaker; - -import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; -import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage; -import com.fangxuele.tool.push.bean.TemplateData; -import com.fangxuele.tool.push.ui.form.msg.MaTemplateMsgForm; -import com.fangxuele.tool.push.util.TemplateUtil; -import org.apache.commons.compress.utils.Lists; -import org.apache.velocity.VelocityContext; - -import javax.swing.table.DefaultTableModel; -import java.util.List; - -/** - *
- * 小程序模板消息加工器
- * 
- * - * @author Zhou Bo - * @since 2019/6/14. - */ -public class WxMaTemplateMsgMaker extends BaseMsgMaker implements IMsgMaker { - - public static String templateId; - private static String templateUrl; - private static String templateKeyWord; - public static List templateDataList; - - /** - * 准备(界面字段等) - */ - @Override - public void prepare() { - templateId = MaTemplateMsgForm.getInstance().getMsgTemplateIdTextField().getText().trim(); - templateUrl = MaTemplateMsgForm.getInstance().getMsgTemplateUrlTextField().getText().trim(); - templateKeyWord = MaTemplateMsgForm.getInstance().getMsgTemplateKeyWordTextField().getText().trim() + ".DATA"; - - if (MaTemplateMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { - MaTemplateMsgForm.initTemplateDataTable(); - } - - DefaultTableModel tableModel = (DefaultTableModel) MaTemplateMsgForm.getInstance().getTemplateMsgDataTable().getModel(); - int rowCount = tableModel.getRowCount(); - TemplateData templateData; - templateDataList = Lists.newArrayList(); - for (int i = 0; i < rowCount; i++) { - String name = ((String) tableModel.getValueAt(i, 0)).trim(); - String value = ((String) tableModel.getValueAt(i, 1)).trim(); - String color = ((String) tableModel.getValueAt(i, 2)).trim(); - templateData = new TemplateData(); - templateData.setName(name); - templateData.setValue(value); - templateData.setColor(color); - templateDataList.add(templateData); - } - } - - /** - * 组织模板消息-小程序 - * - * @param msgData 消息信息 - * @return WxMaTemplateMessage - */ - @Override - public WxMaTemplateMessage makeMsg(String[] msgData) { - // 拼模板 - WxMaTemplateMessage wxMessageTemplate = new WxMaTemplateMessage(); - wxMessageTemplate.setTemplateId(templateId); - VelocityContext velocityContext = getVelocityContext(msgData); - String templateUrlEvaluated = TemplateUtil.evaluate(templateUrl, velocityContext); - wxMessageTemplate.setPage(templateUrlEvaluated); - wxMessageTemplate.setEmphasisKeyword(templateKeyWord); - - WxMaTemplateData wxMaTemplateData; - for (TemplateData templateData : templateDataList) { - wxMaTemplateData = new WxMaTemplateData(); - wxMaTemplateData.setName(templateData.getName()); - wxMaTemplateData.setValue(TemplateUtil.evaluate(templateData.getValue(), velocityContext)); - wxMaTemplateData.setColor(templateData.getColor()); - wxMessageTemplate.addData(wxMaTemplateData); - } - - return wxMessageTemplate; - } -} diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/MailMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/MailMsgSender.java index 7d646d07..27e53a0a 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/MailMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/MailMsgSender.java @@ -133,7 +133,7 @@ private static MailAccount getMailAccount() { mailAccount.setUser(mailUser); mailAccount.setPass(mailPassword); mailAccount.setSslEnable(App.config.isMailUseSSL()); - mailAccount.setStartttlsEnable(App.config.isMailUseStartTLS()); + mailAccount.setStarttlsEnable(App.config.isMailUseStartTLS()); } } } diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/MsgSenderFactory.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/MsgSenderFactory.java index f4a2ebbf..a1543753 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/MsgSenderFactory.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/MsgSenderFactory.java @@ -24,9 +24,6 @@ public static IMsgSender getMsgSender() { case MessageTypeEnum.MP_TEMPLATE_CODE: iMsgSender = new WxMpTemplateMsgSender(); break; - case MessageTypeEnum.MA_TEMPLATE_CODE: - iMsgSender = new WxMaTemplateMsgSender(); - break; case MessageTypeEnum.MA_SUBSCRIBE_CODE: iMsgSender = new WxMaSubscribeMsgSender(); break; diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMaSubscribeMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMaSubscribeMsgSender.java index 685857f6..7192680b 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMaSubscribeMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMaSubscribeMsgSender.java @@ -1,10 +1,14 @@ package com.fangxuele.tool.push.logic.msgsender; import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; +import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; +import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.logic.PushControl; import com.fangxuele.tool.push.logic.msgmaker.WxMaSubscribeMsgMaker; import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; import org.apache.commons.lang3.exception.ExceptionUtils; /** @@ -17,13 +21,16 @@ */ @Slf4j public class WxMaSubscribeMsgSender implements IMsgSender { + public volatile static WxMaService wxMaService; + public volatile static WxMaDefaultConfigImpl wxMaConfigStorage; + private WxMaSubscribeMsgMaker wxMaSubscribeMsgMaker; public WxMaSubscribeMsgSender() { wxMaSubscribeMsgMaker = new WxMaSubscribeMsgMaker(); - wxMaService = WxMaTemplateMsgSender.getWxMaService(); + wxMaService = getWxMaService(); } @Override @@ -55,4 +62,70 @@ public SendResult send(String[] msgData) { public SendResult asyncSend(String[] msgData) { return null; } + + + /** + * 微信小程序配置 + * + * @return WxMaInMemoryConfig + */ + private static WxMaDefaultConfigImpl wxMaConfigStorage() { + WxMaDefaultConfigImpl configStorage = new WxMaDefaultConfigImpl(); + configStorage.setAppid(App.config.getMiniAppAppId()); + configStorage.setSecret(App.config.getMiniAppAppSecret()); + configStorage.setToken(App.config.getMiniAppToken()); + configStorage.setAesKey(App.config.getMiniAppAesKey()); + configStorage.setMsgDataFormat("JSON"); + if (App.config.isMaUseProxy()) { + configStorage.setHttpProxyHost(App.config.getMaProxyHost()); + configStorage.setHttpProxyPort(Integer.parseInt(App.config.getMaProxyPort())); + configStorage.setHttpProxyUsername(App.config.getMaProxyUserName()); + configStorage.setHttpProxyPassword(App.config.getMaProxyPassword()); + } + DefaultApacheHttpClientBuilder clientBuilder = DefaultApacheHttpClientBuilder.get(); + //从连接池获取链接的超时时间(单位ms) + clientBuilder.setConnectionRequestTimeout(10000); + //建立链接的超时时间(单位ms) + clientBuilder.setConnectionTimeout(5000); + //连接池socket超时时间(单位ms) + clientBuilder.setSoTimeout(5000); + //空闲链接的超时时间(单位ms) + clientBuilder.setIdleConnTimeout(60000); + //空闲链接的检测周期(单位ms) + clientBuilder.setCheckWaitTime(60000); + //每路最大连接数 + clientBuilder.setMaxConnPerHost(App.config.getMaxThreadPool() * 2); + //连接池最大连接数 + clientBuilder.setMaxTotalConn(App.config.getMaxThreadPool() * 2); + //HttpClient请求时使用的User Agent +// clientBuilder.setUserAgent(..) + configStorage.setApacheHttpClientBuilder(clientBuilder); + return configStorage; + } + + /** + * 获取微信小程序工具服务 + * + * @return WxMaService + */ + static WxMaService getWxMaService() { + if (wxMaService == null) { + synchronized (WxMaSubscribeMsgSender.class) { + if (wxMaService == null) { + wxMaService = new WxMaServiceImpl(); + } + } + } + if (wxMaConfigStorage == null) { + synchronized (WxMaSubscribeMsgSender.class) { + if (wxMaConfigStorage == null) { + wxMaConfigStorage = wxMaConfigStorage(); + if (wxMaConfigStorage != null) { + wxMaService.setWxMaConfig(wxMaConfigStorage); + } + } + } + } + return wxMaService; + } } diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMaTemplateMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMaTemplateMsgSender.java deleted file mode 100644 index 6e337f98..00000000 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMaTemplateMsgSender.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.fangxuele.tool.push.logic.msgsender; - -import cn.binarywang.wx.miniapp.api.WxMaService; -import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; -import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; -import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage; -import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; -import com.fangxuele.tool.push.App; -import com.fangxuele.tool.push.logic.PushControl; -import com.fangxuele.tool.push.logic.msgmaker.WxMaTemplateMsgMaker; -import lombok.extern.slf4j.Slf4j; -import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; -import org.apache.commons.lang3.exception.ExceptionUtils; - -/** - *
- * 微信小程序模板消息发送器
- * 
- * - * @author RememBerBer - * @since 2019/6/15. - */ -@Slf4j -public class WxMaTemplateMsgSender implements IMsgSender { - public volatile static WxMaService wxMaService; - - public volatile static WxMaDefaultConfigImpl wxMaConfigStorage; - - private WxMaTemplateMsgMaker wxMaTemplateMsgMaker; - - public WxMaTemplateMsgSender() { - wxMaTemplateMsgMaker = new WxMaTemplateMsgMaker(); - wxMaService = getWxMaService(); - } - - @Override - public SendResult send(String[] msgData) { - SendResult sendResult = new SendResult(); - - try { - String openId = msgData[0]; - WxMaSubscribeMessage wxMaSubscribeMessage = new WxMaSubscribeMessage(); - wxMaSubscribeMessage.setToUser(openId); - wxMaSubscribeMessage.setTemplateId(msgData[1]); - if (PushControl.dryRun) { - sendResult.setSuccess(true); - return sendResult; - } else { - wxMaService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage); - } - } catch (Exception e) { - sendResult.setSuccess(false); - sendResult.setInfo(e.getMessage()); - log.error(ExceptionUtils.getStackTrace(e)); - return sendResult; - } - - sendResult.setSuccess(true); - return sendResult; - } - - @Override - public SendResult asyncSend(String[] msgData) { - return null; - } - - /** - * 微信小程序配置 - * - * @return WxMaInMemoryConfig - */ - private static WxMaDefaultConfigImpl wxMaConfigStorage() { - WxMaDefaultConfigImpl configStorage = new WxMaDefaultConfigImpl(); - configStorage.setAppid(App.config.getMiniAppAppId()); - configStorage.setSecret(App.config.getMiniAppAppSecret()); - configStorage.setToken(App.config.getMiniAppToken()); - configStorage.setAesKey(App.config.getMiniAppAesKey()); - configStorage.setMsgDataFormat("JSON"); - if (App.config.isMaUseProxy()) { - configStorage.setHttpProxyHost(App.config.getMaProxyHost()); - configStorage.setHttpProxyPort(Integer.parseInt(App.config.getMaProxyPort())); - configStorage.setHttpProxyUsername(App.config.getMaProxyUserName()); - configStorage.setHttpProxyPassword(App.config.getMaProxyPassword()); - } - DefaultApacheHttpClientBuilder clientBuilder = DefaultApacheHttpClientBuilder.get(); - //从连接池获取链接的超时时间(单位ms) - clientBuilder.setConnectionRequestTimeout(10000); - //建立链接的超时时间(单位ms) - clientBuilder.setConnectionTimeout(5000); - //连接池socket超时时间(单位ms) - clientBuilder.setSoTimeout(5000); - //空闲链接的超时时间(单位ms) - clientBuilder.setIdleConnTimeout(60000); - //空闲链接的检测周期(单位ms) - clientBuilder.setCheckWaitTime(60000); - //每路最大连接数 - clientBuilder.setMaxConnPerHost(App.config.getMaxThreadPool() * 2); - //连接池最大连接数 - clientBuilder.setMaxTotalConn(App.config.getMaxThreadPool() * 2); - //HttpClient请求时使用的User Agent -// clientBuilder.setUserAgent(..) - configStorage.setApacheHttpClientBuilder(clientBuilder); - return configStorage; - } - - /** - * 获取微信小程序工具服务 - * - * @return WxMaService - */ - static WxMaService getWxMaService() { - if (wxMaService == null) { - synchronized (WxMaTemplateMsgSender.class) { - if (wxMaService == null) { - wxMaService = new WxMaServiceImpl(); - } - } - } - if (wxMaConfigStorage == null) { - synchronized (WxMaTemplateMsgSender.class) { - if (wxMaConfigStorage == null) { - wxMaConfigStorage = wxMaConfigStorage(); - if (wxMaConfigStorage != null) { - wxMaService.setWxMaConfig(wxMaConfigStorage); - } - } - } - } - return wxMaService; - } -} diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxUniformMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxUniformMsgSender.java index c5aeb213..5f180c4b 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxUniformMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxUniformMsgSender.java @@ -1,16 +1,20 @@ package com.fangxuele.tool.push.logic.msgsender; -import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage; +import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; +import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; import cn.binarywang.wx.miniapp.bean.WxMaUniformMessage; import cn.binarywang.wx.miniapp.bean.WxMaUniformMessage.MiniProgram; import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.logic.PushControl; -import com.fangxuele.tool.push.logic.msgmaker.WxMaTemplateMsgMaker; +import com.fangxuele.tool.push.logic.msgmaker.WxMaSubscribeMsgMaker; import com.fangxuele.tool.push.logic.msgmaker.WxMpTemplateMsgMaker; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.exception.ExceptionUtils; +import java.util.List; + /** *
  * 微信统一服务消息发送器
@@ -24,11 +28,11 @@ public class WxUniformMsgSender implements IMsgSender {
 
     private WxMpTemplateMsgMaker wxMpTemplateMsgMaker;
 
-    private WxMaTemplateMsgMaker wxMaTemplateMsgMaker;
+    private WxMaSubscribeMsgMaker wxMaSubscribeMsgMaker;
 
     public WxUniformMsgSender() {
         wxMpTemplateMsgMaker = new WxMpTemplateMsgMaker();
-        wxMaTemplateMsgMaker = new WxMaTemplateMsgMaker();
+        wxMaSubscribeMsgMaker = new WxMaSubscribeMsgMaker();
     }
 
     @Override
@@ -37,7 +41,7 @@ public SendResult send(String[] msgData) {
 
         try {
             String openId = msgData[0];
-            WxMaTemplateMessage wxMaTemplateMessage = wxMaTemplateMsgMaker.makeMsg(msgData);
+            WxMaSubscribeMessage wxMaSubscribeMessage = wxMaSubscribeMsgMaker.makeMsg(msgData);
             WxMpTemplateMessage wxMpTemplateMessage = wxMpTemplateMsgMaker.makeMsg(msgData);
 
             WxMaUniformMessage wxMaUniformMessage = new WxMaUniformMessage();
@@ -46,21 +50,29 @@ public SendResult send(String[] msgData) {
             wxMaUniformMessage.setAppid(App.config.getMiniAppAppId());
             wxMaUniformMessage.setTemplateId(wxMpTemplateMessage.getTemplateId());
             wxMaUniformMessage.setUrl(wxMpTemplateMessage.getUrl());
-            wxMaUniformMessage.setPage(wxMaTemplateMessage.getPage());
+            wxMaUniformMessage.setPage(wxMaSubscribeMessage.getPage());
             wxMaUniformMessage.setFormId(msgData[1]);
             MiniProgram miniProgram = new MiniProgram();
             miniProgram.setAppid(App.config.getMiniAppAppId());
-            miniProgram.setPagePath(wxMaTemplateMessage.getPage());
+            miniProgram.setPagePath(wxMaSubscribeMessage.getPage());
 
             wxMaUniformMessage.setMiniProgram(miniProgram);
-            wxMaUniformMessage.setData(wxMaTemplateMessage.getData());
-            wxMaUniformMessage.setEmphasisKeyword(wxMaTemplateMessage.getEmphasisKeyword());
+            List wxMaTemplateDataList = Lists.newArrayList();
+            List data = wxMaSubscribeMessage.getData();
+            WxMaTemplateData wxMaTemplateData;
+            for (WxMaSubscribeMessage.Data datum : data) {
+                wxMaTemplateData = new WxMaTemplateData();
+                wxMaTemplateData.setName(datum.getName());
+                wxMaTemplateData.setValue(datum.getValue());
+                wxMaTemplateDataList.add(wxMaTemplateData);
+            }
+            wxMaUniformMessage.setData(wxMaTemplateDataList);
 
             if (PushControl.dryRun) {
                 sendResult.setSuccess(true);
                 return sendResult;
             } else {
-                WxMaTemplateMsgSender.getWxMaService().getMsgService().sendUniformMsg(wxMaUniformMessage);
+                WxMaSubscribeMsgSender.getWxMaService().getMsgService().sendUniformMsg(wxMaUniformMessage);
             }
         } catch (Exception e) {
             sendResult.setSuccess(false);
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java
index e9e93cf2..0c0ae032 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java
@@ -86,8 +86,6 @@ public static void switchMsgType(int msgType) {
                 messageEditForm.getMsgEditorPanel().add(MpTemplateMsgForm.getInstance().getTemplateMsgPanel(), gridConstraintsRow0);
                 break;
             case MessageTypeEnum.MA_TEMPLATE_CODE:
-                messageEditForm.getMsgEditorPanel().add(MaTemplateMsgForm.getInstance().getTemplateMsgPanel(), gridConstraintsRow0);
-                break;
             case MessageTypeEnum.MA_SUBSCRIBE_CODE:
                 messageEditForm.getMsgEditorPanel().add(MaSubscribeMsgForm.getInstance().getTemplateMsgPanel(), gridConstraintsRow0);
                 break;
@@ -101,7 +99,7 @@ public static void switchMsgType(int msgType) {
                 break;
             case MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE:
                 messageEditForm.getMsgEditorPanel().setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
-                messageEditForm.getMsgEditorPanel().add(MaTemplateMsgForm.getInstance().getTemplateMsgPanel(), gridConstraintsRow0);
+                messageEditForm.getMsgEditorPanel().add(MaSubscribeMsgForm.getInstance().getTemplateMsgPanel(), gridConstraintsRow0);
                 messageEditForm.getMsgEditorPanel().add(MpTemplateMsgForm.getInstance().getTemplateMsgPanel(), gridConstraintsRow1);
                 break;
             case MessageTypeEnum.ALI_YUN_CODE:
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaTemplateMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaTemplateMsgForm.form
deleted file mode 100644
index 31f59c5d..00000000
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaTemplateMsgForm.form
+++ /dev/null
@@ -1,175 +0,0 @@
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaTemplateMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaTemplateMsgForm.java deleted file mode 100644 index 8223a5c2..00000000 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaTemplateMsgForm.java +++ /dev/null @@ -1,359 +0,0 @@ -package com.fangxuele.tool.push.ui.form.msg; - -import com.fangxuele.tool.push.dao.TMsgMaTemplateMapper; -import com.fangxuele.tool.push.dao.TTemplateDataMapper; -import com.fangxuele.tool.push.domain.TMsgMaTemplate; -import com.fangxuele.tool.push.domain.TTemplateData; -import com.fangxuele.tool.push.logic.MessageTypeEnum; -import com.fangxuele.tool.push.ui.component.TableInCellButtonColumn; -import com.fangxuele.tool.push.ui.form.MainWindow; -import com.fangxuele.tool.push.ui.form.MessageEditForm; -import com.fangxuele.tool.push.util.MybatisUtil; -import com.fangxuele.tool.push.util.SqliteUtil; -import com.intellij.uiDesigner.core.GridConstraints; -import com.intellij.uiDesigner.core.GridLayoutManager; -import lombok.Getter; -import org.apache.commons.lang3.StringUtils; - -import javax.swing.*; -import javax.swing.border.TitledBorder; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableColumnModel; -import java.awt.*; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - *
- * MaTemplateMsgForm
- * 
- * - * @author Zhou Bo - * @since 2019/6/3. - */ -@Getter -public class MaTemplateMsgForm implements IMsgForm { - private JPanel templateMsgPanel; - private JLabel templateIdLabel; - private JTextField msgTemplateIdTextField; - private JLabel templateUrlLabel; - private JTextField msgTemplateUrlTextField; - private JPanel templateMsgDataPanel; - private JLabel templateKeyWordLabel; - private JTextField msgTemplateKeyWordTextField; - private JLabel templateMsgNameLabel; - private JTextField templateDataNameTextField; - private JLabel templateMsgValueLabel; - private JTextField templateDataValueTextField; - private JLabel templateMsgColorLabel; - private JTextField templateDataColorTextField; - private JButton templateMsgDataAddButton; - private JTable templateMsgDataTable; - - private static MaTemplateMsgForm maTemplateMsgForm; - - private static TMsgMaTemplateMapper msgMaTemplateMapper = MybatisUtil.getSqlSession().getMapper(TMsgMaTemplateMapper.class); - private static TTemplateDataMapper templateDataMapper = MybatisUtil.getSqlSession().getMapper(TTemplateDataMapper.class); - - public MaTemplateMsgForm() { - // 模板数据-添加 按钮事件 - templateMsgDataAddButton.addActionListener(e -> { - String[] data = new String[3]; - data[0] = getInstance().getTemplateDataNameTextField().getText(); - data[1] = getInstance().getTemplateDataValueTextField().getText(); - data[2] = getInstance().getTemplateDataColorTextField().getText(); - - if (getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { - initTemplateDataTable(); - } - - DefaultTableModel tableModel = (DefaultTableModel) getInstance().getTemplateMsgDataTable() - .getModel(); - int rowCount = tableModel.getRowCount(); - - Set keySet = new HashSet<>(); - String keyData; - for (int i = 0; i < rowCount; i++) { - keyData = (String) tableModel.getValueAt(i, 0); - keySet.add(keyData); - } - - if (StringUtils.isEmpty(data[0]) || StringUtils.isEmpty(data[1])) { - JOptionPane.showMessageDialog(MessageEditForm.getInstance().getMsgEditorPanel(), "Name或value不能为空!", "提示", - JOptionPane.INFORMATION_MESSAGE); - } else if (keySet.contains(data[0])) { - JOptionPane.showMessageDialog(MessageEditForm.getInstance().getMsgEditorPanel(), "Name不能重复!", "提示", - JOptionPane.INFORMATION_MESSAGE); - } else { - if (StringUtils.isEmpty(data[2])) { - data[2] = "#000000"; - } else if (!data[2].startsWith("#")) { - data[2] = "#" + data[2]; - } - tableModel.addRow(data); - } - }); - } - - @Override - public void init(String msgName) { - clearAllField(); - List tMsgMaTemplateList = msgMaTemplateMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.MA_TEMPLATE_CODE, msgName); - Integer msgId = 0; - if (tMsgMaTemplateList.size() > 0) { - TMsgMaTemplate tMsgMaTemplate = tMsgMaTemplateList.get(0); - msgId = tMsgMaTemplate.getId(); - getInstance().getMsgTemplateIdTextField().setText(tMsgMaTemplate.getTemplateId()); - getInstance().getMsgTemplateUrlTextField().setText(tMsgMaTemplate.getPage()); - getInstance().getMsgTemplateKeyWordTextField().setText(tMsgMaTemplate.getEmphasisKeyword()); - } - - initTemplateDataTable(); - // 模板消息Data表 - List templateDataList = templateDataMapper.selectByMsgTypeAndMsgId(MessageTypeEnum.MA_TEMPLATE_CODE, msgId); - String[] headerNames = {"Name", "Value", "Color", "操作"}; - Object[][] cellData = new String[templateDataList.size()][headerNames.length]; - for (int i = 0; i < templateDataList.size(); i++) { - TTemplateData tTemplateData = templateDataList.get(i); - cellData[i][0] = tTemplateData.getName(); - cellData[i][1] = tTemplateData.getValue(); - cellData[i][2] = tTemplateData.getColor(); - } - DefaultTableModel model = new DefaultTableModel(cellData, headerNames); - getInstance().getTemplateMsgDataTable().setModel(model); - TableColumnModel tableColumnModel = getInstance().getTemplateMsgDataTable().getColumnModel(); - tableColumnModel.getColumn(headerNames.length - 1). - setCellRenderer(new TableInCellButtonColumn(getInstance().getTemplateMsgDataTable(), headerNames.length - 1)); - tableColumnModel.getColumn(headerNames.length - 1). - setCellEditor(new TableInCellButtonColumn(getInstance().getTemplateMsgDataTable(), headerNames.length - 1)); - - // 设置列宽 - tableColumnModel.getColumn(3).setPreferredWidth(46); - tableColumnModel.getColumn(3).setMaxWidth(46); - } - - @Override - public void save(String msgName) { - int msgId = 0; - boolean existSameMsg = false; - - List tMsgMaTemplateList = msgMaTemplateMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.MA_TEMPLATE_CODE, msgName); - if (tMsgMaTemplateList.size() > 0) { - existSameMsg = true; - msgId = tMsgMaTemplateList.get(0).getId(); - } - - int isCover = JOptionPane.NO_OPTION; - if (existSameMsg) { - // 如果存在,是否覆盖 - isCover = JOptionPane.showConfirmDialog(MainWindow.getInstance().getMessagePanel(), "已经存在同名的历史消息,\n是否覆盖?", "确认", - JOptionPane.YES_NO_OPTION); - } - - if (!existSameMsg || isCover == JOptionPane.YES_OPTION) { - String templateId = getInstance().getMsgTemplateIdTextField().getText(); - String templateUrl = getInstance().getMsgTemplateUrlTextField().getText(); - String templateKeyWord = getInstance().getMsgTemplateKeyWordTextField().getText(); - - String now = SqliteUtil.nowDateForSqlite(); - - TMsgMaTemplate tMsgMaTemplate = new TMsgMaTemplate(); - tMsgMaTemplate.setMsgType(MessageTypeEnum.MA_TEMPLATE_CODE); - tMsgMaTemplate.setMsgName(msgName); - tMsgMaTemplate.setTemplateId(templateId); - tMsgMaTemplate.setPage(templateUrl); - tMsgMaTemplate.setEmphasisKeyword(templateKeyWord); - tMsgMaTemplate.setCreateTime(now); - tMsgMaTemplate.setModifiedTime(now); - - if (existSameMsg) { - msgMaTemplateMapper.updateByMsgTypeAndMsgName(tMsgMaTemplate); - } else { - msgMaTemplateMapper.insertSelective(tMsgMaTemplate); - msgId = tMsgMaTemplate.getId(); - } - - // 保存模板数据 - - // 如果是覆盖保存,则先清空之前的模板数据 - if (existSameMsg) { - templateDataMapper.deleteByMsgTypeAndMsgId(MessageTypeEnum.MA_TEMPLATE_CODE, msgId); - } - - // 如果table为空,则初始化 - if (getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { - initTemplateDataTable(); - } - - // 逐行读取 - DefaultTableModel tableModel = (DefaultTableModel) getInstance().getTemplateMsgDataTable() - .getModel(); - int rowCount = tableModel.getRowCount(); - for (int i = 0; i < rowCount; i++) { - String name = (String) tableModel.getValueAt(i, 0); - String value = (String) tableModel.getValueAt(i, 1); - String color = ((String) tableModel.getValueAt(i, 2)).trim(); - - TTemplateData tTemplateData = new TTemplateData(); - tTemplateData.setMsgType(MessageTypeEnum.MA_TEMPLATE_CODE); - tTemplateData.setMsgId(msgId); - tTemplateData.setName(name); - tTemplateData.setValue(value); - tTemplateData.setColor(color); - tTemplateData.setCreateTime(now); - tTemplateData.setModifiedTime(now); - - templateDataMapper.insert(tTemplateData); - } - - JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "保存成功!", "成功", - JOptionPane.INFORMATION_MESSAGE); - } - } - - public static MaTemplateMsgForm getInstance() { - if (maTemplateMsgForm == null) { - maTemplateMsgForm = new MaTemplateMsgForm(); - } - return maTemplateMsgForm; - } - - /** - * 初始化模板消息数据table - */ - public static void initTemplateDataTable() { - JTable msgDataTable = getInstance().getTemplateMsgDataTable(); - String[] headerNames = {"Name", "Value", "Color", "操作"}; - DefaultTableModel model = new DefaultTableModel(null, headerNames); - msgDataTable.setModel(model); - msgDataTable.updateUI(); - DefaultTableCellRenderer hr = (DefaultTableCellRenderer) msgDataTable.getTableHeader().getDefaultRenderer(); - // 表头列名居左 - hr.setHorizontalAlignment(DefaultTableCellRenderer.LEFT); - - TableColumnModel tableColumnModel = msgDataTable.getColumnModel(); - tableColumnModel.getColumn(headerNames.length - 1). - setCellRenderer(new TableInCellButtonColumn(msgDataTable, headerNames.length - 1)); - tableColumnModel.getColumn(headerNames.length - 1). - setCellEditor(new TableInCellButtonColumn(msgDataTable, headerNames.length - 1)); - - // 设置列宽 - tableColumnModel.getColumn(3).setPreferredWidth(46); - tableColumnModel.getColumn(3).setMaxWidth(46); - } - - /** - * 清空所有界面字段 - */ - public static void clearAllField() { - getInstance().getMsgTemplateIdTextField().setText(""); - getInstance().getMsgTemplateUrlTextField().setText(""); - getInstance().getMsgTemplateKeyWordTextField().setText(""); - getInstance().getTemplateDataNameTextField().setText(""); - getInstance().getTemplateDataValueTextField().setText(""); - getInstance().getTemplateDataColorTextField().setText(""); - initTemplateDataTable(); - } - - { -// GUI initializer generated by IntelliJ IDEA GUI Designer -// >>> IMPORTANT!! <<< -// DO NOT EDIT OR ADD ANY CODE HERE! - $$$setupUI$$$(); - } - - /** - * Method generated by IntelliJ IDEA GUI Designer - * >>> IMPORTANT!! <<< - * DO NOT edit this method OR call it in your code! - * - * @noinspection ALL - */ - private void $$$setupUI$$$() { - final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); - templateMsgPanel = new JPanel(); - templateMsgPanel.setLayout(new GridLayoutManager(2, 1, new Insets(10, 15, 0, 0), -1, -1)); - panel1.add(templateMsgPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - templateMsgPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "小程序-模板消息编辑", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, templateMsgPanel.getFont()), null)); - templateMsgDataPanel = new JPanel(); - templateMsgDataPanel.setLayout(new GridLayoutManager(3, 4, new Insets(10, 0, 0, 0), -1, -1)); - templateMsgPanel.add(templateMsgDataPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - templateMsgDataPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "模板变量(可使用\"$ENTER$\"作为换行符)", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, templateMsgDataPanel.getFont()), null)); - templateDataNameTextField = new JTextField(); - templateDataNameTextField.setToolTipText("当消息类型是模板消息时的示例:first或者keyword1或者remark之类的"); - templateMsgDataPanel.add(templateDataNameTextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - templateDataValueTextField = new JTextField(); - templateMsgDataPanel.add(templateDataValueTextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - templateDataColorTextField = new JTextField(); - templateDataColorTextField.setToolTipText("示例值:FF0000"); - templateMsgDataPanel.add(templateDataColorTextField, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - templateMsgDataAddButton = new JButton(); - templateMsgDataAddButton.setIcon(new ImageIcon(getClass().getResource("/icon/add.png"))); - templateMsgDataAddButton.setText(""); - templateMsgDataPanel.add(templateMsgDataAddButton, new GridConstraints(1, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - templateMsgDataTable = new JTable(); - templateMsgDataTable.setAutoCreateColumnsFromModel(true); - templateMsgDataTable.setAutoCreateRowSorter(true); - templateMsgDataTable.setGridColor(new Color(-12236470)); - templateMsgDataTable.setRowHeight(36); - templateMsgDataPanel.add(templateMsgDataTable, new GridConstraints(2, 0, 1, 4, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); - templateMsgNameLabel = new JLabel(); - templateMsgNameLabel.setText("name"); - templateMsgNameLabel.setToolTipText("当消息类型是模板消息时的示例:first或者keyword1或者remark之类的"); - templateMsgDataPanel.add(templateMsgNameLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - templateMsgValueLabel = new JLabel(); - templateMsgValueLabel.setText("value"); - templateMsgDataPanel.add(templateMsgValueLabel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - templateMsgColorLabel = new JLabel(); - templateMsgColorLabel.setText("color"); - templateMsgColorLabel.setToolTipText("示例值:FF0000"); - templateMsgDataPanel.add(templateMsgColorLabel, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JPanel panel2 = new JPanel(); - panel2.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 5, 0), -1, -1)); - templateMsgPanel.add(panel2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); - templateIdLabel = new JLabel(); - templateIdLabel.setText("模板ID *"); - panel2.add(templateIdLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - msgTemplateIdTextField = new JTextField(); - panel2.add(msgTemplateIdTextField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - templateUrlLabel = new JLabel(); - templateUrlLabel.setText("跳转URL"); - panel2.add(templateUrlLabel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - msgTemplateUrlTextField = new JTextField(); - panel2.add(msgTemplateUrlTextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - templateKeyWordLabel = new JLabel(); - templateKeyWordLabel.setText("放大关键词"); - panel2.add(templateKeyWordLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - msgTemplateKeyWordTextField = new JTextField(); - panel2.add(msgTemplateKeyWordTextField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - templateMsgNameLabel.setLabelFor(templateDataNameTextField); - templateMsgValueLabel.setLabelFor(templateDataValueTextField); - templateMsgColorLabel.setLabelFor(templateDataColorTextField); - templateIdLabel.setLabelFor(msgTemplateIdTextField); - templateUrlLabel.setLabelFor(msgTemplateUrlTextField); - templateKeyWordLabel.setLabelFor(msgTemplateUrlTextField); - } - - /** - * @noinspection ALL - */ - private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) { - if (currentFont == null) return null; - String resultName; - if (fontName == null) { - resultName = currentFont.getName(); - } else { - Font testFont = new Font(fontName, Font.PLAIN, 10); - if (testFont.canDisplay('a') && testFont.canDisplay('1')) { - resultName = fontName; - } else { - resultName = currentFont.getName(); - } - } - return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize()); - } - -} diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MsgFormFactory.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MsgFormFactory.java index 48c66ab5..d84ad8e3 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MsgFormFactory.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MsgFormFactory.java @@ -25,8 +25,6 @@ public static IMsgForm getMsgForm() { iMsgForm = MpTemplateMsgForm.getInstance(); break; case MessageTypeEnum.MA_TEMPLATE_CODE: - iMsgForm = MaTemplateMsgForm.getInstance(); - break; case MessageTypeEnum.MA_SUBSCRIBE_CODE: iMsgForm = MaSubscribeMsgForm.getInstance(); break; @@ -40,7 +38,7 @@ public static IMsgForm getMsgForm() { break; case MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE: iMsgForm = WxUniformMsgForm.getInstance(); - UndoUtil.register(MaTemplateMsgForm.getInstance()); + UndoUtil.register(MaSubscribeMsgForm.getInstance()); UndoUtil.register(MpTemplateMsgForm.getInstance()); break; case MessageTypeEnum.ALI_YUN_CODE: diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java index bb1b91a8..c0d494a4 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java @@ -42,9 +42,8 @@ public void init(String msgName) { MpTemplateMsgForm.getInstance().getMsgTemplateMiniAppidTextField().setText(tMsgWxUniform.getMaAppid()); MpTemplateMsgForm.getInstance().getMsgTemplateMiniPagePathTextField().setText(tMsgWxUniform.getMaPagePath()); - MaTemplateMsgForm.getInstance().getMsgTemplateIdTextField().setText(tMsgWxUniform.getMaTemplateId()); - MaTemplateMsgForm.getInstance().getMsgTemplateUrlTextField().setText(tMsgWxUniform.getPage()); - MaTemplateMsgForm.getInstance().getMsgTemplateKeyWordTextField().setText(tMsgWxUniform.getEmphasisKeyword()); + MaSubscribeMsgForm.getInstance().getMsgTemplateIdTextField().setText(tMsgWxUniform.getMaTemplateId()); + MaSubscribeMsgForm.getInstance().getMsgTemplateUrlTextField().setText(tMsgWxUniform.getPage()); // -------------公众号模板数据开始 MpTemplateMsgForm.selectedMsgTemplateId = tMsgWxUniform.getMpTemplateId(); @@ -74,7 +73,7 @@ public void init(String msgName) { // -------------公众号模板数据结束 // -------------小程序模板数据开始 - MaTemplateMsgForm.initTemplateDataTable(); + MaSubscribeMsgForm.initTemplateDataTable(); // 模板消息Data表 templateDataList = templateDataMapper.selectByMsgTypeAndMsgId(MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE * MessageTypeEnum.MA_TEMPLATE_CODE, msgId); for (int i = 0; i < templateDataList.size(); i++) { @@ -84,12 +83,12 @@ public void init(String msgName) { cellData[i][2] = tTemplateData.getColor(); } model = new DefaultTableModel(cellData, headerNames); - MaTemplateMsgForm.getInstance().getTemplateMsgDataTable().setModel(model); - tableColumnModel = MaTemplateMsgForm.getInstance().getTemplateMsgDataTable().getColumnModel(); + MaSubscribeMsgForm.getInstance().getTemplateMsgDataTable().setModel(model); + tableColumnModel = MaSubscribeMsgForm.getInstance().getTemplateMsgDataTable().getColumnModel(); tableColumnModel.getColumn(headerNames.length - 1). - setCellRenderer(new TableInCellButtonColumn(MaTemplateMsgForm.getInstance().getTemplateMsgDataTable(), headerNames.length - 1)); + setCellRenderer(new TableInCellButtonColumn(MaSubscribeMsgForm.getInstance().getTemplateMsgDataTable(), headerNames.length - 1)); tableColumnModel.getColumn(headerNames.length - 1). - setCellEditor(new TableInCellButtonColumn(MaTemplateMsgForm.getInstance().getTemplateMsgDataTable(), headerNames.length - 1)); + setCellEditor(new TableInCellButtonColumn(MaSubscribeMsgForm.getInstance().getTemplateMsgDataTable(), headerNames.length - 1)); // 设置列宽 tableColumnModel.getColumn(3).setPreferredWidth(46); @@ -124,9 +123,8 @@ public void save(String msgName) { String templateMiniAppid = MpTemplateMsgForm.getInstance().getMsgTemplateMiniAppidTextField().getText(); String templateMiniPagePath = MpTemplateMsgForm.getInstance().getMsgTemplateMiniPagePathTextField().getText(); - String maTemplateId = MaTemplateMsgForm.getInstance().getMsgTemplateIdTextField().getText(); - String page = MaTemplateMsgForm.getInstance().getMsgTemplateUrlTextField().getText(); - String templateKeyWord = MaTemplateMsgForm.getInstance().getMsgTemplateKeyWordTextField().getText(); + String maTemplateId = MaSubscribeMsgForm.getInstance().getMsgTemplateIdTextField().getText(); + String page = MaSubscribeMsgForm.getInstance().getMsgTemplateUrlTextField().getText(); String now = SqliteUtil.nowDateForSqlite(); @@ -139,7 +137,6 @@ public void save(String msgName) { tMsgWxUniform.setMaAppid(templateMiniAppid); tMsgWxUniform.setMaPagePath(templateMiniPagePath); tMsgWxUniform.setPage(page); - tMsgWxUniform.setEmphasisKeyword(templateKeyWord); tMsgWxUniform.setCreateTime(now); tMsgWxUniform.setModifiedTime(now); @@ -187,12 +184,12 @@ public void save(String msgName) { // -------------小程序模板数据开始 // 如果table为空,则初始化 - if (MaTemplateMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { - MaTemplateMsgForm.initTemplateDataTable(); + if (MaSubscribeMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { + MaSubscribeMsgForm.initTemplateDataTable(); } // 逐行读取 - tableModel = (DefaultTableModel) MaTemplateMsgForm.getInstance().getTemplateMsgDataTable() + tableModel = (DefaultTableModel) MaSubscribeMsgForm.getInstance().getTemplateMsgDataTable() .getModel(); rowCount = tableModel.getRowCount(); for (int i = 0; i < rowCount; i++) { @@ -228,7 +225,7 @@ public static WxUniformMsgForm getInstance() { * 清空所有界面字段 */ public static void clearAllField() { - MaTemplateMsgForm.clearAllField(); + MaSubscribeMsgForm.clearAllField(); MpTemplateMsgForm.clearAllField(); } } diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java index fa9c9dbd..5f087fd9 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java @@ -200,8 +200,8 @@ public static void addListeners() { } SettingForm.initSwitchMultiAccount(); - WxMaTemplateMsgSender.wxMaConfigStorage = null; - WxMaTemplateMsgSender.wxMaService = null; + WxMaSubscribeMsgSender.wxMaConfigStorage = null; + WxMaSubscribeMsgSender.wxMaService = null; JOptionPane.showMessageDialog(settingPanel, "保存成功!", "成功", JOptionPane.INFORMATION_MESSAGE); } catch (Exception e1) { diff --git a/src/main/java/com/fangxuele/tool/push/util/WeWxMpServiceImpl.java b/src/main/java/com/fangxuele/tool/push/util/WeWxMpServiceImpl.java index 04c98673..7e18f3c8 100644 --- a/src/main/java/com/fangxuele/tool/push/util/WeWxMpServiceImpl.java +++ b/src/main/java/com/fangxuele/tool/push/util/WeWxMpServiceImpl.java @@ -4,8 +4,8 @@ import cn.hutool.cache.impl.TimedCache; import cn.hutool.json.JSONUtil; import com.fangxuele.tool.push.App; -import me.chanjar.weixin.common.WxType; import me.chanjar.weixin.common.bean.WxAccessToken; +import me.chanjar.weixin.common.enums.WxType; import me.chanjar.weixin.common.error.WxError; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; From 6f5018c117ebcffd24ccd3ba8db355332fcac2a6 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Wed, 14 Oct 2020 14:50:30 +0800 Subject: [PATCH 04/29] =?UTF-8?q?1.=E6=89=B9=E9=87=8F=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E4=B8=89=E6=96=B9SDK=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 21a0c322..17e9ec81 100644 --- a/pom.xml +++ b/pom.xml @@ -45,8 +45,8 @@ 2.3.2 4.9.0 1.1.0 - 0.10.75 - 7.2.25 + 0.10.134 + 7.3.0 From 40a94c413a809c4f31d64d77e5d3ee42d999aadc Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Thu, 22 Oct 2020 11:20:44 +0800 Subject: [PATCH 05/29] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/ui/listener/MemberListener.java | 71 +++++++++---------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java index cd3fe924..7458b67d 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java @@ -134,49 +134,47 @@ public static void addListeners() { JTable memberListTable = memberForm.getMemberListTable(); // 按数量导入按钮事件 - memberForm.getImportFromNumButton().addActionListener(e -> { - ThreadUtil.execute(() -> { - if (StringUtils.isBlank(memberForm.getImportNumTextField().getText())) { - JOptionPane.showMessageDialog(memberPanel, "请填写数量!", "提示", - JOptionPane.INFORMATION_MESSAGE); - return; - } + memberForm.getImportFromNumButton().addActionListener(e -> ThreadUtil.execute(() -> { + if (StringUtils.isBlank(memberForm.getImportNumTextField().getText())) { + JOptionPane.showMessageDialog(memberPanel, "请填写数量!", "提示", + JOptionPane.INFORMATION_MESSAGE); + return; + } - int currentImported = 0; + int currentImported = 0; - try { - int importNum = Integer.parseInt(memberForm.getImportNumTextField().getText()); - progressBar.setVisible(true); - progressBar.setMaximum(importNum); + try { + int importNum = Integer.parseInt(memberForm.getImportNumTextField().getText()); + progressBar.setVisible(true); + progressBar.setMaximum(importNum); - PushData.allUser = Collections.synchronizedList(new ArrayList<>()); + PushData.allUser = Collections.synchronizedList(new ArrayList<>()); - for (int i = 0; i < importNum; i++) { - String[] array = new String[1]; - array[0] = String.valueOf(i); - PushData.allUser.add(array); - currentImported++; - memberCountLabel.setText(String.valueOf(currentImported)); - } + for (int i = 0; i < importNum; i++) { + String[] array = new String[1]; + array[0] = String.valueOf(i); + PushData.allUser.add(array); + currentImported++; + memberCountLabel.setText(String.valueOf(currentImported)); + } - renderMemberListTable(); + renderMemberListTable(); - if (!PushData.fixRateScheduling) { - JOptionPane.showMessageDialog(memberPanel, "导入完成!", "完成", JOptionPane.INFORMATION_MESSAGE); - } - } catch (Exception e1) { - JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + e1.getMessage(), "失败", - JOptionPane.ERROR_MESSAGE); - logger.error(e1); - e1.printStackTrace(); - } finally { - progressBar.setMaximum(100); - progressBar.setValue(100); - progressBar.setIndeterminate(false); - progressBar.setVisible(false); + if (!PushData.fixRateScheduling) { + JOptionPane.showMessageDialog(memberPanel, "导入完成!", "完成", JOptionPane.INFORMATION_MESSAGE); } - }); - }); + } catch (Exception e1) { + JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + e1.getMessage(), "失败", + JOptionPane.ERROR_MESSAGE); + logger.error(e1); + e1.printStackTrace(); + } finally { + progressBar.setMaximum(100); + progressBar.setValue(100); + progressBar.setIndeterminate(false); + progressBar.setVisible(false); + } + })); // 从文件导入按钮事件 memberForm.getImportFromFileButton().addActionListener(e -> ThreadUtil.execute(MemberListener::importFromFile)); @@ -1208,7 +1206,6 @@ public static void importFromSql() { JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + e1.getMessage(), "失败", JOptionPane.ERROR_MESSAGE); logger.error(e1); - e1.printStackTrace(); } finally { DbUtil.close(conn); memberForm.getImportFromSqlButton().setEnabled(true); From 102cb2322639f23bdeb85adf79cbba597df2c53d Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Fri, 30 Oct 2020 16:39:44 +0800 Subject: [PATCH 06/29] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=89=80=E6=9C=89=E7=BA=BF=E7=A8=8B=E9=83=BD=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E5=AE=8C=E6=AF=95=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangxuele/tool/push/logic/PushData.java | 13 ------------- .../fangxuele/tool/push/logic/PushRunThread.java | 14 +++++++++----- .../tool/push/logic/msgthread/BaseMsgThread.java | 2 -- .../tool/push/logic/msgthread/MsgSendThread.java | 1 - 4 files changed, 9 insertions(+), 21 deletions(-) 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 9838924f..c880dcd5 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/PushData.java +++ b/src/main/java/com/fangxuele/tool/push/logic/PushData.java @@ -82,11 +82,6 @@ public class PushData { */ static int threadCount; - /** - * 已经停止了的线程总数 - */ - static LongAdder stoppedThreadCount = new LongAdder(); - /** * 已处理数+1 */ @@ -108,13 +103,6 @@ public static void increaseFail() { failRecords.add(1); } - /** - * 停止线程数+1 - */ - public static void increaseStoppedThread() { - stoppedThreadCount.add(1); - } - /** * 开始时间 */ @@ -138,7 +126,6 @@ static void reset() { processedRecords.reset(); successRecords.reset(); failRecords.reset(); - stoppedThreadCount.reset(); threadCount = 0; toSendList = Collections.synchronizedList(new LinkedList<>()); sendSuccessList = Collections.synchronizedList(new LinkedList<>()); diff --git a/src/main/java/com/fangxuele/tool/push/logic/PushRunThread.java b/src/main/java/com/fangxuele/tool/push/logic/PushRunThread.java index b3ab5157..992a183d 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/PushRunThread.java +++ b/src/main/java/com/fangxuele/tool/push/logic/PushRunThread.java @@ -48,9 +48,9 @@ public void run() { pushForm.getPushTotalProgressBar().setIndeterminate(false); ConsoleUtil.consoleWithLog("推送开始……"); // 消息数据分片以及线程纷发 - shardingAndMsgThread(); + ThreadPoolExecutor threadPoolExecutor = shardingAndMsgThread(); // 时间监控 - timeMonitor(); + timeMonitor(threadPoolExecutor); } /** @@ -124,7 +124,7 @@ private void preparePushRun() { /** * 消息数据分片以及线程纷发 */ - private static void shardingAndMsgThread() { + private static ThreadPoolExecutor shardingAndMsgThread() { PushForm pushForm = PushForm.getInstance(); Object[] data; @@ -160,18 +160,22 @@ private static void shardingAndMsgThread() { threadPoolExecutor.execute(msgSendThread); } + threadPoolExecutor.shutdown(); ConsoleUtil.consoleWithLog("所有线程宝宝启动完毕……"); + return threadPoolExecutor; } /** * 时间监控 + * + * @param threadPoolExecutor */ - private void timeMonitor() { + private void timeMonitor(ThreadPoolExecutor threadPoolExecutor) { PushForm pushForm = PushForm.getInstance(); long startTimeMillis = System.currentTimeMillis(); // 计时 while (true) { - if (PushData.stoppedThreadCount.intValue() == PushData.threadCount) { + if (threadPoolExecutor.isTerminated()) { if (!PushData.fixRateScheduling) { pushForm.getPushStopButton().setEnabled(false); pushForm.getPushStopButton().updateUI(); diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgthread/BaseMsgThread.java b/src/main/java/com/fangxuele/tool/push/logic/msgthread/BaseMsgThread.java index 94f11406..a4760c6c 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgthread/BaseMsgThread.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgthread/BaseMsgThread.java @@ -97,8 +97,6 @@ public void initCurrentThread() { */ public void currentThreadFinish() { ConsoleUtil.consoleWithLog(this.getName() + "已处理完第" + startIndex + "-" + endIndex + "条的数据"); - - PushData.increaseStoppedThread(); } public int getTableRow() { diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgthread/MsgSendThread.java b/src/main/java/com/fangxuele/tool/push/logic/msgthread/MsgSendThread.java index 624fa9eb..82e814d9 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgthread/MsgSendThread.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgthread/MsgSendThread.java @@ -43,7 +43,6 @@ public void run() { for (int i = 0; i < list.size(); i++) { if (!PushData.running) { // 停止 - PushData.increaseStoppedThread(); return; } From 7e6e75567d7ef00d554d7492ffb9007cf493d61b Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Fri, 30 Oct 2020 16:46:50 +0800 Subject: [PATCH 07/29] =?UTF-8?q?=E6=96=87=E6=A1=88=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fangxuele/tool/push/ui/form/PushForm.form | 2 +- src/main/java/com/fangxuele/tool/push/ui/form/PushForm.java | 2 +- .../com/fangxuele/tool/push/ui/listener/PushListener.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.form index 6b74d534..c33b729c 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.form +++ b/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.form @@ -161,7 +161,7 @@ - + diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.java index a8a9c8f0..823e30da 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.java @@ -169,7 +169,7 @@ public static void init() { scheduleDetailLabel.setText(""); pushUpPanel.add(scheduleDetailLabel, new GridConstraints(5, 8, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); countPerThread = new JLabel(); - countPerThread.setText("每个线程平均分配:0"); + countPerThread.setText("平均每个线程分配:0"); pushUpPanel.add(countPerThread, new GridConstraints(2, 8, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JLabel label4 = new JLabel(); label4.setText("预计剩余"); diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/PushListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/PushListener.java index 8b009795..97d35447 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/PushListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/PushListener.java @@ -428,10 +428,10 @@ static void refreshPushInfo() { // 总记录数 long totalCount = PushData.allUser.size(); pushForm.getPushTotalCountLabel().setText("消息总数:" + totalCount); - // 每个线程平均分配 + // 平均每个线程分配 int threadCount = Integer.parseInt(pushForm.getThreadCountTextField().getText()); int perThread = (int) (totalCount / threadCount) + 1; - pushForm.getCountPerThread().setText("每个线程平均分配:" + perThread); + pushForm.getCountPerThread().setText("平均每个线程分配:" + perThread); // 可用处理器核心 pushForm.getAvailableProcessorLabel().setText("可用处理器核心:" + Runtime.getRuntime().availableProcessors()); // JVM内存占用 From 3a498a7c0ab9bcd403220ecbc1df6183445242f8 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Fri, 30 Oct 2020 17:12:55 +0800 Subject: [PATCH 08/29] =?UTF-8?q?=E9=83=A8=E5=88=86sender=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=E8=BF=9E=E6=8E=A5=E6=B1=A0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fangxuele/tool/push/logic/PushData.java | 2 +- .../com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java | 3 ++- .../tool/push/logic/msgsender/WxMpTemplateMsgSender.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) 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 c880dcd5..3d816582 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/PushData.java +++ b/src/main/java/com/fangxuele/tool/push/logic/PushData.java @@ -80,7 +80,7 @@ public class PushData { /** * 线程总数 */ - static int threadCount; + public static int threadCount; /** * 已处理数+1 diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java index 256f54c0..73472087 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java @@ -9,6 +9,7 @@ import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.bean.HttpMsg; import com.fangxuele.tool.push.logic.PushControl; +import com.fangxuele.tool.push.logic.PushData; import com.fangxuele.tool.push.logic.msgmaker.HttpMsgMaker; import lombok.extern.slf4j.Slf4j; import okhttp3.ConnectionPool; @@ -299,7 +300,7 @@ public static OkHttpClient getOkHttpClient() { builder.proxy(getProxy()); } - ConnectionPool pool = new ConnectionPool(App.config.getThreadCount(), 10, TimeUnit.MINUTES); + ConnectionPool pool = new ConnectionPool(PushData.threadCount, 10, TimeUnit.MINUTES); builder.connectionPool(pool); okHttpClient = builder.build(); } diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMpTemplateMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMpTemplateMsgSender.java index 625b6530..c418e5ff 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMpTemplateMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxMpTemplateMsgSender.java @@ -160,7 +160,7 @@ private static WxMpDefaultConfigImpl wxMpConfigStorage() { //空闲链接的超时时间(单位ms) clientBuilder.setIdleConnTimeout(60000); //空闲链接的检测周期(单位ms) - clientBuilder.setCheckWaitTime(60000); + clientBuilder.setCheckWaitTime(3000); //每路最大连接数 clientBuilder.setMaxConnPerHost(App.config.getMaxThreadPool() * 2); //连接池最大连接数 From 75831592ff37231fb8170d884612842f7f7c84ee Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Mon, 30 Nov 2020 10:35:05 +0800 Subject: [PATCH 09/29] =?UTF-8?q?=E5=8D=87=E7=BA=A7WxJava=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=87=B3=EF=BC=9A=204.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 +++--- .../tool/push/logic/msgmaker/WxCpMsgMaker.java | 2 +- .../tool/push/logic/msgsender/WxCpMsgSender.java | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 17e9ec81..b09a11aa 100644 --- a/pom.xml +++ b/pom.xml @@ -20,9 +20,9 @@ 1.8 1.2.3 - 3.9.0 - 3.9.0 - 3.9.0 + 4.0.0 + 4.0.0 + 4.0.0 5.1.1 5.4.4 5.2 diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/WxCpMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/WxCpMsgMaker.java index 65240d2a..d3aef7a2 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/WxCpMsgMaker.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/WxCpMsgMaker.java @@ -3,8 +3,8 @@ import com.fangxuele.tool.push.logic.msgsender.WxCpMsgSender; import com.fangxuele.tool.push.ui.form.msg.WxCpMsgForm; import com.fangxuele.tool.push.util.TemplateUtil; -import me.chanjar.weixin.cp.bean.WxCpMessage; import me.chanjar.weixin.cp.bean.article.NewArticle; +import me.chanjar.weixin.cp.bean.message.WxCpMessage; import org.apache.velocity.VelocityContext; /** diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxCpMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxCpMsgSender.java index ad279311..9b87fef1 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxCpMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/WxCpMsgSender.java @@ -11,8 +11,8 @@ import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; import me.chanjar.weixin.cp.api.WxCpService; import me.chanjar.weixin.cp.api.impl.WxCpServiceApacheHttpClientImpl; -import me.chanjar.weixin.cp.bean.WxCpMessage; -import me.chanjar.weixin.cp.bean.WxCpMessageSendResult; +import me.chanjar.weixin.cp.bean.message.WxCpMessage; +import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult; import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; @@ -31,9 +31,9 @@ public class WxCpMsgSender implements IMsgSender { public volatile static WxCpDefaultConfigImpl wxCpConfigStorage; public volatile static WxCpService wxCpService; - private WxCpMsgMaker wxCpMsgMaker; + private final WxCpMsgMaker wxCpMsgMaker; - private static TWxCpAppMapper wxCpAppMapper = MybatisUtil.getSqlSession().getMapper(TWxCpAppMapper.class); + private final static TWxCpAppMapper WX_CP_APP_MAPPER = MybatisUtil.getSqlSession().getMapper(TWxCpAppMapper.class); public WxCpMsgSender() { wxCpMsgMaker = new WxCpMsgMaker(); @@ -52,7 +52,7 @@ public SendResult send(String[] msgData) { sendResult.setSuccess(true); return sendResult; } else { - WxCpMessageSendResult wxCpMessageSendResult = wxCpService.messageSend(wxCpMessage); + WxCpMessageSendResult wxCpMessageSendResult = wxCpService.getMessageService().send(wxCpMessage); if (wxCpMessageSendResult.getErrCode() != 0 || StringUtils.isNoneEmpty(wxCpMessageSendResult.getInvalidUser())) { sendResult.setSuccess(false); sendResult.setInfo(wxCpMessageSendResult.toString()); @@ -87,7 +87,7 @@ private static WxCpDefaultConfigImpl wxCpConfigStorage() { String agentId = WxCpMsgForm.appNameToAgentIdMap.get(WxCpMsgForm.getInstance().getAppNameComboBox().getSelectedItem()); configStorage.setAgentId(Integer.valueOf(agentId)); - List wxCpAppList = wxCpAppMapper.selectByAgentId(agentId); + List wxCpAppList = WX_CP_APP_MAPPER.selectByAgentId(agentId); if (wxCpAppList.size() > 0) { configStorage.setCorpSecret(wxCpAppList.get(0).getSecret()); } From 7f94d2e73169b5eeb26afe2cd3dc635c2447b189 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Wed, 2 Dec 2020 20:48:16 +0800 Subject: [PATCH 10/29] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7=E6=A8=A1=E6=9D=BF=E6=B6=88=E6=81=AF=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=BA=E7=A9=BA=E6=97=B6=E7=9A=84=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E6=8A=A5=E9=94=99+IntelliJ=E5=8D=87=E7=BA=A7=E5=90=8E?= =?UTF-8?q?=E7=9A=84Form=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/ui/dialog/FontSizeAdjustDialog.java | 8 +++++++- .../com/fangxuele/tool/push/ui/form/AboutForm.java | 8 +++++++- .../com/fangxuele/tool/push/ui/form/BoostForm.java | 8 +++++++- .../fangxuele/tool/push/ui/form/LoadingForm.java | 8 +++++++- .../fangxuele/tool/push/ui/form/MainWindow.java | 8 +++++++- .../fangxuele/tool/push/ui/form/MemberForm.java | 8 +++++++- .../tool/push/ui/form/MessageEditForm.java | 8 +++++++- .../com/fangxuele/tool/push/ui/form/PushForm.java | 8 +++++++- .../fangxuele/tool/push/ui/form/SettingForm.java | 8 +++++++- .../fangxuele/tool/push/ui/form/UserCaseForm.java | 9 ++++++++- .../tool/push/ui/form/msg/AliYunMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/BdYunMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/DingMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/HwYunMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/KefuMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/MaSubscribeMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/MpTemplateMsgForm.java | 14 +++++++++++--- .../tool/push/ui/form/msg/QiNiuYunMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/TxYunMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/UpYunMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/WxCpMsgForm.java | 8 +++++++- .../tool/push/ui/form/msg/YunpianMsgForm.java | 8 +++++++- 22 files changed, 159 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/FontSizeAdjustDialog.java b/src/main/java/com/fangxuele/tool/push/ui/dialog/FontSizeAdjustDialog.java index 2628a9f6..10d96293 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/dialog/FontSizeAdjustDialog.java +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/FontSizeAdjustDialog.java @@ -10,10 +10,13 @@ import com.intellij.uiDesigner.core.Spacer; import javax.swing.*; +import javax.swing.plaf.FontUIResource; +import javax.swing.text.StyleContext; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.util.Locale; /** *
@@ -136,7 +139,10 @@ private void onCancel() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
     /**
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/AboutForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/AboutForm.java
index 7c1bf809..fb129cb1 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/AboutForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/AboutForm.java
@@ -6,7 +6,10 @@
 import lombok.Getter;
 
 import javax.swing.*;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
+import java.util.Locale;
 
 /**
  * 
@@ -124,7 +127,10 @@ public static void init() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
     /**
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/BoostForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/BoostForm.java
index 99809cd1..45692746 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/BoostForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/BoostForm.java
@@ -8,7 +8,10 @@
 import lombok.Getter;
 
 import javax.swing.*;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
+import java.util.Locale;
 
 /**
  * 
@@ -222,7 +225,10 @@ public static void init() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
     /**
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/LoadingForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/LoadingForm.java
index 3b7c1bff..53de7a4e 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/LoadingForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/LoadingForm.java
@@ -5,7 +5,10 @@
 import lombok.Getter;
 
 import javax.swing.*;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
+import java.util.Locale;
 
 /**
  * 
@@ -61,7 +64,10 @@ public class LoadingForm {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
     /**
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MainWindow.java b/src/main/java/com/fangxuele/tool/push/ui/form/MainWindow.java
index c6236195..79d99931 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/MainWindow.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/MainWindow.java
@@ -6,7 +6,10 @@
 import lombok.Getter;
 
 import javax.swing.*;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
+import java.util.Locale;
 
 /**
  * 
@@ -164,7 +167,10 @@ public void init() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
     /**
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java
index 55899d8d..3d877dc7 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java
@@ -11,10 +11,13 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.table.DefaultTableModel;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Locale;
 
 /**
  * 
@@ -425,7 +428,10 @@ public static void clearMember() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
     /**
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java
index 0c0ae032..45d4588f 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java
@@ -10,7 +10,10 @@
 import org.apache.commons.lang3.StringUtils;
 
 import javax.swing.*;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
+import java.util.Locale;
 
 /**
  * 
@@ -231,7 +234,10 @@ public static void switchMsgType(int msgType) {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.java
index 823e30da..25a46c69 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/PushForm.java
@@ -8,7 +8,10 @@
 import lombok.Getter;
 
 import javax.swing.*;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
+import java.util.Locale;
 
 /**
  * 
@@ -292,7 +295,10 @@ public static void init() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java
index 137668fd..ee1fe824 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java
@@ -13,8 +13,11 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * 
@@ -1030,7 +1033,10 @@ public static void toggleMpOutSideAccessTokenPanel() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/UserCaseForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/UserCaseForm.java
index 6342ed2f..657394f3 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/UserCaseForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/UserCaseForm.java
@@ -14,11 +14,14 @@
 
 import javax.imageio.ImageIO;
 import javax.swing.*;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.IOException;
 import java.net.URL;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * 
@@ -160,7 +163,10 @@ public static void init() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
     /**
@@ -169,4 +175,5 @@ public static void init() {
     public JComponent $$$getRootComponent$$$() {
         return userCasePanel;
     }
+
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java
index 1ebb6252..8753125e 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java
@@ -17,12 +17,15 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableColumnModel;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 
 /**
@@ -306,7 +309,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java
index 85d70ba5..1313a4e6 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java
@@ -17,12 +17,15 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableColumnModel;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 
 /**
@@ -309,7 +312,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java
index cfc9716a..1b4f19d9 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java
@@ -21,11 +21,14 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.awt.event.ItemEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
 
@@ -449,7 +452,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java
index 0a5d5132..02ee475f 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java
@@ -17,12 +17,15 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableColumnModel;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 
 /**
@@ -309,7 +312,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java
index 8638e19a..547f0c2f 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java
@@ -13,9 +13,12 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.awt.event.ItemEvent;
 import java.util.List;
+import java.util.Locale;
 import java.util.Objects;
 
 /**
@@ -260,7 +263,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java
index 72c46a0f..4aa4d737 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java
@@ -17,12 +17,15 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableColumnModel;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 
 /**
@@ -341,7 +344,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java
index 51e53ce2..6d49e22d 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java
@@ -23,13 +23,16 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableColumnModel;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.awt.event.ItemEvent;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.regex.Matcher;
@@ -313,9 +316,11 @@ public static void initTemplateList() {
                 }
             }
 
-            getInstance().getTemplateListComboBox().setSelectedIndex(selectedIndex);
+            if (selectedIndex > 0) {
+                getInstance().getTemplateListComboBox().setSelectedIndex(selectedIndex);
+                fillWxTemplateContentToField();
+            }
 
-            fillWxTemplateContentToField();
         } catch (Exception e) {
             log.error(e.toString());
         }
@@ -538,7 +543,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/QiNiuYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/QiNiuYunMsgForm.java
index 7b8a7bac..b353d8cf 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/QiNiuYunMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/QiNiuYunMsgForm.java
@@ -17,12 +17,15 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableColumnModel;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 
 /**
@@ -309,7 +312,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/TxYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/TxYunMsgForm.java
index 142becf1..9197c682 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/TxYunMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/TxYunMsgForm.java
@@ -17,12 +17,15 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableColumnModel;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 
 /**
@@ -309,7 +312,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/UpYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/UpYunMsgForm.java
index bef0968a..c12a2e60 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/UpYunMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/UpYunMsgForm.java
@@ -17,12 +17,15 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableColumnModel;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 
 /**
@@ -309,7 +312,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxCpMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxCpMsgForm.java
index efa32e7b..ad74e9c3 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxCpMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxCpMsgForm.java
@@ -17,9 +17,12 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.awt.event.ItemEvent;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
 
@@ -339,7 +342,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/YunpianMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/YunpianMsgForm.java
index 53d96bc8..42bb92a1 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/YunpianMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/YunpianMsgForm.java
@@ -12,8 +12,11 @@
 
 import javax.swing.*;
 import javax.swing.border.TitledBorder;
+import javax.swing.plaf.FontUIResource;
+import javax.swing.text.StyleContext;
 import java.awt.*;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * 
@@ -137,7 +140,10 @@ public static void clearAllField() {
                 resultName = currentFont.getName();
             }
         }
-        return new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
+        boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
+        Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
+        return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
     }
 
     /**

From 86572e17fbec2b85317a0853015c58055d3f8117 Mon Sep 17 00:00:00 2001
From: zhoubo58 
Date: Wed, 2 Dec 2020 21:16:18 +0800
Subject: [PATCH 11/29] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=AC=E4=BC=97?=
 =?UTF-8?q?=E5=8F=B7=E6=A8=A1=E6=9D=BF=E6=B6=88=E6=81=AF=E6=A8=A1=E6=9D=BF?=
 =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=BA=E7=A9=BA=E6=97=B6=E7=9A=84=E5=90=8E?=
 =?UTF-8?q?=E5=8F=B0=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java
index 6d49e22d..c2bf600a 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java
@@ -316,7 +316,7 @@ public static void initTemplateList() {
                 }
             }
 
-            if (selectedIndex > 0) {
+            if (getInstance().getTemplateListComboBox().getItemCount() > 0) {
                 getInstance().getTemplateListComboBox().setSelectedIndex(selectedIndex);
                 fillWxTemplateContentToField();
             }

From c10beff1f7e0d34595ef3f08afe6687a271b9003 Mon Sep 17 00:00:00 2001
From: zhoubo58 
Date: Thu, 3 Dec 2020 15:38:42 +0800
Subject: [PATCH 12/29] =?UTF-8?q?=E8=AE=BE=E7=BD=AEtab=E6=96=B0=E5=A2=9E?=
 =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=A8=A1=E5=9D=97=E5=92=8C=E6=9F=A5=E7=9C=8B?=
 =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/fangxuele/tool/push/ui/UiConsts.java  |  5 +++
 .../tool/push/ui/form/SettingForm.form        | 39 ++++++++++++++++++-
 .../tool/push/ui/form/SettingForm.java        | 37 ++++++++++++------
 .../push/ui/listener/SettingListener.java     | 11 ++++++
 4 files changed, 78 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java b/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java
index eb5bd474..cfc798c1 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java
@@ -104,4 +104,9 @@ public class UiConsts {
      */
     public final static String INTRODUCE_QRCODE_URL = "http://download.zhoubochina.com/qrcode/introduce-wepush-qrcode.png";
 
+    /**
+     * 日志文件路径
+     */
+    public final static String LOG_DIR = "./logs/";
+
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.form
index fc74f3eb..835645a5 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.form
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.form
@@ -3,7 +3,7 @@
   
     
     
-      
+      
     
     
     
@@ -36,7 +36,7 @@
                       
                     
                   
-                  
+                  
                     
                     
                       
@@ -1685,6 +1685,41 @@
                           
                         
                       
+                      
+                        
+                        
+                          
+                        
+                        
+                        
+                          
+                        
+                        
+                          
+                            
+                            
+                              
+                            
+                            
+                            
+                            
+                              
+                                
+                                  
+                                
+                                
+                                  
+                                
+                              
+                              
+                                
+                                  
+                                
+                              
+                            
+                          
+                        
+                      
                       
                         
                         
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java
index ee1fe824..5d04dbdb 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java
@@ -124,6 +124,7 @@ public class SettingForm {
     private JButton qiniuSaveButton;
     private JTextField qiniuSecretKeyTextField;
     private JCheckBox useTrayCheckBox;
+    private JButton showLogButton;
 
     private static SettingForm settingForm;
     private static TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class);
@@ -390,7 +391,7 @@ public static void toggleMpOutSideAccessTokenPanel() {
         final Spacer spacer1 = new Spacer();
         panel2.add(spacer1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
         final JPanel panel3 = new JPanel();
-        panel3.setLayout(new GridLayoutManager(16, 1, new Insets(40, 60, 0, 330), -1, -1));
+        panel3.setLayout(new GridLayoutManager(17, 1, new Insets(40, 60, 0, 330), -1, -1));
         panel2.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(600, -1), null, 0, false));
         final JPanel panel4 = new JPanel();
         panel4.setLayout(new GridLayoutManager(2, 1, new Insets(15, 15, 10, 0), -1, -1));
@@ -975,26 +976,38 @@ public static void toggleMpOutSideAccessTokenPanel() {
         final Spacer spacer18 = new Spacer();
         panel35.add(spacer18, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
         final JPanel panel36 = new JPanel();
-        panel36.setLayout(new GridLayoutManager(3, 1, new Insets(15, 15, 10, 0), -1, -1));
-        Font panel36Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel36.getFont());
-        if (panel36Font != null) panel36.setFont(panel36Font);
-        panel3.add(panel36, new GridConstraints(12, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
-        panel36.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel36.getFont()), null));
+        panel36.setLayout(new GridLayoutManager(1, 3, new Insets(15, 15, 10, 0), -1, -1));
+        panel3.add(panel36, new GridConstraints(16, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        panel36.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "调试", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel36.getFont()), null));
         final JPanel panel37 = new JPanel();
         panel37.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
-        panel36.add(panel37, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        panel36.add(panel37, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        showLogButton = new JButton();
+        showLogButton.setText("查看日志");
+        panel37.add(showLogButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final Spacer spacer19 = new Spacer();
+        panel37.add(spacer19, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        final JPanel panel38 = new JPanel();
+        panel38.setLayout(new GridLayoutManager(3, 1, new Insets(15, 15, 10, 0), -1, -1));
+        Font panel38Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel38.getFont());
+        if (panel38Font != null) panel38.setFont(panel38Font);
+        panel3.add(panel38, new GridConstraints(12, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        panel38.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel38.getFont()), null));
+        final JPanel panel39 = new JPanel();
+        panel39.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
+        panel38.add(panel39, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
         httpSaveButton = new JButton();
         httpSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
         httpSaveButton.setText("保存");
-        panel37.add(httpSaveButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final Spacer spacer19 = new Spacer();
-        panel37.add(spacer19, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        panel39.add(httpSaveButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final Spacer spacer20 = new Spacer();
+        panel39.add(spacer20, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
         httpUseProxyCheckBox = new JCheckBox();
         httpUseProxyCheckBox.setText("使用HTTP代理");
-        panel36.add(httpUseProxyCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel38.add(httpUseProxyCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         httpProxyPanel = new JPanel();
         httpProxyPanel.setLayout(new GridLayoutManager(4, 2, new Insets(0, 26, 0, 0), -1, -1));
-        panel36.add(httpProxyPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        panel38.add(httpProxyPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
         final JLabel label53 = new JLabel();
         label53.setText("Host");
         httpProxyPanel.add(label53, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java
index 5f087fd9..e4ea396e 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java
@@ -24,6 +24,7 @@
 import java.awt.event.ItemEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import java.io.File;
 import java.util.List;
 import java.util.Objects;
 
@@ -544,6 +545,16 @@ public static void addListeners() {
             }
         });
 
+        // 调试-查看日志
+        settingForm.getShowLogButton().addActionListener(e -> {
+            try {
+                Desktop desktop = Desktop.getDesktop();
+                desktop.open(new File(UiConsts.LOG_DIR));
+            } catch (Exception e2) {
+                logger.error("查看日志打开失败", e2);
+            }
+        });
+
         settingForm.getMpUseProxyCheckBox().addChangeListener(e -> SettingForm.toggleMpProxyPanel());
         settingForm.getMaUseProxyCheckBox().addChangeListener(e -> SettingForm.toggleMaProxyPanel());
         settingForm.getHttpUseProxyCheckBox().addChangeListener(e -> SettingForm.toggleHttpProxyPanel());

From 2db5ccde9ac527d5d5ce4c1d64369a5ed58c78d5 Mon Sep 17 00:00:00 2001
From: zhoubo58 
Date: Thu, 3 Dec 2020 18:41:58 +0800
Subject: [PATCH 13/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?=
 =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?=
 =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/fangxuele/tool/push/ui/UiConsts.java  |   9 +
 .../push/ui/dialog/SwitchWxAccountDialog.java |   5 +-
 .../tool/push/ui/form/MessageManageForm.form  |  22 +-
 .../tool/push/ui/form/MessageManageForm.java  | 221 +++++++++++-------
 .../tool/push/ui/form/SettingForm.java        |  15 +-
 .../tool/push/ui/frame/MainFrame.java         |   8 +-
 ...Listener.java => MessageEditListener.java} |   2 +-
 ...stener.java => MessageManageListener.java} |  23 +-
 .../push/ui/listener/SettingListener.java     |  16 +-
 .../fangxuele/tool/push/util/UpgradeUtil.java |   8 +-
 10 files changed, 214 insertions(+), 115 deletions(-)
 rename src/main/java/com/fangxuele/tool/push/ui/listener/{MsgEditListener.java => MessageEditListener.java} (99%)
 rename src/main/java/com/fangxuele/tool/push/ui/listener/{MsgManageListener.java => MessageManageListener.java} (85%)

diff --git a/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java b/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java
index cfc798c1..3c1cd838 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java
@@ -109,4 +109,13 @@ public class UiConsts {
      */
     public final static String LOG_DIR = "./logs/";
 
+    /**
+     * 多账号切换账号类型:公众号
+     */
+    public static final String WX_ACCOUNT_TYPE_MP = "mp";
+
+    /**
+     * 多账号切换账号类型:小程序
+     */
+    public static final String WX_ACCOUNT_TYPE_MA = "ma";
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/SwitchWxAccountDialog.java b/src/main/java/com/fangxuele/tool/push/ui/dialog/SwitchWxAccountDialog.java
index b3d313c3..0bc57155 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/dialog/SwitchWxAccountDialog.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/SwitchWxAccountDialog.java
@@ -6,6 +6,7 @@
 import com.fangxuele.tool.push.App;
 import com.fangxuele.tool.push.dao.TWxAccountMapper;
 import com.fangxuele.tool.push.domain.TWxAccount;
+import com.fangxuele.tool.push.ui.UiConsts;
 import com.fangxuele.tool.push.ui.form.SettingForm;
 import com.fangxuele.tool.push.ui.listener.SettingListener;
 import com.fangxuele.tool.push.util.ComponentUtil;
@@ -56,9 +57,9 @@ public class SwitchWxAccountDialog extends JDialog {
     public SwitchWxAccountDialog() {
         super(App.mainFrame, "多账号管理");
         String title = "多账号管理";
-        if (SettingForm.WX_ACCOUNT_TYPE_MP.equals(SettingListener.wxAccountType)) {
+        if (UiConsts.WX_ACCOUNT_TYPE_MP.equals(SettingListener.wxAccountType)) {
             title = "多账号管理-公众号";
-        } else if (SettingForm.WX_ACCOUNT_TYPE_MA.equals(SettingListener.wxAccountType)) {
+        } else if (UiConsts.WX_ACCOUNT_TYPE_MA.equals(SettingListener.wxAccountType)) {
             title = "多账号管理-小程序";
         }
         setTitle(title);
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.form
index f87cf3e2..1a510b12 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.form
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.form
@@ -8,7 +8,7 @@
     
     
     
-      
+      
         
         
           
@@ -22,7 +22,7 @@
         
           
             
-              
+              
             
             
             
@@ -40,7 +40,7 @@
           
             
             
-              
+              
             
             
             
@@ -71,6 +71,22 @@
               
             
           
+          
+            
+            
+              
+            
+            
+            
+            
+              
+                
+                  
+                
+                
+              
+            
+          
         
       
     
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java
index 4ff95168..5237395d 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java
@@ -12,6 +12,7 @@
 import com.fangxuele.tool.push.dao.TMsgSmsMapper;
 import com.fangxuele.tool.push.dao.TMsgWxCpMapper;
 import com.fangxuele.tool.push.dao.TMsgWxUniformMapper;
+import com.fangxuele.tool.push.dao.TWxAccountMapper;
 import com.fangxuele.tool.push.domain.TMsgDing;
 import com.fangxuele.tool.push.domain.TMsgHttp;
 import com.fangxuele.tool.push.domain.TMsgKefu;
@@ -23,7 +24,9 @@
 import com.fangxuele.tool.push.domain.TMsgSms;
 import com.fangxuele.tool.push.domain.TMsgWxCp;
 import com.fangxuele.tool.push.domain.TMsgWxUniform;
+import com.fangxuele.tool.push.domain.TWxAccount;
 import com.fangxuele.tool.push.logic.MessageTypeEnum;
+import com.fangxuele.tool.push.ui.UiConsts;
 import com.fangxuele.tool.push.util.JTableUtil;
 import com.fangxuele.tool.push.util.MybatisUtil;
 import com.intellij.uiDesigner.core.GridConstraints;
@@ -51,6 +54,7 @@ public class MessageManageForm {
     private JTable msgHistable;
     private JButton msgHisTableDeleteButton;
     private JButton createMsgButton;
+    private JComboBox accountSwitchComboBox;
 
     private static MessageManageForm messageManageForm;
 
@@ -65,6 +69,7 @@ public class MessageManageForm {
     private static TMsgWxCpMapper msgWxCpMapper = MybatisUtil.getSqlSession().getMapper(TMsgWxCpMapper.class);
     private static TMsgHttpMapper msgHttpMapper = MybatisUtil.getSqlSession().getMapper(TMsgHttpMapper.class);
     private static TMsgDingMapper msgDingMapper = MybatisUtil.getSqlSession().getMapper(TMsgDingMapper.class);
+    private static TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class);
 
     private MessageManageForm() {
     }
@@ -81,6 +86,9 @@ public static MessageManageForm getInstance() {
      */
     public static void init() {
         messageManageForm = getInstance();
+
+        initSwitchMultiAccount();
+
         // 历史消息管理
         String[] headerNames = {"消息名称"};
         DefaultTableModel model = new DefaultTableModel(null, headerNames);
@@ -92,83 +100,131 @@ public static void init() {
 
         Object[] data;
 
-        if (msgType == MessageTypeEnum.KEFU_CODE) {
-            List tMsgKefuList = msgKefuMapper.selectByMsgType(msgType);
-            for (TMsgKefu tMsgKefu : tMsgKefuList) {
-                data = new Object[1];
-                data[0] = tMsgKefu.getMsgName();
-                model.addRow(data);
-            }
-        } else if (msgType == MessageTypeEnum.KEFU_PRIORITY_CODE) {
-            List tMsgKefuPriorityList = msgKefuPriorityMapper.selectByMsgType(msgType);
-            for (TMsgKefuPriority tMsgKefuPriority : tMsgKefuPriorityList) {
-                data = new Object[1];
-                data[0] = tMsgKefuPriority.getMsgName();
-                model.addRow(data);
-            }
-        } else if (msgType == MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE) {
-            List tMsgWxUniformList = wxUniformMapper.selectByMsgType(msgType);
-            for (TMsgWxUniform tMsgWxUniform : tMsgWxUniformList) {
-                data = new Object[1];
-                data[0] = tMsgWxUniform.getMsgName();
-                model.addRow(data);
-            }
-        } else if (msgType == MessageTypeEnum.MA_TEMPLATE_CODE) {
-            List tMsgMaTemplateList = msgMaTemplateMapper.selectByMsgType(msgType);
-            for (TMsgMaTemplate tMsgMaTemplate : tMsgMaTemplateList) {
-                data = new Object[1];
-                data[0] = tMsgMaTemplate.getMsgName();
-                model.addRow(data);
-            }
-        } else if (msgType == MessageTypeEnum.MA_SUBSCRIBE_CODE) {
-            List tMsgMaSubscribeList = msgMaSubscribeMapper.selectByMsgType(msgType);
-            for (TMsgMaSubscribe tMsgMaSubscribe : tMsgMaSubscribeList) {
-                data = new Object[1];
-                data[0] = tMsgMaSubscribe.getMsgName();
-                model.addRow(data);
-            }
-        } else if (msgType == MessageTypeEnum.MP_TEMPLATE_CODE) {
-            List tMsgMpTemplateList = msgMpTemplateMapper.selectByMsgType(msgType);
-            for (TMsgMpTemplate tMsgMpTemplate : tMsgMpTemplateList) {
-                data = new Object[1];
-                data[0] = tMsgMpTemplate.getMsgName();
-                model.addRow(data);
-            }
-        } else if (msgType == MessageTypeEnum.EMAIL_CODE) {
-            List tMsgMailList = msgMailMapper.selectByMsgType(msgType);
-            for (TMsgMail tMsgMail : tMsgMailList) {
-                data = new Object[1];
-                data[0] = tMsgMail.getMsgName();
-                model.addRow(data);
-            }
-        } else if (msgType == MessageTypeEnum.WX_CP_CODE) {
-            List tMsgWxCpList = msgWxCpMapper.selectByMsgType(msgType);
-            for (TMsgWxCp tMsgWxCp : tMsgWxCpList) {
-                data = new Object[1];
-                data[0] = tMsgWxCp.getMsgName();
-                model.addRow(data);
-            }
-        } else if (msgType == MessageTypeEnum.HTTP_CODE) {
-            List tMsgHttpList = msgHttpMapper.selectByMsgType(msgType);
-            for (TMsgHttp tMsgHttp : tMsgHttpList) {
-                data = new Object[1];
-                data[0] = tMsgHttp.getMsgName();
-                model.addRow(data);
-            }
-        } else if (msgType == MessageTypeEnum.DING_CODE) {
-            List tMsgDingList = msgDingMapper.selectByMsgType(msgType);
-            for (TMsgDing tMsgDing : tMsgDingList) {
-                data = new Object[1];
-                data[0] = tMsgDing.getMsgName();
-                model.addRow(data);
-            }
-        } else {
-            List tMsgSmsList = msgSmsMapper.selectByMsgType(msgType);
-            for (TMsgSms tMsgSms : tMsgSmsList) {
-                data = new Object[1];
-                data[0] = tMsgSms.getMsgName();
-                model.addRow(data);
-            }
+        switch (msgType) {
+            case MessageTypeEnum.KEFU_CODE:
+                List tMsgKefuList = msgKefuMapper.selectByMsgType(msgType);
+                for (TMsgKefu tMsgKefu : tMsgKefuList) {
+                    data = new Object[1];
+                    data[0] = tMsgKefu.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            case MessageTypeEnum.KEFU_PRIORITY_CODE:
+                List tMsgKefuPriorityList = msgKefuPriorityMapper.selectByMsgType(msgType);
+                for (TMsgKefuPriority tMsgKefuPriority : tMsgKefuPriorityList) {
+                    data = new Object[1];
+                    data[0] = tMsgKefuPriority.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            case MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE:
+                List tMsgWxUniformList = wxUniformMapper.selectByMsgType(msgType);
+                for (TMsgWxUniform tMsgWxUniform : tMsgWxUniformList) {
+                    data = new Object[1];
+                    data[0] = tMsgWxUniform.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            case MessageTypeEnum.MA_TEMPLATE_CODE:
+                List tMsgMaTemplateList = msgMaTemplateMapper.selectByMsgType(msgType);
+                for (TMsgMaTemplate tMsgMaTemplate : tMsgMaTemplateList) {
+                    data = new Object[1];
+                    data[0] = tMsgMaTemplate.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            case MessageTypeEnum.MA_SUBSCRIBE_CODE:
+                List tMsgMaSubscribeList = msgMaSubscribeMapper.selectByMsgType(msgType);
+                for (TMsgMaSubscribe tMsgMaSubscribe : tMsgMaSubscribeList) {
+                    data = new Object[1];
+                    data[0] = tMsgMaSubscribe.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            case MessageTypeEnum.MP_TEMPLATE_CODE:
+                List tMsgMpTemplateList = msgMpTemplateMapper.selectByMsgType(msgType);
+                for (TMsgMpTemplate tMsgMpTemplate : tMsgMpTemplateList) {
+                    data = new Object[1];
+                    data[0] = tMsgMpTemplate.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            case MessageTypeEnum.EMAIL_CODE:
+                List tMsgMailList = msgMailMapper.selectByMsgType(msgType);
+                for (TMsgMail tMsgMail : tMsgMailList) {
+                    data = new Object[1];
+                    data[0] = tMsgMail.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            case MessageTypeEnum.WX_CP_CODE:
+                List tMsgWxCpList = msgWxCpMapper.selectByMsgType(msgType);
+                for (TMsgWxCp tMsgWxCp : tMsgWxCpList) {
+                    data = new Object[1];
+                    data[0] = tMsgWxCp.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            case MessageTypeEnum.HTTP_CODE:
+                List tMsgHttpList = msgHttpMapper.selectByMsgType(msgType);
+                for (TMsgHttp tMsgHttp : tMsgHttpList) {
+                    data = new Object[1];
+                    data[0] = tMsgHttp.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            case MessageTypeEnum.DING_CODE:
+                List tMsgDingList = msgDingMapper.selectByMsgType(msgType);
+                for (TMsgDing tMsgDing : tMsgDingList) {
+                    data = new Object[1];
+                    data[0] = tMsgDing.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+            default:
+                List tMsgSmsList = msgSmsMapper.selectByMsgType(msgType);
+                for (TMsgSms tMsgSms : tMsgSmsList) {
+                    data = new Object[1];
+                    data[0] = tMsgSms.getMsgName();
+                    model.addRow(data);
+                }
+                break;
+        }
+    }
+
+
+    /**
+     * 初始化多账号切换
+     */
+    public static void initSwitchMultiAccount() {
+        messageManageForm = getInstance();
+        int msgType = App.config.getMsgType();
+        messageManageForm.getAccountSwitchComboBox().removeAllItems();
+
+        switch (msgType) {
+            case MessageTypeEnum.MP_TEMPLATE_CODE:
+            case MessageTypeEnum.KEFU_CODE:
+            case MessageTypeEnum.KEFU_PRIORITY_CODE:
+                // 多账号切换-公众号
+                List wxAccountList = wxAccountMapper.selectByAccountType(UiConsts.WX_ACCOUNT_TYPE_MP);
+                for (TWxAccount tWxAccount : wxAccountList) {
+                    messageManageForm.getAccountSwitchComboBox().addItem(tWxAccount.getAccountName());
+                }
+                messageManageForm.getAccountSwitchComboBox().setSelectedItem(App.config.getWechatMpName());
+                break;
+
+            case MessageTypeEnum.MA_SUBSCRIBE_CODE:
+            case MessageTypeEnum.MA_TEMPLATE_CODE:
+            case MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE:
+                // 多账号切换-小程序
+                wxAccountList = wxAccountMapper.selectByAccountType(UiConsts.WX_ACCOUNT_TYPE_MA);
+                for (TWxAccount tWxAccount : wxAccountList) {
+                    messageManageForm.getAccountSwitchComboBox().addItem(tWxAccount.getAccountName());
+                }
+                messageManageForm.getAccountSwitchComboBox().setSelectedItem(App.config.getMiniAppName());
+                break;
+            default:
+                break;
         }
     }
 
@@ -190,13 +246,13 @@ public static void init() {
         final JPanel panel1 = new JPanel();
         panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
         messageManagePanel = new JPanel();
-        messageManagePanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
+        messageManagePanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
         messageManagePanel.setMaximumSize(new Dimension(-1, -1));
         messageManagePanel.setMinimumSize(new Dimension(-1, -1));
         messageManagePanel.setPreferredSize(new Dimension(280, -1));
         panel1.add(messageManagePanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
         final JScrollPane scrollPane1 = new JScrollPane();
-        messageManagePanel.add(scrollPane1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
+        messageManagePanel.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
         msgHistable = new JTable();
         msgHistable.setGridColor(new Color(-12236470));
         msgHistable.setRowHeight(36);
@@ -204,7 +260,7 @@ public static void init() {
         scrollPane1.setViewportView(msgHistable);
         final JPanel panel2 = new JPanel();
         panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 5, 5, 0), -1, -1));
-        messageManagePanel.add(panel2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        messageManagePanel.add(panel2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
         msgHisTableDeleteButton = new JButton();
         msgHisTableDeleteButton.setIcon(new ImageIcon(getClass().getResource("/icon/remove.png")));
         msgHisTableDeleteButton.setText("删除");
@@ -216,5 +272,10 @@ public static void init() {
         createMsgButton.setIcon(new ImageIcon(getClass().getResource("/icon/add.png")));
         createMsgButton.setText("新建");
         panel2.add(createMsgButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JPanel panel3 = new JPanel();
+        panel3.setLayout(new GridLayoutManager(1, 1, new Insets(5, 0, 0, 0), -1, -1));
+        messageManagePanel.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        accountSwitchComboBox = new JComboBox();
+        panel3.add(accountSwitchComboBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
     }
 }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java
index 5d04dbdb..6a85c405 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/SettingForm.java
@@ -3,6 +3,7 @@
 import com.fangxuele.tool.push.App;
 import com.fangxuele.tool.push.dao.TWxAccountMapper;
 import com.fangxuele.tool.push.domain.TWxAccount;
+import com.fangxuele.tool.push.ui.UiConsts;
 import com.fangxuele.tool.push.util.MybatisUtil;
 import com.fangxuele.tool.push.util.UndoUtil;
 import com.intellij.uiDesigner.core.GridConstraints;
@@ -129,16 +130,6 @@ public class SettingForm {
     private static SettingForm settingForm;
     private static TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class);
 
-    /**
-     * 多账号切换账号类型:公众号
-     */
-    public static final String WX_ACCOUNT_TYPE_MP = "mp";
-
-    /**
-     * 多账号切换账号类型:小程序
-     */
-    public static final String WX_ACCOUNT_TYPE_MA = "ma";
-
     private SettingForm() {
         UndoUtil.register(this);
     }
@@ -291,14 +282,14 @@ public static void initSwitchMultiAccount() {
 
         // 多账号切换-公众号
         settingForm.getMpAccountSwitchComboBox().removeAllItems();
-        List wxAccountList = wxAccountMapper.selectByAccountType(WX_ACCOUNT_TYPE_MP);
+        List wxAccountList = wxAccountMapper.selectByAccountType(UiConsts.WX_ACCOUNT_TYPE_MP);
         for (TWxAccount tWxAccount : wxAccountList) {
             settingForm.getMpAccountSwitchComboBox().addItem(tWxAccount.getAccountName());
         }
         settingForm.getMpAccountSwitchComboBox().setSelectedItem(App.config.getWechatMpName());
         // 多账号切换-小程序
         settingForm.getMaAccountSwitchComboBox().removeAllItems();
-        wxAccountList = wxAccountMapper.selectByAccountType(WX_ACCOUNT_TYPE_MA);
+        wxAccountList = wxAccountMapper.selectByAccountType(UiConsts.WX_ACCOUNT_TYPE_MA);
         for (TWxAccount tWxAccount : wxAccountList) {
             settingForm.getMaAccountSwitchComboBox().addItem(tWxAccount.getAccountName());
         }
diff --git a/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java b/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java
index 96acec84..ab048054 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java
@@ -9,8 +9,8 @@
 import com.fangxuele.tool.push.ui.listener.HelpListener;
 import com.fangxuele.tool.push.ui.listener.MemberListener;
 import com.fangxuele.tool.push.ui.listener.MessageTypeListener;
-import com.fangxuele.tool.push.ui.listener.MsgEditListener;
-import com.fangxuele.tool.push.ui.listener.MsgManageListener;
+import com.fangxuele.tool.push.ui.listener.MessageEditListener;
+import com.fangxuele.tool.push.ui.listener.MessageManageListener;
 import com.fangxuele.tool.push.ui.listener.PushHisListener;
 import com.fangxuele.tool.push.ui.listener.PushListener;
 import com.fangxuele.tool.push.ui.listener.ScheduleListener;
@@ -70,8 +70,8 @@ public void addListeners() {
         ThreadUtil.execute(HelpListener::addListeners);
         ThreadUtil.execute(PushHisListener::addListeners);
         ThreadUtil.execute(SettingListener::addListeners);
-        ThreadUtil.execute(MsgEditListener::addListeners);
-        ThreadUtil.execute(MsgManageListener::addListeners);
+        ThreadUtil.execute(MessageEditListener::addListeners);
+        ThreadUtil.execute(MessageManageListener::addListeners);
         ThreadUtil.execute(MemberListener::addListeners);
         ThreadUtil.execute(PushListener::addListeners);
         ThreadUtil.execute(BoostListener::addListeners);
diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java
similarity index 99%
rename from src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java
rename to src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java
index d629aafb..13d099e1 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java
@@ -33,7 +33,7 @@
  * @author RememBerBer
  * @since 2017/6/18.
  */
-public class MsgEditListener {
+public class MessageEditListener {
     private static final Log logger = LogFactory.get();
 
     public static void addListeners() {
diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MsgManageListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java
similarity index 85%
rename from src/main/java/com/fangxuele/tool/push/ui/listener/MsgManageListener.java
rename to src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java
index fa98d6bb..de3951cb 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/listener/MsgManageListener.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java
@@ -15,18 +15,22 @@
 import com.fangxuele.tool.push.dao.TMsgSmsMapper;
 import com.fangxuele.tool.push.dao.TMsgWxCpMapper;
 import com.fangxuele.tool.push.dao.TMsgWxUniformMapper;
+import com.fangxuele.tool.push.domain.TWxAccount;
 import com.fangxuele.tool.push.logic.MessageTypeEnum;
 import com.fangxuele.tool.push.ui.form.MainWindow;
 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.PushHisForm;
+import com.fangxuele.tool.push.ui.form.SettingForm;
 import com.fangxuele.tool.push.util.MybatisUtil;
 
 import javax.swing.*;
 import javax.swing.table.DefaultTableModel;
+import java.awt.event.ItemEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import java.util.List;
 
 /**
  * 
@@ -36,7 +40,7 @@
  * @author RememBerBer
  * @since 2017/6/18.
  */
-public class MsgManageListener {
+public class MessageManageListener {
     private static final Log logger = LogFactory.get();
 
     private static TMsgKefuMapper msgKefuMapper = MybatisUtil.getSqlSession().getMapper(TMsgKefuMapper.class);
@@ -133,5 +137,22 @@ public void mousePressed(MouseEvent e) {
             MessageEditForm.getInstance().getMsgNameField().setText("");
             MessageEditForm.getInstance().getMsgNameField().grabFocus();
         });
+
+
+        // 切换账号事件
+        MessageManageForm.getInstance().getAccountSwitchComboBox().addItemListener(e -> {
+            if (e.getStateChange() == ItemEvent.SELECTED) {
+                String accountName = e.getItem().toString();
+//                List wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(SettingForm.WX_ACCOUNT_TYPE_MP, accountName);
+//                if (wxAccountList.size() > 0) {
+//                    TWxAccount tWxAccount = wxAccountList.get(0);
+//                    settingForm.getMpAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName());
+//                    settingForm.getWechatAppIdTextField().setText(tWxAccount.getAppId());
+//                    settingForm.getWechatAppSecretPasswordField().setText(tWxAccount.getAppSecret());
+//                    settingForm.getWechatTokenPasswordField().setText(tWxAccount.getToken());
+//                    settingForm.getWechatAesKeyPasswordField().setText(tWxAccount.getAesKey());
+//                }
+            }
+        });
     }
 }
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java
index e4ea396e..25ef12b8 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java
@@ -96,14 +96,14 @@ public static void addListeners() {
                 App.config.save();
 
                 boolean update = false;
-                List tWxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(SettingForm.WX_ACCOUNT_TYPE_MP, accountName);
+                List tWxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MP, accountName);
                 if (tWxAccountList.size() > 0) {
                     update = true;
                 }
 
                 TWxAccount tWxAccount = new TWxAccount();
                 String now = SqliteUtil.nowDateForSqlite();
-                tWxAccount.setAccountType(SettingForm.WX_ACCOUNT_TYPE_MP);
+                tWxAccount.setAccountType(UiConsts.WX_ACCOUNT_TYPE_MP);
                 tWxAccount.setAccountName(accountName);
                 tWxAccount.setAppId(App.config.getWechatAppId());
                 tWxAccount.setAppSecret(App.config.getWechatAppSecret());
@@ -133,7 +133,7 @@ public static void addListeners() {
         // 设置-公众号-多账号管理
         settingForm.getMpAccountManageButton().addActionListener(e -> {
             SwitchWxAccountDialog dialog = new SwitchWxAccountDialog();
-            wxAccountType = SettingForm.WX_ACCOUNT_TYPE_MP;
+            wxAccountType = UiConsts.WX_ACCOUNT_TYPE_MP;
             dialog.renderTable();
             dialog.pack();
             dialog.setVisible(true);
@@ -143,7 +143,7 @@ public static void addListeners() {
         settingForm.getMpAccountSwitchComboBox().addItemListener(e -> {
             if (e.getStateChange() == ItemEvent.SELECTED) {
                 String accountName = e.getItem().toString();
-                List wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(SettingForm.WX_ACCOUNT_TYPE_MP, accountName);
+                List wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MP, accountName);
                 if (wxAccountList.size() > 0) {
                     TWxAccount tWxAccount = wxAccountList.get(0);
                     settingForm.getMpAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName());
@@ -178,14 +178,14 @@ public static void addListeners() {
                 App.config.save();
 
                 boolean update = false;
-                List tWxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(SettingForm.WX_ACCOUNT_TYPE_MA, accountName);
+                List tWxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MA, accountName);
                 if (tWxAccountList.size() > 0) {
                     update = true;
                 }
 
                 TWxAccount tWxAccount = new TWxAccount();
                 String now = SqliteUtil.nowDateForSqlite();
-                tWxAccount.setAccountType(SettingForm.WX_ACCOUNT_TYPE_MA);
+                tWxAccount.setAccountType(UiConsts.WX_ACCOUNT_TYPE_MA);
                 tWxAccount.setAccountName(accountName);
                 tWxAccount.setAppId(App.config.getMiniAppAppId());
                 tWxAccount.setAppSecret(App.config.getMiniAppAppSecret());
@@ -215,7 +215,7 @@ public static void addListeners() {
         // 设置-小程序-多账号管理
         settingForm.getMaAccountManageButton().addActionListener(e -> {
             SwitchWxAccountDialog dialog = new SwitchWxAccountDialog();
-            wxAccountType = SettingForm.WX_ACCOUNT_TYPE_MA;
+            wxAccountType = UiConsts.WX_ACCOUNT_TYPE_MA;
             dialog.renderTable();
             dialog.pack();
             dialog.setVisible(true);
@@ -225,7 +225,7 @@ public static void addListeners() {
         settingForm.getMaAccountSwitchComboBox().addItemListener(e -> {
             if (e.getStateChange() == ItemEvent.SELECTED) {
                 String accountName = e.getItem().toString();
-                List wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(SettingForm.WX_ACCOUNT_TYPE_MA, accountName);
+                List wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MA, accountName);
                 if (wxAccountList.size() > 0) {
                     TWxAccount tWxAccount = wxAccountList.get(0);
                     settingForm.getMaAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName());
diff --git a/src/main/java/com/fangxuele/tool/push/util/UpgradeUtil.java b/src/main/java/com/fangxuele/tool/push/util/UpgradeUtil.java
index a40fba23..f79bb64c 100644
--- a/src/main/java/com/fangxuele/tool/push/util/UpgradeUtil.java
+++ b/src/main/java/com/fangxuele/tool/push/util/UpgradeUtil.java
@@ -159,14 +159,14 @@ private static void upgrade(int versionIndex) {
                 TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class);
                 if (StringUtils.isNotBlank(App.config.getWechatAppId())) {
                     boolean update = false;
-                    List tWxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(SettingForm.WX_ACCOUNT_TYPE_MP, accountName);
+                    List tWxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MP, accountName);
                     if (tWxAccountList.size() > 0) {
                         update = true;
                     }
 
                     TWxAccount tWxAccount = new TWxAccount();
                     String now = SqliteUtil.nowDateForSqlite();
-                    tWxAccount.setAccountType(SettingForm.WX_ACCOUNT_TYPE_MP);
+                    tWxAccount.setAccountType(UiConsts.WX_ACCOUNT_TYPE_MP);
                     tWxAccount.setAccountName(accountName);
                     tWxAccount.setAppId(App.config.getWechatAppId());
                     tWxAccount.setAppSecret(App.config.getWechatAppSecret());
@@ -185,14 +185,14 @@ private static void upgrade(int versionIndex) {
                 }
                 if (StringUtils.isNotBlank(App.config.getMiniAppAppId())) {
                     boolean update = false;
-                    List tWxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(SettingForm.WX_ACCOUNT_TYPE_MA, accountName);
+                    List tWxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MA, accountName);
                     if (tWxAccountList.size() > 0) {
                         update = true;
                     }
 
                     TWxAccount tWxAccount = new TWxAccount();
                     String now = SqliteUtil.nowDateForSqlite();
-                    tWxAccount.setAccountType(SettingForm.WX_ACCOUNT_TYPE_MA);
+                    tWxAccount.setAccountType(UiConsts.WX_ACCOUNT_TYPE_MA);
                     tWxAccount.setAccountName(accountName);
                     tWxAccount.setAppId(App.config.getMiniAppAppId());
                     tWxAccount.setAppSecret(App.config.getMiniAppAppSecret());

From 5a2a383372744761ab79d6f0c8680366f87c8173 Mon Sep 17 00:00:00 2001
From: zhoubo58 
Date: Fri, 4 Dec 2020 15:11:51 +0800
Subject: [PATCH 14/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?=
 =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?=
 =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../ui/listener/MessageManageListener.java    | 50 +++++++++++++++----
 1 file changed, 40 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java
index de3951cb..04fba388 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java
@@ -15,8 +15,10 @@
 import com.fangxuele.tool.push.dao.TMsgSmsMapper;
 import com.fangxuele.tool.push.dao.TMsgWxCpMapper;
 import com.fangxuele.tool.push.dao.TMsgWxUniformMapper;
+import com.fangxuele.tool.push.dao.TWxAccountMapper;
 import com.fangxuele.tool.push.domain.TWxAccount;
 import com.fangxuele.tool.push.logic.MessageTypeEnum;
+import com.fangxuele.tool.push.ui.UiConsts;
 import com.fangxuele.tool.push.ui.form.MainWindow;
 import com.fangxuele.tool.push.ui.form.MessageEditForm;
 import com.fangxuele.tool.push.ui.form.MessageManageForm;
@@ -54,6 +56,7 @@ public class MessageManageListener {
     private static TMsgHttpMapper msgHttpMapper = MybatisUtil.getSqlSession().getMapper(TMsgHttpMapper.class);
     private static TMsgWxCpMapper msgWxCpMapper = MybatisUtil.getSqlSession().getMapper(TMsgWxCpMapper.class);
     private static TMsgDingMapper msgDingMapper = MybatisUtil.getSqlSession().getMapper(TMsgDingMapper.class);
+    private static TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class);
 
     public static void addListeners() {
         JTable msgHistable = MessageManageForm.getInstance().getMsgHistable();
@@ -138,20 +141,47 @@ public void mousePressed(MouseEvent e) {
             MessageEditForm.getInstance().getMsgNameField().grabFocus();
         });
 
-
         // 切换账号事件
         MessageManageForm.getInstance().getAccountSwitchComboBox().addItemListener(e -> {
             if (e.getStateChange() == ItemEvent.SELECTED) {
                 String accountName = e.getItem().toString();
-//                List wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(SettingForm.WX_ACCOUNT_TYPE_MP, accountName);
-//                if (wxAccountList.size() > 0) {
-//                    TWxAccount tWxAccount = wxAccountList.get(0);
-//                    settingForm.getMpAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName());
-//                    settingForm.getWechatAppIdTextField().setText(tWxAccount.getAppId());
-//                    settingForm.getWechatAppSecretPasswordField().setText(tWxAccount.getAppSecret());
-//                    settingForm.getWechatTokenPasswordField().setText(tWxAccount.getToken());
-//                    settingForm.getWechatAesKeyPasswordField().setText(tWxAccount.getAesKey());
-//                }
+
+                int msgType = App.config.getMsgType();
+                SettingForm settingForm = SettingForm.getInstance();
+
+                switch (msgType) {
+                    case MessageTypeEnum.MP_TEMPLATE_CODE:
+                    case MessageTypeEnum.KEFU_CODE:
+                    case MessageTypeEnum.KEFU_PRIORITY_CODE:
+                        // 多账号切换-公众号
+                        List wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MP, accountName);
+                        if (wxAccountList.size() > 0) {
+                            TWxAccount tWxAccount = wxAccountList.get(0);
+                            settingForm.getMpAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName());
+                            settingForm.getWechatAppIdTextField().setText(tWxAccount.getAppId());
+                            settingForm.getWechatAppSecretPasswordField().setText(tWxAccount.getAppSecret());
+                            settingForm.getWechatTokenPasswordField().setText(tWxAccount.getToken());
+                            settingForm.getWechatAesKeyPasswordField().setText(tWxAccount.getAesKey());
+                        }
+                        break;
+
+                    case MessageTypeEnum.MA_SUBSCRIBE_CODE:
+                    case MessageTypeEnum.MA_TEMPLATE_CODE:
+                    case MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE:
+                        // 多账号切换-小程序
+                        wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MA, accountName);
+                        if (wxAccountList.size() > 0) {
+                            TWxAccount tWxAccount = wxAccountList.get(0);
+                            settingForm.getMaAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName());
+                            settingForm.getMiniAppAppIdTextField().setText(tWxAccount.getAppId());
+                            settingForm.getMiniAppAppSecretPasswordField().setText(tWxAccount.getAppSecret());
+                            settingForm.getMiniAppTokenPasswordField().setText(tWxAccount.getToken());
+                            settingForm.getMiniAppAesKeyPasswordField().setText(tWxAccount.getAesKey());
+                        }
+                        break;
+                    default:
+                        break;
+                }
             }
         });
     }

From ede493203eb95476b919761a04bd5f1918f48efc Mon Sep 17 00:00:00 2001
From: zhoubo58 
Date: Fri, 4 Dec 2020 18:30:35 +0800
Subject: [PATCH 15/29] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E7=9B=B8=E5=85=B3=E8=A1=A8=E5=A2=9E=E5=8A=A0=E9=A2=84?=
 =?UTF-8?q?=E7=95=99=E7=94=A8=E6=88=B7=E5=AD=97=E6=AE=B5=E5=92=8C=E5=BE=AE?=
 =?UTF-8?q?=E4=BF=A1=E8=B4=A6=E6=88=B7id=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../fangxuele/tool/push/domain/TMsgDing.java  | 20 +++++--
 .../fangxuele/tool/push/domain/TMsgHttp.java  | 20 +++++--
 .../fangxuele/tool/push/domain/TMsgKefu.java  | 20 +++++++
 .../tool/push/domain/TMsgKefuPriority.java    | 20 +++++++
 .../tool/push/domain/TMsgMaSubscribe.java     | 20 +++++++
 .../tool/push/domain/TMsgMaTemplate.java      | 20 +++++++
 .../fangxuele/tool/push/domain/TMsgMail.java  | 20 +++++--
 .../tool/push/domain/TMsgMpTemplate.java      | 20 +++++++
 .../fangxuele/tool/push/domain/TMsgSms.java   | 10 ++++
 .../fangxuele/tool/push/domain/TMsgWxCp.java  | 20 +++++--
 .../tool/push/domain/TMsgWxUniform.java       | 20 +++++++
 src/main/resources/generatorConfig.xml        |  6 +--
 src/main/resources/mapper/TMsgDingMapper.xml  | 52 +++++++++++--------
 src/main/resources/mapper/TMsgHttpMapper.xml  | 43 ++++++++++-----
 src/main/resources/mapper/TMsgKefuMapper.xml  | 36 +++++++++++--
 .../mapper/TMsgKefuPriorityMapper.xml         | 35 +++++++++++--
 .../mapper/TMsgMaSubscribeMapper.xml          | 31 +++++++++--
 .../resources/mapper/TMsgMaTemplateMapper.xml | 34 ++++++++++--
 src/main/resources/mapper/TMsgMailMapper.xml  | 41 ++++++++++-----
 .../resources/mapper/TMsgMpTemplateMapper.xml | 34 ++++++++++--
 src/main/resources/mapper/TMsgSmsMapper.xml   | 20 +++++--
 src/main/resources/mapper/TMsgWxCpMapper.xml  | 43 +++++++++------
 .../resources/mapper/TMsgWxUniformMapper.xml  | 32 ++++++++++--
 src/main/resources/upgrade/41.sql             | 34 ++++++++++++
 24 files changed, 533 insertions(+), 118 deletions(-)
 create mode 100644 src/main/resources/upgrade/41.sql

diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java
index 7944ec82..411a7edf 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java
@@ -9,6 +9,8 @@ public class TMsgDing implements Serializable {
 
     private String msgName;
 
+    private String radioType;
+
     private String dingMsgType;
 
     private String agentId;
@@ -21,7 +23,7 @@ public class TMsgDing implements Serializable {
 
     private String modifiedTime;
 
-    private String radioType;
+    private String previewUser;
 
     private static final long serialVersionUID = 1L;
 
@@ -49,6 +51,14 @@ public void setMsgName(String msgName) {
         this.msgName = msgName == null ? null : msgName.trim();
     }
 
+    public String getRadioType() {
+        return radioType;
+    }
+
+    public void setRadioType(String radioType) {
+        this.radioType = radioType == null ? null : radioType.trim();
+    }
+
     public String getDingMsgType() {
         return dingMsgType;
     }
@@ -97,11 +107,11 @@ public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
 
-    public String getRadioType() {
-        return radioType;
+    public String getPreviewUser() {
+        return previewUser;
     }
 
-    public void setRadioType(String radioType) {
-        this.radioType = radioType == null ? null : radioType.trim();
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
     }
 }
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgHttp.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgHttp.java
index 5624365e..b6d4a550 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgHttp.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgHttp.java
@@ -21,11 +21,13 @@ public class TMsgHttp implements Serializable {
 
     private String body;
 
+    private String bodyType;
+
     private String createTime;
 
     private String modifiedTime;
 
-    private String bodyType;
+    private String previewUser;
 
     private static final long serialVersionUID = 1L;
 
@@ -101,6 +103,14 @@ public void setBody(String body) {
         this.body = body == null ? null : body.trim();
     }
 
+    public String getBodyType() {
+        return bodyType;
+    }
+
+    public void setBodyType(String bodyType) {
+        this.bodyType = bodyType == null ? null : bodyType.trim();
+    }
+
     public String getCreateTime() {
         return createTime;
     }
@@ -117,11 +127,11 @@ public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
 
-    public String getBodyType() {
-        return bodyType;
+    public String getPreviewUser() {
+        return previewUser;
     }
 
-    public void setBodyType(String bodyType) {
-        this.bodyType = bodyType == null ? null : bodyType.trim();
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
     }
 }
\ 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
index cdc246e3..76fe5e8c 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgKefu.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgKefu.java
@@ -25,6 +25,10 @@ public class TMsgKefu implements Serializable {
 
     private String modifiedTime;
 
+    private String previewUser;
+
+    private Integer wxAccountId;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -114,4 +118,20 @@ public String getModifiedTime() {
     public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
+
+    public String getPreviewUser() {
+        return previewUser;
+    }
+
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
+    }
+
+    public Integer getWxAccountId() {
+        return wxAccountId;
+    }
+
+    public void setWxAccountId(Integer wxAccountId) {
+        this.wxAccountId = wxAccountId;
+    }
 }
\ 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
index fa3c90a6..fa76ae22 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgKefuPriority.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgKefuPriority.java
@@ -33,6 +33,10 @@ public class TMsgKefuPriority implements Serializable {
 
     private String modifiedTime;
 
+    private String previewUser;
+
+    private Integer wxAccountId;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -154,4 +158,20 @@ public String getModifiedTime() {
     public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
+
+    public String getPreviewUser() {
+        return previewUser;
+    }
+
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
+    }
+
+    public Integer getWxAccountId() {
+        return wxAccountId;
+    }
+
+    public void setWxAccountId(Integer wxAccountId) {
+        this.wxAccountId = wxAccountId;
+    }
 }
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgMaSubscribe.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgMaSubscribe.java
index 2b8b8aff..052e414c 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgMaSubscribe.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgMaSubscribe.java
@@ -17,6 +17,10 @@ public class TMsgMaSubscribe implements Serializable {
 
     private String modifiedTime;
 
+    private String previewUser;
+
+    private Integer wxAccountId;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -74,4 +78,20 @@ public String getModifiedTime() {
     public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
+
+    public String getPreviewUser() {
+        return previewUser;
+    }
+
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
+    }
+
+    public Integer getWxAccountId() {
+        return wxAccountId;
+    }
+
+    public void setWxAccountId(Integer wxAccountId) {
+        this.wxAccountId = wxAccountId;
+    }
 }
\ 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
index 3914f85d..6875edb9 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgMaTemplate.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgMaTemplate.java
@@ -19,6 +19,10 @@ public class TMsgMaTemplate implements Serializable {
 
     private String modifiedTime;
 
+    private String previewUser;
+
+    private Integer wxAccountId;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -84,4 +88,20 @@ public String getModifiedTime() {
     public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
+
+    public String getPreviewUser() {
+        return previewUser;
+    }
+
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
+    }
+
+    public Integer getWxAccountId() {
+        return wxAccountId;
+    }
+
+    public void setWxAccountId(Integer wxAccountId) {
+        this.wxAccountId = wxAccountId;
+    }
 }
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgMail.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgMail.java
index 8fed4bf5..fe731705 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgMail.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgMail.java
@@ -11,6 +11,8 @@ public class TMsgMail implements Serializable {
 
     private String title;
 
+    private String cc;
+
     private String files;
 
     private String content;
@@ -19,7 +21,7 @@ public class TMsgMail implements Serializable {
 
     private String modifiedTime;
 
-    private String cc;
+    private String previewUser;
 
     private static final long serialVersionUID = 1L;
 
@@ -55,6 +57,14 @@ public void setTitle(String title) {
         this.title = title == null ? null : title.trim();
     }
 
+    public String getCc() {
+        return cc;
+    }
+
+    public void setCc(String cc) {
+        this.cc = cc == null ? null : cc.trim();
+    }
+
     public String getFiles() {
         return files;
     }
@@ -87,11 +97,11 @@ public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
 
-    public String getCc() {
-        return cc;
+    public String getPreviewUser() {
+        return previewUser;
     }
 
-    public void setCc(String cc) {
-        this.cc = cc == null ? null : cc.trim();
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.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
index c981b0fa..1f4368ea 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgMpTemplate.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgMpTemplate.java
@@ -21,6 +21,10 @@ public class TMsgMpTemplate implements Serializable {
 
     private String modifiedTime;
 
+    private String previewUser;
+
+    private Integer wxAccountId;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -94,4 +98,20 @@ public String getModifiedTime() {
     public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
+
+    public String getPreviewUser() {
+        return previewUser;
+    }
+
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
+    }
+
+    public Integer getWxAccountId() {
+        return wxAccountId;
+    }
+
+    public void setWxAccountId(Integer wxAccountId) {
+        this.wxAccountId = wxAccountId;
+    }
 }
\ 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
index f6c9745d..e5da455f 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgSms.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgSms.java
@@ -17,6 +17,8 @@ public class TMsgSms implements Serializable {
 
     private String modifiedTime;
 
+    private String previewUser;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -74,4 +76,12 @@ public String getModifiedTime() {
     public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
+
+    public String getPreviewUser() {
+        return previewUser;
+    }
+
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
+    }
 }
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgWxCp.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgWxCp.java
index 378fb471..fac0c0e5 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgWxCp.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgWxCp.java
@@ -23,11 +23,13 @@ public class TMsgWxCp implements Serializable {
 
     private String url;
 
+    private String btnTxt;
+
     private String createTime;
 
     private String modifiedTime;
 
-    private String btnTxt;
+    private String previewUser;
 
     private static final long serialVersionUID = 1L;
 
@@ -111,6 +113,14 @@ public void setUrl(String url) {
         this.url = url == null ? null : url.trim();
     }
 
+    public String getBtnTxt() {
+        return btnTxt;
+    }
+
+    public void setBtnTxt(String btnTxt) {
+        this.btnTxt = btnTxt == null ? null : btnTxt.trim();
+    }
+
     public String getCreateTime() {
         return createTime;
     }
@@ -127,11 +137,11 @@ public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
 
-    public String getBtnTxt() {
-        return btnTxt;
+    public String getPreviewUser() {
+        return previewUser;
     }
 
-    public void setBtnTxt(String btnTxt) {
-        this.btnTxt = btnTxt == null ? null : btnTxt.trim();
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
     }
 }
\ No newline at end of file
diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgWxUniform.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgWxUniform.java
index f9fa474e..7a7c21da 100644
--- a/src/main/java/com/fangxuele/tool/push/domain/TMsgWxUniform.java
+++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgWxUniform.java
@@ -27,6 +27,10 @@ public class TMsgWxUniform implements Serializable {
 
     private String modifiedTime;
 
+    private String previewUser;
+
+    private Integer wxAccountId;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -124,4 +128,20 @@ public String getModifiedTime() {
     public void setModifiedTime(String modifiedTime) {
         this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim();
     }
+
+    public String getPreviewUser() {
+        return previewUser;
+    }
+
+    public void setPreviewUser(String previewUser) {
+        this.previewUser = previewUser == null ? null : previewUser.trim();
+    }
+
+    public Integer getWxAccountId() {
+        return wxAccountId;
+    }
+
+    public void setWxAccountId(Integer wxAccountId) {
+        this.wxAccountId = wxAccountId;
+    }
 }
\ No newline at end of file
diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml
index 31178e72..19f6d563 100644
--- a/src/main/resources/generatorConfig.xml
+++ b/src/main/resources/generatorConfig.xml
@@ -4,7 +4,7 @@
         "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
 
 
-    
+    
 
     
         
@@ -17,7 +17,7 @@
         
 
         
+                        connectionURL="jdbc:sqlite:C:/Users/zhoubo9/.wepush/WePush.db">
         
 
         
@@ -45,7 +45,7 @@
 
         
+               tableName="t_msg_wx_uniform" domainObjectName="TMsgWxUniform">
             
             
         
diff --git a/src/main/resources/mapper/TMsgDingMapper.xml b/src/main/resources/mapper/TMsgDingMapper.xml index 65fd91c9..17f18303 100644 --- a/src/main/resources/mapper/TMsgDingMapper.xml +++ b/src/main/resources/mapper/TMsgDingMapper.xml @@ -5,17 +5,18 @@ + - + - id, msg_type, msg_name, ding_msg_type, agent_id, web_hook, content, create_time, - modified_time, radio_type + id, msg_type, msg_name, radio_type, ding_msg_type, agent_id, web_hook, content, create_time, + modified_time, preview_user diff --git a/src/main/resources/mapper/TMsgHttpMapper.xml b/src/main/resources/mapper/TMsgHttpMapper.xml index 4d04aa76..ef07600f 100644 --- a/src/main/resources/mapper/TMsgHttpMapper.xml +++ b/src/main/resources/mapper/TMsgHttpMapper.xml @@ -11,13 +11,14 @@ + - + - id, msg_type, msg_name, method, url, params, headers, cookies, body, create_time, - modified_time, body_type + id, msg_type, msg_name, method, url, params, headers, cookies, body, body_type, create_time, + modified_time, preview_user diff --git a/src/main/resources/mapper/TMsgKefuMapper.xml b/src/main/resources/mapper/TMsgKefuMapper.xml index 6d4be584..cbfd739a 100644 --- a/src/main/resources/mapper/TMsgKefuMapper.xml +++ b/src/main/resources/mapper/TMsgKefuMapper.xml @@ -13,10 +13,13 @@ + + - id, msg_type, msg_name, kefu_msg_type, content, title, img_url, describe, url, create_time, - modified_time + id, msg_type, msg_name, kefu_msg_type, content, title, img_url, + describe, url, create_time, + modified_time, preview_user, wx_account_id diff --git a/src/main/resources/mapper/TMsgKefuPriorityMapper.xml b/src/main/resources/mapper/TMsgKefuPriorityMapper.xml index a5fbd5f3..7026f05f 100644 --- a/src/main/resources/mapper/TMsgKefuPriorityMapper.xml +++ b/src/main/resources/mapper/TMsgKefuPriorityMapper.xml @@ -17,10 +17,14 @@ + + id, msg_type, msg_name, template_id, url, ma_appid, ma_page_path, kefu_msg_type, - content, title, img_url, describe, kefu_url, create_time, modified_time + content, title, img_url, + describe, kefu_url, create_time, modified_time, preview_user, + wx_account_id diff --git a/src/main/resources/mapper/TMsgMaSubscribeMapper.xml b/src/main/resources/mapper/TMsgMaSubscribeMapper.xml index a4d8fdca..0ece198c 100644 --- a/src/main/resources/mapper/TMsgMaSubscribeMapper.xml +++ b/src/main/resources/mapper/TMsgMaSubscribeMapper.xml @@ -9,9 +9,12 @@ + + - id, msg_type, msg_name, template_id, page, create_time, modified_time + id, msg_type, msg_name, template_id, page, create_time, modified_time, preview_user, + wx_account_id select @@ -28,10 +31,12 @@ insert into t_msg_ma_template (id, msg_type, msg_name, template_id, page, emphasis_keyword, - create_time, modified_time) + create_time, modified_time, preview_user, + wx_account_id) values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR}, #{page,jdbcType=VARCHAR}, #{emphasisKeyword,jdbcType=VARCHAR}, - #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}) + #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}, #{previewUser,jdbcType=VARCHAR}, + #{wxAccountId,jdbcType=INTEGER}) @@ -61,6 +66,12 @@ modified_time, + + preview_user, + + + wx_account_id, + @@ -87,6 +98,12 @@ #{modifiedTime,jdbcType=VARCHAR}, + + #{previewUser,jdbcType=VARCHAR}, + + + #{wxAccountId,jdbcType=INTEGER}, + @@ -113,6 +130,12 @@ modified_time = #{modifiedTime,jdbcType=VARCHAR}, + + preview_user = #{previewUser,jdbcType=VARCHAR}, + + + wx_account_id = #{wxAccountId,jdbcType=INTEGER}, + where id = #{id,jdbcType=INTEGER} @@ -123,7 +146,10 @@ template_id = #{templateId,jdbcType=VARCHAR}, page = #{page,jdbcType=VARCHAR}, emphasis_keyword = #{emphasisKeyword,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + create_time = #{createTime,jdbcType=VARCHAR}, + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR}, + wx_account_id = #{wxAccountId,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER} select @@ -28,13 +29,15 @@ insert into t_msg_mail (id, msg_type, msg_name, - title, files, content, - create_time, modified_time, Cc) + title, Cc, files, content, + create_time, modified_time, preview_user) values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR}, - #{title,jdbcType=VARCHAR}, #{files,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, - #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}, #{cc,jdbcType=VARCHAR}) + #{title,jdbcType=VARCHAR}, #{cc,jdbcType=VARCHAR}, #{files,jdbcType=VARCHAR}, + #{content,jdbcType=VARCHAR}, + #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}, #{previewUser,jdbcType=VARCHAR}) - + insert into t_msg_mail @@ -49,6 +52,9 @@ title, + + Cc, + files, @@ -61,8 +67,8 @@ modified_time, - - Cc, + + preview_user, @@ -78,6 +84,9 @@ #{title,jdbcType=VARCHAR}, + + #{cc,jdbcType=VARCHAR}, + #{files,jdbcType=VARCHAR}, @@ -90,8 +99,8 @@ #{modifiedTime,jdbcType=VARCHAR}, - - #{cc,jdbcType=VARCHAR}, + + #{previewUser,jdbcType=VARCHAR}, @@ -107,6 +116,9 @@ title = #{title,jdbcType=VARCHAR}, + + Cc = #{cc,jdbcType=VARCHAR}, + files = #{files,jdbcType=VARCHAR}, @@ -119,8 +131,8 @@ modified_time = #{modifiedTime,jdbcType=VARCHAR}, - - Cc = #{cc,jdbcType=VARCHAR}, + + preview_user = #{previewUser,jdbcType=VARCHAR}, where id = #{id,jdbcType=INTEGER} @@ -130,11 +142,12 @@ set msg_type = #{msgType,jdbcType=INTEGER}, msg_name = #{msgName,jdbcType=VARCHAR}, title = #{title,jdbcType=VARCHAR}, + Cc = #{cc,jdbcType=VARCHAR}, files = #{files,jdbcType=VARCHAR}, content = #{content,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR}, - Cc = #{cc,jdbcType=VARCHAR} + preview_user = #{previewUser,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} select @@ -29,10 +32,12 @@ insert into t_msg_mp_template (id, msg_type, msg_name, template_id, url, ma_appid, - ma_page_path, create_time, modified_time) + ma_page_path, create_time, modified_time, + preview_user, wx_account_id) values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{maAppid,jdbcType=VARCHAR}, - #{maPagePath,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}) + #{maPagePath,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}, + #{previewUser,jdbcType=VARCHAR}, #{wxAccountId,jdbcType=INTEGER}) @@ -65,6 +70,12 @@ modified_time, + + preview_user, + + + wx_account_id, + @@ -94,6 +105,12 @@ #{modifiedTime,jdbcType=VARCHAR}, + + #{previewUser,jdbcType=VARCHAR}, + + + #{wxAccountId,jdbcType=INTEGER}, + @@ -123,6 +140,12 @@ modified_time = #{modifiedTime,jdbcType=VARCHAR}, + + preview_user = #{previewUser,jdbcType=VARCHAR}, + + + wx_account_id = #{wxAccountId,jdbcType=INTEGER}, + where id = #{id,jdbcType=INTEGER} @@ -134,7 +157,10 @@ url = #{url,jdbcType=VARCHAR}, ma_appid = #{maAppid,jdbcType=VARCHAR}, ma_page_path = #{maPagePath,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + create_time = #{createTime,jdbcType=VARCHAR}, + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR}, + wx_account_id = #{wxAccountId,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER} select @@ -27,10 +28,10 @@ insert into t_msg_sms (id, msg_type, msg_name, template_id, content, create_time, - modified_time) + modified_time, preview_user) values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR}, #{templateId,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, - #{modifiedTime,jdbcType=VARCHAR}) + #{modifiedTime,jdbcType=VARCHAR}, #{previewUser,jdbcType=VARCHAR}) @@ -57,6 +58,9 @@ modified_time, + + preview_user, + @@ -80,6 +84,9 @@ #{modifiedTime,jdbcType=VARCHAR}, + + #{previewUser,jdbcType=VARCHAR}, + @@ -103,6 +110,9 @@ modified_time = #{modifiedTime,jdbcType=VARCHAR}, + + preview_user = #{previewUser,jdbcType=VARCHAR}, + where id = #{id,jdbcType=INTEGER} @@ -112,7 +122,9 @@ msg_name = #{msgName,jdbcType=VARCHAR}, template_id = #{templateId,jdbcType=VARCHAR}, content = #{content,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + create_time = #{createTime,jdbcType=VARCHAR}, + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} select @@ -35,15 +37,16 @@ insert into t_msg_wx_cp (id, msg_type, msg_name, cp_msg_type, agent_id, content, title, img_url, describe, - url, create_time, modified_time, - btn_txt) + url, btn_txt, create_time, + modified_time, preview_user) values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR}, #{cpMsgType,jdbcType=VARCHAR}, #{agentId,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, #{describe,jdbcType=VARCHAR}, - #{url,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}, - #{btnTxt,jdbcType=VARCHAR}) + #{url,jdbcType=VARCHAR}, #{btnTxt,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, + #{modifiedTime,jdbcType=VARCHAR}, #{previewUser,jdbcType=VARCHAR}) - + insert into t_msg_wx_cp @@ -76,14 +79,17 @@ url, + + btn_txt, + create_time, modified_time, - - btn_txt, + + preview_user, @@ -117,14 +123,17 @@ #{url,jdbcType=VARCHAR}, + + #{btnTxt,jdbcType=VARCHAR}, + #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}, - - #{btnTxt,jdbcType=VARCHAR}, + + #{previewUser,jdbcType=VARCHAR}, @@ -158,14 +167,17 @@ url = #{url,jdbcType=VARCHAR}, + + btn_txt = #{btnTxt,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR}, - - btn_txt = #{btnTxt,jdbcType=VARCHAR}, + + preview_user = #{previewUser,jdbcType=VARCHAR}, where id = #{id,jdbcType=INTEGER} @@ -181,9 +193,10 @@ img_url = #{imgUrl,jdbcType=VARCHAR}, describe = #{describe,jdbcType=VARCHAR}, url = #{url,jdbcType=VARCHAR}, + btn_txt = #{btnTxt,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR}, - btn_txt = #{btnTxt,jdbcType=VARCHAR} + preview_user = #{previewUser,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} select @@ -53,11 +55,13 @@ insert into t_msg_wx_uniform (id, msg_type, msg_name, mp_template_id, ma_template_id, mp_url, ma_appid, ma_page_path, page, - emphasis_keyword, create_time, modified_time) + emphasis_keyword, create_time, modified_time, + preview_user, wx_account_id) values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR}, #{mpTemplateId,jdbcType=VARCHAR}, #{maTemplateId,jdbcType=VARCHAR}, #{mpUrl,jdbcType=VARCHAR}, #{maAppid,jdbcType=VARCHAR}, #{maPagePath,jdbcType=VARCHAR}, #{page,jdbcType=VARCHAR}, - #{emphasisKeyword,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}) + #{emphasisKeyword,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}, + #{previewUser,jdbcType=VARCHAR}, #{wxAccountId,jdbcType=INTEGER}) @@ -99,6 +103,12 @@ modified_time, + + preview_user, + + + wx_account_id, + @@ -137,6 +147,12 @@ #{modifiedTime,jdbcType=VARCHAR}, + + #{previewUser,jdbcType=VARCHAR}, + + + #{wxAccountId,jdbcType=INTEGER}, + @@ -175,6 +191,12 @@ modified_time = #{modifiedTime,jdbcType=VARCHAR}, + + preview_user = #{previewUser,jdbcType=VARCHAR}, + + + wx_account_id = #{wxAccountId,jdbcType=INTEGER}, + where id = #{id,jdbcType=INTEGER} @@ -190,7 +212,9 @@ page = #{page,jdbcType=VARCHAR}, emphasis_keyword = #{emphasisKeyword,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR}, + wx_account_id = #{wxAccountId,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER} diff --git a/src/main/resources/upgrade/41.sql b/src/main/resources/upgrade/41.sql new file mode 100644 index 00000000..a03845e5 --- /dev/null +++ b/src/main/resources/upgrade/41.sql @@ -0,0 +1,34 @@ +alter table t_msg_mp_template + add preview_user text; +alter table t_msg_mp_template + add wx_account_id int; +alter table t_msg_kefu + add preview_user text; +alter table t_msg_kefu + add wx_account_id int; +alter table t_msg_kefu_priority + add preview_user text; +alter table t_msg_kefu_priority + add wx_account_id int; +alter table t_msg_ma_subscribe + add preview_user text; +alter table t_msg_ma_subscribe + add wx_account_id int; +alter table t_msg_ma_template + add preview_user text; +alter table t_msg_ma_template + add wx_account_id int; +alter table t_msg_wx_uniform + add preview_user text; +alter table t_msg_wx_uniform + add wx_account_id int; +alter table t_msg_ding + add preview_user text; +alter table t_msg_http + add preview_user text; +alter table t_msg_mail + add preview_user text; +alter table t_msg_sms + add preview_user text; +alter table t_msg_wx_cp + add preview_user text; From 9aea7dcbf6f0bef3822ff15fbbd8176cc4b56d2d Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Fri, 4 Dec 2020 21:08:48 +0800 Subject: [PATCH 16/29] =?UTF-8?q?=E9=A2=84=E8=A7=88=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E5=AF=B9=E5=BA=94=E6=B6=88=E6=81=AF=E4=BF=9D?= =?UTF-8?q?=E5=AD=98-=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/ui/form/MessageEditForm.java | 13 ++----------- .../tool/push/ui/form/msg/AliYunMsgForm.java | 6 ++++++ .../tool/push/ui/form/msg/BdYunMsgForm.java | 5 +++++ .../tool/push/ui/form/msg/DingMsgForm.java | 7 +++++++ .../tool/push/ui/form/msg/HttpMsgForm.java | 7 +++++++ .../tool/push/ui/form/msg/HwYunMsgForm.java | 6 ++++++ .../tool/push/ui/form/msg/KefuMsgForm.java | 8 ++++++++ .../tool/push/ui/form/msg/KefuPriorityMsgForm.java | 7 +++++++ .../tool/push/ui/form/msg/MaSubscribeMsgForm.java | 7 +++++++ .../tool/push/ui/form/msg/MailMsgForm.java | 7 +++++++ .../tool/push/ui/form/msg/MpTemplateMsgForm.java | 7 +++++++ .../tool/push/ui/form/msg/QiNiuYunMsgForm.java | 6 ++++++ .../tool/push/ui/form/msg/TxYunMsgForm.java | 7 +++++++ .../tool/push/ui/form/msg/UpYunMsgForm.java | 7 +++++++ .../tool/push/ui/form/msg/WxCpMsgForm.java | 8 ++++++++ .../tool/push/ui/form/msg/WxUniformMsgForm.java | 8 ++++++++ .../tool/push/ui/form/msg/YunpianMsgForm.java | 8 ++++++++ .../tool/push/ui/listener/MessageEditListener.java | 4 ++-- .../tool/push/ui/listener/MessageTypeListener.java | 8 ++++---- .../com/fangxuele/tool/push/util/ConfigUtil.java | 10 ---------- 20 files changed, 119 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java index 45d4588f..7c430882 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java @@ -6,6 +6,7 @@ import com.fangxuele.tool.push.util.UndoUtil; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; +import com.sun.xml.internal.bind.v2.TODO; import lombok.Getter; import org.apache.commons.lang3.StringUtils; @@ -59,17 +60,7 @@ public static void init(String selectedMsgName) { messageEditForm.getMsgEditScrollPane().getVerticalScrollBar().setUnitIncrement(15); messageEditForm.getMsgEditScrollPane().getVerticalScrollBar().setDoubleBuffered(true); - String msgName; - if (StringUtils.isEmpty(selectedMsgName)) { - msgName = App.config.getMsgName(); - } else { - msgName = selectedMsgName; - } - - messageEditForm.getMsgNameField().setText(msgName); - messageEditForm.getPreviewUserField().setText(App.config.getPreviewUser()); - - MsgFormFactory.getMsgForm().init(msgName); + MsgFormFactory.getMsgForm().init(selectedMsgName); } /** diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java index 8753125e..05559673 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java @@ -1,5 +1,6 @@ package com.fangxuele.tool.push.ui.form.msg; +import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.dao.TMsgSmsMapper; import com.fangxuele.tool.push.dao.TTemplateDataMapper; import com.fangxuele.tool.push.domain.TMsgSms; @@ -96,6 +97,9 @@ public void init(String msgName) { TMsgSms tMsgSms = tMsgSmsList.get(0); msgId = tMsgSms.getId(); getInstance().getMsgTemplateIdTextField().setText(tMsgSms.getTemplateId()); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgSms.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgSms.getPreviewUser()); } initTemplateDataTable(); @@ -150,6 +154,8 @@ public void save(String msgName) { tMsgSms.setTemplateId(templateId); tMsgSms.setCreateTime(now); tMsgSms.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgSms.setPreviewUser(messageEditForm.getPreviewUserField().getText()); if (existSameMsg) { msgSmsMapper.updateByMsgTypeAndMsgName(tMsgSms); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java index 1313a4e6..eac62fae 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java @@ -97,6 +97,9 @@ public void init(String msgName) { TMsgSms tMsgSms = tMsgSmsList.get(0); msgId = tMsgSms.getId(); getInstance().getMsgTemplateIdTextField().setText(tMsgSms.getTemplateId()); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgSms.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgSms.getPreviewUser()); } initTemplateDataTable(); @@ -151,6 +154,8 @@ public void save(String msgName) { tMsgSms.setTemplateId(templateId); tMsgSms.setCreateTime(now); tMsgSms.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgSms.setPreviewUser(messageEditForm.getPreviewUserField().getText()); if (existSameMsg) { msgSmsMapper.updateByMsgTypeAndMsgName(tMsgSms); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java index 1b4f19d9..80f4595b 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -11,6 +11,7 @@ import com.fangxuele.tool.push.ui.dialog.CommonTipsDialog; import com.fangxuele.tool.push.ui.dialog.DingAppDialog; import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.ui.form.MessageEditForm; import com.fangxuele.tool.push.util.MybatisUtil; import com.fangxuele.tool.push.util.SqliteUtil; import com.google.common.collect.Maps; @@ -156,6 +157,10 @@ public void init(String msgName) { switchDingMsgType(dingMsgType); switchRadio(tMsgDing.getRadioType()); + + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgDing.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgDing.getPreviewUser()); } else { switchDingMsgType("文本消息"); } @@ -210,6 +215,8 @@ public void save(String msgName) { tMsgDing.setContent(JSONUtil.toJsonStr(dingMsg)); tMsgDing.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgDing.setPreviewUser(messageEditForm.getPreviewUserField().getText()); if (getInstance().getWorkRadioButton().isSelected()) { tMsgDing.setRadioType("work"); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/HttpMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/HttpMsgForm.java index a663a74a..fc77688e 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/HttpMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/HttpMsgForm.java @@ -7,6 +7,7 @@ import com.fangxuele.tool.push.logic.MessageTypeEnum; import com.fangxuele.tool.push.ui.component.TableInCellButtonColumn; import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.ui.form.MessageEditForm; import com.fangxuele.tool.push.util.MybatisUtil; import com.fangxuele.tool.push.util.SqliteUtil; import com.intellij.uiDesigner.core.GridConstraints; @@ -185,6 +186,10 @@ public void init(String msgName) { getInstance().getBodyTypeComboBox().setSelectedItem(tMsgHttp.getBodyType()); switchMethod(tMsgHttp.getMethod()); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgHttp.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgHttp.getPreviewUser()); + // Params===================================== initParamTable(); List params = JSONUtil.toList(JSONUtil.parseArray(tMsgHttp.getParams()), NameValueObject.class); @@ -285,6 +290,8 @@ public void save(String msgName) { tMsgHttp.setBodyType(bodyType); tMsgHttp.setCreateTime(now); tMsgHttp.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgHttp.setPreviewUser(messageEditForm.getPreviewUserField().getText()); // =============params // 如果table为空,则初始化 diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java index 02ee475f..8bb79021 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java @@ -97,6 +97,10 @@ public void init(String msgName) { TMsgSms tMsgSms = tMsgSmsList.get(0); msgId = tMsgSms.getId(); getInstance().getMsgTemplateIdTextField().setText(tMsgSms.getTemplateId()); + + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgSms.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgSms.getPreviewUser()); } initTemplateDataTable(); @@ -151,6 +155,8 @@ public void save(String msgName) { tMsgSms.setTemplateId(templateId); tMsgSms.setCreateTime(now); tMsgSms.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgSms.setPreviewUser(messageEditForm.getPreviewUserField().getText()); if (existSameMsg) { msgSmsMapper.updateByMsgTypeAndMsgName(tMsgSms); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java index 547f0c2f..a27abf83 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java @@ -4,6 +4,7 @@ import com.fangxuele.tool.push.domain.TMsgKefu; import com.fangxuele.tool.push.logic.MessageTypeEnum; import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.ui.form.MessageEditForm; import com.fangxuele.tool.push.util.MybatisUtil; import com.fangxuele.tool.push.util.SqliteUtil; import com.intellij.uiDesigner.core.GridConstraints; @@ -76,6 +77,10 @@ public void init(String msgName) { getInstance().getMsgKefuUrlTextField().setText(tMsgKefu.getUrl()); switchKefuMsgType(kefuMsgType); + + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgKefu.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgKefu.getPreviewUser()); } else { switchKefuMsgType("图文消息"); } @@ -118,6 +123,9 @@ public void save(String msgName) { tMsgKefu.setUrl(kefuUrl); tMsgKefu.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgKefu.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + if (existSameMsg) { msgKefuMapper.updateByMsgTypeAndMsgName(tMsgKefu); } else { diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuPriorityMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuPriorityMsgForm.java index f18a7836..e3b4f688 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuPriorityMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuPriorityMsgForm.java @@ -7,6 +7,7 @@ import com.fangxuele.tool.push.logic.MessageTypeEnum; import com.fangxuele.tool.push.ui.component.TableInCellButtonColumn; import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.ui.form.MessageEditForm; import com.fangxuele.tool.push.util.MybatisUtil; import com.fangxuele.tool.push.util.SqliteUtil; @@ -43,6 +44,10 @@ public void init(String msgName) { MpTemplateMsgForm.getInstance().getMsgTemplateMiniAppidTextField().setText(tMsgKefuPriority.getMaAppid()); MpTemplateMsgForm.getInstance().getMsgTemplateMiniPagePathTextField().setText(tMsgKefuPriority.getMaPagePath()); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgKefuPriority.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgKefuPriority.getPreviewUser()); + String kefuMsgType = tMsgKefuPriority.getKefuMsgType(); KefuMsgForm.getInstance().getMsgKefuMsgTypeComboBox().setSelectedItem(kefuMsgType); if ("文本消息".equals(kefuMsgType)) { @@ -133,6 +138,8 @@ public void save(String msgName) { tMsgKefuPriority.setKefuUrl(kefuUrl); tMsgKefuPriority.setCreateTime(now); tMsgKefuPriority.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgKefuPriority.setPreviewUser(messageEditForm.getPreviewUserField().getText()); if (existSameMsg) { msgKefuPriorityMapper.updateByMsgTypeAndMsgName(tMsgKefuPriority); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java index 4aa4d737..e171e1b9 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java @@ -108,6 +108,10 @@ public void init(String msgName) { msgId = tMsgMaSubscribe.getId(); getInstance().getMsgTemplateIdTextField().setText(tMsgMaSubscribe.getTemplateId()); getInstance().getMsgTemplateUrlTextField().setText(tMsgMaSubscribe.getPage()); + + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgMaSubscribe.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgMaSubscribe.getPreviewUser()); } initTemplateDataTable(); @@ -166,6 +170,9 @@ public void save(String msgName) { tMsgMaSubscribe.setCreateTime(now); tMsgMaSubscribe.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgMaSubscribe.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + if (existSameMsg) { msgMaSubscribeMapper.updateByMsgTypeAndMsgName(tMsgMaSubscribe); } else { diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MailMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MailMsgForm.java index 9a586518..5506ac72 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MailMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MailMsgForm.java @@ -89,6 +89,10 @@ public void init(String msgName) { getInstance().getMailCcTextField().setText(tMsgMail.getCc()); getInstance().getMailFilesTextField().setText(tMsgMail.getFiles()); getInstance().getMailContentPane().setText(tMsgMail.getContent()); + + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgMail.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgMail.getPreviewUser()); } } @@ -125,6 +129,9 @@ public void save(String msgName) { tMsgMail.setCreateTime(now); tMsgMail.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgMail.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + if (existSameMsg) { msgMailMapper.updateByMsgTypeAndMsgName(tMsgMail); } else { diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java index c2bf600a..3f41eb0b 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java @@ -172,6 +172,10 @@ public void init(String msgName) { mpTemplateMsgForm.getMsgTemplateMiniAppidTextField().setText(tMsgMpTemplate.getMaAppid()); mpTemplateMsgForm.getMsgTemplateMiniPagePathTextField().setText(tMsgMpTemplate.getMaPagePath()); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgMpTemplate.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgMpTemplate.getPreviewUser()); + selectedMsgTemplateId = tMsgMpTemplate.getTemplateId(); } @@ -216,6 +220,9 @@ public void save(String msgName) { tMsgMpTemplate.setCreateTime(now); tMsgMpTemplate.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgMpTemplate.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + if (existSameMsg) { msgMpTemplateMapper.updateByMsgTypeAndMsgName(tMsgMpTemplate); } else { diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/QiNiuYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/QiNiuYunMsgForm.java index b353d8cf..3316ece3 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/QiNiuYunMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/QiNiuYunMsgForm.java @@ -97,6 +97,10 @@ public void init(String msgName) { TMsgSms tMsgSms = tMsgSmsList.get(0); msgId = tMsgSms.getId(); getInstance().getMsgTemplateIdTextField().setText(tMsgSms.getTemplateId()); + + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgSms.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgSms.getPreviewUser()); } initTemplateDataTable(); @@ -151,6 +155,8 @@ public void save(String msgName) { tMsgSms.setTemplateId(templateId); tMsgSms.setCreateTime(now); tMsgSms.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgSms.setPreviewUser(messageEditForm.getPreviewUserField().getText()); if (existSameMsg) { msgSmsMapper.updateByMsgTypeAndMsgName(tMsgSms); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/TxYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/TxYunMsgForm.java index 9197c682..2bc9c9ab 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/TxYunMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/TxYunMsgForm.java @@ -97,6 +97,10 @@ public void init(String msgName) { TMsgSms tMsgSms = tMsgSmsList.get(0); msgId = tMsgSms.getId(); getInstance().getMsgTemplateIdTextField().setText(tMsgSms.getTemplateId()); + + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgSms.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgSms.getPreviewUser()); } initTemplateDataTable(); @@ -152,6 +156,9 @@ public void save(String msgName) { tMsgSms.setCreateTime(now); tMsgSms.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgSms.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + if (existSameMsg) { msgSmsMapper.updateByMsgTypeAndMsgName(tMsgSms); } else { diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/UpYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/UpYunMsgForm.java index c12a2e60..3da9af6f 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/UpYunMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/UpYunMsgForm.java @@ -97,6 +97,10 @@ public void init(String msgName) { TMsgSms tMsgSms = tMsgSmsList.get(0); msgId = tMsgSms.getId(); getInstance().getMsgTemplateIdTextField().setText(tMsgSms.getTemplateId()); + + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgSms.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgSms.getPreviewUser()); } initTemplateDataTable(); @@ -152,6 +156,9 @@ public void save(String msgName) { tMsgSms.setCreateTime(now); tMsgSms.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgSms.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + if (existSameMsg) { msgSmsMapper.updateByMsgTypeAndMsgName(tMsgSms); } else { diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxCpMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxCpMsgForm.java index ad74e9c3..6b1f12a5 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxCpMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxCpMsgForm.java @@ -7,6 +7,7 @@ import com.fangxuele.tool.push.logic.MessageTypeEnum; import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.ui.form.MessageEditForm; import com.fangxuele.tool.push.util.MybatisUtil; import com.fangxuele.tool.push.util.SqliteUtil; import com.google.common.collect.Maps; @@ -95,6 +96,10 @@ public void init(String msgName) { getInstance().getUrlTextField().setText(tMsgWxCp.getUrl()); getInstance().getBtnTxtTextField().setText(tMsgWxCp.getBtnTxt()); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgWxCp.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgWxCp.getPreviewUser()); + switchCpMsgType(cpMsgType); } else { switchCpMsgType("图文消息"); @@ -147,6 +152,9 @@ public void save(String msgName) { tMsgWxCp.setBtnTxt(btnTxt); tMsgWxCp.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgWxCp.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + if (existSameMsg) { msgWxCpMapper.updateByMsgTypeAndMsgName(tMsgWxCp); } else { diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java index c0d494a4..5203ba45 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java @@ -7,6 +7,7 @@ import com.fangxuele.tool.push.logic.MessageTypeEnum; import com.fangxuele.tool.push.ui.component.TableInCellButtonColumn; import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.ui.form.MessageEditForm; import com.fangxuele.tool.push.util.MybatisUtil; import com.fangxuele.tool.push.util.SqliteUtil; @@ -45,6 +46,10 @@ public void init(String msgName) { MaSubscribeMsgForm.getInstance().getMsgTemplateIdTextField().setText(tMsgWxUniform.getMaTemplateId()); MaSubscribeMsgForm.getInstance().getMsgTemplateUrlTextField().setText(tMsgWxUniform.getPage()); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgWxUniform.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgWxUniform.getPreviewUser()); + // -------------公众号模板数据开始 MpTemplateMsgForm.selectedMsgTemplateId = tMsgWxUniform.getMpTemplateId(); // 模板消息Data表 @@ -140,6 +145,9 @@ public void save(String msgName) { tMsgWxUniform.setCreateTime(now); tMsgWxUniform.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgWxUniform.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + if (existSameMsg) { msgWxUniformMapper.updateByMsgTypeAndMsgName(tMsgWxUniform); } else { diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/YunpianMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/YunpianMsgForm.java index 42bb92a1..77aa4e16 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/YunpianMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/YunpianMsgForm.java @@ -4,6 +4,7 @@ import com.fangxuele.tool.push.domain.TMsgSms; import com.fangxuele.tool.push.logic.MessageTypeEnum; import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.ui.form.MessageEditForm; import com.fangxuele.tool.push.util.MybatisUtil; import com.fangxuele.tool.push.util.SqliteUtil; import com.intellij.uiDesigner.core.GridConstraints; @@ -42,6 +43,10 @@ public void init(String msgName) { if (tMsgSmsList.size() > 0) { TMsgSms tMsgSms = tMsgSmsList.get(0); getInstance().getMsgYunpianMsgContentTextField().setText(tMsgSms.getContent()); + + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + messageEditForm.getMsgNameField().setText(tMsgSms.getMsgName()); + messageEditForm.getPreviewUserField().setText(tMsgSms.getPreviewUser()); } } @@ -72,6 +77,9 @@ public void save(String msgName) { tMsgSms.setCreateTime(now); tMsgSms.setModifiedTime(now); + MessageEditForm messageEditForm = MessageEditForm.getInstance(); + tMsgSms.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + if (existSameMsg) { msgSmsMapper.updateByMsgTypeAndMsgName(tMsgSms); } else { diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java index 13d099e1..039c4740 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java @@ -52,8 +52,8 @@ public static void addListeners() { try { MsgFormFactory.getMsgForm().save(msgName); - App.config.setPreviewUser(messageEditForm.getPreviewUserField().getText()); - App.config.save(); +// TODO App.config.setPreviewUser(messageEditForm.getPreviewUserField().getText()); +// TODO App.config.save(); MessageManageForm.init(); } catch (Exception e1) { JOptionPane.showMessageDialog(messagePanel, "保存失败!\n\n" + e1.getMessage(), "失败", diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java index 72c4e1d6..810eaa03 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java @@ -132,11 +132,11 @@ public void mouseExited(MouseEvent e) { * 保存消息类型 */ private static void saveType() { - String msgName = App.config.getMsgName(); +// TODO String msgName = App.config.getMsgName(); - MessageEditForm.getInstance().getMsgNameField().setText(msgName); - MessageEditForm.getInstance().getPreviewUserField().setText(App.config.getPreviewUser()); - App.config.save(); +// TODO MessageEditForm.getInstance().getMsgNameField().setText(msgName); +// TODO MessageEditForm.getInstance().getPreviewUserField().setText(App.config.getPreviewUser()); +// TODO App.config.save(); MessageTypeForm.init(); } } diff --git a/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java b/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java index 4c4f98fc..94bc26a9 100644 --- a/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java +++ b/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java @@ -24,8 +24,6 @@ private ConfigUtil() { private String msgName; - private String previewUser; - private String memberSql; private String memberFilePath; @@ -215,14 +213,6 @@ public void setMsgName(String msgName) { setting.put("msg", "msgName", msgName); } - public String getPreviewUser() { - return setting.getStr("previewUser", "msg", ""); - } - - public void setPreviewUser(String previewUser) { - setting.put("msg", "previewUser", previewUser); - } - public String getMemberSql() { return setting.getStr("sql", "member", ""); } From a575f3aff78cd7b535acf28c8eb8f061ab5fff99 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Mon, 7 Dec 2020 11:08:38 +0800 Subject: [PATCH 17/29] =?UTF-8?q?=E9=A2=84=E8=A7=88=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E5=AF=B9=E5=BA=94=E6=B6=88=E6=81=AF=E4=BF=9D?= =?UTF-8?q?=E5=AD=98-=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mapper/TMsgDingMapper.xml | 3 ++- src/main/resources/mapper/TMsgHttpMapper.xml | 3 ++- src/main/resources/mapper/TMsgKefuMapper.xml | 3 ++- src/main/resources/mapper/TMsgKefuPriorityMapper.xml | 3 ++- src/main/resources/mapper/TMsgMaSubscribeMapper.xml | 3 ++- src/main/resources/mapper/TMsgMaTemplateMapper.xml | 3 ++- src/main/resources/mapper/TMsgMailMapper.xml | 3 ++- src/main/resources/mapper/TMsgMpTemplateMapper.xml | 3 ++- src/main/resources/mapper/TMsgSmsMapper.xml | 3 ++- src/main/resources/mapper/TMsgWxCpMapper.xml | 3 ++- src/main/resources/mapper/TMsgWxUniformMapper.xml | 3 ++- 11 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/main/resources/mapper/TMsgDingMapper.xml b/src/main/resources/mapper/TMsgDingMapper.xml index 17f18303..54f43013 100644 --- a/src/main/resources/mapper/TMsgDingMapper.xml +++ b/src/main/resources/mapper/TMsgDingMapper.xml @@ -178,7 +178,8 @@ content = #{content,jdbcType=VARCHAR}, radio_type = #{radioType,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgHttpMapper.xml b/src/main/resources/mapper/TMsgHttpMapper.xml index ef07600f..057f9c4f 100644 --- a/src/main/resources/mapper/TMsgHttpMapper.xml +++ b/src/main/resources/mapper/TMsgHttpMapper.xml @@ -209,7 +209,8 @@ cookies = #{cookies,jdbcType=VARCHAR}, body = #{body,jdbcType=VARCHAR}, body_type = #{bodyType,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgKefuMapper.xml b/src/main/resources/mapper/TMsgKefuMapper.xml index cbfd739a..b8b05abe 100644 --- a/src/main/resources/mapper/TMsgKefuMapper.xml +++ b/src/main/resources/mapper/TMsgKefuMapper.xml @@ -203,7 +203,8 @@ img_url = #{imgUrl,jdbcType=VARCHAR}, describe = #{describe,jdbcType=VARCHAR}, url = #{url,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgKefuPriorityMapper.xml b/src/main/resources/mapper/TMsgKefuPriorityMapper.xml index 7026f05f..98395cfc 100644 --- a/src/main/resources/mapper/TMsgKefuPriorityMapper.xml +++ b/src/main/resources/mapper/TMsgKefuPriorityMapper.xml @@ -254,7 +254,8 @@ img_url = #{imgUrl,jdbcType=VARCHAR}, describe = #{describe,jdbcType=VARCHAR}, kefu_url = #{kefuUrl,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgMaSubscribeMapper.xml b/src/main/resources/mapper/TMsgMaSubscribeMapper.xml index 0ece198c..d067f3fb 100644 --- a/src/main/resources/mapper/TMsgMaSubscribeMapper.xml +++ b/src/main/resources/mapper/TMsgMaSubscribeMapper.xml @@ -163,7 +163,8 @@ set template_id = #{templateId,jdbcType=VARCHAR}, page = #{page,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgMaTemplateMapper.xml b/src/main/resources/mapper/TMsgMaTemplateMapper.xml index dda8f3ff..1d5c022e 100644 --- a/src/main/resources/mapper/TMsgMaTemplateMapper.xml +++ b/src/main/resources/mapper/TMsgMaTemplateMapper.xml @@ -164,7 +164,8 @@ set template_id = #{templateId,jdbcType=VARCHAR}, page = #{page,jdbcType=VARCHAR}, emphasis_keyword = #{emphasisKeyword,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgMailMapper.xml b/src/main/resources/mapper/TMsgMailMapper.xml index 89041518..d7848240 100644 --- a/src/main/resources/mapper/TMsgMailMapper.xml +++ b/src/main/resources/mapper/TMsgMailMapper.xml @@ -163,7 +163,8 @@ Cc = #{cc,jdbcType=VARCHAR}, files = #{files,jdbcType=VARCHAR}, content = #{content,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgMpTemplateMapper.xml b/src/main/resources/mapper/TMsgMpTemplateMapper.xml index 5c92b2c3..f533f1b4 100644 --- a/src/main/resources/mapper/TMsgMpTemplateMapper.xml +++ b/src/main/resources/mapper/TMsgMpTemplateMapper.xml @@ -176,7 +176,8 @@ url = #{url,jdbcType=VARCHAR}, ma_appid = #{maAppid,jdbcType=VARCHAR}, ma_page_path = #{maPagePath,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgSmsMapper.xml b/src/main/resources/mapper/TMsgSmsMapper.xml index 3c31b63b..2490715e 100644 --- a/src/main/resources/mapper/TMsgSmsMapper.xml +++ b/src/main/resources/mapper/TMsgSmsMapper.xml @@ -138,7 +138,8 @@ update t_msg_sms set template_id = #{templateId,jdbcType=VARCHAR}, content = #{content,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgWxCpMapper.xml b/src/main/resources/mapper/TMsgWxCpMapper.xml index a7086eca..07fb0d4f 100644 --- a/src/main/resources/mapper/TMsgWxCpMapper.xml +++ b/src/main/resources/mapper/TMsgWxCpMapper.xml @@ -217,7 +217,8 @@ url = #{url,jdbcType=VARCHAR}, btn_txt = #{btnTxt,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgWxUniformMapper.xml b/src/main/resources/mapper/TMsgWxUniformMapper.xml index 7fb6e2cb..028b1ce9 100644 --- a/src/main/resources/mapper/TMsgWxUniformMapper.xml +++ b/src/main/resources/mapper/TMsgWxUniformMapper.xml @@ -227,7 +227,8 @@ page = #{page,jdbcType=VARCHAR}, emphasis_keyword = #{emphasisKeyword,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, - modified_time = #{modifiedTime,jdbcType=VARCHAR} + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + preview_user = #{previewUser,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} From e0aefc7ccf44ee09c39aaa3c5ddf832b32c29b7c Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Mon, 7 Dec 2020 20:20:29 +0800 Subject: [PATCH 18/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../push/ui/listener/MessageManageListener.java | 12 ++++-------- .../tool/push/ui/listener/SettingListener.java | 4 ++++ .../com/fangxuele/tool/push/util/ConfigUtil.java | 13 +++++++++++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java index 04fba388..b2aaac9d 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java @@ -158,10 +158,8 @@ public void mousePressed(MouseEvent e) { if (wxAccountList.size() > 0) { TWxAccount tWxAccount = wxAccountList.get(0); settingForm.getMpAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName()); - settingForm.getWechatAppIdTextField().setText(tWxAccount.getAppId()); - settingForm.getWechatAppSecretPasswordField().setText(tWxAccount.getAppSecret()); - settingForm.getWechatTokenPasswordField().setText(tWxAccount.getToken()); - settingForm.getWechatAesKeyPasswordField().setText(tWxAccount.getAesKey()); + App.config.setWxAccountId(tWxAccount.getId()); + App.config.save(); } break; @@ -173,10 +171,8 @@ public void mousePressed(MouseEvent e) { if (wxAccountList.size() > 0) { TWxAccount tWxAccount = wxAccountList.get(0); settingForm.getMaAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName()); - settingForm.getMiniAppAppIdTextField().setText(tWxAccount.getAppId()); - settingForm.getMiniAppAppSecretPasswordField().setText(tWxAccount.getAppSecret()); - settingForm.getMiniAppTokenPasswordField().setText(tWxAccount.getToken()); - settingForm.getMiniAppAesKeyPasswordField().setText(tWxAccount.getAesKey()); + App.config.setWxAccountId(tWxAccount.getId()); + App.config.save(); } break; default: diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java index 25ef12b8..f98c574d 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java @@ -151,6 +151,8 @@ public static void addListeners() { settingForm.getWechatAppSecretPasswordField().setText(tWxAccount.getAppSecret()); settingForm.getWechatTokenPasswordField().setText(tWxAccount.getToken()); settingForm.getWechatAesKeyPasswordField().setText(tWxAccount.getAesKey()); + App.config.setWxAccountId(tWxAccount.getId()); + App.config.save(); } } }); @@ -233,6 +235,8 @@ public static void addListeners() { settingForm.getMiniAppAppSecretPasswordField().setText(tWxAccount.getAppSecret()); settingForm.getMiniAppTokenPasswordField().setText(tWxAccount.getToken()); settingForm.getMiniAppAesKeyPasswordField().setText(tWxAccount.getAesKey()); + App.config.setWxAccountId(tWxAccount.getId()); + App.config.save(); } } }); diff --git a/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java b/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java index 94bc26a9..6a92570c 100644 --- a/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java +++ b/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java @@ -197,6 +197,11 @@ private ConfigUtil() { private int fontSize; + /** + * 当前所选的微信账户的id + */ + private Integer wxAccountId; + public int getMsgType() { return setting.getInt("msgType", "msg", 13); } @@ -940,4 +945,12 @@ public String getHttpProxyPassword() { public void setHttpProxyPassword(String httpProxyPassword) { setting.put("setting.http", "httpProxyPassword", httpProxyPassword); } + + public Integer getWxAccountId() { + return setting.getInt("wxAccountId", "setting.wechat"); + } + + public void setWxAccountId(Integer wxAccountId) { + setting.put("setting.wechat", "wxAccountId", String.valueOf(wxAccountId)); + } } From 1d6bc857d3e052bfefb3092fea25a421ba648dfb Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Mon, 7 Dec 2020 20:27:00 +0800 Subject: [PATCH 19/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangxuele/tool/push/ui/listener/SettingListener.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java index f98c574d..05294c02 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java @@ -10,6 +10,7 @@ import com.fangxuele.tool.push.ui.UiConsts; import com.fangxuele.tool.push.ui.dialog.*; import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.ui.form.MessageManageForm; import com.fangxuele.tool.push.ui.form.SettingForm; import com.fangxuele.tool.push.ui.form.msg.DingMsgForm; import com.fangxuele.tool.push.ui.form.msg.WxCpMsgForm; @@ -153,6 +154,7 @@ public static void addListeners() { settingForm.getWechatAesKeyPasswordField().setText(tWxAccount.getAesKey()); App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); + MessageManageForm.getInstance().getAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName()); } } }); @@ -237,6 +239,7 @@ public static void addListeners() { settingForm.getMiniAppAesKeyPasswordField().setText(tWxAccount.getAesKey()); App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); + MessageManageForm.getInstance().getAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName()); } } }); From bd4dd358b7a9449c71675724a1425ceff55bb97a Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Mon, 7 Dec 2020 21:06:12 +0800 Subject: [PATCH 20/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/ui/form/msg/KefuMsgForm.java | 2 + .../push/ui/form/msg/KefuPriorityMsgForm.java | 2 + .../push/ui/form/msg/MaSubscribeMsgForm.java | 2 + .../push/ui/form/msg/MpTemplateMsgForm.java | 3 ++ .../push/ui/form/msg/WxUniformMsgForm.java | 2 + .../ui/listener/MessageManageListener.java | 10 +++++ .../push/ui/listener/SettingListener.java | 37 +++++++++++++++++++ 7 files changed, 58 insertions(+) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java index a27abf83..69c9d308 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuMsgForm.java @@ -1,5 +1,6 @@ package com.fangxuele.tool.push.ui.form.msg; +import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.dao.TMsgKefuMapper; import com.fangxuele.tool.push.domain.TMsgKefu; import com.fangxuele.tool.push.logic.MessageTypeEnum; @@ -125,6 +126,7 @@ public void save(String msgName) { MessageEditForm messageEditForm = MessageEditForm.getInstance(); tMsgKefu.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + tMsgKefu.setWxAccountId(App.config.getWxAccountId()); if (existSameMsg) { msgKefuMapper.updateByMsgTypeAndMsgName(tMsgKefu); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuPriorityMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuPriorityMsgForm.java index e3b4f688..b7589102 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuPriorityMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/KefuPriorityMsgForm.java @@ -1,5 +1,6 @@ package com.fangxuele.tool.push.ui.form.msg; +import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.dao.TMsgKefuPriorityMapper; import com.fangxuele.tool.push.dao.TTemplateDataMapper; import com.fangxuele.tool.push.domain.TMsgKefuPriority; @@ -140,6 +141,7 @@ public void save(String msgName) { tMsgKefuPriority.setModifiedTime(now); MessageEditForm messageEditForm = MessageEditForm.getInstance(); tMsgKefuPriority.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + tMsgKefuPriority.setWxAccountId(App.config.getWxAccountId()); if (existSameMsg) { msgKefuPriorityMapper.updateByMsgTypeAndMsgName(tMsgKefuPriority); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java index e171e1b9..06ab264c 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MaSubscribeMsgForm.java @@ -1,5 +1,6 @@ package com.fangxuele.tool.push.ui.form.msg; +import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.dao.TMsgMaSubscribeMapper; import com.fangxuele.tool.push.dao.TTemplateDataMapper; import com.fangxuele.tool.push.domain.TMsgMaSubscribe; @@ -172,6 +173,7 @@ public void save(String msgName) { MessageEditForm messageEditForm = MessageEditForm.getInstance(); tMsgMaSubscribe.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + tMsgMaSubscribe.setWxAccountId(App.config.getWxAccountId()); if (existSameMsg) { msgMaSubscribeMapper.updateByMsgTypeAndMsgName(tMsgMaSubscribe); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java index 3f41eb0b..f986c7f6 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java @@ -222,6 +222,7 @@ public void save(String msgName) { MessageEditForm messageEditForm = MessageEditForm.getInstance(); tMsgMpTemplate.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + tMsgMpTemplate.setWxAccountId(App.config.getWxAccountId()); if (existSameMsg) { msgMpTemplateMapper.updateByMsgTypeAndMsgName(tMsgMpTemplate); @@ -423,6 +424,8 @@ public static void clearAllField() { getInstance().getTemplateDataNameTextField().setText(""); getInstance().getTemplateDataValueTextField().setText(""); getInstance().getTemplateDataColorTextField().setText(""); + getInstance().getTemplateListComboBox().removeAllItems(); + getInstance().getTemplateContentTextArea().setText(""); selectedMsgTemplateId = null; initTemplateDataTable(); } diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java index 5203ba45..bb99dd1f 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/WxUniformMsgForm.java @@ -1,5 +1,6 @@ package com.fangxuele.tool.push.ui.form.msg; +import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.dao.TMsgWxUniformMapper; import com.fangxuele.tool.push.dao.TTemplateDataMapper; import com.fangxuele.tool.push.domain.TMsgWxUniform; @@ -147,6 +148,7 @@ public void save(String msgName) { MessageEditForm messageEditForm = MessageEditForm.getInstance(); tMsgWxUniform.setPreviewUser(messageEditForm.getPreviewUserField().getText()); + tMsgWxUniform.setWxAccountId(App.config.getWxAccountId()); if (existSameMsg) { msgWxUniformMapper.updateByMsgTypeAndMsgName(tMsgWxUniform); diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java index b2aaac9d..ecbbab99 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java @@ -25,6 +25,9 @@ import com.fangxuele.tool.push.ui.form.MessageTypeForm; import com.fangxuele.tool.push.ui.form.PushHisForm; import com.fangxuele.tool.push.ui.form.SettingForm; +import com.fangxuele.tool.push.ui.form.msg.KefuMsgForm; +import com.fangxuele.tool.push.ui.form.msg.MaSubscribeMsgForm; +import com.fangxuele.tool.push.ui.form.msg.MpTemplateMsgForm; import com.fangxuele.tool.push.util.MybatisUtil; import javax.swing.*; @@ -151,8 +154,12 @@ public void mousePressed(MouseEvent e) { switch (msgType) { case MessageTypeEnum.MP_TEMPLATE_CODE: + MpTemplateMsgForm.clearAllField(); case MessageTypeEnum.KEFU_CODE: + KefuMsgForm.clearAllField(); case MessageTypeEnum.KEFU_PRIORITY_CODE: + KefuMsgForm.clearAllField(); + MpTemplateMsgForm.clearAllField(); // 多账号切换-公众号 List wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MP, accountName); if (wxAccountList.size() > 0) { @@ -164,8 +171,11 @@ public void mousePressed(MouseEvent e) { break; case MessageTypeEnum.MA_SUBSCRIBE_CODE: + MaSubscribeMsgForm.clearAllField(); case MessageTypeEnum.MA_TEMPLATE_CODE: case MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE: + MaSubscribeMsgForm.clearAllField(); + MpTemplateMsgForm.clearAllField(); // 多账号切换-小程序 wxAccountList = wxAccountMapper.selectByAccountTypeAndAccountName(UiConsts.WX_ACCOUNT_TYPE_MA, accountName); if (wxAccountList.size() > 0) { diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java index 05294c02..d2bfcc7c 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java @@ -152,9 +152,31 @@ public static void addListeners() { settingForm.getWechatAppSecretPasswordField().setText(tWxAccount.getAppSecret()); settingForm.getWechatTokenPasswordField().setText(tWxAccount.getToken()); settingForm.getWechatAesKeyPasswordField().setText(tWxAccount.getAesKey()); + + App.config.setWechatMpName(accountName); + App.config.setWechatAppId(settingForm.getWechatAppIdTextField().getText()); + App.config.setWechatAppSecret(new String(settingForm.getWechatAppSecretPasswordField().getPassword())); + App.config.setWechatToken(new String(settingForm.getWechatTokenPasswordField().getPassword())); + App.config.setWechatAesKey(new String(settingForm.getWechatAesKeyPasswordField().getPassword())); + + App.config.setMpUseProxy(settingForm.getMpUseProxyCheckBox().isSelected()); + App.config.setMpProxyHost(settingForm.getMpProxyHostTextField().getText()); + App.config.setMpProxyPort(settingForm.getMpProxyPortTextField().getText()); + App.config.setMpProxyUserName(settingForm.getMpProxyUserNameTextField().getText()); + App.config.setMpProxyPassword(settingForm.getMpProxyPasswordTextField().getText()); + + App.config.setMpUseOutSideAt(settingForm.getUseOutSideAccessTokenCheckBox().isSelected()); + App.config.setMpManualAt(settingForm.getManualAtRadioButton().isSelected()); + App.config.setMpApiAt(settingForm.getApiAtRadioButton().isSelected()); + App.config.setMpAt(settingForm.getAccessTokenTextField().getText()); + App.config.setMpAtExpiresIn(settingForm.getAtExpiresInTextField().getText()); + App.config.setMpAtApiUrl(settingForm.getAtApiUrlTextField().getText()); + App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); MessageManageForm.getInstance().getAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName()); + WxMpTemplateMsgSender.wxMpConfigStorage = null; + WxMpTemplateMsgSender.wxMpService = null; } } }); @@ -237,9 +259,24 @@ public static void addListeners() { settingForm.getMiniAppAppSecretPasswordField().setText(tWxAccount.getAppSecret()); settingForm.getMiniAppTokenPasswordField().setText(tWxAccount.getToken()); settingForm.getMiniAppAesKeyPasswordField().setText(tWxAccount.getAesKey()); + + App.config.setMiniAppName(accountName); + App.config.setMiniAppAppId(settingForm.getMiniAppAppIdTextField().getText()); + App.config.setMiniAppAppSecret(new String(settingForm.getMiniAppAppSecretPasswordField().getPassword())); + App.config.setMiniAppToken(new String(settingForm.getMiniAppTokenPasswordField().getPassword())); + App.config.setMiniAppAesKey(new String(settingForm.getMiniAppAesKeyPasswordField().getPassword())); + + App.config.setMaUseProxy(settingForm.getMaUseProxyCheckBox().isSelected()); + App.config.setMaProxyHost(settingForm.getMaProxyHostTextField().getText()); + App.config.setMaProxyPort(settingForm.getMaProxyPortTextField().getText()); + App.config.setMaProxyUserName(settingForm.getMaProxyUserNameTextField().getText()); + App.config.setMaProxyPassword(settingForm.getMaProxyPasswordTextField().getText()); + App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); MessageManageForm.getInstance().getAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName()); + WxMaSubscribeMsgSender.wxMaConfigStorage = null; + WxMaSubscribeMsgSender.wxMaService = null; } } }); From 84f544e8d8cbe5cf7aea6d585f19add1be42f042 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Tue, 8 Dec 2020 10:10:19 +0800 Subject: [PATCH 21/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java index f986c7f6..08975bbb 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/MpTemplateMsgForm.java @@ -162,6 +162,7 @@ public void init(String msgName) { } clearAllField(); + initTemplateList(); Integer msgId = 0; List tMsgMpTemplateList = msgMpTemplateMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.MP_TEMPLATE_CODE, msgName); if (tMsgMpTemplateList.size() > 0) { @@ -179,7 +180,6 @@ public void init(String msgName) { selectedMsgTemplateId = tMsgMpTemplate.getTemplateId(); } - initTemplateList(); initTemplateDataTable(); fillTemplateDataTable(msgId); } From 0f593df7753b1b729c11af63b6909b6ce771fdb9 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Tue, 8 Dec 2020 10:38:59 +0800 Subject: [PATCH 22/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangxuele/tool/push/ui/form/MessageManageForm.form | 2 +- .../fangxuele/tool/push/ui/form/MessageManageForm.java | 9 +++++---- .../fangxuele/tool/push/ui/form/MessageTypeForm.java | 10 ++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.form index 1a510b12..41e44553 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.form +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.form @@ -71,7 +71,7 @@ - + diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java index 5237395d..9f506a7b 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java @@ -55,6 +55,7 @@ public class MessageManageForm { private JButton msgHisTableDeleteButton; private JButton createMsgButton; private JComboBox accountSwitchComboBox; + private JPanel accountSwitchPanel; private static MessageManageForm messageManageForm; @@ -272,10 +273,10 @@ public static void initSwitchMultiAccount() { createMsgButton.setIcon(new ImageIcon(getClass().getResource("/icon/add.png"))); createMsgButton.setText("新建"); panel2.add(createMsgButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JPanel panel3 = new JPanel(); - panel3.setLayout(new GridLayoutManager(1, 1, new Insets(5, 0, 0, 0), -1, -1)); - messageManagePanel.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + accountSwitchPanel = new JPanel(); + accountSwitchPanel.setLayout(new GridLayoutManager(1, 1, new Insets(5, 0, 0, 0), -1, -1)); + messageManagePanel.add(accountSwitchPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); accountSwitchComboBox = new JComboBox(); - panel3.add(accountSwitchComboBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + accountSwitchPanel.add(accountSwitchComboBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); } } diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.java index 734aa765..8ecea2c1 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.java @@ -126,6 +126,7 @@ public static void init() { default: } + initMessageManageFormLayOut(msgType); initMessageEditFormLayOut(msgType); initMemberFormLayOut(msgType); MessageEditForm.switchMsgType(msgType); @@ -136,6 +137,15 @@ public static void init() { ScheduleForm.init(); } + private static void initMessageManageFormLayOut(int msgType) { + if (msgType == MessageTypeEnum.KEFU_CODE || msgType == MessageTypeEnum.KEFU_PRIORITY_CODE || msgType == MessageTypeEnum.MP_TEMPLATE_CODE + || msgType == MessageTypeEnum.MA_TEMPLATE_CODE || msgType == MessageTypeEnum.MA_SUBSCRIBE_CODE || msgType == MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE) { + MessageManageForm.getInstance().getAccountSwitchPanel().setVisible(true); + } else { + MessageManageForm.getInstance().getAccountSwitchPanel().setVisible(false); + } + } + private static void initMessageEditFormLayOut(int msgType) { if (msgType == MessageTypeEnum.HTTP_CODE) { MessageEditForm.getInstance().getPreviewMemberLabel().setText("消息变量"); From 41b573e8f99edc2c46b193d9c6ee3387b9e533bd Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Tue, 8 Dec 2020 10:59:59 +0800 Subject: [PATCH 23/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangxuele/tool/push/dao/TMsgKefuMapper.java | 2 ++ .../tool/push/dao/TMsgKefuPriorityMapper.java | 2 ++ .../tool/push/dao/TMsgMaSubscribeMapper.java | 2 ++ .../tool/push/dao/TMsgMaTemplateMapper.java | 2 ++ .../tool/push/dao/TMsgMpTemplateMapper.java | 2 ++ .../tool/push/dao/TMsgWxUniformMapper.java | 2 ++ .../tool/push/ui/form/MessageManageForm.java | 13 +++++++------ src/main/resources/mapper/TMsgKefuMapper.xml | 8 ++++++++ .../resources/mapper/TMsgKefuPriorityMapper.xml | 8 ++++++++ src/main/resources/mapper/TMsgMaSubscribeMapper.xml | 8 ++++++++ src/main/resources/mapper/TMsgMaTemplateMapper.xml | 8 ++++++++ src/main/resources/mapper/TMsgMpTemplateMapper.xml | 8 ++++++++ src/main/resources/mapper/TMsgWxUniformMapper.xml | 7 +++++++ 13 files changed, 66 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgKefuMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgKefuMapper.java index 7360affa..6a80f862 100644 --- a/src/main/java/com/fangxuele/tool/push/dao/TMsgKefuMapper.java +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgKefuMapper.java @@ -25,4 +25,6 @@ public interface TMsgKefuMapper { List selectByMsgType(int msgType); int deleteByMsgTypeAndName(@Param("msgType") int msgType, @Param("msgName") String msgName); + + List selectByMsgTypeAndWxAccountId(@Param("msgType") int msgType, @Param("wxAccountId") Integer wxAccountId); } \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgKefuPriorityMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgKefuPriorityMapper.java index 0057b9d3..173076c4 100644 --- a/src/main/java/com/fangxuele/tool/push/dao/TMsgKefuPriorityMapper.java +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgKefuPriorityMapper.java @@ -25,4 +25,6 @@ public interface TMsgKefuPriorityMapper { List selectByMsgType(int msgType); int deleteByMsgTypeAndName(@Param("msgType") int msgType, @Param("msgName") String msgName); + + List selectByMsgTypeAndWxAccountId(@Param("msgType") int msgType, @Param("wxAccountId") Integer wxAccountId); } \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgMaSubscribeMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgMaSubscribeMapper.java index ee3a8d81..878eb8c7 100644 --- a/src/main/java/com/fangxuele/tool/push/dao/TMsgMaSubscribeMapper.java +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgMaSubscribeMapper.java @@ -25,4 +25,6 @@ public interface TMsgMaSubscribeMapper { List selectByMsgType(int msgType); int deleteByMsgTypeAndName(@Param("msgType") int msgType, @Param("msgName") String msgName); + + List selectByMsgTypeAndWxAccountId(@Param("msgType") int msgType, @Param("wxAccountId") Integer wxAccountId); } \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgMaTemplateMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgMaTemplateMapper.java index 0088699d..e807caf8 100644 --- a/src/main/java/com/fangxuele/tool/push/dao/TMsgMaTemplateMapper.java +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgMaTemplateMapper.java @@ -25,4 +25,6 @@ public interface TMsgMaTemplateMapper { List selectByMsgType(int msgType); int deleteByMsgTypeAndName(@Param("msgType") int msgType, @Param("msgName") String msgName); + + List selectByMsgTypeAndWxAccountId(@Param("msgType") int msgType, @Param("wxAccountId") Integer wxAccountId); } \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgMpTemplateMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgMpTemplateMapper.java index c26851cb..4eba3814 100644 --- a/src/main/java/com/fangxuele/tool/push/dao/TMsgMpTemplateMapper.java +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgMpTemplateMapper.java @@ -25,4 +25,6 @@ public interface TMsgMpTemplateMapper { List selectByMsgType(int msgType); int deleteByMsgTypeAndName(@Param("msgType") int msgType, @Param("msgName") String msgName); + + List selectByMsgTypeAndWxAccountId(@Param("msgType") int msgType, @Param("wxAccountId") Integer wxAccountId); } \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgWxUniformMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgWxUniformMapper.java index 21dfa132..cab75645 100644 --- a/src/main/java/com/fangxuele/tool/push/dao/TMsgWxUniformMapper.java +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgWxUniformMapper.java @@ -25,4 +25,6 @@ public interface TMsgWxUniformMapper { List selectByMsgTypeAndMsgName(@Param("msgType") int msgType, @Param("msgName") String msgName); int updateByMsgTypeAndMsgName(TMsgWxUniform tMsgWxUniform); + + List selectByMsgTypeAndWxAccountId(@Param("msgType") int msgType, @Param("wxAccountId") Integer wxAccountId); } \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java index 9f506a7b..7d22f868 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java @@ -98,12 +98,13 @@ public static void init() { JTableUtil.hideTableHeader(messageManageForm.getMsgHistable()); int msgType = App.config.getMsgType(); + Integer wxAccountId = App.config.getWxAccountId(); Object[] data; switch (msgType) { case MessageTypeEnum.KEFU_CODE: - List tMsgKefuList = msgKefuMapper.selectByMsgType(msgType); + List tMsgKefuList = msgKefuMapper.selectByMsgTypeAndWxAccountId(msgType, wxAccountId); for (TMsgKefu tMsgKefu : tMsgKefuList) { data = new Object[1]; data[0] = tMsgKefu.getMsgName(); @@ -111,7 +112,7 @@ public static void init() { } break; case MessageTypeEnum.KEFU_PRIORITY_CODE: - List tMsgKefuPriorityList = msgKefuPriorityMapper.selectByMsgType(msgType); + List tMsgKefuPriorityList = msgKefuPriorityMapper.selectByMsgTypeAndWxAccountId(msgType, wxAccountId); for (TMsgKefuPriority tMsgKefuPriority : tMsgKefuPriorityList) { data = new Object[1]; data[0] = tMsgKefuPriority.getMsgName(); @@ -119,7 +120,7 @@ public static void init() { } break; case MessageTypeEnum.WX_UNIFORM_MESSAGE_CODE: - List tMsgWxUniformList = wxUniformMapper.selectByMsgType(msgType); + List tMsgWxUniformList = wxUniformMapper.selectByMsgTypeAndWxAccountId(msgType, wxAccountId); for (TMsgWxUniform tMsgWxUniform : tMsgWxUniformList) { data = new Object[1]; data[0] = tMsgWxUniform.getMsgName(); @@ -127,7 +128,7 @@ public static void init() { } break; case MessageTypeEnum.MA_TEMPLATE_CODE: - List tMsgMaTemplateList = msgMaTemplateMapper.selectByMsgType(msgType); + List tMsgMaTemplateList = msgMaTemplateMapper.selectByMsgTypeAndWxAccountId(msgType, wxAccountId); for (TMsgMaTemplate tMsgMaTemplate : tMsgMaTemplateList) { data = new Object[1]; data[0] = tMsgMaTemplate.getMsgName(); @@ -135,7 +136,7 @@ public static void init() { } break; case MessageTypeEnum.MA_SUBSCRIBE_CODE: - List tMsgMaSubscribeList = msgMaSubscribeMapper.selectByMsgType(msgType); + List tMsgMaSubscribeList = msgMaSubscribeMapper.selectByMsgTypeAndWxAccountId(msgType, wxAccountId); for (TMsgMaSubscribe tMsgMaSubscribe : tMsgMaSubscribeList) { data = new Object[1]; data[0] = tMsgMaSubscribe.getMsgName(); @@ -143,7 +144,7 @@ public static void init() { } break; case MessageTypeEnum.MP_TEMPLATE_CODE: - List tMsgMpTemplateList = msgMpTemplateMapper.selectByMsgType(msgType); + List tMsgMpTemplateList = msgMpTemplateMapper.selectByMsgTypeAndWxAccountId(msgType, wxAccountId); for (TMsgMpTemplate tMsgMpTemplate : tMsgMpTemplateList) { data = new Object[1]; data[0] = tMsgMpTemplate.getMsgName(); diff --git a/src/main/resources/mapper/TMsgKefuMapper.xml b/src/main/resources/mapper/TMsgKefuMapper.xml index b8b05abe..3e8cd285 100644 --- a/src/main/resources/mapper/TMsgKefuMapper.xml +++ b/src/main/resources/mapper/TMsgKefuMapper.xml @@ -221,4 +221,12 @@ where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/src/main/resources/mapper/TMsgKefuPriorityMapper.xml b/src/main/resources/mapper/TMsgKefuPriorityMapper.xml index 98395cfc..e8b9dfda 100644 --- a/src/main/resources/mapper/TMsgKefuPriorityMapper.xml +++ b/src/main/resources/mapper/TMsgKefuPriorityMapper.xml @@ -272,4 +272,12 @@ where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/src/main/resources/mapper/TMsgMaSubscribeMapper.xml b/src/main/resources/mapper/TMsgMaSubscribeMapper.xml index d067f3fb..a90c16b6 100644 --- a/src/main/resources/mapper/TMsgMaSubscribeMapper.xml +++ b/src/main/resources/mapper/TMsgMaSubscribeMapper.xml @@ -168,4 +168,12 @@ where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/src/main/resources/mapper/TMsgMaTemplateMapper.xml b/src/main/resources/mapper/TMsgMaTemplateMapper.xml index 1d5c022e..13e6a6ae 100644 --- a/src/main/resources/mapper/TMsgMaTemplateMapper.xml +++ b/src/main/resources/mapper/TMsgMaTemplateMapper.xml @@ -182,4 +182,12 @@ where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/src/main/resources/mapper/TMsgMpTemplateMapper.xml b/src/main/resources/mapper/TMsgMpTemplateMapper.xml index f533f1b4..4dc08a9f 100644 --- a/src/main/resources/mapper/TMsgMpTemplateMapper.xml +++ b/src/main/resources/mapper/TMsgMpTemplateMapper.xml @@ -194,4 +194,12 @@ where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/src/main/resources/mapper/TMsgWxUniformMapper.xml b/src/main/resources/mapper/TMsgWxUniformMapper.xml index 028b1ce9..90b5b504 100644 --- a/src/main/resources/mapper/TMsgWxUniformMapper.xml +++ b/src/main/resources/mapper/TMsgWxUniformMapper.xml @@ -232,4 +232,11 @@ where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} + \ No newline at end of file From c82c8567d4c2cb8022422304d33c07027a2032d2 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Tue, 8 Dec 2020 11:33:49 +0800 Subject: [PATCH 24/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangxuele/tool/push/ui/form/MessageManageForm.java | 5 ++++- .../tool/push/ui/listener/MessageManageListener.java | 2 ++ src/main/resources/mapper/TMsgKefuMapper.xml | 3 ++- src/main/resources/mapper/TMsgKefuPriorityMapper.xml | 3 ++- src/main/resources/mapper/TMsgMaSubscribeMapper.xml | 3 ++- src/main/resources/mapper/TMsgMaTemplateMapper.xml | 3 ++- src/main/resources/mapper/TMsgMpTemplateMapper.xml | 3 ++- src/main/resources/mapper/TMsgWxUniformMapper.xml | 3 ++- 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java index 7d22f868..75372175 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java @@ -90,6 +90,10 @@ public static void init() { initSwitchMultiAccount(); + initMessageList(); + } + + public static void initMessageList() { // 历史消息管理 String[] headerNames = {"消息名称"}; DefaultTableModel model = new DefaultTableModel(null, headerNames); @@ -194,7 +198,6 @@ public static void init() { } } - /** * 初始化多账号切换 */ diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java index ecbbab99..5339d65f 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java @@ -168,6 +168,7 @@ public void mousePressed(MouseEvent e) { App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); } + MessageManageForm.initMessageList(); break; case MessageTypeEnum.MA_SUBSCRIBE_CODE: @@ -184,6 +185,7 @@ public void mousePressed(MouseEvent e) { App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); } + MessageManageForm.initMessageList(); break; default: break; diff --git a/src/main/resources/mapper/TMsgKefuMapper.xml b/src/main/resources/mapper/TMsgKefuMapper.xml index 3e8cd285..ec72cf95 100644 --- a/src/main/resources/mapper/TMsgKefuMapper.xml +++ b/src/main/resources/mapper/TMsgKefuMapper.xml @@ -204,7 +204,8 @@ describe = #{describe,jdbcType=VARCHAR}, url = #{url,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR}, - preview_user = #{previewUser,jdbcType=VARCHAR} + preview_user = #{previewUser,jdbcType=VARCHAR}, + wx_account_id = #{wxAccountId,jdbcType=INTEGER} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgKefuPriorityMapper.xml b/src/main/resources/mapper/TMsgKefuPriorityMapper.xml index e8b9dfda..f297f2e2 100644 --- a/src/main/resources/mapper/TMsgKefuPriorityMapper.xml +++ b/src/main/resources/mapper/TMsgKefuPriorityMapper.xml @@ -255,7 +255,8 @@ describe = #{describe,jdbcType=VARCHAR}, kefu_url = #{kefuUrl,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR}, - preview_user = #{previewUser,jdbcType=VARCHAR} + preview_user = #{previewUser,jdbcType=VARCHAR}, + wx_account_id = #{wxAccountId,jdbcType=INTEGER} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgMaSubscribeMapper.xml b/src/main/resources/mapper/TMsgMaSubscribeMapper.xml index a90c16b6..2afa2bc4 100644 --- a/src/main/resources/mapper/TMsgMaSubscribeMapper.xml +++ b/src/main/resources/mapper/TMsgMaSubscribeMapper.xml @@ -164,7 +164,8 @@ page = #{page,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR}, - preview_user = #{previewUser,jdbcType=VARCHAR} + preview_user = #{previewUser,jdbcType=VARCHAR}, + wx_account_id = #{wxAccountId,jdbcType=INTEGER} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgMaTemplateMapper.xml b/src/main/resources/mapper/TMsgMaTemplateMapper.xml index 13e6a6ae..67dd617a 100644 --- a/src/main/resources/mapper/TMsgMaTemplateMapper.xml +++ b/src/main/resources/mapper/TMsgMaTemplateMapper.xml @@ -165,7 +165,8 @@ page = #{page,jdbcType=VARCHAR}, emphasis_keyword = #{emphasisKeyword,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR}, - preview_user = #{previewUser,jdbcType=VARCHAR} + preview_user = #{previewUser,jdbcType=VARCHAR}, + wx_account_id = #{wxAccountId,jdbcType=INTEGER} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgMpTemplateMapper.xml b/src/main/resources/mapper/TMsgMpTemplateMapper.xml index 4dc08a9f..a7bae98a 100644 --- a/src/main/resources/mapper/TMsgMpTemplateMapper.xml +++ b/src/main/resources/mapper/TMsgMpTemplateMapper.xml @@ -177,7 +177,8 @@ ma_appid = #{maAppid,jdbcType=VARCHAR}, ma_page_path = #{maPagePath,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR}, - preview_user = #{previewUser,jdbcType=VARCHAR} + preview_user = #{previewUser,jdbcType=VARCHAR}, + wx_account_id = #{wxAccountId,jdbcType=INTEGER} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} diff --git a/src/main/resources/mapper/TMsgWxUniformMapper.xml b/src/main/resources/mapper/TMsgWxUniformMapper.xml index 90b5b504..fda636dc 100644 --- a/src/main/resources/mapper/TMsgWxUniformMapper.xml +++ b/src/main/resources/mapper/TMsgWxUniformMapper.xml @@ -228,7 +228,8 @@ emphasis_keyword = #{emphasisKeyword,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR}, - preview_user = #{previewUser,jdbcType=VARCHAR} + preview_user = #{previewUser,jdbcType=VARCHAR}, + wx_account_id = #{wxAccountId,jdbcType=INTEGER} where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} From 82dbe1126f4a970346af9f8aaa201397b8b032e7 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Tue, 8 Dec 2020 14:02:27 +0800 Subject: [PATCH 25/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2-=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangxuele/tool/push/ui/form/MessageManageForm.java | 4 ++++ .../tool/push/ui/listener/MessageManageListener.java | 5 +++++ .../com/fangxuele/tool/push/ui/listener/SettingListener.java | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java index 75372175..748f49c1 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java @@ -72,6 +72,8 @@ public class MessageManageForm { private static TMsgDingMapper msgDingMapper = MybatisUtil.getSqlSession().getMapper(TMsgDingMapper.class); private static TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class); + public static boolean accountSwitchComboBoxListenIgnore = false; + private MessageManageForm() { } @@ -212,9 +214,11 @@ public static void initSwitchMultiAccount() { case MessageTypeEnum.KEFU_PRIORITY_CODE: // 多账号切换-公众号 List wxAccountList = wxAccountMapper.selectByAccountType(UiConsts.WX_ACCOUNT_TYPE_MP); + accountSwitchComboBoxListenIgnore = true; for (TWxAccount tWxAccount : wxAccountList) { messageManageForm.getAccountSwitchComboBox().addItem(tWxAccount.getAccountName()); } + accountSwitchComboBoxListenIgnore = false; messageManageForm.getAccountSwitchComboBox().setSelectedItem(App.config.getWechatMpName()); break; diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java index 5339d65f..1e1cf70f 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java @@ -146,6 +146,9 @@ public void mousePressed(MouseEvent e) { // 切换账号事件 MessageManageForm.getInstance().getAccountSwitchComboBox().addItemListener(e -> { + if (MessageManageForm.accountSwitchComboBoxListenIgnore) { + return; + } if (e.getStateChange() == ItemEvent.SELECTED) { String accountName = e.getItem().toString(); @@ -165,6 +168,7 @@ public void mousePressed(MouseEvent e) { if (wxAccountList.size() > 0) { TWxAccount tWxAccount = wxAccountList.get(0); settingForm.getMpAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName()); + App.config.setWechatMpName(tWxAccount.getAccountName()); App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); } @@ -182,6 +186,7 @@ public void mousePressed(MouseEvent e) { if (wxAccountList.size() > 0) { TWxAccount tWxAccount = wxAccountList.get(0); settingForm.getMaAccountSwitchComboBox().setSelectedItem(tWxAccount.getAccountName()); + App.config.setMiniAppName(tWxAccount.getAccountName()); App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); } diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java index d2bfcc7c..617cff9e 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java @@ -153,7 +153,7 @@ public static void addListeners() { settingForm.getWechatTokenPasswordField().setText(tWxAccount.getToken()); settingForm.getWechatAesKeyPasswordField().setText(tWxAccount.getAesKey()); - App.config.setWechatMpName(accountName); + App.config.setWechatMpName(tWxAccount.getAccountName()); App.config.setWechatAppId(settingForm.getWechatAppIdTextField().getText()); App.config.setWechatAppSecret(new String(settingForm.getWechatAppSecretPasswordField().getPassword())); App.config.setWechatToken(new String(settingForm.getWechatTokenPasswordField().getPassword())); From 820e5e4e3e6aee320cefe62c0f89b8e3f4bad810 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Tue, 8 Dec 2020 14:11:08 +0800 Subject: [PATCH 26/29] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=92=88=E5=AF=B9=E5=BE=AE=E4=BF=A1=E7=B1=BB=E5=9E=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=A4=9A=E8=B4=A6=E5=8F=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2-=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangxuele/tool/push/ui/form/MessageManageForm.java | 2 ++ .../fangxuele/tool/push/ui/listener/MessageEditListener.java | 3 --- .../tool/push/ui/listener/MessageManageListener.java | 2 ++ .../fangxuele/tool/push/ui/listener/MessageTypeListener.java | 5 ----- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java index 748f49c1..b269417b 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java @@ -90,6 +90,8 @@ public static MessageManageForm getInstance() { public static void init() { messageManageForm = getInstance(); + MessageEditForm.getInstance().getMsgNameField().setText(""); + initSwitchMultiAccount(); initMessageList(); diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java index 039c4740..e5a984c8 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageEditListener.java @@ -51,9 +51,6 @@ public static void addListeners() { try { MsgFormFactory.getMsgForm().save(msgName); - -// TODO App.config.setPreviewUser(messageEditForm.getPreviewUserField().getText()); -// TODO App.config.save(); MessageManageForm.init(); } catch (Exception e1) { JOptionPane.showMessageDialog(messagePanel, "保存失败!\n\n" + e1.getMessage(), "失败", diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java index 1e1cf70f..3d4dcd00 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageManageListener.java @@ -172,6 +172,7 @@ public void mousePressed(MouseEvent e) { App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); } + MessageEditForm.getInstance().getMsgNameField().setText(""); MessageManageForm.initMessageList(); break; @@ -190,6 +191,7 @@ public void mousePressed(MouseEvent e) { App.config.setWxAccountId(tWxAccount.getId()); App.config.save(); } + MessageEditForm.getInstance().getMsgNameField().setText(""); MessageManageForm.initMessageList(); break; default: diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java index 810eaa03..b2793a88 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java @@ -132,11 +132,6 @@ public void mouseExited(MouseEvent e) { * 保存消息类型 */ private static void saveType() { -// TODO String msgName = App.config.getMsgName(); - -// TODO MessageEditForm.getInstance().getMsgNameField().setText(msgName); -// TODO MessageEditForm.getInstance().getPreviewUserField().setText(App.config.getPreviewUser()); -// TODO App.config.save(); MessageTypeForm.init(); } } From 12df48ab61fa370cfcb9a1e7362ce13c1d7eed58 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Tue, 8 Dec 2020 17:18:38 +0800 Subject: [PATCH 27/29] Optimize Imports --- .../tool/push/logic/PushControl.java | 1 - .../push/logic/msgsender/UpYunMsgSender.java | 6 +++++- .../tool/push/ui/form/MessageEditForm.java | 19 +++++++++++++++---- .../tool/push/ui/form/msg/AliYunMsgForm.java | 1 - .../tool/push/ui/frame/MainFrame.java | 2 +- .../push/ui/listener/MessageTypeListener.java | 1 - .../push/ui/listener/SettingListener.java | 17 +++++++++++++++-- .../tool/push/util/FileCharSetUtil.java | 7 ++++++- 8 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java index a512b048..2dc73338 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java +++ b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java @@ -38,7 +38,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Objects; diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/UpYunMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/UpYunMsgSender.java index e13f96a4..4c12f3c1 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/UpYunMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/UpYunMsgSender.java @@ -4,7 +4,11 @@ import com.fangxuele.tool.push.logic.PushControl; import com.fangxuele.tool.push.logic.msgmaker.UpYunMsgMaker; import lombok.extern.slf4j.Slf4j; -import okhttp3.*; +import okhttp3.FormBody; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; import org.apache.commons.lang3.exception.ExceptionUtils; /** diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java index 7c430882..93263e7e 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageEditForm.java @@ -1,14 +1,25 @@ package com.fangxuele.tool.push.ui.form; -import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.logic.MessageTypeEnum; -import com.fangxuele.tool.push.ui.form.msg.*; +import com.fangxuele.tool.push.ui.form.msg.AliYunMsgForm; +import com.fangxuele.tool.push.ui.form.msg.BdYunMsgForm; +import com.fangxuele.tool.push.ui.form.msg.DingMsgForm; +import com.fangxuele.tool.push.ui.form.msg.HttpMsgForm; +import com.fangxuele.tool.push.ui.form.msg.HwYunMsgForm; +import com.fangxuele.tool.push.ui.form.msg.KefuMsgForm; +import com.fangxuele.tool.push.ui.form.msg.MaSubscribeMsgForm; +import com.fangxuele.tool.push.ui.form.msg.MailMsgForm; +import com.fangxuele.tool.push.ui.form.msg.MpTemplateMsgForm; +import com.fangxuele.tool.push.ui.form.msg.MsgFormFactory; +import com.fangxuele.tool.push.ui.form.msg.QiNiuYunMsgForm; +import com.fangxuele.tool.push.ui.form.msg.TxYunMsgForm; +import com.fangxuele.tool.push.ui.form.msg.UpYunMsgForm; +import com.fangxuele.tool.push.ui.form.msg.WxCpMsgForm; +import com.fangxuele.tool.push.ui.form.msg.YunpianMsgForm; import com.fangxuele.tool.push.util.UndoUtil; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; -import com.sun.xml.internal.bind.v2.TODO; import lombok.Getter; -import org.apache.commons.lang3.StringUtils; import javax.swing.*; import javax.swing.plaf.FontUIResource; diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java index 05559673..4034e2e5 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/AliYunMsgForm.java @@ -1,6 +1,5 @@ package com.fangxuele.tool.push.ui.form.msg; -import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.dao.TMsgSmsMapper; import com.fangxuele.tool.push.dao.TTemplateDataMapper; import com.fangxuele.tool.push.domain.TMsgSms; diff --git a/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java b/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java index ab048054..ab61edd2 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java +++ b/src/main/java/com/fangxuele/tool/push/ui/frame/MainFrame.java @@ -8,9 +8,9 @@ import com.fangxuele.tool.push.ui.listener.FrameListener; import com.fangxuele.tool.push.ui.listener.HelpListener; import com.fangxuele.tool.push.ui.listener.MemberListener; -import com.fangxuele.tool.push.ui.listener.MessageTypeListener; import com.fangxuele.tool.push.ui.listener.MessageEditListener; import com.fangxuele.tool.push.ui.listener.MessageManageListener; +import com.fangxuele.tool.push.ui.listener.MessageTypeListener; import com.fangxuele.tool.push.ui.listener.PushHisListener; import com.fangxuele.tool.push.ui.listener.PushListener; import com.fangxuele.tool.push.ui.listener.ScheduleListener; diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java index b2793a88..ed3160f4 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MessageTypeListener.java @@ -4,7 +4,6 @@ import com.fangxuele.tool.push.logic.MessageTypeEnum; import com.fangxuele.tool.push.ui.UiConsts; import com.fangxuele.tool.push.ui.dialog.CommonTipsDialog; -import com.fangxuele.tool.push.ui.form.MessageEditForm; import com.fangxuele.tool.push.ui.form.MessageTypeForm; import javax.swing.*; diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java index 617cff9e..13031ee2 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java @@ -5,10 +5,23 @@ import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.dao.TWxAccountMapper; import com.fangxuele.tool.push.domain.TWxAccount; -import com.fangxuele.tool.push.logic.msgsender.*; +import com.fangxuele.tool.push.logic.msgsender.AliYunMsgSender; +import com.fangxuele.tool.push.logic.msgsender.BdYunMsgSender; +import com.fangxuele.tool.push.logic.msgsender.HttpMsgSender; +import com.fangxuele.tool.push.logic.msgsender.HwYunMsgSender; +import com.fangxuele.tool.push.logic.msgsender.MailMsgSender; +import com.fangxuele.tool.push.logic.msgsender.QiNiuYunMsgSender; +import com.fangxuele.tool.push.logic.msgsender.TxYunMsgSender; +import com.fangxuele.tool.push.logic.msgsender.WxMaSubscribeMsgSender; +import com.fangxuele.tool.push.logic.msgsender.WxMpTemplateMsgSender; +import com.fangxuele.tool.push.logic.msgsender.YunPianMsgSender; import com.fangxuele.tool.push.ui.Init; import com.fangxuele.tool.push.ui.UiConsts; -import com.fangxuele.tool.push.ui.dialog.*; +import com.fangxuele.tool.push.ui.dialog.CommonTipsDialog; +import com.fangxuele.tool.push.ui.dialog.DingAppDialog; +import com.fangxuele.tool.push.ui.dialog.MailTestDialog; +import com.fangxuele.tool.push.ui.dialog.SwitchWxAccountDialog; +import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; import com.fangxuele.tool.push.ui.form.MainWindow; import com.fangxuele.tool.push.ui.form.MessageManageForm; import com.fangxuele.tool.push.ui.form.SettingForm; diff --git a/src/main/java/com/fangxuele/tool/push/util/FileCharSetUtil.java b/src/main/java/com/fangxuele/tool/push/util/FileCharSetUtil.java index 96716e25..cb6de8e2 100644 --- a/src/main/java/com/fangxuele/tool/push/util/FileCharSetUtil.java +++ b/src/main/java/com/fangxuele/tool/push/util/FileCharSetUtil.java @@ -2,7 +2,12 @@ import cn.hutool.log.Log; import cn.hutool.log.LogFactory; -import info.monitorenter.cpdetector.io.*; +import info.monitorenter.cpdetector.io.ASCIIDetector; +import info.monitorenter.cpdetector.io.ByteOrderMarkDetector; +import info.monitorenter.cpdetector.io.CodepageDetectorProxy; +import info.monitorenter.cpdetector.io.JChardetFacade; +import info.monitorenter.cpdetector.io.ParsingDetector; +import info.monitorenter.cpdetector.io.UnicodeDetector; import java.io.File; import java.io.IOException; From ec990a8e2c05eaefd38a35137a705305284607a1 Mon Sep 17 00:00:00 2001 From: zhoubo58 Date: Tue, 8 Dec 2020 21:06:04 +0800 Subject: [PATCH 28/29] release:v_4.2.2_201208 --- src/main/java/com/fangxuele/tool/push/ui/UiConsts.java | 2 +- .../tool/push/ui/dialog/SwitchWxAccountDialog.java | 2 ++ .../com/fangxuele/tool/push/ui/form/MemberForm.java | 1 + .../com/fangxuele/tool/push/ui/form/PushHisForm.java | 2 +- .../tool/push/ui/listener/SettingListener.java | 1 + .../java/com/fangxuele/tool/push/util/UpgradeUtil.java | 1 + src/main/resources/version_summary.json | 10 ++++++++-- 7 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java b/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java index 3c1cd838..b865d70e 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java +++ b/src/main/java/com/fangxuele/tool/push/ui/UiConsts.java @@ -16,7 +16,7 @@ public class UiConsts { * 软件名称,版本 */ public final static String APP_NAME = "WePush"; - public final static String APP_VERSION = "v_4.2.1_200308"; + public final static String APP_VERSION = "v_4.2.2_201208"; /** * Logo-1024*1024 diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/SwitchWxAccountDialog.java b/src/main/java/com/fangxuele/tool/push/ui/dialog/SwitchWxAccountDialog.java index 0bc57155..b6878171 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/dialog/SwitchWxAccountDialog.java +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/SwitchWxAccountDialog.java @@ -7,6 +7,7 @@ import com.fangxuele.tool.push.dao.TWxAccountMapper; import com.fangxuele.tool.push.domain.TWxAccount; import com.fangxuele.tool.push.ui.UiConsts; +import com.fangxuele.tool.push.ui.form.MessageManageForm; import com.fangxuele.tool.push.ui.form.SettingForm; import com.fangxuele.tool.push.ui.listener.SettingListener; import com.fangxuele.tool.push.util.ComponentUtil; @@ -115,6 +116,7 @@ public void windowClosing(WindowEvent e) { } renderTable(); SettingForm.initSwitchMultiAccount(); + MessageManageForm.initSwitchMultiAccount(); JOptionPane.showMessageDialog(this, "保存成功!", "成功", JOptionPane.INFORMATION_MESSAGE); }); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java index 3d877dc7..f8e90d35 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java @@ -116,6 +116,7 @@ public static void init() { Color foreColor = new Color(187, 187, 187); memberForm.getImportFromSqlTextArea().setForeground(foreColor); } + clearMember(); } /** diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/PushHisForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/PushHisForm.java index 21ef2cd2..1e2afd3d 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/PushHisForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/PushHisForm.java @@ -71,7 +71,7 @@ public static void init() { pushHisForm.getSplitPane().setDividerLocation((int) (App.mainFrame.getWidth() * 0.38)); initHisLeftTable(); - + pushHisForm.getPushHisTextArea().setText(""); } private static void initHisLeftTable() { diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java index 13031ee2..7e7f794a 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/SettingListener.java @@ -133,6 +133,7 @@ public static void addListeners() { } SettingForm.initSwitchMultiAccount(); + MessageManageForm.initSwitchMultiAccount(); WxMpTemplateMsgSender.wxMpConfigStorage = null; WxMpTemplateMsgSender.wxMpService = null; JOptionPane.showMessageDialog(settingPanel, "保存成功!", "成功", diff --git a/src/main/java/com/fangxuele/tool/push/util/UpgradeUtil.java b/src/main/java/com/fangxuele/tool/push/util/UpgradeUtil.java index f79bb64c..7028c893 100644 --- a/src/main/java/com/fangxuele/tool/push/util/UpgradeUtil.java +++ b/src/main/java/com/fangxuele/tool/push/util/UpgradeUtil.java @@ -128,6 +128,7 @@ public static void smoothUpgrade() { String sql = FileUtil.readString(sqlFileUrl, CharsetUtil.UTF_8); try { MybatisUtil.executeSql(sql); + log.info("执行索引为{}的版本对应的sql完毕", i); } catch (SQLException e) { log.error("执行索引为{}的版本对应的sql时异常", i, e); if (!e.getMessage().contains("duplicate column")) { diff --git a/src/main/resources/version_summary.json b/src/main/resources/version_summary.json index f9054dcc..0df76645 100644 --- a/src/main/resources/version_summary.json +++ b/src/main/resources/version_summary.json @@ -1,5 +1,5 @@ { - "currentVersion": "v_4.2.1_200308", + "currentVersion": "v_4.2.2_201208", "versionIndex": { "v_1.1.0_170701": "0", "v_1.2.0_170831": "1", @@ -41,7 +41,8 @@ "v_4.1.0_190930": "37", "v_4.1.1_191027": "38", "v_4.2.0_191129": "39", - "v_4.2.1_200308": "40" + "v_4.2.1_200308": "40", + "v_4.2.2_201208": "41" }, "versionDetailList": [ { @@ -248,6 +249,11 @@ "version": "v_4.2.1_200308", "title": "修复bug", "log": "● fix:修复小程序订阅消息无法发送问题\n● optimization:由于小程序模板消息接口将于2020年1月10日下线,禁用小程序模板消息入口\n● fix:公众号模板消息支持小程序路径修复\n● fix:代码优化,界面细节优化\n" + }, + { + "version": "v_4.2.2_201208", + "title": "微信公众号和小程序类消息管理体验优化", + "log": "● feature:微信公号和小程序消息支持按多账号分组管理\n● feature:保存了编辑每条消息时的预览用户,下次预览不再烦恼\n● feature:设置tab新增调试模块和查看日志按钮\n● fix:修复公众号模板消息模板列表为空时的后台报错\n● optimization:部分sender客户端连接池调整\n● optimization:调整判断所有线程都执行完毕的逻辑\n● optimization:1.批量升级依赖版本 2.移除小程序模板消息相关消息构造器和发送器 3.调整小程序统一服务消息功能 4.代码细节和文案细节调整\n" } ] } \ No newline at end of file From c601c916dcde4541b82df4566488bec4ece1d875 Mon Sep 17 00:00:00 2001 From: duoduo Date: Tue, 8 Dec 2020 23:22:46 +0800 Subject: [PATCH 29/29] release:v_4.2.2_201208 --- download.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/download.md b/download.md index 8c5a3921..7aa81de3 100644 --- a/download.md +++ b/download.md @@ -3,6 +3,7 @@
Windows +[WePush-v4.2.2_201208-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.2.2_201208-x64-Setup.exe) [WePush-v4.2.1_200308-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.2.1_200308-x64-Setup.exe) [WePush-v4.2.0_191129-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.2.0_191129-x64-Setup.exe) [WePush-v4.1.1_191027-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v4.1.1_191027-x64-Setup.exe) @@ -127,6 +128,7 @@
Portable(各系统通用绿色便携版32/64位) +[v4.2.2_201208](http://download.zhoubochina.com/linux/WePush-4.2.2.zip) [v4.2.1_200308](http://download.zhoubochina.com/linux/WePush-4.2.1.zip) [v4.2.0_191129](http://download.zhoubochina.com/linux/WePush-4.2.0.zip) [v4.1.1_191027](http://download.zhoubochina.com/linux/WePush-4.1.1.zip)