Browse Source

代码优化开发20211128_2

MSY 3 years ago
parent
commit
77200da02a

+ 21 - 10
src/main/java/com/jkcredit/invoice/controller/localBussiness/CustomerController.java

@@ -191,6 +191,7 @@ public class CustomerController {
     @LoginRequired
     public RespR customeRecQueryUpper(@RequestBody  CustomerRec customerRec) {
         RespR<List<B2bCompanyModel>> respR = customerService.customerRecQuery(customerRec);
+
         if(respR.getCode() == 1){
             return respR;
         }else{
@@ -198,19 +199,29 @@ public class CustomerController {
             if(resArr == null || resArr.size() == 0){
                 return new RespR(false,"未注册,无法回填");
             }else {
-                B2bCompanyModel b2bCompanyModel = resArr.get(0);
-                customerRec.setCompanyType(b2bCompanyModel.getCompanyType());
-                customerRec.setOperatingRangeType(b2bCompanyModel.getOperatingRangeType());
-                customerRec.setCompanyLeader(b2bCompanyModel.getContact());
-                customerRec.setCompanyLeaderPhone(b2bCompanyModel.getEmergencyTel());
-                customerRec.setCompanyAdress(b2bCompanyModel.getBuyerAddr());
-                customerRec.setCompanyPhone(b2bCompanyModel.getBuyerTel());
-                customerRec.setCompanyOpenbank(b2bCompanyModel.getBuyerBank());
-                customerRec.setCompanyOpenbankAcc(b2bCompanyModel.getBuyerBankAccount());
-                customerRec.setCompanyPhone(b2bCompanyModel.getTel());
+
+                if(resArr.size()>=1){
+                    resArr.forEach(b2bCompanyModel->{
+                        if(b2bCompanyModel.getCompanyType().equals(customerRec.getCompanyType())){
+                            customerRec.setCompanyType(b2bCompanyModel.getCompanyType());
+                            customerRec.setOperatingRangeType(b2bCompanyModel.getOperatingRangeType());
+                            customerRec.setCompanyLeader(b2bCompanyModel.getContact());
+                            customerRec.setCompanyLeaderPhone(b2bCompanyModel.getEmergencyTel());
+                            customerRec.setCompanyAdress(b2bCompanyModel.getBuyerAddr());
+                            customerRec.setCompanyPhone(b2bCompanyModel.getBuyerTel());
+                            customerRec.setCompanyOpenbank(b2bCompanyModel.getBuyerBank());
+                            customerRec.setCompanyOpenbankAcc(b2bCompanyModel.getBuyerBankAccount());
+                            customerRec.setCompanyPhone(b2bCompanyModel.getTel());
+
+                        }
+                    });
+                }
+
                 return new RespR(customerRec);
             }
         }
+
+
     }