From c2e013a4159b474e74d342d4a696f1961316397e Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Mon, 8 Dec 2025 17:30:47 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1563181443416070]通知配置管理优化 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1563181443416070 --- .../api/mailserver/MailServerTestApi.java | 23 +++++++++++++++--- .../tenant/api/wechat/TestWechatApi.java | 24 +++++++++---------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerTestApi.java b/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerTestApi.java index 5e24087d..967a7826 100644 --- a/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerTestApi.java +++ b/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerTestApi.java @@ -16,10 +16,12 @@ import com.alibaba.fastjson.JSONObject; import neatlogic.framework.auth.core.AuthAction; import neatlogic.framework.auth.label.NOTIFY_CONFIG_MODIFY; import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.dto.MailServerVo; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; import neatlogic.framework.util.EmailUtil; +import neatlogic.framework.util.RegexUtils; import org.springframework.stereotype.Service; import java.util.Collections; @@ -51,18 +53,33 @@ public class MailServerTestApi extends PrivateApiComponentBase { } @Input({ + @Param(name = "id", type = ApiParamType.STRING, desc = "common.id"), + @Param(name = "name", type = ApiParamType.REGEX, rule = RegexUtils.NAME, isRequired = true, maxLength = 50, desc = "common.name"), + @Param(name = "host", type = ApiParamType.STRING, isRequired = true, maxLength = 50, desc = "term.framework.smpthost"), + @Param(name = "port", type = ApiParamType.INTEGER, isRequired = true, desc = "term.framework.smptport"), + @Param(name = "userName", type = ApiParamType.STRING, maxLength = 50, desc = "common.username"), + @Param(name = "password", type = ApiParamType.STRING, maxLength = 50, desc = "common.password"), + @Param(name = "homeUrl", type = ApiParamType.STRING, desc = "common.homeurl"), + @Param(name = "fromAddress", type = ApiParamType.STRING, isRequired = true, maxLength = 50, desc = "common.mailaddress"), + @Param(name = "sslEnable", type = ApiParamType.ENUM, rule = "true,false", isRequired = true, maxLength = 50, desc = "term.framework.smptsslenable"), @Param(name = "emailAddress", type = ApiParamType.EMAIL, isRequired = true, desc = "common.mailaddress") }) @Output({}) @Description(desc = "nmtam.mailservertestapi.getname") @Override public Object myDoService(JSONObject jsonObj) throws Exception { - EmailUtil.sendHtmlEmail( +// EmailUtil.sendHtmlEmail( +// "Test mail", +// "Your configured mail server information is available!", +// Collections.singletonList(jsonObj.getString("emailAddress")), +// null +// ); + MailServerVo mailServerVo = jsonObj.toJavaObject(MailServerVo.class); + EmailUtil.sendEmailWithFile( "Test mail", "Your configured mail server information is available!", Collections.singletonList(jsonObj.getString("emailAddress")), - null - ); + null, null, mailServerVo); return null; } diff --git a/src/main/java/neatlogic/module/tenant/api/wechat/TestWechatApi.java b/src/main/java/neatlogic/module/tenant/api/wechat/TestWechatApi.java index 13b19cd5..2d45c29b 100644 --- a/src/main/java/neatlogic/module/tenant/api/wechat/TestWechatApi.java +++ b/src/main/java/neatlogic/module/tenant/api/wechat/TestWechatApi.java @@ -16,26 +16,20 @@ import com.alibaba.fastjson.JSONObject; import neatlogic.framework.auth.core.AuthAction; import neatlogic.framework.auth.label.NOTIFY_CONFIG_MODIFY; import neatlogic.framework.common.constvalue.ApiParamType; -import neatlogic.framework.dao.mapper.NotifyConfigMapper; import neatlogic.framework.dto.WechatVo; -import neatlogic.framework.exception.wechat.WechatAuthenticationInformationNotFoundException; -import neatlogic.framework.notify.core.NotifyHandlerType; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; import neatlogic.framework.util.WechatUtil; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; -import javax.annotation.Resource; - @Component @AuthAction(action = NOTIFY_CONFIG_MODIFY.class) @OperationType(type = OperationTypeEnum.SEARCH) public class TestWechatApi extends PrivateApiComponentBase { - @Resource - private NotifyConfigMapper notifyConfigMapper; +// @Resource +// private NotifyConfigMapper notifyConfigMapper; @Override public String getName() { @@ -43,17 +37,21 @@ public class TestWechatApi extends PrivateApiComponentBase { } @Input({ + @Param(name = "corpId", type = ApiParamType.STRING, isRequired = true, desc = "term.framework.corpid"), + @Param(name = "corpSecret", type = ApiParamType.STRING, isRequired = true, desc = "term.framework.corpsecret"), + @Param(name = "agentId", type = ApiParamType.STRING, isRequired = true, desc = "term.framework.agentid"), @Param(name = "toUser", type = ApiParamType.STRING, isRequired = true, desc = "nmtaw.testwechatapi.input.param.desc.touser") }) @Output({}) @Description(desc = "nmtaw.testwechatapi.getname") @Override public Object myDoService(JSONObject paramObj) throws Exception { - String config = notifyConfigMapper.getConfigByType(NotifyHandlerType.WECHAT.getValue()); - if (StringUtils.isBlank(config)) { - throw new WechatAuthenticationInformationNotFoundException(); - } - WechatVo wechatVo = JSONObject.parseObject(config, WechatVo.class); +// String config = notifyConfigMapper.getConfigByType(NotifyHandlerType.WECHAT.getValue()); +// if (StringUtils.isBlank(config)) { +// throw new WechatAuthenticationInformationNotFoundException(); +// } +// WechatVo wechatVo = JSONObject.parseObject(config, WechatVo.class); + WechatVo wechatVo = paramObj.toJavaObject(WechatVo.class); WechatUtil.AccessToken accessToken = WechatUtil.getAccessToken(wechatVo.getCorpId(), wechatVo.getCorpSecret()); String toUser = paramObj.getString("toUser"); JSONObject data = WechatUtil.getTextCardMsg( -- Gitee