Browse Source

处理协单需要新增的问题

anderx 9 months ago
parent
commit
5842c9b533

+ 2 - 9
src/main/java/com/goafanti/common/dao/OrganizationIdentityMapper.java

@@ -1,14 +1,7 @@
 package com.goafanti.common.dao;
 
 import com.goafanti.common.model.OrganizationIdentity;
-import com.goafanti.user.bo.AuditorOrgIdentityDetailBo;
-import com.goafanti.user.bo.InputUserChannel;
-import com.goafanti.user.bo.OrgBasicInfoBo;
-import com.goafanti.user.bo.OrgIdentityBo;
-import com.goafanti.user.bo.OrgIdentityDetailBo;
-import com.goafanti.user.bo.OrgUnitNames;
-
-import java.util.List;
+import com.goafanti.user.bo.*;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -48,5 +41,5 @@ public interface OrganizationIdentityMapper {
 
     void insertBatch(List<InputUserChannel> list);
 
-    OrganizationIdentity selectByOrgCode(String orgCode);
+    List<OrganizationIdentity> selectByOrgCode(String orgCode);
 }

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

@@ -1706,9 +1706,19 @@ public class AdminCustomerApiController extends BaseApiController{
 	@PostMapping("/updateAndReceiveCustomer")
 	public Result updateAndReceiveCustomer(InputUpdateAndReceiveCustomer in) {
 		Result res = new Result();
+		if (in.getOrgCode()!=null){
+			in.setOrgCode(in.getOrgCode().trim());
+			if (customerService.checkOrgCode(in.getOrgCode())){
+				res.getError().add(buildError("","统一信用代码已存在"));
+				return res;
+			}
+		}
+		Result result = receiveCustomer(in.getId(), null);
+		res.getError().addAll(result.getError());
+		if (!res.getError().isEmpty()){
+			return res;
+		}
 		customerService.updateAndReceiveCustomer(in);
-		receiveCustomer( in.getId(), null);
-		res.setData(1);
 		return res;
 	}
 }

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

@@ -1540,8 +1540,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 
 	@Override
 	public boolean checkOrgCode(String orgCode) {
-		OrganizationIdentity organizationIdentity = organizationIdentityMapper.selectByOrgCode(orgCode);
-		if (organizationIdentity!=null)return true;
+		List<OrganizationIdentity> list = organizationIdentityMapper.selectByOrgCode(orgCode);
+		if (!list.isEmpty())return true;
 		return false;
 	}