From 3578a0f166fde85257c9123f86be17360e7170e1 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Wed, 25 May 2022 10:56:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=8E=E7=BB=86=E8=A1=A8=E6=9B=B4=E6=96=B0BU?= =?UTF-8?q?G=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CompServiceImpl.java | 10 +++- .../service/impl/ExtServiceImpl.java | 51 +++++++++---------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/com/engine/organization/service/impl/CompServiceImpl.java b/src/com/engine/organization/service/impl/CompServiceImpl.java index aac49022..53b08975 100644 --- a/src/com/engine/organization/service/impl/CompServiceImpl.java +++ b/src/com/engine/organization/service/impl/CompServiceImpl.java @@ -292,6 +292,7 @@ public class CompServiceImpl extends Service implements CompService { return apiDatas; } + /** * 是否为搜索查询 * @@ -299,7 +300,14 @@ public class CompServiceImpl extends Service implements CompService { * @return */ private boolean isFilter(CompPO compPO) { - return !(StringUtil.isEmpty(compPO.getCompName()) && StringUtil.isEmpty(compPO.getCompNo()) && null == compPO.getParentCompany() && StringUtil.isEmpty(compPO.getOrgCode()) && null == compPO.getIndustry() && null == compPO.getCompPrincipal() && null == compPO.getForbiddenTag()); + return !(StringUtil.isEmpty(compPO.getCompName()) + && StringUtil.isEmpty(compPO.getCompNo()) + && StringUtil.isEmpty(compPO.getCompNameShort()) + && StringUtil.isEmpty(compPO.getOrgCode()) + && null == compPO.getParentCompany() + && null == compPO.getIndustry() + && null == compPO.getCompPrincipal() + && null == compPO.getForbiddenTag()); } diff --git a/src/com/engine/organization/service/impl/ExtServiceImpl.java b/src/com/engine/organization/service/impl/ExtServiceImpl.java index 7bdb6612..0b49db23 100644 --- a/src/com/engine/organization/service/impl/ExtServiceImpl.java +++ b/src/com/engine/organization/service/impl/ExtServiceImpl.java @@ -82,7 +82,7 @@ public class ExtServiceImpl extends Service implements ExtService { tableMap.put("tabname", getExtendGroupMapper().getGroupNameById(entry.getKey() + "")); Map tabinfoMap = new HashMap<>(); tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, entry.getValue(), viewAttr, showLabel)); - tabinfoMap.put("rownum", "rownum"); + tabinfoMap.put("rownum", "rownum" + entry.getKey()); // 浏览按钮添加filespan字段 String fields = entry.getValue().stream().map(item -> { @@ -150,33 +150,32 @@ public class ExtServiceImpl extends Service implements ExtService { @Override public void updateExtDT(User user, String extendType, String tableName, Map params, Long id) { - List dtInfoPOList = getExtendInfoMapper().listFields(extendType, "", tableName); - List dtFields = dtInfoPOList.stream().map(ExtendInfoPO::getFieldName).collect(Collectors.toList()); - - List> insertList = new ArrayList<>(); - // 删除明细表数据 - getExtDTMapper().deleteByMainID(tableName, id); - // 处理明细表数据 - int rowNum = Util.getIntValue((String) params.get("rownum")); - rowNum = 5; - for (int i = 0; i < rowNum; i++) { - Map map = new HashMap<>(); - for (ExtendInfoPO extendInfoPO : dtInfoPOList) { - if (BROWSER_TYPE == extendInfoPO.getControlType()) { - map.put(extendInfoPO.getFieldName() + "span", params.get(extendInfoPO.getFieldName() + "span_" + i)); + List dtInfoPOList = getExtendInfoMapper().listFields(extendType, "", ""); + Map groups = dtInfoPOList.stream().collect(Collectors.toMap(ExtendInfoPO::getExtendGroupId, ExtendInfoPO::getTableName, (k1, k2) -> k1)); + // 删除原有明细表数据 + groups.forEach((k, v) -> { + if (v.toLowerCase().contains("_dt")) getExtDTMapper().deleteByMainID(v, id); + }); + + for (Map.Entry entry : groups.entrySet()) { + int rowNum = Util.getIntValue((String) params.get("rownum" + entry.getKey())); + List filterS = dtInfoPOList.stream().filter(item -> entry.getKey().equals(item.getExtendGroupId())).collect(Collectors.toList()); + for (int i = 0; i < rowNum; i++) { + Map map = new HashMap<>(); + + for (ExtendInfoPO extendInfoPO : filterS) { + if (BROWSER_TYPE == extendInfoPO.getControlType()) { + map.put(extendInfoPO.getFieldName() + "span", params.get(extendInfoPO.getFieldName() + "span_" + i)); + } + map.put(extendInfoPO.getFieldName(), params.get(extendInfoPO.getFieldName() + "_" + i)); } - map.put(extendInfoPO.getFieldName(), params.get(extendInfoPO.getFieldName() + "_" + i)); + map.put("mainid", id); + map.put("creator", user.getUID()); + map.put("delete_type", 0); + map.put("create_time", new Date()); + map.put("update_time", new Date()); + getExtDTMapper().insertCompExtDT(entry.getValue(), map); } - map.put("mainid", id); - map.put("creator", user.getUID()); - map.put("delete_type", 0); - map.put("create_time", new Date()); - map.put("update_time", new Date()); - insertList.add(map); - } - // 更新拓展表数据 - for (Map map : insertList) { - getExtDTMapper().insertCompExtDT(tableName, map); } } }