wangshan 5 miesięcy temu
rodzic
commit
1d15472971

+ 20 - 6
marketanalysis/common.go

@@ -105,6 +105,9 @@ func WinningAnalysis(thisWinnerRow BuyerWinnerRow, rMap *sync.Map, entArrMap map
 		} else {
 			_d.Data = ss
 		}
+		if len(countMap) >= Top30 {
+			break
+		}
 		countMap = append(countMap, _d)
 	}
 
@@ -152,6 +155,9 @@ func WinningAnalysis(thisWinnerRow BuyerWinnerRow, rMap *sync.Map, entArrMap map
 		} else {
 			_d.Data = ss
 		}
+		if len(amountMap) >= Top30 {
+			break
+		}
 		amountMap = append(amountMap, _d)
 	}
 	rMap.Store("winner_time_distribution", buyerMap)
@@ -292,6 +298,9 @@ func BuyerAnalysis(thisBuyerRow BuyerWinnerRow, rMap *sync.Map, winnerName map[s
 		} else {
 			_d.Data = ss
 		}
+		if len(countMap) >= Top30 {
+			break
+		}
 		countMap = append(countMap, _d)
 	}
 
@@ -341,6 +350,9 @@ func BuyerAnalysis(thisBuyerRow BuyerWinnerRow, rMap *sync.Map, winnerName map[s
 		} else {
 			_d.Data = ss
 		}
+		if len(amountMap) >= Top30 {
+			break
+		}
 		amountMap = append(amountMap, _d)
 	}
 	rMap.Store("buyer_time_distribution", buyerMap)
@@ -820,12 +832,14 @@ func GetEntNameByIds(ids []string) (returnMap map[string]string) {
 
 // GetMsgOpen 获取用户服务通知开关是否开启
 func GetMsgOpen(mgo *mongodb.MongodbSim, mgoUserId string, positionType int, entId, entUserId int) bool {
-	pushSetMap := &map[string]interface{}{}
-	if positionType == 1 {
-		pushSetMap, _ = mgo.FindOne("ent_user", map[string]interface{}{"i_entid": entId, "i_userid": entUserId})
-	} else {
-		pushSetMap, _ = mgo.FindById("user", mgoUserId, `{"o_pushset":1,"s_m_openid":1}`)
-	}
+	//-- 服务通知不区分身份,只存在user表中
+	//pushSetMap := &map[string]interface{}{}
+	//if positionType == 1 {
+	//	pushSetMap, _ = mgo.FindOne("ent_user", map[string]interface{}{"i_entid": entId, "i_userid": entUserId})
+	//} else {
+	//	pushSetMap, _ = mgo.FindById("user", mgoUserId, `{"o_pushset":1,"s_m_openid":1}`)
+	//}
+	pushSetMap, _ := mgo.FindById("user", mgoUserId, `{"o_pushset":1,"s_m_openid":1}`)
 	//log.Println(mgoUserId, pushSetMap)
 	if pushSetMap != nil && len(*pushSetMap) > 0 {
 		pushset := common.ObjToMap((*pushSetMap)["o_pushset"])

+ 1 - 0
marketanalysis/consts.go

@@ -65,6 +65,7 @@ const (
 	Top10                     = 10
 	Top20                     = 20
 	Top30                     = 30
+	Top50                     = 50
 	Top1000                   = 1000
 )
 

+ 4 - 4
marketanalysis/marketanalysis.go

@@ -1460,8 +1460,8 @@ func (a *AnalysisEntity) BuyerWinnerAnalysis() map[string]interface{} {
 	//buyer_scalefmt := fmt.Sprintf(buyer_procurement_scale, sortprice_str)
 
 	//采购单位-项目数量 采购单位-项目金额
-	bc := fmt.Sprintf(buyerCount, Top30, Top30)
-	bs := fmt.Sprintf(buyerSortprice, Top30, Top30)
+	bc := fmt.Sprintf(buyerCount, Top50, Top30)
+	bs := fmt.Sprintf(buyerSortprice, Top50, Top30)
 	if a.Offline == ValueOffline {
 		bc = fmt.Sprintf(buyerCount, BWCount, Top30)
 		bs = fmt.Sprintf(buyerSortprice, BWCount, Top30)
@@ -1471,8 +1471,8 @@ func (a *AnalysisEntity) BuyerWinnerAnalysis() map[string]interface{} {
 	//winner_scalefmt := fmt.Sprintf(winner_procurement_scale, sortprice_str)
 
 	//中标单位-项目数量 中标单位-项目金额
-	wc := fmt.Sprintf(winnerCount, Top30, Top30)
-	ws := fmt.Sprintf(winnerSortprice, Top30, Top30)
+	wc := fmt.Sprintf(winnerCount, Top50, Top30) //正常需求30-3;目前是50-30,多获取数据 分析后进行数据损失补充,尽量减少 实时分析和离线分析的误差
+	ws := fmt.Sprintf(winnerSortprice, Top50, Top30)
 	if a.Offline == ValueOffline {
 		wc = fmt.Sprintf(winnerCount, BWCount, Top30)
 		ws = fmt.Sprintf(winnerSortprice, BWCount, Top30)

+ 2 - 2
marketanalysis/scalerefine.go

@@ -86,7 +86,7 @@ func (srd *scaleRefineData) doIdSwitch() {
 	for _, v := range srd.ReturnData.TotalTop {
 		var ents []*entValue
 		for _, vv := range v.TopList {
-			if !srd.IsOffline && len(ents) > Top3 {
+			if !srd.IsOffline && len(ents) >= Top3 {
 				break
 			}
 			vv.Name, _ = srd.IdSwitch[vv.Id]
@@ -101,7 +101,7 @@ func (srd *scaleRefineData) doIdSwitch() {
 	for _, v := range srd.ReturnData.AmountTop {
 		var ents []*entValue
 		for _, vv := range v.TopList {
-			if !srd.IsOffline && len(ents) > Top3 {
+			if !srd.IsOffline && len(ents) >= Top3 {
 				break
 			}
 			vv.Name, _ = srd.IdSwitch[vv.Id]