Browse Source

feat:xiugai

wangchuanjin 9 months ago
parent
commit
cf69a1b7fe
1 changed files with 4 additions and 4 deletions
  1. 4 4
      api/internal/service/network.go

+ 4 - 4
api/internal/service/network.go

@@ -1314,7 +1314,7 @@ func (n *network) BuyerProjectInfoBatch(ids []string, businessType []string, vm
 		return
 	}
 	wh, args := WhArgs(ids)
-	q := `select buyer_id,count(DISTINCT project_id) AS project_count,sum(project_money) AS project_amount,groupUniqArray(project_id) from information.transaction_info_all prewhere buyer_id in (` + wh + `) and zbtime>? and project_bidstatus>1`
+	q := `select buyer_id,uniqCombined(project_id) AS project_count,sum(project_money) AS project_amount,groupUniqArray(project_id) from information.transaction_info_all prewhere buyer_id in (` + wh + `) and zbtime>? and project_bidstatus>1`
 	args = append(args, NetworkCom.ProjectYearLimit())
 	if len(businessType) > 0 {
 		newWh, newArgs := WhArgs(businessType)
@@ -1365,7 +1365,7 @@ func (n *network) TjProject(agencyIds, winnerIds []string, vbs map[string][]*idN
 	}
 	yearLimit := NetworkCom.ProjectYearLimit()
 	allArgs := []interface{}{}
-	q := `select buyer_id,count(DISTINCT project_id) AS project_count,sum(project_money) AS project_amount,groupUniqArray(project_id) from information.transaction_info_all prewhere buyer_id in (select DISTINCT buyer_id from information.transaction_info_all prewhere `
+	q := `select buyer_id,uniqCombined(project_id) AS project_count,sum(project_money) AS project_amount,groupUniqArray(project_id) from information.transaction_info_all prewhere buyer_id in (select DISTINCT buyer_id from information.transaction_info_all prewhere `
 	if len(agencyIds) > 0 {
 		wh, args := WhArgs(agencyIds)
 		allArgs = append(allArgs, args...)
@@ -1451,8 +1451,8 @@ func (n *network) MakeProjectInfo(agencyIds, winnerIds []string, vbs map[string]
 
 func (n *network) AllIntroduceOwner(positionId int64, sqlAppend1, sqlAppend2 string, args []interface{}, isTjProject bool, businessType []string) *introduceOwnerProject {
 	logx.Info(positionId, " AllIntroduceOwner start 。。。")
-	q := `select a.id,a.company_id,a.company_name,a.qyxy_id,a.itype,a.contact_person as person,a.contact_phone as phone,count(DISTINCT if(b.itype=1,b.relate_id,null)) as buyer_count,count(DISTINCT if(b.itype=2,b.relate_id,null)) as project_count,GROUP_CONCAT(IF(b.itype=1,b.relate_id,NULL)) AS relate_buyer_id,GROUP_CONCAT(IF(b.itype=1,b.relate_name,NULL)) AS relate_buyer_name,GROUP_CONCAT(IF(b.itype=2,b.relate_id,NULL)) AS relate_project_id,a.create_time from crm.connection a 
-		left join crm.connection_introduce b on (a.position_id=? and b.position_id=? and a.id=b.connection_id) prewhere a.position_id=?` + sqlAppend1 + ` GROUP BY a.id order by a.create_time desc` + sqlAppend2
+	q := `select a.id,a.company_id,a.company_name,a.qyxy_id,a.itype,a.contact_person as person,a.contact_phone as phone,uniqCombined(if(b.itype=1,b.relate_id,null)) as buyer_count,uniqCombined(if(b.itype=2,b.relate_id,null)) as project_count,GROUP_CONCAT(IF(b.itype=1,b.relate_id,NULL)) AS relate_buyer_id,GROUP_CONCAT(IF(b.itype=1,b.relate_name,NULL)) AS relate_buyer_name,GROUP_CONCAT(IF(b.itype=2,b.relate_id,NULL)) AS relate_project_id,a.create_time from crm.connection a 
+		left join crm.connection_introduce b on (a.position_id=? and b.position_id=? and a.id=b.connection_id) where a.position_id=?` + sqlAppend1 + ` GROUP BY a.id order by a.create_time desc` + sqlAppend2
 	listTemp := CrmMysql.SelectBySql(q, args...)
 	firstparty_array, supplier_array, adiffb_array, agency_array, middleman_buyer_array, middleman_project_array := []string{}, []string{}, []string{}, []string{}, []string{}, []string{}
 	myNetworks := []*myNetwork{}