Browse Source

fix(水务版Spring17): 客户管理添加名称重复提示

chenlong 4 years ago
parent
commit
063cc403d3

+ 2 - 3
smart-city-platform/src/main/java/com/bz/smart_city/commom/model/ResultStatus.java

@@ -83,9 +83,8 @@ public enum ResultStatus {
     PAY_ADD_CUSTOMER_ERR(-721,"添加开户失败"),
     PAY_ADD_CUSTOMER_UPDATEAMOUNT(-722,"添加开户失败,计算阶梯可用量有误"),
     WATER_PROPERTY_CHENCK_NAME(-723,"该名称已经存在,请修改"),
-    ACCOUNT_OPERATOR_EERROR(-724,"操作员信息异常")
-
-    ;
+    ACCOUNT_OPERATOR_EERROR(-724,"操作员信息异常"),
+    CUSTOMER_IS_EXISTED(-3001,"客户名称已存在");
 
     private final int status;
 

+ 3 - 2
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/CustomerServiceImpl.java

@@ -2,6 +2,7 @@ package com.bz.smart_city.service.impl;
 
 import com.bz.smart_city.commom.exception.ServiceException;
 import com.bz.smart_city.commom.model.Pagination;
+import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.commom.util.TreeUtil;
 import com.bz.smart_city.commom.util.UserUtil;
 import com.bz.smart_city.commom.util.Util;
@@ -133,7 +134,7 @@ public class CustomerServiceImpl implements CustomerService {
         customerDto.setCustomerNo(customerNo);
         int resultName = customerMapper.findByNameUnique(loginUser.getSiteId(),null, customerDto.getCustomerName());
         if(resultName > 0) {
-            throw new ServiceException(-900, "客户名称已经存在");
+            throw new ServiceException(ResultStatus.CUSTOMER_IS_EXISTED);
         }
         this.insertSelective(customerDto);
 
@@ -149,7 +150,7 @@ public class CustomerServiceImpl implements CustomerService {
         LoginUser loginUser = UserUtil.getCurrentUser();
         int resultName = customerMapper.findByNameUnique(loginUser.getSiteId(), customer.getId(), customer.getCustomerName());
         if(resultName > 0) {
-            throw new ServiceException(-900, "客户名称已经存在");
+            throw new ServiceException(ResultStatus.CUSTOMER_IS_EXISTED);
         }
         Integer oldParentId = customerMapper.findById(customer.getId()).getParentId();
         this.updateByPrimaryKeySelective(customer);