From f1f50c69cd4f601ffaf60a6a5b30bcfb17a6247b Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Tue, 30 May 2023 17:19:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=907.6.0=E3=80=91=E3=80=90group=E3=80=91?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=86=E7=BB=84=E5=90=8D=E7=A7=B0=E7=9A=84?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=EF=BC=8C=E4=BE=BF=E6=8D=B7=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E7=9A=84=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kernel/group/api/GroupConditionApi.java | 10 +++++++ .../api/callback/GroupNameRenderApi.java | 28 +++++++++++++++++++ .../service/impl/SysGroupServiceImpl.java | 19 +++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 kernel-s-group/group-api/src/main/java/cn/stylefeng/roses/kernel/group/api/callback/GroupNameRenderApi.java diff --git a/kernel-s-group/group-api/src/main/java/cn/stylefeng/roses/kernel/group/api/GroupConditionApi.java b/kernel-s-group/group-api/src/main/java/cn/stylefeng/roses/kernel/group/api/GroupConditionApi.java index e972b4349..174a33672 100644 --- a/kernel-s-group/group-api/src/main/java/cn/stylefeng/roses/kernel/group/api/GroupConditionApi.java +++ b/kernel-s-group/group-api/src/main/java/cn/stylefeng/roses/kernel/group/api/GroupConditionApi.java @@ -24,6 +24,7 @@ */ package cn.stylefeng.roses.kernel.group.api; +import cn.stylefeng.roses.kernel.group.api.callback.GroupNameRenderApi; import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest; import java.util.List; @@ -59,4 +60,13 @@ public interface GroupConditionApi { */ List getUserGroupBizIds(String groupBizCode, BaseRequest baseRequest); + /** + * 将业务的数据集合渲染分组名称 + * + * @param businessList 业务的数据集合 + * @author fengshuonan + * @since 2023/5/30 17:15 + */ + void renderBizListGroupName(String groupBizCode, List businessList); + } diff --git a/kernel-s-group/group-api/src/main/java/cn/stylefeng/roses/kernel/group/api/callback/GroupNameRenderApi.java b/kernel-s-group/group-api/src/main/java/cn/stylefeng/roses/kernel/group/api/callback/GroupNameRenderApi.java new file mode 100644 index 000000000..5697477ef --- /dev/null +++ b/kernel-s-group/group-api/src/main/java/cn/stylefeng/roses/kernel/group/api/callback/GroupNameRenderApi.java @@ -0,0 +1,28 @@ +package cn.stylefeng.roses.kernel.group.api.callback; + +/** + * 分组名称回显的方法 + * + * @author fengshuonan + * @since 2023/5/30 17:13 + */ +public interface GroupNameRenderApi { + + /** + * 获取被渲染数据的主键id + * + * @author fengshuonan + * @since 2023/5/30 17:18 + */ + Long getRenderBusinessId(); + + /** + * 设置条件分组名称,供回调用 + * + * @param groupName 分组名称 + * @author fengshuonan + * @since 2023/5/30 17:13 + */ + void renderGroupName(String groupName); + +} diff --git a/kernel-s-group/group-business/src/main/java/cn/stylefeng/roses/kernel/group/modular/service/impl/SysGroupServiceImpl.java b/kernel-s-group/group-business/src/main/java/cn/stylefeng/roses/kernel/group/modular/service/impl/SysGroupServiceImpl.java index 553afd5ee..3aa2a9efe 100644 --- a/kernel-s-group/group-business/src/main/java/cn/stylefeng/roses/kernel/group/modular/service/impl/SysGroupServiceImpl.java +++ b/kernel-s-group/group-business/src/main/java/cn/stylefeng/roses/kernel/group/modular/service/impl/SysGroupServiceImpl.java @@ -3,6 +3,7 @@ package cn.stylefeng.roses.kernel.group.modular.service.impl; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.stylefeng.roses.kernel.auth.api.context.LoginContext; +import cn.stylefeng.roses.kernel.group.api.callback.GroupNameRenderApi; import cn.stylefeng.roses.kernel.group.api.constants.GroupConstants; import cn.stylefeng.roses.kernel.group.api.pojo.SysGroupDTO; import cn.stylefeng.roses.kernel.group.api.pojo.SysGroupRequest; @@ -154,6 +155,24 @@ public class SysGroupServiceImpl extends ServiceImpl i return userBizIds; } + @Override + public void renderBizListGroupName(String groupBizCode, List businessList) { + + // 查询结果中有没有用户挂标签的,有的话就返回中文分组名称 + SysGroupRequest sysGroupRequest = new SysGroupRequest(); + sysGroupRequest.setGroupBizCode(groupBizCode); + List list = this.findGroupList(sysGroupRequest, true); + + // 增加返回结果的分组名称 + for (SysGroupDTO sysGroupDTO : list) { + for (GroupNameRenderApi item : businessList) { + if (item.getRenderBusinessId().equals(sysGroupDTO.getBusinessId())) { + item.renderGroupName(sysGroupDTO.getGroupName()); + } + } + } + } + /** * 返回结果增加通用的两个分组名称 *