diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 161c9cd9ef..f84dfde45f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -32,7 +32,9 @@ public enum EpmetErrorCode { NOT_DEL_AGENCY_PER(8205, "该机关存在工作人员,不允许删除"), NOT_DEL_DEPARTMENT(8206, "该部门存在工作人员,不允许删除"), - REQUIRE_PERMISSION(8301, "没有足够的操作权限"); + REQUIRE_PERMISSION(8301, "没有足够的操作权限"), + + NOT_ADD_GRID(8401,"您当前的网格名称已存在,请重新修改"); private int code; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java index 2c5556f7a3..b22e5048f9 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java @@ -18,6 +18,11 @@ public class EditGridFormDTO implements Serializable { */ private String gridId; + /** + * pid 当前机关id + */ + private String agencyId; + /** * 网格名称 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index a43d3e56ae..11fb36a5fc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -110,7 +110,7 @@ public interface CustomerGridDao extends BaseDao { * @param gridName * @return */ - String selectGridIdByGridName(@Param("gridName")String gridName); + String selectGridIdByGridName(@Param("gridName")String gridName,@Param("agencyId")String pid); /** * 编辑网格信息 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 00db15a6bd..f783b6c336 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -186,6 +186,10 @@ public class CustomerGridServiceImpl extends BaseServiceImpl addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO) { + String checkGridName = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName(),addGridFormDTO.getAgencyId()); + if (checkGridName!=null){ + return new Result().error(EpmetErrorCode.NOT_ADD_GRID.getCode()); + } CustomerGridEntity customerGridEntity = new CustomerGridEntity(); customerGridEntity.setCustomerId(baseDao.selectCustomerIdByUserId(tokenDto.getUserId())); customerGridEntity.setGridName(addGridFormDTO.getGridName()); @@ -197,7 +201,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(addGridResultDTO); @@ -211,6 +215,10 @@ public class CustomerGridServiceImpl extends BaseServiceImpl