瀏覽代碼

Merge branch 'crm/13.9' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 1 年之前
父節點
當前提交
b69fd7abe4
共有 1 個文件被更改,包括 17 次插入6 次删除
  1. 17 6
      controllers/statistic_report.go

+ 17 - 6
controllers/statistic_report.go

@@ -3405,6 +3405,8 @@ func (this *StatisticReportController) IncrementalCompanyList() {
 		condition += ` and b.company_name like "%` + keyword + `%" `
 	}
 
+	var conditionAscribRai string // 处理权益未续约客户检索列表SQL查询条件
+	var parsAscribeRai []interface{}
 	//是否确认续约 CRM 13.9
 	if isConfirm != -1 {
 		var conditionConfirm string
@@ -3425,11 +3427,11 @@ func (this *StatisticReportController) IncrementalCompanyList() {
 			}
 		}
 		if isConfirm == 0 {
-			condition += ` AND c.company_id NOT IN (` + utils.GetOrmInReplace(len(companyIds)) + `)` // 待确认
+			conditionAscribRai += ` AND c.company_id NOT IN (` + utils.GetOrmInReplace(len(companyIds)) + `)` // 待确认
 		} else {
-			condition += ` AND c.company_id IN (` + utils.GetOrmInReplace(len(companyIds)) + `)` // 已确认
+			conditionAscribRai += ` AND c.company_id IN (` + utils.GetOrmInReplace(len(companyIds)) + `)` // 已确认
 		}
-		pars = append(pars, companyIds)
+		parsAscribeRai = append(parsAscribeRai, companyIds)
 	}
 
 	//归因ID CRM 13.9
@@ -3452,9 +3454,10 @@ func (this *StatisticReportController) IncrementalCompanyList() {
 				companyIds = append(companyIds, v.CompanyId)
 			}
 		}
-		condition += ` AND c.company_id IN (` + utils.GetOrmInReplace(len(companyIds)) + `)`
-		pars = append(pars, companyIds)
+		conditionAscribRai += ` AND c.company_id IN (` + utils.GetOrmInReplace(len(companyIds)) + `)`
+		parsAscribeRai = append(parsAscribeRai, companyIds)
 	}
+
 	switch companyType {
 	case "ficc":
 		condition += ` AND c.product_id = ? `
@@ -3752,7 +3755,15 @@ func (this *StatisticReportController) IncrementalCompanyList() {
 			//	br.ErrMsg = "获取失败,Err:" + err.Error()
 			//	return
 			//}
-
+			condition1 += conditionAscribRai
+			pars1 = append(pars1, parsAscribeRai)
+			//分页total单独计算
+			total, err = models.GetIncrementalCompanyProductCountByOperationRecord(condition1, pars1)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取失败"
+				br.ErrMsg = "获取失败,Err:" + err.Error()
+				return
+			}
 			//列表页数据
 			tmpList, err := models.GetIncrementalCompanyListByOperationRecord(condition1, pars1, startSize, pageSize)
 			if err != nil {