From 49dd1332bf2168e969b0bb5b217a19e0e07068ad Mon Sep 17 00:00:00 2001 From: duoduo Date: Fri, 13 Sep 2019 23:01:29 +0800 Subject: [PATCH 01/12] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E5=8D=8E?= =?UTF-8?q?=E4=B8=BA=E4=BA=91=E7=9F=AD=E4=BF=A1=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/ui/form/SettingForm.form | 131 +++++++- .../tool/push/ui/form/SettingForm.java | 280 +++++++++++------- .../push/ui/listener/SettingListener.java | 21 ++ .../fangxuele/tool/push/util/ConfigUtil.java | 46 +++ 4 files changed, 358 insertions(+), 120 deletions(-) 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 7a7f1a37..fd284d2a 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 @@ -36,7 +36,7 @@ - + @@ -922,12 +922,131 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -980,7 +1099,7 @@ - + @@ -1122,7 +1241,7 @@ - + @@ -1216,7 +1335,7 @@ - + @@ -1335,7 +1454,7 @@ - + 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 d32dea66..cdc6d7e5 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 @@ -104,6 +104,12 @@ public class SettingForm { private JLabel manualAtTipsLabel; private JLabel apiAtTipsLabel; private JButton dingAppManageButton; + private JButton hwSaveButton; + private JTextField hwAppKeyTextField; + private JPasswordField hwAppSecretPasswordField; + private JTextField hwAccessUrlTextField; + private JTextField hwSignatureTextField; + private JTextField hwSenderCodeTextField; private static SettingForm settingForm; private static TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class); @@ -189,6 +195,13 @@ public static void init() { settingForm.getTxyunAppKeyTextField().setText(App.config.getTxyunAppKey()); settingForm.getTxyunSignTextField().setText(App.config.getTxyunSign()); + // 华为云短信 + settingForm.getHwAppKeyTextField().setText(App.config.getHwAppKey()); + settingForm.getHwAppSecretPasswordField().setText(App.config.getHwAppSecretPassword()); + settingForm.getHwAccessUrlTextField().setText(App.config.getHwAccessUrl()); + settingForm.getHwSenderCodeTextField().setText(App.config.getHwSenderCode()); + settingForm.getHwSignatureTextField().setText(App.config.getHwSignature()); + // 云片网短信 settingForm.getYunpianApiKeyTextField().setText(App.config.getYunpianApiKey()); @@ -349,7 +362,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(12, 1, new Insets(0, 60, 0, 330), -1, -1)); + panel3.setLayout(new GridLayoutManager(13, 1, new Insets(0, 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(1, 1, new Insets(15, 15, 10, 0), -1, -1)); @@ -654,122 +667,161 @@ public static void toggleMpOutSideAccessTokenPanel() { txyunAppIdTextField = new JTextField(); panel18.add(txyunAppIdTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false)); final JPanel panel20 = new JPanel(); - panel20.setLayout(new GridLayoutManager(2, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel20.setLayout(new GridLayoutManager(6, 4, new Insets(15, 15, 10, 0), -1, -1)); panel3.add(panel20, new GridConstraints(7, 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)); - panel20.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "云片网短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel20.getFont()))); + panel20.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "华为云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel20.getFont()))); final JLabel label29 = new JLabel(); - label29.setText("ApiKey"); + label29.setText("AppKey"); panel20.add(label29, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - yunpianApiKeyTextField = new JPasswordField(); - yunpianApiKeyTextField.setText(""); - panel20.add(yunpianApiKeyTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false)); + final JLabel label30 = new JLabel(); + label30.setText("AppSecret"); + panel20.add(label30, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label31 = new JLabel(); + label31.setText("APP接入地址"); + panel20.add(label31, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label32 = new JLabel(); + label32.setText("短信签名通道号"); + panel20.add(label32, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label33 = new JLabel(); + label33.setText("短信签名"); + panel20.add(label33, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + hwAccessUrlTextField = new JTextField(); + panel20.add(hwAccessUrlTextField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + hwSenderCodeTextField = new JTextField(); + panel20.add(hwSenderCodeTextField, new GridConstraints(3, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + hwSignatureTextField = new JTextField(); + panel20.add(hwSignatureTextField, new GridConstraints(4, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + hwAppSecretPasswordField = new JPasswordField(); + hwAppSecretPasswordField.setText(""); + panel20.add(hwAppSecretPasswordField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); final JPanel panel21 = new JPanel(); panel21.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel20.add(panel21, new GridConstraints(1, 0, 1, 4, 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)); - settingYunpianSaveButton = new JButton(); - settingYunpianSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); - settingYunpianSaveButton.setText("保存"); - panel21.add(settingYunpianSaveButton, 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)); + panel20.add(panel21, new GridConstraints(5, 0, 1, 4, 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)); + hwSaveButton = new JButton(); + hwSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); + hwSaveButton.setText("保存"); + panel21.add(hwSaveButton, 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 spacer11 = new Spacer(); panel21.add(spacer11, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + hwAppKeyTextField = new JTextField(); + panel20.add(hwAppKeyTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false)); final JPanel panel22 = new JPanel(); - panel22.setLayout(new GridLayoutManager(8, 4, new Insets(15, 15, 10, 0), -1, -1)); - panel3.add(panel22, new GridConstraints(9, 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)); - panel22.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "E-Mail", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel22.getFont()))); - final JLabel label30 = new JLabel(); - label30.setText("邮件服务器的SMTP地址"); - panel22.add(label30, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JLabel label31 = new JLabel(); - label31.setText("邮件服务器的SMTP端口"); - panel22.add(label31, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JLabel label32 = new JLabel(); - label32.setText("发件人(邮箱地址)"); - panel22.add(label32, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JLabel label33 = new JLabel(); - label33.setText("用户名"); - label33.setToolTipText("如果使用foxmail邮箱,此处为qq号"); - panel22.add(label33, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel22.setLayout(new GridLayoutManager(2, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel3.add(panel22, new GridConstraints(8, 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)); + panel22.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "云片网短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel22.getFont()))); final JLabel label34 = new JLabel(); - label34.setText("密码"); - panel22.add(label34, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + label34.setText("ApiKey"); + panel22.add(label34, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + yunpianApiKeyTextField = new JPasswordField(); + yunpianApiKeyTextField.setText(""); + panel22.add(yunpianApiKeyTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false)); final JPanel panel23 = new JPanel(); - panel23.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); - panel22.add(panel23, new GridConstraints(7, 0, 1, 4, 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)); + panel23.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel22.add(panel23, new GridConstraints(1, 0, 1, 4, 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)); + settingYunpianSaveButton = new JButton(); + settingYunpianSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); + settingYunpianSaveButton.setText("保存"); + panel23.add(settingYunpianSaveButton, 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 spacer12 = new Spacer(); + panel23.add(spacer12, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JPanel panel24 = new JPanel(); + panel24.setLayout(new GridLayoutManager(8, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel3.add(panel24, new GridConstraints(10, 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)); + panel24.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "E-Mail", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel24.getFont()))); + final JLabel label35 = new JLabel(); + label35.setText("邮件服务器的SMTP地址"); + panel24.add(label35, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label36 = new JLabel(); + label36.setText("邮件服务器的SMTP端口"); + panel24.add(label36, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label37 = new JLabel(); + label37.setText("发件人(邮箱地址)"); + panel24.add(label37, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label38 = new JLabel(); + label38.setText("用户名"); + label38.setToolTipText("如果使用foxmail邮箱,此处为qq号"); + panel24.add(label38, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label39 = new JLabel(); + label39.setText("密码"); + panel24.add(label39, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel25 = new JPanel(); + panel25.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); + panel24.add(panel25, new GridConstraints(7, 0, 1, 4, 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)); saveMailButton = new JButton(); saveMailButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); saveMailButton.setText("保存"); - panel23.add(saveMailButton, 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 Spacer spacer12 = new Spacer(); - panel23.add(spacer12, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + panel25.add(saveMailButton, 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 Spacer spacer13 = new Spacer(); + panel25.add(spacer13, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); testMailButton = new JButton(); testMailButton.setIcon(new ImageIcon(getClass().getResource("/icon/arrow_right.png"))); testMailButton.setText("测试"); - panel23.add(testMailButton, 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)); + panel25.add(testMailButton, 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)); mailStartTLSCheckBox = new JCheckBox(); mailStartTLSCheckBox.setText("使用STARTTLS安全连接"); - panel22.add(mailStartTLSCheckBox, new GridConstraints(5, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel24.add(mailStartTLSCheckBox, new GridConstraints(5, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); mailSSLCheckBox = new JCheckBox(); mailSSLCheckBox.setText("使用SSL安全连接"); - panel22.add(mailSSLCheckBox, new GridConstraints(6, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel24.add(mailSSLCheckBox, new GridConstraints(6, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); mailHostTextField = new JTextField(); - panel22.add(mailHostTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + panel24.add(mailHostTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); mailPortTextField = new JTextField(); - panel22.add(mailPortTextField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + panel24.add(mailPortTextField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); mailFromTextField = new JTextField(); - panel22.add(mailFromTextField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + panel24.add(mailFromTextField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); mailUserTextField = new JTextField(); - panel22.add(mailUserTextField, new GridConstraints(3, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + panel24.add(mailUserTextField, new GridConstraints(3, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); mailPasswordField = new JPasswordField(); - panel22.add(mailPasswordField, new GridConstraints(4, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - final JPanel panel24 = new JPanel(); - panel24.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); - panel3.add(panel24, new GridConstraints(10, 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)); - panel24.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "MySQL数据库", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel24.getFont()))); - final JLabel label35 = new JLabel(); - label35.setText("数据库地址"); - panel24.add(label35, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel24.add(mailPasswordField, new GridConstraints(4, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JPanel panel26 = new JPanel(); + panel26.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel3.add(panel26, new GridConstraints(11, 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)); + panel26.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "MySQL数据库", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel26.getFont()))); + final JLabel label40 = new JLabel(); + label40.setText("数据库地址"); + panel26.add(label40, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); mysqlUrlTextField = new JTextField(); - panel24.add(mysqlUrlTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false)); - final JLabel label36 = new JLabel(); - label36.setText("用户名"); - panel24.add(label36, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel26.add(mysqlUrlTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false)); + final JLabel label41 = new JLabel(); + label41.setText("用户名"); + panel26.add(label41, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); mysqlUserTextField = new JTextField(); - panel24.add(mysqlUserTextField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - final JLabel label37 = new JLabel(); - label37.setText("密码"); - panel24.add(label37, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel26.add(mysqlUserTextField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label42 = new JLabel(); + label42.setText("密码"); + panel26.add(label42, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); mysqlPasswordField = new JPasswordField(); - panel24.add(mysqlPasswordField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - final JPanel panel25 = new JPanel(); - panel25.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1)); - panel24.add(panel25, new GridConstraints(3, 0, 1, 4, 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)); + panel26.add(mysqlPasswordField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JPanel panel27 = new JPanel(); + panel27.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1)); + panel26.add(panel27, new GridConstraints(3, 0, 1, 4, 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)); settingTestDbLinkButton = new JButton(); settingTestDbLinkButton.setIcon(new ImageIcon(getClass().getResource("/icon/arrow_right.png"))); settingTestDbLinkButton.setText("测试连接"); - panel25.add(settingTestDbLinkButton, 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 spacer13 = new Spacer(); - panel25.add(spacer13, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + panel27.add(settingTestDbLinkButton, 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 spacer14 = new Spacer(); + panel27.add(spacer14, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); settingDbInfoSaveButton = new JButton(); settingDbInfoSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingDbInfoSaveButton.setText("保存"); - panel25.add(settingDbInfoSaveButton, 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 panel26 = new JPanel(); - panel26.setLayout(new GridLayoutManager(4, 3, new Insets(15, 15, 10, 0), -1, -1)); - panel3.add(panel26, new GridConstraints(11, 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)); - panel26.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "外观", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel26.getFont()))); - final JLabel label38 = new JLabel(); - label38.setText("主题风格"); - panel26.add(label38, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel27.add(settingDbInfoSaveButton, 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 panel28 = new JPanel(); + panel28.setLayout(new GridLayoutManager(4, 3, new Insets(15, 15, 10, 0), -1, -1)); + panel3.add(panel28, 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)); + panel28.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "外观", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel28.getFont()))); + final JLabel label43 = new JLabel(); + label43.setText("主题风格"); + panel28.add(label43, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); settingThemeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("Darcula(推荐)"); defaultComboBoxModel1.addElement("BeautyEye"); defaultComboBoxModel1.addElement("系统默认"); settingThemeComboBox.setModel(defaultComboBoxModel1); - panel26.add(settingThemeComboBox, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false)); - final JLabel label39 = new JLabel(); - label39.setText("字体"); - panel26.add(label39, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel28.add(settingThemeComboBox, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false)); + final JLabel label44 = new JLabel(); + label44.setText("字体"); + panel28.add(label44, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); settingFontNameComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel(); defaultComboBoxModel2.addElement("Microsoft YaHei"); @@ -777,10 +829,10 @@ public static void toggleMpOutSideAccessTokenPanel() { defaultComboBoxModel2.addElement("Microsoft YaHei UI"); defaultComboBoxModel2.addElement("Microsoft YaHei UI Light"); settingFontNameComboBox.setModel(defaultComboBoxModel2); - panel26.add(settingFontNameComboBox, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JLabel label40 = new JLabel(); - label40.setText("字号"); - panel26.add(label40, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel28.add(settingFontNameComboBox, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label45 = new JLabel(); + label45.setText("字号"); + panel28.add(label45, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); settingFontSizeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel3 = new DefaultComboBoxModel(); defaultComboBoxModel3.addElement("5"); @@ -806,51 +858,51 @@ public static void toggleMpOutSideAccessTokenPanel() { defaultComboBoxModel3.addElement("25"); defaultComboBoxModel3.addElement("26"); settingFontSizeComboBox.setModel(defaultComboBoxModel3); - panel26.add(settingFontSizeComboBox, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JPanel panel27 = new JPanel(); - panel27.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel26.add(panel27, new GridConstraints(3, 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)); + panel28.add(settingFontSizeComboBox, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel29 = new JPanel(); + panel29.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel28.add(panel29, new GridConstraints(3, 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)); settingAppearanceSaveButton = new JButton(); settingAppearanceSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingAppearanceSaveButton.setText("保存"); - panel27.add(settingAppearanceSaveButton, 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 spacer14 = new Spacer(); - panel27.add(spacer14, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); - final JPanel panel28 = new JPanel(); - panel28.setLayout(new GridLayoutManager(3, 3, new Insets(15, 15, 10, 0), -1, -1)); - Font panel28Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel28.getFont()); - if (panel28Font != null) panel28.setFont(panel28Font); - panel3.add(panel28, new GridConstraints(8, 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)); - panel28.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel28.getFont()))); - final JPanel panel29 = new JPanel(); - panel29.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel28.add(panel29, new GridConstraints(2, 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)); + panel29.add(settingAppearanceSaveButton, 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 spacer15 = new Spacer(); + panel29.add(spacer15, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JPanel panel30 = new JPanel(); + panel30.setLayout(new GridLayoutManager(3, 3, new Insets(15, 15, 10, 0), -1, -1)); + Font panel30Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel30.getFont()); + if (panel30Font != null) panel30.setFont(panel30Font); + panel3.add(panel30, new GridConstraints(9, 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)); + panel30.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel30.getFont()))); + final JPanel panel31 = new JPanel(); + panel31.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel30.add(panel31, new GridConstraints(2, 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)); httpSaveButton = new JButton(); httpSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); httpSaveButton.setText("保存"); - panel29.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 spacer15 = new Spacer(); - panel29.add(spacer15, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + panel31.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 spacer16 = new Spacer(); + panel31.add(spacer16, 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代理"); - panel28.add(httpUseProxyCheckBox, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel30.add(httpUseProxyCheckBox, new GridConstraints(0, 0, 1, 3, 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)); - panel28.add(httpProxyPanel, new GridConstraints(1, 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)); - final JLabel label41 = new JLabel(); - label41.setText("Host"); - httpProxyPanel.add(label41, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel30.add(httpProxyPanel, new GridConstraints(1, 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)); + final JLabel label46 = new JLabel(); + label46.setText("Host"); + httpProxyPanel.add(label46, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); httpProxyHostTextField = new JTextField(); httpProxyPanel.add(httpProxyHostTextField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); - final JLabel label42 = new JLabel(); - label42.setText("端口"); - httpProxyPanel.add(label42, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JLabel label43 = new JLabel(); - label43.setText("用户名"); - httpProxyPanel.add(label43, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JLabel label44 = new JLabel(); - label44.setText("密码"); - httpProxyPanel.add(label44, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label47 = new JLabel(); + label47.setText("端口"); + httpProxyPanel.add(label47, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label48 = new JLabel(); + label48.setText("用户名"); + httpProxyPanel.add(label48, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label49 = new JLabel(); + label49.setText("密码"); + httpProxyPanel.add(label49, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); httpProxyPortTextField = new JTextField(); httpProxyPanel.add(httpProxyPortTextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); httpProxyUserTextField = new JTextField(); 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 e3602a0b..7e944399 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 @@ -304,6 +304,27 @@ public static void addListeners() { } }); + // 设置-华为云短信-保存 + settingForm.getHwSaveButton().addActionListener(e -> { + try { + App.config.setHwAppKey(settingForm.getHwAppKeyTextField().getText()); + App.config.setHwAppSecretPassword(new String(settingForm.getHwAppSecretPasswordField().getPassword())); + App.config.setHwAccessUrl(settingForm.getHwAccessUrlTextField().getText()); + App.config.setHwSenderCode(settingForm.getHwSenderCodeTextField().getText()); + App.config.setHwSignature(settingForm.getHwSignatureTextField().getText()); + App.config.save(); + +// TODO TxYunMsgSender.smsSingleSender = null; + + JOptionPane.showMessageDialog(settingPanel, "保存成功!", "成功", + JOptionPane.INFORMATION_MESSAGE); + } catch (Exception e1) { + JOptionPane.showMessageDialog(settingPanel, "保存失败!\n\n" + e1.getMessage(), "失败", + JOptionPane.ERROR_MESSAGE); + logger.error(e1); + } + }); + // 设置-云片网短信-保存 settingForm.getSettingYunpianSaveButton().addActionListener(e -> { try { 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 2d6c2a72..2213217e 100644 --- a/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java +++ b/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java @@ -141,6 +141,12 @@ private ConfigUtil() { private String txyunSign; + private String hwAppKey; + private String hwAppSecretPassword; + private String hwAccessUrl; + private String hwSignature; + private String hwSenderCode; + private String yunpianApiKey; private boolean httpUseProxy; @@ -781,6 +787,46 @@ public void setTxyunSign(String txyunSign) { setting.put("setting.txyun", "txyunSign", txyunSign); } + public String getHwAppKey() { + return setting.getStr("hwAppKey", "setting.hwyun", ""); + } + + public void setHwAppKey(String hwAppKey) { + setting.put("setting.hwyun", "hwAppKey", hwAppKey); + } + + public String getHwAppSecretPassword() { + return setting.getStr("hwAppSecretPassword", "setting.hwyun", ""); + } + + public void setHwAppSecretPassword(String hwAppSecretPassword) { + setting.put("setting.hwyun", "hwAppSecretPassword", hwAppSecretPassword); + } + + public String getHwAccessUrl() { + return setting.getStr("hwAccessUrl", "setting.hwyun", ""); + } + + public void setHwAccessUrl(String hwAccessUrl) { + setting.put("setting.hwyun", "hwAccessUrl", hwAccessUrl); + } + + public String getHwSignature() { + return setting.getStr("hwSignature", "setting.hwyun", ""); + } + + public void setHwSignature(String hwSignature) { + setting.put("setting.hwyun", "hwSignature", hwSignature); + } + + public String getHwSenderCode() { + return setting.getStr("hwSenderCode", "setting.hwyun", ""); + } + + public void setHwSenderCode(String hwSenderCode) { + setting.put("setting.hwyun", "hwSenderCode", hwSenderCode); + } + public String getYunpianApiKey() { return setting.getStr("apiKey", "setting.yunpian", ""); } From 7a053b5610db660a106208050c4e172e9c063225 Mon Sep 17 00:00:00 2001 From: duoduo Date: Fri, 13 Sep 2019 23:20:34 +0800 Subject: [PATCH 02/12] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E5=8D=8E?= =?UTF-8?q?=E4=B8=BA=E4=BA=91=E7=9F=AD=E4=BF=A1=E7=BC=96=E8=BE=91=E8=A1=A8?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/logic/PushControl.java | 11 + .../push/logic/msgmaker/HwYunMsgMaker.java | 61 ++++ .../push/logic/msgmaker/MsgMakerFactory.java | 3 + .../push/logic/msgsender/HwYunMsgSender.java | 86 +++++ .../logic/msgsender/MsgSenderFactory.java | 3 + .../tool/push/ui/form/MessageEditForm.java | 4 + .../tool/push/ui/form/MessageTypeForm.form | 26 +- .../tool/push/ui/form/MessageTypeForm.java | 16 +- .../tool/push/ui/form/msg/HwYunMsgForm.form | 121 +++++++ .../tool/push/ui/form/msg/HwYunMsgForm.java | 315 ++++++++++++++++++ .../tool/push/ui/form/msg/MsgFormFactory.java | 3 + .../push/ui/listener/MsgEditListener.java | 3 +- 12 files changed, 630 insertions(+), 22 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/logic/msgmaker/HwYunMsgMaker.java create mode 100644 src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java create mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.form create mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java 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 cb1982bd..492b712b 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java +++ b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java @@ -186,6 +186,17 @@ public static boolean configCheck() { return false; } break; + case MessageTypeEnum.HW_YUN_CODE: + String hwAppKey = App.config.getHwAppKey(); + String hwAppSecretPassword = App.config.getHwAppSecretPassword(); + + if (StringUtils.isEmpty(hwAppKey) || StringUtils.isEmpty(hwAppSecretPassword)) { + JOptionPane.showMessageDialog(settingForm.getSettingPanel(), + "请先在设置中填写并保存华为云短信相关配置!", "提示", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + break; case MessageTypeEnum.YUN_PIAN_CODE: String yunpianApiKey = App.config.getYunpianApiKey(); if (StringUtils.isEmpty(yunpianApiKey)) { diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/HwYunMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/HwYunMsgMaker.java new file mode 100644 index 00000000..38619dc3 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/HwYunMsgMaker.java @@ -0,0 +1,61 @@ +package com.fangxuele.tool.push.logic.msgmaker; + +import com.fangxuele.tool.push.ui.form.msg.TxYunMsgForm; +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 HwYunMsgMaker extends BaseMsgMaker implements IMsgMaker{ + + public static int templateId; + + public static List paramList; + + /** + * 准备(界面字段等) + */ + @Override + public void prepare() { + templateId = Integer.parseInt(TxYunMsgForm.getInstance().getMsgTemplateIdTextField().getText()); + + if (TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { + TxYunMsgForm.initTemplateDataTable(); + } + + DefaultTableModel tableModel = (DefaultTableModel) TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel(); + int rowCount = tableModel.getRowCount(); + paramList = Lists.newArrayList(); + for (int i = 0; i < rowCount; i++) { + String value = ((String) tableModel.getValueAt(i, 1)); + paramList.add(value); + } + } + + /** + * 组织腾讯云短信消息 + * + * @param msgData 消息信息 + * @return String[] + */ + @Override + public String[] makeMsg(String[] msgData) { + + VelocityContext velocityContext = getVelocityContext(msgData); + for (int i = 0; i < paramList.size(); i++) { + paramList.set(i, TemplateUtil.evaluate(paramList.get(i), velocityContext)); + } + String[] paramArray = new String[paramList.size()]; + return paramList.toArray(paramArray); + } +} 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 5e95adc9..e4735fcb 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 @@ -36,6 +36,9 @@ public static IMsgMaker getMsgMaker() { case MessageTypeEnum.TX_YUN_CODE: iMsgMaker = new TxYunMsgMaker(); break; + case MessageTypeEnum.HW_YUN_CODE: + iMsgMaker = new HwYunMsgMaker(); + break; case MessageTypeEnum.YUN_PIAN_CODE: iMsgMaker = new YunPianMsgMaker(); break; diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java new file mode 100644 index 00000000..d0590c36 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java @@ -0,0 +1,86 @@ +package com.fangxuele.tool.push.logic.msgsender; + +import com.fangxuele.tool.push.App; +import com.fangxuele.tool.push.logic.PushControl; +import com.fangxuele.tool.push.logic.msgmaker.TxYunMsgMaker; +import com.github.qcloudsms.SmsSingleSender; +import com.github.qcloudsms.SmsSingleSenderResult; +import lombok.extern.slf4j.Slf4j; + +/** + *
+ * 华为云模板短信发送器
+ * 
+ * + * @author RememBerBer + * @since 2019/6/15. + */ +@Slf4j +public class HwYunMsgSender implements IMsgSender { + /** + * 腾讯云短信sender + */ + public volatile static SmsSingleSender smsSingleSender; + + private TxYunMsgMaker txYunMsgMaker; + + public HwYunMsgSender() { + txYunMsgMaker = new TxYunMsgMaker(); + smsSingleSender = getTxYunSender(); + } + + @Override + public SendResult send(String[] msgData) { + SendResult sendResult = new SendResult(); + try { + int templateId = TxYunMsgMaker.templateId; + String smsSign = App.config.getAliyunSign(); + String[] params = txYunMsgMaker.makeMsg(msgData); + String telNum = msgData[0]; + if (PushControl.dryRun) { + sendResult.setSuccess(true); + return sendResult; + } else { + SmsSingleSenderResult result = smsSingleSender.sendWithParam("86", telNum, + templateId, params, smsSign, "", ""); + + if (result.result == 0) { + sendResult.setSuccess(true); + } else { + sendResult.setSuccess(false); + sendResult.setInfo(result.toString()); + } + } + } catch (Exception e) { + sendResult.setSuccess(false); + sendResult.setInfo(e.getMessage()); + log.error(e.toString()); + } + + return sendResult; + } + + @Override + public SendResult asyncSend(String[] msgData) { + return null; + } + + /** + * 获取腾讯云短信发送客户端 + * + * @return SmsSingleSender + */ + private static SmsSingleSender getTxYunSender() { + if (smsSingleSender == null) { + synchronized (HwYunMsgSender.class) { + if (smsSingleSender == null) { + String txyunAppId = App.config.getTxyunAppId(); + String txyunAppKey = App.config.getTxyunAppKey(); + + smsSingleSender = new SmsSingleSender(Integer.parseInt(txyunAppId), txyunAppKey); + } + } + } + return smsSingleSender; + } +} 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 24d4f6e0..cc661df8 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 @@ -39,6 +39,9 @@ public static IMsgSender getMsgSender() { case MessageTypeEnum.TX_YUN_CODE: iMsgSender = new TxYunMsgSender(); break; + case MessageTypeEnum.HW_YUN_CODE: + iMsgSender = new HwYunMsgSender(); + break; case MessageTypeEnum.YUN_PIAN_CODE: iMsgSender = new YunPianMsgSender(); break; 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 0c0c045d..44258723 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 @@ -5,6 +5,7 @@ import com.fangxuele.tool.push.ui.form.msg.AliYunMsgForm; 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.MaTemplateMsgForm; import com.fangxuele.tool.push.ui.form.msg.MailMsgForm; @@ -112,6 +113,9 @@ public static void switchMsgType(int msgType) { case MessageTypeEnum.TX_YUN_CODE: messageEditForm.getMsgEditorPanel().add(TxYunMsgForm.getInstance().getTemplateMsgPanel(), gridConstraintsRow0); break; + case MessageTypeEnum.HW_YUN_CODE: + messageEditForm.getMsgEditorPanel().add(HwYunMsgForm.getInstance().getTemplateMsgPanel(), gridConstraintsRow0); + break; case MessageTypeEnum.YUN_PIAN_CODE: messageEditForm.getMsgEditorPanel().add(YunpianMsgForm.getInstance().getYunpianMsgPanel(), gridConstraintsRow0); break; diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form index 62b90cad..ff8e13cb 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form @@ -79,7 +79,7 @@ - + @@ -87,22 +87,13 @@ - + - - - - - - - - - @@ -159,7 +150,7 @@ - + @@ -177,7 +168,7 @@ - + @@ -216,6 +207,15 @@ + + + + + + + + +
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 276ccd12..44086c90 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 @@ -224,15 +224,11 @@ public static void clearAllSelected() { msgTypeListPanel.add(txYunRadioButton, new GridConstraints(8, 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)); yunPianRadioButton = new JRadioButton(); yunPianRadioButton.setText("云片网短信"); - msgTypeListPanel.add(yunPianRadioButton, new GridConstraints(9, 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)); + msgTypeListPanel.add(yunPianRadioButton, new GridConstraints(10, 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)); upYunRadioButton = new JRadioButton(); upYunRadioButton.setEnabled(false); upYunRadioButton.setText("又拍云短信"); - msgTypeListPanel.add(upYunRadioButton, new GridConstraints(11, 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)); - hwYunRadioButton = new JRadioButton(); - hwYunRadioButton.setEnabled(false); - hwYunRadioButton.setText("华为云短信"); - msgTypeListPanel.add(hwYunRadioButton, new GridConstraints(13, 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)); + msgTypeListPanel.add(upYunRadioButton, new GridConstraints(12, 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)); 网易云信短信RadioButton = new JRadioButton(); 网易云信短信RadioButton.setEnabled(false); 网易云信短信RadioButton.setText("网易云信短信"); @@ -260,7 +256,7 @@ public static void clearAllSelected() { eMailRadioButton = new JRadioButton(); eMailRadioButton.setEnabled(true); eMailRadioButton.setText("E-Mail(BETA)"); - msgTypeListPanel.add(eMailRadioButton, new GridConstraints(10, 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)); + msgTypeListPanel.add(eMailRadioButton, new GridConstraints(11, 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)); wxCpRadioButton = new JRadioButton(); wxCpRadioButton.setEnabled(true); wxCpRadioButton.setText("企业号/企业微信"); @@ -268,7 +264,7 @@ public static void clearAllSelected() { 七牛云短信RadioButton = new JRadioButton(); 七牛云短信RadioButton.setEnabled(false); 七牛云短信RadioButton.setText("七牛云短信"); - msgTypeListPanel.add(七牛云短信RadioButton, new GridConstraints(12, 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)); + msgTypeListPanel.add(七牛云短信RadioButton, new GridConstraints(13, 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)); httpRadioButton = new JRadioButton(); httpRadioButton.setEnabled(true); httpRadioButton.setText("HTTP请求"); @@ -283,6 +279,10 @@ public static void clearAllSelected() { 百度云短信RadioButton.setEnabled(false); 百度云短信RadioButton.setText("百度云短信"); msgTypeListPanel.add(百度云短信RadioButton, new GridConstraints(14, 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)); + hwYunRadioButton = new JRadioButton(); + hwYunRadioButton.setEnabled(true); + hwYunRadioButton.setText("华为云短信"); + msgTypeListPanel.add(hwYunRadioButton, new GridConstraints(9, 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)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(2, 1, new Insets(8, 8, 8, 0), -1, -1)); messageTypePanel.add(panel1, 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)); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.form new file mode 100644 index 00000000..0280ce48 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.form @@ -0,0 +1,121 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..84bbd712 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/HwYunMsgForm.java @@ -0,0 +1,315 @@ +package com.fangxuele.tool.push.ui.form.msg; + +import com.fangxuele.tool.push.dao.TMsgSmsMapper; +import com.fangxuele.tool.push.dao.TTemplateDataMapper; +import com.fangxuele.tool.push.domain.TMsgSms; +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; + +/** + *
+ * HwYunMsgForm
+ * 
+ * + * @author Zhou Bo + * @since 2019/6/3. + */ +@Getter +public class HwYunMsgForm implements IMsgForm { + private JPanel templateMsgPanel; + private JLabel templateIdLabel; + private JTextField msgTemplateIdTextField; + private JPanel templateMsgDataPanel; + private JLabel templateMsgNameLabel; + private JTextField templateDataNameTextField; + private JLabel templateMsgValueLabel; + private JTextField templateDataValueTextField; + private JButton templateMsgDataAddButton; + private JTable templateMsgDataTable; + + private static HwYunMsgForm hwYunMsgForm; + + private static TMsgSmsMapper msgSmsMapper = MybatisUtil.getSqlSession().getMapper(TMsgSmsMapper.class); + private static TTemplateDataMapper templateDataMapper = MybatisUtil.getSqlSession().getMapper(TTemplateDataMapper.class); + + public HwYunMsgForm() { + // 模板数据-添加 按钮事件 + templateMsgDataAddButton.addActionListener(e -> { + String[] data = new String[2]; + data[0] = getInstance().getTemplateDataNameTextField().getText(); + data[1] = getInstance().getTemplateDataValueTextField().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(), "模板参数和参数对应的值不能为空!", "提示", + JOptionPane.INFORMATION_MESSAGE); + } else if (keySet.contains(data[0])) { + JOptionPane.showMessageDialog(MessageEditForm.getInstance().getMsgEditorPanel(), "模板参数不能重复!", "提示", + JOptionPane.INFORMATION_MESSAGE); + } else { + tableModel.addRow(data); + } + }); + } + + @Override + public void init(String msgName) { + clearAllField(); + List tMsgSmsList = msgSmsMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.HW_YUN_CODE, msgName); + Integer msgId = 0; + if (tMsgSmsList.size() > 0) { + TMsgSms tMsgSms = tMsgSmsList.get(0); + msgId = tMsgSms.getId(); + getInstance().getMsgTemplateIdTextField().setText(tMsgSms.getTemplateId()); + } + + initTemplateDataTable(); + // 模板消息Data表 + List templateDataList = templateDataMapper.selectByMsgTypeAndMsgId(MessageTypeEnum.HW_YUN_CODE, msgId); + String[] headerNames = {"模板参数", "参数对应的值", "操作"}; + 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(); + } + 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(2).setPreferredWidth(46); + tableColumnModel.getColumn(2).setMaxWidth(46); + } + + @Override + public void save(String msgName) { + int msgId = 0; + boolean existSameMsg = false; + + List tMsgSmsList = msgSmsMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.HW_YUN_CODE, msgName); + if (tMsgSmsList.size() > 0) { + existSameMsg = true; + msgId = tMsgSmsList.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 now = SqliteUtil.nowDateForSqlite(); + + TMsgSms tMsgSms = new TMsgSms(); + tMsgSms.setMsgType(MessageTypeEnum.HW_YUN_CODE); + tMsgSms.setMsgName(msgName); + tMsgSms.setTemplateId(templateId); + tMsgSms.setCreateTime(now); + tMsgSms.setModifiedTime(now); + + if (existSameMsg) { + msgSmsMapper.updateByMsgTypeAndMsgName(tMsgSms); + } else { + msgSmsMapper.insertSelective(tMsgSms); + msgId = tMsgSms.getId(); + } + + // 保存模板数据 + // 如果是覆盖保存,则先清空之前的模板数据 + if (existSameMsg) { + templateDataMapper.deleteByMsgTypeAndMsgId(MessageTypeEnum.HW_YUN_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); + + TTemplateData tTemplateData = new TTemplateData(); + tTemplateData.setMsgType(MessageTypeEnum.HW_YUN_CODE); + tTemplateData.setMsgId(msgId); + tTemplateData.setName(name); + tTemplateData.setValue(value); + tTemplateData.setCreateTime(now); + tTemplateData.setModifiedTime(now); + + templateDataMapper.insert(tTemplateData); + } + + JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "保存成功!", "成功", + JOptionPane.INFORMATION_MESSAGE); + } + + } + + public static HwYunMsgForm getInstance() { + if (hwYunMsgForm == null) { + hwYunMsgForm = new HwYunMsgForm(); + } + return hwYunMsgForm; + } + + /** + * 初始化模板消息数据table + */ + public static void initTemplateDataTable() { + JTable msgDataTable = getInstance().getTemplateMsgDataTable(); + String[] headerNames = {"模板参数", "参数对应的值", "操作"}; + 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(2).setPreferredWidth(46); + tableColumnModel.getColumn(2).setMaxWidth(46); + } + + /** + * 清空所有界面字段 + */ + public static void clearAllField() { + getInstance().getMsgTemplateIdTextField().setText(""); + getInstance().getTemplateDataNameTextField().setText(""); + getInstance().getTemplateDataValueTextField().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, 3, new Insets(10, 5, 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()))); + templateMsgDataPanel = new JPanel(); + templateMsgDataPanel.setLayout(new GridLayoutManager(3, 3, new Insets(10, 0, 0, 0), -1, -1)); + templateMsgPanel.add(templateMsgDataPanel, new GridConstraints(1, 0, 1, 3, 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()))); + 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)); + templateMsgDataAddButton = new JButton(); + templateMsgDataAddButton.setIcon(new ImageIcon(getClass().getResource("/icon/add.png"))); + templateMsgDataAddButton.setText(""); + templateMsgDataPanel.add(templateMsgDataAddButton, new GridConstraints(1, 2, 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, 3, 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("模板参数"); + 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("参数对应的值"); + 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)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 5, 10, 5), -1, -1)); + templateMsgPanel.add(panel2, 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)); + 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)); + templateMsgNameLabel.setLabelFor(templateDataNameTextField); + templateMsgValueLabel.setLabelFor(templateDataValueTextField); + templateIdLabel.setLabelFor(msgTemplateIdTextField); + } + + /** + * @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 31706f03..45d74db2 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 @@ -41,6 +41,9 @@ public static IMsgForm getMsgForm() { case MessageTypeEnum.TX_YUN_CODE: iMsgForm = TxYunMsgForm.getInstance(); break; + case MessageTypeEnum.HW_YUN_CODE: + iMsgForm = HwYunMsgForm.getInstance(); + break; case MessageTypeEnum.YUN_PIAN_CODE: iMsgForm = YunpianMsgForm.getInstance(); break; diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java index 7264b8a5..47a02de0 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java @@ -158,7 +158,8 @@ public void mousePressed(MouseEvent e) { } else if (msgType == MessageTypeEnum.DING_CODE) { fillParaName = "预览消息用户的UserId(如果是聊天机器人消息,填写需要@ 的用户的手机号,如果@所有人 可不填写)"; paraDemo = "manager9115|manager9116|manager9117"; - } else if (msgType == MessageTypeEnum.ALI_YUN_CODE || msgType == MessageTypeEnum.TX_YUN_CODE || msgType == MessageTypeEnum.YUN_PIAN_CODE) { + } else if (msgType == MessageTypeEnum.ALI_YUN_CODE || msgType == MessageTypeEnum.TX_YUN_CODE + || msgType == MessageTypeEnum.HW_YUN_CODE || msgType == MessageTypeEnum.YUN_PIAN_CODE) { fillParaName = "预览消息用户的手机号"; paraDemo = "13910733521;13910733522"; } From 3339806d74468f3db9d77b2456c98a7499069559 Mon Sep 17 00:00:00 2001 From: duoduo Date: Sat, 14 Sep 2019 18:23:05 +0800 Subject: [PATCH 03/12] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8D=8E=E4=B8=BA=E4=BA=91=E7=9F=AD=E4=BF=A1=EF=BC=88?= =?UTF-8?q?=E6=9C=AA=E7=BB=8F=E6=B5=8B=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../push/logic/msgmaker/HwYunMsgMaker.java | 14 +- .../push/logic/msgsender/HwYunMsgSender.java | 192 +++++++++++++++--- .../push/logic/msgsender/TxYunMsgSender.java | 2 +- 3 files changed, 171 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/HwYunMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/HwYunMsgMaker.java index 38619dc3..81d321ed 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/HwYunMsgMaker.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/HwYunMsgMaker.java @@ -1,6 +1,6 @@ package com.fangxuele.tool.push.logic.msgmaker; -import com.fangxuele.tool.push.ui.form.msg.TxYunMsgForm; +import com.fangxuele.tool.push.ui.form.msg.HwYunMsgForm; import com.fangxuele.tool.push.util.TemplateUtil; import org.apache.commons.compress.utils.Lists; import org.apache.velocity.VelocityContext; @@ -18,7 +18,7 @@ */ public class HwYunMsgMaker extends BaseMsgMaker implements IMsgMaker{ - public static int templateId; + public static String templateId; public static List paramList; @@ -27,13 +27,13 @@ public class HwYunMsgMaker extends BaseMsgMaker implements IMsgMaker{ */ @Override public void prepare() { - templateId = Integer.parseInt(TxYunMsgForm.getInstance().getMsgTemplateIdTextField().getText()); + templateId = HwYunMsgForm.getInstance().getMsgTemplateIdTextField().getText(); - if (TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { - TxYunMsgForm.initTemplateDataTable(); + if (HwYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { + HwYunMsgForm.initTemplateDataTable(); } - DefaultTableModel tableModel = (DefaultTableModel) TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel(); + DefaultTableModel tableModel = (DefaultTableModel) HwYunMsgForm.getInstance().getTemplateMsgDataTable().getModel(); int rowCount = tableModel.getRowCount(); paramList = Lists.newArrayList(); for (int i = 0; i < rowCount; i++) { @@ -43,7 +43,7 @@ public void prepare() { } /** - * 组织腾讯云短信消息 + * 组织华为云短信消息 * * @param msgData 消息信息 * @return String[] diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java index d0590c36..75ef1799 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java @@ -1,11 +1,35 @@ package com.fangxuele.tool.push.logic.msgsender; +import cn.hutool.json.JSONUtil; import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.logic.PushControl; -import com.fangxuele.tool.push.logic.msgmaker.TxYunMsgMaker; -import com.github.qcloudsms.SmsSingleSender; -import com.github.qcloudsms.SmsSingleSenderResult; +import com.fangxuele.tool.push.logic.msgmaker.HwYunMsgMaker; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Hex; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.apache.http.HttpHeaders; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.methods.RequestBuilder; +import org.apache.http.client.utils.URLEncodedUtils; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.ssl.SSLContextBuilder; + +import java.nio.charset.Charset; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; +import java.util.List; +import java.util.UUID; /** *
@@ -18,43 +42,82 @@
 @Slf4j
 public class HwYunMsgSender implements IMsgSender {
     /**
-     * 腾讯云短信sender
+     * CloseableHttpClient
      */
-    public volatile static SmsSingleSender smsSingleSender;
+    public volatile static CloseableHttpClient closeableHttpClient;
+
+    //无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值
+    private static final String WSSE_HEADER_FORMAT = "UsernameToken Username=\"%s\",PasswordDigest=\"%s\",Nonce=\"%s\",Created=\"%s\"";
+    //无需修改,用于格式化鉴权头域,给"Authorization"参数赋值
+    private static final String AUTH_HEADER_VALUE = "WSSE realm=\"SDP\",profile=\"UsernameToken\",type=\"Appkey\"";
 
-    private TxYunMsgMaker txYunMsgMaker;
+    private HwYunMsgMaker hwYunMsgMaker;
 
     public HwYunMsgSender() {
-        txYunMsgMaker = new TxYunMsgMaker();
-        smsSingleSender = getTxYunSender();
+        hwYunMsgMaker = new HwYunMsgMaker();
+        closeableHttpClient = getHttpClient();
     }
 
     @Override
     public SendResult send(String[] msgData) {
         SendResult sendResult = new SendResult();
         try {
-            int templateId = TxYunMsgMaker.templateId;
-            String smsSign = App.config.getAliyunSign();
-            String[] params = txYunMsgMaker.makeMsg(msgData);
-            String telNum = msgData[0];
+            //APP接入地址+接口访问URI
+            String url = App.config.getHwAccessUrl();
+            //APP_Key
+            String appKey = App.config.getHwAppKey();
+            //APP_Secret
+            String appSecret = App.config.getHwAppSecretPassword();
+            //国内短信签名通道号或国际/港澳台短信通道号
+            String sender = App.config.getHwSenderCode();
+            String signature = App.config.getHwSignature();
+            //模板ID
+            String templateId = HwYunMsgMaker.templateId;
+            //模板变量
+            String templateParas = JSONUtil.toJsonStr(hwYunMsgMaker.makeMsg(msgData));
+            String receiver = msgData[0];
             if (PushControl.dryRun) {
                 sendResult.setSuccess(true);
                 return sendResult;
             } else {
-                SmsSingleSenderResult result = smsSingleSender.sendWithParam("86", telNum,
-                        templateId, params, smsSign, "", "");
+                //请求Body,不携带签名名称时,signature请填null
+                String body = buildRequestBody(sender, receiver, templateId, templateParas, "", signature);
+                if (null == body || body.isEmpty()) {
+                    sendResult.setSuccess(false);
+                    sendResult.setInfo("body is null.");
+                    log.error("body is null.");
+                    return sendResult;
+                }
 
-                if (result.result == 0) {
-                    sendResult.setSuccess(true);
-                } else {
+                //请求Headers中的X-WSSE参数值
+                String wsseHeader = buildWsseHeader(appKey, appSecret);
+                if (null == wsseHeader || wsseHeader.isEmpty()) {
                     sendResult.setSuccess(false);
-                    sendResult.setInfo(result.toString());
+                    sendResult.setInfo("wsse header is null.");
+                    log.error("wsse header is null.");
+                    return sendResult;
                 }
+
+                HttpResponse response = closeableHttpClient.execute(RequestBuilder.create("POST")
+                        .setUri(url)
+                        .addHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded")
+                        .addHeader(HttpHeaders.AUTHORIZATION, AUTH_HEADER_VALUE)
+                        .addHeader("X-WSSE", wsseHeader)
+                        .setEntity(new StringEntity(body)).build());
+
+//                System.out.println(response.toString()); //打印响应头域信息
+//                System.out.println(EntityUtils.toString(response.getEntity())); //打印响应消息实体
+//                if (result.result == 0) {
+                sendResult.setSuccess(true);
+//                } else {
+//                    sendResult.setSuccess(false);
+//                    sendResult.setInfo(result.toString());
+//                }
             }
         } catch (Exception e) {
             sendResult.setSuccess(false);
             sendResult.setInfo(e.getMessage());
-            log.error(e.toString());
+            log.error(ExceptionUtils.getStackTrace(e));
         }
 
         return sendResult;
@@ -66,21 +129,92 @@ public SendResult asyncSend(String[] msgData) {
     }
 
     /**
-     * 获取腾讯云短信发送客户端
+     * 获取CloseableHttpClient
      *
-     * @return SmsSingleSender
+     * @return CloseableHttpClient
      */
-    private static SmsSingleSender getTxYunSender() {
-        if (smsSingleSender == null) {
+    private static CloseableHttpClient getHttpClient() {
+        if (closeableHttpClient == null) {
             synchronized (HwYunMsgSender.class) {
-                if (smsSingleSender == null) {
-                    String txyunAppId = App.config.getTxyunAppId();
-                    String txyunAppKey = App.config.getTxyunAppKey();
-
-                    smsSingleSender = new SmsSingleSender(Integer.parseInt(txyunAppId), txyunAppKey);
+                if (closeableHttpClient == null) {
+                    try {
+                        // 为防止因HTTPS证书认证失败造成API调用失败,需要先忽略证书信任问题
+                        closeableHttpClient = HttpClients.custom()
+                                .setSSLContext(new SSLContextBuilder().loadTrustMaterial(null,
+                                        (x509CertChain, authType) -> true).build())
+                                .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
+                                .build();
+                    } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
+                        e.printStackTrace();
+                    }
                 }
             }
         }
-        return smsSingleSender;
+        return closeableHttpClient;
+    }
+
+    /**
+     * 构造请求Body体
+     *
+     * @param sender
+     * @param receiver
+     * @param templateId
+     * @param templateParas
+     * @param statusCallbackUrl
+     * @param signature         | 签名名称,使用国内短信通用模板时填写
+     * @return
+     */
+    static String buildRequestBody(String sender, String receiver, String templateId, String templateParas,
+                                   String statusCallbackUrl, String signature) {
+        if (null == sender || null == receiver || null == templateId || sender.isEmpty() || receiver.isEmpty()
+                || templateId.isEmpty()) {
+            System.out.println("buildRequestBody(): sender, receiver or templateId is null.");
+            return null;
+        }
+        List keyValues = new ArrayList<>();
+
+        keyValues.add(new BasicNameValuePair("from", sender));
+        keyValues.add(new BasicNameValuePair("to", receiver));
+        keyValues.add(new BasicNameValuePair("templateId", templateId));
+        if (null != templateParas && !templateParas.isEmpty()) {
+            keyValues.add(new BasicNameValuePair("templateParas", templateParas));
+        }
+        if (null != statusCallbackUrl && !statusCallbackUrl.isEmpty()) {
+            keyValues.add(new BasicNameValuePair("statusCallback", statusCallbackUrl));
+        }
+        if (null != signature && !signature.isEmpty()) {
+            keyValues.add(new BasicNameValuePair("signature", signature));
+        }
+
+        return URLEncodedUtils.format(keyValues, Charset.forName("UTF-8"));
+    }
+
+    /**
+     * 构造X-WSSE参数值
+     *
+     * @param appKey
+     * @param appSecret
+     * @return
+     */
+    static String buildWsseHeader(String appKey, String appSecret) {
+        if (null == appKey || null == appSecret || appKey.isEmpty() || appSecret.isEmpty()) {
+            System.out.println("buildWsseHeader(): appKey or appSecret is null.");
+            return null;
+        }
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+        String time = sdf.format(new Date()); //Created
+        String nonce = UUID.randomUUID().toString().replace("-", ""); //Nonce
+
+        byte[] passwordDigest = DigestUtils.sha256(nonce + time + appSecret);
+        String hexDigest = Hex.encodeHexString(passwordDigest);
+
+        //如果JDK版本是1.8,请加载原生Base64类,并使用如下代码
+        String passwordDigestBase64Str = Base64.getEncoder().encodeToString(hexDigest.getBytes()); //PasswordDigest
+        //如果JDK版本低于1.8,请加载三方库提供Base64类,并使用如下代码
+        //String passwordDigestBase64Str = Base64.encodeBase64String(hexDigest.getBytes(Charset.forName("utf-8"))); //PasswordDigest
+        //若passwordDigestBase64Str中包含换行符,请执行如下代码进行修正
+        //passwordDigestBase64Str = passwordDigestBase64Str.replaceAll("[\\s*\t\n\r]", "");
+
+        return String.format(WSSE_HEADER_FORMAT, appKey, passwordDigestBase64Str, nonce, time);
     }
 }
diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/TxYunMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/TxYunMsgSender.java
index 0fbefccf..8c1dacb5 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/TxYunMsgSender.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/TxYunMsgSender.java
@@ -34,7 +34,7 @@ public SendResult send(String[] msgData) {
         SendResult sendResult = new SendResult();
         try {
             int templateId = TxYunMsgMaker.templateId;
-            String smsSign = App.config.getAliyunSign();
+            String smsSign = App.config.getTxyunSign();
             String[] params = txYunMsgMaker.makeMsg(msgData);
             String telNum = msgData[0];
             if (PushControl.dryRun) {

From 13aab75a308b6f8a0f08b2d936dfc45de08747cb Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Sat, 14 Sep 2019 18:39:01 +0800
Subject: [PATCH 04/12] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E7=99=BE?=
 =?UTF-8?q?=E5=BA=A6=E4=BA=91=E7=9B=B8=E5=85=B3=E4=BE=9D=E8=B5=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 pom.xml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pom.xml b/pom.xml
index 87067cfe..c3c3317f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -303,6 +303,12 @@
             ${aliyun-java-sdk-dysmsapi.version}
         
 
+        
+            com.baidubce
+            bce-java-sdk
+            0.10.75
+        
+
     
 
     

From 81e663b24e3cc455af49fcf13180b6afd97473fe Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Sat, 14 Sep 2019 21:06:42 +0800
Subject: [PATCH 05/12] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E7=99=BE?=
 =?UTF-8?q?=E5=BA=A6=E4=BA=91=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../tool/push/ui/form/SettingForm.form        | 145 +++++++--
 .../tool/push/ui/form/SettingForm.java        | 303 ++++++++++--------
 .../push/ui/listener/SettingListener.java     |  23 +-
 .../fangxuele/tool/push/util/ConfigUtil.java  |  37 +++
 4 files changed, 357 insertions(+), 151 deletions(-)

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 fd284d2a..cdc1f038 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
@@ -36,7 +36,7 @@
                       
                     
                   
-                  
+                  
                     
                     
                       
@@ -66,7 +66,7 @@
                           
                         
                       
-                      
+                      
                         
                         
                           
@@ -81,7 +81,7 @@
                           
                             
                             
-                              
+                              
                             
                             
                             
@@ -113,7 +113,7 @@
                           
                           
                             
-                              
+                              
                             
                             
                               
@@ -122,7 +122,7 @@
                           
                             
                             
-                              
+                              
                             
                             
                             
@@ -201,7 +201,7 @@
                           
                           
                             
-                              
+                              
                             
                             
                               
@@ -210,7 +210,7 @@
                           
                             
                             
-                              
+                              
                             
                             
                             
@@ -334,17 +334,17 @@
                           
                           
                             
-                              
+                              
                             
                             
                               
                               
                             
                           
-                          
+                          
                             
                             
-                              
+                              
                             
                             
                             
@@ -359,7 +359,7 @@
                               
                               
                                 
-                                  
+                                  
                                     
                                   
                                 
@@ -375,7 +375,7 @@
                               
                               
                                 
-                                  
+                                  
                                     
                                   
                                 
@@ -391,7 +391,7 @@
                               
                               
                                 
-                                  
+                                  
                                     
                                   
                                 
@@ -407,7 +407,7 @@
                               
                               
                                 
-                                  
+                                  
                                     
                                   
                                 
@@ -423,7 +423,7 @@
                               
                               
                                 
-                                  
+                                  
                                     
                                     
                                   
@@ -434,7 +434,7 @@
                           
                           
                             
-                              
+                              
                             
                           
                         
@@ -1041,12 +1041,115 @@
                           
                         
                       
-                      
+                      
                         
                         
                           
                         
                         
+                        
+                          
+                        
+                        
+                          
+                            
+                              
+                            
+                            
+                              
+                            
+                          
+                          
+                            
+                              
+                            
+                            
+                              
+                            
+                          
+                          
+                            
+                              
+                            
+                            
+                              
+                            
+                          
+                          
+                            
+                              
+                            
+                            
+                              
+                            
+                          
+                          
+                            
+                              
+                                
+                              
+                            
+                            
+                          
+                          
+                            
+                              
+                                
+                              
+                            
+                            
+                          
+                          
+                            
+                              
+                                
+                              
+                            
+                            
+                              
+                            
+                          
+                          
+                            
+                            
+                              
+                            
+                            
+                            
+                            
+                              
+                                
+                                  
+                                
+                                
+                                  
+                                  
+                                
+                              
+                              
+                                
+                                  
+                                
+                              
+                            
+                          
+                          
+                            
+                              
+                                
+                                
+                              
+                            
+                            
+                          
+                        
+                      
+                      
+                        
+                        
+                          
+                        
+                        
                         
                           
                         
@@ -1099,7 +1202,7 @@
                       
                         
                         
-                          
+                          
                         
                         
                         
@@ -1241,7 +1344,7 @@
                       
                         
                         
-                          
+                          
                         
                         
                         
@@ -1335,7 +1438,7 @@
                       
                         
                         
-                          
+                          
                         
                         
                         
@@ -1454,7 +1557,7 @@
                       
                         
                         
-                          
+                          
                         
                         
                           
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 cdc6d7e5..273173af 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
@@ -110,6 +110,11 @@ public class SettingForm {
     private JTextField hwAccessUrlTextField;
     private JTextField hwSignatureTextField;
     private JTextField hwSenderCodeTextField;
+    private JPasswordField bdSecretAccessKeyPasswordField;
+    private JButton bdSaveButton;
+    private JTextField bdAccessKeyIdTextField;
+    private JTextField bdEndPointTextField;
+    private JTextField bdInvokeIdTextField;
 
     private static SettingForm settingForm;
     private static TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class);
@@ -202,6 +207,12 @@ public static void init() {
         settingForm.getHwSenderCodeTextField().setText(App.config.getHwSenderCode());
         settingForm.getHwSignatureTextField().setText(App.config.getHwSignature());
 
+        // 百度云短信
+        settingForm.getBdAccessKeyIdTextField().setText(App.config.getBdAccessKeyId());
+        settingForm.getBdSecretAccessKeyPasswordField().setText(App.config.getBdSecretAccessKey());
+        settingForm.getBdEndPointTextField().setText(App.config.getBdEndPoint());
+        settingForm.getBdInvokeIdTextField().setText(App.config.getBdInvokeId());
+
         // 云片网短信
         settingForm.getYunpianApiKeyTextField().setText(App.config.getYunpianApiKey());
 
@@ -362,7 +373,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(13, 1, new Insets(0, 60, 0, 330), -1, -1));
+        panel3.setLayout(new GridLayoutManager(14, 1, new Insets(0, 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(1, 1, new Insets(15, 15, 10, 0), -1, -1));
@@ -372,14 +383,14 @@ public static void toggleMpOutSideAccessTokenPanel() {
         autoCheckUpdateCheckBox.setText("启动时自动检查更新");
         panel4.add(autoCheckUpdateCheckBox, 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));
         final JPanel panel5 = new JPanel();
-        panel5.setLayout(new GridLayoutManager(10, 3, new Insets(15, 15, 10, 0), -1, -1));
+        panel5.setLayout(new GridLayoutManager(6, 3, new Insets(15, 15, 10, 0), -1, -1));
         Font panel5Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel5.getFont());
         if (panel5Font != null) panel5.setFont(panel5Font);
         panel3.add(panel5, 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));
         panel5.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "微信公众号", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel5.getFont())));
         final JPanel panel6 = new JPanel();
         panel6.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
-        panel5.add(panel6, new GridConstraints(9, 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));
+        panel5.add(panel6, new GridConstraints(5, 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));
         settingMpInfoSaveButton = new JButton();
         settingMpInfoSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
         settingMpInfoSaveButton.setText("保存");
@@ -392,10 +403,10 @@ public static void toggleMpOutSideAccessTokenPanel() {
         panel6.add(mpAccountManageButton, 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));
         mpUseProxyCheckBox = new JCheckBox();
         mpUseProxyCheckBox.setText("使用HTTP代理");
-        panel5.add(mpUseProxyCheckBox, new GridConstraints(7, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel5.add(mpUseProxyCheckBox, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         mpProxyPanel = new JPanel();
         mpProxyPanel.setLayout(new GridLayoutManager(4, 2, new Insets(0, 26, 0, 0), -1, -1));
-        panel5.add(mpProxyPanel, new GridConstraints(8, 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));
+        panel5.add(mpProxyPanel, new GridConstraints(4, 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));
         final JLabel label1 = new JLabel();
         label1.setText("Host");
         mpProxyPanel.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
@@ -422,10 +433,10 @@ public static void toggleMpOutSideAccessTokenPanel() {
         mpProxyPanel.add(mpProxyPasswordTextField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         useOutSideAccessTokenCheckBox = new JCheckBox();
         useOutSideAccessTokenCheckBox.setText("使用外部AccessToken");
-        panel5.add(useOutSideAccessTokenCheckBox, new GridConstraints(5, 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));
+        panel5.add(useOutSideAccessTokenCheckBox, new GridConstraints(1, 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));
         mpOutSideAccessTokenPanel = new JPanel();
         mpOutSideAccessTokenPanel.setLayout(new GridLayoutManager(5, 4, new Insets(0, 26, 0, 0), -1, -1));
-        panel5.add(mpOutSideAccessTokenPanel, new GridConstraints(6, 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));
+        panel5.add(mpOutSideAccessTokenPanel, new GridConstraints(2, 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));
         manualAtRadioButton = new JRadioButton();
         manualAtRadioButton.setText("手动输入");
         mpOutSideAccessTokenPanel.add(manualAtRadioButton, 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));
@@ -470,37 +481,37 @@ public static void toggleMpOutSideAccessTokenPanel() {
         outSideAtTipsLabel = new JLabel();
         outSideAtTipsLabel.setIcon(new ImageIcon(getClass().getResource("/icon/helpButton.png")));
         outSideAtTipsLabel.setText("");
-        panel5.add(outSideAtTipsLabel, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel5.add(outSideAtTipsLabel, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         final JPanel panel9 = new JPanel();
-        panel9.setLayout(new GridLayoutManager(5, 4, new Insets(0, 0, 0, 0), -1, -1));
-        panel5.add(panel9, new GridConstraints(0, 0, 5, 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));
+        panel9.setLayout(new GridLayoutManager(5, 2, new Insets(0, 0, 0, 0), -1, -1));
+        panel5.add(panel9, 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));
         final JLabel label8 = new JLabel();
         label8.setText("AppID");
         panel9.add(label8, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         wechatAppIdTextField = new JTextField();
-        panel9.add(wechatAppIdTextField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        panel9.add(wechatAppIdTextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         final JLabel label9 = new JLabel();
         label9.setText("AppSecret");
         panel9.add(label9, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         wechatAppSecretPasswordField = new JPasswordField();
-        panel9.add(wechatAppSecretPasswordField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        panel9.add(wechatAppSecretPasswordField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         final JLabel label10 = new JLabel();
         label10.setText("Token");
         panel9.add(label10, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         wechatTokenPasswordField = new JPasswordField();
-        panel9.add(wechatTokenPasswordField, new GridConstraints(3, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        panel9.add(wechatTokenPasswordField, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         final JLabel label11 = new JLabel();
         label11.setText("AES Key");
         panel9.add(label11, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         wechatAesKeyPasswordField = new JPasswordField();
-        panel9.add(wechatAesKeyPasswordField, new GridConstraints(4, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        panel9.add(wechatAesKeyPasswordField, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         final JLabel label12 = new JLabel();
         label12.setText("切换账号");
         panel9.add(label12, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         mpAccountSwitchComboBox = new JComboBox();
-        panel9.add(mpAccountSwitchComboBox, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
+        panel9.add(mpAccountSwitchComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
         final Spacer spacer5 = new Spacer();
-        panel5.add(spacer5, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        panel5.add(spacer5, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
         final JPanel panel10 = new JPanel();
         panel10.setLayout(new GridLayoutManager(8, 3, new Insets(15, 15, 10, 0), -1, -1));
         Font panel10Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel10.getFont());
@@ -706,122 +717,156 @@ public static void toggleMpOutSideAccessTokenPanel() {
         hwAppKeyTextField = new JTextField();
         panel20.add(hwAppKeyTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
         final JPanel panel22 = new JPanel();
-        panel22.setLayout(new GridLayoutManager(2, 4, new Insets(15, 15, 10, 0), -1, -1));
+        panel22.setLayout(new GridLayoutManager(5, 4, new Insets(15, 15, 10, 0), -1, -1));
         panel3.add(panel22, new GridConstraints(8, 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));
-        panel22.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "云片网短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel22.getFont())));
+        panel22.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "百度云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel22.getFont())));
         final JLabel label34 = new JLabel();
-        label34.setText("ApiKey");
+        label34.setText("AccessKeyID");
         panel22.add(label34, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        yunpianApiKeyTextField = new JPasswordField();
-        yunpianApiKeyTextField.setText("");
-        panel22.add(yunpianApiKeyTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
+        final JLabel label35 = new JLabel();
+        label35.setText("SecretAccessKey");
+        panel22.add(label35, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label36 = new JLabel();
+        label36.setText("SMS服务域名");
+        panel22.add(label36, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label37 = new JLabel();
+        label37.setText("签名的调用ID");
+        panel22.add(label37, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        bdEndPointTextField = new JTextField();
+        panel22.add(bdEndPointTextField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        bdInvokeIdTextField = new JTextField();
+        panel22.add(bdInvokeIdTextField, new GridConstraints(3, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        bdSecretAccessKeyPasswordField = new JPasswordField();
+        bdSecretAccessKeyPasswordField.setText("");
+        panel22.add(bdSecretAccessKeyPasswordField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         final JPanel panel23 = new JPanel();
         panel23.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
-        panel22.add(panel23, new GridConstraints(1, 0, 1, 4, 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));
-        settingYunpianSaveButton = new JButton();
-        settingYunpianSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
-        settingYunpianSaveButton.setText("保存");
-        panel23.add(settingYunpianSaveButton, 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));
+        panel22.add(panel23, new GridConstraints(4, 0, 1, 4, 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));
+        bdSaveButton = new JButton();
+        bdSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
+        bdSaveButton.setText("保存");
+        panel23.add(bdSaveButton, 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 spacer12 = new Spacer();
         panel23.add(spacer12, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        bdAccessKeyIdTextField = new JTextField();
+        panel22.add(bdAccessKeyIdTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
         final JPanel panel24 = new JPanel();
-        panel24.setLayout(new GridLayoutManager(8, 4, new Insets(15, 15, 10, 0), -1, -1));
-        panel3.add(panel24, new GridConstraints(10, 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));
-        panel24.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "E-Mail", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel24.getFont())));
-        final JLabel label35 = new JLabel();
-        label35.setText("邮件服务器的SMTP地址");
-        panel24.add(label35, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JLabel label36 = new JLabel();
-        label36.setText("邮件服务器的SMTP端口");
-        panel24.add(label36, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JLabel label37 = new JLabel();
-        label37.setText("发件人(邮箱地址)");
-        panel24.add(label37, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel24.setLayout(new GridLayoutManager(2, 4, new Insets(15, 15, 10, 0), -1, -1));
+        panel3.add(panel24, new GridConstraints(9, 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));
+        panel24.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "云片网短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel24.getFont())));
         final JLabel label38 = new JLabel();
-        label38.setText("用户名");
-        label38.setToolTipText("如果使用foxmail邮箱,此处为qq号");
-        panel24.add(label38, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JLabel label39 = new JLabel();
-        label39.setText("密码");
-        panel24.add(label39, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        label38.setText("ApiKey");
+        panel24.add(label38, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        yunpianApiKeyTextField = new JPasswordField();
+        yunpianApiKeyTextField.setText("");
+        panel24.add(yunpianApiKeyTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
         final JPanel panel25 = new JPanel();
-        panel25.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
-        panel24.add(panel25, new GridConstraints(7, 0, 1, 4, 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));
+        panel25.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
+        panel24.add(panel25, new GridConstraints(1, 0, 1, 4, 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));
+        settingYunpianSaveButton = new JButton();
+        settingYunpianSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
+        settingYunpianSaveButton.setText("保存");
+        panel25.add(settingYunpianSaveButton, 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 spacer13 = new Spacer();
+        panel25.add(spacer13, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        final JPanel panel26 = new JPanel();
+        panel26.setLayout(new GridLayoutManager(8, 4, new Insets(15, 15, 10, 0), -1, -1));
+        panel3.add(panel26, new GridConstraints(11, 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));
+        panel26.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "E-Mail", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel26.getFont())));
+        final JLabel label39 = new JLabel();
+        label39.setText("邮件服务器的SMTP地址");
+        panel26.add(label39, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label40 = new JLabel();
+        label40.setText("邮件服务器的SMTP端口");
+        panel26.add(label40, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label41 = new JLabel();
+        label41.setText("发件人(邮箱地址)");
+        panel26.add(label41, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label42 = new JLabel();
+        label42.setText("用户名");
+        label42.setToolTipText("如果使用foxmail邮箱,此处为qq号");
+        panel26.add(label42, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label43 = new JLabel();
+        label43.setText("密码");
+        panel26.add(label43, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JPanel panel27 = new JPanel();
+        panel27.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
+        panel26.add(panel27, new GridConstraints(7, 0, 1, 4, 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));
         saveMailButton = new JButton();
         saveMailButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
         saveMailButton.setText("保存");
-        panel25.add(saveMailButton, 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 Spacer spacer13 = new Spacer();
-        panel25.add(spacer13, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        panel27.add(saveMailButton, 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 Spacer spacer14 = new Spacer();
+        panel27.add(spacer14, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
         testMailButton = new JButton();
         testMailButton.setIcon(new ImageIcon(getClass().getResource("/icon/arrow_right.png")));
         testMailButton.setText("测试");
-        panel25.add(testMailButton, 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));
+        panel27.add(testMailButton, 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));
         mailStartTLSCheckBox = new JCheckBox();
         mailStartTLSCheckBox.setText("使用STARTTLS安全连接");
-        panel24.add(mailStartTLSCheckBox, new GridConstraints(5, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel26.add(mailStartTLSCheckBox, new GridConstraints(5, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         mailSSLCheckBox = new JCheckBox();
         mailSSLCheckBox.setText("使用SSL安全连接");
-        panel24.add(mailSSLCheckBox, new GridConstraints(6, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel26.add(mailSSLCheckBox, new GridConstraints(6, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         mailHostTextField = new JTextField();
-        panel24.add(mailHostTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        panel26.add(mailHostTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         mailPortTextField = new JTextField();
-        panel24.add(mailPortTextField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        panel26.add(mailPortTextField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         mailFromTextField = new JTextField();
-        panel24.add(mailFromTextField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        panel26.add(mailFromTextField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         mailUserTextField = new JTextField();
-        panel24.add(mailUserTextField, new GridConstraints(3, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        panel26.add(mailUserTextField, new GridConstraints(3, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         mailPasswordField = new JPasswordField();
-        panel24.add(mailPasswordField, new GridConstraints(4, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
-        final JPanel panel26 = new JPanel();
-        panel26.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1));
-        panel3.add(panel26, new GridConstraints(11, 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));
-        panel26.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "MySQL数据库", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel26.getFont())));
-        final JLabel label40 = new JLabel();
-        label40.setText("数据库地址");
-        panel26.add(label40, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel26.add(mailPasswordField, new GridConstraints(4, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        final JPanel panel28 = new JPanel();
+        panel28.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1));
+        panel3.add(panel28, 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));
+        panel28.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "MySQL数据库", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel28.getFont())));
+        final JLabel label44 = new JLabel();
+        label44.setText("数据库地址");
+        panel28.add(label44, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         mysqlUrlTextField = new JTextField();
-        panel26.add(mysqlUrlTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
-        final JLabel label41 = new JLabel();
-        label41.setText("用户名");
-        panel26.add(label41, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel28.add(mysqlUrlTextField, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
+        final JLabel label45 = new JLabel();
+        label45.setText("用户名");
+        panel28.add(label45, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         mysqlUserTextField = new JTextField();
-        panel26.add(mysqlUserTextField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
-        final JLabel label42 = new JLabel();
-        label42.setText("密码");
-        panel26.add(label42, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel28.add(mysqlUserTextField, new GridConstraints(1, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        final JLabel label46 = new JLabel();
+        label46.setText("密码");
+        panel28.add(label46, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         mysqlPasswordField = new JPasswordField();
-        panel26.add(mysqlPasswordField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
-        final JPanel panel27 = new JPanel();
-        panel27.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
-        panel26.add(panel27, new GridConstraints(3, 0, 1, 4, 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));
+        panel28.add(mysqlPasswordField, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        final JPanel panel29 = new JPanel();
+        panel29.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
+        panel28.add(panel29, new GridConstraints(3, 0, 1, 4, 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));
         settingTestDbLinkButton = new JButton();
         settingTestDbLinkButton.setIcon(new ImageIcon(getClass().getResource("/icon/arrow_right.png")));
         settingTestDbLinkButton.setText("测试连接");
-        panel27.add(settingTestDbLinkButton, 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 spacer14 = new Spacer();
-        panel27.add(spacer14, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        panel29.add(settingTestDbLinkButton, 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 spacer15 = new Spacer();
+        panel29.add(spacer15, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
         settingDbInfoSaveButton = new JButton();
         settingDbInfoSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
         settingDbInfoSaveButton.setText("保存");
-        panel27.add(settingDbInfoSaveButton, 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 panel28 = new JPanel();
-        panel28.setLayout(new GridLayoutManager(4, 3, new Insets(15, 15, 10, 0), -1, -1));
-        panel3.add(panel28, 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));
-        panel28.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "外观", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel28.getFont())));
-        final JLabel label43 = new JLabel();
-        label43.setText("主题风格");
-        panel28.add(label43, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel29.add(settingDbInfoSaveButton, 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 panel30 = new JPanel();
+        panel30.setLayout(new GridLayoutManager(4, 3, new Insets(15, 15, 10, 0), -1, -1));
+        panel3.add(panel30, new GridConstraints(13, 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));
+        panel30.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "外观", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel30.getFont())));
+        final JLabel label47 = new JLabel();
+        label47.setText("主题风格");
+        panel30.add(label47, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         settingThemeComboBox = new JComboBox();
         final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
         defaultComboBoxModel1.addElement("Darcula(推荐)");
         defaultComboBoxModel1.addElement("BeautyEye");
         defaultComboBoxModel1.addElement("系统默认");
         settingThemeComboBox.setModel(defaultComboBoxModel1);
-        panel28.add(settingThemeComboBox, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
-        final JLabel label44 = new JLabel();
-        label44.setText("字体");
-        panel28.add(label44, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel30.add(settingThemeComboBox, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(300, -1), new Dimension(300, -1), null, 0, false));
+        final JLabel label48 = new JLabel();
+        label48.setText("字体");
+        panel30.add(label48, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         settingFontNameComboBox = new JComboBox();
         final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel();
         defaultComboBoxModel2.addElement("Microsoft YaHei");
@@ -829,10 +874,10 @@ public static void toggleMpOutSideAccessTokenPanel() {
         defaultComboBoxModel2.addElement("Microsoft YaHei UI");
         defaultComboBoxModel2.addElement("Microsoft YaHei UI Light");
         settingFontNameComboBox.setModel(defaultComboBoxModel2);
-        panel28.add(settingFontNameComboBox, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JLabel label45 = new JLabel();
-        label45.setText("字号");
-        panel28.add(label45, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel30.add(settingFontNameComboBox, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label49 = new JLabel();
+        label49.setText("字号");
+        panel30.add(label49, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         settingFontSizeComboBox = new JComboBox();
         final DefaultComboBoxModel defaultComboBoxModel3 = new DefaultComboBoxModel();
         defaultComboBoxModel3.addElement("5");
@@ -858,51 +903,51 @@ public static void toggleMpOutSideAccessTokenPanel() {
         defaultComboBoxModel3.addElement("25");
         defaultComboBoxModel3.addElement("26");
         settingFontSizeComboBox.setModel(defaultComboBoxModel3);
-        panel28.add(settingFontSizeComboBox, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JPanel panel29 = new JPanel();
-        panel29.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
-        panel28.add(panel29, new GridConstraints(3, 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));
+        panel30.add(settingFontSizeComboBox, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JPanel panel31 = new JPanel();
+        panel31.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
+        panel30.add(panel31, new GridConstraints(3, 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));
         settingAppearanceSaveButton = new JButton();
         settingAppearanceSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
         settingAppearanceSaveButton.setText("保存");
-        panel29.add(settingAppearanceSaveButton, 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 spacer15 = new Spacer();
-        panel29.add(spacer15, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
-        final JPanel panel30 = new JPanel();
-        panel30.setLayout(new GridLayoutManager(3, 3, new Insets(15, 15, 10, 0), -1, -1));
-        Font panel30Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel30.getFont());
-        if (panel30Font != null) panel30.setFont(panel30Font);
-        panel3.add(panel30, new GridConstraints(9, 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));
-        panel30.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel30.getFont())));
-        final JPanel panel31 = new JPanel();
-        panel31.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
-        panel30.add(panel31, new GridConstraints(2, 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));
+        panel31.add(settingAppearanceSaveButton, 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 spacer16 = new Spacer();
+        panel31.add(spacer16, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        final JPanel panel32 = new JPanel();
+        panel32.setLayout(new GridLayoutManager(3, 3, new Insets(15, 15, 10, 0), -1, -1));
+        Font panel32Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel32.getFont());
+        if (panel32Font != null) panel32.setFont(panel32Font);
+        panel3.add(panel32, new GridConstraints(10, 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));
+        panel32.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel32.getFont())));
+        final JPanel panel33 = new JPanel();
+        panel33.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
+        panel32.add(panel33, new GridConstraints(2, 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));
         httpSaveButton = new JButton();
         httpSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
         httpSaveButton.setText("保存");
-        panel31.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 spacer16 = new Spacer();
-        panel31.add(spacer16, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        panel33.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 spacer17 = new Spacer();
+        panel33.add(spacer17, 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代理");
-        panel30.add(httpUseProxyCheckBox, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel32.add(httpUseProxyCheckBox, new GridConstraints(0, 0, 1, 3, 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));
-        panel30.add(httpProxyPanel, new GridConstraints(1, 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));
-        final JLabel label46 = new JLabel();
-        label46.setText("Host");
-        httpProxyPanel.add(label46, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel32.add(httpProxyPanel, new GridConstraints(1, 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));
+        final JLabel label50 = new JLabel();
+        label50.setText("Host");
+        httpProxyPanel.add(label50, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         httpProxyHostTextField = new JTextField();
         httpProxyPanel.add(httpProxyHostTextField, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
-        final JLabel label47 = new JLabel();
-        label47.setText("端口");
-        httpProxyPanel.add(label47, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JLabel label48 = new JLabel();
-        label48.setText("用户名");
-        httpProxyPanel.add(label48, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JLabel label49 = new JLabel();
-        label49.setText("密码");
-        httpProxyPanel.add(label49, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label51 = new JLabel();
+        label51.setText("端口");
+        httpProxyPanel.add(label51, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label52 = new JLabel();
+        label52.setText("用户名");
+        httpProxyPanel.add(label52, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label53 = new JLabel();
+        label53.setText("密码");
+        httpProxyPanel.add(label53, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         httpProxyPortTextField = new JTextField();
         httpProxyPanel.add(httpProxyPortTextField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         httpProxyUserTextField = new JTextField();
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 7e944399..dead114f 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
@@ -7,6 +7,7 @@
 import com.fangxuele.tool.push.domain.TWxAccount;
 import com.fangxuele.tool.push.logic.msgsender.AliYunMsgSender;
 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.TxYunMsgSender;
 import com.fangxuele.tool.push.logic.msgsender.WxMaTemplateMsgSender;
@@ -314,7 +315,27 @@ public static void addListeners() {
                 App.config.setHwSignature(settingForm.getHwSignatureTextField().getText());
                 App.config.save();
 
-//          TODO      TxYunMsgSender.smsSingleSender = null;
+                HwYunMsgSender.closeableHttpClient = null;
+
+                JOptionPane.showMessageDialog(settingPanel, "保存成功!", "成功",
+                        JOptionPane.INFORMATION_MESSAGE);
+            } catch (Exception e1) {
+                JOptionPane.showMessageDialog(settingPanel, "保存失败!\n\n" + e1.getMessage(), "失败",
+                        JOptionPane.ERROR_MESSAGE);
+                logger.error(e1);
+            }
+        });
+
+        // 设置-百度云短信-保存
+        settingForm.getBdSaveButton().addActionListener(e -> {
+            try {
+                App.config.setBdAccessKeyId(settingForm.getBdAccessKeyIdTextField().getText());
+                App.config.setBdSecretAccessKey(new String(settingForm.getBdSecretAccessKeyPasswordField().getPassword()));
+                App.config.setBdEndPoint(settingForm.getBdEndPointTextField().getText());
+                App.config.setBdInvokeId(settingForm.getBdInvokeIdTextField().getText());
+                App.config.save();
+
+//                TODO HwYunMsgSender.closeableHttpClient = null;
 
                 JOptionPane.showMessageDialog(settingPanel, "保存成功!", "成功",
                         JOptionPane.INFORMATION_MESSAGE);
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 2213217e..f1cd243a 100644
--- a/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java
+++ b/src/main/java/com/fangxuele/tool/push/util/ConfigUtil.java
@@ -147,6 +147,11 @@ private ConfigUtil() {
     private String hwSignature;
     private String hwSenderCode;
 
+    private String bdSecretAccessKey;
+    private String bdAccessKeyId;
+    private String bdEndPoint;
+    private String bdInvokeId;
+
     private String yunpianApiKey;
 
     private boolean httpUseProxy;
@@ -827,6 +832,38 @@ public void setHwSenderCode(String hwSenderCode) {
         setting.put("setting.hwyun", "hwSenderCode", hwSenderCode);
     }
 
+    public String getBdSecretAccessKey() {
+        return setting.getStr("bdSecretAccessKey", "setting.bdyun", "");
+    }
+
+    public void setBdSecretAccessKey(String bdSecretAccessKey) {
+        setting.put("setting.bdyun", "bdSecretAccessKey", bdSecretAccessKey);
+    }
+
+    public String getBdAccessKeyId() {
+        return setting.getStr("bdAccessKeyId", "setting.bdyun", "");
+    }
+
+    public void setBdAccessKeyId(String bdAccessKeyId) {
+        setting.put("setting.bdyun", "bdAccessKeyId", bdAccessKeyId);
+    }
+
+    public String getBdEndPoint() {
+        return setting.getStr("bdEndPoint", "setting.bdyun", "");
+    }
+
+    public void setBdEndPoint(String bdEndPoint) {
+        setting.put("setting.bdyun", "bdEndPoint", bdEndPoint);
+    }
+
+    public String getBdInvokeId() {
+        return setting.getStr("bdInvokeId", "setting.bdyun", "");
+    }
+
+    public void setBdInvokeId(String bdInvokeId) {
+        setting.put("setting.bdyun", "bdInvokeId", bdInvokeId);
+    }
+
     public String getYunpianApiKey() {
         return setting.getStr("apiKey", "setting.yunpian", "");
     }

From 6a4cee18f08bf12dc00e5848d9005f91960a7746 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Sat, 14 Sep 2019 21:20:44 +0800
Subject: [PATCH 06/12] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E7=99=BE?=
 =?UTF-8?q?=E5=BA=A6=E4=BA=91=E8=A1=A8=E5=8D=95=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../tool/push/logic/MessageTypeEnum.java      |   8 +-
 .../tool/push/logic/PushControl.java          |  11 +
 .../push/logic/msgmaker/BdYunMsgMaker.java    |  61 ++++
 .../push/logic/msgmaker/MsgMakerFactory.java  |   3 +
 .../push/logic/msgsender/BdYunMsgSender.java  |  86 +++++
 .../logic/msgsender/MsgSenderFactory.java     |   3 +
 .../tool/push/ui/form/MessageEditForm.java    |   4 +
 .../tool/push/ui/form/MessageTypeForm.form    |  22 +-
 .../tool/push/ui/form/MessageTypeForm.java    |  21 +-
 .../tool/push/ui/form/msg/BdYunMsgForm.form   | 121 +++++++
 .../tool/push/ui/form/msg/BdYunMsgForm.java   | 315 ++++++++++++++++++
 .../tool/push/ui/form/msg/MsgFormFactory.java |   3 +
 .../push/ui/listener/MessageTypeListener.java |   4 +
 .../push/ui/listener/MsgEditListener.java     |   3 +-
 14 files changed, 643 insertions(+), 22 deletions(-)
 create mode 100644 src/main/java/com/fangxuele/tool/push/logic/msgmaker/BdYunMsgMaker.java
 create mode 100644 src/main/java/com/fangxuele/tool/push/logic/msgsender/BdYunMsgSender.java
 create mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.form
 create mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java

diff --git a/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java b/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java
index 66cdc7e1..a89405e2 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java
@@ -24,7 +24,8 @@ public enum MessageTypeEnum {
     EMAIL(11, "E-Mail"),
     WX_CP(12, "微信企业号/企业微信"),
     HTTP(13, "HTTP请求"),
-    DING(14, "钉钉");
+    DING(14, "钉钉"),
+    BD_YUN(15, "百度云短信");
 
     private int code;
 
@@ -43,6 +44,7 @@ public enum MessageTypeEnum {
     public static final int WX_CP_CODE = 12;
     public static final int HTTP_CODE = 13;
     public static final int DING_CODE = 14;
+    public static final int BD_YUN_CODE = 15;
 
     MessageTypeEnum(int code, String name) {
         this.code = code;
@@ -91,7 +93,11 @@ public static String getName(int code) {
             case 14:
                 name = DING.name;
                 break;
+            case 15:
+                name = BD_YUN.name;
+                break;
             default:
+                name = "";
         }
         return name;
     }
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 492b712b..c3933743 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/PushControl.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/PushControl.java
@@ -186,6 +186,17 @@ public static boolean configCheck() {
                     return false;
                 }
                 break;
+            case MessageTypeEnum.BD_YUN_CODE:
+                String bdAccessKeyId = App.config.getBdAccessKeyId();
+                String bdSecretAccessKey = App.config.getBdSecretAccessKey();
+
+                if (StringUtils.isEmpty(bdAccessKeyId) || StringUtils.isEmpty(bdSecretAccessKey)) {
+                    JOptionPane.showMessageDialog(settingForm.getSettingPanel(),
+                            "请先在设置中填写并保存百度云短信相关配置!", "提示",
+                            JOptionPane.INFORMATION_MESSAGE);
+                    return false;
+                }
+                break;
             case MessageTypeEnum.HW_YUN_CODE:
                 String hwAppKey = App.config.getHwAppKey();
                 String hwAppSecretPassword = App.config.getHwAppSecretPassword();
diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/BdYunMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/BdYunMsgMaker.java
new file mode 100644
index 00000000..17973d1c
--- /dev/null
+++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/BdYunMsgMaker.java
@@ -0,0 +1,61 @@
+package com.fangxuele.tool.push.logic.msgmaker;
+
+import com.fangxuele.tool.push.ui.form.msg.TxYunMsgForm;
+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 BdYunMsgMaker extends BaseMsgMaker implements IMsgMaker{ + + public static int templateId; + + public static List paramList; + + /** + * 准备(界面字段等) + */ + @Override + public void prepare() { + templateId = Integer.parseInt(TxYunMsgForm.getInstance().getMsgTemplateIdTextField().getText()); + + if (TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) { + TxYunMsgForm.initTemplateDataTable(); + } + + DefaultTableModel tableModel = (DefaultTableModel) TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel(); + int rowCount = tableModel.getRowCount(); + paramList = Lists.newArrayList(); + for (int i = 0; i < rowCount; i++) { + String value = ((String) tableModel.getValueAt(i, 1)); + paramList.add(value); + } + } + + /** + * 组织百度云短信消息 + * + * @param msgData 消息信息 + * @return String[] + */ + @Override + public String[] makeMsg(String[] msgData) { + + VelocityContext velocityContext = getVelocityContext(msgData); + for (int i = 0; i < paramList.size(); i++) { + paramList.set(i, TemplateUtil.evaluate(paramList.get(i), velocityContext)); + } + String[] paramArray = new String[paramList.size()]; + return paramList.toArray(paramArray); + } +} 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 e4735fcb..436b30ab 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 @@ -54,6 +54,9 @@ public static IMsgMaker getMsgMaker() { case MessageTypeEnum.DING_CODE: iMsgMaker = new DingMsgMaker(); break; + case MessageTypeEnum.BD_YUN_CODE: + iMsgMaker = new BdYunMsgMaker(); + break; default: } return iMsgMaker; diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/BdYunMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/BdYunMsgSender.java new file mode 100644 index 00000000..ac97092e --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/BdYunMsgSender.java @@ -0,0 +1,86 @@ +package com.fangxuele.tool.push.logic.msgsender; + +import com.fangxuele.tool.push.App; +import com.fangxuele.tool.push.logic.PushControl; +import com.fangxuele.tool.push.logic.msgmaker.TxYunMsgMaker; +import com.github.qcloudsms.SmsSingleSender; +import com.github.qcloudsms.SmsSingleSenderResult; +import lombok.extern.slf4j.Slf4j; + +/** + *
+ * 百度云模板短信发送器
+ * 
+ * + * @author RememBerBer + * @since 2019/6/15. + */ +@Slf4j +public class BdYunMsgSender implements IMsgSender { + /** + * 百度云短信sender + */ + public volatile static SmsSingleSender smsSingleSender; + + private TxYunMsgMaker txYunMsgMaker; + + public BdYunMsgSender() { + txYunMsgMaker = new TxYunMsgMaker(); + smsSingleSender = getTxYunSender(); + } + + @Override + public SendResult send(String[] msgData) { + SendResult sendResult = new SendResult(); + try { + int templateId = TxYunMsgMaker.templateId; + String smsSign = App.config.getTxyunSign(); + String[] params = txYunMsgMaker.makeMsg(msgData); + String telNum = msgData[0]; + if (PushControl.dryRun) { + sendResult.setSuccess(true); + return sendResult; + } else { + SmsSingleSenderResult result = smsSingleSender.sendWithParam("86", telNum, + templateId, params, smsSign, "", ""); + + if (result.result == 0) { + sendResult.setSuccess(true); + } else { + sendResult.setSuccess(false); + sendResult.setInfo(result.toString()); + } + } + } catch (Exception e) { + sendResult.setSuccess(false); + sendResult.setInfo(e.getMessage()); + log.error(e.toString()); + } + + return sendResult; + } + + @Override + public SendResult asyncSend(String[] msgData) { + return null; + } + + /** + * 获取百度云短信发送客户端 + * + * @return SmsSingleSender + */ + private static SmsSingleSender getTxYunSender() { + if (smsSingleSender == null) { + synchronized (BdYunMsgSender.class) { + if (smsSingleSender == null) { + String txyunAppId = App.config.getTxyunAppId(); + String txyunAppKey = App.config.getTxyunAppKey(); + + smsSingleSender = new SmsSingleSender(Integer.parseInt(txyunAppId), txyunAppKey); + } + } + } + return smsSingleSender; + } +} 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 cc661df8..de074f27 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 @@ -57,6 +57,9 @@ public static IMsgSender getMsgSender() { case MessageTypeEnum.DING_CODE: iMsgSender = new DingMsgSender(); break; + case MessageTypeEnum.BD_YUN_CODE: + iMsgSender = new BdYunMsgSender(); + break; default: break; } 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 44258723..1435c0f0 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 @@ -3,6 +3,7 @@ import com.fangxuele.tool.push.App; import com.fangxuele.tool.push.logic.MessageTypeEnum; 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; @@ -131,6 +132,9 @@ public static void switchMsgType(int msgType) { case MessageTypeEnum.DING_CODE: messageEditForm.getMsgEditorPanel().add(DingMsgForm.getInstance().getDingMsgPanel(), gridConstraintsRow0); break; + case MessageTypeEnum.BD_YUN_CODE: + messageEditForm.getMsgEditorPanel().add(BdYunMsgForm.getInstance().getTemplateMsgPanel(), gridConstraintsRow0); + break; default: break; } diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form index ff8e13cb..55542276 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form @@ -79,7 +79,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -150,7 +150,7 @@ - + @@ -168,7 +168,7 @@ - + @@ -198,22 +198,22 @@ - + - + - - + + - + - + - + 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 44086c90..5aa24e6c 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 @@ -43,7 +43,7 @@ public class MessageTypeForm { private JLabel kefuPriorityTipsLabel; private JRadioButton httpRadioButton; private JRadioButton 七牛云短信RadioButton; - private JRadioButton 百度云短信RadioButton; + private JRadioButton bdYunRadioButton; private static MessageTypeForm messageTypeForm; @@ -109,6 +109,9 @@ public static void init() { case MessageTypeEnum.DING_CODE: messageTypeForm.getDingRadioButton().setSelected(true); break; + case MessageTypeEnum.BD_YUN_CODE: + messageTypeForm.getBdYunRadioButton().setSelected(true); + break; default: } @@ -224,11 +227,11 @@ public static void clearAllSelected() { msgTypeListPanel.add(txYunRadioButton, new GridConstraints(8, 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)); yunPianRadioButton = new JRadioButton(); yunPianRadioButton.setText("云片网短信"); - msgTypeListPanel.add(yunPianRadioButton, new GridConstraints(10, 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)); + msgTypeListPanel.add(yunPianRadioButton, new GridConstraints(11, 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)); upYunRadioButton = new JRadioButton(); upYunRadioButton.setEnabled(false); upYunRadioButton.setText("又拍云短信"); - msgTypeListPanel.add(upYunRadioButton, new GridConstraints(12, 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)); + msgTypeListPanel.add(upYunRadioButton, new GridConstraints(13, 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)); 网易云信短信RadioButton = new JRadioButton(); 网易云信短信RadioButton.setEnabled(false); 网易云信短信RadioButton.setText("网易云信短信"); @@ -256,7 +259,7 @@ public static void clearAllSelected() { eMailRadioButton = new JRadioButton(); eMailRadioButton.setEnabled(true); eMailRadioButton.setText("E-Mail(BETA)"); - msgTypeListPanel.add(eMailRadioButton, new GridConstraints(11, 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)); + msgTypeListPanel.add(eMailRadioButton, new GridConstraints(12, 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)); wxCpRadioButton = new JRadioButton(); wxCpRadioButton.setEnabled(true); wxCpRadioButton.setText("企业号/企业微信"); @@ -264,7 +267,7 @@ public static void clearAllSelected() { 七牛云短信RadioButton = new JRadioButton(); 七牛云短信RadioButton.setEnabled(false); 七牛云短信RadioButton.setText("七牛云短信"); - msgTypeListPanel.add(七牛云短信RadioButton, new GridConstraints(13, 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)); + msgTypeListPanel.add(七牛云短信RadioButton, new GridConstraints(14, 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)); httpRadioButton = new JRadioButton(); httpRadioButton.setEnabled(true); httpRadioButton.setText("HTTP请求"); @@ -275,14 +278,14 @@ public static void clearAllSelected() { dingRadioButton.setEnabled(true); dingRadioButton.setText("钉钉"); msgTypeListPanel.add(dingRadioButton, new GridConstraints(6, 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)); - 百度云短信RadioButton = new JRadioButton(); - 百度云短信RadioButton.setEnabled(false); - 百度云短信RadioButton.setText("百度云短信"); - msgTypeListPanel.add(百度云短信RadioButton, new GridConstraints(14, 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)); hwYunRadioButton = new JRadioButton(); hwYunRadioButton.setEnabled(true); hwYunRadioButton.setText("华为云短信"); msgTypeListPanel.add(hwYunRadioButton, new GridConstraints(9, 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)); + bdYunRadioButton = new JRadioButton(); + bdYunRadioButton.setEnabled(true); + bdYunRadioButton.setText("百度云短信"); + msgTypeListPanel.add(bdYunRadioButton, new GridConstraints(10, 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)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(2, 1, new Insets(8, 8, 8, 0), -1, -1)); messageTypePanel.add(panel1, 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)); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.form new file mode 100644 index 00000000..1fe25822 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.form @@ -0,0 +1,121 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 00000000..69161781 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/BdYunMsgForm.java @@ -0,0 +1,315 @@ +package com.fangxuele.tool.push.ui.form.msg; + +import com.fangxuele.tool.push.dao.TMsgSmsMapper; +import com.fangxuele.tool.push.dao.TTemplateDataMapper; +import com.fangxuele.tool.push.domain.TMsgSms; +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; + +/** + *
+ * BdYunMsgForm
+ * 
+ * + * @author Zhou Bo + * @since 2019/6/3. + */ +@Getter +public class BdYunMsgForm implements IMsgForm { + private JPanel templateMsgPanel; + private JLabel templateIdLabel; + private JTextField msgTemplateIdTextField; + private JPanel templateMsgDataPanel; + private JLabel templateMsgNameLabel; + private JTextField templateDataNameTextField; + private JLabel templateMsgValueLabel; + private JTextField templateDataValueTextField; + private JButton templateMsgDataAddButton; + private JTable templateMsgDataTable; + + private static BdYunMsgForm bdYunMsgForm; + + private static TMsgSmsMapper msgSmsMapper = MybatisUtil.getSqlSession().getMapper(TMsgSmsMapper.class); + private static TTemplateDataMapper templateDataMapper = MybatisUtil.getSqlSession().getMapper(TTemplateDataMapper.class); + + public BdYunMsgForm() { + // 模板数据-添加 按钮事件 + templateMsgDataAddButton.addActionListener(e -> { + String[] data = new String[2]; + data[0] = getInstance().getTemplateDataNameTextField().getText(); + data[1] = getInstance().getTemplateDataValueTextField().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(), "模板参数和参数对应的值不能为空!", "提示", + JOptionPane.INFORMATION_MESSAGE); + } else if (keySet.contains(data[0])) { + JOptionPane.showMessageDialog(MessageEditForm.getInstance().getMsgEditorPanel(), "模板参数不能重复!", "提示", + JOptionPane.INFORMATION_MESSAGE); + } else { + tableModel.addRow(data); + } + }); + } + + @Override + public void init(String msgName) { + clearAllField(); + List tMsgSmsList = msgSmsMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.BD_YUN_CODE, msgName); + Integer msgId = 0; + if (tMsgSmsList.size() > 0) { + TMsgSms tMsgSms = tMsgSmsList.get(0); + msgId = tMsgSms.getId(); + getInstance().getMsgTemplateIdTextField().setText(tMsgSms.getTemplateId()); + } + + initTemplateDataTable(); + // 模板消息Data表 + List templateDataList = templateDataMapper.selectByMsgTypeAndMsgId(MessageTypeEnum.BD_YUN_CODE, msgId); + String[] headerNames = {"模板参数", "参数对应的值", "操作"}; + 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(); + } + 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(2).setPreferredWidth(46); + tableColumnModel.getColumn(2).setMaxWidth(46); + } + + @Override + public void save(String msgName) { + int msgId = 0; + boolean existSameMsg = false; + + List tMsgSmsList = msgSmsMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.BD_YUN_CODE, msgName); + if (tMsgSmsList.size() > 0) { + existSameMsg = true; + msgId = tMsgSmsList.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 now = SqliteUtil.nowDateForSqlite(); + + TMsgSms tMsgSms = new TMsgSms(); + tMsgSms.setMsgType(MessageTypeEnum.BD_YUN_CODE); + tMsgSms.setMsgName(msgName); + tMsgSms.setTemplateId(templateId); + tMsgSms.setCreateTime(now); + tMsgSms.setModifiedTime(now); + + if (existSameMsg) { + msgSmsMapper.updateByMsgTypeAndMsgName(tMsgSms); + } else { + msgSmsMapper.insertSelective(tMsgSms); + msgId = tMsgSms.getId(); + } + + // 保存模板数据 + // 如果是覆盖保存,则先清空之前的模板数据 + if (existSameMsg) { + templateDataMapper.deleteByMsgTypeAndMsgId(MessageTypeEnum.BD_YUN_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); + + TTemplateData tTemplateData = new TTemplateData(); + tTemplateData.setMsgType(MessageTypeEnum.BD_YUN_CODE); + tTemplateData.setMsgId(msgId); + tTemplateData.setName(name); + tTemplateData.setValue(value); + tTemplateData.setCreateTime(now); + tTemplateData.setModifiedTime(now); + + templateDataMapper.insert(tTemplateData); + } + + JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "保存成功!", "成功", + JOptionPane.INFORMATION_MESSAGE); + } + + } + + public static BdYunMsgForm getInstance() { + if (bdYunMsgForm == null) { + bdYunMsgForm = new BdYunMsgForm(); + } + return bdYunMsgForm; + } + + /** + * 初始化模板消息数据table + */ + public static void initTemplateDataTable() { + JTable msgDataTable = getInstance().getTemplateMsgDataTable(); + String[] headerNames = {"模板参数", "参数对应的值", "操作"}; + 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(2).setPreferredWidth(46); + tableColumnModel.getColumn(2).setMaxWidth(46); + } + + /** + * 清空所有界面字段 + */ + public static void clearAllField() { + getInstance().getMsgTemplateIdTextField().setText(""); + getInstance().getTemplateDataNameTextField().setText(""); + getInstance().getTemplateDataValueTextField().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, 3, new Insets(10, 5, 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()))); + templateMsgDataPanel = new JPanel(); + templateMsgDataPanel.setLayout(new GridLayoutManager(3, 3, new Insets(10, 0, 0, 0), -1, -1)); + templateMsgPanel.add(templateMsgDataPanel, new GridConstraints(1, 0, 1, 3, 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()))); + 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)); + templateMsgDataAddButton = new JButton(); + templateMsgDataAddButton.setIcon(new ImageIcon(getClass().getResource("/icon/add.png"))); + templateMsgDataAddButton.setText(""); + templateMsgDataPanel.add(templateMsgDataAddButton, new GridConstraints(1, 2, 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, 3, 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("模板参数"); + 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("参数对应的值"); + 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)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 5, 10, 5), -1, -1)); + templateMsgPanel.add(panel2, 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)); + 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)); + templateMsgNameLabel.setLabelFor(templateDataNameTextField); + templateMsgValueLabel.setLabelFor(templateDataValueTextField); + templateIdLabel.setLabelFor(msgTemplateIdTextField); + } + + /** + * @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 45d74db2..da73ea72 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 @@ -59,6 +59,9 @@ public static IMsgForm getMsgForm() { case MessageTypeEnum.DING_CODE: iMsgForm = DingMsgForm.getInstance(); break; + case MessageTypeEnum.BD_YUN_CODE: + iMsgForm = BdYunMsgForm.getInstance(); + break; default: iMsgForm = HttpMsgForm.getInstance(); } 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 712eadb8..1ea38f95 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 @@ -48,6 +48,10 @@ public static void addListeners() { App.config.setMsgType(MessageTypeEnum.TX_YUN_CODE); saveType(); }); + messageTypeForm.getBdYunRadioButton().addActionListener(e -> { + App.config.setMsgType(MessageTypeEnum.BD_YUN_CODE); + saveType(); + }); messageTypeForm.getYunPianRadioButton().addActionListener(e -> { App.config.setMsgType(MessageTypeEnum.YUN_PIAN_CODE); saveType(); diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java index 47a02de0..8653f78a 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java +++ b/src/main/java/com/fangxuele/tool/push/ui/listener/MsgEditListener.java @@ -159,7 +159,8 @@ public void mousePressed(MouseEvent e) { fillParaName = "预览消息用户的UserId(如果是聊天机器人消息,填写需要@ 的用户的手机号,如果@所有人 可不填写)"; paraDemo = "manager9115|manager9116|manager9117"; } else if (msgType == MessageTypeEnum.ALI_YUN_CODE || msgType == MessageTypeEnum.TX_YUN_CODE - || msgType == MessageTypeEnum.HW_YUN_CODE || msgType == MessageTypeEnum.YUN_PIAN_CODE) { + || msgType == MessageTypeEnum.HW_YUN_CODE || msgType == MessageTypeEnum.BD_YUN_CODE + || msgType == MessageTypeEnum.YUN_PIAN_CODE) { fillParaName = "预览消息用户的手机号"; paraDemo = "13910733521;13910733522"; } From 9a92bcfda460a2308b38373d8a0173052879ddc5 Mon Sep 17 00:00:00 2001 From: sunsence Date: Sat, 14 Sep 2019 21:54:14 +0800 Subject: [PATCH 07/12] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E7=99=BE=E5=BA=A6=E4=BA=91=E7=9F=AD=E4=BF=A1=E7=9A=84=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../push/logic/msgmaker/BdYunMsgMaker.java | 34 ++++----- .../push/logic/msgsender/BdYunMsgSender.java | 74 +++++++++++++------ .../push/logic/msgsender/HwYunMsgSender.java | 9 ++- 3 files changed, 74 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/BdYunMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/BdYunMsgMaker.java index 17973d1c..c0a48ba2 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/BdYunMsgMaker.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/BdYunMsgMaker.java @@ -1,12 +1,12 @@ package com.fangxuele.tool.push.logic.msgmaker; -import com.fangxuele.tool.push.ui.form.msg.TxYunMsgForm; +import com.fangxuele.tool.push.ui.form.msg.BdYunMsgForm; import com.fangxuele.tool.push.util.TemplateUtil; -import org.apache.commons.compress.utils.Lists; +import com.google.common.collect.Maps; import org.apache.velocity.VelocityContext; import javax.swing.table.DefaultTableModel; -import java.util.List; +import java.util.Map; /** *
@@ -16,29 +16,30 @@
  * @author Zhou Bo
  * @since 2019/6/14.
  */
-public class BdYunMsgMaker extends BaseMsgMaker implements IMsgMaker{
+public class BdYunMsgMaker extends BaseMsgMaker implements IMsgMaker {
 
-    public static int templateId;
+    public static String templateId;
 
-    public static List paramList;
+    public static Map paramMap;
 
     /**
      * 准备(界面字段等)
      */
     @Override
     public void prepare() {
-        templateId = Integer.parseInt(TxYunMsgForm.getInstance().getMsgTemplateIdTextField().getText());
+        templateId = BdYunMsgForm.getInstance().getMsgTemplateIdTextField().getText();
 
-        if (TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
-            TxYunMsgForm.initTemplateDataTable();
+        if (BdYunMsgForm.getInstance().getTemplateMsgDataTable().getModel().getRowCount() == 0) {
+            BdYunMsgForm.initTemplateDataTable();
         }
 
-        DefaultTableModel tableModel = (DefaultTableModel) TxYunMsgForm.getInstance().getTemplateMsgDataTable().getModel();
+        DefaultTableModel tableModel = (DefaultTableModel) BdYunMsgForm.getInstance().getTemplateMsgDataTable().getModel();
         int rowCount = tableModel.getRowCount();
-        paramList = Lists.newArrayList();
+        paramMap = Maps.newHashMap();
         for (int i = 0; i < rowCount; i++) {
+            String key = ((String) tableModel.getValueAt(i, 0));
             String value = ((String) tableModel.getValueAt(i, 1));
-            paramList.add(value);
+            paramMap.put(key, value);
         }
     }
 
@@ -49,13 +50,12 @@ public void prepare() {
      * @return String[]
      */
     @Override
-    public String[] makeMsg(String[] msgData) {
+    public Map makeMsg(String[] msgData) {
 
         VelocityContext velocityContext = getVelocityContext(msgData);
-        for (int i = 0; i < paramList.size(); i++) {
-            paramList.set(i, TemplateUtil.evaluate(paramList.get(i), velocityContext));
+        for (Map.Entry stringStringEntry : paramMap.entrySet()) {
+            stringStringEntry.setValue(TemplateUtil.evaluate(stringStringEntry.getValue(), velocityContext));
         }
-        String[] paramArray = new String[paramList.size()];
-        return paramList.toArray(paramArray);
+        return paramMap;
     }
 }
diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/BdYunMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/BdYunMsgSender.java
index ac97092e..312ed24b 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/BdYunMsgSender.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/BdYunMsgSender.java
@@ -1,15 +1,21 @@
 package com.fangxuele.tool.push.logic.msgsender;
 
+import com.baidubce.auth.DefaultBceCredentials;
+import com.baidubce.services.sms.SmsClient;
+import com.baidubce.services.sms.SmsClientConfiguration;
+import com.baidubce.services.sms.model.SendMessageV2Request;
+import com.baidubce.services.sms.model.SendMessageV2Response;
 import com.fangxuele.tool.push.App;
 import com.fangxuele.tool.push.logic.PushControl;
-import com.fangxuele.tool.push.logic.msgmaker.TxYunMsgMaker;
-import com.github.qcloudsms.SmsSingleSender;
-import com.github.qcloudsms.SmsSingleSenderResult;
+import com.fangxuele.tool.push.logic.msgmaker.BdYunMsgMaker;
 import lombok.extern.slf4j.Slf4j;
 
+import java.util.Map;
+
 /**
  * 
  * 百度云模板短信发送器
+ * 部分代码来源于官网文档示例
  * 
* * @author RememBerBer @@ -18,37 +24,47 @@ @Slf4j public class BdYunMsgSender implements IMsgSender { /** - * 百度云短信sender + * 百度云短信SmsClient */ - public volatile static SmsSingleSender smsSingleSender; + public volatile static SmsClient smsClient; - private TxYunMsgMaker txYunMsgMaker; + private BdYunMsgMaker bdYunMsgMaker; public BdYunMsgSender() { - txYunMsgMaker = new TxYunMsgMaker(); - smsSingleSender = getTxYunSender(); + bdYunMsgMaker = new BdYunMsgMaker(); + smsClient = getBdYunSmsClient(); } @Override public SendResult send(String[] msgData) { SendResult sendResult = new SendResult(); try { - int templateId = TxYunMsgMaker.templateId; - String smsSign = App.config.getTxyunSign(); - String[] params = txYunMsgMaker.makeMsg(msgData); - String telNum = msgData[0]; + String templateCode = BdYunMsgMaker.templateId; + Map params = bdYunMsgMaker.makeMsg(msgData); + String phoneNumber = msgData[0]; if (PushControl.dryRun) { sendResult.setSuccess(true); return sendResult; } else { - SmsSingleSenderResult result = smsSingleSender.sendWithParam("86", telNum, - templateId, params, smsSign, "", ""); + // 定义请求参数 + // 发送使用签名的调用ID + String invokeId = App.config.getBdInvokeId(); + + //实例化请求对象 + SendMessageV2Request request = new SendMessageV2Request(); + request.withInvokeId(invokeId) + .withPhoneNumber(phoneNumber) + .withTemplateCode(templateCode) + .withContentVar(params); - if (result.result == 0) { + // 发送请求 + SendMessageV2Response response = smsClient.sendMessage(request); + + if (response != null && response.isSuccess()) { sendResult.setSuccess(true); } else { sendResult.setSuccess(false); - sendResult.setInfo(result.toString()); + sendResult.setInfo(response.getMessage()); } } } catch (Exception e) { @@ -68,19 +84,29 @@ public SendResult asyncSend(String[] msgData) { /** * 获取百度云短信发送客户端 * - * @return SmsSingleSender + * @return SmsClient */ - private static SmsSingleSender getTxYunSender() { - if (smsSingleSender == null) { + private static SmsClient getBdYunSmsClient() { + if (smsClient == null) { synchronized (BdYunMsgSender.class) { - if (smsSingleSender == null) { - String txyunAppId = App.config.getTxyunAppId(); - String txyunAppKey = App.config.getTxyunAppKey(); + if (smsClient == null) { + // SMS服务域名,可根据环境选择具体域名 + String endPoint = App.config.getBdEndPoint(); + // 发送账号安全认证的Access Key ID + String accessKeyId = App.config.getBdAccessKeyId(); + // 发送账号安全认证的Secret Access Key + String secretAccessKy = App.config.getBdSecretAccessKey(); + + // ak、sk等config + SmsClientConfiguration config = new SmsClientConfiguration(); + config.setCredentials(new DefaultBceCredentials(accessKeyId, secretAccessKy)); + config.setEndpoint(endPoint); - smsSingleSender = new SmsSingleSender(Integer.parseInt(txyunAppId), txyunAppKey); + // 实例化发送客户端 + smsClient = new SmsClient(config); } } } - return smsSingleSender; + return smsClient; } } diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java index 75ef1799..af3a477e 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HwYunMsgSender.java @@ -34,6 +34,7 @@ /** *
  * 华为云模板短信发送器
+ * 部分代码来源于官网文档示例
  * 
* * @author RememBerBer @@ -46,9 +47,13 @@ public class HwYunMsgSender implements IMsgSender { */ public volatile static CloseableHttpClient closeableHttpClient; - //无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值 + /** + * 无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值 + */ private static final String WSSE_HEADER_FORMAT = "UsernameToken Username=\"%s\",PasswordDigest=\"%s\",Nonce=\"%s\",Created=\"%s\""; - //无需修改,用于格式化鉴权头域,给"Authorization"参数赋值 + /** + * 无需修改,用于格式化鉴权头域,给"Authorization"参数赋值 + */ private static final String AUTH_HEADER_VALUE = "WSSE realm=\"SDP\",profile=\"UsernameToken\",type=\"Appkey\""; private HwYunMsgMaker hwYunMsgMaker; From c63313fa6f64af663c79a007bf67c9e5c889d83d Mon Sep 17 00:00:00 2001 From: sunsence Date: Sat, 14 Sep 2019 22:20:36 +0800 Subject: [PATCH 08/12] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E7=99=BE=E5=BA=A6=E4=BA=91=E7=9F=AD=E4=BF=A1=E7=9A=84=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/pom.xml b/pom.xml index c3c3317f..86c4a246 100644 --- a/pom.xml +++ b/pom.xml @@ -307,6 +307,84 @@ com.baidubce bce-java-sdk 0.10.75 + + + slf4j-api + org.slf4j + + + logback-classic + ch.qos.logback + + + logback-core + ch.qos.logback + + + guava + com.google.guava + + + commons-beanutils + commons-beanutils + + + commons-codec + commons-codec + + + commons-collections + commons-collections + + + commons-io + commons-io + + + commons-lang + commons-lang + + + commons-logging + commons-logging + + + jaxb-api + javax.xml.bind + + + log4j + log4j + + + commons-compress + org.apache.commons + + + commons-lang3 + org.apache.commons + + + commons-math3 + org.apache.commons + + + httpasyncclient + org.apache.httpcomponents + + + httpclient + org.apache.httpcomponents + + + jcl-over-slf4j + org.slf4j + + + slf4j-log4j12 + org.slf4j + + From d17a9ca599b1a05390d9afabba464d1f64ca3123 Mon Sep 17 00:00:00 2001 From: sunsence Date: Sat, 14 Sep 2019 22:38:17 +0800 Subject: [PATCH 09/12] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E7=99=BE=E5=BA=A6=E4=BA=91=E7=9F=AD=E4=BF=A1=E7=9A=84=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form | 4 ++-- .../java/com/fangxuele/tool/push/ui/form/MessageTypeForm.java | 4 ++-- .../java/com/fangxuele/tool/push/ui/form/SettingForm.form | 2 +- .../java/com/fangxuele/tool/push/ui/form/SettingForm.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form index 55542276..f78c41b9 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form @@ -204,7 +204,7 @@ - + @@ -213,7 +213,7 @@ - + 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 5aa24e6c..e47543ac 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 @@ -280,11 +280,11 @@ public static void clearAllSelected() { msgTypeListPanel.add(dingRadioButton, new GridConstraints(6, 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)); hwYunRadioButton = new JRadioButton(); hwYunRadioButton.setEnabled(true); - hwYunRadioButton.setText("华为云短信"); + hwYunRadioButton.setText("华为云短信(BETA)"); msgTypeListPanel.add(hwYunRadioButton, new GridConstraints(9, 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)); bdYunRadioButton = new JRadioButton(); bdYunRadioButton.setEnabled(true); - bdYunRadioButton.setText("百度云短信"); + bdYunRadioButton.setText("百度云短信(BETA)"); msgTypeListPanel.add(bdYunRadioButton, new GridConstraints(10, 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)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(2, 1, new Insets(8, 8, 8, 0), -1, -1)); 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 cdc1f038..41d6e6a9 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 @@ -37,7 +37,7 @@ - + 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 273173af..fc5ba7b1 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 @@ -373,7 +373,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(14, 1, new Insets(0, 60, 0, 330), -1, -1)); + panel3.setLayout(new GridLayoutManager(14, 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(1, 1, new Insets(15, 15, 10, 0), -1, -1)); From 46f15694514cf54107dc7853648bfb50aad8e362 Mon Sep 17 00:00:00 2001 From: sunsence Date: Sun, 15 Sep 2019 12:09:36 +0800 Subject: [PATCH 10/12] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=BC=82=E5=B8=B8=E6=97=B6=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangxuele/tool/push/ui/listener/MemberListener.java | 5 +++++ 1 file changed, 5 insertions(+) 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 577036a1..11139ca3 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 @@ -1051,12 +1051,14 @@ public static void importFromFile() { if (StringUtils.isBlank(filePathField.getText())) { JOptionPane.showMessageDialog(memberPanel, "请填写或点击浏览按钮选择要导入的文件的路径!", "提示", JOptionPane.INFORMATION_MESSAGE); + MemberForm.getInstance().getImportFromFileButton().setEnabled(true); return; } File file = new File(filePathField.getText()); if (!file.exists()) { JOptionPane.showMessageDialog(memberPanel, filePathField.getText() + "\n该文件不存在!", "文件不存在", JOptionPane.ERROR_MESSAGE); + MemberForm.getInstance().getImportFromFileButton().setEnabled(true); return; } CSVReader reader = null; @@ -1110,6 +1112,7 @@ public static void importFromFile() { } else { JOptionPane.showMessageDialog(memberPanel, "不支持该格式的文件!", "文件格式不支持", JOptionPane.ERROR_MESSAGE); + MemberForm.getInstance().getImportFromFileButton().setEnabled(true); return; } renderMemberListTable(); @@ -1155,12 +1158,14 @@ public static void importFromSql() { if (StringUtils.isBlank(App.config.getMysqlUrl()) || StringUtils.isBlank(App.config.getMysqlUser())) { JOptionPane.showMessageDialog(memberPanel, "请先在设置中填写并保存MySQL的配置信息!", "提示", JOptionPane.INFORMATION_MESSAGE); + memberForm.getImportFromSqlButton().setEnabled(true); return; } String querySql = memberForm.getImportFromSqlTextArea().getText(); if (StringUtils.isBlank(querySql)) { JOptionPane.showMessageDialog(memberPanel, "请先填写要执行导入的SQL!", "提示", JOptionPane.INFORMATION_MESSAGE); + memberForm.getImportFromSqlButton().setEnabled(true); return; } From 3368bf56b267618c28798be68be2a2719dfb7667 Mon Sep 17 00:00:00 2001 From: duoduo Date: Sun, 15 Sep 2019 16:43:11 +0800 Subject: [PATCH 11/12] release:v_3.9.0_190915 --- src/main/java/com/fangxuele/tool/push/ui/UiConsts.java | 2 +- src/main/resources/version_summary.json | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 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 f7d773e5..c73e5c3b 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_3.8.0_190909"; + public final static String APP_VERSION = "v_3.9.0_190915"; /** * Logo-1024*1024 diff --git a/src/main/resources/version_summary.json b/src/main/resources/version_summary.json index 66d7fac7..1e9011ee 100644 --- a/src/main/resources/version_summary.json +++ b/src/main/resources/version_summary.json @@ -1,5 +1,5 @@ { - "currentVersion": "v_3.8.0_190909", + "currentVersion": "v_3.9.0_190915", "versionIndex": { "v_1.1.0_170701": "0", "v_1.2.0_170831": "1", @@ -35,7 +35,8 @@ "v_3.6.2_190811": "31", "v_3.6.3_190825": "32", "v_3.7.0_190904": "33", - "v_3.8.0_190909": "34" + "v_3.8.0_190909": "34", + "v_3.9.0_190915": "35" }, "versionDetailList": [ { @@ -212,6 +213,11 @@ "version": "v_3.8.0_190909", "title": "新增支持钉钉消息", "log": "● feature:新增支持钉钉消息类型(工作通知消息和群机器人消息)\n● bug fix:修复微信公众号相关消息使用外部accessToken缓存异常的问题\n● optimization:优化http请求失败提示更详细准确\n● bug fix:修复消息类型不存在时启动异常,预览消息失败时提示框标题等问题\n" + }, + { + "version": "v_3.9.0_190915", + "title": "新增支持华为云短信和百度云短信", + "log": "● feature:新增支持华为云短信消息类型\n● feature:新增支持百度云短信消息类型\n● bug fix:修复导入成员异常时按钮状态不正确的问题\n" } ] } \ No newline at end of file From 21ce10626c794c9f32f1b8281027fa214dc3bb56 Mon Sep 17 00:00:00 2001 From: duoduo Date: Sun, 15 Sep 2019 17:13:45 +0800 Subject: [PATCH 12/12] release:v_3.9.0_190915 --- download.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/download.md b/download.md index 5ae00e2a..15090877 100644 --- a/download.md +++ b/download.md @@ -3,6 +3,7 @@
Windows +[WePush-v3.9.0_190915-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v3.9.0_190915-x64-Setup.exe) [WePush-v3.8.0_190909-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v3.8.0_190909-x64-Setup.exe) [WePush-v3.7.0_190904-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v3.7.0_190904-x64-Setup.exe) [WePush-v3.6.3_190825-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v3.6.3_190825-x64-Setup.exe) @@ -69,6 +70,7 @@
Mac OS +[v_3.9.0_190915.app](http://download.zhoubochina.com/mac/3.9.0.zip) [v_3.6.2_190811.app](http://download.zhoubochina.com/mac/3.6.2.zip) [v_3.6.1_190728.app](http://download.zhoubochina.com/mac/3.6.1.zip) [v_3.6.0_190721.app](http://download.zhoubochina.com/mac/3.6.0.zip) @@ -109,6 +111,7 @@
Linux +[v3.9.0_190915](http://download.zhoubochina.com/linux/WePush-3.9.0.zip) [v3.8.0_190909](http://download.zhoubochina.com/linux/WePush-3.8.0.zip) [v3.7.0_190904](http://download.zhoubochina.com/linux/WePush-3.7.0.zip) [v3.6.3_190825](http://download.zhoubochina.com/linux/WePush-3.6.3.zip)