From 2b5acfeb32107cd4f11663931fe3fd1042b9ce55 Mon Sep 17 00:00:00 2001 From: Mlin Date: Fri, 13 Jan 2023 18:40:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=B1=E5=90=8D=E5=86=8C=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=AE=A1=E7=90=86bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/HrmResourceServiceImpl.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java index ef8f8b52..471e54cf 100644 --- a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java +++ b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java @@ -316,8 +316,18 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic public Integer updateCustomTemplate(Map params) { int rowNum = Util.getIntValue((String) params.get("rownum")); int count = 0; - List allIds = MapperProxyFactory.getProxy(JclOrgCustomTemplateMapper.class).listAllId(); + List allIds = getJclOrgCustomTemplateMapper().listAllId(); String currentDate = OrganizationDateUtil.getFormatLocalDate(new java.util.Date()); + List nameList = new ArrayList<>(); + for (int i = 0; i < rowNum; i++) { + String recordIndex = "_" + i; + String name = Util.null2String(params.get("name" + recordIndex)); + if (StringUtils.isNotBlank(name)) { + nameList.add(name); + } + } + + OrganizationAssert.isFalse(new HashSet<>(nameList).size() < nameList.size(), "模板名称不能重复"); for (int i = 0; i < rowNum; i++) { String recordIndex = "_" + i; String id = Util.null2String(params.get("id" + recordIndex)); @@ -333,6 +343,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic allIds.remove(jclId); } else { //插入 + OrganizationAssert.isFalse("".equals(name), "模板名称不能为空"); jclOrgCustomTemplatePO.setName(name); jclOrgCustomTemplatePO.setCreator(user.getUID()); jclOrgCustomTemplatePO.setCreateTime(new java.sql.Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));