diff --git a/.gitignore b/.gitignore index 82e5c637..317307aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ # Project exclude paths /target/ /.idea/ +/logs/ 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) 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/TDingAppMapper.java b/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java new file mode 100644 index 00000000..d0f4473c --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/dao/TDingAppMapper.java @@ -0,0 +1,25 @@ +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(); + + TDingApp selectByAgentId(String agentId); +} \ No newline at end of file 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..722e0719 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/dao/TMsgDingMapper.java @@ -0,0 +1,26 @@ +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); + + int insert(TMsgDing record); + + int insertSelective(TMsgDing record); + + TMsgDing selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(TMsgDing record); + + int updateByPrimaryKey(TMsgDing record); + + 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/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/domain/TMsgDing.java b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java new file mode 100644 index 00000000..7944ec82 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/domain/TMsgDing.java @@ -0,0 +1,107 @@ +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 String radioType; + + 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(); + } + + 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/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/logic/msgmaker/DingMsgMaker.java b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java new file mode 100644 index 00000000..58812f2d --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/logic/msgmaker/DingMsgMaker.java @@ -0,0 +1,100 @@ +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 { + + public 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; + + public static String radioType; + + public static String webHook; + + /** + * 准备(界面字段等) + */ + @Override + 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(); + 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(); + if (DingMsgForm.getInstance().getWorkRadioButton().isSelected()) { + radioType = "work"; + } else { + radioType = "robot"; + } + webHook = DingMsgForm.getInstance().getWebHookTextField().getText(); + } + + /** + * 组织消息-企业号 + * + * @param msgData 消息数据 + * @return WxMpTemplateMessage + */ + @Override + public DingMsg makeMsg(String[] msgData) { + + DingMsg dingMsg = new DingMsg(); + VelocityContext velocityContext = getVelocityContext(msgData); + 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)); + 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..493e02d6 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/logic/msgsender/DingMsgSender.java @@ -0,0 +1,244 @@ +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.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; +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; +import org.apache.commons.compress.utils.Lists; +import org.apache.commons.lang3.StringUtils; + +import java.util.List; + +/** + *
+ * 钉钉消息发送器
+ * 
+ * + * @author RememBerBer + * @since 2019/9/5. + */ +@Slf4j +public class DingMsgSender implements IMsgSender { + public volatile static DefaultDingTalkClient defaultDingTalkClient; + public volatile static DefaultDingTalkClient robotClient; + public static TimedCache accessTokenTimedCache; + private DingMsgMaker dingMsgMaker; + + private static TDingAppMapper dingAppMapper = MybatisUtil.getSqlSession().getMapper(TDingAppMapper.class); + + public DingMsgSender() { + dingMsgMaker = new DingMsgMaker(); + defaultDingTalkClient = getDefaultDingTalkClient(); + } + + @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 { + 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); + OapiMessageCorpconversationAsyncsendV2Request.Msg msg = getMsg(dingMsg); + request2.setMsg(msg); + + if (PushControl.dryRun) { + sendResult.setSuccess(true); + return sendResult; + } else { + OapiMessageCorpconversationAsyncsendV2Response response2 = defaultDingTalkClient.execute(request2, getAccessTokenTimedCache().get("accessToken")); + 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; + } + + 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(); + 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"); + 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)) { + 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; + } + + public static DefaultDingTalkClient getDefaultDingTalkClient() { + if (defaultDingTalkClient == null) { + synchronized (PushControl.class) { + if (defaultDingTalkClient == null) { + defaultDingTalkClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"); + } + } + } + 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) { + if (accessTokenTimedCache == null || StringUtils.isEmpty(accessTokenTimedCache.get("accessToken"))) { + DefaultDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken"); + OapiGettokenRequest request = new OapiGettokenRequest(); + 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"); + 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()); + } + } + } + return accessTokenTimedCache; + } +} 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; } 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/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/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..56186a88 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.form @@ -0,0 +1,156 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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..a3a1d1ce --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/dialog/DingAppDialog.java @@ -0,0 +1,276 @@ +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(); + appsTable.setRowHeight(36); + 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/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/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/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/MessageTypeForm.form b/src/main/java/com/fangxuele/tool/push/ui/form/MessageTypeForm.form index 66edfeed..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 @@ - + @@ -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 @@ - + @@ -141,22 +141,13 @@ - + - - - - - - - - - @@ -168,7 +159,7 @@ - + @@ -186,7 +177,7 @@ - + @@ -207,6 +198,24 @@ + + + + + + + + + + + + + + + + + + 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..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 @@ -38,11 +38,12 @@ 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; private JRadioButton 七牛云短信RadioButton; + private JRadioButton 百度云短信RadioButton; private static MessageTypeForm messageTypeForm; @@ -105,6 +106,9 @@ public static void init() { case MessageTypeEnum.HTTP_CODE: messageTypeForm.getHttpRadioButton().setSelected(true); break; + case MessageTypeEnum.DING_CODE: + messageTypeForm.getDingRadioButton().setSelected(true); + break; default: } @@ -145,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, "③准备消息变量"); @@ -192,7 +199,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(); @@ -211,45 +218,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(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(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(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(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(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(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(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(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(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(""); @@ -257,7 +260,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 +268,21 @@ 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)); + 百度云短信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)); 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 new file mode 100644 index 00000000..3d8d4368 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.form @@ -0,0 +1,223 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..039baad6 --- /dev/null +++ b/src/main/java/com/fangxuele/tool/push/ui/form/msg/DingMsgForm.java @@ -0,0 +1,455 @@ +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; +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; +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.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +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 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 JTextField btnURLTextField; + private JLabel btnURLLabel; + private JRadioButton workRadioButton; + private JRadioButton robotRadioButton; + private JTextField webHookTextField; + private JLabel webHookHelpLabel; + + private static DingMsgForm dingMsgForm; + + private static TMsgDingMapper msgDingMapper = MybatisUtil.getSqlSession().getMapper(TMsgDingMapper.class); + private static TDingAppMapper dingAppMapper = MybatisUtil.getSqlSession().getMapper(TDingAppMapper.class); + + public static Map appNameToAgentIdMap = Maps.newHashMap(); + public static Map agentIdToAppNameMap = Maps.newHashMap(); + + public DingMsgForm() { + // 消息类型切换事件 + msgTypeComboBox.addItemListener(e -> { + if (e.getStateChange() == ItemEvent.SELECTED) { + switchDingMsgType(e.getItem().toString()); + } + }); + appManageButton.addActionListener(e -> { + DingAppDialog dialog = new DingAppDialog(); + dialog.renderTable(); + dialog.pack(); + 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 + public void init(String msgName) { + clearAllField(); + initAppNameList(); + 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); + 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()); + getInstance().getWebHookTextField().setText(tMsgDing.getWebHook()); + + switchDingMsgType(dingMsgType); + + switchRadio(tMsgDing.getRadioType()); + } else { + switchDingMsgType("文本消息"); + } + } + + @Override + public void save(String msgName) { + boolean existSameMsg = false; + + if (getInstance().getAppNameComboBox().getSelectedItem() == null) { + JOptionPane.showMessageDialog(MainWindow.getInstance().getMessagePanel(), "请选择应用!", "成功", + JOptionPane.ERROR_MESSAGE); + return; + } + + List tMsgDingList = msgDingMapper.selectByMsgTypeAndMsgName(MessageTypeEnum.DING_CODE, msgName); + if (tMsgDingList.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 dingMsgType = Objects.requireNonNull(getInstance().getMsgTypeComboBox().getSelectedItem()).toString(); + String content = getInstance().getContentTextArea().getText(); + String title = getInstance().getTitleTextField().getText(); + String picUrl = getInstance().getPicUrlTextField().getText(); + String url = getInstance().getUrlTextField().getText(); + String btnTxt = getInstance().getBtnTxtTextField().getText(); + String btnUrl = getInstance().getBtnURLTextField().getText(); + String webHook = getInstance().getWebHookTextField().getText(); + + String now = SqliteUtil.nowDateForSqlite(); + + TMsgDing tMsgDing = new TMsgDing(); + tMsgDing.setMsgType(MessageTypeEnum.DING_CODE); + tMsgDing.setMsgName(msgName); + tMsgDing.setAgentId(appNameToAgentIdMap.get(getInstance().getAppNameComboBox().getSelectedItem())); + tMsgDing.setDingMsgType(dingMsgType); + 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 (getInstance().getWorkRadioButton().isSelected()) { + tMsgDing.setRadioType("work"); + } else { + tMsgDing.setRadioType("robot"); + } + tMsgDing.setWebHook(webHook); + + if (existSameMsg) { + msgDingMapper.updateByMsgTypeAndMsgName(tMsgDing); + } else { + tMsgDing.setCreateTime(now); + msgDingMapper.insertSelective(tMsgDing); + } + + 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 tDingAppList = dingAppMapper.selectAll(); + getInstance().getAppNameComboBox().removeAllItems(); + for (TDingApp tDingApp : tDingAppList) { + appNameToAgentIdMap.put(tDingApp.getAppName(), tDingApp.getAgentId()); + agentIdToAppNameMap.put(tDingApp.getAgentId(), tDingApp.getAppName()); + getInstance().getAppNameComboBox().addItem(tDingApp.getAppName()); + } + } + + /** + * 根据消息类型转换界面显示 + * + * @param msgType 消息类型 + */ + public static void switchDingMsgType(String msgType) { + switch (msgType) { + case "文本消息": + getInstance().getContentTextArea().setVisible(true); + 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); + getInstance().getBtnURLLabel().setVisible(false); + getInstance().getBtnURLTextField().setVisible(false); + break; + case "markdown消息": + getInstance().getContentLabel().setVisible(true); + getInstance().getContentTextArea().setVisible(true); + 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(true); + getInstance().getContentTextArea().setVisible(true); + getInstance().getBtnTxtLabel().setVisible(false); + getInstance().getBtnTxtTextField().setVisible(false); + getInstance().getPicUrlLabel().setVisible(true); + getInstance().getPicUrlTextField().setVisible(true); + getInstance().getUrlLabel().setVisible(true); + getInstance().getUrlTextField().setVisible(true); + getInstance().getTitleLabel().setVisible(true); + getInstance().getTitleTextField().setVisible(true); + getInstance().getBtnURLLabel().setVisible(false); + getInstance().getBtnURLTextField().setVisible(false); + break; + 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().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; + } + } + + 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); + } + } + + /** + * 清空所有界面字段 + */ + public static void clearAllField() { + getInstance().getContentTextArea().setText(""); + getInstance().getTitleTextField().setText(""); + getInstance().getPicUrlTextField().setText(""); + getInstance().getUrlTextField().setText(""); + getInstance().getBtnTxtTextField().setText(""); + getInstance().getBtnURLTextField().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(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(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(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("文本消息"); + defaultComboBoxModel1.addElement("链接消息"); + defaultComboBoxModel1.addElement("markdown消息"); + defaultComboBoxModel1.addElement("卡片消息"); + msgTypeComboBox.setModel(defaultComboBoxModel1); + 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(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(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(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(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, 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(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(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(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(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, 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(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(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(); + 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); + urlLabel.setLabelFor(urlTextField); + btnURLLabel.setLabelFor(btnURLTextField); + } + + /** + * @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/MemberListener.java b/src/main/java/com/fangxuele/tool/push/ui/listener/MemberListener.java index 6d62058a..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 @@ -15,17 +15,25 @@ 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.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; 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 +434,112 @@ 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.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(() -> { + importDingAll(); + }); + }); + // 清除按钮事件 memberForm.getClearImportButton().addActionListener(e -> { int isClear = JOptionPane.showConfirmDialog(memberPanel, "确认清除?", "确认", @@ -1193,4 +1307,74 @@ 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"); + + 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); + } + } } 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 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..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 @@ -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) { @@ -81,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; } @@ -150,6 +155,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"; 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..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,11 +15,13 @@ 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; 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 +258,15 @@ public static void addListeners() { WxCpMsgForm.initAppNameList(); }); + // 设置-钉钉-应用管理 + settingForm.getDingAppManageButton().addActionListener(e -> { + DingAppDialog dialog = new DingAppDialog(); + dialog.renderTable(); + dialog.pack(); + dialog.setVisible(true); + DingMsgForm.initAppNameList(); + }); + // 设置-阿里云短信-保存 settingForm.getSettingAliyunSaveButton().addActionListener(e -> { try { diff --git a/src/main/resources/db_init.sql b/src/main/resources/db_init.sql index d3f60f3a..26d884c1 100644 --- a/src/main/resources/db_init.sql +++ b/src/main/resources/db_init.sql @@ -222,3 +222,35 @@ 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, + radio_type 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); + +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 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/TDingAppMapper.xml b/src/main/resources/mapper/TDingAppMapper.xml new file mode 100644 index 00000000..8a90018f --- /dev/null +++ b/src/main/resources/mapper/TDingAppMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + 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/mapper/TMsgDingMapper.xml b/src/main/resources/mapper/TMsgDingMapper.xml new file mode 100644 index 00000000..c30ddf39 --- /dev/null +++ b/src/main/resources/mapper/TMsgDingMapper.xml @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + id, msg_type, msg_name, ding_msg_type, agent_id, web_hook, content, create_time, + modified_time, radio_type + + + + 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, + radio_type) + 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}, + #{radioType,jdbcType=VARCHAR}) + + + insert into t_msg_ding + + + id, + + + msg_type, + + + msg_name, + + + ding_msg_type, + + + agent_id, + + + web_hook, + + + content, + + + create_time, + + + modified_time, + + + radio_type, + + + + + #{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}, + + + #{radioType,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}, + + + radio_type = #{radioType,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}, + radio_type = #{radioType,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}, + radio_type = #{radioType,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 diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml index b795ed9c..d900a686 100644 --- a/src/main/resources/mybatis-config.xml +++ b/src/main/resources/mybatis-config.xml @@ -27,5 +27,7 @@ + + \ No newline at end of file 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