From 18cc155387f22791200343fd5587ffb0570cee1e Mon Sep 17 00:00:00 2001 From: duoduo Date: Tue, 3 Sep 2019 22:15:00 +0800 Subject: [PATCH 01/33] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E9=92=89?= =?UTF-8?q?=E9=92=89=E6=B6=88=E6=81=AF=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/dao/TMsgDingMapper.java | 17 +++ .../fangxuele/tool/push/domain/TMsgDing.java | 97 ++++++++++++ src/main/resources/db_init.sql | 19 +++ src/main/resources/generatorConfig.xml | 4 +- src/main/resources/mapper/TMsgDingMapper.xml | 141 ++++++++++++++++++ src/main/resources/mybatis-config.xml | 1 + 6 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java create mode 100644 src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java create mode 100644 src/main/resources/mapper/TMsgDingMapper.xml diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java new file mode 100644 index 00000000..d31841e9 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java @@ -0,0 +1,17 @@ +package com.fangxuele.tool.push.dao; + +import com.fangxuele.tool.push.domain.TMsgDing; + +public interface TMsgDingMapper { + int deleteByPrimaryKey(Integer id); + + int insert(TMsgDing record); + + int insertSelective(TMsgDing record); + + TMsgDing selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(TMsgDing record); + + int updateByPrimaryKey(TMsgDing record); +} \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java new file mode 100644 index 00000000..48cfd240 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java @@ -0,0 +1,97 @@ +package com.fangxuele.tool.push.domain; + +import java.io.Serializable; + +public class TMsgDing implements Serializable { + private Integer id; + + private Integer msgType; + + private String msgName; + + private String dingMsgType; + + private String agentId; + + private String webHook; + + private String content; + + private String createTime; + + private String modifiedTime; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getMsgType() { + return msgType; + } + + public void setMsgType(Integer msgType) { + this.msgType = msgType; + } + + public String getMsgName() { + return msgName; + } + + public void setMsgName(String msgName) { + this.msgName = msgName == null ? null : msgName.trim(); + } + + public String getDingMsgType() { + return dingMsgType; + } + + public void setDingMsgType(String dingMsgType) { + this.dingMsgType = dingMsgType == null ? null : dingMsgType.trim(); + } + + public String getAgentId() { + return agentId; + } + + public void setAgentId(String agentId) { + this.agentId = agentId == null ? null : agentId.trim(); + } + + public String getWebHook() { + return webHook; + } + + public void setWebHook(String webHook) { + this.webHook = webHook == null ? null : webHook.trim(); + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content == null ? null : content.trim(); + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime == null ? null : createTime.trim(); + } + + public String getModifiedTime() { + return modifiedTime; + } + + public void setModifiedTime(String modifiedTime) { + this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim(); + } +} \ No newline at end of file diff --git a/src/main/resources/db_init.sql b/src/main/resources/db_init.sql index d3f60f3a..e155071f 100644 --- a/src/main/resources/db_init.sql +++ b/src/main/resources/db_init.sql @@ -222,3 +222,22 @@ create table if not exists t_msg_http create unique index if not exists t_msg_http_msg_type_msg_name_uindex on t_msg_http (msg_type, msg_name); + +create table if not exists t_msg_ding +( + id integer + constraint t_msg_ding_pk + primary key autoincrement, + msg_type integer, + msg_name text, + ding_msg_type text, + agent_id text, + web_hook text, + content text, + create_time datetime, + modified_time datetime +); + +create unique index if not exists t_msg_ding_msg_type_msg_name_uindex + on t_msg_ding (msg_type, msg_name); + diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index 4bb0bf39..721f60eb 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -4,7 +4,7 @@ "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> - + @@ -45,7 +45,7 @@ + tableName="t_msg_ding" domainObjectName="TMsgDing">
diff --git a/src/main/resources/mapper/TMsgDingMapper.xml b/src/main/resources/mapper/TMsgDingMapper.xml new file mode 100644 index 00000000..50628b22 --- /dev/null +++ b/src/main/resources/mapper/TMsgDingMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + id, msg_type, msg_name, ding_msg_type, agent_id, web_hook, content, create_time, + modified_time + + + + delete + from t_msg_ding + where id = #{id,jdbcType=INTEGER} + + + insert into t_msg_ding (id, msg_type, msg_name, + ding_msg_type, agent_id, web_hook, + content, create_time, modified_time) + values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR}, + #{dingMsgType,jdbcType=VARCHAR}, #{agentId,jdbcType=VARCHAR}, #{webHook,jdbcType=VARCHAR}, + #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}) + + + insert into t_msg_ding + + + id, + + + msg_type, + + + msg_name, + + + ding_msg_type, + + + agent_id, + + + web_hook, + + + content, + + + create_time, + + + modified_time, + + + + + #{id,jdbcType=INTEGER}, + + + #{msgType,jdbcType=INTEGER}, + + + #{msgName,jdbcType=VARCHAR}, + + + #{dingMsgType,jdbcType=VARCHAR}, + + + #{agentId,jdbcType=VARCHAR}, + + + #{webHook,jdbcType=VARCHAR}, + + + #{content,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=VARCHAR}, + + + #{modifiedTime,jdbcType=VARCHAR}, + + + + + update t_msg_ding + + + msg_type = #{msgType,jdbcType=INTEGER}, + + + msg_name = #{msgName,jdbcType=VARCHAR}, + + + ding_msg_type = #{dingMsgType,jdbcType=VARCHAR}, + + + agent_id = #{agentId,jdbcType=VARCHAR}, + + + web_hook = #{webHook,jdbcType=VARCHAR}, + + + content = #{content,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=VARCHAR}, + + + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update t_msg_ding + set msg_type = #{msgType,jdbcType=INTEGER}, + msg_name = #{msgName,jdbcType=VARCHAR}, + ding_msg_type = #{dingMsgType,jdbcType=VARCHAR}, + agent_id = #{agentId,jdbcType=VARCHAR}, + web_hook = #{webHook,jdbcType=VARCHAR}, + content = #{content,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=VARCHAR}, + modified_time = #{modifiedTime,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index b795ed9c..1f1042be 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -27,5 +27,6 @@ + \ No newline at end of file From 0440b3bf69e5dae2a1663db59c3e2f7b1e96777c Mon Sep 17 00:00:00 2001 From: duoduo Date: Tue, 3 Sep 2019 22:15:00 +0800 Subject: [PATCH 02/33] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E9=92=89?= =?UTF-8?q?=E9=92=89=E6=B6=88=E6=81=AF=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/dao/TMsgDingMapper.java | 17 +++ .../fangxuele/tool/push/domain/TMsgDing.java | 97 ++++++++++++ src/main/resources/db_init.sql | 19 +++ src/main/resources/generatorConfig.xml | 4 +- src/main/resources/mapper/TMsgDingMapper.xml | 141 ++++++++++++++++++ src/main/resources/mybatis-config.xml | 1 + 6 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java create mode 100644 src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java create mode 100644 src/main/resources/mapper/TMsgDingMapper.xml diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java new file mode 100644 index 00000000..d31841e9 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java @@ -0,0 +1,17 @@ +package com.fangxuele.tool.push.dao; + +import com.fangxuele.tool.push.domain.TMsgDing; + +public interface TMsgDingMapper { + int deleteByPrimaryKey(Integer id); + + int insert(TMsgDing record); + + int insertSelective(TMsgDing record); + + TMsgDing selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(TMsgDing record); + + int updateByPrimaryKey(TMsgDing record); +} \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java new file mode 100644 index 00000000..48cfd240 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java @@ -0,0 +1,97 @@ +package com.fangxuele.tool.push.domain; + +import java.io.Serializable; + +public class TMsgDing implements Serializable { + private Integer id; + + private Integer msgType; + + private String msgName; + + private String dingMsgType; + + private String agentId; + + private String webHook; + + private String content; + + private String createTime; + + private String modifiedTime; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getMsgType() { + return msgType; + } + + public void setMsgType(Integer msgType) { + this.msgType = msgType; + } + + public String getMsgName() { + return msgName; + } + + public void setMsgName(String msgName) { + this.msgName = msgName == null ? null : msgName.trim(); + } + + public String getDingMsgType() { + return dingMsgType; + } + + public void setDingMsgType(String dingMsgType) { + this.dingMsgType = dingMsgType == null ? null : dingMsgType.trim(); + } + + public String getAgentId() { + return agentId; + } + + public void setAgentId(String agentId) { + this.agentId = agentId == null ? null : agentId.trim(); + } + + public String getWebHook() { + return webHook; + } + + public void setWebHook(String webHook) { + this.webHook = webHook == null ? null : webHook.trim(); + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content == null ? null : content.trim(); + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime == null ? null : createTime.trim(); + } + + public String getModifiedTime() { + return modifiedTime; + } + + public void setModifiedTime(String modifiedTime) { + this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim(); + } +} \ No newline at end of file diff --git a/src/main/resources/db_init.sql b/src/main/resources/db_init.sql index d3f60f3a..e155071f 100644 --- a/src/main/resources/db_init.sql +++ b/src/main/resources/db_init.sql @@ -222,3 +222,22 @@ create table if not exists t_msg_http create unique index if not exists t_msg_http_msg_type_msg_name_uindex on t_msg_http (msg_type, msg_name); + +create table if not exists t_msg_ding +( + id integer + constraint t_msg_ding_pk + primary key autoincrement, + msg_type integer, + msg_name text, + ding_msg_type text, + agent_id text, + web_hook text, + content text, + create_time datetime, + modified_time datetime +); + +create unique index if not exists t_msg_ding_msg_type_msg_name_uindex + on t_msg_ding (msg_type, msg_name); + diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index 4bb0bf39..721f60eb 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -4,7 +4,7 @@ "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> - + @@ -45,7 +45,7 @@ + tableName="t_msg_ding" domainObjectName="TMsgDing">
diff --git a/src/main/resources/mapper/TMsgDingMapper.xml b/src/main/resources/mapper/TMsgDingMapper.xml new file mode 100644 index 00000000..50628b22 --- /dev/null +++ b/src/main/resources/mapper/TMsgDingMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + id, msg_type, msg_name, ding_msg_type, agent_id, web_hook, content, create_time, + modified_time + + + + delete + from t_msg_ding + where id = #{id,jdbcType=INTEGER} + + + insert into t_msg_ding (id, msg_type, msg_name, + ding_msg_type, agent_id, web_hook, + content, create_time, modified_time) + values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR}, + #{dingMsgType,jdbcType=VARCHAR}, #{agentId,jdbcType=VARCHAR}, #{webHook,jdbcType=VARCHAR}, + #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}) + + + insert into t_msg_ding + + + id, + + + msg_type, + + + msg_name, + + + ding_msg_type, + + + agent_id, + + + web_hook, + + + content, + + + create_time, + + + modified_time, + + + + + #{id,jdbcType=INTEGER}, + + + #{msgType,jdbcType=INTEGER}, + + + #{msgName,jdbcType=VARCHAR}, + + + #{dingMsgType,jdbcType=VARCHAR}, + + + #{agentId,jdbcType=VARCHAR}, + + + #{webHook,jdbcType=VARCHAR}, + + + #{content,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=VARCHAR}, + + + #{modifiedTime,jdbcType=VARCHAR}, + + + + + update t_msg_ding + + + msg_type = #{msgType,jdbcType=INTEGER}, + + + msg_name = #{msgName,jdbcType=VARCHAR}, + + + ding_msg_type = #{dingMsgType,jdbcType=VARCHAR}, + + + agent_id = #{agentId,jdbcType=VARCHAR}, + + + web_hook = #{webHook,jdbcType=VARCHAR}, + + + content = #{content,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=VARCHAR}, + + + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update t_msg_ding + set msg_type = #{msgType,jdbcType=INTEGER}, + msg_name = #{msgName,jdbcType=VARCHAR}, + ding_msg_type = #{dingMsgType,jdbcType=VARCHAR}, + agent_id = #{agentId,jdbcType=VARCHAR}, + web_hook = #{webHook,jdbcType=VARCHAR}, + content = #{content,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=VARCHAR}, + modified_time = #{modifiedTime,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index b795ed9c..1f1042be 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -27,5 +27,6 @@ + \ No newline at end of file From f0495dcf127a481d3560a279e433b7af5c6bbbfb Mon Sep 17 00:00:00 2001 From: duoduo Date: Wed, 4 Sep 2019 11:33:03 +0800 Subject: [PATCH 03/33] optimization:about tab update UI after init --- src/main/java/com/fangxuele/tool/push/ui/form/AboutForm.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/AboutForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/AboutForm.java index 57b866c5..c19be3ad 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/AboutForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/AboutForm.java @@ -41,6 +41,7 @@ public static AboutForm getInstance() { public static void init() { getInstance().getPushTotalLabel().setText("已累计为您推送 " + App.config.getPushTotal() + " 条消息"); + aboutForm.getAboutPanel().updateUI(); } { From 375babff595abb7873a0e788d033f6f135274642 Mon Sep 17 00:00:00 2001 From: duoduo Date: Wed, 4 Sep 2019 21:34:34 +0800 Subject: [PATCH 04/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=95=8C=E9=9D=A2=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/logic/MessageTypeEnum.java | 7 +- .../tool/push/ui/form/MessageEditForm.java | 4 + .../tool/push/ui/form/MessageTypeForm.form | 42 +-- .../tool/push/ui/form/MessageTypeForm.java | 37 +- .../tool/push/ui/form/msg/DingMsgForm.form | 188 ++++++++++ .../tool/push/ui/form/msg/DingMsgForm.java | 349 ++++++++++++++++++ .../tool/push/ui/form/msg/MsgFormFactory.java | 3 + .../push/ui/listener/MessageTypeListener.java | 4 + 8 files changed, 595 insertions(+), 39 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form create mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.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 49a0624d..66cdc7e1 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java +++ b/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java @@ -23,7 +23,8 @@ public enum MessageTypeEnum { HW_YUN(10, "华为云短信"), EMAIL(11, "E-Mail"), WX_CP(12, "微信企业号/企业微信"), - HTTP(13, "HTTP请求"); + HTTP(13, "HTTP请求"), + DING(14, "钉钉"); private int code; @@ -41,6 +42,7 @@ public enum MessageTypeEnum { public static final int EMAIL_CODE = 11; public static final int WX_CP_CODE = 12; public static final int HTTP_CODE = 13; + public static final int DING_CODE = 14; MessageTypeEnum(int code, String name) { this.code = code; @@ -86,6 +88,9 @@ public static String getName(int code) { case 13: name = HTTP.name; break; + case 14: + name = DING.name; + break; default: } return name; 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 efc01db2..0c0c045d 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.DingMsgForm; import com.fangxuele.tool.push.ui.form.msg.HttpMsgForm; import com.fangxuele.tool.push.ui.form.msg.KefuMsgForm; import com.fangxuele.tool.push.ui.form.msg.MaTemplateMsgForm; @@ -123,6 +124,9 @@ public static void switchMsgType(int msgType) { case MessageTypeEnum.HTTP_CODE: messageEditForm.getMsgEditorPanel().add(HttpMsgForm.getInstance().getHttpPanel(), gridConstraintsRow0); break; + case MessageTypeEnum.DING_CODE: + messageEditForm.getMsgEditorPanel().add(DingMsgForm.getInstance().getDingMsgPanel(), 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 66edfeed..7fc1faf3 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 @@ -63,7 +63,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -96,7 +96,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -132,7 +132,7 @@ - + @@ -140,21 +140,12 @@ - - - - - - - - - - + @@ -168,7 +159,7 @@ - + @@ -186,7 +177,7 @@ - + @@ -207,6 +198,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 203ceafc..f8fef421 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 @@ -38,7 +38,7 @@ public class MessageTypeForm { private JRadioButton 极光短信RadioButton; private JRadioButton 极光推送RadioButton; private JRadioButton wxCpRadioButton; - private JRadioButton 钉钉RadioButton; + private JRadioButton dingRadioButton; private JScrollPane messageTypeScrollPane; private JLabel kefuPriorityTipsLabel; private JRadioButton httpRadioButton; @@ -105,6 +105,9 @@ public static void init() { case MessageTypeEnum.HTTP_CODE: messageTypeForm.getHttpRadioButton().setSelected(true); break; + case MessageTypeEnum.DING_CODE: + messageTypeForm.getDingRadioButton().setSelected(true); + break; default: } @@ -211,45 +214,41 @@ public static void clearAllSelected() { msgTypeListPanel.add(kefuPriorityRadioButton, new GridConstraints(4, 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)); aliYunRadioButton = new JRadioButton(); aliYunRadioButton.setText("阿里云短信"); - msgTypeListPanel.add(aliYunRadioButton, 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)); + msgTypeListPanel.add(aliYunRadioButton, new GridConstraints(7, 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)); txYunRadioButton = new JRadioButton(); txYunRadioButton.setText("腾讯云短信"); - msgTypeListPanel.add(txYunRadioButton, new GridConstraints(7, 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(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(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)); + 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)); upYunRadioButton = new JRadioButton(); upYunRadioButton.setEnabled(false); upYunRadioButton.setText("又拍云短信"); - msgTypeListPanel.add(upYunRadioButton, 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(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(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(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)); 网易云信短信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)); 榛子云短信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)); + msgTypeListPanel.add(榛子云短信RadioButton, new GridConstraints(15, 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)); luosimao短信RadioButton = new JRadioButton(); luosimao短信RadioButton.setEnabled(false); luosimao短信RadioButton.setText("Luosimao短信"); - msgTypeListPanel.add(luosimao短信RadioButton, new GridConstraints(15, 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(luosimao短信RadioButton, new GridConstraints(16, 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(16, 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(17, 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(17, 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(18, 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(18, 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)); kefuPriorityTipsLabel = new JLabel(); kefuPriorityTipsLabel.setIcon(new ImageIcon(getClass().getResource("/icon/helpButton.png"))); kefuPriorityTipsLabel.setText(""); @@ -257,7 +256,7 @@ public static void clearAllSelected() { eMailRadioButton = new JRadioButton(); eMailRadioButton.setEnabled(true); eMailRadioButton.setText("E-Mail(BETA)"); - msgTypeListPanel.add(eMailRadioButton, 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(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)); wxCpRadioButton = new JRadioButton(); wxCpRadioButton.setEnabled(true); wxCpRadioButton.setText("企业号/企业微信"); @@ -265,13 +264,17 @@ public static void clearAllSelected() { 七牛云短信RadioButton = new JRadioButton(); 七牛云短信RadioButton.setEnabled(false); 七牛云短信RadioButton.setText("七牛云短信"); - msgTypeListPanel.add(七牛云短信RadioButton, 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(七牛云短信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)); httpRadioButton = new JRadioButton(); httpRadioButton.setEnabled(true); httpRadioButton.setText("HTTP请求"); msgTypeListPanel.add(httpRadioButton, 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 Spacer spacer1 = new Spacer(); msgTypeListPanel.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + dingRadioButton = new JRadioButton(); + 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)); 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/DingMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form new file mode 100644 index 00000000..2cec5134 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form @@ -0,0 +1,188 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java new file mode 100644 index 00000000..24f166a1 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -0,0 +1,349 @@ +package com.fangxuele.tool.push.ui.form.msg; + +import com.fangxuele.tool.push.dao.TMsgWxCpMapper; +import com.fangxuele.tool.push.dao.TWxCpAppMapper; +import com.fangxuele.tool.push.domain.TMsgWxCp; +import com.fangxuele.tool.push.domain.TWxCpApp; +import com.fangxuele.tool.push.logic.MessageTypeEnum; +import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; +import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.util.MybatisUtil; +import com.fangxuele.tool.push.util.SqliteUtil; +import com.google.common.collect.Maps; +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; +import lombok.Getter; + +import javax.swing.*; +import javax.swing.border.TitledBorder; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *
+ * DingMsgForm
+ * 
+ * + * @author RememBerBer + * @since 2019/9/4. + */ +@Getter +public class DingMsgForm implements IMsgForm { + private JPanel dingMsgPanel; + private JLabel msgTypeLabel; + private JComboBox msgTypeComboBox; + private JLabel titleLabel; + private JLabel picUrlLabel; + private JTextField picUrlTextField; + private JLabel descLabel; + private JTextField descTextField; + private JLabel urlLabel; + private JTextField urlTextField; + private JLabel contentLabel; + private JComboBox appNameComboBox; + private JButton appManageButton; + private JTextField titleTextField; + private JTextArea contentTextArea; + private JLabel btnTxtLabel; + private JTextField btnTxtTextField; + + private static DingMsgForm dingMsgForm; + + private static TMsgWxCpMapper msgWxCpMapper = MybatisUtil.getSqlSession().getMapper(TMsgWxCpMapper.class); + private static TWxCpAppMapper wxCpAppMapper = MybatisUtil.getSqlSession().getMapper(TWxCpAppMapper.class); + + public static Map appNameToAgentIdMap = Maps.newHashMap(); + public static Map agentIdToAppNameMap = Maps.newHashMap(); + + public DingMsgForm() { + // 消息类型切换事件 + msgTypeComboBox.addItemListener(e -> { + if (e.getStateChange() == ItemEvent.SELECTED) { + switchCpMsgType(e.getItem().toString()); + } + }); + appManageButton.addActionListener(e -> { + WxCpAppDialog dialog = new WxCpAppDialog(); + dialog.renderTable(); + dialog.pack(); + dialog.setVisible(true); + initAppNameList(); + }); + } + + @Override + public void init(String msgName) { + clearAllField(); + initAppNameList(); + List tMsgWxCpList = msgWxCpMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.WX_CP_CODE, msgName); + if (tMsgWxCpList.size() > 0) { + TMsgWxCp tMsgWxCp = tMsgWxCpList.get(0); + String cpMsgType = tMsgWxCp.getCpMsgType(); + getInstance().getAppNameComboBox().setSelectedItem(agentIdToAppNameMap.get(tMsgWxCp.getAgentId())); + getInstance().getMsgTypeComboBox().setSelectedItem(cpMsgType); + getInstance().getContentTextArea().setText(tMsgWxCp.getContent()); + getInstance().getTitleTextField().setText(tMsgWxCp.getTitle()); + getInstance().getPicUrlTextField().setText(tMsgWxCp.getImgUrl()); + getInstance().getDescTextField().setText(tMsgWxCp.getDescribe()); + getInstance().getUrlTextField().setText(tMsgWxCp.getUrl()); + getInstance().getBtnTxtTextField().setText(tMsgWxCp.getBtnTxt()); + + switchCpMsgType(cpMsgType); + } else { + switchCpMsgType("图文消息"); + } + } + + @Override + public void save(String msgName) { + boolean existSameMsg = false; + + if (getInstance().getAppNameComboBox().getSelectedItem() == null) { + JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "请选择应用!", "成功", + JOptionPane.ERROR_MESSAGE); + return; + } + + List tMsgWxCpList = msgWxCpMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.WX_CP_CODE, msgName); + if (tMsgWxCpList.size() > 0) { + existSameMsg = true; + } + + 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 cpMsgType = Objects.requireNonNull(getInstance().getMsgTypeComboBox().getSelectedItem()).toString(); + String content = getInstance().getContentTextArea().getText(); + String title = getInstance().getTitleTextField().getText(); + String picUrl = getInstance().getPicUrlTextField().getText(); + String desc = getInstance().getDescTextField().getText(); + String url = getInstance().getUrlTextField().getText(); + String btnTxt = getInstance().getBtnTxtTextField().getText(); + + String now = SqliteUtil.nowDateForSqlite(); + + TMsgWxCp tMsgWxCp = new TMsgWxCp(); + tMsgWxCp.setMsgType(MessageTypeEnum.WX_CP_CODE); + tMsgWxCp.setMsgName(msgName); + tMsgWxCp.setAgentId(appNameToAgentIdMap.get(getInstance().getAppNameComboBox().getSelectedItem())); + tMsgWxCp.setCpMsgType(cpMsgType); + tMsgWxCp.setContent(content); + tMsgWxCp.setTitle(title); + tMsgWxCp.setImgUrl(picUrl); + tMsgWxCp.setDescribe(desc); + tMsgWxCp.setUrl(url); + tMsgWxCp.setBtnTxt(btnTxt); + tMsgWxCp.setModifiedTime(now); + + if (existSameMsg) { + msgWxCpMapper.updateByMsgTypeAndMsgName(tMsgWxCp); + } else { + tMsgWxCp.setCreateTime(now); + msgWxCpMapper.insertSelective(tMsgWxCp); + } + + JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "保存成功!", "成功", + JOptionPane.INFORMATION_MESSAGE); + } + } + + public static DingMsgForm getInstance() { + if (dingMsgForm == null) { + dingMsgForm = new DingMsgForm(); + } + return dingMsgForm; + } + + /** + * 初始化应用名称列表 + */ + public static void initAppNameList() { + List tWxCpAppList = wxCpAppMapper.selectAll(); + getInstance().getAppNameComboBox().removeAllItems(); + for (TWxCpApp tWxCpApp : tWxCpAppList) { + appNameToAgentIdMap.put(tWxCpApp.getAppName(), tWxCpApp.getAgentId()); + agentIdToAppNameMap.put(tWxCpApp.getAgentId(), tWxCpApp.getAppName()); + getInstance().getAppNameComboBox().addItem(tWxCpApp.getAppName()); + } + } + + /** + * 根据消息类型转换界面显示 + * + * @param msgType 消息类型 + */ + public static void switchCpMsgType(String msgType) { + switch (msgType) { + case "文本消息": + case "markdown消息": + getInstance().getContentTextArea().setVisible(true); + getInstance().getDescLabel().setVisible(false); + getInstance().getDescTextField().setVisible(false); + getInstance().getPicUrlLabel().setVisible(false); + getInstance().getPicUrlTextField().setVisible(false); + getInstance().getUrlLabel().setVisible(false); + getInstance().getUrlTextField().setVisible(false); + getInstance().getTitleLabel().setVisible(false); + getInstance().getTitleTextField().setVisible(false); + getInstance().getBtnTxtLabel().setVisible(false); + getInstance().getBtnTxtTextField().setVisible(false); + break; + case "图文消息": + getInstance().getContentLabel().setVisible(false); + getInstance().getContentTextArea().setVisible(false); + getInstance().getBtnTxtLabel().setVisible(false); + getInstance().getBtnTxtTextField().setVisible(false); + getInstance().getDescLabel().setVisible(true); + getInstance().getDescTextField().setVisible(true); + getInstance().getPicUrlLabel().setVisible(true); + getInstance().getPicUrlTextField().setVisible(true); + getInstance().getUrlLabel().setVisible(true); + getInstance().getUrlTextField().setVisible(true); + getInstance().getTitleLabel().setVisible(true); + getInstance().getTitleTextField().setVisible(true); + break; + case "文本卡片消息": + getInstance().getContentLabel().setVisible(false); + getInstance().getContentTextArea().setVisible(false); + getInstance().getPicUrlLabel().setVisible(false); + getInstance().getPicUrlTextField().setVisible(false); + getInstance().getDescLabel().setVisible(true); + getInstance().getDescTextField().setVisible(true); + getInstance().getBtnTxtLabel().setVisible(true); + getInstance().getBtnTxtTextField().setVisible(true); + getInstance().getUrlLabel().setVisible(true); + getInstance().getUrlTextField().setVisible(true); + getInstance().getTitleLabel().setVisible(true); + getInstance().getTitleTextField().setVisible(true); + break; + default: + break; + } + } + + /** + * 清空所有界面字段 + */ + public static void clearAllField() { + getInstance().getContentTextArea().setText(""); + getInstance().getTitleTextField().setText(""); + getInstance().getPicUrlTextField().setText(""); + getInstance().getDescTextField().setText(""); + getInstance().getUrlTextField().setText(""); + getInstance().getBtnTxtTextField().setText(""); + } + + { +// 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(2, 2, new Insets(0, 0, 0, 0), -1, -1)); + dingMsgPanel = new JPanel(); + dingMsgPanel.setLayout(new GridLayoutManager(9, 3, new Insets(10, 8, 0, 8), -1, -1)); + panel1.add(dingMsgPanel, 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)); + dingMsgPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, dingMsgPanel.getFont()))); + msgTypeLabel = new JLabel(); + msgTypeLabel.setText("消息类型"); + dingMsgPanel.add(msgTypeLabel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + dingMsgPanel.add(spacer1, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + msgTypeComboBox = new JComboBox(); + final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); + defaultComboBoxModel1.addElement("图文消息"); + defaultComboBoxModel1.addElement("文本消息"); + defaultComboBoxModel1.addElement("文本卡片消息"); + defaultComboBoxModel1.addElement("markdown消息"); + msgTypeComboBox.setModel(defaultComboBoxModel1); + dingMsgPanel.add(msgTypeComboBox, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + titleLabel = new JLabel(); + titleLabel.setText("标题"); + dingMsgPanel.add(titleLabel, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + picUrlLabel = new JLabel(); + picUrlLabel.setText("图片URL"); + dingMsgPanel.add(picUrlLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + picUrlTextField = new JTextField(); + dingMsgPanel.add(picUrlTextField, new GridConstraints(4, 1, 1, 2, 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)); + descLabel = new JLabel(); + descLabel.setText("描述"); + dingMsgPanel.add(descLabel, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + descTextField = new JTextField(); + dingMsgPanel.add(descTextField, new GridConstraints(5, 1, 1, 2, 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)); + urlLabel = new JLabel(); + urlLabel.setText("跳转URL"); + dingMsgPanel.add(urlLabel, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + urlTextField = new JTextField(); + dingMsgPanel.add(urlTextField, new GridConstraints(6, 1, 1, 2, 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)); + contentLabel = new JLabel(); + contentLabel.setText("内容"); + dingMsgPanel.add(contentLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("选择应用"); + dingMsgPanel.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)); + appNameComboBox = new JComboBox(); + dingMsgPanel.add(appNameComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + appManageButton = new JButton(); + appManageButton.setText("应用管理"); + dingMsgPanel.add(appManageButton, new GridConstraints(0, 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)); + titleTextField = new JTextField(); + dingMsgPanel.add(titleTextField, new GridConstraints(3, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(380, -1), new Dimension(380, -1), null, 0, false)); + contentTextArea = new JTextArea(); + dingMsgPanel.add(contentTextArea, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(150, 50), null, 0, false)); + btnTxtLabel = new JLabel(); + btnTxtLabel.setText("按钮文字"); + btnTxtLabel.setToolTipText("可不填。默认为“详情”, 不超过4个文字,超过自动截断"); + dingMsgPanel.add(btnTxtLabel, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + btnTxtTextField = new JTextField(); + btnTxtTextField.setToolTipText("可不填。默认为“详情”, 不超过4个文字,超过自动截断"); + dingMsgPanel.add(btnTxtTextField, new GridConstraints(7, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final Spacer spacer2 = new Spacer(); + panel1.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final Spacer spacer3 = new Spacer(); + panel1.add(spacer3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + msgTypeLabel.setLabelFor(msgTypeComboBox); + titleLabel.setLabelFor(titleTextField); + picUrlLabel.setLabelFor(picUrlTextField); + descLabel.setLabelFor(descTextField); + urlLabel.setLabelFor(urlTextField); + } + + /** + * @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 ce897833..cb9f68c4 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 @@ -53,6 +53,9 @@ public static IMsgForm getMsgForm() { case MessageTypeEnum.HTTP_CODE: iMsgForm = HttpMsgForm.getInstance(); break; + case MessageTypeEnum.DING_CODE: + iMsgForm = DingMsgForm.getInstance(); + break; default: } if (iMsgForm != null) { 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 27bb5600..712eadb8 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 @@ -72,6 +72,10 @@ public static void addListeners() { App.config.setMsgType(MessageTypeEnum.HTTP_CODE); saveType(); }); + messageTypeForm.getDingRadioButton().addActionListener(e -> { + App.config.setMsgType(MessageTypeEnum.DING_CODE); + saveType(); + }); messageTypeForm.getKefuPriorityTipsLabel().addMouseListener(new MouseAdapter() { @Override From 3bda37719bdf1797df8bb5721846a980ee80e05f Mon Sep 17 00:00:00 2001 From: duoduo Date: Wed, 4 Sep 2019 21:59:14 +0800 Subject: [PATCH 05/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=95=8C=E9=9D=A2=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/ui/form/SettingForm.form | 53 +++- .../tool/push/ui/form/SettingForm.java | 241 ++++++++++-------- .../tool/push/ui/form/msg/DingMsgForm.form | 4 +- .../tool/push/ui/form/msg/DingMsgForm.java | 4 +- .../push/ui/listener/SettingListener.java | 10 + 5 files changed, 187 insertions(+), 125 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 191cf2f1..7a7f1a37 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 @@ - + @@ -713,11 +713,48 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -801,7 +838,7 @@ - + @@ -888,7 +925,7 @@ - + @@ -943,7 +980,7 @@ - + @@ -1085,7 +1122,7 @@ - + @@ -1179,7 +1216,7 @@ - + @@ -1298,7 +1335,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 8c5e2cd2..d32dea66 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 @@ -103,6 +103,7 @@ public class SettingForm { private JLabel outSideAtTipsLabel; private JLabel manualAtTipsLabel; private JLabel apiAtTipsLabel; + private JButton dingAppManageButton; private static SettingForm settingForm; private static TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class); @@ -348,7 +349,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(11, 1, new Insets(0, 60, 0, 330), -1, -1)); + panel3.setLayout(new GridLayoutManager(12, 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)); @@ -582,179 +583,193 @@ public static void toggleMpOutSideAccessTokenPanel() { wxCpAppManageButton.setText("应用管理"); panel13.add(wxCpAppManageButton, 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 panel14 = new JPanel(); - panel14.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel14.setLayout(new GridLayoutManager(1, 3, new Insets(15, 15, 10, 0), -1, -1)); + Font panel14Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel14.getFont()); + if (panel14Font != null) panel14.setFont(panel14Font); panel3.add(panel14, new GridConstraints(4, 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)); - panel14.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "阿里云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel14.getFont()))); + panel14.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "钉钉", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel14.getFont()))); + final JPanel panel15 = new JPanel(); + panel15.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel14.add(panel15, 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 Spacer spacer8 = new Spacer(); + panel15.add(spacer8, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + dingAppManageButton = new JButton(); + dingAppManageButton.setText("应用管理"); + panel15.add(dingAppManageButton, 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 JPanel panel16 = new JPanel(); + panel16.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel3.add(panel16, new GridConstraints(5, 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)); + panel16.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "阿里云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel16.getFont()))); final JLabel label23 = new JLabel(); label23.setText("AccessKeyId"); - panel14.add(label23, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel16.add(label23, 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 label24 = new JLabel(); label24.setText("AccessKeySecret"); - panel14.add(label24, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel16.add(label24, 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 label25 = new JLabel(); label25.setText("短信签名"); - panel14.add(label25, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel16.add(label25, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); aliyunSignTextField = new JTextField(); - panel14.add(aliyunSignTextField, 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)); + panel16.add(aliyunSignTextField, 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)); aliyunAccessKeySecretTextField = new JPasswordField(); - panel14.add(aliyunAccessKeySecretTextField, 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 panel15 = new JPanel(); - panel15.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel14.add(panel15, 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)); + panel16.add(aliyunAccessKeySecretTextField, 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 panel17 = new JPanel(); + panel17.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel16.add(panel17, 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)); settingAliyunSaveButton = new JButton(); settingAliyunSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingAliyunSaveButton.setText("保存"); - panel15.add(settingAliyunSaveButton, 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 spacer8 = new Spacer(); - panel15.add(spacer8, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + panel17.add(settingAliyunSaveButton, 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 spacer9 = new Spacer(); + panel17.add(spacer9, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); aliyunAccessKeyIdTextField = new JTextField(); - panel14.add(aliyunAccessKeyIdTextField, 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 panel16 = new JPanel(); - panel16.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); - panel3.add(panel16, new GridConstraints(5, 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)); - panel16.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "腾讯云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel16.getFont()))); + panel16.add(aliyunAccessKeyIdTextField, 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 panel18 = new JPanel(); + panel18.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel3.add(panel18, new GridConstraints(6, 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)); + panel18.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "腾讯云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel18.getFont()))); final JLabel label26 = new JLabel(); label26.setText("AppId"); - panel16.add(label26, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel18.add(label26, 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 label27 = new JLabel(); label27.setText("AppKey"); - panel16.add(label27, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel18.add(label27, 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 label28 = new JLabel(); label28.setText("短信签名"); - panel16.add(label28, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel18.add(label28, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); txyunSignTextField = new JTextField(); - panel16.add(txyunSignTextField, 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)); + panel18.add(txyunSignTextField, 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)); txyunAppKeyTextField = new JPasswordField(); txyunAppKeyTextField.setText(""); - panel16.add(txyunAppKeyTextField, 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 panel17 = new JPanel(); - panel17.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel16.add(panel17, 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)); + panel18.add(txyunAppKeyTextField, 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 panel19 = new JPanel(); + panel19.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel18.add(panel19, 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)); settingTxyunSaveButton = new JButton(); settingTxyunSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingTxyunSaveButton.setText("保存"); - panel17.add(settingTxyunSaveButton, 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 spacer9 = new Spacer(); - panel17.add(spacer9, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + panel19.add(settingTxyunSaveButton, 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 spacer10 = new Spacer(); + panel19.add(spacer10, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); txyunAppIdTextField = new JTextField(); - panel16.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 panel18 = new JPanel(); - panel18.setLayout(new GridLayoutManager(2, 4, new Insets(15, 15, 10, 0), -1, -1)); - panel3.add(panel18, new GridConstraints(6, 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)); - panel18.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "云片网短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel18.getFont()))); + 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)); + 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()))); final JLabel label29 = new JLabel(); label29.setText("ApiKey"); - panel18.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)); + 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(""); - panel18.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 panel19 = new JPanel(); - panel19.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel18.add(panel19, 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)); + 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 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("保存"); - panel19.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 spacer10 = new Spacer(); - panel19.add(spacer10, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); - final JPanel panel20 = new JPanel(); - panel20.setLayout(new GridLayoutManager(8, 4, new Insets(15, 15, 10, 0), -1, -1)); - panel3.add(panel20, 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)); - panel20.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "E-Mail", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel20.getFont()))); + 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)); + 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)); + 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地址"); - panel20.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)); + 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端口"); - panel20.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)); + 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("发件人(邮箱地址)"); - panel20.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)); + 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号"); - panel20.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.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)); final JLabel label34 = new JLabel(); label34.setText("密码"); - panel20.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)); - final JPanel panel21 = new JPanel(); - panel21.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); - panel20.add(panel21, 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)); + 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)); + 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)); saveMailButton = new JButton(); saveMailButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); saveMailButton.setText("保存"); - panel21.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 spacer11 = new Spacer(); - panel21.add(spacer11, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + 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)); testMailButton = new JButton(); testMailButton.setIcon(new ImageIcon(getClass().getResource("/icon/arrow_right.png"))); testMailButton.setText("测试"); - panel21.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)); + 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)); mailStartTLSCheckBox = new JCheckBox(); mailStartTLSCheckBox.setText("使用STARTTLS安全连接"); - panel20.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)); + 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)); mailSSLCheckBox = new JCheckBox(); mailSSLCheckBox.setText("使用SSL安全连接"); - panel20.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)); + 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)); mailHostTextField = new JTextField(); - panel20.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)); + 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)); mailPortTextField = new JTextField(); - panel20.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)); + 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)); mailFromTextField = new JTextField(); - panel20.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)); + 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)); mailUserTextField = new JTextField(); - panel20.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)); + 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)); mailPasswordField = new JPasswordField(); - panel20.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 panel22 = new JPanel(); - panel22.setLayout(new GridLayoutManager(4, 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(), "MySQL数据库", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel22.getFont()))); + 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("数据库地址"); - panel22.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(label35, 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(); - panel22.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)); + 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("用户名"); - panel22.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)); + 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)); mysqlUserTextField = new JTextField(); - panel22.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)); + 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("密码"); - panel22.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.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)); mysqlPasswordField = new JPasswordField(); - panel22.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 panel23 = new JPanel(); - panel23.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1)); - panel22.add(panel23, 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)); + 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)); settingTestDbLinkButton = new JButton(); settingTestDbLinkButton.setIcon(new ImageIcon(getClass().getResource("/icon/arrow_right.png"))); settingTestDbLinkButton.setText("测试连接"); - panel23.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 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(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)); settingDbInfoSaveButton = new JButton(); settingDbInfoSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingDbInfoSaveButton.setText("保存"); - panel23.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 panel24 = new JPanel(); - panel24.setLayout(new GridLayoutManager(4, 3, 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(), "外观", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel24.getFont()))); + 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("主题风格"); - 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)); + 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)); settingThemeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("Darcula(推荐)"); defaultComboBoxModel1.addElement("BeautyEye"); defaultComboBoxModel1.addElement("系统默认"); settingThemeComboBox.setModel(defaultComboBoxModel1); - panel24.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)); + 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("字体"); - panel24.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)); + 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)); settingFontNameComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel(); defaultComboBoxModel2.addElement("Microsoft YaHei"); @@ -762,10 +777,10 @@ public static void toggleMpOutSideAccessTokenPanel() { defaultComboBoxModel2.addElement("Microsoft YaHei UI"); defaultComboBoxModel2.addElement("Microsoft YaHei UI Light"); settingFontNameComboBox.setModel(defaultComboBoxModel2); - panel24.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)); + 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("字号"); - panel24.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)); + 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)); settingFontSizeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel3 = new DefaultComboBoxModel(); defaultComboBoxModel3.addElement("5"); @@ -791,37 +806,37 @@ public static void toggleMpOutSideAccessTokenPanel() { defaultComboBoxModel3.addElement("25"); defaultComboBoxModel3.addElement("26"); settingFontSizeComboBox.setModel(defaultComboBoxModel3); - panel24.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 panel25 = new JPanel(); - panel25.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel24.add(panel25, 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)); + 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)); settingAppearanceSaveButton = new JButton(); settingAppearanceSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingAppearanceSaveButton.setText("保存"); - panel25.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 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(3, 3, new Insets(15, 15, 10, 0), -1, -1)); - Font panel26Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel26.getFont()); - if (panel26Font != null) panel26.setFont(panel26Font); - panel3.add(panel26, 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)); - panel26.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel26.getFont()))); - final JPanel panel27 = new JPanel(); - panel27.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel26.add(panel27, 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)); + 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)); httpSaveButton = new JButton(); httpSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); httpSaveButton.setText("保存"); - panel27.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 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)); + 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)); httpUseProxyCheckBox = new JCheckBox(); httpUseProxyCheckBox.setText("使用HTTP代理"); - panel26.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)); + 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)); httpProxyPanel = new JPanel(); httpProxyPanel.setLayout(new GridLayoutManager(4, 2, new Insets(0, 26, 0, 0), -1, -1)); - panel26.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)); + 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)); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form index 2cec5134..ca6a0f7e 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form @@ -38,10 +38,10 @@ - - + +
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java index 24f166a1..dd06899b 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -270,10 +270,10 @@ public static void clearAllField() { dingMsgPanel.add(spacer1, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); msgTypeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); - defaultComboBoxModel1.addElement("图文消息"); defaultComboBoxModel1.addElement("文本消息"); - defaultComboBoxModel1.addElement("文本卡片消息"); + defaultComboBoxModel1.addElement("链接消息"); defaultComboBoxModel1.addElement("markdown消息"); + defaultComboBoxModel1.addElement("卡片消息"); msgTypeComboBox.setModel(defaultComboBoxModel1); dingMsgPanel.add(msgTypeComboBox, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); titleLabel = new JLabel(); 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 6e301b97..d8b6cae1 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 @@ -20,6 +20,7 @@ import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; import com.fangxuele.tool.push.ui.form.MainWindow; import com.fangxuele.tool.push.ui.form.SettingForm; +import com.fangxuele.tool.push.ui.form.msg.DingMsgForm; import com.fangxuele.tool.push.ui.form.msg.WxCpMsgForm; import com.fangxuele.tool.push.util.HikariUtil; import com.fangxuele.tool.push.util.MybatisUtil; @@ -256,6 +257,15 @@ public static void addListeners() { WxCpMsgForm.initAppNameList(); }); + // 设置-钉钉-应用管理 + settingForm.getDingAppManageButton().addActionListener(e -> { + WxCpAppDialog dialog = new WxCpAppDialog(); + dialog.renderTable(); + dialog.pack(); + dialog.setVisible(true); + DingMsgForm.initAppNameList(); + }); + // 设置-阿里云短信-保存 settingForm.getSettingAliyunSaveButton().addActionListener(e -> { try { From cb2890a9dff09cbb7a36b311e372828088828f68 Mon Sep 17 00:00:00 2001 From: duoduo Date: Thu, 5 Sep 2019 13:42:59 +0800 Subject: [PATCH 06/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=A2=9E=E5=8A=A0=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/dao/TDingAppMapper.java | 24 ++ .../fangxuele/tool/push/domain/TDingApp.java | 77 +++++ .../tool/push/ui/dialog/DingAppDialog.form | 154 ++++++++++ .../tool/push/ui/dialog/DingAppDialog.java | 274 ++++++++++++++++++ .../tool/push/ui/dialog/WxCpAppDialog.java | 1 - .../tool/push/ui/form/msg/DingMsgForm.java | 20 +- .../push/ui/listener/SettingListener.java | 3 +- src/main/resources/db_init.sql | 12 + src/main/resources/generatorConfig.xml | 2 +- src/main/resources/mapper/TDingAppMapper.xml | 129 +++++++++ src/main/resources/mybatis-config.xml | 1 + 11 files changed, 684 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java create mode 100644 src/main/java/com/fangxuele/tool/push/domain/TDingApp.java create mode 100644 src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form create mode 100644 src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java create mode 100644 src/main/resources/mapper/TDingAppMapper.xml diff --git a/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java new file mode 100644 index 00000000..89e08cc5 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java @@ -0,0 +1,24 @@ +package com.fangxuele.tool.push.dao; + +import com.fangxuele.tool.push.domain.TDingApp; + +import java.util.List; + +public interface TDingAppMapper { + int deleteByPrimaryKey(Integer id); + + int insert(TDingApp record); + + int insertSelective(TDingApp record); + + TDingApp selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(TDingApp record); + + int updateByPrimaryKey(TDingApp record); + + List selectByAppName(String appName); + + List selectAll(); + +} \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/domain/TDingApp.java b/src/main/java/com/fangxuele/tool/push/domain/TDingApp.java new file mode 100644 index 00000000..6e259643 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/domain/TDingApp.java @@ -0,0 +1,77 @@ +package com.fangxuele.tool.push.domain; + +import java.io.Serializable; + +public class TDingApp implements Serializable { + private Integer id; + + private String appName; + + private String agentId; + + private String appKey; + + private String appSecret; + + private String createTime; + + private String modifiedTime; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName == null ? null : appName.trim(); + } + + public String getAgentId() { + return agentId; + } + + public void setAgentId(String agentId) { + this.agentId = agentId == null ? null : agentId.trim(); + } + + public String getAppKey() { + return appKey; + } + + public void setAppKey(String appKey) { + this.appKey = appKey == null ? null : appKey.trim(); + } + + public String getAppSecret() { + return appSecret; + } + + public void setAppSecret(String appSecret) { + this.appSecret = appSecret == null ? null : appSecret.trim(); + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime == null ? null : createTime.trim(); + } + + public String getModifiedTime() { + return modifiedTime; + } + + public void setModifiedTime(String modifiedTime) { + this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim(); + } +} \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form new file mode 100644 index 00000000..4aa3edfd --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form @@ -0,0 +1,154 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java new file mode 100644 index 00000000..6a20d064 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java @@ -0,0 +1,274 @@ +package com.fangxuele.tool.push.ui.dialog; + +import cn.hutool.core.thread.ThreadUtil; +import cn.hutool.log.Log; +import cn.hutool.log.LogFactory; +import com.fangxuele.tool.push.App; +import com.fangxuele.tool.push.dao.TDingAppMapper; +import com.fangxuele.tool.push.domain.TDingApp; +import com.fangxuele.tool.push.ui.form.SettingForm; +import com.fangxuele.tool.push.util.ComponentUtil; +import com.fangxuele.tool.push.util.JTableUtil; +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 com.intellij.uiDesigner.core.Spacer; +import org.apache.commons.lang3.StringUtils; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.DefaultTableModel; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.List; + +/** + *
+ * DingAppDialog
+ * 
+ * + * @author Zhou Bo + * @since 2019/9/5. + */ +public class DingAppDialog extends JDialog { + private JPanel contentPane; + private JButton buttonDelete; + private JButton buttonCancel; + private JTable appsTable; + private JTextField appNameTextField; + private JTextField agentIdTextField; + private JTextField appKeyTextField; + private JTextField appSecretTextField; + private JButton saveButton; + + private Log logger = LogFactory.get(); + private static TDingAppMapper dingAppMapper = MybatisUtil.getSqlSession().getMapper(TDingAppMapper.class); + + public DingAppDialog() { + super(App.mainFrame, "钉钉-应用管理"); + setContentPane(contentPane); + setModal(true); + + ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.5, 0.5); + + // 保存按钮事件 + saveButton.addActionListener(e -> { + String appName = appNameTextField.getText(); + if (StringUtils.isBlank(appName)) { + JOptionPane.showMessageDialog(this, "请填写账号名称!", "提示", + JOptionPane.INFORMATION_MESSAGE); + return; + } + String agentId = agentIdTextField.getText(); + if (StringUtils.isBlank(agentId)) { + JOptionPane.showMessageDialog(this, "请填写AgentId!", "提示", + JOptionPane.INFORMATION_MESSAGE); + return; + } + + boolean update = false; + List tDingAppList = dingAppMapper.selectByAppName(appName); + if (tDingAppList.size() > 0) { + update = true; + } + + TDingApp tDingApp = new TDingApp(); + String now = SqliteUtil.nowDateForSqlite(); + tDingApp.setAppName(appName); + tDingApp.setAgentId(agentIdTextField.getText()); + tDingApp.setAppKey(appKeyTextField.getText()); + tDingApp.setAppSecret(appSecretTextField.getText()); + tDingApp.setModifiedTime(now); + + if (update) { + tDingApp.setId(tDingAppList.get(0).getId()); + dingAppMapper.updateByPrimaryKeySelective(tDingApp); + } else { + tDingApp.setCreateTime(now); + dingAppMapper.insert(tDingApp); + } + renderTable(); + JOptionPane.showMessageDialog(this, "保存成功!", "成功", + JOptionPane.INFORMATION_MESSAGE); + }); + + // 删除按钮事件 + buttonDelete.addActionListener(e -> ThreadUtil.execute(() -> { + try { + int[] selectedRows = appsTable.getSelectedRows(); + if (selectedRows.length == 0) { + JOptionPane.showMessageDialog(this, "请至少选择一个!", "提示", + JOptionPane.INFORMATION_MESSAGE); + } else { + int isDelete = JOptionPane.showConfirmDialog(this, "确认删除?", "确认", + JOptionPane.YES_NO_OPTION); + if (isDelete == JOptionPane.YES_OPTION) { + DefaultTableModel tableModel = (DefaultTableModel) appsTable.getModel(); + for (int i = selectedRows.length; i > 0; i--) { + int selectedRow = appsTable.getSelectedRow(); + Integer selectedId = (Integer) tableModel.getValueAt(selectedRow, 0); + dingAppMapper.deleteByPrimaryKey(selectedId); + tableModel.removeRow(selectedRow); + } + SettingForm.initSwitchMultiAccount(); + } + } + } catch (Exception e1) { + JOptionPane.showMessageDialog(this, "删除失败!\n\n" + e1.getMessage(), "失败", + JOptionPane.ERROR_MESSAGE); + logger.error(e1); + } + })); + + appsTable.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + clearFields(); + + int selectedRow = appsTable.getSelectedRow(); + String selectedId = appsTable.getValueAt(selectedRow, 0).toString(); + TDingApp tDingApp = dingAppMapper.selectByPrimaryKey(Integer.valueOf(selectedId)); + appNameTextField.setText(tDingApp.getAppName()); + agentIdTextField.setText(tDingApp.getAgentId()); + appKeyTextField.setText(tDingApp.getAppKey()); + appSecretTextField.setText(tDingApp.getAppSecret()); + super.mousePressed(e); + } + }); + + buttonCancel.addActionListener(e -> onCancel()); + + // call onCancel() when cross is clicked + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + onCancel(); + } + }); + + // call onCancel() on ESCAPE + contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + } + + private void onCancel() { + // add your code here if necessary + dispose(); + } + + /** + * 应用列表表格 + */ + public void renderTable() { + String[] headerNames = {"id", "应用名称", "AgentId", "AppKey", "AppSecret"}; + DefaultTableModel model = new DefaultTableModel(null, headerNames); + appsTable.setModel(model); + + DefaultTableCellRenderer hr = (DefaultTableCellRenderer) appsTable.getTableHeader().getDefaultRenderer(); + // 表头列名居左 + hr.setHorizontalAlignment(DefaultTableCellRenderer.LEFT); + + List dingAppList = dingAppMapper.selectAll(); + Object[] data; + for (TDingApp tDingApp : dingAppList) { + data = new Object[5]; + data[0] = tDingApp.getId(); + data[1] = tDingApp.getAppName(); + data[2] = tDingApp.getAgentId(); + data[3] = tDingApp.getAppKey(); + data[4] = tDingApp.getAppSecret(); + model.addRow(data); + } + + // 隐藏id列 + JTableUtil.hideColumn(appsTable, 0); + } + + /** + * 清空表单 + */ + public void clearFields() { + appNameTextField.setText(""); + agentIdTextField.setText(""); + appKeyTextField.setText(""); + appSecretTextField.setText(""); + } + + { +// 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$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); + panel1.add(panel2, new GridConstraints(0, 1, 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)); + buttonDelete = new JButton(); + buttonDelete.setText("删除"); + panel2.add(buttonDelete, 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)); + buttonCancel = new JButton(); + buttonCancel.setText("好了"); + panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel3 = new JPanel(); + panel3.setLayout(new GridLayoutManager(5, 3, new Insets(5, 5, 0, 5), -1, -1)); + contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + panel3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "添加应用")); + final JLabel label1 = new JLabel(); + label1.setText("应用名称"); + panel3.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)); + final JLabel label2 = new JLabel(); + label2.setText("AgentId"); + panel3.add(label2, 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 label3 = new JLabel(); + label3.setText("Appkey"); + panel3.add(label3, 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 label4 = new JLabel(); + label4.setText("AppSecret"); + panel3.add(label4, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + appNameTextField = new JTextField(); + panel3.add(appNameTextField, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + agentIdTextField = new JTextField(); + panel3.add(agentIdTextField, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + appKeyTextField = new JTextField(); + panel3.add(appKeyTextField, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + appSecretTextField = new JTextField(); + panel3.add(appSecretTextField, new GridConstraints(3, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + saveButton = new JButton(); + saveButton.setText("保存"); + panel3.add(saveButton, new GridConstraints(4, 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)); + final Spacer spacer2 = new Spacer(); + panel3.add(spacer2, new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + appsTable = new JTable(); + scrollPane1.setViewportView(appsTable); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } +} diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/WxCpAppDialog.java b/src/main/java/com/fangxuele/tool/push/ui/dialog/WxCpAppDialog.java index 397905f7..780d28e3 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/dialog/WxCpAppDialog.java +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/WxCpAppDialog.java @@ -93,7 +93,6 @@ public WxCpAppDialog() { wxCpAppMapper.insert(tWxCpApp); } renderTable(); - SettingForm.initSwitchMultiAccount(); JOptionPane.showMessageDialog(this, "保存成功!", "成功", JOptionPane.INFORMATION_MESSAGE); }); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java index dd06899b..3597c3ea 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -1,11 +1,11 @@ package com.fangxuele.tool.push.ui.form.msg; +import com.fangxuele.tool.push.dao.TDingAppMapper; import com.fangxuele.tool.push.dao.TMsgWxCpMapper; -import com.fangxuele.tool.push.dao.TWxCpAppMapper; +import com.fangxuele.tool.push.domain.TDingApp; import com.fangxuele.tool.push.domain.TMsgWxCp; -import com.fangxuele.tool.push.domain.TWxCpApp; import com.fangxuele.tool.push.logic.MessageTypeEnum; -import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; +import com.fangxuele.tool.push.ui.dialog.DingAppDialog; import com.fangxuele.tool.push.ui.form.MainWindow; import com.fangxuele.tool.push.util.MybatisUtil; import com.fangxuele.tool.push.util.SqliteUtil; @@ -54,7 +54,7 @@ public class DingMsgForm implements IMsgForm { private static DingMsgForm dingMsgForm; private static TMsgWxCpMapper msgWxCpMapper = MybatisUtil.getSqlSession().getMapper(TMsgWxCpMapper.class); - private static TWxCpAppMapper wxCpAppMapper = MybatisUtil.getSqlSession().getMapper(TWxCpAppMapper.class); + private static TDingAppMapper dingAppMapper = MybatisUtil.getSqlSession().getMapper(TDingAppMapper.class); public static Map appNameToAgentIdMap = Maps.newHashMap(); public static Map agentIdToAppNameMap = Maps.newHashMap(); @@ -67,7 +67,7 @@ public DingMsgForm() { } }); appManageButton.addActionListener(e -> { - WxCpAppDialog dialog = new WxCpAppDialog(); + DingAppDialog dialog = new DingAppDialog(); dialog.renderTable(); dialog.pack(); dialog.setVisible(true); @@ -167,12 +167,12 @@ public static DingMsgForm getInstance() { * 初始化应用名称列表 */ public static void initAppNameList() { - List tWxCpAppList = wxCpAppMapper.selectAll(); + List tDingAppList = dingAppMapper.selectAll(); getInstance().getAppNameComboBox().removeAllItems(); - for (TWxCpApp tWxCpApp : tWxCpAppList) { - appNameToAgentIdMap.put(tWxCpApp.getAppName(), tWxCpApp.getAgentId()); - agentIdToAppNameMap.put(tWxCpApp.getAgentId(), tWxCpApp.getAppName()); - getInstance().getAppNameComboBox().addItem(tWxCpApp.getAppName()); + for (TDingApp tDingApp : tDingAppList) { + appNameToAgentIdMap.put(tDingApp.getAppName(), tDingApp.getAgentId()); + agentIdToAppNameMap.put(tDingApp.getAgentId(), tDingApp.getAppName()); + getInstance().getAppNameComboBox().addItem(tDingApp.getAppName()); } } 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 d8b6cae1..e3602a0b 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 @@ -15,6 +15,7 @@ import com.fangxuele.tool.push.ui.Init; import com.fangxuele.tool.push.ui.UiConsts; import com.fangxuele.tool.push.ui.dialog.CommonTipsDialog; +import com.fangxuele.tool.push.ui.dialog.DingAppDialog; import com.fangxuele.tool.push.ui.dialog.MailTestDialog; import com.fangxuele.tool.push.ui.dialog.SwitchWxAccountDialog; import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; @@ -259,7 +260,7 @@ public static void addListeners() { // 设置-钉钉-应用管理 settingForm.getDingAppManageButton().addActionListener(e -> { - WxCpAppDialog dialog = new WxCpAppDialog(); + DingAppDialog dialog = new DingAppDialog(); dialog.renderTable(); dialog.pack(); dialog.setVisible(true); diff --git a/src/main/resources/db_init.sql b/src/main/resources/db_init.sql index e155071f..35b98b43 100644 --- a/src/main/resources/db_init.sql +++ b/src/main/resources/db_init.sql @@ -241,3 +241,15 @@ create table if not exists t_msg_ding create unique index if not exists t_msg_ding_msg_type_msg_name_uindex on t_msg_ding (msg_type, msg_name); +create table if not exists t_ding_app +( + id INTEGER + constraint t_ding_app_pk + primary key autoincrement, + app_name text, + agent_id text, + app_key text, + app_secret text, + create_time datetime, + modified_time datetime +); \ No newline at end of file diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index 721f60eb..2b45be3b 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -45,7 +45,7 @@ + tableName="t_ding_app" domainObjectName="TDingApp">
diff --git a/src/main/resources/mapper/TDingAppMapper.xml b/src/main/resources/mapper/TDingAppMapper.xml new file mode 100644 index 00000000..0d457ce1 --- /dev/null +++ b/src/main/resources/mapper/TDingAppMapper.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + id, app_name, agent_id, app_key, app_secret, create_time, modified_time + + + + delete + from t_ding_app + where id = #{id,jdbcType=INTEGER} + + + insert into t_ding_app (id, app_name, agent_id, + app_key, app_secret, create_time, + modified_time) + values (#{id,jdbcType=INTEGER}, #{appName,jdbcType=VARCHAR}, #{agentId,jdbcType=VARCHAR}, + #{appKey,jdbcType=VARCHAR}, #{appSecret,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, + #{modifiedTime,jdbcType=VARCHAR}) + + + insert into t_ding_app + + + id, + + + app_name, + + + agent_id, + + + app_key, + + + app_secret, + + + create_time, + + + modified_time, + + + + + #{id,jdbcType=INTEGER}, + + + #{appName,jdbcType=VARCHAR}, + + + #{agentId,jdbcType=VARCHAR}, + + + #{appKey,jdbcType=VARCHAR}, + + + #{appSecret,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=VARCHAR}, + + + #{modifiedTime,jdbcType=VARCHAR}, + + + + + update t_ding_app + + + app_name = #{appName,jdbcType=VARCHAR}, + + + agent_id = #{agentId,jdbcType=VARCHAR}, + + + app_key = #{appKey,jdbcType=VARCHAR}, + + + app_secret = #{appSecret,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=VARCHAR}, + + + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update t_ding_app + set app_name = #{appName,jdbcType=VARCHAR}, + agent_id = #{agentId,jdbcType=VARCHAR}, + app_key = #{appKey,jdbcType=VARCHAR}, + app_secret = #{appSecret,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=VARCHAR}, + modified_time = #{modifiedTime,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index 1f1042be..d900a686 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -28,5 +28,6 @@ + \ No newline at end of file From ebd278c48245f39a0053d381036ee5bcf6ac3318 Mon Sep 17 00:00:00 2001 From: duoduo Date: Tue, 3 Sep 2019 22:15:00 +0800 Subject: [PATCH 07/33] =?UTF-8?q?feature:=E5=A2=9E=E5=8A=A0=E9=92=89?= =?UTF-8?q?=E9=92=89=E6=B6=88=E6=81=AF=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/dao/TMsgDingMapper.java | 17 +++ .../fangxuele/tool/push/domain/TMsgDing.java | 97 ++++++++++++ src/main/resources/db_init.sql | 19 +++ src/main/resources/generatorConfig.xml | 4 +- src/main/resources/mapper/TMsgDingMapper.xml | 141 ++++++++++++++++++ src/main/resources/mybatis-config.xml | 1 + 6 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java create mode 100644 src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java create mode 100644 src/main/resources/mapper/TMsgDingMapper.xml diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java new file mode 100644 index 00000000..d31841e9 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java @@ -0,0 +1,17 @@ +package com.fangxuele.tool.push.dao; + +import com.fangxuele.tool.push.domain.TMsgDing; + +public interface TMsgDingMapper { + int deleteByPrimaryKey(Integer id); + + int insert(TMsgDing record); + + int insertSelective(TMsgDing record); + + TMsgDing selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(TMsgDing record); + + int updateByPrimaryKey(TMsgDing record); +} \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java new file mode 100644 index 00000000..48cfd240 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java @@ -0,0 +1,97 @@ +package com.fangxuele.tool.push.domain; + +import java.io.Serializable; + +public class TMsgDing implements Serializable { + private Integer id; + + private Integer msgType; + + private String msgName; + + private String dingMsgType; + + private String agentId; + + private String webHook; + + private String content; + + private String createTime; + + private String modifiedTime; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getMsgType() { + return msgType; + } + + public void setMsgType(Integer msgType) { + this.msgType = msgType; + } + + public String getMsgName() { + return msgName; + } + + public void setMsgName(String msgName) { + this.msgName = msgName == null ? null : msgName.trim(); + } + + public String getDingMsgType() { + return dingMsgType; + } + + public void setDingMsgType(String dingMsgType) { + this.dingMsgType = dingMsgType == null ? null : dingMsgType.trim(); + } + + public String getAgentId() { + return agentId; + } + + public void setAgentId(String agentId) { + this.agentId = agentId == null ? null : agentId.trim(); + } + + public String getWebHook() { + return webHook; + } + + public void setWebHook(String webHook) { + this.webHook = webHook == null ? null : webHook.trim(); + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content == null ? null : content.trim(); + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime == null ? null : createTime.trim(); + } + + public String getModifiedTime() { + return modifiedTime; + } + + public void setModifiedTime(String modifiedTime) { + this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim(); + } +} \ No newline at end of file diff --git a/src/main/resources/db_init.sql b/src/main/resources/db_init.sql index d3f60f3a..e155071f 100644 --- a/src/main/resources/db_init.sql +++ b/src/main/resources/db_init.sql @@ -222,3 +222,22 @@ create table if not exists t_msg_http create unique index if not exists t_msg_http_msg_type_msg_name_uindex on t_msg_http (msg_type, msg_name); + +create table if not exists t_msg_ding +( + id integer + constraint t_msg_ding_pk + primary key autoincrement, + msg_type integer, + msg_name text, + ding_msg_type text, + agent_id text, + web_hook text, + content text, + create_time datetime, + modified_time datetime +); + +create unique index if not exists t_msg_ding_msg_type_msg_name_uindex + on t_msg_ding (msg_type, msg_name); + diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index 4bb0bf39..721f60eb 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -4,7 +4,7 @@ "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> - + @@ -45,7 +45,7 @@ + tableName="t_msg_ding" domainObjectName="TMsgDing">
diff --git a/src/main/resources/mapper/TMsgDingMapper.xml b/src/main/resources/mapper/TMsgDingMapper.xml new file mode 100644 index 00000000..50628b22 --- /dev/null +++ b/src/main/resources/mapper/TMsgDingMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + id, msg_type, msg_name, ding_msg_type, agent_id, web_hook, content, create_time, + modified_time + + + + delete + from t_msg_ding + where id = #{id,jdbcType=INTEGER} + + + insert into t_msg_ding (id, msg_type, msg_name, + ding_msg_type, agent_id, web_hook, + content, create_time, modified_time) + values (#{id,jdbcType=INTEGER}, #{msgType,jdbcType=INTEGER}, #{msgName,jdbcType=VARCHAR}, + #{dingMsgType,jdbcType=VARCHAR}, #{agentId,jdbcType=VARCHAR}, #{webHook,jdbcType=VARCHAR}, + #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=VARCHAR}) + + + insert into t_msg_ding + + + id, + + + msg_type, + + + msg_name, + + + ding_msg_type, + + + agent_id, + + + web_hook, + + + content, + + + create_time, + + + modified_time, + + + + + #{id,jdbcType=INTEGER}, + + + #{msgType,jdbcType=INTEGER}, + + + #{msgName,jdbcType=VARCHAR}, + + + #{dingMsgType,jdbcType=VARCHAR}, + + + #{agentId,jdbcType=VARCHAR}, + + + #{webHook,jdbcType=VARCHAR}, + + + #{content,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=VARCHAR}, + + + #{modifiedTime,jdbcType=VARCHAR}, + + + + + update t_msg_ding + + + msg_type = #{msgType,jdbcType=INTEGER}, + + + msg_name = #{msgName,jdbcType=VARCHAR}, + + + ding_msg_type = #{dingMsgType,jdbcType=VARCHAR}, + + + agent_id = #{agentId,jdbcType=VARCHAR}, + + + web_hook = #{webHook,jdbcType=VARCHAR}, + + + content = #{content,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=VARCHAR}, + + + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update t_msg_ding + set msg_type = #{msgType,jdbcType=INTEGER}, + msg_name = #{msgName,jdbcType=VARCHAR}, + ding_msg_type = #{dingMsgType,jdbcType=VARCHAR}, + agent_id = #{agentId,jdbcType=VARCHAR}, + web_hook = #{webHook,jdbcType=VARCHAR}, + content = #{content,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=VARCHAR}, + modified_time = #{modifiedTime,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index b795ed9c..1f1042be 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -27,5 +27,6 @@ + \ No newline at end of file From ccfbfe080fd6ca96e12273afa82206ece0ae8dfc Mon Sep 17 00:00:00 2001 From: duoduo Date: Wed, 4 Sep 2019 21:34:34 +0800 Subject: [PATCH 08/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=95=8C=E9=9D=A2=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/logic/MessageTypeEnum.java | 7 +- .../tool/push/ui/form/MessageEditForm.java | 4 + .../tool/push/ui/form/MessageTypeForm.form | 42 +-- .../tool/push/ui/form/MessageTypeForm.java | 37 +- .../tool/push/ui/form/msg/DingMsgForm.form | 188 ++++++++++ .../tool/push/ui/form/msg/DingMsgForm.java | 349 ++++++++++++++++++ .../tool/push/ui/form/msg/MsgFormFactory.java | 3 + .../push/ui/listener/MessageTypeListener.java | 4 + 8 files changed, 595 insertions(+), 39 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form create mode 100644 src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.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 49a0624d..66cdc7e1 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java +++ b/src/main/java/com/fangxuele/tool/push/logic/MessageTypeEnum.java @@ -23,7 +23,8 @@ public enum MessageTypeEnum { HW_YUN(10, "华为云短信"), EMAIL(11, "E-Mail"), WX_CP(12, "微信企业号/企业微信"), - HTTP(13, "HTTP请求"); + HTTP(13, "HTTP请求"), + DING(14, "钉钉"); private int code; @@ -41,6 +42,7 @@ public enum MessageTypeEnum { public static final int EMAIL_CODE = 11; public static final int WX_CP_CODE = 12; public static final int HTTP_CODE = 13; + public static final int DING_CODE = 14; MessageTypeEnum(int code, String name) { this.code = code; @@ -86,6 +88,9 @@ public static String getName(int code) { case 13: name = HTTP.name; break; + case 14: + name = DING.name; + break; default: } return name; 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 efc01db2..0c0c045d 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.DingMsgForm; import com.fangxuele.tool.push.ui.form.msg.HttpMsgForm; import com.fangxuele.tool.push.ui.form.msg.KefuMsgForm; import com.fangxuele.tool.push.ui.form.msg.MaTemplateMsgForm; @@ -123,6 +124,9 @@ public static void switchMsgType(int msgType) { case MessageTypeEnum.HTTP_CODE: messageEditForm.getMsgEditorPanel().add(HttpMsgForm.getInstance().getHttpPanel(), gridConstraintsRow0); break; + case MessageTypeEnum.DING_CODE: + messageEditForm.getMsgEditorPanel().add(DingMsgForm.getInstance().getDingMsgPanel(), 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 66edfeed..7fc1faf3 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 @@ -63,7 +63,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -96,7 +96,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -132,7 +132,7 @@ - + @@ -140,21 +140,12 @@ - - - - - - - - - - + @@ -168,7 +159,7 @@ - + @@ -186,7 +177,7 @@ - + @@ -207,6 +198,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 203ceafc..f8fef421 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 @@ -38,7 +38,7 @@ public class MessageTypeForm { private JRadioButton 极光短信RadioButton; private JRadioButton 极光推送RadioButton; private JRadioButton wxCpRadioButton; - private JRadioButton 钉钉RadioButton; + private JRadioButton dingRadioButton; private JScrollPane messageTypeScrollPane; private JLabel kefuPriorityTipsLabel; private JRadioButton httpRadioButton; @@ -105,6 +105,9 @@ public static void init() { case MessageTypeEnum.HTTP_CODE: messageTypeForm.getHttpRadioButton().setSelected(true); break; + case MessageTypeEnum.DING_CODE: + messageTypeForm.getDingRadioButton().setSelected(true); + break; default: } @@ -211,45 +214,41 @@ public static void clearAllSelected() { msgTypeListPanel.add(kefuPriorityRadioButton, new GridConstraints(4, 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)); aliYunRadioButton = new JRadioButton(); aliYunRadioButton.setText("阿里云短信"); - msgTypeListPanel.add(aliYunRadioButton, 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)); + msgTypeListPanel.add(aliYunRadioButton, new GridConstraints(7, 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)); txYunRadioButton = new JRadioButton(); txYunRadioButton.setText("腾讯云短信"); - msgTypeListPanel.add(txYunRadioButton, new GridConstraints(7, 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(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(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)); + 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)); upYunRadioButton = new JRadioButton(); upYunRadioButton.setEnabled(false); upYunRadioButton.setText("又拍云短信"); - msgTypeListPanel.add(upYunRadioButton, 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(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(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(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)); 网易云信短信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)); 榛子云短信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)); + msgTypeListPanel.add(榛子云短信RadioButton, new GridConstraints(15, 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)); luosimao短信RadioButton = new JRadioButton(); luosimao短信RadioButton.setEnabled(false); luosimao短信RadioButton.setText("Luosimao短信"); - msgTypeListPanel.add(luosimao短信RadioButton, new GridConstraints(15, 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(luosimao短信RadioButton, new GridConstraints(16, 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(16, 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(17, 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(17, 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(18, 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(18, 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)); kefuPriorityTipsLabel = new JLabel(); kefuPriorityTipsLabel.setIcon(new ImageIcon(getClass().getResource("/icon/helpButton.png"))); kefuPriorityTipsLabel.setText(""); @@ -257,7 +256,7 @@ public static void clearAllSelected() { eMailRadioButton = new JRadioButton(); eMailRadioButton.setEnabled(true); eMailRadioButton.setText("E-Mail(BETA)"); - msgTypeListPanel.add(eMailRadioButton, 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(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)); wxCpRadioButton = new JRadioButton(); wxCpRadioButton.setEnabled(true); wxCpRadioButton.setText("企业号/企业微信"); @@ -265,13 +264,17 @@ public static void clearAllSelected() { 七牛云短信RadioButton = new JRadioButton(); 七牛云短信RadioButton.setEnabled(false); 七牛云短信RadioButton.setText("七牛云短信"); - msgTypeListPanel.add(七牛云短信RadioButton, 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(七牛云短信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)); httpRadioButton = new JRadioButton(); httpRadioButton.setEnabled(true); httpRadioButton.setText("HTTP请求"); msgTypeListPanel.add(httpRadioButton, 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 Spacer spacer1 = new Spacer(); msgTypeListPanel.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + dingRadioButton = new JRadioButton(); + 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)); 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/DingMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form new file mode 100644 index 00000000..2cec5134 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form @@ -0,0 +1,188 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java new file mode 100644 index 00000000..24f166a1 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -0,0 +1,349 @@ +package com.fangxuele.tool.push.ui.form.msg; + +import com.fangxuele.tool.push.dao.TMsgWxCpMapper; +import com.fangxuele.tool.push.dao.TWxCpAppMapper; +import com.fangxuele.tool.push.domain.TMsgWxCp; +import com.fangxuele.tool.push.domain.TWxCpApp; +import com.fangxuele.tool.push.logic.MessageTypeEnum; +import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; +import com.fangxuele.tool.push.ui.form.MainWindow; +import com.fangxuele.tool.push.util.MybatisUtil; +import com.fangxuele.tool.push.util.SqliteUtil; +import com.google.common.collect.Maps; +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; +import lombok.Getter; + +import javax.swing.*; +import javax.swing.border.TitledBorder; +import java.awt.*; +import java.awt.event.ItemEvent; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + *
+ * DingMsgForm
+ * 
+ * + * @author RememBerBer + * @since 2019/9/4. + */ +@Getter +public class DingMsgForm implements IMsgForm { + private JPanel dingMsgPanel; + private JLabel msgTypeLabel; + private JComboBox msgTypeComboBox; + private JLabel titleLabel; + private JLabel picUrlLabel; + private JTextField picUrlTextField; + private JLabel descLabel; + private JTextField descTextField; + private JLabel urlLabel; + private JTextField urlTextField; + private JLabel contentLabel; + private JComboBox appNameComboBox; + private JButton appManageButton; + private JTextField titleTextField; + private JTextArea contentTextArea; + private JLabel btnTxtLabel; + private JTextField btnTxtTextField; + + private static DingMsgForm dingMsgForm; + + private static TMsgWxCpMapper msgWxCpMapper = MybatisUtil.getSqlSession().getMapper(TMsgWxCpMapper.class); + private static TWxCpAppMapper wxCpAppMapper = MybatisUtil.getSqlSession().getMapper(TWxCpAppMapper.class); + + public static Map appNameToAgentIdMap = Maps.newHashMap(); + public static Map agentIdToAppNameMap = Maps.newHashMap(); + + public DingMsgForm() { + // 消息类型切换事件 + msgTypeComboBox.addItemListener(e -> { + if (e.getStateChange() == ItemEvent.SELECTED) { + switchCpMsgType(e.getItem().toString()); + } + }); + appManageButton.addActionListener(e -> { + WxCpAppDialog dialog = new WxCpAppDialog(); + dialog.renderTable(); + dialog.pack(); + dialog.setVisible(true); + initAppNameList(); + }); + } + + @Override + public void init(String msgName) { + clearAllField(); + initAppNameList(); + List tMsgWxCpList = msgWxCpMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.WX_CP_CODE, msgName); + if (tMsgWxCpList.size() > 0) { + TMsgWxCp tMsgWxCp = tMsgWxCpList.get(0); + String cpMsgType = tMsgWxCp.getCpMsgType(); + getInstance().getAppNameComboBox().setSelectedItem(agentIdToAppNameMap.get(tMsgWxCp.getAgentId())); + getInstance().getMsgTypeComboBox().setSelectedItem(cpMsgType); + getInstance().getContentTextArea().setText(tMsgWxCp.getContent()); + getInstance().getTitleTextField().setText(tMsgWxCp.getTitle()); + getInstance().getPicUrlTextField().setText(tMsgWxCp.getImgUrl()); + getInstance().getDescTextField().setText(tMsgWxCp.getDescribe()); + getInstance().getUrlTextField().setText(tMsgWxCp.getUrl()); + getInstance().getBtnTxtTextField().setText(tMsgWxCp.getBtnTxt()); + + switchCpMsgType(cpMsgType); + } else { + switchCpMsgType("图文消息"); + } + } + + @Override + public void save(String msgName) { + boolean existSameMsg = false; + + if (getInstance().getAppNameComboBox().getSelectedItem() == null) { + JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "请选择应用!", "成功", + JOptionPane.ERROR_MESSAGE); + return; + } + + List tMsgWxCpList = msgWxCpMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.WX_CP_CODE, msgName); + if (tMsgWxCpList.size() > 0) { + existSameMsg = true; + } + + 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 cpMsgType = Objects.requireNonNull(getInstance().getMsgTypeComboBox().getSelectedItem()).toString(); + String content = getInstance().getContentTextArea().getText(); + String title = getInstance().getTitleTextField().getText(); + String picUrl = getInstance().getPicUrlTextField().getText(); + String desc = getInstance().getDescTextField().getText(); + String url = getInstance().getUrlTextField().getText(); + String btnTxt = getInstance().getBtnTxtTextField().getText(); + + String now = SqliteUtil.nowDateForSqlite(); + + TMsgWxCp tMsgWxCp = new TMsgWxCp(); + tMsgWxCp.setMsgType(MessageTypeEnum.WX_CP_CODE); + tMsgWxCp.setMsgName(msgName); + tMsgWxCp.setAgentId(appNameToAgentIdMap.get(getInstance().getAppNameComboBox().getSelectedItem())); + tMsgWxCp.setCpMsgType(cpMsgType); + tMsgWxCp.setContent(content); + tMsgWxCp.setTitle(title); + tMsgWxCp.setImgUrl(picUrl); + tMsgWxCp.setDescribe(desc); + tMsgWxCp.setUrl(url); + tMsgWxCp.setBtnTxt(btnTxt); + tMsgWxCp.setModifiedTime(now); + + if (existSameMsg) { + msgWxCpMapper.updateByMsgTypeAndMsgName(tMsgWxCp); + } else { + tMsgWxCp.setCreateTime(now); + msgWxCpMapper.insertSelective(tMsgWxCp); + } + + JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "保存成功!", "成功", + JOptionPane.INFORMATION_MESSAGE); + } + } + + public static DingMsgForm getInstance() { + if (dingMsgForm == null) { + dingMsgForm = new DingMsgForm(); + } + return dingMsgForm; + } + + /** + * 初始化应用名称列表 + */ + public static void initAppNameList() { + List tWxCpAppList = wxCpAppMapper.selectAll(); + getInstance().getAppNameComboBox().removeAllItems(); + for (TWxCpApp tWxCpApp : tWxCpAppList) { + appNameToAgentIdMap.put(tWxCpApp.getAppName(), tWxCpApp.getAgentId()); + agentIdToAppNameMap.put(tWxCpApp.getAgentId(), tWxCpApp.getAppName()); + getInstance().getAppNameComboBox().addItem(tWxCpApp.getAppName()); + } + } + + /** + * 根据消息类型转换界面显示 + * + * @param msgType 消息类型 + */ + public static void switchCpMsgType(String msgType) { + switch (msgType) { + case "文本消息": + case "markdown消息": + getInstance().getContentTextArea().setVisible(true); + getInstance().getDescLabel().setVisible(false); + getInstance().getDescTextField().setVisible(false); + getInstance().getPicUrlLabel().setVisible(false); + getInstance().getPicUrlTextField().setVisible(false); + getInstance().getUrlLabel().setVisible(false); + getInstance().getUrlTextField().setVisible(false); + getInstance().getTitleLabel().setVisible(false); + getInstance().getTitleTextField().setVisible(false); + getInstance().getBtnTxtLabel().setVisible(false); + getInstance().getBtnTxtTextField().setVisible(false); + break; + case "图文消息": + getInstance().getContentLabel().setVisible(false); + getInstance().getContentTextArea().setVisible(false); + getInstance().getBtnTxtLabel().setVisible(false); + getInstance().getBtnTxtTextField().setVisible(false); + getInstance().getDescLabel().setVisible(true); + getInstance().getDescTextField().setVisible(true); + getInstance().getPicUrlLabel().setVisible(true); + getInstance().getPicUrlTextField().setVisible(true); + getInstance().getUrlLabel().setVisible(true); + getInstance().getUrlTextField().setVisible(true); + getInstance().getTitleLabel().setVisible(true); + getInstance().getTitleTextField().setVisible(true); + break; + case "文本卡片消息": + getInstance().getContentLabel().setVisible(false); + getInstance().getContentTextArea().setVisible(false); + getInstance().getPicUrlLabel().setVisible(false); + getInstance().getPicUrlTextField().setVisible(false); + getInstance().getDescLabel().setVisible(true); + getInstance().getDescTextField().setVisible(true); + getInstance().getBtnTxtLabel().setVisible(true); + getInstance().getBtnTxtTextField().setVisible(true); + getInstance().getUrlLabel().setVisible(true); + getInstance().getUrlTextField().setVisible(true); + getInstance().getTitleLabel().setVisible(true); + getInstance().getTitleTextField().setVisible(true); + break; + default: + break; + } + } + + /** + * 清空所有界面字段 + */ + public static void clearAllField() { + getInstance().getContentTextArea().setText(""); + getInstance().getTitleTextField().setText(""); + getInstance().getPicUrlTextField().setText(""); + getInstance().getDescTextField().setText(""); + getInstance().getUrlTextField().setText(""); + getInstance().getBtnTxtTextField().setText(""); + } + + { +// 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(2, 2, new Insets(0, 0, 0, 0), -1, -1)); + dingMsgPanel = new JPanel(); + dingMsgPanel.setLayout(new GridLayoutManager(9, 3, new Insets(10, 8, 0, 8), -1, -1)); + panel1.add(dingMsgPanel, 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)); + dingMsgPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, dingMsgPanel.getFont()))); + msgTypeLabel = new JLabel(); + msgTypeLabel.setText("消息类型"); + dingMsgPanel.add(msgTypeLabel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + dingMsgPanel.add(spacer1, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + msgTypeComboBox = new JComboBox(); + final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); + defaultComboBoxModel1.addElement("图文消息"); + defaultComboBoxModel1.addElement("文本消息"); + defaultComboBoxModel1.addElement("文本卡片消息"); + defaultComboBoxModel1.addElement("markdown消息"); + msgTypeComboBox.setModel(defaultComboBoxModel1); + dingMsgPanel.add(msgTypeComboBox, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + titleLabel = new JLabel(); + titleLabel.setText("标题"); + dingMsgPanel.add(titleLabel, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + picUrlLabel = new JLabel(); + picUrlLabel.setText("图片URL"); + dingMsgPanel.add(picUrlLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + picUrlTextField = new JTextField(); + dingMsgPanel.add(picUrlTextField, new GridConstraints(4, 1, 1, 2, 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)); + descLabel = new JLabel(); + descLabel.setText("描述"); + dingMsgPanel.add(descLabel, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + descTextField = new JTextField(); + dingMsgPanel.add(descTextField, new GridConstraints(5, 1, 1, 2, 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)); + urlLabel = new JLabel(); + urlLabel.setText("跳转URL"); + dingMsgPanel.add(urlLabel, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + urlTextField = new JTextField(); + dingMsgPanel.add(urlTextField, new GridConstraints(6, 1, 1, 2, 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)); + contentLabel = new JLabel(); + contentLabel.setText("内容"); + dingMsgPanel.add(contentLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("选择应用"); + dingMsgPanel.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)); + appNameComboBox = new JComboBox(); + dingMsgPanel.add(appNameComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + appManageButton = new JButton(); + appManageButton.setText("应用管理"); + dingMsgPanel.add(appManageButton, new GridConstraints(0, 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)); + titleTextField = new JTextField(); + dingMsgPanel.add(titleTextField, new GridConstraints(3, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(380, -1), new Dimension(380, -1), null, 0, false)); + contentTextArea = new JTextArea(); + dingMsgPanel.add(contentTextArea, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(150, 50), null, 0, false)); + btnTxtLabel = new JLabel(); + btnTxtLabel.setText("按钮文字"); + btnTxtLabel.setToolTipText("可不填。默认为“详情”, 不超过4个文字,超过自动截断"); + dingMsgPanel.add(btnTxtLabel, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + btnTxtTextField = new JTextField(); + btnTxtTextField.setToolTipText("可不填。默认为“详情”, 不超过4个文字,超过自动截断"); + dingMsgPanel.add(btnTxtTextField, new GridConstraints(7, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final Spacer spacer2 = new Spacer(); + panel1.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final Spacer spacer3 = new Spacer(); + panel1.add(spacer3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + msgTypeLabel.setLabelFor(msgTypeComboBox); + titleLabel.setLabelFor(titleTextField); + picUrlLabel.setLabelFor(picUrlTextField); + descLabel.setLabelFor(descTextField); + urlLabel.setLabelFor(urlTextField); + } + + /** + * @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 203cd9ae..31706f03 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 @@ -53,6 +53,9 @@ public static IMsgForm getMsgForm() { case MessageTypeEnum.HTTP_CODE: iMsgForm = HttpMsgForm.getInstance(); break; + case MessageTypeEnum.DING_CODE: + iMsgForm = DingMsgForm.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 27bb5600..712eadb8 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 @@ -72,6 +72,10 @@ public static void addListeners() { App.config.setMsgType(MessageTypeEnum.HTTP_CODE); saveType(); }); + messageTypeForm.getDingRadioButton().addActionListener(e -> { + App.config.setMsgType(MessageTypeEnum.DING_CODE); + saveType(); + }); messageTypeForm.getKefuPriorityTipsLabel().addMouseListener(new MouseAdapter() { @Override From 42fdeef96b9a25a281e3fae607b6a66aa458ead6 Mon Sep 17 00:00:00 2001 From: duoduo Date: Wed, 4 Sep 2019 21:59:14 +0800 Subject: [PATCH 09/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=95=8C=E9=9D=A2=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/ui/form/SettingForm.form | 53 +++- .../tool/push/ui/form/SettingForm.java | 241 ++++++++++-------- .../tool/push/ui/form/msg/DingMsgForm.form | 4 +- .../tool/push/ui/form/msg/DingMsgForm.java | 4 +- .../push/ui/listener/SettingListener.java | 10 + 5 files changed, 187 insertions(+), 125 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 191cf2f1..7a7f1a37 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 @@ - + @@ -713,11 +713,48 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -801,7 +838,7 @@ - + @@ -888,7 +925,7 @@ - + @@ -943,7 +980,7 @@ - + @@ -1085,7 +1122,7 @@ - + @@ -1179,7 +1216,7 @@ - + @@ -1298,7 +1335,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 8c5e2cd2..d32dea66 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 @@ -103,6 +103,7 @@ public class SettingForm { private JLabel outSideAtTipsLabel; private JLabel manualAtTipsLabel; private JLabel apiAtTipsLabel; + private JButton dingAppManageButton; private static SettingForm settingForm; private static TWxAccountMapper wxAccountMapper = MybatisUtil.getSqlSession().getMapper(TWxAccountMapper.class); @@ -348,7 +349,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(11, 1, new Insets(0, 60, 0, 330), -1, -1)); + panel3.setLayout(new GridLayoutManager(12, 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)); @@ -582,179 +583,193 @@ public static void toggleMpOutSideAccessTokenPanel() { wxCpAppManageButton.setText("应用管理"); panel13.add(wxCpAppManageButton, 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 panel14 = new JPanel(); - panel14.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel14.setLayout(new GridLayoutManager(1, 3, new Insets(15, 15, 10, 0), -1, -1)); + Font panel14Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel14.getFont()); + if (panel14Font != null) panel14.setFont(panel14Font); panel3.add(panel14, new GridConstraints(4, 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)); - panel14.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "阿里云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel14.getFont()))); + panel14.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "钉钉", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel14.getFont()))); + final JPanel panel15 = new JPanel(); + panel15.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel14.add(panel15, 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 Spacer spacer8 = new Spacer(); + panel15.add(spacer8, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + dingAppManageButton = new JButton(); + dingAppManageButton.setText("应用管理"); + panel15.add(dingAppManageButton, 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 JPanel panel16 = new JPanel(); + panel16.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel3.add(panel16, new GridConstraints(5, 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)); + panel16.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "阿里云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel16.getFont()))); final JLabel label23 = new JLabel(); label23.setText("AccessKeyId"); - panel14.add(label23, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel16.add(label23, 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 label24 = new JLabel(); label24.setText("AccessKeySecret"); - panel14.add(label24, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel16.add(label24, 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 label25 = new JLabel(); label25.setText("短信签名"); - panel14.add(label25, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel16.add(label25, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); aliyunSignTextField = new JTextField(); - panel14.add(aliyunSignTextField, 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)); + panel16.add(aliyunSignTextField, 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)); aliyunAccessKeySecretTextField = new JPasswordField(); - panel14.add(aliyunAccessKeySecretTextField, 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 panel15 = new JPanel(); - panel15.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel14.add(panel15, 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)); + panel16.add(aliyunAccessKeySecretTextField, 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 panel17 = new JPanel(); + panel17.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel16.add(panel17, 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)); settingAliyunSaveButton = new JButton(); settingAliyunSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingAliyunSaveButton.setText("保存"); - panel15.add(settingAliyunSaveButton, 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 spacer8 = new Spacer(); - panel15.add(spacer8, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + panel17.add(settingAliyunSaveButton, 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 spacer9 = new Spacer(); + panel17.add(spacer9, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); aliyunAccessKeyIdTextField = new JTextField(); - panel14.add(aliyunAccessKeyIdTextField, 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 panel16 = new JPanel(); - panel16.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); - panel3.add(panel16, new GridConstraints(5, 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)); - panel16.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "腾讯云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel16.getFont()))); + panel16.add(aliyunAccessKeyIdTextField, 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 panel18 = new JPanel(); + panel18.setLayout(new GridLayoutManager(4, 4, new Insets(15, 15, 10, 0), -1, -1)); + panel3.add(panel18, new GridConstraints(6, 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)); + panel18.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "腾讯云短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel18.getFont()))); final JLabel label26 = new JLabel(); label26.setText("AppId"); - panel16.add(label26, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel18.add(label26, 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 label27 = new JLabel(); label27.setText("AppKey"); - panel16.add(label27, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel18.add(label27, 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 label28 = new JLabel(); label28.setText("短信签名"); - panel16.add(label28, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panel18.add(label28, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); txyunSignTextField = new JTextField(); - panel16.add(txyunSignTextField, 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)); + panel18.add(txyunSignTextField, 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)); txyunAppKeyTextField = new JPasswordField(); txyunAppKeyTextField.setText(""); - panel16.add(txyunAppKeyTextField, 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 panel17 = new JPanel(); - panel17.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel16.add(panel17, 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)); + panel18.add(txyunAppKeyTextField, 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 panel19 = new JPanel(); + panel19.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel18.add(panel19, 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)); settingTxyunSaveButton = new JButton(); settingTxyunSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingTxyunSaveButton.setText("保存"); - panel17.add(settingTxyunSaveButton, 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 spacer9 = new Spacer(); - panel17.add(spacer9, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + panel19.add(settingTxyunSaveButton, 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 spacer10 = new Spacer(); + panel19.add(spacer10, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); txyunAppIdTextField = new JTextField(); - panel16.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 panel18 = new JPanel(); - panel18.setLayout(new GridLayoutManager(2, 4, new Insets(15, 15, 10, 0), -1, -1)); - panel3.add(panel18, new GridConstraints(6, 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)); - panel18.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "云片网短信", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel18.getFont()))); + 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)); + 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()))); final JLabel label29 = new JLabel(); label29.setText("ApiKey"); - panel18.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)); + 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(""); - panel18.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 panel19 = new JPanel(); - panel19.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel18.add(panel19, 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)); + 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 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("保存"); - panel19.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 spacer10 = new Spacer(); - panel19.add(spacer10, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); - final JPanel panel20 = new JPanel(); - panel20.setLayout(new GridLayoutManager(8, 4, new Insets(15, 15, 10, 0), -1, -1)); - panel3.add(panel20, 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)); - panel20.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "E-Mail", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel20.getFont()))); + 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)); + 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)); + 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地址"); - panel20.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)); + 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端口"); - panel20.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)); + 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("发件人(邮箱地址)"); - panel20.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)); + 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号"); - panel20.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.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)); final JLabel label34 = new JLabel(); label34.setText("密码"); - panel20.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)); - final JPanel panel21 = new JPanel(); - panel21.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1)); - panel20.add(panel21, 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)); + 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)); + 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)); saveMailButton = new JButton(); saveMailButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); saveMailButton.setText("保存"); - panel21.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 spacer11 = new Spacer(); - panel21.add(spacer11, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + 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)); testMailButton = new JButton(); testMailButton.setIcon(new ImageIcon(getClass().getResource("/icon/arrow_right.png"))); testMailButton.setText("测试"); - panel21.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)); + 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)); mailStartTLSCheckBox = new JCheckBox(); mailStartTLSCheckBox.setText("使用STARTTLS安全连接"); - panel20.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)); + 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)); mailSSLCheckBox = new JCheckBox(); mailSSLCheckBox.setText("使用SSL安全连接"); - panel20.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)); + 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)); mailHostTextField = new JTextField(); - panel20.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)); + 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)); mailPortTextField = new JTextField(); - panel20.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)); + 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)); mailFromTextField = new JTextField(); - panel20.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)); + 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)); mailUserTextField = new JTextField(); - panel20.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)); + 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)); mailPasswordField = new JPasswordField(); - panel20.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 panel22 = new JPanel(); - panel22.setLayout(new GridLayoutManager(4, 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(), "MySQL数据库", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel22.getFont()))); + 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("数据库地址"); - panel22.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(label35, 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(); - panel22.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)); + 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("用户名"); - panel22.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)); + 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)); mysqlUserTextField = new JTextField(); - panel22.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)); + 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("密码"); - panel22.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.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)); mysqlPasswordField = new JPasswordField(); - panel22.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 panel23 = new JPanel(); - panel23.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1)); - panel22.add(panel23, 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)); + 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)); settingTestDbLinkButton = new JButton(); settingTestDbLinkButton.setIcon(new ImageIcon(getClass().getResource("/icon/arrow_right.png"))); settingTestDbLinkButton.setText("测试连接"); - panel23.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 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(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)); settingDbInfoSaveButton = new JButton(); settingDbInfoSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingDbInfoSaveButton.setText("保存"); - panel23.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 panel24 = new JPanel(); - panel24.setLayout(new GridLayoutManager(4, 3, 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(), "外观", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel24.getFont()))); + 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("主题风格"); - 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)); + 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)); settingThemeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("Darcula(推荐)"); defaultComboBoxModel1.addElement("BeautyEye"); defaultComboBoxModel1.addElement("系统默认"); settingThemeComboBox.setModel(defaultComboBoxModel1); - panel24.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)); + 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("字体"); - panel24.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)); + 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)); settingFontNameComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel(); defaultComboBoxModel2.addElement("Microsoft YaHei"); @@ -762,10 +777,10 @@ public static void toggleMpOutSideAccessTokenPanel() { defaultComboBoxModel2.addElement("Microsoft YaHei UI"); defaultComboBoxModel2.addElement("Microsoft YaHei UI Light"); settingFontNameComboBox.setModel(defaultComboBoxModel2); - panel24.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)); + 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("字号"); - panel24.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)); + 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)); settingFontSizeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel3 = new DefaultComboBoxModel(); defaultComboBoxModel3.addElement("5"); @@ -791,37 +806,37 @@ public static void toggleMpOutSideAccessTokenPanel() { defaultComboBoxModel3.addElement("25"); defaultComboBoxModel3.addElement("26"); settingFontSizeComboBox.setModel(defaultComboBoxModel3); - panel24.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 panel25 = new JPanel(); - panel25.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel24.add(panel25, 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)); + 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)); settingAppearanceSaveButton = new JButton(); settingAppearanceSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); settingAppearanceSaveButton.setText("保存"); - panel25.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 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(3, 3, new Insets(15, 15, 10, 0), -1, -1)); - Font panel26Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel26.getFont()); - if (panel26Font != null) panel26.setFont(panel26Font); - panel3.add(panel26, 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)); - panel26.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel26.getFont()))); - final JPanel panel27 = new JPanel(); - panel27.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); - panel26.add(panel27, 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)); + 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)); httpSaveButton = new JButton(); httpSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png"))); httpSaveButton.setText("保存"); - panel27.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 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)); + 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)); httpUseProxyCheckBox = new JCheckBox(); httpUseProxyCheckBox.setText("使用HTTP代理"); - panel26.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)); + 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)); httpProxyPanel = new JPanel(); httpProxyPanel.setLayout(new GridLayoutManager(4, 2, new Insets(0, 26, 0, 0), -1, -1)); - panel26.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)); + 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)); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form index 2cec5134..ca6a0f7e 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form @@ -38,10 +38,10 @@ - - + +
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java index 24f166a1..dd06899b 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -270,10 +270,10 @@ public static void clearAllField() { dingMsgPanel.add(spacer1, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); msgTypeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); - defaultComboBoxModel1.addElement("图文消息"); defaultComboBoxModel1.addElement("文本消息"); - defaultComboBoxModel1.addElement("文本卡片消息"); + defaultComboBoxModel1.addElement("链接消息"); defaultComboBoxModel1.addElement("markdown消息"); + defaultComboBoxModel1.addElement("卡片消息"); msgTypeComboBox.setModel(defaultComboBoxModel1); dingMsgPanel.add(msgTypeComboBox, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); titleLabel = new JLabel(); 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 6e301b97..d8b6cae1 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 @@ -20,6 +20,7 @@ import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; import com.fangxuele.tool.push.ui.form.MainWindow; import com.fangxuele.tool.push.ui.form.SettingForm; +import com.fangxuele.tool.push.ui.form.msg.DingMsgForm; import com.fangxuele.tool.push.ui.form.msg.WxCpMsgForm; import com.fangxuele.tool.push.util.HikariUtil; import com.fangxuele.tool.push.util.MybatisUtil; @@ -256,6 +257,15 @@ public static void addListeners() { WxCpMsgForm.initAppNameList(); }); + // 设置-钉钉-应用管理 + settingForm.getDingAppManageButton().addActionListener(e -> { + WxCpAppDialog dialog = new WxCpAppDialog(); + dialog.renderTable(); + dialog.pack(); + dialog.setVisible(true); + DingMsgForm.initAppNameList(); + }); + // 设置-阿里云短信-保存 settingForm.getSettingAliyunSaveButton().addActionListener(e -> { try { From b5dc96ca6d7d7ec246ba8abbd1652ea53c35a329 Mon Sep 17 00:00:00 2001 From: duoduo Date: Thu, 5 Sep 2019 13:42:59 +0800 Subject: [PATCH 10/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=A2=9E=E5=8A=A0=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/dao/TDingAppMapper.java | 24 ++ .../fangxuele/tool/push/domain/TDingApp.java | 77 +++++ .../tool/push/ui/dialog/DingAppDialog.form | 154 ++++++++++ .../tool/push/ui/dialog/DingAppDialog.java | 274 ++++++++++++++++++ .../tool/push/ui/dialog/WxCpAppDialog.java | 1 - .../tool/push/ui/form/msg/DingMsgForm.java | 20 +- .../push/ui/listener/SettingListener.java | 3 +- src/main/resources/db_init.sql | 12 + src/main/resources/generatorConfig.xml | 2 +- src/main/resources/mapper/TDingAppMapper.xml | 129 +++++++++ src/main/resources/mybatis-config.xml | 1 + 11 files changed, 684 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java create mode 100644 src/main/java/com/fangxuele/tool/push/domain/TDingApp.java create mode 100644 src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form create mode 100644 src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java create mode 100644 src/main/resources/mapper/TDingAppMapper.xml diff --git a/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java new file mode 100644 index 00000000..89e08cc5 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java @@ -0,0 +1,24 @@ +package com.fangxuele.tool.push.dao; + +import com.fangxuele.tool.push.domain.TDingApp; + +import java.util.List; + +public interface TDingAppMapper { + int deleteByPrimaryKey(Integer id); + + int insert(TDingApp record); + + int insertSelective(TDingApp record); + + TDingApp selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(TDingApp record); + + int updateByPrimaryKey(TDingApp record); + + List selectByAppName(String appName); + + List selectAll(); + +} \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/domain/TDingApp.java b/src/main/java/com/fangxuele/tool/push/domain/TDingApp.java new file mode 100644 index 00000000..6e259643 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/domain/TDingApp.java @@ -0,0 +1,77 @@ +package com.fangxuele.tool.push.domain; + +import java.io.Serializable; + +public class TDingApp implements Serializable { + private Integer id; + + private String appName; + + private String agentId; + + private String appKey; + + private String appSecret; + + private String createTime; + + private String modifiedTime; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName == null ? null : appName.trim(); + } + + public String getAgentId() { + return agentId; + } + + public void setAgentId(String agentId) { + this.agentId = agentId == null ? null : agentId.trim(); + } + + public String getAppKey() { + return appKey; + } + + public void setAppKey(String appKey) { + this.appKey = appKey == null ? null : appKey.trim(); + } + + public String getAppSecret() { + return appSecret; + } + + public void setAppSecret(String appSecret) { + this.appSecret = appSecret == null ? null : appSecret.trim(); + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime == null ? null : createTime.trim(); + } + + public String getModifiedTime() { + return modifiedTime; + } + + public void setModifiedTime(String modifiedTime) { + this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim(); + } +} \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form new file mode 100644 index 00000000..4aa3edfd --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form @@ -0,0 +1,154 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java new file mode 100644 index 00000000..6a20d064 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java @@ -0,0 +1,274 @@ +package com.fangxuele.tool.push.ui.dialog; + +import cn.hutool.core.thread.ThreadUtil; +import cn.hutool.log.Log; +import cn.hutool.log.LogFactory; +import com.fangxuele.tool.push.App; +import com.fangxuele.tool.push.dao.TDingAppMapper; +import com.fangxuele.tool.push.domain.TDingApp; +import com.fangxuele.tool.push.ui.form.SettingForm; +import com.fangxuele.tool.push.util.ComponentUtil; +import com.fangxuele.tool.push.util.JTableUtil; +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 com.intellij.uiDesigner.core.Spacer; +import org.apache.commons.lang3.StringUtils; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.DefaultTableModel; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.List; + +/** + *
+ * DingAppDialog
+ * 
+ * + * @author Zhou Bo + * @since 2019/9/5. + */ +public class DingAppDialog extends JDialog { + private JPanel contentPane; + private JButton buttonDelete; + private JButton buttonCancel; + private JTable appsTable; + private JTextField appNameTextField; + private JTextField agentIdTextField; + private JTextField appKeyTextField; + private JTextField appSecretTextField; + private JButton saveButton; + + private Log logger = LogFactory.get(); + private static TDingAppMapper dingAppMapper = MybatisUtil.getSqlSession().getMapper(TDingAppMapper.class); + + public DingAppDialog() { + super(App.mainFrame, "钉钉-应用管理"); + setContentPane(contentPane); + setModal(true); + + ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.5, 0.5); + + // 保存按钮事件 + saveButton.addActionListener(e -> { + String appName = appNameTextField.getText(); + if (StringUtils.isBlank(appName)) { + JOptionPane.showMessageDialog(this, "请填写账号名称!", "提示", + JOptionPane.INFORMATION_MESSAGE); + return; + } + String agentId = agentIdTextField.getText(); + if (StringUtils.isBlank(agentId)) { + JOptionPane.showMessageDialog(this, "请填写AgentId!", "提示", + JOptionPane.INFORMATION_MESSAGE); + return; + } + + boolean update = false; + List tDingAppList = dingAppMapper.selectByAppName(appName); + if (tDingAppList.size() > 0) { + update = true; + } + + TDingApp tDingApp = new TDingApp(); + String now = SqliteUtil.nowDateForSqlite(); + tDingApp.setAppName(appName); + tDingApp.setAgentId(agentIdTextField.getText()); + tDingApp.setAppKey(appKeyTextField.getText()); + tDingApp.setAppSecret(appSecretTextField.getText()); + tDingApp.setModifiedTime(now); + + if (update) { + tDingApp.setId(tDingAppList.get(0).getId()); + dingAppMapper.updateByPrimaryKeySelective(tDingApp); + } else { + tDingApp.setCreateTime(now); + dingAppMapper.insert(tDingApp); + } + renderTable(); + JOptionPane.showMessageDialog(this, "保存成功!", "成功", + JOptionPane.INFORMATION_MESSAGE); + }); + + // 删除按钮事件 + buttonDelete.addActionListener(e -> ThreadUtil.execute(() -> { + try { + int[] selectedRows = appsTable.getSelectedRows(); + if (selectedRows.length == 0) { + JOptionPane.showMessageDialog(this, "请至少选择一个!", "提示", + JOptionPane.INFORMATION_MESSAGE); + } else { + int isDelete = JOptionPane.showConfirmDialog(this, "确认删除?", "确认", + JOptionPane.YES_NO_OPTION); + if (isDelete == JOptionPane.YES_OPTION) { + DefaultTableModel tableModel = (DefaultTableModel) appsTable.getModel(); + for (int i = selectedRows.length; i > 0; i--) { + int selectedRow = appsTable.getSelectedRow(); + Integer selectedId = (Integer) tableModel.getValueAt(selectedRow, 0); + dingAppMapper.deleteByPrimaryKey(selectedId); + tableModel.removeRow(selectedRow); + } + SettingForm.initSwitchMultiAccount(); + } + } + } catch (Exception e1) { + JOptionPane.showMessageDialog(this, "删除失败!\n\n" + e1.getMessage(), "失败", + JOptionPane.ERROR_MESSAGE); + logger.error(e1); + } + })); + + appsTable.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + clearFields(); + + int selectedRow = appsTable.getSelectedRow(); + String selectedId = appsTable.getValueAt(selectedRow, 0).toString(); + TDingApp tDingApp = dingAppMapper.selectByPrimaryKey(Integer.valueOf(selectedId)); + appNameTextField.setText(tDingApp.getAppName()); + agentIdTextField.setText(tDingApp.getAgentId()); + appKeyTextField.setText(tDingApp.getAppKey()); + appSecretTextField.setText(tDingApp.getAppSecret()); + super.mousePressed(e); + } + }); + + buttonCancel.addActionListener(e -> onCancel()); + + // call onCancel() when cross is clicked + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + onCancel(); + } + }); + + // call onCancel() on ESCAPE + contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + } + + private void onCancel() { + // add your code here if necessary + dispose(); + } + + /** + * 应用列表表格 + */ + public void renderTable() { + String[] headerNames = {"id", "应用名称", "AgentId", "AppKey", "AppSecret"}; + DefaultTableModel model = new DefaultTableModel(null, headerNames); + appsTable.setModel(model); + + DefaultTableCellRenderer hr = (DefaultTableCellRenderer) appsTable.getTableHeader().getDefaultRenderer(); + // 表头列名居左 + hr.setHorizontalAlignment(DefaultTableCellRenderer.LEFT); + + List dingAppList = dingAppMapper.selectAll(); + Object[] data; + for (TDingApp tDingApp : dingAppList) { + data = new Object[5]; + data[0] = tDingApp.getId(); + data[1] = tDingApp.getAppName(); + data[2] = tDingApp.getAgentId(); + data[3] = tDingApp.getAppKey(); + data[4] = tDingApp.getAppSecret(); + model.addRow(data); + } + + // 隐藏id列 + JTableUtil.hideColumn(appsTable, 0); + } + + /** + * 清空表单 + */ + public void clearFields() { + appNameTextField.setText(""); + agentIdTextField.setText(""); + appKeyTextField.setText(""); + appSecretTextField.setText(""); + } + + { +// 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$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); + panel1.add(panel2, new GridConstraints(0, 1, 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)); + buttonDelete = new JButton(); + buttonDelete.setText("删除"); + panel2.add(buttonDelete, 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)); + buttonCancel = new JButton(); + buttonCancel.setText("好了"); + panel2.add(buttonCancel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel3 = new JPanel(); + panel3.setLayout(new GridLayoutManager(5, 3, new Insets(5, 5, 0, 5), -1, -1)); + contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + panel3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "添加应用")); + final JLabel label1 = new JLabel(); + label1.setText("应用名称"); + panel3.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)); + final JLabel label2 = new JLabel(); + label2.setText("AgentId"); + panel3.add(label2, 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 label3 = new JLabel(); + label3.setText("Appkey"); + panel3.add(label3, 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 label4 = new JLabel(); + label4.setText("AppSecret"); + panel3.add(label4, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + appNameTextField = new JTextField(); + panel3.add(appNameTextField, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + agentIdTextField = new JTextField(); + panel3.add(agentIdTextField, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + appKeyTextField = new JTextField(); + panel3.add(appKeyTextField, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + appSecretTextField = new JTextField(); + panel3.add(appSecretTextField, new GridConstraints(3, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + saveButton = new JButton(); + saveButton.setText("保存"); + panel3.add(saveButton, new GridConstraints(4, 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)); + final Spacer spacer2 = new Spacer(); + panel3.add(spacer2, new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + appsTable = new JTable(); + scrollPane1.setViewportView(appsTable); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } +} diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/WxCpAppDialog.java b/src/main/java/com/fangxuele/tool/push/ui/dialog/WxCpAppDialog.java index 397905f7..780d28e3 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/dialog/WxCpAppDialog.java +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/WxCpAppDialog.java @@ -93,7 +93,6 @@ public WxCpAppDialog() { wxCpAppMapper.insert(tWxCpApp); } renderTable(); - SettingForm.initSwitchMultiAccount(); JOptionPane.showMessageDialog(this, "保存成功!", "成功", JOptionPane.INFORMATION_MESSAGE); }); diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java index dd06899b..3597c3ea 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -1,11 +1,11 @@ package com.fangxuele.tool.push.ui.form.msg; +import com.fangxuele.tool.push.dao.TDingAppMapper; import com.fangxuele.tool.push.dao.TMsgWxCpMapper; -import com.fangxuele.tool.push.dao.TWxCpAppMapper; +import com.fangxuele.tool.push.domain.TDingApp; import com.fangxuele.tool.push.domain.TMsgWxCp; -import com.fangxuele.tool.push.domain.TWxCpApp; import com.fangxuele.tool.push.logic.MessageTypeEnum; -import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; +import com.fangxuele.tool.push.ui.dialog.DingAppDialog; import com.fangxuele.tool.push.ui.form.MainWindow; import com.fangxuele.tool.push.util.MybatisUtil; import com.fangxuele.tool.push.util.SqliteUtil; @@ -54,7 +54,7 @@ public class DingMsgForm implements IMsgForm { private static DingMsgForm dingMsgForm; private static TMsgWxCpMapper msgWxCpMapper = MybatisUtil.getSqlSession().getMapper(TMsgWxCpMapper.class); - private static TWxCpAppMapper wxCpAppMapper = MybatisUtil.getSqlSession().getMapper(TWxCpAppMapper.class); + private static TDingAppMapper dingAppMapper = MybatisUtil.getSqlSession().getMapper(TDingAppMapper.class); public static Map appNameToAgentIdMap = Maps.newHashMap(); public static Map agentIdToAppNameMap = Maps.newHashMap(); @@ -67,7 +67,7 @@ public DingMsgForm() { } }); appManageButton.addActionListener(e -> { - WxCpAppDialog dialog = new WxCpAppDialog(); + DingAppDialog dialog = new DingAppDialog(); dialog.renderTable(); dialog.pack(); dialog.setVisible(true); @@ -167,12 +167,12 @@ public static DingMsgForm getInstance() { * 初始化应用名称列表 */ public static void initAppNameList() { - List tWxCpAppList = wxCpAppMapper.selectAll(); + List tDingAppList = dingAppMapper.selectAll(); getInstance().getAppNameComboBox().removeAllItems(); - for (TWxCpApp tWxCpApp : tWxCpAppList) { - appNameToAgentIdMap.put(tWxCpApp.getAppName(), tWxCpApp.getAgentId()); - agentIdToAppNameMap.put(tWxCpApp.getAgentId(), tWxCpApp.getAppName()); - getInstance().getAppNameComboBox().addItem(tWxCpApp.getAppName()); + for (TDingApp tDingApp : tDingAppList) { + appNameToAgentIdMap.put(tDingApp.getAppName(), tDingApp.getAgentId()); + agentIdToAppNameMap.put(tDingApp.getAgentId(), tDingApp.getAppName()); + getInstance().getAppNameComboBox().addItem(tDingApp.getAppName()); } } 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 d8b6cae1..e3602a0b 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 @@ -15,6 +15,7 @@ import com.fangxuele.tool.push.ui.Init; import com.fangxuele.tool.push.ui.UiConsts; import com.fangxuele.tool.push.ui.dialog.CommonTipsDialog; +import com.fangxuele.tool.push.ui.dialog.DingAppDialog; import com.fangxuele.tool.push.ui.dialog.MailTestDialog; import com.fangxuele.tool.push.ui.dialog.SwitchWxAccountDialog; import com.fangxuele.tool.push.ui.dialog.WxCpAppDialog; @@ -259,7 +260,7 @@ public static void addListeners() { // 设置-钉钉-应用管理 settingForm.getDingAppManageButton().addActionListener(e -> { - WxCpAppDialog dialog = new WxCpAppDialog(); + DingAppDialog dialog = new DingAppDialog(); dialog.renderTable(); dialog.pack(); dialog.setVisible(true); diff --git a/src/main/resources/db_init.sql b/src/main/resources/db_init.sql index e155071f..35b98b43 100644 --- a/src/main/resources/db_init.sql +++ b/src/main/resources/db_init.sql @@ -241,3 +241,15 @@ create table if not exists t_msg_ding create unique index if not exists t_msg_ding_msg_type_msg_name_uindex on t_msg_ding (msg_type, msg_name); +create table if not exists t_ding_app +( + id INTEGER + constraint t_ding_app_pk + primary key autoincrement, + app_name text, + agent_id text, + app_key text, + app_secret text, + create_time datetime, + modified_time datetime +); \ No newline at end of file diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index 721f60eb..2b45be3b 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -45,7 +45,7 @@ + tableName="t_ding_app" domainObjectName="TDingApp">
diff --git a/src/main/resources/mapper/TDingAppMapper.xml b/src/main/resources/mapper/TDingAppMapper.xml new file mode 100644 index 00000000..0d457ce1 --- /dev/null +++ b/src/main/resources/mapper/TDingAppMapper.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + id, app_name, agent_id, app_key, app_secret, create_time, modified_time + + + + delete + from t_ding_app + where id = #{id,jdbcType=INTEGER} + + + insert into t_ding_app (id, app_name, agent_id, + app_key, app_secret, create_time, + modified_time) + values (#{id,jdbcType=INTEGER}, #{appName,jdbcType=VARCHAR}, #{agentId,jdbcType=VARCHAR}, + #{appKey,jdbcType=VARCHAR}, #{appSecret,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR}, + #{modifiedTime,jdbcType=VARCHAR}) + + + insert into t_ding_app + + + id, + + + app_name, + + + agent_id, + + + app_key, + + + app_secret, + + + create_time, + + + modified_time, + + + + + #{id,jdbcType=INTEGER}, + + + #{appName,jdbcType=VARCHAR}, + + + #{agentId,jdbcType=VARCHAR}, + + + #{appKey,jdbcType=VARCHAR}, + + + #{appSecret,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=VARCHAR}, + + + #{modifiedTime,jdbcType=VARCHAR}, + + + + + update t_ding_app + + + app_name = #{appName,jdbcType=VARCHAR}, + + + agent_id = #{agentId,jdbcType=VARCHAR}, + + + app_key = #{appKey,jdbcType=VARCHAR}, + + + app_secret = #{appSecret,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=VARCHAR}, + + + modified_time = #{modifiedTime,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update t_ding_app + set app_name = #{appName,jdbcType=VARCHAR}, + agent_id = #{agentId,jdbcType=VARCHAR}, + app_key = #{appKey,jdbcType=VARCHAR}, + app_secret = #{appSecret,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=VARCHAR}, + modified_time = #{modifiedTime,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index 1f1042be..d900a686 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -28,5 +28,6 @@ + \ No newline at end of file From 881d6ffff37f233ed9662d03b2bef78c75729ab9 Mon Sep 17 00:00:00 2001 From: duoduo Date: Thu, 5 Sep 2019 15:14:23 +0800 Subject: [PATCH 11/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=A2=9E=E5=8A=A0=E5=BA=94=E7=94=A8=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form | 4 +++- .../java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form index 4aa3edfd..56186a88 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form @@ -145,7 +145,9 @@ - + + + diff --git a/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java index 6a20d064..a3a1d1ce 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java @@ -262,6 +262,7 @@ public void clearFields() { final JScrollPane scrollPane1 = new JScrollPane(); contentPane.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); appsTable = new JTable(); + appsTable.setRowHeight(36); scrollPane1.setViewportView(appsTable); } @@ -271,4 +272,5 @@ public void clearFields() { public JComponent $$$getRootComponent$$$() { return contentPane; } + } From 0f80a7d1d355458ebc582f9a74ec93d398c45702 Mon Sep 17 00:00:00 2001 From: duoduo Date: Thu, 5 Sep 2019 19:15:50 +0800 Subject: [PATCH 12/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=95=8C=E9=9D=A2=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/ui/form/msg/DingMsgForm.form | 23 ++++++- .../tool/push/ui/form/msg/DingMsgForm.java | 62 ++++++++++++++----- 2 files changed, 66 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form index ca6a0f7e..e4650193 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form @@ -3,12 +3,12 @@ - + - + @@ -29,7 +29,7 @@ - + @@ -171,6 +171,23 @@ + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java index 3597c3ea..6629ab34 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -50,6 +50,8 @@ public class DingMsgForm implements IMsgForm { private JTextArea contentTextArea; private JLabel btnTxtLabel; private JTextField btnTxtTextField; + private JTextField btnURLTextField; + private JLabel btnURLLabel; private static DingMsgForm dingMsgForm; @@ -94,7 +96,7 @@ public void init(String msgName) { switchCpMsgType(cpMsgType); } else { - switchCpMsgType("图文消息"); + switchCpMsgType("文本消息"); } } @@ -184,7 +186,6 @@ public static void initAppNameList() { public static void switchCpMsgType(String msgType) { switch (msgType) { case "文本消息": - case "markdown消息": getInstance().getContentTextArea().setVisible(true); getInstance().getDescLabel().setVisible(false); getInstance().getDescTextField().setVisible(false); @@ -196,8 +197,26 @@ public static void switchCpMsgType(String msgType) { getInstance().getTitleTextField().setVisible(false); getInstance().getBtnTxtLabel().setVisible(false); getInstance().getBtnTxtTextField().setVisible(false); + getInstance().getBtnURLLabel().setVisible(false); + getInstance().getBtnURLTextField().setVisible(false); break; - case "图文消息": + case "markdown消息": + getInstance().getContentLabel().setVisible(true); + getInstance().getContentTextArea().setVisible(true); + getInstance().getDescLabel().setVisible(false); + getInstance().getDescTextField().setVisible(false); + getInstance().getPicUrlLabel().setVisible(false); + getInstance().getPicUrlTextField().setVisible(false); + getInstance().getUrlLabel().setVisible(false); + getInstance().getUrlTextField().setVisible(false); + getInstance().getTitleLabel().setVisible(true); + getInstance().getTitleTextField().setVisible(true); + getInstance().getBtnTxtLabel().setVisible(false); + getInstance().getBtnTxtTextField().setVisible(false); + getInstance().getBtnURLLabel().setVisible(false); + getInstance().getBtnURLTextField().setVisible(false); + break; + case "链接消息": getInstance().getContentLabel().setVisible(false); getInstance().getContentTextArea().setVisible(false); getInstance().getBtnTxtLabel().setVisible(false); @@ -210,20 +229,24 @@ public static void switchCpMsgType(String msgType) { getInstance().getUrlTextField().setVisible(true); getInstance().getTitleLabel().setVisible(true); getInstance().getTitleTextField().setVisible(true); + getInstance().getBtnURLLabel().setVisible(false); + getInstance().getBtnURLTextField().setVisible(false); break; - case "文本卡片消息": - getInstance().getContentLabel().setVisible(false); - getInstance().getContentTextArea().setVisible(false); - getInstance().getPicUrlLabel().setVisible(false); - getInstance().getPicUrlTextField().setVisible(false); - getInstance().getDescLabel().setVisible(true); - getInstance().getDescTextField().setVisible(true); - getInstance().getBtnTxtLabel().setVisible(true); - getInstance().getBtnTxtTextField().setVisible(true); - getInstance().getUrlLabel().setVisible(true); - getInstance().getUrlTextField().setVisible(true); + case "卡片消息": getInstance().getTitleLabel().setVisible(true); getInstance().getTitleTextField().setVisible(true); + getInstance().getContentLabel().setVisible(true); + getInstance().getContentTextArea().setVisible(true); + getInstance().getBtnTxtLabel().setVisible(true); + getInstance().getBtnTxtTextField().setVisible(true); + getInstance().getDescLabel().setVisible(false); + getInstance().getDescTextField().setVisible(false); + getInstance().getPicUrlLabel().setVisible(false); + getInstance().getPicUrlTextField().setVisible(false); + getInstance().getUrlLabel().setVisible(false); + getInstance().getUrlTextField().setVisible(false); + getInstance().getBtnURLLabel().setVisible(true); + getInstance().getBtnURLTextField().setVisible(true); break; default: break; @@ -240,6 +263,7 @@ public static void clearAllField() { getInstance().getDescTextField().setText(""); getInstance().getUrlTextField().setText(""); getInstance().getBtnTxtTextField().setText(""); + getInstance().getBtnURLTextField().setText(""); } { @@ -260,14 +284,14 @@ public static void clearAllField() { final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); dingMsgPanel = new JPanel(); - dingMsgPanel.setLayout(new GridLayoutManager(9, 3, new Insets(10, 8, 0, 8), -1, -1)); + dingMsgPanel.setLayout(new GridLayoutManager(10, 3, new Insets(10, 8, 0, 8), -1, -1)); panel1.add(dingMsgPanel, 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)); dingMsgPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, dingMsgPanel.getFont()))); msgTypeLabel = new JLabel(); msgTypeLabel.setText("消息类型"); dingMsgPanel.add(msgTypeLabel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); - dingMsgPanel.add(spacer1, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + dingMsgPanel.add(spacer1, new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); msgTypeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("文本消息"); @@ -316,6 +340,11 @@ public static void clearAllField() { btnTxtTextField = new JTextField(); btnTxtTextField.setToolTipText("可不填。默认为“详情”, 不超过4个文字,超过自动截断"); dingMsgPanel.add(btnTxtTextField, new GridConstraints(7, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + btnURLTextField = new JTextField(); + dingMsgPanel.add(btnURLTextField, new GridConstraints(8, 1, 1, 2, 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)); + btnURLLabel = new JLabel(); + btnURLLabel.setText("按钮URL"); + dingMsgPanel.add(btnURLLabel, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel1.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final Spacer spacer3 = new Spacer(); @@ -325,6 +354,7 @@ public static void clearAllField() { picUrlLabel.setLabelFor(picUrlTextField); descLabel.setLabelFor(descTextField); urlLabel.setLabelFor(urlTextField); + btnURLLabel.setLabelFor(btnURLTextField); } /** From a54a4fadc601d36ce8a223e37aa7fe90176689cd Mon Sep 17 00:00:00 2001 From: duoduo Date: Thu, 5 Sep 2019 19:32:47 +0800 Subject: [PATCH 13/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=95=8C=E9=9D=A2=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/dao/TMsgDingMapper.java | 7 ++ .../tool/push/ui/form/msg/DingMsgForm.java | 75 ++++++++++--------- src/main/resources/mapper/TMsgDingMapper.xml | 18 +++++ 3 files changed, 63 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java index d31841e9..d59c2a0e 100644 --- a/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java @@ -1,6 +1,9 @@ package com.fangxuele.tool.push.dao; import com.fangxuele.tool.push.domain.TMsgDing; +import org.apache.ibatis.annotations.Param; + +import java.util.List; public interface TMsgDingMapper { int deleteByPrimaryKey(Integer id); @@ -14,4 +17,8 @@ public interface TMsgDingMapper { int updateByPrimaryKeySelective(TMsgDing record); int updateByPrimaryKey(TMsgDing record); + + List selectByMsgTypeAndMsgName(@Param("msgType") int msgType, @Param("msgName") String msgName); + + int updateByMsgTypeAndMsgName(TMsgDing tMsgDing); } \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java index 6629ab34..2f66f9d0 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -1,9 +1,9 @@ package com.fangxuele.tool.push.ui.form.msg; import com.fangxuele.tool.push.dao.TDingAppMapper; -import com.fangxuele.tool.push.dao.TMsgWxCpMapper; +import com.fangxuele.tool.push.dao.TMsgDingMapper; import com.fangxuele.tool.push.domain.TDingApp; -import com.fangxuele.tool.push.domain.TMsgWxCp; +import com.fangxuele.tool.push.domain.TMsgDing; import com.fangxuele.tool.push.logic.MessageTypeEnum; import com.fangxuele.tool.push.ui.dialog.DingAppDialog; import com.fangxuele.tool.push.ui.form.MainWindow; @@ -55,7 +55,7 @@ public class DingMsgForm implements IMsgForm { private static DingMsgForm dingMsgForm; - private static TMsgWxCpMapper msgWxCpMapper = MybatisUtil.getSqlSession().getMapper(TMsgWxCpMapper.class); + private static TMsgDingMapper msgDingMapper = MybatisUtil.getSqlSession().getMapper(TMsgDingMapper.class); private static TDingAppMapper dingAppMapper = MybatisUtil.getSqlSession().getMapper(TDingAppMapper.class); public static Map appNameToAgentIdMap = Maps.newHashMap(); @@ -65,7 +65,7 @@ public DingMsgForm() { // 消息类型切换事件 msgTypeComboBox.addItemListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { - switchCpMsgType(e.getItem().toString()); + switchDingMsgType(e.getItem().toString()); } }); appManageButton.addActionListener(e -> { @@ -81,22 +81,22 @@ public DingMsgForm() { public void init(String msgName) { clearAllField(); initAppNameList(); - List tMsgWxCpList = msgWxCpMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.WX_CP_CODE, msgName); - if (tMsgWxCpList.size() > 0) { - TMsgWxCp tMsgWxCp = tMsgWxCpList.get(0); - String cpMsgType = tMsgWxCp.getCpMsgType(); - getInstance().getAppNameComboBox().setSelectedItem(agentIdToAppNameMap.get(tMsgWxCp.getAgentId())); - getInstance().getMsgTypeComboBox().setSelectedItem(cpMsgType); - getInstance().getContentTextArea().setText(tMsgWxCp.getContent()); - getInstance().getTitleTextField().setText(tMsgWxCp.getTitle()); - getInstance().getPicUrlTextField().setText(tMsgWxCp.getImgUrl()); - getInstance().getDescTextField().setText(tMsgWxCp.getDescribe()); - getInstance().getUrlTextField().setText(tMsgWxCp.getUrl()); - getInstance().getBtnTxtTextField().setText(tMsgWxCp.getBtnTxt()); + List tMsgDingList = msgDingMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.DING_CODE, msgName); + if (tMsgDingList.size() > 0) { + TMsgDing tMsgDing = tMsgDingList.get(0); + String dingMsgType = tMsgDing.getDingMsgType(); + getInstance().getAppNameComboBox().setSelectedItem(agentIdToAppNameMap.get(tMsgDing.getAgentId())); + getInstance().getMsgTypeComboBox().setSelectedItem(dingMsgType); +// getInstance().getContentTextArea().setText(tMsgDing.getContent()); +// getInstance().getTitleTextField().setText(tMsgDing.getTitle()); +// getInstance().getPicUrlTextField().setText(tMsgDing.getImgUrl()); +// getInstance().getDescTextField().setText(tMsgDing.getDescribe()); +// getInstance().getUrlTextField().setText(tMsgDing.getUrl()); +// getInstance().getBtnTxtTextField().setText(tMsgDing.getBtnTxt()); - switchCpMsgType(cpMsgType); + switchDingMsgType(dingMsgType); } else { - switchCpMsgType("文本消息"); + switchDingMsgType("文本消息"); } } @@ -110,8 +110,8 @@ public void save(String msgName) { return; } - List tMsgWxCpList = msgWxCpMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.WX_CP_CODE, msgName); - if (tMsgWxCpList.size() > 0) { + List tMsgDingList = msgDingMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.DING_CODE, msgName); + if (tMsgDingList.size() > 0) { existSameMsg = true; } @@ -123,34 +123,35 @@ public void save(String msgName) { } if (!existSameMsg || isCover == JOptionPane.YES_OPTION) { - String cpMsgType = Objects.requireNonNull(getInstance().getMsgTypeComboBox().getSelectedItem()).toString(); + String dingMsgType = Objects.requireNonNull(getInstance().getMsgTypeComboBox().getSelectedItem()).toString(); String content = getInstance().getContentTextArea().getText(); String title = getInstance().getTitleTextField().getText(); String picUrl = getInstance().getPicUrlTextField().getText(); String desc = getInstance().getDescTextField().getText(); String url = getInstance().getUrlTextField().getText(); String btnTxt = getInstance().getBtnTxtTextField().getText(); + String btnUrl = getInstance().getBtnURLTextField().getText(); String now = SqliteUtil.nowDateForSqlite(); - TMsgWxCp tMsgWxCp = new TMsgWxCp(); - tMsgWxCp.setMsgType(MessageTypeEnum.WX_CP_CODE); - tMsgWxCp.setMsgName(msgName); - tMsgWxCp.setAgentId(appNameToAgentIdMap.get(getInstance().getAppNameComboBox().getSelectedItem())); - tMsgWxCp.setCpMsgType(cpMsgType); - tMsgWxCp.setContent(content); - tMsgWxCp.setTitle(title); - tMsgWxCp.setImgUrl(picUrl); - tMsgWxCp.setDescribe(desc); - tMsgWxCp.setUrl(url); - tMsgWxCp.setBtnTxt(btnTxt); - tMsgWxCp.setModifiedTime(now); + TMsgDing tMsgDing = new TMsgDing(); + tMsgDing.setMsgType(MessageTypeEnum.DING_CODE); + tMsgDing.setMsgName(msgName); + tMsgDing.setAgentId(appNameToAgentIdMap.get(getInstance().getAppNameComboBox().getSelectedItem())); + tMsgDing.setDingMsgType(dingMsgType); +// tMsgDing.setContent(content); +// tMsgDing.setTitle(title); +// tMsgDing.setImgUrl(picUrl); +// tMsgDing.setDescribe(desc); +// tMsgDing.setUrl(url); +// tMsgDing.setBtnTxt(btnTxt); + tMsgDing.setModifiedTime(now); if (existSameMsg) { - msgWxCpMapper.updateByMsgTypeAndMsgName(tMsgWxCp); + msgDingMapper.updateByMsgTypeAndMsgName(tMsgDing); } else { - tMsgWxCp.setCreateTime(now); - msgWxCpMapper.insertSelective(tMsgWxCp); + tMsgDing.setCreateTime(now); + msgDingMapper.insertSelective(tMsgDing); } JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "保存成功!", "成功", @@ -183,7 +184,7 @@ public static void initAppNameList() { * * @param msgType 消息类型 */ - public static void switchCpMsgType(String msgType) { + public static void switchDingMsgType(String msgType) { switch (msgType) { case "文本消息": getInstance().getContentTextArea().setVisible(true); diff --git a/src/main/resources/mapper/TMsgDingMapper.xml b/src/main/resources/mapper/TMsgDingMapper.xml index 50628b22..268cff7f 100644 --- a/src/main/resources/mapper/TMsgDingMapper.xml +++ b/src/main/resources/mapper/TMsgDingMapper.xml @@ -138,4 +138,22 @@ modified_time = #{modifiedTime,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} + + + update t_msg_ding + set ding_msg_type = #{dingMsgType,jdbcType=VARCHAR}, + agent_id = #{agentId,jdbcType=VARCHAR}, + web_hook = #{webHook,jdbcType=VARCHAR}, + content = #{content,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=VARCHAR}, + modified_time = #{modifiedTime,jdbcType=VARCHAR} + where msg_type = #{msgType,jdbcType=INTEGER} + and msg_name = #{msgName,jdbcType=VARCHAR} + \ No newline at end of file From 3ed6a5badf4e9f770cae74504320d14b82fe3c18 Mon Sep 17 00:00:00 2001 From: duoduo Date: Thu, 5 Sep 2019 21:35:42 +0800 Subject: [PATCH 14/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=95=8C=E9=9D=A2=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangxuele/tool/push/bean/DingMsg.java | 34 ++++++++++ .../tool/push/dao/TMsgDingMapper.java | 2 + .../tool/push/ui/form/MessageManageForm.java | 10 +++ .../tool/push/ui/form/msg/DingMsgForm.form | 33 +++------ .../tool/push/ui/form/msg/DingMsgForm.java | 67 ++++++++----------- src/main/resources/mapper/TMsgDingMapper.xml | 6 ++ 6 files changed, 87 insertions(+), 65 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/bean/DingMsg.java diff --git a/src/main/java/com/fangxuele/tool/push/bean/DingMsg.java b/src/main/java/com/fangxuele/tool/push/bean/DingMsg.java new file mode 100644 index 00000000..6804bc40 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/bean/DingMsg.java @@ -0,0 +1,34 @@ +package com.fangxuele.tool.push.bean; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import java.io.Serializable; + +/** + *
+ * 钉钉消息
+ * 
+ * + * @author RememBerBer + * @since 2019/9/5. + */ +@Getter +@Setter +@ToString +public class DingMsg implements Serializable { + private static final long serialVersionUID = 1L; + + private String content; + + private String title; + + private String picUrl; + + private String url; + + private String btnTxt; + + private String btnUrl; +} diff --git a/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java index d59c2a0e..722e0719 100644 --- a/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java @@ -21,4 +21,6 @@ public interface TMsgDingMapper { List selectByMsgTypeAndMsgName(@Param("msgType") int msgType, @Param("msgName") String msgName); int updateByMsgTypeAndMsgName(TMsgDing tMsgDing); + + List selectByMsgType(int msgType); } \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java index af17a0da..ae393d3d 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/MessageManageForm.java @@ -1,6 +1,7 @@ package com.fangxuele.tool.push.ui.form; import com.fangxuele.tool.push.App; +import com.fangxuele.tool.push.dao.TMsgDingMapper; import com.fangxuele.tool.push.dao.TMsgHttpMapper; import com.fangxuele.tool.push.dao.TMsgKefuMapper; import com.fangxuele.tool.push.dao.TMsgKefuPriorityMapper; @@ -9,6 +10,7 @@ import com.fangxuele.tool.push.dao.TMsgMpTemplateMapper; import com.fangxuele.tool.push.dao.TMsgSmsMapper; import com.fangxuele.tool.push.dao.TMsgWxCpMapper; +import com.fangxuele.tool.push.domain.TMsgDing; import com.fangxuele.tool.push.domain.TMsgHttp; import com.fangxuele.tool.push.domain.TMsgKefu; import com.fangxuele.tool.push.domain.TMsgKefuPriority; @@ -56,6 +58,7 @@ public class MessageManageForm { private static TMsgMailMapper msgMailMapper = MybatisUtil.getSqlSession().getMapper(TMsgMailMapper.class); private static TMsgWxCpMapper msgWxCpMapper = MybatisUtil.getSqlSession().getMapper(TMsgWxCpMapper.class); private static TMsgHttpMapper msgHttpMapper = MybatisUtil.getSqlSession().getMapper(TMsgHttpMapper.class); + private static TMsgDingMapper msgDingMapper = MybatisUtil.getSqlSession().getMapper(TMsgDingMapper.class); private MessageManageForm() { } @@ -132,6 +135,13 @@ public static void init() { data[0] = tMsgHttp.getMsgName(); model.addRow(data); } + } else if (msgType == MessageTypeEnum.DING_CODE) { + List tMsgDingList = msgDingMapper.selectByMsgType(msgType); + for (TMsgDing tMsgDing : tMsgDingList) { + data = new Object[1]; + data[0] = tMsgDing.getMsgName(); + model.addRow(data); + } } else { List tMsgSmsList = msgSmsMapper.selectByMsgType(msgType); for (TMsgSms tMsgSms : tMsgSmsList) { diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form index e4650193..0d4adff1 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form @@ -8,7 +8,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -71,26 +71,9 @@ - - - - - - - - - - - - - - - - - - + @@ -99,7 +82,7 @@ - + @@ -154,7 +137,7 @@ - + @@ -163,7 +146,7 @@ - + @@ -173,7 +156,7 @@ - + @@ -181,7 +164,7 @@ - + diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java index 2f66f9d0..5e9be144 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -1,5 +1,7 @@ package com.fangxuele.tool.push.ui.form.msg; +import cn.hutool.json.JSONUtil; +import com.fangxuele.tool.push.bean.DingMsg; import com.fangxuele.tool.push.dao.TDingAppMapper; import com.fangxuele.tool.push.dao.TMsgDingMapper; import com.fangxuele.tool.push.domain.TDingApp; @@ -39,8 +41,6 @@ public class DingMsgForm implements IMsgForm { private JLabel titleLabel; private JLabel picUrlLabel; private JTextField picUrlTextField; - private JLabel descLabel; - private JTextField descTextField; private JLabel urlLabel; private JTextField urlTextField; private JLabel contentLabel; @@ -87,12 +87,12 @@ public void init(String msgName) { String dingMsgType = tMsgDing.getDingMsgType(); getInstance().getAppNameComboBox().setSelectedItem(agentIdToAppNameMap.get(tMsgDing.getAgentId())); getInstance().getMsgTypeComboBox().setSelectedItem(dingMsgType); -// getInstance().getContentTextArea().setText(tMsgDing.getContent()); -// getInstance().getTitleTextField().setText(tMsgDing.getTitle()); -// getInstance().getPicUrlTextField().setText(tMsgDing.getImgUrl()); -// getInstance().getDescTextField().setText(tMsgDing.getDescribe()); -// getInstance().getUrlTextField().setText(tMsgDing.getUrl()); -// getInstance().getBtnTxtTextField().setText(tMsgDing.getBtnTxt()); + DingMsg dingMsg = JSONUtil.toBean(tMsgDing.getContent(), DingMsg.class); + getInstance().getContentTextArea().setText(dingMsg.getContent()); + getInstance().getTitleTextField().setText(dingMsg.getTitle()); + getInstance().getPicUrlTextField().setText(dingMsg.getPicUrl()); + getInstance().getUrlTextField().setText(dingMsg.getUrl()); + getInstance().getBtnTxtTextField().setText(dingMsg.getBtnTxt()); switchDingMsgType(dingMsgType); } else { @@ -127,7 +127,6 @@ public void save(String msgName) { String content = getInstance().getContentTextArea().getText(); String title = getInstance().getTitleTextField().getText(); String picUrl = getInstance().getPicUrlTextField().getText(); - String desc = getInstance().getDescTextField().getText(); String url = getInstance().getUrlTextField().getText(); String btnTxt = getInstance().getBtnTxtTextField().getText(); String btnUrl = getInstance().getBtnURLTextField().getText(); @@ -139,12 +138,15 @@ public void save(String msgName) { tMsgDing.setMsgName(msgName); tMsgDing.setAgentId(appNameToAgentIdMap.get(getInstance().getAppNameComboBox().getSelectedItem())); tMsgDing.setDingMsgType(dingMsgType); -// tMsgDing.setContent(content); -// tMsgDing.setTitle(title); -// tMsgDing.setImgUrl(picUrl); -// tMsgDing.setDescribe(desc); -// tMsgDing.setUrl(url); -// tMsgDing.setBtnTxt(btnTxt); + DingMsg dingMsg = new DingMsg(); + dingMsg.setContent(content); + dingMsg.setTitle(title); + dingMsg.setPicUrl(picUrl); + dingMsg.setUrl(url); + dingMsg.setBtnTxt(btnTxt); + dingMsg.setBtnUrl(btnUrl); + + tMsgDing.setContent(JSONUtil.toJsonStr(dingMsg)); tMsgDing.setModifiedTime(now); if (existSameMsg) { @@ -188,8 +190,6 @@ public static void switchDingMsgType(String msgType) { switch (msgType) { case "文本消息": getInstance().getContentTextArea().setVisible(true); - getInstance().getDescLabel().setVisible(false); - getInstance().getDescTextField().setVisible(false); getInstance().getPicUrlLabel().setVisible(false); getInstance().getPicUrlTextField().setVisible(false); getInstance().getUrlLabel().setVisible(false); @@ -204,8 +204,6 @@ public static void switchDingMsgType(String msgType) { case "markdown消息": getInstance().getContentLabel().setVisible(true); getInstance().getContentTextArea().setVisible(true); - getInstance().getDescLabel().setVisible(false); - getInstance().getDescTextField().setVisible(false); getInstance().getPicUrlLabel().setVisible(false); getInstance().getPicUrlTextField().setVisible(false); getInstance().getUrlLabel().setVisible(false); @@ -218,12 +216,10 @@ public static void switchDingMsgType(String msgType) { getInstance().getBtnURLTextField().setVisible(false); break; case "链接消息": - getInstance().getContentLabel().setVisible(false); - getInstance().getContentTextArea().setVisible(false); + getInstance().getContentLabel().setVisible(true); + getInstance().getContentTextArea().setVisible(true); getInstance().getBtnTxtLabel().setVisible(false); getInstance().getBtnTxtTextField().setVisible(false); - getInstance().getDescLabel().setVisible(true); - getInstance().getDescTextField().setVisible(true); getInstance().getPicUrlLabel().setVisible(true); getInstance().getPicUrlTextField().setVisible(true); getInstance().getUrlLabel().setVisible(true); @@ -240,8 +236,6 @@ public static void switchDingMsgType(String msgType) { getInstance().getContentTextArea().setVisible(true); getInstance().getBtnTxtLabel().setVisible(true); getInstance().getBtnTxtTextField().setVisible(true); - getInstance().getDescLabel().setVisible(false); - getInstance().getDescTextField().setVisible(false); getInstance().getPicUrlLabel().setVisible(false); getInstance().getPicUrlTextField().setVisible(false); getInstance().getUrlLabel().setVisible(false); @@ -261,7 +255,6 @@ public static void clearAllField() { getInstance().getContentTextArea().setText(""); getInstance().getTitleTextField().setText(""); getInstance().getPicUrlTextField().setText(""); - getInstance().getDescTextField().setText(""); getInstance().getUrlTextField().setText(""); getInstance().getBtnTxtTextField().setText(""); getInstance().getBtnURLTextField().setText(""); @@ -285,14 +278,14 @@ public static void clearAllField() { final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); dingMsgPanel = new JPanel(); - dingMsgPanel.setLayout(new GridLayoutManager(10, 3, new Insets(10, 8, 0, 8), -1, -1)); + dingMsgPanel.setLayout(new GridLayoutManager(9, 3, new Insets(10, 8, 0, 8), -1, -1)); panel1.add(dingMsgPanel, 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)); dingMsgPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, dingMsgPanel.getFont()))); msgTypeLabel = new JLabel(); msgTypeLabel.setText("消息类型"); dingMsgPanel.add(msgTypeLabel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); - dingMsgPanel.add(spacer1, new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + dingMsgPanel.add(spacer1, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); msgTypeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("文本消息"); @@ -309,16 +302,11 @@ public static void clearAllField() { dingMsgPanel.add(picUrlLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); picUrlTextField = new JTextField(); dingMsgPanel.add(picUrlTextField, new GridConstraints(4, 1, 1, 2, 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)); - descLabel = new JLabel(); - descLabel.setText("描述"); - dingMsgPanel.add(descLabel, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - descTextField = new JTextField(); - dingMsgPanel.add(descTextField, new GridConstraints(5, 1, 1, 2, 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)); urlLabel = new JLabel(); urlLabel.setText("跳转URL"); - dingMsgPanel.add(urlLabel, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(urlLabel, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); urlTextField = new JTextField(); - dingMsgPanel.add(urlTextField, new GridConstraints(6, 1, 1, 2, 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)); + dingMsgPanel.add(urlTextField, new GridConstraints(5, 1, 1, 2, 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)); contentLabel = new JLabel(); contentLabel.setText("内容"); dingMsgPanel.add(contentLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); @@ -337,15 +325,15 @@ public static void clearAllField() { btnTxtLabel = new JLabel(); btnTxtLabel.setText("按钮文字"); btnTxtLabel.setToolTipText("可不填。默认为“详情”, 不超过4个文字,超过自动截断"); - dingMsgPanel.add(btnTxtLabel, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(btnTxtLabel, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); btnTxtTextField = new JTextField(); btnTxtTextField.setToolTipText("可不填。默认为“详情”, 不超过4个文字,超过自动截断"); - dingMsgPanel.add(btnTxtTextField, new GridConstraints(7, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + dingMsgPanel.add(btnTxtTextField, new GridConstraints(6, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); btnURLTextField = new JTextField(); - dingMsgPanel.add(btnURLTextField, new GridConstraints(8, 1, 1, 2, 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)); + dingMsgPanel.add(btnURLTextField, new GridConstraints(7, 1, 1, 2, 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)); btnURLLabel = new JLabel(); btnURLLabel.setText("按钮URL"); - dingMsgPanel.add(btnURLLabel, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(btnURLLabel, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel1.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final Spacer spacer3 = new Spacer(); @@ -353,7 +341,6 @@ public static void clearAllField() { msgTypeLabel.setLabelFor(msgTypeComboBox); titleLabel.setLabelFor(titleTextField); picUrlLabel.setLabelFor(picUrlTextField); - descLabel.setLabelFor(descTextField); urlLabel.setLabelFor(urlTextField); btnURLLabel.setLabelFor(btnURLTextField); } diff --git a/src/main/resources/mapper/TMsgDingMapper.xml b/src/main/resources/mapper/TMsgDingMapper.xml index 268cff7f..55482a3e 100644 --- a/src/main/resources/mapper/TMsgDingMapper.xml +++ b/src/main/resources/mapper/TMsgDingMapper.xml @@ -156,4 +156,10 @@ where msg_type = #{msgType,jdbcType=INTEGER} and msg_name = #{msgName,jdbcType=VARCHAR} +
\ No newline at end of file From c8c01fefc57499c3781365b5a0dbc831a58fff91 Mon Sep 17 00:00:00 2001 From: duoduo Date: Thu, 5 Sep 2019 22:28:23 +0800 Subject: [PATCH 15/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AFSender=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../push/logic/msgmaker/DingMsgMaker.java | 80 ++++++++++ .../push/logic/msgmaker/MsgMakerFactory.java | 3 + .../push/logic/msgsender/DingMsgSender.java | 141 ++++++++++++++++++ .../logic/msgsender/MsgSenderFactory.java | 3 + .../tool/push/ui/form/MessageTypeForm.form | 21 ++- .../tool/push/ui/form/MessageTypeForm.java | 17 ++- 6 files changed, 253 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java create mode 100644 src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java new file mode 100644 index 00000000..7edba845 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java @@ -0,0 +1,80 @@ +package com.fangxuele.tool.push.logic.msgmaker; + +import com.fangxuele.tool.push.bean.DingMsg; +import com.fangxuele.tool.push.logic.msgsender.DingMsgSender; +import com.fangxuele.tool.push.ui.form.msg.DingMsgForm; +import com.fangxuele.tool.push.util.TemplateUtil; +import org.apache.velocity.VelocityContext; + +/** + *
+ * 钉钉消息加工器
+ * 
+ * + * @author Zhou Bo + * @since 2019/9/5. + */ +public class DingMsgMaker extends BaseMsgMaker implements IMsgMaker { + + private static String agentId; + + public static String msgType; + + private static String msgTitle; + + private static String picUrl; + + public static String desc; + + public static String url; + + private static String btnTxt; + + private static String btnUrl; + + private static String msgContent; + + /** + * 准备(界面字段等) + */ + @Override + public void prepare() { + String agentIdBefore = agentId; + String agentIdNow = DingMsgForm.appNameToAgentIdMap.get(DingMsgForm.getInstance().getAppNameComboBox().getSelectedItem()); + synchronized (this) { + if (agentIdBefore == null || !agentIdBefore.equals(agentIdNow)) { + agentId = agentIdNow; + DingMsgSender.wxCpConfigStorage = null; + DingMsgSender.wxCpService = null; + } + } + msgType = (String) DingMsgForm.getInstance().getMsgTypeComboBox().getSelectedItem(); + msgTitle = DingMsgForm.getInstance().getTitleTextField().getText(); + picUrl = DingMsgForm.getInstance().getPicUrlTextField().getText().trim(); + url = DingMsgForm.getInstance().getUrlTextField().getText().trim(); + btnTxt = DingMsgForm.getInstance().getBtnTxtTextField().getText().trim(); + btnUrl = DingMsgForm.getInstance().getBtnURLTextField().getText().trim(); + msgContent = DingMsgForm.getInstance().getContentTextArea().getText(); + } + + /** + * 组织消息-企业号 + * + * @param msgData 消息数据 + * @return WxMpTemplateMessage + */ + @Override + public DingMsg makeMsg(String[] msgData) { + + DingMsg dingMsg = new DingMsg(); + VelocityContext velocityContext = getVelocityContext(msgData); + dingMsg.setContent(TemplateUtil.evaluate(msgContent, velocityContext)); + dingMsg.setTitle(TemplateUtil.evaluate(msgTitle, velocityContext)); + dingMsg.setPicUrl(TemplateUtil.evaluate(picUrl, velocityContext)); + dingMsg.setUrl(TemplateUtil.evaluate(url, velocityContext)); + dingMsg.setBtnTxt(TemplateUtil.evaluate(btnTxt, velocityContext)); + dingMsg.setBtnUrl(TemplateUtil.evaluate(btnUrl, velocityContext)); + + return dingMsg; + } +} 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 65608054..5e95adc9 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 @@ -48,6 +48,9 @@ public static IMsgMaker getMsgMaker() { case MessageTypeEnum.HTTP_CODE: iMsgMaker = new HttpMsgMaker(); break; + case MessageTypeEnum.DING_CODE: + iMsgMaker = new DingMsgMaker(); + break; default: } return iMsgMaker; diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java new file mode 100644 index 00000000..7e49f214 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java @@ -0,0 +1,141 @@ +package com.fangxuele.tool.push.logic.msgsender; + +import com.fangxuele.tool.push.App; +import com.fangxuele.tool.push.bean.DingMsg; +import com.fangxuele.tool.push.dao.TWxCpAppMapper; +import com.fangxuele.tool.push.domain.TWxCpApp; +import com.fangxuele.tool.push.logic.PushControl; +import com.fangxuele.tool.push.logic.msgmaker.DingMsgMaker; +import com.fangxuele.tool.push.ui.form.msg.WxCpMsgForm; +import com.fangxuele.tool.push.util.MybatisUtil; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; +import me.chanjar.weixin.cp.api.WxCpService; +import me.chanjar.weixin.cp.api.impl.WxCpServiceApacheHttpClientImpl; +import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl; + +import java.util.List; + +/** + *
+ * 钉钉消息发送器
+ * 
+ * + * @author RememBerBer + * @since 2019/9/5. + */ +@Slf4j +public class DingMsgSender implements IMsgSender { + public volatile static WxCpDefaultConfigImpl wxCpConfigStorage; + public volatile static WxCpService wxCpService; + private DingMsgMaker dingMsgMaker; + + private static TWxCpAppMapper wxCpAppMapper = MybatisUtil.getSqlSession().getMapper(TWxCpAppMapper.class); + + public DingMsgSender() { + dingMsgMaker = new DingMsgMaker(); + wxCpService = getWxCpService(); + } + + @Override + public SendResult send(String[] msgData) { + SendResult sendResult = new SendResult(); + + try { + String openId = msgData[0]; + DingMsg dingMsg = dingMsgMaker.makeMsg(msgData); +// dingMsg.setToUser(openId); + if (PushControl.dryRun) { + sendResult.setSuccess(true); + return sendResult; + } else { +// WxCpMessageSendResult wxCpMessageSendResult = wxCpService.messageSend(dingMsg); +// if (wxCpMessageSendResult.getErrCode() != 0 || StringUtils.isNoneEmpty(wxCpMessageSendResult.getInvalidUser())) { +// sendResult.setSuccess(false); +// sendResult.setInfo(wxCpMessageSendResult.toString()); +// log.error(wxCpMessageSendResult.toString()); +// return sendResult; +// } + } + } catch (Exception e) { + sendResult.setSuccess(false); + sendResult.setInfo(e.getMessage()); + log.error(e.toString()); + return sendResult; + } + + sendResult.setSuccess(true); + return sendResult; + } + + @Override + public SendResult asyncSend(String[] msgData) { + return null; + } + + /** + * 微信企业号配置 + * + * @return WxCpConfigStorage + */ + private static WxCpDefaultConfigImpl wxCpConfigStorage() { + WxCpDefaultConfigImpl configStorage = new WxCpDefaultConfigImpl(); + configStorage.setCorpId(App.config.getWxCpCorpId()); + String agentId = WxCpMsgForm.appNameToAgentIdMap.get(WxCpMsgForm.getInstance().getAppNameComboBox().getSelectedItem()); + configStorage.setAgentId(Integer.valueOf(agentId)); + + List wxCpAppList = wxCpAppMapper.selectByAgentId(agentId); + if (wxCpAppList.size() > 0) { + configStorage.setCorpSecret(wxCpAppList.get(0).getSecret()); + } + if (App.config.isMpUseProxy()) { + configStorage.setHttpProxyHost(App.config.getMpProxyHost()); + configStorage.setHttpProxyPort(Integer.parseInt(App.config.getMpProxyPort())); + configStorage.setHttpProxyUsername(App.config.getMpProxyUserName()); + configStorage.setHttpProxyPassword(App.config.getMpProxyPassword()); + } + DefaultApacheHttpClientBuilder clientBuilder = DefaultApacheHttpClientBuilder.get(); + //从连接池获取链接的超时时间(单位ms) + clientBuilder.setConnectionRequestTimeout(10000); + //建立链接的超时时间(单位ms) + clientBuilder.setConnectionTimeout(5000); + //连接池socket超时时间(单位ms) + clientBuilder.setSoTimeout(5000); + //空闲链接的超时时间(单位ms) + clientBuilder.setIdleConnTimeout(60000); + //空闲链接的检测周期(单位ms) + clientBuilder.setCheckWaitTime(60000); + //每路最大连接数 + clientBuilder.setMaxConnPerHost(App.config.getMaxThreadPool() * 2); + //连接池最大连接数 + clientBuilder.setMaxTotalConn(App.config.getMaxThreadPool() * 2); + //HttpClient请求时使用的User Agent +// clientBuilder.setUserAgent(..) + configStorage.setApacheHttpClientBuilder(clientBuilder); + return configStorage; + } + + /** + * 获取微信企业号工具服务 + * + * @return WxCpService + */ + public static WxCpService getWxCpService() { + if (wxCpConfigStorage == null) { + synchronized (DingMsgSender.class) { + if (wxCpConfigStorage == null) { + wxCpConfigStorage = wxCpConfigStorage(); + } + } + } + if (wxCpService == null && wxCpConfigStorage != null) { + synchronized (PushControl.class) { + if (wxCpService == null && wxCpConfigStorage != null) { + wxCpService = new WxCpServiceApacheHttpClientImpl(); + wxCpService.setWxCpConfigStorage(wxCpConfigStorage); + } + } + } + return wxCpService; + } +} 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 4cc8125b..24d4f6e0 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 @@ -51,6 +51,9 @@ public static IMsgSender getMsgSender() { case MessageTypeEnum.HTTP_CODE: iMsgSender = new HttpMsgSender(); break; + case MessageTypeEnum.DING_CODE: + iMsgSender = new DingMsgSender(); + 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 7fc1faf3..62b90cad 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 @@ -19,7 +19,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -114,7 +114,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -132,7 +132,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -207,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 f8fef421..aa542e17 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,6 +43,7 @@ public class MessageTypeForm { private JLabel kefuPriorityTipsLabel; private JRadioButton httpRadioButton; private JRadioButton 七牛云短信RadioButton; + private JRadioButton 百度云短信RadioButton; private static MessageTypeForm messageTypeForm; @@ -195,7 +196,7 @@ public static void clearAllSelected() { messageTypeScrollPane.setAutoscrolls(true); messageTypePanel.add(messageTypeScrollPane, 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)); msgTypeListPanel = new JPanel(); - msgTypeListPanel.setLayout(new GridLayoutManager(19, 3, new Insets(20, 20, 0, 0), -1, -1)); + msgTypeListPanel.setLayout(new GridLayoutManager(20, 3, new Insets(20, 20, 0, 0), -1, -1)); msgTypeListPanel.setAutoscrolls(true); messageTypeScrollPane.setViewportView(msgTypeListPanel); mpTemplateRadioButton = new JRadioButton(); @@ -232,23 +233,23 @@ public static void clearAllSelected() { 网易云信短信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)); + msgTypeListPanel.add(网易云信短信RadioButton, new GridConstraints(15, 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(15, 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(16, 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)); luosimao短信RadioButton = new JRadioButton(); luosimao短信RadioButton.setEnabled(false); luosimao短信RadioButton.setText("Luosimao短信"); - msgTypeListPanel.add(luosimao短信RadioButton, new GridConstraints(16, 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(luosimao短信RadioButton, new GridConstraints(17, 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(17, 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(18, 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(18, 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(19, 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)); kefuPriorityTipsLabel = new JLabel(); kefuPriorityTipsLabel.setIcon(new ImageIcon(getClass().getResource("/icon/helpButton.png"))); kefuPriorityTipsLabel.setText(""); @@ -275,6 +276,10 @@ 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)); 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)); From d7a613a3d0a81340a947b2316582fc9422d183b0 Mon Sep 17 00:00:00 2001 From: duoduo Date: Thu, 5 Sep 2019 23:42:39 +0800 Subject: [PATCH 16/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AFSender=E5=88=9D=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/dao/TDingAppMapper.java | 1 + .../push/logic/msgmaker/DingMsgMaker.java | 6 +- .../push/logic/msgsender/DingMsgSender.java | 127 +++++++----------- src/main/resources/mapper/TDingAppMapper.xml | 6 + 4 files changed, 59 insertions(+), 81 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java index 89e08cc5..d0f4473c 100644 --- a/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java +++ b/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java @@ -21,4 +21,5 @@ public interface TDingAppMapper { List selectAll(); + TDingApp selectByAgentId(String agentId); } \ No newline at end of file diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java index 7edba845..d257d586 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java @@ -16,7 +16,7 @@ */ public class DingMsgMaker extends BaseMsgMaker implements IMsgMaker { - private static String agentId; + public static String agentId; public static String msgType; @@ -44,8 +44,8 @@ public void prepare() { synchronized (this) { if (agentIdBefore == null || !agentIdBefore.equals(agentIdNow)) { agentId = agentIdNow; - DingMsgSender.wxCpConfigStorage = null; - DingMsgSender.wxCpService = null; + DingMsgSender.accessToken = null; + DingMsgSender.defaultDingTalkClient = null; } } msgType = (String) DingMsgForm.getInstance().getMsgTypeComboBox().getSelectedItem(); diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java index 7e49f214..ff783f54 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java @@ -1,20 +1,18 @@ package com.fangxuele.tool.push.logic.msgsender; -import com.fangxuele.tool.push.App; +import com.dingtalk.api.DefaultDingTalkClient; +import com.dingtalk.api.request.OapiGettokenRequest; +import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request; +import com.dingtalk.api.response.OapiGettokenResponse; +import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response; import com.fangxuele.tool.push.bean.DingMsg; -import com.fangxuele.tool.push.dao.TWxCpAppMapper; -import com.fangxuele.tool.push.domain.TWxCpApp; +import com.fangxuele.tool.push.dao.TDingAppMapper; +import com.fangxuele.tool.push.domain.TDingApp; import com.fangxuele.tool.push.logic.PushControl; import com.fangxuele.tool.push.logic.msgmaker.DingMsgMaker; -import com.fangxuele.tool.push.ui.form.msg.WxCpMsgForm; import com.fangxuele.tool.push.util.MybatisUtil; +import com.taobao.api.ApiException; import lombok.extern.slf4j.Slf4j; -import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder; -import me.chanjar.weixin.cp.api.WxCpService; -import me.chanjar.weixin.cp.api.impl.WxCpServiceApacheHttpClientImpl; -import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl; - -import java.util.List; /** *
@@ -26,15 +24,15 @@
  */
 @Slf4j
 public class DingMsgSender implements IMsgSender {
-    public volatile static WxCpDefaultConfigImpl wxCpConfigStorage;
-    public volatile static WxCpService wxCpService;
+    public volatile static DefaultDingTalkClient defaultDingTalkClient;
+    public volatile static String accessToken;
     private DingMsgMaker dingMsgMaker;
 
-    private static TWxCpAppMapper wxCpAppMapper = MybatisUtil.getSqlSession().getMapper(TWxCpAppMapper.class);
+    private static TDingAppMapper dingAppMapper = MybatisUtil.getSqlSession().getMapper(TDingAppMapper.class);
 
     public DingMsgSender() {
         dingMsgMaker = new DingMsgMaker();
-        wxCpService = getWxCpService();
+        defaultDingTalkClient = getDefaultDingTalkClient();
     }
 
     @Override
@@ -42,20 +40,26 @@ public SendResult send(String[] msgData) {
         SendResult sendResult = new SendResult();
 
         try {
-            String openId = msgData[0];
+            String userId = msgData[0];
+
+            OapiMessageCorpconversationAsyncsendV2Request request2 = new OapiMessageCorpconversationAsyncsendV2Request();
+            request2.setUseridList(userId);
+            request2.setAgentId(Long.valueOf(DingMsgMaker.agentId));
+            request2.setToAllUser(false);
+
             DingMsg dingMsg = dingMsgMaker.makeMsg(msgData);
-//            dingMsg.setToUser(openId);
+
             if (PushControl.dryRun) {
                 sendResult.setSuccess(true);
                 return sendResult;
             } else {
-//                WxCpMessageSendResult wxCpMessageSendResult = wxCpService.messageSend(dingMsg);
-//                if (wxCpMessageSendResult.getErrCode() != 0 || StringUtils.isNoneEmpty(wxCpMessageSendResult.getInvalidUser())) {
-//                    sendResult.setSuccess(false);
-//                    sendResult.setInfo(wxCpMessageSendResult.toString());
-//                    log.error(wxCpMessageSendResult.toString());
-//                    return sendResult;
-//                }
+                OapiMessageCorpconversationAsyncsendV2Response response2 = defaultDingTalkClient.execute(request2, getAccessToken());
+                if (response2.getErrcode() != 0) {
+                    sendResult.setSuccess(false);
+                    sendResult.setInfo(response2.getErrmsg());
+                    log.error(response2.getErrmsg());
+                    return sendResult;
+                }
             }
         } catch (Exception e) {
             sendResult.setSuccess(false);
@@ -73,69 +77,36 @@ public SendResult asyncSend(String[] msgData) {
         return null;
     }
 
-    /**
-     * 微信企业号配置
-     *
-     * @return WxCpConfigStorage
-     */
-    private static WxCpDefaultConfigImpl wxCpConfigStorage() {
-        WxCpDefaultConfigImpl configStorage = new WxCpDefaultConfigImpl();
-        configStorage.setCorpId(App.config.getWxCpCorpId());
-        String agentId = WxCpMsgForm.appNameToAgentIdMap.get(WxCpMsgForm.getInstance().getAppNameComboBox().getSelectedItem());
-        configStorage.setAgentId(Integer.valueOf(agentId));
-
-        List wxCpAppList = wxCpAppMapper.selectByAgentId(agentId);
-        if (wxCpAppList.size() > 0) {
-            configStorage.setCorpSecret(wxCpAppList.get(0).getSecret());
-        }
-        if (App.config.isMpUseProxy()) {
-            configStorage.setHttpProxyHost(App.config.getMpProxyHost());
-            configStorage.setHttpProxyPort(Integer.parseInt(App.config.getMpProxyPort()));
-            configStorage.setHttpProxyUsername(App.config.getMpProxyUserName());
-            configStorage.setHttpProxyPassword(App.config.getMpProxyPassword());
-        }
-        DefaultApacheHttpClientBuilder clientBuilder = DefaultApacheHttpClientBuilder.get();
-        //从连接池获取链接的超时时间(单位ms)
-        clientBuilder.setConnectionRequestTimeout(10000);
-        //建立链接的超时时间(单位ms)
-        clientBuilder.setConnectionTimeout(5000);
-        //连接池socket超时时间(单位ms)
-        clientBuilder.setSoTimeout(5000);
-        //空闲链接的超时时间(单位ms)
-        clientBuilder.setIdleConnTimeout(60000);
-        //空闲链接的检测周期(单位ms)
-        clientBuilder.setCheckWaitTime(60000);
-        //每路最大连接数
-        clientBuilder.setMaxConnPerHost(App.config.getMaxThreadPool() * 2);
-        //连接池最大连接数
-        clientBuilder.setMaxTotalConn(App.config.getMaxThreadPool() * 2);
-        //HttpClient请求时使用的User Agent
-//        clientBuilder.setUserAgent(..)
-        configStorage.setApacheHttpClientBuilder(clientBuilder);
-        return configStorage;
-    }
-
     /**
      * 获取微信企业号工具服务
      *
      * @return WxCpService
      */
-    public static WxCpService getWxCpService() {
-        if (wxCpConfigStorage == null) {
-            synchronized (DingMsgSender.class) {
-                if (wxCpConfigStorage == null) {
-                    wxCpConfigStorage = wxCpConfigStorage();
-                }
-            }
-        }
-        if (wxCpService == null && wxCpConfigStorage != null) {
+    public static DefaultDingTalkClient getDefaultDingTalkClient() {
+        if (defaultDingTalkClient == null) {
             synchronized (PushControl.class) {
-                if (wxCpService == null && wxCpConfigStorage != null) {
-                    wxCpService = new WxCpServiceApacheHttpClientImpl();
-                    wxCpService.setWxCpConfigStorage(wxCpConfigStorage);
+                if (defaultDingTalkClient == null) {
+                    defaultDingTalkClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2");
                 }
             }
         }
-        return wxCpService;
+        return defaultDingTalkClient;
+    }
+
+    public static String getAccessToken() {
+        DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
+        OapiGettokenRequest request = new OapiGettokenRequest();
+        TDingApp tDingApp = dingAppMapper.selectByAgentId(DingMsgMaker.agentId);
+        request.setAppkey(tDingApp.getAppKey());
+        request.setAppsecret(tDingApp.getAppSecret());
+        request.setHttpMethod("GET");
+        OapiGettokenResponse response = null;
+        try {
+            response = client.execute(request);
+        } catch (ApiException e) {
+            e.printStackTrace();
+        }
+        accessToken = response.getAccessToken();
+        return accessToken;
     }
 }
diff --git a/src/main/resources/mapper/TDingAppMapper.xml b/src/main/resources/mapper/TDingAppMapper.xml
index 0d457ce1..8a90018f 100644
--- a/src/main/resources/mapper/TDingAppMapper.xml
+++ b/src/main/resources/mapper/TDingAppMapper.xml
@@ -126,4 +126,10 @@
         
         from t_ding_app
     
+    
 
\ No newline at end of file

From 18d354ca454ea15b4722be444c34aa634696ba46 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Thu, 5 Sep 2019 23:45:27 +0800
Subject: [PATCH 17/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?=
 =?UTF-8?q?=E6=81=AFSender=E5=88=9D=E6=AD=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 82e5c637..317307aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 # Project exclude paths
 /target/
 /.idea/
+/logs/

From fe368e351292f084c83347f51b8bd5a244a4d88d Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Fri, 6 Sep 2019 13:15:02 +0800
Subject: [PATCH 18/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?=
 =?UTF-8?q?=E6=81=AFSenderw=E5=AE=8C=E6=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../push/logic/msgmaker/DingMsgMaker.java     |  6 +++-
 .../push/logic/msgsender/DingMsgSender.java   | 31 +++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java
index d257d586..e01301e6 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java
@@ -68,7 +68,11 @@ public DingMsg makeMsg(String[] msgData) {
 
         DingMsg dingMsg = new DingMsg();
         VelocityContext velocityContext = getVelocityContext(msgData);
-        dingMsg.setContent(TemplateUtil.evaluate(msgContent, velocityContext));
+        if ("markdown消息".equals(msgType)) {
+            dingMsg.setContent(msgContent);
+        } else {
+            dingMsg.setContent(TemplateUtil.evaluate(msgContent, velocityContext));
+        }
         dingMsg.setTitle(TemplateUtil.evaluate(msgTitle, velocityContext));
         dingMsg.setPicUrl(TemplateUtil.evaluate(picUrl, velocityContext));
         dingMsg.setUrl(TemplateUtil.evaluate(url, velocityContext));
diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java
index ff783f54..1701bd22 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java
@@ -48,6 +48,8 @@ public SendResult send(String[] msgData) {
             request2.setToAllUser(false);
 
             DingMsg dingMsg = dingMsgMaker.makeMsg(msgData);
+            OapiMessageCorpconversationAsyncsendV2Request.Msg msg = getMsg(dingMsg);
+            request2.setMsg(msg);
 
             if (PushControl.dryRun) {
                 sendResult.setSuccess(true);
@@ -72,6 +74,35 @@ public SendResult send(String[] msgData) {
         return sendResult;
     }
 
+    private OapiMessageCorpconversationAsyncsendV2Request.Msg getMsg(DingMsg dingMsg) {
+        OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg();
+        if ("文本消息".equals(DingMsgMaker.msgType)) {
+            msg.setMsgtype("text");
+            msg.setText(new OapiMessageCorpconversationAsyncsendV2Request.Text());
+            msg.getText().setContent(dingMsg.getContent());
+        } else if ("链接消息".equals(DingMsgMaker.msgType)) {
+            msg.setMsgtype("link");
+            msg.setLink(new OapiMessageCorpconversationAsyncsendV2Request.Link());
+            msg.getLink().setTitle(dingMsg.getTitle());
+            msg.getLink().setText(dingMsg.getContent());
+            msg.getLink().setMessageUrl(dingMsg.getUrl());
+            msg.getLink().setPicUrl(dingMsg.getPicUrl());
+        } else if ("markdown消息".equals(DingMsgMaker.msgType)) {
+            msg.setMsgtype("markdown");
+            msg.setMarkdown(new OapiMessageCorpconversationAsyncsendV2Request.Markdown());
+            msg.getMarkdown().setText(dingMsg.getContent());
+            msg.getMarkdown().setTitle(dingMsg.getTitle());
+        } else if ("卡片消息".equals(DingMsgMaker.msgType)) {
+            msg.setMsgtype("action_card");
+            msg.setActionCard(new OapiMessageCorpconversationAsyncsendV2Request.ActionCard());
+            msg.getActionCard().setTitle(dingMsg.getTitle());
+            msg.getActionCard().setMarkdown(dingMsg.getContent());
+            msg.getActionCard().setSingleTitle(dingMsg.getBtnTxt());
+            msg.getActionCard().setSingleUrl(dingMsg.getBtnUrl());
+        }
+        return msg;
+    }
+
     @Override
     public SendResult asyncSend(String[] msgData) {
         return null;

From 184f5fde12791fc7f3aa2abf17876a275a2cbcf0 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Fri, 6 Sep 2019 13:21:29 +0800
Subject: [PATCH 19/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?=
 =?UTF-8?q?=E6=81=AFSenderw=E5=AE=8C=E6=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/fangxuele/tool/push/ui/listener/MsgEditListener.java   | 3 +++
 1 file changed, 3 insertions(+)

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 5cf67d07..1ebec10a 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
@@ -150,6 +150,9 @@ public void mousePressed(MouseEvent e) {
                 } else if (msgType == MessageTypeEnum.HTTP_CODE) {
                     fillParaName = "消息变量(如果是变量消息)";
                     paraDemo = "变量0|变量1|变量2";
+                } 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) {
                     fillParaName = "预览消息用户的手机号";
                     paraDemo = "13910733521;13910733522";

From 2b1b25c7b56190beb1ef5a38d508ebab30c7d561 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Fri, 6 Sep 2019 13:45:28 +0800
Subject: [PATCH 20/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?=
 =?UTF-8?q?=E6=81=AFaccessToken=E7=BC=93=E5=AD=98=E7=AD=96=E7=95=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../push/logic/msgmaker/DingMsgMaker.java     |  2 +-
 .../push/logic/msgsender/DingMsgSender.java   | 42 ++++++++++++-------
 2 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java
index e01301e6..3c0f57c0 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java
@@ -44,7 +44,7 @@ public void prepare() {
         synchronized (this) {
             if (agentIdBefore == null || !agentIdBefore.equals(agentIdNow)) {
                 agentId = agentIdNow;
-                DingMsgSender.accessToken = null;
+                DingMsgSender.accessTokenTimedCache = null;
                 DingMsgSender.defaultDingTalkClient = null;
             }
         }
diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java
index 1701bd22..fa7afd43 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java
@@ -1,5 +1,7 @@
 package com.fangxuele.tool.push.logic.msgsender;
 
+import cn.hutool.cache.CacheUtil;
+import cn.hutool.cache.impl.TimedCache;
 import com.dingtalk.api.DefaultDingTalkClient;
 import com.dingtalk.api.request.OapiGettokenRequest;
 import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
@@ -13,6 +15,7 @@
 import com.fangxuele.tool.push.util.MybatisUtil;
 import com.taobao.api.ApiException;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 
 /**
  * 
@@ -25,7 +28,7 @@
 @Slf4j
 public class DingMsgSender implements IMsgSender {
     public volatile static DefaultDingTalkClient defaultDingTalkClient;
-    public volatile static String accessToken;
+    public static TimedCache accessTokenTimedCache;
     private DingMsgMaker dingMsgMaker;
 
     private static TDingAppMapper dingAppMapper = MybatisUtil.getSqlSession().getMapper(TDingAppMapper.class);
@@ -55,7 +58,7 @@ public SendResult send(String[] msgData) {
                 sendResult.setSuccess(true);
                 return sendResult;
             } else {
-                OapiMessageCorpconversationAsyncsendV2Response response2 = defaultDingTalkClient.execute(request2, getAccessToken());
+                OapiMessageCorpconversationAsyncsendV2Response response2 = defaultDingTalkClient.execute(request2, getAccessTokenTimedCache().get("accessToken"));
                 if (response2.getErrcode() != 0) {
                     sendResult.setSuccess(false);
                     sendResult.setInfo(response2.getErrmsg());
@@ -124,20 +127,27 @@ public static DefaultDingTalkClient getDefaultDingTalkClient() {
         return defaultDingTalkClient;
     }
 
-    public static String getAccessToken() {
-        DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
-        OapiGettokenRequest request = new OapiGettokenRequest();
-        TDingApp tDingApp = dingAppMapper.selectByAgentId(DingMsgMaker.agentId);
-        request.setAppkey(tDingApp.getAppKey());
-        request.setAppsecret(tDingApp.getAppSecret());
-        request.setHttpMethod("GET");
-        OapiGettokenResponse response = null;
-        try {
-            response = client.execute(request);
-        } catch (ApiException e) {
-            e.printStackTrace();
+    public static TimedCache getAccessTokenTimedCache() {
+        if (accessTokenTimedCache == null || StringUtils.isEmpty(accessTokenTimedCache.get("accessToken"))) {
+            synchronized (PushControl.class) {
+                if (accessTokenTimedCache == null || StringUtils.isEmpty(accessTokenTimedCache.get("accessToken"))) {
+                    DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
+                    OapiGettokenRequest request = new OapiGettokenRequest();
+                    TDingApp tDingApp = dingAppMapper.selectByAgentId(DingMsgMaker.agentId);
+                    request.setAppkey(tDingApp.getAppKey());
+                    request.setAppsecret(tDingApp.getAppSecret());
+                    request.setHttpMethod("GET");
+                    OapiGettokenResponse response = null;
+                    try {
+                        response = client.execute(request);
+                    } catch (ApiException e) {
+                        e.printStackTrace();
+                    }
+                    accessTokenTimedCache = CacheUtil.newTimedCache((response.getExpiresIn() - 60) * 1000);
+                    accessTokenTimedCache.put("accessToken", response.getAccessToken());
+                }
+            }
         }
-        accessToken = response.getAccessToken();
-        return accessToken;
+        return accessTokenTimedCache;
     }
 }

From e7eb2b58af3f1a3135176ffd173e945353435676 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Fri, 6 Sep 2019 14:10:58 +0800
Subject: [PATCH 21/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E7=BC=96=E8=BE=91=E7=95=8C=E9=9D=A2=E5=A2=9E=E5=8A=A0?=
 =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=B6=88=E6=81=AF=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../tool/push/ui/form/msg/DingMsgForm.form    | 113 +++++++++++------
 .../tool/push/ui/form/msg/DingMsgForm.java    | 115 ++++++++++++++----
 2 files changed, 165 insertions(+), 63 deletions(-)

diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form
index 0d4adff1..3d8d4368 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form
@@ -3,12 +3,12 @@
   
     
     
-      
+      
     
     
     
     
-      
+      
         
         
           
@@ -20,7 +20,7 @@
         
           
             
-              
+              
             
             
               
@@ -29,12 +29,12 @@
           
           
             
-              
+              
             
           
           
             
-              
+              
             
             
               
@@ -47,7 +47,7 @@
           
           
             
-              
+              
             
             
               
@@ -56,7 +56,7 @@
           
           
             
-              
+              
             
             
               
@@ -65,7 +65,7 @@
           
           
             
-              
+              
                 
               
             
@@ -73,7 +73,7 @@
           
           
             
-              
+              
             
             
               
@@ -82,7 +82,7 @@
           
           
             
-              
+              
                 
               
             
@@ -90,37 +90,15 @@
           
           
             
-              
+              
             
             
               
             
           
-          
-            
-              
-            
-            
-              
-            
-          
-          
-            
-              
-            
-            
-          
-          
-            
-              
-            
-            
-              
-            
-          
           
             
-              
+              
                 
                 
               
@@ -129,7 +107,7 @@
           
           
             
-              
+              
                 
               
             
@@ -137,7 +115,7 @@
           
           
             
-              
+              
             
             
               
@@ -146,7 +124,7 @@
           
           
             
-              
+              
                 
               
             
@@ -156,7 +134,7 @@
           
           
             
-              
+              
                 
               
             
@@ -164,13 +142,70 @@
           
           
             
-              
+              
             
             
               
               
             
           
+          
+            
+            
+              
+            
+            
+            
+            
+              
+                
+                  
+                
+                
+              
+              
+                
+                  
+                
+                
+                  
+                
+              
+              
+                
+                  
+                
+                
+                  
+                
+              
+              
+                
+                  
+                
+                
+                  
+                
+              
+              
+                
+                  
+                    
+                  
+                
+                
+              
+              
+                
+                  
+                
+                
+                  
+                  
+                
+              
+            
+          
         
       
       
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java
index 5e9be144..68887ce7 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java
@@ -7,6 +7,8 @@
 import com.fangxuele.tool.push.domain.TDingApp;
 import com.fangxuele.tool.push.domain.TMsgDing;
 import com.fangxuele.tool.push.logic.MessageTypeEnum;
+import com.fangxuele.tool.push.ui.UiConsts;
+import com.fangxuele.tool.push.ui.dialog.CommonTipsDialog;
 import com.fangxuele.tool.push.ui.dialog.DingAppDialog;
 import com.fangxuele.tool.push.ui.form.MainWindow;
 import com.fangxuele.tool.push.util.MybatisUtil;
@@ -21,6 +23,8 @@
 import javax.swing.border.TitledBorder;
 import java.awt.*;
 import java.awt.event.ItemEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -52,6 +56,10 @@ public class DingMsgForm implements IMsgForm {
     private JTextField btnTxtTextField;
     private JTextField btnURLTextField;
     private JLabel btnURLLabel;
+    private JRadioButton workRadioButton;
+    private JRadioButton robotRadioButton;
+    private JTextField webHookTextField;
+    private JLabel webHookHelpLabel;
 
     private static DingMsgForm dingMsgForm;
 
@@ -75,6 +83,53 @@ public DingMsgForm() {
             dialog.setVisible(true);
             initAppNameList();
         });
+
+        workRadioButton.addChangeListener(e -> {
+            boolean isSelected = workRadioButton.isSelected();
+            if (isSelected) {
+                robotRadioButton.setSelected(false);
+            }
+        });
+        robotRadioButton.addChangeListener(e -> {
+            boolean isSelected = robotRadioButton.isSelected();
+            if (isSelected) {
+                workRadioButton.setSelected(false);
+            }
+        });
+        webHookHelpLabel.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mousePressed(MouseEvent e) {
+                CommonTipsDialog dialog = new CommonTipsDialog();
+
+                StringBuilder tipsBuilder = new StringBuilder();
+                tipsBuilder.append("

如何获取自定义机器人webhook?

"); + tipsBuilder.append("

进入一个钉钉群,在群的顶部功能栏中,点击【群设置】,进入菜单可以看到【群机器人】的入口,点击进入“群机器人”的管理面板后,可以进行添加、编辑和删除群机器人的操作。

"); + tipsBuilder.append("

在机器人管理页面选择“自定义”机器人,输入机器人名字并选择要发送消息的群。如果需要的话,可以为机器人设置一个头像。点击“完成添加”,完成后会生成Hook地址。

"); + tipsBuilder.append("

点击“复制”按钮,即可获得这个机器人对应的Webhook地址,其格式如下:

"); + tipsBuilder.append("

https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxx

"); + + dialog.setHtmlText(tipsBuilder.toString()); + dialog.pack(); + dialog.setVisible(true); + + super.mousePressed(e); + } + + @Override + public void mouseEntered(MouseEvent e) { + JLabel label = (JLabel) e.getComponent(); + label.setCursor(new Cursor(Cursor.HAND_CURSOR)); + label.setIcon(new ImageIcon(UiConsts.HELP_FOCUSED_ICON)); + super.mouseEntered(e); + } + + @Override + public void mouseExited(MouseEvent e) { + JLabel label = (JLabel) e.getComponent(); + label.setIcon(new ImageIcon(UiConsts.HELP_ICON)); + super.mouseExited(e); + } + }); } @Override @@ -278,14 +333,14 @@ public static void clearAllField() { final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); dingMsgPanel = new JPanel(); - dingMsgPanel.setLayout(new GridLayoutManager(9, 3, new Insets(10, 8, 0, 8), -1, -1)); + dingMsgPanel.setLayout(new GridLayoutManager(10, 4, new Insets(10, 8, 0, 8), -1, -1)); panel1.add(dingMsgPanel, 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)); dingMsgPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, dingMsgPanel.getFont()))); msgTypeLabel = new JLabel(); msgTypeLabel.setText("消息类型"); - dingMsgPanel.add(msgTypeLabel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(msgTypeLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); - dingMsgPanel.add(spacer1, new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + dingMsgPanel.add(spacer1, new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); msgTypeComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("文本消息"); @@ -293,47 +348,59 @@ public static void clearAllField() { defaultComboBoxModel1.addElement("markdown消息"); defaultComboBoxModel1.addElement("卡片消息"); msgTypeComboBox.setModel(defaultComboBoxModel1); - dingMsgPanel.add(msgTypeComboBox, new GridConstraints(1, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(msgTypeComboBox, new GridConstraints(2, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); titleLabel = new JLabel(); titleLabel.setText("标题"); - dingMsgPanel.add(titleLabel, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(titleLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); picUrlLabel = new JLabel(); picUrlLabel.setText("图片URL"); - dingMsgPanel.add(picUrlLabel, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(picUrlLabel, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); picUrlTextField = new JTextField(); - dingMsgPanel.add(picUrlTextField, new GridConstraints(4, 1, 1, 2, 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)); + dingMsgPanel.add(picUrlTextField, new GridConstraints(5, 1, 1, 3, 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)); urlLabel = new JLabel(); urlLabel.setText("跳转URL"); - dingMsgPanel.add(urlLabel, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(urlLabel, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); urlTextField = new JTextField(); - dingMsgPanel.add(urlTextField, new GridConstraints(5, 1, 1, 2, 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)); + dingMsgPanel.add(urlTextField, new GridConstraints(6, 1, 1, 3, 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)); contentLabel = new JLabel(); contentLabel.setText("内容"); - dingMsgPanel.add(contentLabel, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final JLabel label1 = new JLabel(); - label1.setText("选择应用"); - dingMsgPanel.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)); - appNameComboBox = new JComboBox(); - dingMsgPanel.add(appNameComboBox, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - appManageButton = new JButton(); - appManageButton.setText("应用管理"); - dingMsgPanel.add(appManageButton, new GridConstraints(0, 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)); + dingMsgPanel.add(contentLabel, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); titleTextField = new JTextField(); - dingMsgPanel.add(titleTextField, new GridConstraints(3, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(380, -1), new Dimension(380, -1), null, 0, false)); + dingMsgPanel.add(titleTextField, new GridConstraints(4, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, new Dimension(380, -1), new Dimension(380, -1), null, 0, false)); contentTextArea = new JTextArea(); - dingMsgPanel.add(contentTextArea, new GridConstraints(2, 1, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(150, 50), null, 0, false)); + dingMsgPanel.add(contentTextArea, new GridConstraints(3, 1, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(150, 50), null, 0, false)); btnTxtLabel = new JLabel(); btnTxtLabel.setText("按钮文字"); btnTxtLabel.setToolTipText("可不填。默认为“详情”, 不超过4个文字,超过自动截断"); - dingMsgPanel.add(btnTxtLabel, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(btnTxtLabel, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); btnTxtTextField = new JTextField(); btnTxtTextField.setToolTipText("可不填。默认为“详情”, 不超过4个文字,超过自动截断"); - dingMsgPanel.add(btnTxtTextField, new GridConstraints(6, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + dingMsgPanel.add(btnTxtTextField, new GridConstraints(7, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); btnURLTextField = new JTextField(); - dingMsgPanel.add(btnURLTextField, new GridConstraints(7, 1, 1, 2, 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)); + dingMsgPanel.add(btnURLTextField, new GridConstraints(8, 1, 1, 3, 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)); btnURLLabel = new JLabel(); btnURLLabel.setText("按钮URL"); - dingMsgPanel.add(btnURLLabel, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + dingMsgPanel.add(btnURLLabel, new GridConstraints(8, 0, 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(2, 4, new Insets(0, 0, 20, 0), -1, -1)); + dingMsgPanel.add(panel2, new GridConstraints(0, 0, 2, 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)); + appNameComboBox = new JComboBox(); + panel2.add(appNameComboBox, new GridConstraints(0, 1, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + appManageButton = new JButton(); + appManageButton.setText("应用管理"); + panel2.add(appManageButton, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + workRadioButton = new JRadioButton(); + workRadioButton.setText("工作通知消息"); + panel2.add(workRadioButton, 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)); + robotRadioButton = new JRadioButton(); + robotRadioButton.setText("群机器人消息"); + panel2.add(robotRadioButton, 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)); + webHookTextField = new JTextField(); + panel2.add(webHookTextField, new GridConstraints(1, 2, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + webHookHelpLabel = new JLabel(); + webHookHelpLabel.setIcon(new ImageIcon(getClass().getResource("/icon/helpButton.png"))); + webHookHelpLabel.setText("webhook"); + panel2.add(webHookHelpLabel, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer2 = new Spacer(); panel1.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); final Spacer spacer3 = new Spacer(); From 13bbc28a3574c9d3f35496d9c24c577f5bad39ed Mon Sep 17 00:00:00 2001 From: duoduo Date: Fri, 6 Sep 2019 14:22:40 +0800 Subject: [PATCH 22/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5radio=5Ft?= =?UTF-8?q?ype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fangxuele/tool/push/domain/TMsgDing.java | 10 +++++++++ src/main/resources/db_init.sql | 1 + src/main/resources/generatorConfig.xml | 2 +- src/main/resources/mapper/TMsgDingMapper.xml | 22 +++++++++++++++---- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java index 48cfd240..7944ec82 100644 --- a/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java +++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java @@ -21,6 +21,8 @@ public class TMsgDing implements Serializable { private String modifiedTime; + private String radioType; + private static final long serialVersionUID = 1L; public Integer getId() { @@ -94,4 +96,12 @@ public String getModifiedTime() { public void setModifiedTime(String modifiedTime) { this.modifiedTime = modifiedTime == null ? null : modifiedTime.trim(); } + + public String getRadioType() { + return radioType; + } + + public void setRadioType(String radioType) { + this.radioType = radioType == null ? null : radioType.trim(); + } } \ No newline at end of file diff --git a/src/main/resources/db_init.sql b/src/main/resources/db_init.sql index 35b98b43..26d884c1 100644 --- a/src/main/resources/db_init.sql +++ b/src/main/resources/db_init.sql @@ -230,6 +230,7 @@ create table if not exists t_msg_ding primary key autoincrement, msg_type integer, msg_name text, + radio_type text, ding_msg_type text, agent_id text, web_hook text, diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index 2b45be3b..721f60eb 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -45,7 +45,7 @@ + tableName="t_msg_ding" domainObjectName="TMsgDing">
diff --git a/src/main/resources/mapper/TMsgDingMapper.xml b/src/main/resources/mapper/TMsgDingMapper.xml index 55482a3e..c30ddf39 100644 --- a/src/main/resources/mapper/TMsgDingMapper.xml +++ b/src/main/resources/mapper/TMsgDingMapper.xml @@ -11,10 +11,11 @@ + id, msg_type, msg_name, ding_msg_type, agent_id, web_hook, content, create_time, - modified_time + modified_time, radio_type @@ -151,6 +164,7 @@ agent_id = #{agentId,jdbcType=VARCHAR}, web_hook = #{webHook,jdbcType=VARCHAR}, content = #{content,jdbcType=VARCHAR}, + radio_type = #{radioType,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=VARCHAR}, modified_time = #{modifiedTime,jdbcType=VARCHAR} where msg_type = #{msgType,jdbcType=INTEGER} From 28bc1947d6965ad2e2776fd3b53950d6c0064f6d Mon Sep 17 00:00:00 2001 From: duoduo Date: Fri, 6 Sep 2019 14:34:42 +0800 Subject: [PATCH 23/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5radio=5Ft?= =?UTF-8?q?ype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/ui/form/msg/DingMsgForm.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java index 68887ce7..039baad6 100644 --- a/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -148,8 +148,11 @@ public void init(String msgName) { getInstance().getPicUrlTextField().setText(dingMsg.getPicUrl()); getInstance().getUrlTextField().setText(dingMsg.getUrl()); getInstance().getBtnTxtTextField().setText(dingMsg.getBtnTxt()); + getInstance().getWebHookTextField().setText(tMsgDing.getWebHook()); switchDingMsgType(dingMsgType); + + switchRadio(tMsgDing.getRadioType()); } else { switchDingMsgType("文本消息"); } @@ -185,6 +188,7 @@ public void save(String msgName) { String url = getInstance().getUrlTextField().getText(); String btnTxt = getInstance().getBtnTxtTextField().getText(); String btnUrl = getInstance().getBtnURLTextField().getText(); + String webHook = getInstance().getWebHookTextField().getText(); String now = SqliteUtil.nowDateForSqlite(); @@ -204,6 +208,13 @@ public void save(String msgName) { tMsgDing.setContent(JSONUtil.toJsonStr(dingMsg)); tMsgDing.setModifiedTime(now); + if (getInstance().getWorkRadioButton().isSelected()) { + tMsgDing.setRadioType("work"); + } else { + tMsgDing.setRadioType("robot"); + } + tMsgDing.setWebHook(webHook); + if (existSameMsg) { msgDingMapper.updateByMsgTypeAndMsgName(tMsgDing); } else { @@ -303,6 +314,16 @@ public static void switchDingMsgType(String msgType) { } } + private void switchRadio(String radioType) { + getInstance().getWorkRadioButton().setSelected(false); + getInstance().getRobotRadioButton().setSelected(false); + if ("work".equals(radioType)) { + getInstance().getWorkRadioButton().setSelected(true); + } else if ("robot".equals(radioType)) { + getInstance().getRobotRadioButton().setSelected(true); + } + } + /** * 清空所有界面字段 */ From 226fe6cc2df13ebe091e711f82758830c36e98bf Mon Sep 17 00:00:00 2001 From: duoduo Date: Fri, 6 Sep 2019 15:08:06 +0800 Subject: [PATCH 24/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E8=81=8A=E5=A4=A9=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../push/logic/msgmaker/DingMsgMaker.java | 16 ++++ .../push/logic/msgsender/DingMsgSender.java | 90 +++++++++++++++++-- 2 files changed, 101 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java index 3c0f57c0..58812f2d 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java @@ -34,6 +34,10 @@ public class DingMsgMaker extends BaseMsgMaker implements IMsgMaker { private static String msgContent; + public static String radioType; + + public static String webHook; + /** * 准备(界面字段等) */ @@ -41,12 +45,18 @@ public class DingMsgMaker extends BaseMsgMaker implements IMsgMaker { public void prepare() { String agentIdBefore = agentId; String agentIdNow = DingMsgForm.appNameToAgentIdMap.get(DingMsgForm.getInstance().getAppNameComboBox().getSelectedItem()); + + String webHookBefore = webHook; + String webHookNow = DingMsgForm.getInstance().getWebHookTextField().getText().trim(); synchronized (this) { if (agentIdBefore == null || !agentIdBefore.equals(agentIdNow)) { agentId = agentIdNow; DingMsgSender.accessTokenTimedCache = null; DingMsgSender.defaultDingTalkClient = null; } + if (webHookBefore == null || !webHookBefore.equals(webHookNow)) { + DingMsgSender.robotClient = null; + } } msgType = (String) DingMsgForm.getInstance().getMsgTypeComboBox().getSelectedItem(); msgTitle = DingMsgForm.getInstance().getTitleTextField().getText(); @@ -55,6 +65,12 @@ public void prepare() { btnTxt = DingMsgForm.getInstance().getBtnTxtTextField().getText().trim(); btnUrl = DingMsgForm.getInstance().getBtnURLTextField().getText().trim(); msgContent = DingMsgForm.getInstance().getContentTextArea().getText(); + if (DingMsgForm.getInstance().getWorkRadioButton().isSelected()) { + radioType = "work"; + } else { + radioType = "robot"; + } + webHook = DingMsgForm.getInstance().getWebHookTextField().getText(); } /** diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java index fa7afd43..cead28b9 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java @@ -3,10 +3,13 @@ import cn.hutool.cache.CacheUtil; import cn.hutool.cache.impl.TimedCache; import com.dingtalk.api.DefaultDingTalkClient; +import com.dingtalk.api.DingTalkClient; import com.dingtalk.api.request.OapiGettokenRequest; import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request; +import com.dingtalk.api.request.OapiRobotSendRequest; import com.dingtalk.api.response.OapiGettokenResponse; import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response; +import com.dingtalk.api.response.OapiRobotSendResponse; import com.fangxuele.tool.push.bean.DingMsg; import com.fangxuele.tool.push.dao.TDingAppMapper; import com.fangxuele.tool.push.domain.TDingApp; @@ -28,6 +31,7 @@ @Slf4j public class DingMsgSender implements IMsgSender { public volatile static DefaultDingTalkClient defaultDingTalkClient; + public volatile static DefaultDingTalkClient robotClient; public static TimedCache accessTokenTimedCache; private DingMsgMaker dingMsgMaker; @@ -40,6 +44,14 @@ public DingMsgSender() { @Override public SendResult send(String[] msgData) { + if ("work".equals(DingMsgMaker.radioType)) { + return sendWorkMsg(msgData); + } else { + return sendRobotMsg(msgData); + } + } + + public SendResult sendWorkMsg(String[] msgData) { SendResult sendResult = new SendResult(); try { @@ -77,6 +89,68 @@ public SendResult send(String[] msgData) { return sendResult; } + public SendResult sendRobotMsg(String[] msgData) { + SendResult sendResult = new SendResult(); + + try { + DingTalkClient client = getRobotClient(); + OapiRobotSendRequest request2 = new OapiRobotSendRequest(); + DingMsg dingMsg = dingMsgMaker.makeMsg(msgData); + if ("文本消息".equals(DingMsgMaker.msgType)) { + request2.setMsgtype("text"); + OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text(); + text.setContent(dingMsg.getContent()); + request2.setText(text); + OapiRobotSendRequest.At at = new OapiRobotSendRequest.At(); + at.setIsAtAll("true"); + request2.setAt(at); + } else if ("链接消息".equals(DingMsgMaker.msgType)) { + request2.setMsgtype("link"); + OapiRobotSendRequest.Link link = new OapiRobotSendRequest.Link(); + link.setMessageUrl(dingMsg.getUrl()); + link.setPicUrl(dingMsg.getPicUrl()); + link.setTitle(dingMsg.getTitle()); + link.setText(dingMsg.getContent()); + request2.setLink(link); + } else if ("markdown消息".equals(DingMsgMaker.msgType)) { + request2.setMsgtype("markdown"); + OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); + markdown.setTitle(dingMsg.getTitle()); + markdown.setText(dingMsg.getContent()); + request2.setMarkdown(markdown); + } else if ("卡片消息".equals(DingMsgMaker.msgType)) { + request2.setMsgtype("actionCard"); + OapiRobotSendRequest.Actioncard actionCard = new OapiRobotSendRequest.Actioncard(); + actionCard.setTitle(dingMsg.getTitle()); + actionCard.setText(dingMsg.getContent()); + actionCard.setSingleTitle(dingMsg.getBtnTxt()); + actionCard.setSingleURL(dingMsg.getBtnUrl()); + request2.setActionCard(actionCard); + } + + if (PushControl.dryRun) { + sendResult.setSuccess(true); + return sendResult; + } else { + OapiRobotSendResponse response2 = client.execute(request2); + if (response2.getErrcode() != 0) { + sendResult.setSuccess(false); + sendResult.setInfo(response2.getErrmsg()); + log.error(response2.getErrmsg()); + return sendResult; + } + } + } catch (Exception e) { + sendResult.setSuccess(false); + sendResult.setInfo(e.getMessage()); + log.error(e.toString()); + return sendResult; + } + + sendResult.setSuccess(true); + return sendResult; + } + private OapiMessageCorpconversationAsyncsendV2Request.Msg getMsg(DingMsg dingMsg) { OapiMessageCorpconversationAsyncsendV2Request.Msg msg = new OapiMessageCorpconversationAsyncsendV2Request.Msg(); if ("文本消息".equals(DingMsgMaker.msgType)) { @@ -111,11 +185,6 @@ public SendResult asyncSend(String[] msgData) { return null; } - /** - * 获取微信企业号工具服务 - * - * @return WxCpService - */ public static DefaultDingTalkClient getDefaultDingTalkClient() { if (defaultDingTalkClient == null) { synchronized (PushControl.class) { @@ -127,6 +196,17 @@ public static DefaultDingTalkClient getDefaultDingTalkClient() { return defaultDingTalkClient; } + public static DefaultDingTalkClient getRobotClient() { + if (robotClient == null) { + synchronized (PushControl.class) { + if (robotClient == null) { + robotClient = new DefaultDingTalkClient(DingMsgMaker.webHook); + } + } + } + return robotClient; + } + public static TimedCache getAccessTokenTimedCache() { if (accessTokenTimedCache == null || StringUtils.isEmpty(accessTokenTimedCache.get("accessToken"))) { synchronized (PushControl.class) { From f047937c402efe02ef319b2dd63ee3fbbc139800 Mon Sep 17 00:00:00 2001 From: duoduo Date: Fri, 6 Sep 2019 15:26:24 +0800 Subject: [PATCH 25/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E8=81=8A=E5=A4=A9=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/push/logic/msgsender/DingMsgSender.java | 11 ++++++++++- .../tool/push/ui/listener/MsgEditListener.java | 13 +++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java index cead28b9..558eee15 100644 --- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java @@ -18,8 +18,11 @@ import com.fangxuele.tool.push.util.MybatisUtil; import com.taobao.api.ApiException; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; +import java.util.List; + /** *
  * 钉钉消息发送器
@@ -102,7 +105,13 @@ public SendResult sendRobotMsg(String[] msgData) {
                 text.setContent(dingMsg.getContent());
                 request2.setText(text);
                 OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
-                at.setIsAtAll("true");
+                if (msgData != null && StringUtils.isNotBlank(msgData[0])) {
+                    List mobiles = Lists.newArrayList();
+                    mobiles.add(msgData[0]);
+                    at.setAtMobiles(mobiles);
+                } else {
+                    at.setIsAtAll("true");
+                }
                 request2.setAt(at);
             } else if ("链接消息".equals(DingMsgMaker.msgType)) {
                 request2.setMsgtype("link");
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 1ebec10a..72f938cd 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
@@ -13,6 +13,7 @@
 import com.fangxuele.tool.push.ui.form.MainWindow;
 import com.fangxuele.tool.push.ui.form.MessageEditForm;
 import com.fangxuele.tool.push.ui.form.MessageManageForm;
+import com.fangxuele.tool.push.ui.form.msg.DingMsgForm;
 import com.fangxuele.tool.push.ui.form.msg.MsgFormFactory;
 import com.fangxuele.tool.push.ui.form.msg.WxCpMsgForm;
 import com.fangxuele.tool.push.ui.frame.HttpResultFrame;
@@ -66,9 +67,13 @@ public static void addListeners() {
         messageEditForm.getPreviewMsgButton().addActionListener(e -> {
             try {
                 if (App.config.getMsgType() != MessageTypeEnum.HTTP_CODE && "".equals(messageEditForm.getPreviewUserField().getText().trim())) {
-                    JOptionPane.showMessageDialog(messagePanel, "预览用户不能为空!", "提示",
-                            JOptionPane.INFORMATION_MESSAGE);
-                    return;
+                    if (App.config.getMsgType() == MessageTypeEnum.DING_CODE && DingMsgForm.getInstance().getRobotRadioButton().isSelected()) {
+                        // Do Nothing
+                    } else {
+                        JOptionPane.showMessageDialog(messagePanel, "预览用户不能为空!", "提示",
+                                JOptionPane.INFORMATION_MESSAGE);
+                        return;
+                    }
                 }
                 if (App.config.getMsgType() == MessageTypeEnum.MA_TEMPLATE_CODE
                         && messageEditForm.getPreviewUserField().getText().split(";")[0].length() < 2) {
@@ -151,7 +156,7 @@ public void mousePressed(MouseEvent e) {
                     fillParaName = "消息变量(如果是变量消息)";
                     paraDemo = "变量0|变量1|变量2";
                 } else if (msgType == MessageTypeEnum.DING_CODE) {
-                    fillParaName = "预览消息用户的UserId(如果是聊天机器人消息则无需填写)";
+                    fillParaName = "预览消息用户的UserId(如果是聊天机器人消息,填写需要@ 的用户的手机号,如果@所有人 可不填写)";
                     paraDemo = "manager9115|manager9116|manager9117";
                 } else if (msgType == MessageTypeEnum.ALI_YUN_CODE || msgType == MessageTypeEnum.TX_YUN_CODE || msgType == MessageTypeEnum.YUN_PIAN_CODE) {
                     fillParaName = "预览消息用户的手机号";

From ed840b28b81bc83414412f6bfea5cf7292c248a2 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Fri, 6 Sep 2019 19:54:12 +0800
Subject: [PATCH 26/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=AF=BC=E5=85=A5=E9=83=A8=E9=97=A8?=
 =?UTF-8?q?=E8=81=94=E7=B3=BB=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../push/logic/msgsender/DingMsgSender.java   |  4 +-
 .../tool/push/ui/form/MemberForm.form         | 61 ++++++++++++++-
 .../tool/push/ui/form/MemberForm.java         | 36 ++++++++-
 .../tool/push/ui/form/MessageTypeForm.java    |  3 +
 .../tool/push/ui/listener/MemberListener.java | 76 +++++++++++++++++++
 5 files changed, 175 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java
index 558eee15..493e02d6 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java
@@ -15,6 +15,7 @@
 import com.fangxuele.tool.push.domain.TDingApp;
 import com.fangxuele.tool.push.logic.PushControl;
 import com.fangxuele.tool.push.logic.msgmaker.DingMsgMaker;
+import com.fangxuele.tool.push.ui.form.msg.DingMsgForm;
 import com.fangxuele.tool.push.util.MybatisUtil;
 import com.taobao.api.ApiException;
 import lombok.extern.slf4j.Slf4j;
@@ -222,7 +223,8 @@ public static TimedCache getAccessTokenTimedCache() {
                 if (accessTokenTimedCache == null || StringUtils.isEmpty(accessTokenTimedCache.get("accessToken"))) {
                     DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
                     OapiGettokenRequest request = new OapiGettokenRequest();
-                    TDingApp tDingApp = dingAppMapper.selectByAgentId(DingMsgMaker.agentId);
+                    String agentId = DingMsgForm.appNameToAgentIdMap.get(DingMsgForm.getInstance().getAppNameComboBox().getSelectedItem());
+                    TDingApp tDingApp = dingAppMapper.selectByAgentId(agentId);
                     request.setAppkey(tDingApp.getAppKey());
                     request.setAppsecret(tDingApp.getAppSecret());
                     request.setHttpMethod("GET");
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.form
index 02129065..74da1b16 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.form
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.form
@@ -204,7 +204,7 @@
                     
                     
                     
-                      
+                      
                         
                         
                         
@@ -447,10 +447,67 @@
                               
                             
                           
+                          
+                            
+                            
+                              
+                            
+                            
+                            
+                              
+                            
+                            
+                              
+                                
+                                  
+                                
+                                
+                                  
+                                
+                              
+                              
+                                
+                                  
+                                
+                                
+                                  
+                                  
+                                  
+                                
+                              
+                              
+                                
+                                  
+                                
+                                
+                                  
+                                  
+                                  
+                                
+                              
+                              
+                                
+                                  
+                                
+                                
+                                  
+                                
+                              
+                              
+                                
+                                  
+                                
+                                
+                                  
+                                  
+                                
+                              
+                            
+                          
                           
                             
                             
-                              
+                              
                             
                             
                             
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java
index a55f6e4b..43b58d40 100644
--- a/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java
+++ b/src/main/java/com/fangxuele/tool/push/ui/form/MemberForm.java
@@ -73,6 +73,11 @@ public class MemberForm {
     private JTextField importNumTextField;
     private JButton importFromNumButton;
     private JSplitPane splitPane;
+    private JButton dingImportAllButton;
+    private JPanel importFromDingPanel;
+    private JButton dingDeptsImportButton;
+    private JComboBox dingDeptsComboBox;
+    private JButton dingDeptsRefreshButton;
 
     private static MemberForm memberForm;
 
@@ -226,7 +231,7 @@ public static void clearMember() {
         memberImportScrollPane = new JScrollPane();
         memberPanelRight.add(memberImportScrollPane, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
         importWayPanel = new JPanel();
-        importWayPanel.setLayout(new GridLayoutManager(6, 1, new Insets(8, 0, 0, 0), -1, -1));
+        importWayPanel.setLayout(new GridLayoutManager(7, 1, new Insets(8, 0, 0, 0), -1, -1));
         importWayPanel.setMinimumSize(new Dimension(-1, -1));
         importWayPanel.setPreferredSize(new Dimension(150, 600));
         memberImportScrollPane.setViewportView(importWayPanel);
@@ -338,9 +343,36 @@ public static void clearMember() {
         wxCpDeptsImportButton.setIcon(new ImageIcon(getClass().getResource("/icon/import_dark.png")));
         wxCpDeptsImportButton.setText("导入");
         importFromWxCpPanel.add(wxCpDeptsImportButton, new GridConstraints(1, 7, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        importFromDingPanel = new JPanel();
+        importFromDingPanel.setLayout(new GridLayoutManager(2, 8, new Insets(8, 15, 0, 5), -1, -1));
+        importWayPanel.add(importFromDingPanel, new GridConstraints(5, 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));
+        importFromDingPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "通过钉钉通讯录导入", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, importFromDingPanel.getFont())));
+        dingDeptsComboBox = new JComboBox();
+        final DefaultComboBoxModel defaultComboBoxModel4 = new DefaultComboBoxModel();
+        dingDeptsComboBox.setModel(defaultComboBoxModel4);
+        importFromDingPanel.add(dingDeptsComboBox, new GridConstraints(0, 1, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        dingImportAllButton = new JButton();
+        Font dingImportAllButtonFont = this.$$$getFont$$$(null, Font.PLAIN, -1, dingImportAllButton.getFont());
+        if (dingImportAllButtonFont != null) dingImportAllButton.setFont(dingImportAllButtonFont);
+        dingImportAllButton.setIcon(new ImageIcon(getClass().getResource("/icon/import_dark.png")));
+        dingImportAllButton.setText("导入通讯录中所有用户");
+        importFromDingPanel.add(dingImportAllButton, new GridConstraints(1, 0, 1, 8, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        dingDeptsRefreshButton = new JButton();
+        Font dingDeptsRefreshButtonFont = this.$$$getFont$$$(null, Font.PLAIN, -1, dingDeptsRefreshButton.getFont());
+        if (dingDeptsRefreshButtonFont != null) dingDeptsRefreshButton.setFont(dingDeptsRefreshButtonFont);
+        dingDeptsRefreshButton.setIcon(new ImageIcon(getClass().getResource("/icon/refresh.png")));
+        dingDeptsRefreshButton.setText("刷新");
+        importFromDingPanel.add(dingDeptsRefreshButton, new GridConstraints(0, 4, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, 1, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label5 = new JLabel();
+        label5.setText("按部门导入");
+        importFromDingPanel.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        dingDeptsImportButton = new JButton();
+        dingDeptsImportButton.setIcon(new ImageIcon(getClass().getResource("/icon/import_dark.png")));
+        dingDeptsImportButton.setText("导入");
+        importFromDingPanel.add(dingDeptsImportButton, new GridConstraints(0, 7, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         importOptionPanel = new JPanel();
         importOptionPanel.setLayout(new GridLayoutManager(1, 5, new Insets(0, 15, 0, 0), -1, -1));
-        importWayPanel.add(importOptionPanel, new GridConstraints(5, 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));
+        importWayPanel.add(importOptionPanel, new GridConstraints(6, 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));
         importOptionPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(-276358)), "导入选项", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, importOptionPanel.getFont()), new Color(-276358)));
         importOptionOpenIdCheckBox = new JCheckBox();
         importOptionOpenIdCheckBox.setEnabled(false);
diff --git a/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.java b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.java
index aa542e17..276ccd12 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
@@ -149,6 +149,9 @@ private static void initMemberFormLayOut(int msgType) {
         if (msgType == MessageTypeEnum.WX_CP_CODE) {
             MemberForm.getInstance().getImportFromWxCpPanel().setVisible(true);
         }
+        if (msgType == MessageTypeEnum.DING_CODE) {
+            MemberForm.getInstance().getImportFromDingPanel().setVisible(true);
+        }
 
         if (msgType == MessageTypeEnum.HTTP_CODE) {
             MainWindow.getInstance().getTabbedPane().setTitleAt(3, "③准备消息变量");
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 6d62058a..d1c13886 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
@@ -15,17 +15,23 @@
 import cn.hutool.poi.excel.BigExcelWriter;
 import cn.hutool.poi.excel.ExcelReader;
 import cn.hutool.poi.excel.ExcelUtil;
+import com.dingtalk.api.DefaultDingTalkClient;
+import com.dingtalk.api.DingTalkClient;
+import com.dingtalk.api.request.OapiUserSimplelistRequest;
+import com.dingtalk.api.response.OapiUserSimplelistResponse;
 import com.fangxuele.tool.push.App;
 import com.fangxuele.tool.push.dao.TWxMpUserMapper;
 import com.fangxuele.tool.push.domain.TWxMpUser;
 import com.fangxuele.tool.push.logic.MessageTypeEnum;
 import com.fangxuele.tool.push.logic.PushData;
+import com.fangxuele.tool.push.logic.msgsender.DingMsgSender;
 import com.fangxuele.tool.push.logic.msgsender.WxCpMsgSender;
 import com.fangxuele.tool.push.logic.msgsender.WxMpTemplateMsgSender;
 import com.fangxuele.tool.push.ui.component.TableInCellImageLabelRenderer;
 import com.fangxuele.tool.push.ui.dialog.ExportDialog;
 import com.fangxuele.tool.push.ui.form.MainWindow;
 import com.fangxuele.tool.push.ui.form.MemberForm;
+import com.fangxuele.tool.push.ui.form.msg.DingMsgForm;
 import com.fangxuele.tool.push.ui.form.msg.WxCpMsgForm;
 import com.fangxuele.tool.push.util.ConsoleUtil;
 import com.fangxuele.tool.push.util.FileCharSetUtil;
@@ -426,6 +432,13 @@ public static void addListeners() {
             });
         });
 
+        // 钉钉-导入全部
+        memberForm.getDingImportAllButton().addActionListener(e -> {
+            ThreadUtil.execute(() -> {
+                importDingAll();
+            });
+        });
+
         // 清除按钮事件
         memberForm.getClearImportButton().addActionListener(e -> {
             int isClear = JOptionPane.showConfirmDialog(memberPanel, "确认清除?", "确认",
@@ -1193,4 +1206,67 @@ public static void importWxCpAll() {
             progressBar.setVisible(false);
         }
     }
+
+    /**
+     * 导入钉钉通讯录全员
+     */
+    public static void importDingAll() {
+        JProgressBar progressBar = MemberForm.getInstance().getMemberTabImportProgressBar();
+        JLabel memberCountLabel = MemberForm.getInstance().getMemberTabCountLabel();
+        JPanel memberPanel = MemberForm.getInstance().getMemberPanel();
+
+        try {
+            if (DingMsgForm.getInstance().getAppNameComboBox().getSelectedItem() == null) {
+                JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "请先在编辑消息tab中选择应用!", "提示",
+                        JOptionPane.ERROR_MESSAGE);
+                MainWindow.getInstance().getTabbedPane().setSelectedIndex(2);
+                return;
+            }
+
+            progressBar.setVisible(true);
+            progressBar.setIndeterminate(true);
+            int importedCount = 0;
+            PushData.allUser = Collections.synchronizedList(new ArrayList<>());
+
+            // 最小部门id为1
+            // 获取用户
+            DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/simplelist");
+            OapiUserSimplelistRequest request = new OapiUserSimplelistRequest();
+            request.setDepartmentId(1L);
+            request.setOffset(0L);
+            request.setSize(100L);
+            request.setHttpMethod("GET");
+
+            OapiUserSimplelistResponse response = client.execute(request, DingMsgSender.getAccessTokenTimedCache().get("accessToken"));
+            if (response.getErrcode() != 0) {
+                if (response.getErrcode() == 60011) {
+                    JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + response.getErrmsg() + "\n\n进入开发者后台,在小程序或者微应用详情的「接口权限」模块,点击申请对应的通讯录接口读写权限", "失败",
+                            JOptionPane.ERROR_MESSAGE);
+                } else {
+                    JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + response.getErrmsg(), "失败", JOptionPane.ERROR_MESSAGE);
+                }
+
+                logger.error(response.getErrmsg());
+                return;
+            }
+            List userlist = response.getUserlist();
+            for (OapiUserSimplelistResponse.Userlist dingUser : userlist) {
+                String[] dataArray = new String[]{dingUser.getUserid(), dingUser.getName()};
+                PushData.allUser.add(dataArray);
+                importedCount++;
+                memberCountLabel.setText(String.valueOf(importedCount));
+            }
+            renderMemberListTable();
+            if (!PushData.fixRateScheduling) {
+                JOptionPane.showMessageDialog(memberPanel, "导入完成!", "完成", JOptionPane.INFORMATION_MESSAGE);
+            }
+        } catch (Exception ex) {
+            JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + ex, "失败",
+                    JOptionPane.ERROR_MESSAGE);
+            logger.error(ex.toString());
+        } finally {
+            progressBar.setIndeterminate(false);
+            progressBar.setVisible(false);
+        }
+    }
 }

From 98d1254648f67b59face4c63b6e06703ba5f610e Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Fri, 6 Sep 2019 20:02:54 +0800
Subject: [PATCH 27/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=AF=BC=E5=85=A5=E9=83=A8=E9=97=A8?=
 =?UTF-8?q?=E8=81=94=E7=B3=BB=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../tool/push/ui/listener/MemberListener.java | 41 +++++++++++--------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java
index d1c13886..1ed6be02 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
@@ -1237,25 +1237,32 @@ public static void importDingAll() {
             request.setSize(100L);
             request.setHttpMethod("GET");
 
-            OapiUserSimplelistResponse response = client.execute(request, DingMsgSender.getAccessTokenTimedCache().get("accessToken"));
-            if (response.getErrcode() != 0) {
-                if (response.getErrcode() == 60011) {
-                    JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + response.getErrmsg() + "\n\n进入开发者后台,在小程序或者微应用详情的「接口权限」模块,点击申请对应的通讯录接口读写权限", "失败",
-                            JOptionPane.ERROR_MESSAGE);
-                } else {
-                    JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + response.getErrmsg(), "失败", JOptionPane.ERROR_MESSAGE);
-                }
+            long offset = 0;
+            OapiUserSimplelistResponse response = new OapiUserSimplelistResponse();
+            while (response.getErrcode() == null || response.getUserlist().size() > 0) {
+                response = client.execute(request, DingMsgSender.getAccessTokenTimedCache().get("accessToken"));
+                if (response.getErrcode() != 0) {
+                    if (response.getErrcode() == 60011) {
+                        JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + response.getErrmsg() + "\n\n进入开发者后台,在小程序或者微应用详情的「接口权限」模块,点击申请对应的通讯录接口读写权限", "失败",
+                                JOptionPane.ERROR_MESSAGE);
+                    } else {
+                        JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + response.getErrmsg(), "失败", JOptionPane.ERROR_MESSAGE);
+                    }
 
-                logger.error(response.getErrmsg());
-                return;
-            }
-            List userlist = response.getUserlist();
-            for (OapiUserSimplelistResponse.Userlist dingUser : userlist) {
-                String[] dataArray = new String[]{dingUser.getUserid(), dingUser.getName()};
-                PushData.allUser.add(dataArray);
-                importedCount++;
-                memberCountLabel.setText(String.valueOf(importedCount));
+                    logger.error(response.getErrmsg());
+                    return;
+                }
+                List userlist = response.getUserlist();
+                for (OapiUserSimplelistResponse.Userlist dingUser : userlist) {
+                    String[] dataArray = new String[]{dingUser.getUserid(), dingUser.getName()};
+                    PushData.allUser.add(dataArray);
+                    importedCount++;
+                    memberCountLabel.setText(String.valueOf(importedCount));
+                }
+                offset += 100;
+                request.setOffset(offset);
             }
+
             renderMemberListTable();
             if (!PushData.fixRateScheduling) {
                 JOptionPane.showMessageDialog(memberPanel, "导入完成!", "完成", JOptionPane.INFORMATION_MESSAGE);

From c84259bef12c1e5ac5a582511e60694cf41444b9 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Fri, 6 Sep 2019 20:10:12 +0800
Subject: [PATCH 28/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=AF=BC=E5=85=A5=E9=83=A8=E9=97=A8?=
 =?UTF-8?q?=E8=81=94=E7=B3=BB=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../tool/push/ui/listener/MemberListener.java | 38 +++++++++++++++++++
 1 file changed, 38 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 1ed6be02..32ec0def 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
@@ -17,7 +17,9 @@
 import cn.hutool.poi.excel.ExcelUtil;
 import com.dingtalk.api.DefaultDingTalkClient;
 import com.dingtalk.api.DingTalkClient;
+import com.dingtalk.api.request.OapiDepartmentListRequest;
 import com.dingtalk.api.request.OapiUserSimplelistRequest;
+import com.dingtalk.api.response.OapiDepartmentListResponse;
 import com.dingtalk.api.response.OapiUserSimplelistResponse;
 import com.fangxuele.tool.push.App;
 import com.fangxuele.tool.push.dao.TWxMpUserMapper;
@@ -432,6 +434,42 @@ public static void addListeners() {
             });
         });
 
+        // 钉钉-按部门导入-刷新
+        memberForm.getDingDeptsRefreshButton().addActionListener(e -> {
+            ThreadUtil.execute(() -> {
+                if (DingMsgForm.getInstance().getAppNameComboBox().getSelectedItem() == null) {
+                    JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "请先在编辑消息tab中选择应用!", "提示",
+                            JOptionPane.ERROR_MESSAGE);
+                    MainWindow.getInstance().getTabbedPane().setSelectedIndex(2);
+                    return;
+                }
+                memberForm.getDingDeptsComboBox().removeAllItems();
+
+                try {
+                    // 获取部门列表
+                    DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/department/list");
+                    OapiDepartmentListRequest request = new OapiDepartmentListRequest();
+                    request.setHttpMethod("GET");
+                    OapiDepartmentListResponse response = client.execute(request, DingMsgSender.getAccessTokenTimedCache().get("accessToken"));
+                    if (response.getErrcode() != 0) {
+                        JOptionPane.showMessageDialog(memberPanel, "刷新失败!\n\n" + response.getErrmsg(), "失败",
+                                JOptionPane.ERROR_MESSAGE);
+                        return;
+                    }
+                    List departmentList = response.getDepartment();
+                    for (OapiDepartmentListResponse.Department department : departmentList) {
+                        memberForm.getDingDeptsComboBox().addItem(department.getName());
+                        wxCpDeptNameToIdMap.put(department.getName(), department.getId());
+                        wxCpIdToDeptNameMap.put(department.getId(), department.getName());
+                    }
+                } catch (Exception ex) {
+                    JOptionPane.showMessageDialog(memberPanel, "刷新失败!\n\n" + ex, "失败",
+                            JOptionPane.ERROR_MESSAGE);
+                    logger.error(ex.toString());
+                }
+            });
+        });
+
         // 钉钉-导入全部
         memberForm.getDingImportAllButton().addActionListener(e -> {
             ThreadUtil.execute(() -> {

From 6e9f0f72bb94faadfc3d128972f53d094d7b3759 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Fri, 6 Sep 2019 20:15:04 +0800
Subject: [PATCH 29/33] =?UTF-8?q?feature:=E9=92=89=E9=92=89=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=AF=BC=E5=85=A5=E9=83=A8=E9=97=A8?=
 =?UTF-8?q?=E8=81=94=E7=B3=BB=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../tool/push/ui/listener/MemberListener.java | 63 +++++++++++++++++++
 1 file changed, 63 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 32ec0def..577036a1 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
@@ -470,6 +470,69 @@ public static void addListeners() {
             });
         });
 
+        // 钉钉-按部门导入-导入
+        memberForm.getDingDeptsImportButton().addActionListener(e -> {
+            ThreadUtil.execute(() -> {
+                if (memberForm.getDingDeptsComboBox().getSelectedItem() == null) {
+                    return;
+                }
+                try {
+                    progressBar.setVisible(true);
+                    progressBar.setIndeterminate(true);
+                    int importedCount = 0;
+                    PushData.allUser = Collections.synchronizedList(new ArrayList<>());
+
+                    // 获取部门id
+                    Long deptId = wxCpDeptNameToIdMap.get(memberForm.getDingDeptsComboBox().getSelectedItem());
+                    // 获取用户
+                    DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/simplelist");
+                    OapiUserSimplelistRequest request = new OapiUserSimplelistRequest();
+                    request.setDepartmentId(deptId);
+                    request.setOffset(0L);
+                    request.setSize(100L);
+                    request.setHttpMethod("GET");
+
+                    long offset = 0;
+                    OapiUserSimplelistResponse response = new OapiUserSimplelistResponse();
+                    while (response.getErrcode() == null || response.getUserlist().size() > 0) {
+                        response = client.execute(request, DingMsgSender.getAccessTokenTimedCache().get("accessToken"));
+                        if (response.getErrcode() != 0) {
+                            if (response.getErrcode() == 60011) {
+                                JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + response.getErrmsg() + "\n\n进入开发者后台,在小程序或者微应用详情的「接口权限」模块,点击申请对应的通讯录接口读写权限", "失败",
+                                        JOptionPane.ERROR_MESSAGE);
+                            } else {
+                                JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + response.getErrmsg(), "失败", JOptionPane.ERROR_MESSAGE);
+                            }
+
+                            logger.error(response.getErrmsg());
+                            return;
+                        }
+                        List userlist = response.getUserlist();
+                        for (OapiUserSimplelistResponse.Userlist dingUser : userlist) {
+                            String[] dataArray = new String[]{dingUser.getUserid(), dingUser.getName()};
+                            PushData.allUser.add(dataArray);
+                            importedCount++;
+                            memberCountLabel.setText(String.valueOf(importedCount));
+                        }
+                        offset += 100;
+                        request.setOffset(offset);
+                    }
+                    renderMemberListTable();
+                    if (!PushData.fixRateScheduling) {
+                        JOptionPane.showMessageDialog(memberPanel, "导入完成!", "完成", JOptionPane.INFORMATION_MESSAGE);
+                    }
+                } catch (Exception ex) {
+                    JOptionPane.showMessageDialog(memberPanel, "导入失败!\n\n" + ex, "失败",
+                            JOptionPane.ERROR_MESSAGE);
+                    logger.error(ex.toString());
+                } finally {
+                    progressBar.setIndeterminate(false);
+                    progressBar.setVisible(false);
+                }
+
+            });
+        });
+
         // 钉钉-导入全部
         memberForm.getDingImportAllButton().addActionListener(e -> {
             ThreadUtil.execute(() -> {

From b02e6658e55b25c0f84866620735f54b40c2172a Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Sun, 8 Sep 2019 21:36:57 +0800
Subject: [PATCH 30/33] fix:preview fail tips words fix

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

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 72f938cd..7264b8a5 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
@@ -86,7 +86,7 @@ public static void addListeners() {
 
                 if (App.config.getMsgType() == MessageTypeEnum.WX_CP_CODE
                         && WxCpMsgForm.getInstance().getAppNameComboBox().getSelectedItem() == null) {
-                    JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "请选择应用!", "成功",
+                    JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "请选择应用!", "失败",
                             JOptionPane.ERROR_MESSAGE);
                     return;
                 }

From 3b14da5b7e41dbea09cae848893c3b0e00b42aea Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Sun, 8 Sep 2019 21:54:06 +0800
Subject: [PATCH 31/33] =?UTF-8?q?optimization:=E4=BC=98=E5=8C=96http?=
 =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=A4=B1=E8=B4=A5=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java
index 4006f43d..4ece64a0 100644
--- a/src/main/java/com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java
+++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/HttpMsgSender.java
@@ -123,7 +123,7 @@ public HttpSendResult sendUseHutool(String[] msgData) {
             }
         } catch (Exception e) {
             sendResult.setSuccess(false);
-            sendResult.setInfo(e.getMessage());
+            sendResult.setInfo(e.toString());
             log.error(e.toString());
             return sendResult;
         }

From cdf402679baa86bd354087f4d87f217d16b39b85 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Mon, 9 Sep 2019 14:41:59 +0800
Subject: [PATCH 32/33] release:v_3.8.0_190909

---
 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 6eb58afa..f7d773e5 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.7.0_190904";
+    public final static String APP_VERSION = "v_3.8.0_190909";
 
     /**
      * Logo-1024*1024
diff --git a/src/main/resources/version_summary.json b/src/main/resources/version_summary.json
index 13c5f389..66d7fac7 100644
--- a/src/main/resources/version_summary.json
+++ b/src/main/resources/version_summary.json
@@ -1,5 +1,5 @@
 {
-  "currentVersion": "v_3.7.0_190904",
+  "currentVersion": "v_3.8.0_190909",
   "versionIndex": {
     "v_1.1.0_170701": "0",
     "v_1.2.0_170831": "1",
@@ -34,7 +34,8 @@
     "v_3.6.1_190728": "30",
     "v_3.6.2_190811": "31",
     "v_3.6.3_190825": "32",
-    "v_3.7.0_190904": "33"
+    "v_3.7.0_190904": "33",
+    "v_3.8.0_190909": "34"
   },
   "versionDetailList": [
     {
@@ -206,6 +207,11 @@
       "version": "v_3.7.0_190904",
       "title": "严重bug修复",
       "log": "● bug fix:修复客服消息文本类型发送失败的问题\n● bug fix:修复微信公众号相关消息accessToken缓存机制问题\n● optimization:导入用户tab相关按钮防止重复点击\n● optimization:移除对阿里大于短信的支持\n"
+    },
+    {
+      "version": "v_3.8.0_190909",
+      "title": "新增支持钉钉消息",
+      "log": "● feature:新增支持钉钉消息类型(工作通知消息和群机器人消息)\n● bug fix:修复微信公众号相关消息使用外部accessToken缓存异常的问题\n● optimization:优化http请求失败提示更详细准确\n● bug fix:修复消息类型不存在时启动异常,预览消息失败时提示框标题等问题\n"
     }
   ]
 }
\ No newline at end of file

From f3183295a94108aedf59d9e140c30086410221f7 Mon Sep 17 00:00:00 2001
From: duoduo 
Date: Mon, 9 Sep 2019 15:23:10 +0800
Subject: [PATCH 33/33] update:download link

---
 download.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/download.md b/download.md
index c4292c87..5ae00e2a 100644
--- a/download.md
+++ b/download.md
@@ -3,6 +3,7 @@
 
Windows +[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) [WePush-v3.6.2_190811-x64-Setup.exe](http://download.zhoubochina.com/exe/WePush-v3.6.2_190811-x64-Setup.exe) @@ -108,6 +109,7 @@
Linux +[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) [v3.6.2_190811](http://download.zhoubochina.com/linux/WePush-3.6.2.zip)