|
@@ -356,17 +356,16 @@ func isNullSearch(scd *SieveCondition) (isNull bool) {
|
|
* webdomain 三级页域名
|
|
* webdomain 三级页域名
|
|
* count 返回数量 (-1:预览数据查询)
|
|
* count 返回数量 (-1:预览数据查询)
|
|
*/
|
|
*/
|
|
-var EntTable = "winner_enterprise"
|
|
|
|
|
|
|
|
-func GetDataExportSearchResultByScdId(sim, entmg mg.MongodbSim, elasticAddress, id string, dataType string, checkCount int, webdomain string) (*[]map[string]interface{}, error) {
|
|
|
|
|
|
+func GetDataExportSearchResultByScdId(sim mg.MongodbSim, elasticAddress, id, dataType string, checkCount int) (*[]map[string]interface{}, error) {
|
|
scd := GetSqlObjFromId(sim, id)
|
|
scd := GetSqlObjFromId(sim, id)
|
|
- return GetDataExportSearchResult(entmg, elasticAddress, scd, dataType, checkCount, webdomain)
|
|
|
|
|
|
+ return GetDataExportSearchResult(elasticAddress, scd, dataType, checkCount)
|
|
}
|
|
}
|
|
|
|
|
|
//GetDataExportSearchResult 获取数据导出内容
|
|
//GetDataExportSearchResult 获取数据导出内容
|
|
//entmg 高级字段包查询企业电话邮箱等字段
|
|
//entmg 高级字段包查询企业电话邮箱等字段
|
|
//checkCount -1 预览500条
|
|
//checkCount -1 预览500条
|
|
-func GetDataExportSearchResult(entmg mg.MongodbSim, elasticAddress string, scd *SieveCondition, dataType string, checkCount int, webdomain string) (*[]map[string]interface{}, error) {
|
|
|
|
|
|
+func GetDataExportSearchResult(elasticAddress string, scd *SieveCondition, dataType string, checkCount int) (*[]map[string]interface{}, error) {
|
|
defer qutil.Catch()
|
|
defer qutil.Catch()
|
|
var res []map[string]interface{}
|
|
var res []map[string]interface{}
|
|
//获取查询语句
|
|
//获取查询语句
|
|
@@ -456,7 +455,6 @@ func GetDataExportSearchResult(entmg mg.MongodbSim, elasticAddress string, scd *
|
|
return nil, fmt.Errorf("GetDataExportSearchResult-%s-数据总量校验异常,期望:%d,实际:%d", scd.Id, checkCount, len(res))
|
|
return nil, fmt.Errorf("GetDataExportSearchResult-%s-数据总量校验异常,期望:%d,实际:%d", scd.Id, checkCount, len(res))
|
|
//发邮件
|
|
//发邮件
|
|
}
|
|
}
|
|
- res = *FormatExportData(entmg, &res, webdomain, dataType)
|
|
|
|
return &res, nil
|
|
return &res, nil
|
|
}
|
|
}
|
|
|
|
|
|
@@ -525,7 +523,7 @@ func FormatExportData(entmg mg.MongodbSim, data *[]map[string]interface{}, webdo
|
|
//查询企业公示 法人 公司电话 公司邮箱地址
|
|
//查询企业公示 法人 公司电话 公司邮箱地址
|
|
s_winner, ok := v["s_winner"].(string) //改为entidlist?
|
|
s_winner, ok := v["s_winner"].(string) //改为entidlist?
|
|
if ok && s_winner != "" {
|
|
if ok && s_winner != "" {
|
|
- if entData, ok := entmg.Find(EntTable, bson.M{"company_name": s_winner}, nil, `{"company_name":1,"company_email":1,"legal_person":1,"company_phone":1}`, false, -1, -1); ok {
|
|
|
|
|
|
+ if entData, ok := entmg.Find("winner_enterprise", bson.M{"company_name": s_winner}, 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 {
|
|
if entData != nil && *entData != nil && len(*entData) > 0 {
|
|
for _, ev := range *entData {
|
|
for _, ev := range *entData {
|
|
if v["s_winner"] == ev["company_name"] {
|
|
if v["s_winner"] == ev["company_name"] {
|
|
@@ -683,6 +681,7 @@ func doSearch(sql string, start, count int, dataType string) *[]map[string]inter
|
|
//分页排序
|
|
//分页排序
|
|
sql = sql[:len(sql)-1] + `,"sort": {"publishtime":"desc"},"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(count) + "}"
|
|
sql = sql[:len(sql)-1] + `,"sort": {"publishtime":"desc"},"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(count) + "}"
|
|
}
|
|
}
|
|
|
|
+ log.Println("doSearch", sql)
|
|
return elastic.Get(INDEX, TYPE, sql)
|
|
return elastic.Get(INDEX, TYPE, sql)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -751,7 +750,6 @@ func ScreenData(arr *[]map[string]interface{}, dataType string, resultNum int, k
|
|
keys = append(keys, k)
|
|
keys = append(keys, k)
|
|
}
|
|
}
|
|
sort.Ints(keys)
|
|
sort.Ints(keys)
|
|
- log.Println("空字段数量", keys)
|
|
|
|
//选取结果
|
|
//选取结果
|
|
for _, v := range keys {
|
|
for _, v := range keys {
|
|
if len(AllMap[v]) >= resultNum {
|
|
if len(AllMap[v]) >= resultNum {
|