zwxi 1 年之前
父節點
當前提交
32c17c8538
共有 2 個文件被更改,包括 40 次插入41 次删除
  1. 40 40
      controller/census/seller.go
  2. 0 1
      models/fms/contract_invoice.go

+ 40 - 40
controller/census/seller.go

@@ -449,14 +449,6 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
 		page.SetCurrent(1)
 	}
 
-	//if req.SellerIds != "" {
-	//	sellerIds := strings.Split(req.SellerIds, ",")
-	//	cond += ` AND (a.seller_id in ? ) `
-	//	historyCond += ` AND (seller_id in ? ) `
-	//	pars = append(pars, sellerIds)
-	//	historyPars = append(historyPars, sellerIds)
-	//}
-
 	var departmentId int
 	if req.SellerType == 1 {
 		departmentId = crm.SellerDepartmentId
@@ -498,28 +490,36 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
 		historyCond += ` AND new_company = 0 `
 	}
 
-	groupIds := make([]int, 0)
-	if req.GroupId > 0 {
-		// 筛选组别时, 查询当前组别的下级组(因为admin表存的group_id, 有三级的存的是子ID, 只有二级的存的才是父ID =_=!)
-		groupCond := `parent_id = ?`
-		groupPars := make([]interface{}, 0)
-		groupPars = append(groupPars, req.GroupId)
-		groupOB := new(crm.SysGroup)
-		groupList, e := groupOB.List(groupCond, groupPars)
-		if e != nil {
-			resp.FailMsg("获取失败", "获取组别下级组列表失败, Err: "+e.Error(), c)
-			return
-		}
-		groupIds = append(groupIds, req.GroupId)
-		for i := range groupList {
-			groupIds = append(groupIds, groupList[i].GroupId)
-		}
-		cond += ` AND (c.seller_group_id IN (?) OR d.seller_group_id IN (?))`
-		pars = append(pars, groupIds, groupIds)
-		historyCond += ` AND group_id IN (?) `
-		historyPars = append(historyPars, groupIds)
+	if req.SellerIds != "" {
+		sellerIds := strings.Split(req.SellerIds, ",")
+		cond += ` AND (a.seller_id in ? ) `
+		historyCond += ` AND (seller_id in ? ) `
+		pars = append(pars, sellerIds)
+		historyPars = append(historyPars, sellerIds)
 	}
 
+	//groupIds := make([]int, 0)
+	//if req.GroupId > 0 {
+	//	// 筛选组别时, 查询当前组别的下级组(因为admin表存的group_id, 有三级的存的是子ID, 只有二级的存的才是父ID =_=!)
+	//	groupCond := `parent_id = ?`
+	//	groupPars := make([]interface{}, 0)
+	//	groupPars = append(groupPars, req.GroupId)
+	//	groupOB := new(crm.SysGroup)
+	//	groupList, e := groupOB.List(groupCond, groupPars)
+	//	if e != nil {
+	//		resp.FailMsg("获取失败", "获取组别下级组列表失败, Err: "+e.Error(), c)
+	//		return
+	//	}
+	//	groupIds = append(groupIds, req.GroupId)
+	//	for i := range groupList {
+	//		groupIds = append(groupIds, groupList[i].GroupId)
+	//	}
+	//	cond += ` AND (c.seller_group_id IN (?) OR d.seller_group_id IN (?))`
+	//	pars = append(pars, groupIds, groupIds)
+	//	historyCond += ` AND group_id IN (?) `
+	//	historyPars = append(historyPars, groupIds)
+	//}
+
 	if req.CompanyType == 1 {
 		cond += ` AND b.contract_type = 1 `
 		historyCond += ` AND new_company = 1 `
@@ -560,10 +560,10 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
 			amountCond := `a.id IN ? `
 			amountPars := make([]interface{}, 0)
 			amountPars = append(amountPars, summaryIds)
-			if len(groupIds) > 0 {
-				amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
-				amountPars = append(amountPars, groupIds)
-			}
+			//if len(groupIds) > 0 {
+			//	amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
+			//	amountPars = append(amountPars, groupIds)
+			//}
 
 			if req.SellerIds != "" {
 				sellerIds := strings.Split(req.SellerIds, ",")
@@ -645,10 +645,10 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
 			amountCond := `a.id IN ? `
 			amountPars := make([]interface{}, 0)
 			amountPars = append(amountPars, summaryIds)
-			if len(groupIds) > 0 {
-				amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
-				amountPars = append(amountPars, groupIds)
-			}
+			//if len(groupIds) > 0 {
+			//	amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
+			//	amountPars = append(amountPars, groupIds)
+			//}
 			if req.SellerIds != "" {
 				sellerIds := strings.Split(req.SellerIds, ",")
 				amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
@@ -743,10 +743,10 @@ func (this *SellerController) InvoiceListV2(c *gin.Context) {
 			amountCond := `a.id IN ? `
 			amountPars := make([]interface{}, 0)
 			amountPars = append(amountPars, summaryIds)
-			if len(groupIds) > 0 {
-				amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
-				amountPars = append(amountPars, groupIds)
-			}
+			//if len(groupIds) > 0 {
+			//	amountCond += ` AND IF ( a.invoice_id = 0, d.seller_group_id, b.seller_group_id ) IN (?) `
+			//	amountPars = append(amountPars, groupIds)
+			//}
 			if req.SellerIds != "" {
 				sellerIds := strings.Split(req.SellerIds, ",")
 				amountCond += ` AND (( b.seller_id IN ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`

+ 0 - 1
models/fms/contract_invoice.go

@@ -444,7 +444,6 @@ func GetCensusSellerGroupInvoicePageList(page base.IPage, condition, outCond str
 
 // CensusSellerInvoiceListReq 销售开票统计列表请求体
 type CensusSellerInvoiceListReq struct {
-	GroupId     int    `json:"group_id" form:"group_id" description:"销售组别ID"`
 	SellerIds   string `json:"seller_ids" form:"seller_ids" description:"销售IDs"`
 	StartDate   string `json:"start_date" form:"start_date" binding:"omitempty,datetime=2006-01-02" description:"开始日期"`
 	EndDate     string `json:"end_date" form:"end_date" binding:"omitempty,datetime=2006-01-02" description:"结束日期"`