瀏覽代碼

Merge branch 'crm/crm_16.7' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

zhangchuanxing 1 月之前
父節點
當前提交
8dc6d438e5
共有 1 個文件被更改,包括 19 次插入3 次删除
  1. 19 3
      controllers/statistic/rai_data_summary.go

+ 19 - 3
controllers/statistic/rai_data_summary.go

@@ -643,6 +643,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 		for _, Dv := range dataTypeArr {
 			item := new(statistic_report.RaiDataSummaryResp)
 			item.DataType = fmt.Sprint(i, Dv)
+			keyMapTtoal = fmt.Sprint(item.DataType, "_Develop")
 			keyMapTtoalServer = fmt.Sprint(item.DataType, "_Server_")
 			var sellerIds []string
 			var sellerServiceIds []string
@@ -894,6 +895,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 // @Param   SellerId   query   int  true       "销售ID"
 // @Param   DataType   query   string  false       "报表类型,枚举值:`季度`,`年度`,`半年度`"
 // @Param   PopupType   query   string	  false       "弹窗数据类型,枚举值:"
+// @Param   IsServerSeller   query   bool	  false       "是否属于服务组销售"
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Success 200 {object} statistic_report.RaiDataSummaryPopupTypeResp
@@ -917,6 +919,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
 	dataType := this.GetString("DataType")
 	sellerId := this.GetString("SellerId")
 	popupType := this.GetString("PopupType")
+	isServerSeller, _ := this.GetBool("IsServerSeller")
 
 	var startSize int
 	if pageSize <= 0 {
@@ -1087,7 +1090,12 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
 	case "到期合同":
 
 		if sellerId != "" {
-			condition += ` AND a.seller_id_last  IN (` + sellerId + `) `
+			if isServerSeller {
+				condition += ` AND a.share_seller_id_last  IN (` + sellerId + `) `
+			} else {
+				condition += ` AND a.seller_id_last  IN (` + sellerId + `) `
+			}
+
 		}
 
 		condition += ` AND  a.status = 1  AND a.end_date >= ?  AND a.end_date <= ?   AND a.end_date < ? `
@@ -1141,7 +1149,11 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
 
 	case "续约合同":
 		if sellerId != "" {
-			condition += ` AND a.seller_id_last  IN (` + sellerId + `) `
+			if isServerSeller {
+				condition += ` AND a.share_seller_id_last  IN (` + sellerId + `) `
+			} else {
+				condition += ` AND a.seller_id_last  IN (` + sellerId + `) `
+			}
 		}
 
 		condition += ` AND  a.status = 1  AND a.inherit_end_date >= ?  AND a.inherit_end_date <= ?  AND  a.inherit_company_contract_id > 0  AND a.rai_contract_type = '续约合同'  AND a.company_id NOT  IN (` + utils.GetOrmInReplace(lenArrCompany) + `)  `
@@ -1282,7 +1294,11 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
 		condition += ` AND  a.company_contract_id IN (` + utils.GetOrmInReplace(len(noRenewedcompanyContractIds)) + `)  ` // 已确认
 		pars = append(pars, noRenewedcompanyContractIds)
 		if sellerId != "" {
-			condition += ` AND a.seller_id_last  IN (` + sellerId + `) `
+			if isServerSeller {
+				condition += ` AND a.share_seller_id_last  IN (` + sellerId + `) `
+			} else {
+				condition += ` AND a.seller_id_last  IN (` + sellerId + `) `
+			}
 		}
 		condition += ` AND  a.product_id = 2  AND  a.status = 1  AND a.end_date >= ?  AND a.end_date <= ?  AND a.end_date <= ?  `
 		pars = append(pars, startDate, endDate, time.Now().Format(utils.FormatDate))