From c9d830c91a750ea0bd916cd4e80fa6266ee7447b Mon Sep 17 00:00:00 2001
From: "1437892690@qq.com" <1437892690@qq.com>
Date: Mon, 14 Apr 2025 18:25:15 +0800
Subject: [PATCH 1/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=9A=E4=B8=AA=E9=82=AE=E4=BB=B6=E6=9C=8D?=
=?UTF-8?q?=E5=8A=A1=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
关联 #[1399118465826816]支持配置多个邮件服务器 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1399118465826816
---
.../api/mailserver/DeleteMailServerApi.java | 67 +++++++++++
.../api/mailserver/ListMailServerApi.java | 104 ++++++++++++++++++
.../api/mailserver/MailServerGetApi.java | 52 ++++++---
.../api/mailserver/MailServerSaveApi.java | 16 ++-
.../UpdateMailServerIsActiveApi.java | 69 ++++++++++++
.../UpdateMailServerIsDefaultApi.java | 84 ++++++++++++++
.../tenant/api/wechat/SaveWechatApi.java | 22 +++-
7 files changed, 396 insertions(+), 18 deletions(-)
create mode 100644 src/main/java/neatlogic/module/tenant/api/mailserver/DeleteMailServerApi.java
create mode 100644 src/main/java/neatlogic/module/tenant/api/mailserver/ListMailServerApi.java
create mode 100644 src/main/java/neatlogic/module/tenant/api/mailserver/UpdateMailServerIsActiveApi.java
create mode 100644 src/main/java/neatlogic/module/tenant/api/mailserver/UpdateMailServerIsDefaultApi.java
diff --git a/src/main/java/neatlogic/module/tenant/api/mailserver/DeleteMailServerApi.java b/src/main/java/neatlogic/module/tenant/api/mailserver/DeleteMailServerApi.java
new file mode 100644
index 00000000..67b55057
--- /dev/null
+++ b/src/main/java/neatlogic/module/tenant/api/mailserver/DeleteMailServerApi.java
@@ -0,0 +1,67 @@
+/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .*/
+
+package neatlogic.module.tenant.api.mailserver;
+
+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.restful.annotation.*;
+import neatlogic.framework.restful.constvalue.OperationTypeEnum;
+import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+@Service
+@AuthAction(action = NOTIFY_CONFIG_MODIFY.class)
+@OperationType(type = OperationTypeEnum.DELETE)
+@Transactional
+public class DeleteMailServerApi extends PrivateApiComponentBase {
+
+ @Resource
+ private NotifyConfigMapper notifyConfigMapper;
+
+ @Override
+ public String getToken() {
+ return "mailserver/delete";
+ }
+
+ @Override
+ public String getName() {
+ return "nmtam.deletemailserverapi.getname";
+ }
+
+ @Override
+ public String getConfig() {
+ return null;
+ }
+
+ @Input({
+ @Param(name = "id", type = ApiParamType.LONG, isRequired = true, desc = "common.id")
+ })
+ @Output({})
+ @Description(desc = "nmtam.deletemailserverapi.getname")
+ @Override
+ public Object myDoService(JSONObject jsonObj) throws Exception {
+ Long id = jsonObj.getLong("id");
+ notifyConfigMapper.deleteNotifyConfigById(id);
+ return null;
+ }
+
+}
diff --git a/src/main/java/neatlogic/module/tenant/api/mailserver/ListMailServerApi.java b/src/main/java/neatlogic/module/tenant/api/mailserver/ListMailServerApi.java
new file mode 100644
index 00000000..f28b1e40
--- /dev/null
+++ b/src/main/java/neatlogic/module/tenant/api/mailserver/ListMailServerApi.java
@@ -0,0 +1,104 @@
+/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .*/
+
+package neatlogic.module.tenant.api.mailserver;
+
+import com.alibaba.fastjson.JSONObject;
+import neatlogic.framework.auth.core.AuthAction;
+import neatlogic.framework.auth.label.NOTIFY_CONFIG_MODIFY;
+import neatlogic.framework.dao.mapper.NotifyConfigMapper;
+import neatlogic.framework.dto.MailServerVo;
+import neatlogic.framework.dto.NotifyConfigVo;
+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.TableResultUtil;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+@AuthAction(action = NOTIFY_CONFIG_MODIFY.class)
+@OperationType(type = OperationTypeEnum.SEARCH)
+public class ListMailServerApi extends PrivateApiComponentBase {
+
+ @Resource
+ private NotifyConfigMapper notifyConfigMapper;
+
+ @Override
+ public String getToken() {
+ return "mailserver/list";
+ }
+
+ @Override
+ public String getName() {
+ return "nmtam.listmailserverapi.getname";
+ }
+
+ @Override
+ public String getConfig() {
+ return null;
+ }
+
+ @Input({})
+ @Output({
+ @Param(name = "tbodyList", explode = MailServerVo[].class, desc = "common.tbodylist")
+ })
+ @Description(desc = "nmtam.listmailserverapi.getname")
+ @Override
+ public Object myDoService(JSONObject jsonObj) throws Exception {
+ List tbodyList = new ArrayList<>();
+ List notifyConfigList = notifyConfigMapper.getNotifyConfigListByType(NotifyHandlerType.EMAIL.getValue());
+ if (CollectionUtils.isNotEmpty(notifyConfigList)) {
+ for (NotifyConfigVo notifyConfigVo : notifyConfigList) {
+ Long id = notifyConfigVo.getId();
+ String name = notifyConfigVo.getName();
+ Integer isActive = notifyConfigVo.getIsActive();
+ Integer isDefault = notifyConfigVo.getIsDefault();
+ JSONObject config = notifyConfigVo.getConfig();
+ String fromAddress = config.getString("fromAddress");
+ String homeUrl = config.getString("homeUrl");
+ String host = config.getString("host");
+ if (StringUtils.isBlank(name)) {
+ name = config.getString("name");
+ }
+ String password = config.getString("password");
+ Integer port = config.getInteger("port");
+ String sslEnable = config.getString("sslEnable");
+ String userName = config.getString("userName");
+ MailServerVo mailServerVo = new MailServerVo();
+ mailServerVo.setFromAddress(fromAddress);
+ mailServerVo.setHomeUrl(homeUrl);
+ mailServerVo.setHost(host);
+ mailServerVo.setName(name);
+ mailServerVo.setPassword(password);
+ mailServerVo.setPort(port);
+ mailServerVo.setSslEnable(sslEnable);
+ mailServerVo.setUserName(userName);
+ mailServerVo.setId(id);
+ mailServerVo.setIsActive(isActive);
+ mailServerVo.setIsDefault(isDefault);
+ tbodyList.add(mailServerVo);
+ }
+ }
+ return TableResultUtil.getResult(tbodyList);
+ }
+
+}
diff --git a/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerGetApi.java b/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerGetApi.java
index e6d4f650..f30d237f 100644
--- a/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerGetApi.java
+++ b/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerGetApi.java
@@ -15,19 +15,17 @@ along with this program. If not, see .*/
package neatlogic.module.tenant.api.mailserver;
+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.notify.core.NotifyHandlerType;
-import neatlogic.framework.restful.constvalue.OperationTypeEnum;
+import neatlogic.framework.dto.MailServerVo;
+import neatlogic.framework.dto.NotifyConfigVo;
import neatlogic.framework.restful.annotation.*;
+import neatlogic.framework.restful.constvalue.OperationTypeEnum;
import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase;
-
import org.apache.commons.lang3.StringUtils;
-
-import com.alibaba.fastjson.JSONObject;
-
-import neatlogic.framework.dto.MailServerVo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -55,19 +53,47 @@ public class MailServerGetApi extends PrivateApiComponentBase {
return null;
}
- @Input({})
+ @Input({
+ @Param(name = "id", type = ApiParamType.LONG, isRequired = true, desc = "common.id")
+ })
@Output({
@Param(explode = MailServerVo.class)
})
@Description(desc = "nmtam.mailservergetapi.getname")
@Override
public Object myDoService(JSONObject jsonObj) throws Exception {
- String config = notifyConfigMapper.getConfigByType(NotifyHandlerType.EMAIL.getValue());
- if (StringUtils.isBlank(config)) {
- return null;
+ Long id = jsonObj.getLong("id");
+ NotifyConfigVo notifyConfigVo = notifyConfigMapper.getNotifyConfigById(id);
+ if (notifyConfigVo != null) {
+ String name = notifyConfigVo.getName();
+ Integer isActive = notifyConfigVo.getIsActive();
+ Integer isDefault = notifyConfigVo.getIsDefault();
+ JSONObject config = notifyConfigVo.getConfig();
+ String fromAddress = config.getString("fromAddress");
+ String homeUrl = config.getString("homeUrl");
+ String host = config.getString("host");
+ if (StringUtils.isBlank(name)) {
+ name = config.getString("name");
+ }
+ String password = config.getString("password");
+ Integer port = config.getInteger("port");
+ String sslEnable = config.getString("sslEnable");
+ String userName = config.getString("userName");
+ MailServerVo mailServerVo = new MailServerVo();
+ mailServerVo.setFromAddress(fromAddress);
+ mailServerVo.setHomeUrl(homeUrl);
+ mailServerVo.setHost(host);
+ mailServerVo.setName(name);
+ mailServerVo.setPassword(password);
+ mailServerVo.setPort(port);
+ mailServerVo.setSslEnable(sslEnable);
+ mailServerVo.setUserName(userName);
+ mailServerVo.setId(id);
+ mailServerVo.setIsActive(isActive);
+ mailServerVo.setIsDefault(isDefault);
+ return mailServerVo;
}
- MailServerVo mailServerVo = JSONObject.parseObject(config, MailServerVo.class);
- return mailServerVo;
+ return null;
}
}
diff --git a/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerSaveApi.java b/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerSaveApi.java
index c2ff01f6..35de4949 100644
--- a/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerSaveApi.java
+++ b/src/main/java/neatlogic/module/tenant/api/mailserver/MailServerSaveApi.java
@@ -22,6 +22,7 @@ import neatlogic.framework.auth.label.NOTIFY_CONFIG_MODIFY;
import neatlogic.framework.common.constvalue.ApiParamType;
import neatlogic.framework.dao.mapper.NotifyConfigMapper;
import neatlogic.framework.dto.MailServerVo;
+import neatlogic.framework.dto.NotifyConfigVo;
import neatlogic.framework.notify.core.NotifyHandlerType;
import neatlogic.framework.restful.annotation.*;
import neatlogic.framework.restful.constvalue.OperationTypeEnum;
@@ -57,22 +58,29 @@ public class MailServerSaveApi extends PrivateApiComponentBase {
}
@Input({
- @Param(name = "uuid", type = ApiParamType.STRING, desc = "common.uuid"),
+ @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 = "domain", type = ApiParamType.STRING, maxLength = 50, desc = "term.framework.domain"),
+ @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 = "sslEnable", type = ApiParamType.ENUM, rule = "true,false", isRequired = true, maxLength = 50, desc = "term.framework.smptsslenable"),
})
@Output({})
@Description(desc = "nmtam.mailserversaveapi.getname")
@Override
public Object myDoService(JSONObject jsonObj) throws Exception {
MailServerVo mailServerVo = jsonObj.toJavaObject(MailServerVo.class);
- notifyConfigMapper.insertNotifyConfig(NotifyHandlerType.EMAIL.getValue(), JSON.toJSONString(mailServerVo));
+ NotifyConfigVo notifyConfigVo = new NotifyConfigVo();
+ notifyConfigVo.setId(mailServerVo.getId());
+ notifyConfigVo.setName(mailServerVo.getName());
+ notifyConfigVo.setIsActive(0);
+ notifyConfigVo.setIsDefault(0);
+ notifyConfigVo.setType(NotifyHandlerType.EMAIL.getValue());
+ notifyConfigVo.setConfigStr(JSON.toJSONString(mailServerVo));
+ notifyConfigMapper.insertNotifyConfigVo(notifyConfigVo);
return null;
}
diff --git a/src/main/java/neatlogic/module/tenant/api/mailserver/UpdateMailServerIsActiveApi.java b/src/main/java/neatlogic/module/tenant/api/mailserver/UpdateMailServerIsActiveApi.java
new file mode 100644
index 00000000..e612fcb1
--- /dev/null
+++ b/src/main/java/neatlogic/module/tenant/api/mailserver/UpdateMailServerIsActiveApi.java
@@ -0,0 +1,69 @@
+/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .*/
+
+package neatlogic.module.tenant.api.mailserver;
+
+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.restful.annotation.*;
+import neatlogic.framework.restful.constvalue.OperationTypeEnum;
+import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+@Service
+@Transactional
+@AuthAction(action = NOTIFY_CONFIG_MODIFY.class)
+@OperationType(type = OperationTypeEnum.UPDATE)
+public class UpdateMailServerIsActiveApi extends PrivateApiComponentBase {
+
+ @Resource
+ private NotifyConfigMapper notifyConfigMapper;
+
+ @Override
+ public String getToken() {
+ return "mailserver/isactive/update";
+ }
+
+ @Override
+ public String getName() {
+ return "nmtam.updatemailserverisactiveapi.getname";
+ }
+
+ @Override
+ public String getConfig() {
+ return null;
+ }
+
+ @Input({
+ @Param(name = "id", type = ApiParamType.STRING, isRequired = true, desc = "common.id"),
+ @Param(name = "isActive", type = ApiParamType.ENUM, rule = "0,1", isRequired = true, desc = "common.isactive"),
+ })
+ @Output({})
+ @Description(desc = "nmtam.updatemailserverisactiveapi.getname")
+ @Override
+ public Object myDoService(JSONObject jsonObj) throws Exception {
+ Long id = jsonObj.getLong("id");
+ Integer isActive = jsonObj.getInteger("isActive");
+ notifyConfigMapper.updateNotifyConfigIsActive(id, isActive);
+ return null;
+ }
+
+}
diff --git a/src/main/java/neatlogic/module/tenant/api/mailserver/UpdateMailServerIsDefaultApi.java b/src/main/java/neatlogic/module/tenant/api/mailserver/UpdateMailServerIsDefaultApi.java
new file mode 100644
index 00000000..18252a1f
--- /dev/null
+++ b/src/main/java/neatlogic/module/tenant/api/mailserver/UpdateMailServerIsDefaultApi.java
@@ -0,0 +1,84 @@
+/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .*/
+
+package neatlogic.module.tenant.api.mailserver;
+
+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.NotifyConfigVo;
+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 org.apache.commons.collections4.CollectionUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Objects;
+
+@Service
+@Transactional
+@AuthAction(action = NOTIFY_CONFIG_MODIFY.class)
+@OperationType(type = OperationTypeEnum.UPDATE)
+public class UpdateMailServerIsDefaultApi extends PrivateApiComponentBase {
+
+ @Resource
+ private NotifyConfigMapper notifyConfigMapper;
+
+ @Override
+ public String getToken() {
+ return "mailserver/isdefault/update";
+ }
+
+ @Override
+ public String getName() {
+ return "nmtam.updatemailserverisdefaultapi.getname";
+ }
+
+ @Override
+ public String getConfig() {
+ return null;
+ }
+
+ @Input({
+ @Param(name = "id", type = ApiParamType.STRING, isRequired = true, desc = "common.id"),
+ @Param(name = "isDefault", type = ApiParamType.ENUM, rule = "0,1", isRequired = true, desc = "common.isdefault"),
+ })
+ @Output({})
+ @Description(desc = "nmtam.updatemailserverisdefaultapi.getname")
+ @Override
+ public Object myDoService(JSONObject jsonObj) throws Exception {
+ Long id = jsonObj.getLong("id");
+ Integer isDefault = jsonObj.getInteger("isDefault");
+ if (Objects.equals(isDefault, 1)) {
+ List notifyConfigList = notifyConfigMapper.getNotifyConfigListByType(NotifyHandlerType.EMAIL.getValue());
+ if (CollectionUtils.isNotEmpty(notifyConfigList)) {
+ for (NotifyConfigVo notifyConfigVo : notifyConfigList) {
+ if (Objects.equals(notifyConfigVo.getIsDefault(), 1) && !Objects.equals(notifyConfigVo.getId(), id)) {
+ notifyConfigMapper.updateNotifyConfigIsDefault(notifyConfigVo.getId(), 0);
+ }
+ }
+ }
+ }
+ notifyConfigMapper.updateNotifyConfigIsDefault(id, isDefault);
+ return null;
+ }
+
+}
diff --git a/src/main/java/neatlogic/module/tenant/api/wechat/SaveWechatApi.java b/src/main/java/neatlogic/module/tenant/api/wechat/SaveWechatApi.java
index 538767f3..0ffbacaa 100644
--- a/src/main/java/neatlogic/module/tenant/api/wechat/SaveWechatApi.java
+++ b/src/main/java/neatlogic/module/tenant/api/wechat/SaveWechatApi.java
@@ -15,20 +15,25 @@ along with this program. If not, see .*/
package neatlogic.module.tenant.api.wechat;
+import com.alibaba.fastjson.JSON;
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.NotifyConfigVo;
import neatlogic.framework.dto.WechatVo;
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.SnowflakeUtil;
+import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.util.List;
@Component
@Transactional
@@ -53,8 +58,23 @@ public class SaveWechatApi extends PrivateApiComponentBase {
@Description(desc = "nmtaw.savewechatapi.getname")
@Override
public Object myDoService(JSONObject paramObj) throws Exception {
+ Long id = null;
+ List notifyConfigList = notifyConfigMapper.getNotifyConfigListByType(NotifyHandlerType.WECHAT.getValue());
+ if (CollectionUtils.isNotEmpty(notifyConfigList)) {
+ id = notifyConfigList.get(0).getId();
+ } else {
+ id = SnowflakeUtil.uniqueLong();
+ }
WechatVo wechatVo = paramObj.toJavaObject(WechatVo.class);
- notifyConfigMapper.insertNotifyConfig(NotifyHandlerType.WECHAT.getValue(), JSONObject.toJSONString(wechatVo));
+ NotifyConfigVo notifyConfigVo = new NotifyConfigVo();
+ notifyConfigVo.setId(id);
+// notifyConfigVo.setName();
+ notifyConfigVo.setIsActive(1);
+ notifyConfigVo.setIsDefault(1);
+ notifyConfigVo.setType(NotifyHandlerType.WECHAT.getValue());
+ notifyConfigVo.setConfigStr(JSON.toJSONString(wechatVo));
+ notifyConfigMapper.insertNotifyConfigVo(notifyConfigVo);
+// notifyConfigMapper.insertNotifyConfig(NotifyHandlerType.WECHAT.getValue(), JSONObject.toJSONString(wechatVo));
return null;
}
--
Gitee
From 53dc096a44e60adca9df2e069d4ee5b83bc83c20 Mon Sep 17 00:00:00 2001
From: "1437892690@qq.com" <1437892690@qq.com>
Date: Mon, 14 Apr 2025 18:26:49 +0800
Subject: [PATCH 2/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E6=94=AF=E6=8C=81?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A4=9A=E4=B8=AA=E9=82=AE=E4=BB=B6=E6=9C=8D?=
=?UTF-8?q?=E5=8A=A1=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
关联 #[1399118465826816]支持配置多个邮件服务器 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1399118465826816
---
.../java/neatlogic/module/tenant/api/wechat/SaveWechatApi.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/main/java/neatlogic/module/tenant/api/wechat/SaveWechatApi.java b/src/main/java/neatlogic/module/tenant/api/wechat/SaveWechatApi.java
index 0ffbacaa..2a51a0e8 100644
--- a/src/main/java/neatlogic/module/tenant/api/wechat/SaveWechatApi.java
+++ b/src/main/java/neatlogic/module/tenant/api/wechat/SaveWechatApi.java
@@ -68,13 +68,11 @@ public class SaveWechatApi extends PrivateApiComponentBase {
WechatVo wechatVo = paramObj.toJavaObject(WechatVo.class);
NotifyConfigVo notifyConfigVo = new NotifyConfigVo();
notifyConfigVo.setId(id);
-// notifyConfigVo.setName();
notifyConfigVo.setIsActive(1);
notifyConfigVo.setIsDefault(1);
notifyConfigVo.setType(NotifyHandlerType.WECHAT.getValue());
notifyConfigVo.setConfigStr(JSON.toJSONString(wechatVo));
notifyConfigMapper.insertNotifyConfigVo(notifyConfigVo);
-// notifyConfigMapper.insertNotifyConfig(NotifyHandlerType.WECHAT.getValue(), JSONObject.toJSONString(wechatVo));
return null;
}
--
Gitee