浏览代码

数据导出 中标企业 企业公示库

wangshan 5 年之前
父节点
当前提交
ebc961e79c

+ 2 - 0
src/config.json

@@ -3,6 +3,8 @@
 	"mongodbServers": "192.168.3.128:27080",
     "mongodbPoolSize": "5",
     "mongodbName": "qfw",
+	"mongodbServersEnt": "192.168.3.128:27080",
+    "mongodbNameEnt": "extract_v3",
     "influxaddr": "http://192.168.3.11:8086",
     "influxdb": "jy_logs",
     "qrModelID": "2",

+ 10 - 1
src/jfw/front/dataExport.go

@@ -578,7 +578,16 @@ func (d *DataExport) PreviewData(source, _id string) error {
 	}
 	//格式化字段
 	res_screen := public.ScreenData(res, dataType, 20, kws)
-	list := public.FormatExportData(&res_screen, config.Sysconfig["webdomain"].(string), dataType, true)
+	if dataType == "2" {
+		var EntArr = []string{}
+		for _, v := range res_screen {
+			//高级字段查询且winner不为空
+			if v["s_winner"] != "" && dataType == "2" {
+				EntArr = append(EntArr, v["s_winner"].(string))
+			}
+		}
+	}
+	list := public.FormatExportData(&res_screen, config.Sysconfig["webdomain"].(string), dataType, true, EntArr)
 	d.T["data"] = subUrl(list, dataType)
 	d.T["dataType"] = dataType
 	d.T["ttf"] = public.GetFontVersion() + "_" + public.PC

+ 10 - 1
src/jfw/front/ws_dataExport.go

@@ -69,7 +69,16 @@ func (w *WsDataExport) GetPreview() error {
 	}
 	//格式化字段
 	res_screen := public.ScreenData(res, dataType, 20, kws)
-	list := public.FormatExportData(&res_screen, config.Sysconfig["webdomain"].(string), dataType, true)
+	if dataType == "2" {
+		var EntArr = []string{}
+		for _, v := range res_screen {
+			//高级字段查询且winner不为空
+			if v["s_winner"] != "" && dataType == "2" {
+				EntArr = append(EntArr, v["s_winner"].(string))
+			}
+		}
+	}
+	list := public.FormatExportData(&res_screen, config.Sysconfig["webdomain"].(string), dataType, true, EntArr)
 	_res["data"] = subUrl(list, dataType)
 	_res["dataType"] = dataType
 	w.ServeJson(map[string]interface{}{

+ 10 - 1
src/jfw/modules/app/src/app/front/ws_dataExport.go

@@ -69,7 +69,16 @@ func (w *WsDataExport) GetPreview() error {
 	}
 	//格式化字段
 	res_screen := public.ScreenData(res, dataType, 20, kws)
-	list := public.FormatExportData(&res_screen, config.Sysconfig["webdomain"].(string), dataType, true)
+	if dataType == "2" {
+		var EntArr = []string{}
+		for _, v := range res_screen {
+			//高级字段查询且winner不为空
+			if v["s_winner"] != "" {
+				EntArr = append(EntArr, v["s_winner"].(string))
+			}
+		}
+	}
+	list := public.FormatExportData(&res_screen, config.Sysconfig["webdomain"].(string), dataType, true, EntArr)
 	_res["data"] = subUrl(list, dataType)
 	_res["dataType"] = dataType
 	w.ServeJson(map[string]interface{}{

+ 1 - 1
src/jfw/modules/subscribepay/src/entity/dataExportSearch.go

@@ -538,7 +538,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 + "]}"
 		}

+ 2 - 1
src/jfw/modules/subscribepay/src/entity/dataexport.go

@@ -5,6 +5,7 @@ import (
 	"config"
 	"encoding/json"
 	"fmt"
+	"jfw/public"
 	"log"
 	"os"
 	qutil "qfw/util"
@@ -654,7 +655,7 @@ func SendMailToPayUser(order *map[string]interface{}, order_money float64, pay_t
 		Border:    border,
 		Alignment: alignment,
 	}
-	list, _ := GetDataExportSearchResultUseId(filter_id, dataType, data_count)
+	list, _ := public.GetDataExportSearchResultUseId(filter_id, dataType, data_count)
 	if list != nil {
 		for _, v := range *list {
 			row = sheet.AddRow()

+ 8 - 0
src/jfw/public/db.go

@@ -11,6 +11,7 @@ import (
 )
 
 var MQFW mg.MongodbSim
+var MQFWENT mg.MongodbSim
 var Mysql *mysql.Mysql
 var PushMysql *mysql.Mysql
 var Ca_Log = &ca.Cassandra{}
@@ -52,6 +53,13 @@ func init() {
 	}
 	MQFW.InitPool()
 	//
+	MQFWENT = mg.MongodbSim{
+		MongodbAddr: Sysconfig["mongodbServersEnt"].(string),
+		Size:        util.IntAll(Sysconfig["mongodbPoolSize"]),
+		DbName:      Sysconfig["mongodbNameEnt"].(string),
+	}
+	MQFWENT.InitPool()
+	//
 	mysqlConfig, _ := Sysconfig["mysql"].(map[string]interface{})
 	if mysqlConfig != nil {
 		Mysql = &mysql.Mysql{

+ 30 - 4
src/jfw/public/search.go

@@ -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 + "]}"
 		}