|
@@ -14,6 +14,8 @@ import (
|
|
|
"strings"
|
|
|
"sync"
|
|
|
"time"
|
|
|
+
|
|
|
+ "gopkg.in/mgo.v2/bson"
|
|
|
)
|
|
|
|
|
|
/*筛选条件--关键词*/
|
|
@@ -335,6 +337,8 @@ func isNullSearch(scd *SieveCondition) (isNull bool) {
|
|
|
* webdomain 三级页域名
|
|
|
* count 返回数量 (-1:预览数据查询)
|
|
|
*/
|
|
|
+var EntTable = "winner_enterprise"
|
|
|
+
|
|
|
func GetDataExportSearchResultUseId(_id, dataType string, count int) (*[]map[string]interface{}, []KeyWord) {
|
|
|
defer util.Catch()
|
|
|
var res []map[string]interface{}
|
|
@@ -342,7 +346,6 @@ func GetDataExportSearchResultUseId(_id, dataType string, count int) (*[]map[str
|
|
|
scd := getSqlObjFromId(_id)
|
|
|
//获取查询语句
|
|
|
qstr := getDataExportSql(scd)
|
|
|
-
|
|
|
kws = scd.Keyword
|
|
|
if count == -1 {
|
|
|
//数据预览数据查询
|
|
@@ -427,14 +430,37 @@ func GetDataExportSearchResultUseId(_id, dataType string, count int) (*[]map[str
|
|
|
res = *delRepeatMapArr(&res, res2)
|
|
|
}
|
|
|
}
|
|
|
- res = *FormatExportData(&res, config.Sysconfig["webdomain"].(string), dataType, false)
|
|
|
+ var EntArr = []string{}
|
|
|
+ for _, v := range res {
|
|
|
+ //高级字段查询且winner不为空
|
|
|
+ if v["s_winner"] != "" && dataType == "2" {
|
|
|
+ EntArr = append(EntArr, v["s_winner"].(string))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ res = *FormatExportData(&res, config.Sysconfig["webdomain"].(string), dataType, false, EntArr)
|
|
|
}
|
|
|
return &res, kws
|
|
|
}
|
|
|
|
|
|
-func FormatExportData(data *[]map[string]interface{}, webdomain string, dataType string, isBreviary bool) *[]map[string]interface{} {
|
|
|
+func FormatExportData(data *[]map[string]interface{}, webdomain string, dataType string, isBreviary bool, EntArr []string) *[]map[string]interface{} {
|
|
|
//格式化输出
|
|
|
for _, v := range *data {
|
|
|
+ //有中标企业 且 高级字段查询
|
|
|
+ if len(EntArr) > 0 && dataType == "2" {
|
|
|
+ //查询企业公示 法人 公司电话 公司邮箱地址
|
|
|
+ query := bson.M{"company_name": bson.M{"$in": EntArr}} //
|
|
|
+ if entData, ok := MQFWENT.Find(EntTable, query, nil, `{"company_name":1,"company_email":1,"legal_person":1,"company_phone":1}`, false, -1, -1); ok {
|
|
|
+ if entData != nil && *entData != nil && len(*entData) > 0 {
|
|
|
+ for _, ev := range *entData {
|
|
|
+ if v["s_winner"] == ev["company_name"] {
|
|
|
+ v["legal_person"] = ev["legal_person"]
|
|
|
+ v["company_phone"] = ev["company_phone"]
|
|
|
+ v["company_email"] = ev["company_name"]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//====================字段补漏=========================
|
|
|
if v["toptype"] == "结果" && dataType == "2" && !(v["agency"] != nil && v["budget"] != nil && v["buyerperson"] != nil && v["buyertel"] != nil) {
|
|
|
r := elastic.Get("projectset", "projectset", fmt.Sprintf(`{"query":{"term":{"list.infoid":"%s"}},"_source": ["list"]}`, v["_id"]))
|
|
@@ -519,7 +545,7 @@ func doSearch(sql string, start, count int, dataType string) *[]map[string]inter
|
|
|
if dataType != "" {
|
|
|
dataexport_field := `"_id","title","detail","area","city","publishtime","projectname","buyer","s_winner","bidamount","subtype","toptype"`
|
|
|
if dataType == "2" {
|
|
|
- dataexport_field += `,"href","projectcode","buyerperson","buyertel","budget","bidopentime","agency","projectscope"`
|
|
|
+ dataexport_field += `,"href","projectcode","buyerperson","buyertel","budget","bidopentime","agency","projectscope","winnerperson","winnertel"`
|
|
|
}
|
|
|
sql = sql[:len(sql)-1] + `,"_source":[` + dataexport_field + "]}"
|
|
|
}
|