ziwen 1 year ago
parent
commit
f13da3e0fe
1 changed files with 9 additions and 3 deletions
  1. 9 3
      services/crm/company_seller.go

+ 9 - 3
services/crm/company_seller.go

@@ -2,6 +2,7 @@ package crm
 
 import (
 	"errors"
+	"fmt"
 	"hongze/fms_api/models/crm"
 )
 
@@ -126,6 +127,7 @@ func GetSellerDepartmentList() (resp crm.SellerAdminWithGroupList, err error) {
 	}
 
 	// 销售列表
+	departmentMap := make(map[int][]crm.SellerAdminWithGroupTree)
 	groupSeller := make(map[int][]crm.SellerAdminWithGroupTree)
 	ficcList := make([]crm.SellerAdminList, 0)
 	raiList := make([]crm.SellerAdminList, 0)
@@ -148,6 +150,7 @@ func GetSellerDepartmentList() (resp crm.SellerAdminWithGroupList, err error) {
 				}
 				groupSeller[g.GroupId] = append(groupSeller[g.GroupId], tmp)
 			}else{
+				fmt.Println("adminList[i]:",adminList[i].AdminId)
 				err = errors.New("找不到对应的销售分组")
 				return
 			}
@@ -160,13 +163,16 @@ func GetSellerDepartmentList() (resp crm.SellerAdminWithGroupList, err error) {
 				}
 				groupSeller[g.GroupId] = append(groupSeller[g.GroupId], tmp)
 			}else{
-				err = errors.New("找不到对应的销售分组")
-				return
+				tmp := crm.SellerAdminWithGroupTree{
+					SellerId:    adminList[i].AdminId,
+					SellerName:  adminList[i].RealName,
+					Child: nil,
+				}
+				departmentMap[adminList[i].DepartmentId] = append(departmentMap[adminList[i].DepartmentId], tmp)
 			}
 		}
 	}
 	//分组
-	departmentMap := make(map[int][]crm.SellerAdminWithGroupTree)
 	for k, v := range groupMap {
 		child, _ := groupSeller[k]
 		tmp := crm.SellerAdminWithGroupTree{