Browse Source

Merge branch 'pool_603'

ziwen 1 year ago
parent
commit
ed1e129c1d
2 changed files with 12 additions and 6 deletions
  1. 2 2
      controller/census/seller.go
  2. 10 4
      services/crm/company_seller.go

+ 2 - 2
controller/census/seller.go

@@ -223,9 +223,9 @@ func (ct *SellerController) InvoiceList(c *gin.Context) {
 		return
 	}
 	pars := make([]interface{}, 0)
-	outCond := ` a.department_id = %d AND a.enabled = 1 `
+	outCond := ` a.department_id = %d `
 	outCond = fmt.Sprintf(outCond, departmentId)
-	totalCond := ` department_id = %d AND enabled = 1 `
+	totalCond := ` department_id = %d `
 	totalCond = fmt.Sprintf(totalCond, departmentId)
 	totalPars := make([]interface{}, 0)
 	if req.GroupId > 0 {

+ 10 - 4
services/crm/company_seller.go

@@ -2,6 +2,7 @@ package crm
 
 import (
 	"errors"
+	"fmt"
 	"hongze/fms_api/models/crm"
 )
 
@@ -115,7 +116,7 @@ func GetSellerDepartmentList() (resp crm.SellerAdminWithGroupList, err error) {
 	}
 
 	// 获取销售部门所有销售信息
-	adminCond := "department_id in (?) AND enabled = 1"
+	adminCond := "department_id in (?) "
 	adminPars := make([]interface{}, 0)
 	adminPars = append(adminPars, departmentIds)
 	adminOB := new(crm.Admin)
@@ -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{