邮箱黑名单
parent
1aac6f6cc4
commit
e23fc2161e
|
@ -113,9 +113,12 @@
|
|||
|
||||
```properties
|
||||
serverName=ecology
|
||||
rootPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/src/main/resources/ # 修改为实际的地址
|
||||
systemFilePath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/file # 修改为实际的地址,这里可以是你实际ecology的文件地址,即.../ecolog/web-inf/systemfile 绝对路径
|
||||
logPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/log # 修改为实际的地址
|
||||
# 修改为实际的地址
|
||||
rootPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/src/main/resources/
|
||||
# 修改为实际的地址,这里可以是你实际ecology的文件地址,即.../ecolog/web-inf/systemfile 绝对路径
|
||||
systemFilePath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/file
|
||||
# 修改为实际的地址
|
||||
logPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/log
|
||||
```
|
||||
|
||||
### 测试
|
||||
|
|
|
@ -26,4 +26,8 @@ public class RequestLogAuthority {
|
|||
/** 权限组成员 */
|
||||
@SqlOracleDbFieldAnn("AUTHORITY_MEMBER")
|
||||
private String authorityMember;
|
||||
|
||||
/** */
|
||||
@SqlOracleDbFieldAnn("DEFAULT_VALUE")
|
||||
private String defaultValue;
|
||||
}
|
||||
|
|
|
@ -30,13 +30,22 @@ public class RequestLogAuthorityService {
|
|||
result.put("show", false);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(requestId) || "-1".equals(requestId)) {
|
||||
if ("1".equals(requestLogAuthority.getDefaultValue())) {
|
||||
result.put("enable", true);
|
||||
} else {
|
||||
result.put("enable", false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Integer id = mapper.selectRequestLogId(requestId, nodeId, String.valueOf(user.getUID()));
|
||||
if (id <= 0) {
|
||||
if ("1".equals(requestLogAuthority.getDefaultValue())) {
|
||||
result.put("enable", true);
|
||||
} else {
|
||||
result.put("enable", false);
|
||||
}
|
||||
} else {
|
||||
result.put("enable", true);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.engine.workflow.cmd.requestForm.remind.GetEmailRemindUrlCmd;
|
|||
import com.engine.workflow.constant.RemindTypeEnum;
|
||||
import com.engine.workflow.util.GetCustomLevelUtil;
|
||||
import com.engine.workflow.util.WfToDocUtil;
|
||||
import com.engine.youhong.ai.taibao.email.BlackListExpansion;
|
||||
import com.engine.youhong.ai.taibao.email.BlackListRegister;
|
||||
import com.google.common.base.Strings;
|
||||
import weaver.conn.RecordSet;
|
||||
|
@ -1747,11 +1746,9 @@ public class RequestRemindBiz {
|
|||
}
|
||||
}
|
||||
/* ******************* youhong.ai 添加发送邮箱的黑名单拓展start ******************* */
|
||||
for (BlackListExpansion blackListExpansion : BlackListRegister.getExpansionList()) {
|
||||
Set<String> mailAddress1 = blackListExpansion.sendEmailHandler(mailAddress);
|
||||
if (Objects.nonNull(mailAddress1)) {
|
||||
mailAddress = mailAddress1;
|
||||
}
|
||||
Set<String> expansionList = BlackListRegister.getExpansionList(mailAddress);
|
||||
if (Objects.nonNull(expansionList)) {
|
||||
mailAddress = expansionList;
|
||||
}
|
||||
/* ******************* youhong.ai 添加发送邮箱的黑名单拓展 end ******************* */
|
||||
if (mailAddress.isEmpty()) return;
|
||||
|
@ -1784,11 +1781,9 @@ public class RequestRemindBiz {
|
|||
}
|
||||
}
|
||||
/* ******************* youhong.ai 添加发送邮箱的黑名单拓展start ******************* */
|
||||
for (BlackListExpansion blackListExpansion : BlackListRegister.getExpansionApproveList()) {
|
||||
Set<String> mailAddress1 = blackListExpansion.sendEmailHandler(mailAddress);
|
||||
if (Objects.nonNull(mailAddress1)) {
|
||||
mailAddress = mailAddress1;
|
||||
}
|
||||
Set<String> expansionList = BlackListRegister.getExpansionApproveList(mailAddress);
|
||||
if (Objects.nonNull(expansionList)) {
|
||||
mailAddress = expansionList;
|
||||
}
|
||||
/* ******************* youhong.ai 添加发送邮箱的黑名单拓展 end ******************* */
|
||||
EmailApprovalRunnable.threadModeReminder(String.join(",", mailAddress), title, content, String.valueOf(requestId), allAttchment);
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package com.engine.youhong.ai.taibao.email;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <h1>黑名单扩展接口</h1>
|
||||
*
|
||||
* <p>create: 2023/4/14 17:07</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
public interface BlackListExpansion {
|
||||
|
||||
/**
|
||||
* <h2>发送邮件</h2>
|
||||
*
|
||||
* @param mailAddress 邮箱地址
|
||||
* @return 邮箱地址
|
||||
*/
|
||||
Set<String> sendEmailHandler(Set<String> mailAddress);
|
||||
}
|
|
@ -1,8 +1,14 @@
|
|||
package com.engine.youhong.ai.taibao.email;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||
import com.engine.youhong.ai.taibao.email.mapper.InitBlackEmailListMapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <h1>注册信息</h1>
|
||||
|
@ -13,26 +19,42 @@ import java.util.Objects;
|
|||
*/
|
||||
public class BlackListRegister {
|
||||
|
||||
private static final List<BlackListExpansion> EXPANSION_LIST = new ArrayList<>();
|
||||
private static final List<BlackListExpansion> EXPANSION_APPROVE_LIST = new ArrayList<>();
|
||||
|
||||
public static void registerExpansion(BlackListExpansion blackListExpansion) {
|
||||
if (Objects.nonNull(blackListExpansion)) {
|
||||
EXPANSION_LIST.add(blackListExpansion);
|
||||
private static final InitBlackEmailListMapper mapper = Util.getMapper(InitBlackEmailListMapper.class);
|
||||
|
||||
|
||||
public static Set<String> getExpansionList(Set<String> set) {
|
||||
if (Objects.isNull(set)) {
|
||||
return null;
|
||||
}
|
||||
List<String> hrmList = mapper.selectWorkflowBlackEmailList();
|
||||
if (CollectionUtil.isEmpty(hrmList)) {
|
||||
return null;
|
||||
}
|
||||
String ids = Util.join(hrmList, ",");
|
||||
List<String> blackEmailList = mapper.selectEmailListByHrmIds(ids);
|
||||
if (CollectionUtil.isEmpty(blackEmailList)) {
|
||||
return set;
|
||||
}
|
||||
return set.stream()
|
||||
.filter(item -> !blackEmailList.contains(item))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public static void registerAPPROVEExpansion(BlackListExpansion blackListExpansion) {
|
||||
if (Objects.nonNull(blackListExpansion)) {
|
||||
EXPANSION_APPROVE_LIST.add(blackListExpansion);
|
||||
public static Set<String> getExpansionApproveList(Set<String> set) {
|
||||
if (Objects.isNull(set)) {
|
||||
return null;
|
||||
}
|
||||
String ids = mapper.selectWorkflowApproveBlackEmailList();
|
||||
if (StrUtil.isBlank(ids)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<BlackListExpansion> getExpansionList() {
|
||||
return EXPANSION_LIST;
|
||||
List<String> blackEmailList = mapper.selectEmailListByHrmIds(ids);
|
||||
if (CollectionUtil.isEmpty(blackEmailList)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<BlackListExpansion> getExpansionApproveList() {
|
||||
return EXPANSION_APPROVE_LIST;
|
||||
return set.stream()
|
||||
.filter(item -> !blackEmailList.contains(item))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
package com.engine.youhong.ai.taibao.email.impl;
|
||||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||
import com.engine.youhong.ai.taibao.email.BlackListRegister;
|
||||
import com.engine.youhong.ai.taibao.email.mapper.InitBlackEmailListMapper;
|
||||
import com.weaverboot.frame.ioc.anno.classAnno.WeaSysInitComponent;
|
||||
import com.weaverboot.frame.ioc.anno.methodAnno.WeaSysInit;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <h1>初始化扩展信息</h1>
|
||||
*
|
||||
* <p>create: 2023/4/14 17:15</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
|
||||
@WeaSysInitComponent("注册email黑名单拦截器")
|
||||
public class InitBlackListServiceImpl {
|
||||
|
||||
private final InitBlackEmailListMapper mapper = Util.getMapper(InitBlackEmailListMapper.class);
|
||||
|
||||
@WeaSysInit(order = 1, description = "注册拦截邮箱黑名单")
|
||||
public void init() {
|
||||
Util.getLogger().info("注册拦截邮箱黑名单,init");
|
||||
BlackListRegister.registerExpansion(set -> {
|
||||
if (Objects.isNull(set)) {
|
||||
return null;
|
||||
}
|
||||
List<String> hrmList = mapper.selectWorkflowBlackEmailList();
|
||||
String ids = Util.join(hrmList, ",");
|
||||
List<String> blackEmailList = mapper.selectEmailListByHrmIds(ids);
|
||||
if (CollectionUtil.isEmpty(blackEmailList)) {
|
||||
return set;
|
||||
}
|
||||
return set.stream()
|
||||
.filter(item -> !blackEmailList.contains(item))
|
||||
.collect(Collectors.toSet());
|
||||
});
|
||||
}
|
||||
|
||||
@WeaSysInit(order = 2, description = "注册拦截邮箱黑名单")
|
||||
public void initApprove() {
|
||||
Util.getLogger().info("注册拦截邮箱黑名单,initApprove");
|
||||
BlackListRegister.registerAPPROVEExpansion(set -> {
|
||||
if (Objects.isNull(set)) {
|
||||
return null;
|
||||
}
|
||||
String ids = mapper.selectWorkflowApproveBlackEmailList();
|
||||
List<String> blackEmailList = mapper.selectEmailListByHrmIds(ids);
|
||||
if (CollectionUtil.isEmpty(blackEmailList)) {
|
||||
return set;
|
||||
}
|
||||
return set.stream()
|
||||
.filter(item -> !blackEmailList.contains(item))
|
||||
.collect(Collectors.toSet());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ import aiyh.utils.action.SafeCusBaseAction;
|
|||
import aiyh.utils.annotation.*;
|
||||
import aiyh.utils.excention.CustomerException;
|
||||
import aiyh.utils.tool.cn.hutool.core.lang.Assert;
|
||||
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||
import lombok.Setter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import weaver.general.GCONST;
|
||||
|
@ -101,7 +102,7 @@ public class VoucherPayableNewAction extends SafeCusBaseAction {
|
|||
private String deleteTemp = "false";
|
||||
|
||||
@PrintParamMark
|
||||
@RequiredMark("过滤字段字段名称,接口参数配置中的接口参数名,也就是序号")
|
||||
@ActionOptionalParam(value = "", desc = "过滤字段字段名称,接口参数配置中的接口参数名,也就是序号")
|
||||
@ActionDefaultTestValue("100")
|
||||
private String filterField;
|
||||
|
||||
|
@ -214,6 +215,7 @@ public class VoucherPayableNewAction extends SafeCusBaseAction {
|
|||
keys = sortKey(keys);
|
||||
for (Object o : list) {
|
||||
Map<String, Object> map = (Map<String, Object>) o;
|
||||
if (!StrUtil.isBlank(filterField)) {
|
||||
if (map.containsKey(filterField)) {
|
||||
try {
|
||||
String value = Util.null2String(map.get(filterField));
|
||||
|
@ -223,6 +225,7 @@ public class VoucherPayableNewAction extends SafeCusBaseAction {
|
|||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String key : keys) {
|
||||
if (map.containsKey(key)) {
|
||||
sb.append(map.get(key))
|
||||
|
|
|
@ -96,7 +96,7 @@ public interface SapConfigMapper {
|
|||
* @author youHong.ai ******************************************
|
||||
*/
|
||||
@Select("select * from $t{billTable} where requestid = #{requestId}")
|
||||
Map<String, String> selectWorkflowDataByRequestId(@ParamMapper("requestId") String requestId,
|
||||
Map<String, Object> selectWorkflowDataByRequestId(@ParamMapper("requestId") String requestId,
|
||||
@ParamMapper("billTable") String billTable);
|
||||
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class SapConfigService {
|
|||
}
|
||||
|
||||
private SapVoucher parseByPaymentDetailTable(String requestId, String billTable, SapConfigMain sapConfigMain) {
|
||||
Map<String, String> workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable);
|
||||
Map<String, Object> workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable);
|
||||
Assert.notNull(workflowMainData, "payment: query workflow data fail, query request id is {}", requestId);
|
||||
List<Map<String, Object>> workflowDetailData = mapper.selectWorkflowDataByMainId(Util.null2String(workflowMainData.get("id")),
|
||||
sapConfigMain.getDocumentDetailTableName());
|
||||
|
@ -120,7 +120,7 @@ public class SapConfigService {
|
|||
|
||||
|
||||
private SapVoucher parsePaymentByMainTable(String requestId, String billTable, SapConfigMain sapConfigMain) {
|
||||
Map<String, String> workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable);
|
||||
Map<String, Object> workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable);
|
||||
Assert.notNull(workflowMainData, "payment: query workflow data fail, query request id is {}", requestId);
|
||||
Map<String, Object> workflowData = new HashMap<>();
|
||||
workflowData.put("main", workflowMainData);
|
||||
|
@ -144,7 +144,7 @@ public class SapConfigService {
|
|||
*/
|
||||
private SapVoucher parseByMainTable(String requestId,
|
||||
String billTable, SapConfigMain sapConfigMain) {
|
||||
Map<String, String> workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable);
|
||||
Map<String, Object> workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable);
|
||||
Assert.notNull(workflowMainData, "query workflow data fail, query request id is {}", requestId);
|
||||
Map<String, Object> workflowData = new HashMap<>();
|
||||
workflowData.put("main", workflowMainData);
|
||||
|
@ -248,7 +248,7 @@ public class SapConfigService {
|
|||
*/
|
||||
private SapVoucher parseByDetailTable(String requestId,
|
||||
String billTable, SapConfigMain sapConfigMain) {
|
||||
Map<String, String> workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable);
|
||||
Map<String, Object> workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable);
|
||||
Assert.notNull(workflowMainData, "query workflow data fail, query request id is {}", requestId);
|
||||
List<Map<String, Object>> workflowDetailData = mapper.selectWorkflowDataByMainId(Util.null2String(workflowMainData.get("id")),
|
||||
sapConfigMain.getDocumentDetailTableName());
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.api.youhong.ai.taibao.fcuntionlist.service.FunctionListService;
|
||||
import com.api.youhong.ai.taibao.qikan.service.PeriodicalService;
|
||||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.engine.youhong.ai.taibao.email.BlackListRegister;
|
||||
import com.engine.youhong.ai.taibao.email.mapper.InitBlackEmailListMapper;
|
||||
import org.junit.Test;
|
||||
import weaver.conn.RecordSet;
|
||||
|
@ -18,8 +19,7 @@ import weaver.workflow.webservices.WorkflowBaseInfo;
|
|||
import weaver.workflow.webservices.WorkflowRequestInfo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <h1>测试</h1>
|
||||
|
@ -169,4 +169,14 @@ public class TestTaiBao extends BaseTest {
|
|||
List<String> strings = mapper.selectEmailListByHrmIds(ids);
|
||||
System.out.println(JSON.toJSONString(strings));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmailFilter() {
|
||||
Set<String> set = new HashSet<>(Arrays.asList("774495953@qq.com", "wxr15844272561@163.com"));
|
||||
Set<String> expansionList = BlackListRegister.getExpansionList(set);
|
||||
if (Objects.nonNull(expansionList)) {
|
||||
set = expansionList;
|
||||
}
|
||||
System.out.println(set);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue