From 7723cc8c085bf1a7132dfc37a2a3d7bb842d8fa9 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 14 Apr 2022 17:54:14 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=B1=85=E6=B0=91=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=AF=B9=E5=BF=85?= =?UTF-8?q?=E5=A1=AB=E9=A1=B9=E7=9A=84=E6=A0=A1=E9=AA=8C=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=92=8C=E6=8F=90=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/IcResiUserImportServiceImpl.java | 180 ++++++++++++------ 1 file changed, 127 insertions(+), 53 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index 722fb93cd2..bf606f6da5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -75,10 +75,17 @@ import java.util.stream.Collectors; @Service public class IcResiUserImportServiceImpl implements IcResiUserImportService, ResultDataResolver { + public static final List controlGroup1 = Arrays.asList("input", "textarea", "datepicker", "daterange"); + public static final List controlGroup2 = Arrays.asList("select", "radio"); + /** * 身份证号列序号 */ public static final Integer ID_CARD_COLUMN_NO = 9; + /** + * 姓名列序号 + */ + public static final Integer ID_NAME_COLUMN_NO = 6; // 错误和跳过excel行暂存 public static final ThreadLocal>> errorRows = new ThreadLocal<>(); @@ -163,9 +170,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res private Integer required; private List colIndex; //private List colContents; - // 单元格内容 + // 单元格内容。多选框没有该列,因为多选框对应着excel的多列 private String cellContent; - // 数据库中列的值 + // 单元格内容对应的数据库中值 private String colValue; // key:label,value:value @@ -425,11 +432,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res try { convertColumnWrappers2Map4Persist(itemIdAndColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel, columnAndValues, true); - String idCard = columnAndValues.get("ID_CARD"); - // 执行指定的检查 specifiedCheck(columnAndValues); + String idCard = columnAndValues.get("ID_CARD"); Map existingResiMap = icResiUserDao.selectResiInfoMap(idCard, null); if (existingResiMap == null) { @@ -719,111 +725,179 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res /** * 将当前行数据转化成LinkedHashMap,供后续插入 - * @param itemIdAndColumnWrappers 当前行的ColumnWrapper,每一个ColumnWrapper元素都是当前行中的一个列,key:itemId + * @param dbMetadataItemIdAndColumnWrappers 当前行的ColumnWrapper,每一条都是数据库中的一个列的源数据,对应到excel中可能是多个列(多选)。每一个ColumnWrapper元素都是当前行中的一个列,key:itemId * @param row 当前行数据 * @param currUserAgencyId 当前用户所属机构ID * @param checkBoxOptionColumnIdxAndLabel 复选框options列表。key:列号,value:复选框中文 - * @param target 要将数据放到哪个对象中 + * @param target2Insert 要用来insert到db的数据 * @param isPrimaryTable 是否是主表 */ - private void convertColumnWrappers2Map4Persist(Map itemIdAndColumnWrappers, Map row, + private void convertColumnWrappers2Map4Persist(Map dbMetadataItemIdAndColumnWrappers, Map row, String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, - LinkedHashMap target, boolean isPrimaryTable) { + LinkedHashMap target2Insert, boolean isPrimaryTable) { + + boolean hasError = false; - boolean interupt = false; + String notFoundColumnNames = null; + String emptyColumnNames = null; - List errorColumnNames = new LinkedList<>(); + // 这两列要提前放进去,因为有的列未填写的话,会抛异常出去,需要用这两列来做描述 + target2Insert.put("ID_CARD", row.get(ID_CARD_COLUMN_NO)); + target2Insert.put("NAME", row.get(ID_NAME_COLUMN_NO)); - for (Map.Entry itemIdAndColumnWrapper : itemIdAndColumnWrappers.entrySet()) { + for (Map.Entry dbColumnMetadata : dbMetadataItemIdAndColumnWrappers.entrySet()) { - String itemId = itemIdAndColumnWrapper.getKey(); - ColumnWrapper columnWrapper = itemIdAndColumnWrapper.getValue(); + String currentItemId = dbColumnMetadata.getKey(); + ColumnWrapper columnWrapper = dbColumnMetadata.getValue(); - if ("input".equals(columnWrapper.getItemType()) - || "textarea".equals(columnWrapper.getItemType()) - || "datepicker".equals(columnWrapper.getItemType()) - || "daterange".equals(columnWrapper.getItemType()) - ) { + // "input", "textarea", "datepicker", "daterange" + if (controlGroup1.contains(columnWrapper.getItemType())) { + // 输入的控件,不会横跨多个单元格,所以只取一列就可以了 String cellContent = row.get(columnWrapper.getColIndex().get(0)); + columnWrapper.setCellContent(cellContent); columnWrapper.setColValue(cellContent); - } else if ("select".equals(columnWrapper.getItemType()) - || "radio".equals(columnWrapper.getItemType())){ + // 必填检查 + if (hasError = requiredButEmptyCheck(isPrimaryTable, columnWrapper)) { + emptyColumnNames = columnWrapper.combinedLabel; + break; + } + + // "select", "radio" + } else if (controlGroup2.contains(columnWrapper.getItemType())){ - String optionSourceType = columnWrapper.getOptionSourceType(); // 取单元格的内容 String cellContent = row.get(columnWrapper.getColIndex().get(0)); columnWrapper.setCellContent(cellContent); - if ("local".equals(optionSourceType)) { + // 必填检查 + if (hasError = requiredButEmptyCheck(isPrimaryTable, columnWrapper)) { + emptyColumnNames = columnWrapper.combinedLabel; + break; + } + + if ("local".equals(columnWrapper.getOptionSourceType())) { // 根据单元格内容,取到指定的option - Map options = columnWrapper.getOptions(); - String colValue = options.get(cellContent); + Map itemOptions = columnWrapper.getOptions(); + String colValue = itemOptions.get(cellContent); columnWrapper.setColValue(colValue); } else { - // remote类型。优先从缓存取 String fullUri = columnWrapper.getOptionSourceValue(); String[] uriParts = splitOptionSourceUrl(fullUri); String pureUri = uriParts[0]; String superItemId = uriParts[1]; - String superColumValue; + String superColumnValue; + // 获取父item的值 if (StringUtils.isNotBlank(superItemId)) { - superColumValue = itemIdAndColumnWrappers.get(superItemId).getColValue(); + superColumnValue = dbMetadataItemIdAndColumnWrappers.get(superItemId).getColValue(); } else { - superColumValue = "-"; + superColumnValue = "-"; } - Map> superOptions = itemIdAndOptionsCache.getIfPresent(itemId); + // 通过接口调用,计算出colValue,放到columnWrapper中 + Map> superOptions = itemIdAndOptionsCache.getIfPresent(currentItemId); if (superOptions != null && superOptions.size() > 0) { - Map options = superOptions.get(superColumValue); + Map options = superOptions.get(superColumnValue); if (options == null || options.size() == 0) { - options = listRemoteOptions(pureUri, superItemId, itemIdAndColumnWrappers, currUserAgencyId, "saveorupdate"); - superOptions.put(superColumValue, options); + options = listRemoteOptions(pureUri, superItemId, dbMetadataItemIdAndColumnWrappers, currUserAgencyId, "saveorupdate"); + superOptions.put(superColumnValue, options); } String colValue = options.get(cellContent); columnWrapper.setColValue(colValue); } else { - Map options = listRemoteOptions(pureUri, superItemId, itemIdAndColumnWrappers, currUserAgencyId, "saveorupdate"); + // 父item的options。例如当前遍历的是小区列,那查出来的就是网格下的小区 + // 然后把 > 放到缓存里 + Map options = listRemoteOptions(pureUri, superItemId, dbMetadataItemIdAndColumnWrappers, currUserAgencyId, "saveorupdate"); superOptions = new HashMap<>(); - superOptions.put(superColumValue, options); - itemIdAndOptionsCache.put(itemId, superOptions); + superOptions.put(superColumnValue, options); + itemIdAndOptionsCache.put(currentItemId, superOptions); String colValue = options.get(cellContent); columnWrapper.setColValue(colValue); } } } else if ("checkbox".equals(columnWrapper.getItemType())) { + //多选框没有具体的cellContent,因为多选框对应着excel的多列 String checkBoxColValue = getCheckBoxColValue(columnWrapper, row, checkBoxOptionColumnIdxAndLabel); columnWrapper.setColValue(checkBoxColValue); } - // requiredColumns中的值不在排除字段中 && 是必填 && 未填写 - if (isPrimaryTable) { - // 主表没有需要排除的列 - if (columnWrapper.getRequired() == 1 && StringUtils.isBlank(columnWrapper.colValue)) { - interupt = true; - errorColumnNames.add(columnWrapper.combinedLabel); - } - } else { - // 从表需要排除掉一些不必要校验的列 - if (!subTableNeedlessColumns.contains(columnWrapper.columnName) - && columnWrapper.getRequired() == 1 - && StringUtils.isBlank(columnWrapper.colValue)) { - interupt = true; - errorColumnNames.add(columnWrapper.combinedLabel); - } + // 填了,但找不到对应数据的检查 + if (hasError = notFoundCheck(isPrimaryTable, columnWrapper)) { + notFoundColumnNames = columnWrapper.combinedLabel; + break; } - target.put(columnWrapper.columnName, columnWrapper.colValue); + target2Insert.put(columnWrapper.columnName, columnWrapper.colValue); + } + + if (!hasError) { + return; + } + + StringBuilder sb = new StringBuilder(); + + // 组织报错信息 + if (StringUtils.isNotBlank(emptyColumnNames)) { + sb.append(emptyColumnNames).append("的值未填写"); + } + + if (StringUtils.isNotBlank(notFoundColumnNames)) { + sb.append(notFoundColumnNames).append("填写的值在系统中未找到"); + } + + throw new EpmetException(sb.toString()); + } + + /** + * 必填,但是用户没填的,放到list中 + * @param isPrimaryTable 是否是主表。true:是主表,false:从表 + * @param columnWrapper 数据库列包装对象 + */ + public boolean requiredButEmptyCheck(Boolean isPrimaryTable, ColumnWrapper columnWrapper) { + // requiredColumns中的值不在排除字段中 && 是必填 && 未填写 + if (isPrimaryTable) { + // 主表没有需要排除的列 + if (columnWrapper.getRequired() == 1 && StringUtils.isBlank(columnWrapper.cellContent)) { + return true; + } + } else { + // 从表需要排除掉一些不必要校验的列 + if (!subTableNeedlessColumns.contains(columnWrapper.columnName) + && columnWrapper.getRequired() == 1 + && StringUtils.isBlank(columnWrapper.cellContent)) { + return true; + } } - if (interupt) { - throw new RenException(String.join(",", errorColumnNames) + "的值未填写,或者所填写信息在系统中未找到"); + return false; + } + + /** + * 必填,并且在系统中没找到值的,放到list中 + * @param isPrimaryTable 是否是主表。true:是主表,false:从表 + * @param columnWrapper 数据库列包装对象 + */ + public boolean notFoundCheck(Boolean isPrimaryTable, ColumnWrapper columnWrapper) { + // requiredColumns中的值不在排除字段中 && 是必填 && 未填写 + if (isPrimaryTable) { + // 主表没有需要排除的列 + if (columnWrapper.getRequired() == 1 && StringUtils.isBlank(columnWrapper.colValue)) { + return true; + } + } else { + // 从表需要排除掉一些不必要校验的列 + if (!subTableNeedlessColumns.contains(columnWrapper.columnName) + && columnWrapper.getRequired() == 1 + && StringUtils.isBlank(columnWrapper.colValue)) { + return true; + } } + return false; } /** From 6752d439aeadbd3b64b8712e8ec032afbca81114 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 14 Apr 2022 20:52:13 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=B1=85=E6=B0=91=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=EF=BC=9A=E6=8F=90=E7=A4=BA=E8=AF=9D=E6=9C=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/IcResiUserImportServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index bf606f6da5..a8c28673ee 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -602,7 +602,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res if (resiName == null) { resiName = ""; } - throw new RenException(EpmetErrorCode.IDCARDNO_ERROR.getCode(), String.format("用户【%s】身份证号未填写或格式错误", resiName)); + throw new RenException(EpmetErrorCode.IDCARDNO_ERROR.getCode(), String.format("居民【%s】身份证号未填写或格式错误", resiName)); } // 检查用户是否存在 From a3cfc504c15f116c54445281c9b7cf779c68c9e0 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 14 Apr 2022 22:13:47 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=B1=85=E6=B0=91=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=EF=BC=9A=E6=A0=A1=E9=AA=8C=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=88=97=E7=9A=84=E5=BF=85=E5=A1=AB=EF=BC=9B=E5=8F=AA=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=87=BA=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E5=A1=AB=E4=BA=86=E4=BD=86=E7=B3=BB=E7=BB=9F=E4=B8=AD=E6=89=BE?= =?UTF-8?q?=E4=B8=8D=E5=88=B0=E7=9A=84=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-user/epmet-user-server/pom.xml | 2 +- .../impl/IcResiUserImportServiceImpl.java | 64 ++++++++++++------- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 56b1318f64..b2f751c8b5 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -303,7 +303,7 @@ 6379 EpmEtrEdIs!q@w - true + false 192.168.10.150:8848 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index a8c28673ee..ee23c3f7d1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -736,10 +736,11 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, LinkedHashMap target2Insert, boolean isPrimaryTable) { + // 本行中是否有必填但未填,或者填了但填错了系统中找不到的列,那后面的数据可能就没办法通过前面填写的值去关联查询,因此只做必填检查,提示出来就行了,仁至义尽 boolean hasError = false; - String notFoundColumnNames = null; - String emptyColumnNames = null; + String notFoundColumnName = null; + List emptyColumnNames = new ArrayList<>(); // 这两列要提前放进去,因为有的列未填写的话,会抛异常出去,需要用这两列来做描述 target2Insert.put("ID_CARD", row.get(ID_CARD_COLUMN_NO)); @@ -760,9 +761,15 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res columnWrapper.setColValue(cellContent); // 必填检查 - if (hasError = requiredButEmptyCheck(isPrimaryTable, columnWrapper)) { - emptyColumnNames = columnWrapper.combinedLabel; - break; + boolean hasEmptyError = requiredButEmptyCheck(isPrimaryTable, columnWrapper); + if (hasEmptyError) { + emptyColumnNames.add(columnWrapper.combinedLabel); + hasError = true; + continue; + } + + if (hasError) { + continue; } // "select", "radio" @@ -773,9 +780,15 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res columnWrapper.setCellContent(cellContent); // 必填检查 - if (hasError = requiredButEmptyCheck(isPrimaryTable, columnWrapper)) { - emptyColumnNames = columnWrapper.combinedLabel; - break; + boolean hasEmptyError = requiredButEmptyCheck(isPrimaryTable, columnWrapper); + if (hasEmptyError) { + emptyColumnNames.add(columnWrapper.combinedLabel); + hasError = true; + continue; + } + + if (hasError) { + continue; } if ("local".equals(columnWrapper.getOptionSourceType())) { @@ -821,36 +834,39 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } } } else if ("checkbox".equals(columnWrapper.getItemType())) { - //多选框没有具体的cellContent,因为多选框对应着excel的多列 + //多选框没有具体的cellContent,因为多选框对应着excel的多列。并且复选框,为空就是否,所以不需要做必填检查 String checkBoxColValue = getCheckBoxColValue(columnWrapper, row, checkBoxOptionColumnIdxAndLabel); columnWrapper.setColValue(checkBoxColValue); + + if (hasError) { + continue; + } } // 填了,但找不到对应数据的检查 - if (hasError = notFoundCheck(isPrimaryTable, columnWrapper)) { - notFoundColumnNames = columnWrapper.combinedLabel; - break; + boolean hasNotFoundError = notFoundCheck(isPrimaryTable, columnWrapper); + if (hasNotFoundError) { + notFoundColumnName = columnWrapper.combinedLabel; + hasError = true; } target2Insert.put(columnWrapper.columnName, columnWrapper.colValue); } - if (!hasError) { - return; - } + if (hasError) { + StringBuilder sb = new StringBuilder(); - StringBuilder sb = new StringBuilder(); + // 组织报错信息 + if (CollectionUtils.isNotEmpty(emptyColumnNames)) { + sb.append(String.join(",", emptyColumnNames)).append("的值未填写;"); + } - // 组织报错信息 - if (StringUtils.isNotBlank(emptyColumnNames)) { - sb.append(emptyColumnNames).append("的值未填写"); - } + if (StringUtils.isNotBlank(notFoundColumnName)) { + sb.append(notFoundColumnName).append("填写的值在系统中未找到"); + } - if (StringUtils.isNotBlank(notFoundColumnNames)) { - sb.append(notFoundColumnNames).append("填写的值在系统中未找到"); + throw new EpmetException(sb.toString()); } - - throw new EpmetException(sb.toString()); } /** From 5c91f43ab913bad26ac2279e423b7bf0b8b03518 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 14 Apr 2022 22:15:45 +0800 Subject: [PATCH 4/8] - --- epmet-user/epmet-user-server/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index b2f751c8b5..56b1318f64 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -303,7 +303,7 @@ 6379 EpmEtrEdIs!q@w - false + true 192.168.10.150:8848 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae From 23fecfa3a66a74cae424fef0509fb822f1d5edc4 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 15 Apr 2022 10:56:51 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=85=B7=E4=BD=93=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/ImportErrorMsgConstants.java | 14 ++++---- .../model/ImportBuildingInfoListener.java | 28 ++++++++-------- .../epmet/model/ImportHouseInfoListener.java | 32 ++++++++++--------- .../model/ImportNeighborHoodInfoListener.java | 22 ++++++------- 4 files changed, 51 insertions(+), 45 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java index be68d37843..ff66dcb167 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java @@ -9,14 +9,16 @@ public interface ImportErrorMsgConstants { String EXIST_ERROR = "数据已存在"; - String HOUSE_ERROR = "所属组织、所属网格、所属小区、所属楼栋、单元号、房屋类型、房屋用途、出租的值未填写,或者所填写信息在系统中未找到"; + String DOCUMENT_EXIST_ERROR = "文件中存在重复数据"; - String BUILDING_ERROR = "所属组织、所属网格、所属小区、楼栋类型、单元数的值未填写,或者所填写信息在系统中未找到"; + String BELONG_GRID_ERROR = "所属网格的值未填写或者所填写信息在系统中未找到"; - String NEIGHBOR_HOOD_ERROR = "所属组织、所属网格、详细地址的值未填写,或者所填写信息在系统中未找到"; + String BELONG_AGENCY_ERROR = "所属组织的值未填写或者所填写信息在系统中未找到"; - String HOUSE_ERROR_NAME = "导入失败的列表-房屋"; - String BUILDING_ERROR_NAME = "导入失败的列表-楼宇"; - String NEIGHBORHOOD_ERROR_NAME = "导入失败的列表-小区"; + String HOUSE_TYPE_ERROR = "房屋类型的值未填写或者所填写信息在系统中未找到"; + + String BUILDING_TYPE_ERROR = "楼栋类型的值未填写或者所填写信息在系统中未找到"; + + String NEIGHBORHOOD_TYPE_ERROR = "小区名称的值未填写或者所填写信息在系统中未找到"; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java index 7451f1f996..47681e15d1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java @@ -30,6 +30,8 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import static com.epmet.constant.ImportErrorMsgConstants.*; + /** * @Author zxc * @DateTime 2022/2/15 10:06 上午 @@ -117,7 +119,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener Date: Fri, 15 Apr 2022 16:52:38 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=A5=BC=E6=A0=8B=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=95=B0=E6=97=B6=EF=BC=8C=E4=BB=8E=E5=A4=B4?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E6=96=B0=E5=A2=9E=E5=8D=95=E5=85=83=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=8E=9F=E5=85=88=E5=B7=B2=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E7=95=A5=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/dto/result/OptionResultDTO.java | 1 + .../service/impl/BuildingServiceImpl.java | 20 ++++++++++++------- .../impl/IcBuildingUnitServiceImpl.java | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java index 8c42570bc3..95741eb813 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java @@ -14,6 +14,7 @@ import java.util.List; public class OptionResultDTO implements Serializable { private static final long serialVersionUID = 8618231166600518980L; private String label; + private String code; private String value; private String pValue; private String sysDictDataId; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java index 04670fde28..3511bfc536 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java @@ -12,6 +12,7 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; @@ -537,14 +538,19 @@ public class BuildingServiceImpl implements BuildingService { Integer unit = icBuilding.getTotalUnitNum(); if(nowUnit>=unit){ //新增单元 + List units = icBuildingUnitService.getUnitOptions(icBuilding.getId()); + Map unitMap = units.stream().collect(Collectors.toMap(OptionResultDTO::getCode, OptionResultDTO::getLabel)); List unitList = new ArrayList<>(); - for(int i =unit ;i { OptionResultDTO dto = new OptionResultDTO(); dto.setValue(item.getId()); + dto.setCode(item.getUnitNum()); dto.setLabel(item.getUnitName()); return dto; }).collect(Collectors.toList()); From 9a2e8b31f8ce34fb21e19af26e2c6d88590e7ce9 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 15 Apr 2022 18:23:29 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=95=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BuildingServiceImpl.java | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java index 3511bfc536..58aa913cec 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java @@ -14,6 +14,7 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; @@ -536,30 +537,26 @@ public class BuildingServiceImpl implements BuildingService { //如果楼宇单元大于之前的楼宇单元,新增单元 Integer nowUnit= formDTO.getTotalUnitNum(); Integer unit = icBuilding.getTotalUnitNum(); - if(nowUnit>=unit){ - //新增单元 - List units = icBuildingUnitService.getUnitOptions(icBuilding.getId()); - Map unitMap = units.stream().collect(Collectors.toMap(OptionResultDTO::getCode, OptionResultDTO::getLabel)); - List unitList = new ArrayList<>(); - for(int i = 1 ;i units = icBuildingUnitService.getUnitOptions(icBuilding.getId()); + Map unitMap = units.stream().collect(Collectors.toMap(OptionResultDTO::getCode, OptionResultDTO::getLabel)); + List unitList = new ArrayList<>(); + for (int i = 1; i <= nowUnit; i++) { + String unitNum = String.valueOf(i); + if (!unitMap.containsKey(unitNum)) { + IcBuildingUnitEntity icBuildingUnit = new IcBuildingUnitEntity(); + icBuildingUnit.setBuildingId(icBuilding.getId()); + icBuildingUnit.setCustomerId(customerId); + icBuildingUnit.setUnitName(unitNum + "单元"); + icBuildingUnit.setUnitNum(unitNum); + unitList.add(icBuildingUnit); + } + } + icBuildingUnitService.insertBatch(unitList); } /** From 5509da011a0251c58446f3454dd9f9524d0729a6 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 15 Apr 2022 18:35:19 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/BuildingServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java index 58aa913cec..cadad656c8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java @@ -539,7 +539,7 @@ public class BuildingServiceImpl implements BuildingService { Integer unit = icBuilding.getTotalUnitNum(); if(nowUnit units = icBuildingUnitService.getUnitOptions(icBuilding.getId());