diff --git a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java index 93e5c658..dc334a94 100644 --- a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java +++ b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java @@ -320,8 +320,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)); @@ -337,6 +347,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()));