Browse Source

信用代码处理

anderx 9 months ago
parent
commit
230738905b

+ 2 - 2
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -1497,7 +1497,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		Result res = new Result();
 		if (in.getOrgCode()!=null){
 			in.setOrgCode(in.getOrgCode().trim());
-			if (customerService.checkOrgCode(in.getOrgCode())){
+			if (customerService.checkOrgCode(in.getOrgCode(),in.getUid())){
 				res.getError().add(buildError("","统一信用代码已存在"));
 				return res;
 			}
@@ -1708,7 +1708,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		Result res = new Result();
 		if (in.getOrgCode()!=null){
 			in.setOrgCode(in.getOrgCode().trim());
-			if (customerService.checkOrgCode(in.getOrgCode())){
+			if (customerService.checkOrgCode(in.getOrgCode(),in.getId())){
 				res.getError().add(buildError("","统一信用代码已存在"));
 				return res;
 			}

+ 3 - 1
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -556,7 +556,9 @@ public interface CustomerService {
 
     int pushReceiveAsChannel(String uid);
 
-    boolean checkOrgCode(String orgCode);
+    boolean checkOrgCode(String orgCode,String aid);
+
+	boolean checkOrgCode(String orgCode);
 
     Integer queryUserMax();
 

+ 13 - 3
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -1537,11 +1537,21 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		userMapper.update(u);
 		return 1;
 	}
-
-	@Override
 	public boolean checkOrgCode(String orgCode) {
+		return checkOrgCode( orgCode, null);
+	}
+	@Override
+	public boolean checkOrgCode(String orgCode,String uid) {
 		List<OrganizationIdentity> list = organizationIdentityMapper.selectByOrgCode(orgCode);
-		if (!list.isEmpty())return true;
+		if (!list.isEmpty()){
+			if(list.size()==1&&uid!=null){
+				OrganizationIdentity organizationIdentity = list.get(0);
+				if (organizationIdentity.getUid().equals(uid)){
+					return false;
+				}
+			}
+			return true;
+		}
 		return false;
 	}