From a7e561909767140d15f62aa2b0b1c015e1a15aff Mon Sep 17 00:00:00 2001 From: dxfeng Date: Tue, 14 Jun 2022 17:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E5=8C=96=E5=88=86=E7=BB=84=E3=80=81?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E3=80=81=E5=90=8D=E5=AD=97=E8=A1=A8=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=90=AF=E7=94=A8=EF=BC=9B=20=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E8=A1=A8=E6=8C=89=E7=85=A7=E4=B8=8A=E4=B8=8B=E7=BA=A7=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=E5=B1=95=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/extend/ExtendGroupMapper.xml | 4 ++-- .../mapper/extend/ExtendTitleMapper.xml | 4 ++-- .../organization/service/ExtService.java | 3 +-- .../service/FieldDefinedService.java | 8 +++++++ .../service/impl/CompServiceImpl.java | 2 +- .../service/impl/DepartmentServiceImpl.java | 2 +- .../service/impl/ExtServiceImpl.java | 23 +++++++++++++------ .../service/impl/FieldDefinedServiceImpl.java | 15 ++++++++++++ .../service/impl/JobServiceImpl.java | 2 +- 9 files changed, 47 insertions(+), 16 deletions(-) diff --git a/src/com/engine/organization/mapper/extend/ExtendGroupMapper.xml b/src/com/engine/organization/mapper/extend/ExtendGroupMapper.xml index 25167c29..16fa249a 100644 --- a/src/com/engine/organization/mapper/extend/ExtendGroupMapper.xml +++ b/src/com/engine/organization/mapper/extend/ExtendGroupMapper.xml @@ -31,7 +31,7 @@ FROM jcl_field_extendgroup t - WHERE t.delete_type = 0 + WHERE t.delete_type = 0 and t.is_show = 1 and extend_type = #{extendType} @@ -56,7 +56,7 @@ select from jcl_field_extendgroup t - WHERE t.delete_type = 0 + WHERE t.delete_type = 0 and t.is_show = 1 and t.pid= #{pid} diff --git a/src/com/engine/organization/mapper/extend/ExtendTitleMapper.xml b/src/com/engine/organization/mapper/extend/ExtendTitleMapper.xml index e39e32f5..fff58b22 100644 --- a/src/com/engine/organization/mapper/extend/ExtendTitleMapper.xml +++ b/src/com/engine/organization/mapper/extend/ExtendTitleMapper.xml @@ -33,7 +33,7 @@ FROM jcl_field_extendtitle t - WHERE t.delete_type = 0 + WHERE t.delete_type = 0 and t.is_show = 1 and group_id = #{groupId} @@ -45,7 +45,7 @@ FROM jcl_field_extendtitle t - WHERE t.delete_type = 0 + WHERE t.delete_type = 0 and t.is_show = 1 AND id IN #{id} diff --git a/src/com/engine/organization/service/ExtService.java b/src/com/engine/organization/service/ExtService.java index 6574500c..af0e8484 100644 --- a/src/com/engine/organization/service/ExtService.java +++ b/src/com/engine/organization/service/ExtService.java @@ -51,8 +51,7 @@ public interface ExtService { * @param showLabel * @return */ - List> getExtendTables(User user, String extendType, String tableName, long id, int viewAttr, boolean showLabel); - + List> getExtendTables(User user, String extendType, Long groupId,String tableName, long id, int viewAttr, boolean showLabel); /** * 拓展页面分组 * diff --git a/src/com/engine/organization/service/FieldDefinedService.java b/src/com/engine/organization/service/FieldDefinedService.java index 2ecc15de..48010e12 100644 --- a/src/com/engine/organization/service/FieldDefinedService.java +++ b/src/com/engine/organization/service/FieldDefinedService.java @@ -24,4 +24,12 @@ public interface FieldDefinedService { */ Map getTabInfo(String groupType); + /** + * 保存自定义字段 + * + * @param data + * @return + */ + int saveFields(String data); + } diff --git a/src/com/engine/organization/service/impl/CompServiceImpl.java b/src/com/engine/organization/service/impl/CompServiceImpl.java index f7bc2409..6410d187 100644 --- a/src/com/engine/organization/service/impl/CompServiceImpl.java +++ b/src/com/engine/organization/service/impl/CompServiceImpl.java @@ -254,7 +254,7 @@ public class CompServiceImpl extends Service implements CompService { // 拓展页面分组 resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_COMPEXT)); // 处理明细表 - resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, JCL_ORG_COMPEXT_DT1, id, viewAttr, false)); + resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_COMPEXT_DT1, id, viewAttr, false)); Map apiDatas = new HashMap<>(); apiDatas.put("result", resultMap); diff --git a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java index 71f97b2c..e5607405 100644 --- a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java +++ b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java @@ -307,7 +307,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService // 拓展页面分组 resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_DEPTEXT)); // 处理明细表 - resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, JCL_ORG_DEPTEXT_DT1, id, viewAttr, false)); + resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_DEPTEXT_DT1, id, viewAttr, false)); Map apiDatas = new HashMap<>(); apiDatas.put("result", resultMap); diff --git a/src/com/engine/organization/service/impl/ExtServiceImpl.java b/src/com/engine/organization/service/impl/ExtServiceImpl.java index 904a9021..92070e07 100644 --- a/src/com/engine/organization/service/impl/ExtServiceImpl.java +++ b/src/com/engine/organization/service/impl/ExtServiceImpl.java @@ -6,6 +6,7 @@ import com.engine.organization.entity.TopTab; import com.engine.organization.entity.codesetting.po.CodeRulePO; import com.engine.organization.entity.extend.ExtendInfoOperateType; import com.engine.organization.entity.extend.bo.ExtendInfoBO; +import com.engine.organization.entity.extend.po.ExtendGroupPO; import com.engine.organization.entity.extend.po.ExtendInfoPO; import com.engine.organization.entity.extend.po.ExtendTitlePO; import com.engine.organization.mapper.codesetting.CodeRuleMapper; @@ -116,10 +117,15 @@ public class ExtServiceImpl extends Service implements ExtService { } @Override - public List> getExtendTables(User user, String extendType, String tableName, long id, int viewAttr, boolean showLabel) { + public List> getExtendTables(User user, String extendType, Long groupId, String tableName, long id, int viewAttr, boolean showLabel) { List> tables = new ArrayList<>(); + List infoPOList = new ArrayList<>(); + // 查询明细表 + List extendGroupList = getExtendGroupMapper().listGroupByPid(groupId); + for (ExtendGroupPO extendGroup : extendGroupList) { + infoPOList.addAll(getExtendInfoMapper().listFields(extendType, extendGroup.getId() + "", tableName, "")); + } // 查询所有分布模块,拓展明细表信息 - List infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ""); Map> groupMap = infoPOList.stream().collect(Collectors.groupingBy(ExtendInfoPO::getExtendGroupId)); // 遍历Map,组装数据 for (Map.Entry> entry : groupMap.entrySet()) { @@ -132,7 +138,7 @@ public class ExtServiceImpl extends Service implements ExtService { // 浏览按钮添加filespan字段 String fields = entry.getValue().stream().map(item -> { - if (BROWSER_TYPE == item.getControlType()) { + if (BROWSER_TYPE.equals(item.getControlType())) { return item.getFieldName() + "," + item.getFieldName() + "span"; } return item.getFieldName(); @@ -160,12 +166,15 @@ public class ExtServiceImpl extends Service implements ExtService { infoPOList.addAll(infoPOList1); List ids = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList()); List extendTitles = getExtendTitleMapper().getTitlesByIds(ids); - Set extendGroups = extendTitles.stream().map(ExtendTitlePO::getGroupId).collect(Collectors.toSet()); + Set groupIds = extendTitles.stream().map(ExtendTitlePO::getGroupId).collect(Collectors.toSet()); + List extendGroupList = getExtendGroupMapper().listByType(extendType); // 拓展信息 - if (CollectionUtils.isNotEmpty(extendGroups)) { - for (Long groupId : extendGroups) { - topTabs.add(TopTab.builder().color("#000000").groupId(groupId + "").showcount(false).title(getExtendGroupMapper().getGroupNameById(groupId + "")).viewCondition(groupId + "").build()); + if (CollectionUtils.isNotEmpty(extendGroupList) && CollectionUtils.isNotEmpty(groupIds)) { + for (ExtendGroupPO extendGroup : extendGroupList) { + if (groupIds.contains(extendGroup.getId())) { + topTabs.add(TopTab.builder().color("#000000").groupId(extendGroup.getId().toString()).showcount(false).title(extendGroup.getGroupName()).viewCondition(extendGroup.getId().toString()).build()); + } } } return topTabs; diff --git a/src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java b/src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java index 6be33e5d..721926aa 100644 --- a/src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java +++ b/src/com/engine/organization/service/impl/FieldDefinedServiceImpl.java @@ -1,5 +1,7 @@ package com.engine.organization.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.engine.core.impl.Service; import com.engine.organization.entity.extend.po.ExtendTitlePO; import com.engine.organization.entity.fieldset.TypeTreeDTO; @@ -8,6 +10,8 @@ import com.engine.organization.mapper.extend.ExtendTitleMapper; import com.engine.organization.service.FieldDefinedService; import com.engine.organization.util.OrganizationAssert; import com.engine.organization.util.db.MapperProxyFactory; +import org.apache.commons.lang3.StringUtils; +import weaver.general.Util; import java.util.ArrayList; import java.util.HashMap; @@ -59,6 +63,17 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ return datas; } + @Override + public int saveFields(String data) { + if (StringUtils.isEmpty(data)) { + return 0; + } + JSONObject jsonObject = JSON.parseObject(data); + String groupType = Util.null2String(jsonObject.get("groupType")); + String groupId = Util.null2String(jsonObject.get("groupId")); + return 0; + } + /** * 判断该分组下是否有字段 * diff --git a/src/com/engine/organization/service/impl/JobServiceImpl.java b/src/com/engine/organization/service/impl/JobServiceImpl.java index f38a2abd..b52f7c2f 100644 --- a/src/com/engine/organization/service/impl/JobServiceImpl.java +++ b/src/com/engine/organization/service/impl/JobServiceImpl.java @@ -291,7 +291,7 @@ public class JobServiceImpl extends Service implements JobService { // 拓展页面分组 resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_JOBEXT)); // 处理明细表 - List> extendTables = getExtService(user).getExtendTables(user, EXTEND_TYPE, JCL_ORG_JOBEXT_DT1, id, viewAttr, false); + List> extendTables = getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId),JCL_ORG_JOBEXT_DT1, id, viewAttr, false); Map tableMap = new HashMap<>(); tableMap.put("hide", false);