Pārlūkot izejas kodu

投标决策分析

wangshan 3 gadi atpakaļ
vecāks
revīzija
550854d13e

+ 25 - 36
src/jfw/modules/bigmember/src/entity/analysis.go

@@ -43,47 +43,36 @@ func (this *AnalysisDec) DecQueryNewSimilarMsgByBW() (qstr string) {
 	bools := []string{}
 	musts := []string{}
 	shoulds := []string{}
-	switch this.SearchType {
-	case 1:
-		//中标单位 类似项目明显
-		if this.Winner != "" {
-			winnerterms := `{"terms":{"s_winner":[`
-			for k, v := range strings.Split(this.Winner, ",") {
-				if k > 0 {
-					winnerterms += `,`
-				}
-				winnerterms += `"` + v + `"`
-			}
-			winnerterms += `]}}`
-			musts = append(musts, winnerterms)
-		}
-	case 2, 3:
-		//中标单位 类似项目合作历史
-		if this.Winner != "" {
-			winnerterms := `{"terms":{"s_winner":[`
-			for k, v := range strings.Split(this.Winner, ",") {
-				if k > 0 {
-					winnerterms += `,`
-				}
-				winnerterms += `"` + v + `"`
+	var BWExists = 1
+	//中标单位 类似项目合作历史||采购单位类似项目
+	if this.Winner != "" {
+		BWExists += 1
+		winnerterms := `{"terms":{"s_winner":[`
+		for k, v := range strings.Split(this.Winner, ",") {
+			if k > 0 {
+				winnerterms += `,`
 			}
-			winnerterms += `]}}`
-			musts = append(musts, winnerterms)
+			winnerterms += `"` + v + `"`
 		}
-		//中标单位 类似项目合作历史
-		if this.Buyer != "" {
-			buyerterms := `{"terms":{"buyer":[`
-			for k, v := range strings.Split(this.Buyer, ",") {
-				if k > 0 {
-					buyerterms += `,`
-				}
-				buyerterms += `"` + v + `"`
+		winnerterms += `]}}`
+		musts = append(musts, winnerterms)
+	}
+	//中标单位 类似项目合作历史||采购单位类似项目
+	if this.Buyer != "" {
+		BWExists += 1
+		buyerterms := `{"terms":{"buyer":[`
+		for k, v := range strings.Split(this.Buyer, ",") {
+			if k > 0 {
+				buyerterms += `,`
 			}
-			buyerterms += `]}}`
-			musts = append(musts, buyerterms)
+			buyerterms += `"` + v + `"`
 		}
+		buyerterms += `]}}`
+		musts = append(musts, buyerterms)
+	}
+	if BWExists > 1 && this.SearchType == 3 {
+		this.SearchType = 1
 	}
-
 	//省份
 	areaCity := []string{}
 	citys := []string{}

+ 1 - 1
src/jfw/modules/bigmember/src/entity/analysisEntName.go

@@ -188,7 +188,7 @@ type AnalysisDec struct {
 	MobileModel      string                 //手机型号
 	AppVersion       string                 //app版本号
 	Winner           string                 //中标企业
-	SearchType       int                    //默认0;1:类似项目明细;2:和采购单位类似项目明细;3:和采购单位其他项目明细
+	SearchType       int                    //默认0;1:中标企业||采购单位-类似项目明细;2:中标企业和采购单位类似项目明细;3:中标企业和采购单位其他项目明细
 	UserId           string                 //用户id
 	IsPower          bool                   //是否有权限
 	UserLock         sync.Mutex             //用户锁