|
@@ -2,6 +2,8 @@ package marketAnalysis
|
|
|
|
|
|
import (
|
|
import (
|
|
qutil "app.yhyue.com/moapp/jybase/common"
|
|
qutil "app.yhyue.com/moapp/jybase/common"
|
|
|
|
+ elastic "app.yhyue.com/moapp/jybase/es"
|
|
|
|
+ mgo "app.yhyue.com/moapp/jybase/mongodb"
|
|
"fmt"
|
|
"fmt"
|
|
"strings"
|
|
"strings"
|
|
)
|
|
)
|
|
@@ -46,7 +48,20 @@ func (mae *MarketAnalysisEntity) GetCommonQuerySql() string {
|
|
}
|
|
}
|
|
//中标企业
|
|
//中标企业
|
|
if mae.FormatParam.Winner != "" {
|
|
if mae.FormatParam.Winner != "" {
|
|
- musts = append(musts, fmt.Sprintf(`{"term":{"s_winner":"%s"}}`, mae.FormatParam.Winner))
|
|
|
|
|
|
+ var winnerId string
|
|
|
|
+ if mgo.IsObjectIdHex(mae.FormatParam.Winner) {
|
|
|
|
+ winnerId = mae.FormatParam.Winner
|
|
|
|
+ } else {
|
|
|
|
+ rData := elastic.Get("qyxy", "qyxy", fmt.Sprintf(`{"query": {"bool": {"must": [{"term": {"company_name": "%s"}}]}},"_source":["_id"]"size": 1}`, mae.FormatParam.Winner))
|
|
|
|
+ if rData != nil && len(*rData) > 0 {
|
|
|
|
+ winnerId = qutil.InterfaceToStr((*rData)[0]["_id"])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if winnerId != "" {
|
|
|
|
+ musts = append(musts, fmt.Sprintf(`{"term":{"entidlist":"%s"}}`, winnerId))
|
|
|
|
+ } else {
|
|
|
|
+ musts = append(musts, fmt.Sprintf(`{"term":{"s_winner":"%s"}}`, mae.FormatParam.Winner))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//采购单位
|
|
//采购单位
|
|
if mae.FormatParam.Buyer != "" {
|
|
if mae.FormatParam.Buyer != "" {
|