From b85a33b2294e66c0cf87846f24d7d52417eac7ef Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Sun, 26 Apr 2020 13:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=90=8D=E7=A7=B0=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/exception/EpmetErrorCode.java | 4 +++- .../main/java/com/epmet/dto/form/EditGridFormDTO.java | 5 +++++ .../src/main/java/com/epmet/dao/CustomerGridDao.java | 2 +- .../epmet/service/impl/CustomerGridServiceImpl.java | 10 +++++++++- .../src/main/resources/mapper/CustomerGridDao.xml | 1 + 5 files changed, 19 insertions(+), 3 deletions(-) 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