diff --git a/README.md b/README.md index c9c4e09..94ab11e 100644 --- a/README.md +++ b/README.md @@ -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 ``` ### 测试 diff --git a/src/main/java/com/api/youhong/ai/geerde/requestlog/pojo/RequestLogAuthority.java b/src/main/java/com/api/youhong/ai/geerde/requestlog/pojo/RequestLogAuthority.java index a3edf5b..00a47af 100644 --- a/src/main/java/com/api/youhong/ai/geerde/requestlog/pojo/RequestLogAuthority.java +++ b/src/main/java/com/api/youhong/ai/geerde/requestlog/pojo/RequestLogAuthority.java @@ -26,4 +26,8 @@ public class RequestLogAuthority { /** 权限组成员 */ @SqlOracleDbFieldAnn("AUTHORITY_MEMBER") private String authorityMember; + + /** */ + @SqlOracleDbFieldAnn("DEFAULT_VALUE") + private String defaultValue; } diff --git a/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java b/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java index fe6f835..fbe45ab 100644 --- a/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java +++ b/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java @@ -30,13 +30,22 @@ public class RequestLogAuthorityService { result.put("show", false); return result; } + if (StrUtil.isBlank(requestId) || "-1".equals(requestId)) { - result.put("enable", false); + 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) { - result.put("enable", false); + if ("1".equals(requestLogAuthority.getDefaultValue())) { + result.put("enable", true); + } else { + result.put("enable", false); + } } else { result.put("enable", true); } diff --git a/src/main/java/com/engine/workflow/biz/requestForm/RequestRemindBiz.java b/src/main/java/com/engine/workflow/biz/requestForm/RequestRemindBiz.java index 6f3df02..8d1790f 100644 --- a/src/main/java/com/engine/workflow/biz/requestForm/RequestRemindBiz.java +++ b/src/main/java/com/engine/workflow/biz/requestForm/RequestRemindBiz.java @@ -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 mailAddress1 = blackListExpansion.sendEmailHandler(mailAddress); - if (Objects.nonNull(mailAddress1)) { - mailAddress = mailAddress1; - } + Set 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 mailAddress1 = blackListExpansion.sendEmailHandler(mailAddress); - if (Objects.nonNull(mailAddress1)) { - mailAddress = mailAddress1; - } + Set expansionList = BlackListRegister.getExpansionApproveList(mailAddress); + if (Objects.nonNull(expansionList)) { + mailAddress = expansionList; } /* ******************* youhong.ai 添加发送邮箱的黑名单拓展 end ******************* */ EmailApprovalRunnable.threadModeReminder(String.join(",", mailAddress), title, content, String.valueOf(requestId), allAttchment); diff --git a/src/main/java/com/engine/youhong/ai/taibao/email/BlackListExpansion.java b/src/main/java/com/engine/youhong/ai/taibao/email/BlackListExpansion.java deleted file mode 100644 index 986f2bf..0000000 --- a/src/main/java/com/engine/youhong/ai/taibao/email/BlackListExpansion.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.engine.youhong.ai.taibao.email; - -import java.util.Set; - -/** - *

黑名单扩展接口

- * - *

create: 2023/4/14 17:07

- * - * @author youHong.ai - */ -public interface BlackListExpansion { - - /** - *

发送邮件

- * - * @param mailAddress 邮箱地址 - * @return 邮箱地址 - */ - Set sendEmailHandler(Set mailAddress); -} diff --git a/src/main/java/com/engine/youhong/ai/taibao/email/BlackListRegister.java b/src/main/java/com/engine/youhong/ai/taibao/email/BlackListRegister.java index 4d63bd3..314f70d 100644 --- a/src/main/java/com/engine/youhong/ai/taibao/email/BlackListRegister.java +++ b/src/main/java/com/engine/youhong/ai/taibao/email/BlackListRegister.java @@ -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; /** *

注册信息

@@ -13,26 +19,42 @@ import java.util.Objects; */ public class BlackListRegister { - private static final List EXPANSION_LIST = new ArrayList<>(); - private static final List 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 getExpansionList(Set set) { + if (Objects.isNull(set)) { + return null; } - } - - public static void registerAPPROVEExpansion(BlackListExpansion blackListExpansion) { - if (Objects.nonNull(blackListExpansion)) { - EXPANSION_APPROVE_LIST.add(blackListExpansion); + List hrmList = mapper.selectWorkflowBlackEmailList(); + if (CollectionUtil.isEmpty(hrmList)) { + return null; } + String ids = Util.join(hrmList, ","); + List blackEmailList = mapper.selectEmailListByHrmIds(ids); + if (CollectionUtil.isEmpty(blackEmailList)) { + return set; + } + return set.stream() + .filter(item -> !blackEmailList.contains(item)) + .collect(Collectors.toSet()); } - public static List getExpansionList() { - return EXPANSION_LIST; - } - - public static List getExpansionApproveList() { - return EXPANSION_APPROVE_LIST; + public static Set getExpansionApproveList(Set set) { + if (Objects.isNull(set)) { + return null; + } + String ids = mapper.selectWorkflowApproveBlackEmailList(); + if (StrUtil.isBlank(ids)) { + return null; + } + List blackEmailList = mapper.selectEmailListByHrmIds(ids); + if (CollectionUtil.isEmpty(blackEmailList)) { + return null; + } + return set.stream() + .filter(item -> !blackEmailList.contains(item)) + .collect(Collectors.toSet()); } } diff --git a/src/main/java/com/engine/youhong/ai/taibao/email/impl/InitBlackListServiceImpl.java b/src/main/java/com/engine/youhong/ai/taibao/email/impl/InitBlackListServiceImpl.java deleted file mode 100644 index cb6e5e6..0000000 --- a/src/main/java/com/engine/youhong/ai/taibao/email/impl/InitBlackListServiceImpl.java +++ /dev/null @@ -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; - -/** - *

初始化扩展信息

- * - *

create: 2023/4/14 17:15

- * - * @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 hrmList = mapper.selectWorkflowBlackEmailList(); - String ids = Util.join(hrmList, ","); - List 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 blackEmailList = mapper.selectEmailListByHrmIds(ids); - if (CollectionUtil.isEmpty(blackEmailList)) { - return set; - } - return set.stream() - .filter(item -> !blackEmailList.contains(item)) - .collect(Collectors.toSet()); - }); - } - -} diff --git a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/VoucherPayableNewAction.java b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/VoucherPayableNewAction.java index 3dcb4d0..6bc4e62 100644 --- a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/VoucherPayableNewAction.java +++ b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/VoucherPayableNewAction.java @@ -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,13 +215,15 @@ public class VoucherPayableNewAction extends SafeCusBaseAction { keys = sortKey(keys); for (Object o : list) { Map map = (Map) o; - if (map.containsKey(filterField)) { - try { - String value = Util.null2String(map.get(filterField)); - if (Double.parseDouble(value) == 0.0) { - continue; + if (!StrUtil.isBlank(filterField)) { + if (map.containsKey(filterField)) { + try { + String value = Util.null2String(map.get(filterField)); + if (Double.parseDouble(value) == 0.0) { + continue; + } + } catch (Exception ignore) { } - } catch (Exception ignore) { } } for (String key : keys) { diff --git a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/mapper/SapConfigMapper.java b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/mapper/SapConfigMapper.java index 877ab26..3ed9915 100644 --- a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/mapper/SapConfigMapper.java +++ b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/mapper/SapConfigMapper.java @@ -96,7 +96,7 @@ public interface SapConfigMapper { * @author youHong.ai ****************************************** */ @Select("select * from $t{billTable} where requestid = #{requestId}") - Map selectWorkflowDataByRequestId(@ParamMapper("requestId") String requestId, + Map selectWorkflowDataByRequestId(@ParamMapper("requestId") String requestId, @ParamMapper("billTable") String billTable); diff --git a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java index e1c482f..82eb60a 100644 --- a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java +++ b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java @@ -91,7 +91,7 @@ public class SapConfigService { } private SapVoucher parseByPaymentDetailTable(String requestId, String billTable, SapConfigMain sapConfigMain) { - Map workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable); + Map workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable); Assert.notNull(workflowMainData, "payment: query workflow data fail, query request id is {}", requestId); List> 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 workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable); + Map workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable); Assert.notNull(workflowMainData, "payment: query workflow data fail, query request id is {}", requestId); Map workflowData = new HashMap<>(); workflowData.put("main", workflowMainData); @@ -144,7 +144,7 @@ public class SapConfigService { */ private SapVoucher parseByMainTable(String requestId, String billTable, SapConfigMain sapConfigMain) { - Map workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable); + Map workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable); Assert.notNull(workflowMainData, "query workflow data fail, query request id is {}", requestId); Map workflowData = new HashMap<>(); workflowData.put("main", workflowMainData); @@ -248,7 +248,7 @@ public class SapConfigService { */ private SapVoucher parseByDetailTable(String requestId, String billTable, SapConfigMain sapConfigMain) { - Map workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable); + Map workflowMainData = mapper.selectWorkflowDataByRequestId(requestId, billTable); Assert.notNull(workflowMainData, "query workflow data fail, query request id is {}", requestId); List> workflowDetailData = mapper.selectWorkflowDataByMainId(Util.null2String(workflowMainData.get("id")), sapConfigMain.getDocumentDetailTableName()); diff --git a/src/test/java/youhong/ai/taibao/TestTaiBao.java b/src/test/java/youhong/ai/taibao/TestTaiBao.java index 58a4d1c..b2a74e9 100644 --- a/src/test/java/youhong/ai/taibao/TestTaiBao.java +++ b/src/test/java/youhong/ai/taibao/TestTaiBao.java @@ -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.*; /** *

测试

@@ -169,4 +169,14 @@ public class TestTaiBao extends BaseTest { List strings = mapper.selectEmailListByHrmIds(ids); System.out.println(JSON.toJSONString(strings)); } + + @Test + public void testEmailFilter() { + Set set = new HashSet<>(Arrays.asList("774495953@qq.com", "wxr15844272561@163.com")); + Set expansionList = BlackListRegister.getExpansionList(set); + if (Objects.nonNull(expansionList)) { + set = expansionList; + } + System.out.println(set); + } }