Browse Source

no message

Jianghan 4 years ago
parent
commit
08dc52e0fc

+ 79 - 63
fullproject/src_v1/init.go

@@ -234,30 +234,39 @@ func NewKeyMap() *KeyMap {
 
 
 //招标信息实体类
 //招标信息实体类
 type Info struct {
 type Info struct {
-	Id            string                   `json:"_id"`
-	Href          string                   `json:"href"` //源地址
-	Publishtime   int64                    `json:"publishtime"`
-	Comeintime    int64                    `json:"comeintime"`
-	Title         string                   `json:"title"`
-	TopType       string                   `json:"toptype"`
-	SubType       string                   `json:"subtype"`
-	ProjectName   string                   `json:"projectname"`
-	ProjectCode   string                   `json:"projectcode"`
-	ProjectScope  string                   `json:"projectscope"`
-	ContractCode  string                   `json:"contractcode"`
-	Buyer         string                   `json:"buyer"`
-	Buyerperson   string                   `json:"buyerperson"`
-	Buyertel      string                   `json:"buyertel"`
-	Agency        string                   `json:"agency"`
-	Area          string                   `json:"area"`
-	City          string                   `json:"city"`
-	District      string                   `json:"district"`
-	Infoformat    int                      `json:"infoformat"`
-	ReviewExperts []string                 `json:"review_experts"`
-	Purchasing    string                   `json:"purchasing"`
-	WinnerOrder   []map[string]interface{} `json:"winnerorder"`
-	HasPackage    bool                     // `json:"haspackage"`
-	Package       map[string]interface{}   `json:"package"`
+	Id                  string                   `json:"_id"`
+	Href                string                   `json:"href"` //源地址
+	Publishtime         int64                    `json:"publishtime"`
+	Comeintime          int64                    `json:"comeintime"`
+	Title               string                   `json:"title"`
+	TopType             string                   `json:"toptype"`
+	SubType             string                   `json:"subtype"`
+	ProjectName         string                   `json:"projectname"`
+	ProjectCode         string                   `json:"projectcode"`
+	ProjectScope        string                   `json:"projectscope"`
+	ContractCode        string                   `json:"contractcode"`
+	Buyer               string                   `json:"buyer"`
+	Buyerperson         string                   `json:"buyerperson"`
+	Buyertel            string                   `json:"buyertel"`
+	Agency              string                   `json:"agency"`
+	Area                string                   `json:"area"`
+	City                string                   `json:"city"`
+	District            string                   `json:"district"`
+	Infoformat          int                      `json:"infoformat"`
+	ReviewExperts       []string                 `json:"review_experts"`
+	Purchasing          string                   `json:"purchasing"`
+	WinnerOrder         []map[string]interface{} `json:"winnerorder"`
+	ProjectScale        string                   `json:"project_scale"`
+	ProjectDuration     int                      `json:"project_duration"`
+	ProjectTimeUnit     string                   `json:"project_timeunit"`
+	ProjectStartDate    int64                    `json:"project_startdate"`
+	ProjectCompleteDate int64                    `json:"project_completedate"`
+	Payway              string                   `json:"payway"`
+	ContractGuarantee   bool                     `json:"contract_guarantee"`
+	BidGuarantee        bool                     `json:"bid_guarantee"`
+	Qualifies           []map[string]interface{} `json:"qualifies"`
+	HasPackage          bool                     // `json:"haspackage"`
+	Package             map[string]interface{}   `json:"package"`
 	//PNum          string                 `json:"pnum"`
 	//PNum          string                 `json:"pnum"`
 	Topscopeclass []string `json:"topscopeclass"`
 	Topscopeclass []string `json:"topscopeclass"`
 	Subscopeclass []string `json:"subscopeclass"`
 	Subscopeclass []string `json:"subscopeclass"`
@@ -280,45 +289,52 @@ type Info struct {
 
 
 //项目实体类
 //项目实体类
 type ProjectInfo struct {
 type ProjectInfo struct {
-	Id            primitive.ObjectID `json:"_id"`
-	FirstTime     int64              `json:"firsttime,omitempty"` //项目的最早时间
-	LastTime      int64              `json:"lasttime,omitempty"`  //项目的最后时间
-	Ids           []string           `json:"ids,omitempty"`
-	Topscopeclass []string           `json:"topscopeclass,omitempty"`
-	Subscopeclass []string           `json:"subscopeclass,omitempty"` //子行业分类
-	Winners       []string           `json:"s_winner,omitempty"`      //中标人
-	ProjectName   string             `json:"projectname,omitempty"`   //项目名称
-	ProjectCode   string             `json:"projectcode,omitempty"`   //项目代码唯一(纯数字的权重低)
-	ContractCode  string             `json:"contractcode,omitempty"`  //项目编号
-	Buyer         string             `json:"buyer,omitempty"`         //采购单位唯一
-	MPN           []string           `json:"mpn,omitempty"`           //合并后多余的项目名称
-	MPC           []string           `json:"mpc,omitempty"`           //合并后多余的项目编号
-	Buyerperson   string             `json:"buyerperson"`             //采购联系人
-	Buyertel      string             `json:"buyertel"`                //采购联系人电话
-	Agency        string             `json:"agency"`                  //代理机构
-	Area          string             `json:"area"`                    //地区
-	City          string             `json:"city"`                    //地市
-	District      string             `json:"district"`                //区县
-	Bidstatus     string             `json:"bidstatus"`               //
-	Bidtype       string             `json:"bidtype"`                 //
-	ReviewExperts []string           `json:"review_experts"`          // 项目评审专家
-	Purchasing    string             `json:"purchasing"`              // 标的物
-	//HasPackage    bool                   `json:"haspackage"`              //是否有分包
-	Package     map[string]interface{} `json:"package,omitempty"`     //分包的对比对象
-	Buyerclass  string                 `json:"buyerclass"`            //采购单位分类
-	Bidopentime int64                  `json:"bidopentime,omitempty"` //开标时间
-	//	Zbtime        int64                  `json:"zbtime"`        //招标时间
-	Jgtime        int64    `json:"jgtime"`              //结果中标时间
-	Zbtime        int64    `json:"zbtime"`              //招标时间
-	Bidamount     float64  `json:"bidamount,omitempty"` //中标金额
-	Budget        float64  `json:"budget,omitempty"`    //预算
-	Winnerorder   []string `json:"winnerorder"`         //中标候选人
-	score         int
-	comStr        string
-	resVal, pjVal int
-	InfoFiled     map[string]InfoField `json:"infofield"`    //逻辑处理需要的info字段
-	Budgettag     int                  `json:"budgettag"`    //预算是否有效标记
-	Bidamounttag  int                  `json:"bidamounttag"` //中标金额是否有效标记
+	Id                 primitive.ObjectID     `json:"_id"`
+	FirstTime          int64                  `json:"firsttime,omitempty"` //项目的最早时间
+	LastTime           int64                  `json:"lasttime,omitempty"`  //项目的最后时间
+	Ids                []string               `json:"ids,omitempty"`
+	Topscopeclass      []string               `json:"topscopeclass,omitempty"`
+	Subscopeclass      []string               `json:"subscopeclass,omitempty"` //子行业分类
+	Winners            []string               `json:"s_winner,omitempty"`      //中标人
+	ProjectName        string                 `json:"projectname,omitempty"`   //项目名称
+	ProjectCode        string                 `json:"projectcode,omitempty"`   //项目代码唯一(纯数字的权重低)
+	ContractCode       string                 `json:"contractcode,omitempty"`  //项目编号
+	Buyer              string                 `json:"buyer,omitempty"`         //采购单位唯一
+	MPN                []string               `json:"mpn,omitempty"`           //合并后多余的项目名称
+	MPC                []string               `json:"mpc,omitempty"`           //合并后多余的项目编号
+	Buyerperson        string                 `json:"buyerperson"`             //采购联系人
+	Buyertel           string                 `json:"buyertel"`                //采购联系人电话
+	Agency             string                 `json:"agency"`                  //代理机构
+	Area               string                 `json:"area"`                    //地区
+	City               string                 `json:"city"`                    //地市
+	District           string                 `json:"district"`                //区县
+	Bidstatus          string                 `json:"bidstatus"`               //
+	Bidtype            string                 `json:"bidtype"`                 //
+	ReviewExperts      []string               `json:"review_experts"`          // 项目评审专家
+	Purchasing         string                 `json:"purchasing"`              // 标的物
+	Package            map[string]interface{} `json:"package,omitempty"`       //分包的对比对象
+	Buyerclass         string                 `json:"buyerclass"`              //采购单位分类
+	Bidopentime        int64                  `json:"bidopentime,omitempty"`   //开标时间
+	Jgtime             int64                  `json:"jgtime"`                  //结果中标时间
+	Zbtime             int64                  `json:"zbtime"`                  //招标时间
+	Bidamount          float64                `json:"bidamount,omitempty"`     //中标金额
+	Budget             float64                `json:"budget,omitempty"`        //预算
+	Winnerorder        []string               `json:"winnerorder"`             //中标候选人
+	ProjectScale       string                 `json:"project_scale"`           //项目规模
+	ProjectDuration    int                    `json:"project_duration"`        //工期时长
+	ProjectTimeunit    string                 `json:"project_timeunit"`        //工期时长单位
+	ProjectStartDate   int64                  `json:"project_startdate"`       //开工日期
+	ProjctCompleteDate int64                  `json:"projct_completedate"`     //竣工日期
+	Payway             string                 `json:"payway"`                  //付款方式
+	ContractGuarantee  bool                   `json:"contract_guarantee"`      //履约保证金 是否支持包含
+	BidGuarantee       bool                   `json:"bid_guarantee"`           //投标保证金 是否支持包含
+	Qualifies          string                 `json:"qualifies"`               //资质条件
+	score              int
+	comStr             string
+	resVal, pjVal      int
+	InfoFiled          map[string]InfoField `json:"infofield"`    //逻辑处理需要的info字段
+	Budgettag          int                  `json:"budgettag"`    //预算是否有效标记
+	Bidamounttag       int                  `json:"bidamounttag"` //中标金额是否有效标记
 }
 }
 
 
 //存储部分招标信息字段,业务逻辑处理需要
 //存储部分招标信息字段,业务逻辑处理需要

+ 4 - 4
fullproject/src_v1/main.go

@@ -70,7 +70,7 @@ func DealSign() {
 	}
 	}
 }
 }
 
 
-func main() {
+func mainT() {
 	//udp跑增量  id段   project
 	//udp跑增量  id段   project
 	//udp跑全量			qlT
 	//udp跑全量			qlT
 	//udp跑历史数据  信息id1,id2/或id段  ls
 	//udp跑历史数据  信息id1,id2/或id段  ls
@@ -89,9 +89,9 @@ func main() {
 }
 }
 
 
 //测试组人员使用
 //测试组人员使用
-func mainT() {
-	sid = "5fe07b07f0f9d716c179e2aa"
-	eid = "5fe57be8f0f9d716c17d95e8"
+func main() {
+	sid = "5f0fd94e801f744d04772ceb"
+	eid = "5f6304a0b49c3a9ded2f5974"
 	//flag.StringVar(&sid, "sid", "", "开始id")
 	//flag.StringVar(&sid, "sid", "", "开始id")
 	//flag.StringVar(&eid, "eid", "", "结束id")
 	//flag.StringVar(&eid, "eid", "", "结束id")
 	//flag.Parse()
 	//flag.Parse()

+ 136 - 3
fullproject/src_v1/project.go

@@ -545,6 +545,61 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
 		set["winnerorder"] = list
 		set["winnerorder"] = list
 		p1.Winnerorder = list
 		p1.Winnerorder = list
 	}
 	}
+	//项目规模
+	if len(thisinfo.ProjectScale) > 0 {
+		p1.ProjectScale = thisinfo.ProjectScale
+		set["project_scale"] = thisinfo.ProjectScale
+	}
+	//工期时长
+	if thisinfo.ProjectDuration > 0 {
+		p1.ProjectDuration = thisinfo.ProjectDuration
+		set["project_duration"] = thisinfo.ProjectDuration
+	}
+	// 工期单位
+	if thisinfo.ProjectDuration > 0 && len(thisinfo.ProjectTimeUnit) > 0 {
+		p1.ProjectTimeunit = thisinfo.ProjectTimeUnit
+		set["project_timeunit"] = thisinfo.ProjectTimeUnit
+	}
+	//开工日期
+	if thisinfo.ProjectStartDate > 0 {
+		p1.ProjectStartDate = thisinfo.ProjectStartDate
+		set["project_startdate"] = thisinfo.ProjectStartDate
+	}
+	//竣工日期
+	if thisinfo.ProjectCompleteDate > 0 {
+		p1.ProjctCompleteDate = thisinfo.ProjectCompleteDate
+		set["project_completedate"] = thisinfo.ProjectCompleteDate
+	}
+	//付款方式
+	if len(thisinfo.Payway) > 0 {
+		p1.Payway = thisinfo.Payway
+		set["payway"] = thisinfo.Payway
+	}
+	// 履约保证金
+	if tmp["contract_guarantee"] != nil {
+		p1.ContractGuarantee = thisinfo.ContractGuarantee
+		set["contract_guarantee"] = thisinfo.ContractGuarantee
+	}
+	// 投标保证金
+	if tmp["bid_guarantee"] != nil {
+		p1.BidGuarantee = thisinfo.BidGuarantee
+		set["bid_guarantee"] = thisinfo.BidGuarantee
+	}
+	// 资质条件
+	if len(thisinfo.Qualifies) > 0 {
+		var str []string
+		for _, v := range thisinfo.Qualifies{
+			if len(qu.ObjToString(v["key"])) > 0 {
+				if BinarySearch(str, qu.ObjToString(v["key"])) == -1 {
+					str = append(str, qu.ObjToString(v["key"]))
+				}
+			}
+		}
+		if len(str) > 0 {
+			p1.Qualifies = strings.Join(str, ",")
+			set["qualifies"] = strings.Join(str, ",")
+		}
+	}
 	p1.InfoFiled = make(map[string]InfoField)
 	p1.InfoFiled = make(map[string]InfoField)
 	infofield := InfoField{
 	infofield := InfoField{
 		Budget:       thisinfo.Budget,
 		Budget:       thisinfo.Budget,
@@ -629,6 +684,15 @@ var INFOFIELDS = []string{
 	"site",
 	"site",
 	"review_experts",
 	"review_experts",
 	"purchasing",
 	"purchasing",
+	"project_scale",
+	"project_duration",
+	"project_timeunit",
+	"project_startdate",
+	"project_completedate",
+	"payway",
+	"contract_guarantee",
+	"bid_guarantee",
+	"qualifies",
 }
 }
 
 
 //项目中list的信息
 //项目中list的信息
@@ -672,8 +736,6 @@ func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidty
 		Bidstatus:     bidstatus,
 		Bidstatus:     bidstatus,
 		Bidtype:       bidtype,
 		Bidtype:       bidtype,
 		Winners:       thisinfo.Winners,
 		Winners:       thisinfo.Winners,
-		ReviewExperts: thisinfo.ReviewExperts,
-		Purchasing:    thisinfo.Purchasing,
 	}
 	}
 	if thisinfo.LenPTC > 5 {
 	if thisinfo.LenPTC > 5 {
 		p1.MPC = append(p1.MPC, thisinfo.PTC)
 		p1.MPC = append(p1.MPC, thisinfo.PTC)
@@ -919,7 +981,6 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 		if len(pInfo.Winners) <= 0 {
 		if len(pInfo.Winners) <= 0 {
 			set["winner"] = qu.ObjToString(tmp["winner"])
 			set["winner"] = qu.ObjToString(tmp["winner"])
 		}
 		}
-
 		sort.Strings(pInfo.Winners)
 		sort.Strings(pInfo.Winners)
 		for _, k := range thisinfo.Winners {
 		for _, k := range thisinfo.Winners {
 			if thisinfo.SubType == "流标" || thisinfo.SubType == "废标" {
 			if thisinfo.SubType == "流标" || thisinfo.SubType == "废标" {
@@ -936,6 +997,78 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 		}
 		}
 		set["s_winner"] = strings.Join(pInfo.Winners, ",")
 		set["s_winner"] = strings.Join(pInfo.Winners, ",")
 	}
 	}
+	//项目规模
+	if len(thisinfo.ProjectScale) > 0 {
+		pInfo.ProjectScale = thisinfo.ProjectScale
+		set["project_scale"] = thisinfo.ProjectScale
+	}
+	//工期时长
+	if thisinfo.ProjectDuration > 0 {
+		pInfo.ProjectDuration = thisinfo.ProjectDuration
+		set["project_duration"] = thisinfo.ProjectDuration
+	}
+	// 工期单位
+	if thisinfo.ProjectDuration > 0 && len(thisinfo.ProjectTimeUnit) > 0 {
+		pInfo.ProjectTimeunit = thisinfo.ProjectTimeUnit
+		set["project_timeunit"] = thisinfo.ProjectTimeUnit
+	}
+	//开工日期
+	if thisinfo.ProjectStartDate > 0 {
+		if pInfo.ProjectStartDate > 0 {
+			if pInfo.ProjectStartDate < thisinfo.ProjectStartDate  {
+				pInfo.ProjectStartDate = thisinfo.ProjectStartDate
+				set["project_startdate"] = thisinfo.ProjectStartDate
+			}
+		}else {
+			pInfo.ProjectStartDate = thisinfo.ProjectStartDate
+			set["project_startdate"] = thisinfo.ProjectStartDate
+		}
+	}
+	//竣工日期
+	if thisinfo.ProjectCompleteDate > 0 {
+		if pInfo.ProjctCompleteDate > 0 {
+			if pInfo.ProjctCompleteDate < thisinfo.ProjectCompleteDate {
+				pInfo.ProjctCompleteDate = thisinfo.ProjectCompleteDate
+				set["project_completedate"] = thisinfo.ProjectCompleteDate
+			}
+		}else {
+			pInfo.ProjctCompleteDate = thisinfo.ProjectCompleteDate
+			set["project_completedate"] = thisinfo.ProjectCompleteDate
+		}
+	}
+	// 付款方式
+	if len(thisinfo.Payway) > 0 {
+		pInfo.Payway = thisinfo.Payway
+		set["payway"] = thisinfo.Payway
+	}
+	// 履约保证金
+	if tmp["contract_guarantee"] != nil {
+		pInfo.ContractGuarantee = thisinfo.ContractGuarantee
+		set["contract_guarantee"] = thisinfo.ContractGuarantee
+	}
+	// 投标保证金
+	if tmp["bid_guarantee"] != nil {
+		pInfo.BidGuarantee = thisinfo.BidGuarantee
+		set["bid_guarantee"] = thisinfo.BidGuarantee
+	}
+	// 资质条件
+	if len(thisinfo.Qualifies) > 0 {
+		var str []string
+		if len(pInfo.Qualifies) > 0 {
+			str = append(str, strings.Split(pInfo.Qualifies, ",")...)
+		}
+		for _, v := range thisinfo.Qualifies{
+			if len(qu.ObjToString(v["key"])) > 0 {
+				if BinarySearch(str, qu.ObjToString(v["key"])) == -1 {
+					str = append(str, qu.ObjToString(v["key"]))
+				}
+			}
+		}
+		if len(str) > 0 {
+			pInfo.Qualifies = strings.Join(str, ",")
+			set["qualifies"] = strings.Join(str, ",")
+		}
+	}
 
 
 	if thisinfo.HasPackage { //多包处理
 	if thisinfo.HasPackage { //多包处理
 		set["multipackage"] = 1
 		set["multipackage"] = 1

+ 6 - 4
fullproject/src_v1/task.go

@@ -711,9 +711,10 @@ func (p *ProjectTask) updateJudge(infoMap map[string]interface{}, pid string) {
 	tmpPro := MongoTool.FindById(ProjectColl, pid)
 	tmpPro := MongoTool.FindById(ProjectColl, pid)
 
 
 	modifyProMap := make(map[string]interface{}) // 修改项目的字段
 	modifyProMap := make(map[string]interface{}) // 修改项目的字段
-	for k := range infoMap{
-		if modifyMap, ok := infoMap["modifyinfo"].(map[string]interface{}); ok {
-			if modifyMap[k] != nil {
+
+	if modifyMap, ok := infoMap["modifyinfo"].(map[string]interface{}); ok {
+		for k := range modifyMap {
+			if modifyMap[k] != nil && modifyMap[k] != "" && tmpPro[k] != nil {
 				modifyProMap[k] = infoMap[k]
 				modifyProMap[k] = infoMap[k]
 			}
 			}
 		}
 		}
@@ -780,7 +781,8 @@ func (p *ProjectTask) updateJudge(infoMap map[string]interface{}, pid string) {
 		}
 		}
 	}else {
 	}else {
 		// 周期外
 		// 周期外
-		p.modifyUpdate(pid, index, position, tmpPro, infoMap)
+		util.Debug("周期外数据直接修改", "----------------------------")
+		p.modifyUpdate(pid, index, position, tmpPro, modifyProMap)
 	}
 	}
 }
 }
 
 

+ 10 - 0
qyxy/src/task.go

@@ -210,6 +210,16 @@ func QyxyStandard() bool {
 							esMap[field] = "其他"
 							esMap[field] = "其他"
 						}
 						}
 					}
 					}
+				} else if field == "history_name" {
+					var nameArr []string
+					for _, v := range strings.Split(qu.ObjToString(tmp[field]), ";") {
+						if v != "" {
+							nameArr = append(nameArr, v)
+						}
+					}
+					if len(nameArr) > 0 {
+						esMap[field] = nameArr
+					}
 				} else if strings.Contains(field, "date") || strings.Contains(field, "time") { //时间处理
 				} else if strings.Contains(field, "date") || strings.Contains(field, "time") { //时间处理
 					if tmp[field] != nil {
 					if tmp[field] != nil {
 						if timeTmp, ok := tmp[field].(primitive.DateTime); ok {
 						if timeTmp, ok := tmp[field].(primitive.DateTime); ok {

+ 109 - 5
udpcreateindex/src/biddingall.go

@@ -5,7 +5,6 @@ import (
 	"log"
 	"log"
 	qutil "qfw/util"
 	qutil "qfw/util"
 	elastic "qfw/util/elastic"
 	elastic "qfw/util/elastic"
-
 	"reflect"
 	"reflect"
 	"strings"
 	"strings"
 	"sync"
 	"sync"
@@ -222,13 +221,30 @@ func biddingAllTask(data []byte, mapInfo map[string]interface{}) {
 			for tk, tv := range update {
 			for tk, tv := range update {
 				tmp[tk] = tv
 				tmp[tk] = tv
 			}
 			}
+			if tmp["s_winner"] != "" {
+				sWinnerarr := strings.Split(qutil.ObjToString(tmp["s_winner"]), ",")
+				var cid []string
+				for _, w := range sWinnerarr {
+					if w != "" {
+						ent, _ := mgostandard.FindOne("", map[string]interface{}{"compnay_name": w})
+						if len(*ent) > 0 {
+							cid = append(cid, qutil.ObjToString((*ent)["company_id"]))
+						}
+					}
+				}
+				if len(cid) > 0 {
+					tmp["entidlist"] = cid
+				}
+			}
 			//对projectscope字段的索引处理
 			//对projectscope字段的索引处理
 			ps, _ := tmp["projectscope"].(string)
 			ps, _ := tmp["projectscope"].(string)
 			if len(ps) > ESLEN {
 			if len(ps) > ESLEN {
 				tmp["projectscope"] = string(([]rune(ps))[:4000])
 				tmp["projectscope"] = string(([]rune(ps))[:4000])
 			}
 			}
 			//对标的物为空处理
 			//对标的物为空处理
-			if filetext := getFileText(tmp); len(filetext) > 10 { //attach_text
+			filetext := getFileText(tmp)
+			filetextS := filetext
+			if len([]rune(filetextS)) > 10 { //attach_text
 				tmp["filetext"] = filetext
 				tmp["filetext"] = filetext
 			}
 			}
 			if purchasing, ok := tmp["purchasing"].(string); ok && purchasing == "" {
 			if purchasing, ok := tmp["purchasing"].(string); ok && purchasing == "" {
@@ -320,14 +336,33 @@ func biddingAllTask(data []byte, mapInfo map[string]interface{}) {
 							if len(winnerorder_new) > 0 {
 							if len(winnerorder_new) > 0 {
 								newTmp[field] = winnerorder_new
 								newTmp[field] = winnerorder_new
 							}
 							}
+						} else if field == "qualifies" {
+							//项目资质
+							qs := []string{}
+							if q, _ := tmp[field].([]interface{}); len(q) > 0 {
+								for _, v := range q {
+									v1 := v.(map[string]interface{})
+									qs = append(qs, qutil.ObjToString(v1["key"]))
+								}
+							}
+							if len(qs) > 0 {
+								newTmp[field] = strings.Join(qs, ",")
+							}
 						} else if field == "detail" { //过滤
 						} else if field == "detail" { //过滤
 							detail, _ := tmp[field].(string)
 							detail, _ := tmp[field].(string)
-							if len([]rune(detail)) > detailLength {
-								detail = detail[:detailLength]
+							if isUtf8([]byte(detail)) || isGBK([]byte(detail)) {
+								if len([]rune(detail)) > detailLength {
+									detail = detail[:detailLength]
+								}
+								newTmp[field] = FilterDetail(detail)
 							}
 							}
-							newTmp[field] = FilterDetail(detail)
 						} else if field == "_id" || field == "topscopeclass" { //不做处理
 						} else if field == "_id" || field == "topscopeclass" { //不做处理
 							newTmp[field] = tmp[field]
 							newTmp[field] = tmp[field]
+						} else if field == "publishtime" || field == "comeintime" {
+							//字段类型不正确,特别处理
+							if tmp[field] != nil && qutil.Int64All(tmp[field]) > 0 {
+								newTmp[field] = qutil.Int64All(tmp[field])
+							}
 						} else { //其它字段判断数据类型,不正确舍弃
 						} else { //其它字段判断数据类型,不正确舍弃
 							if fieldval := tmp[field]; reflect.TypeOf(fieldval).String() != ftype {
 							if fieldval := tmp[field]; reflect.TypeOf(fieldval).String() != ftype {
 								continue
 								continue
@@ -440,3 +475,72 @@ func biddingAllTask(data []byte, mapInfo map[string]interface{}) {
 	UpdatesLock.Unlock()
 	UpdatesLock.Unlock()
 	log.Println(mapInfo, "create bidding index...over", n)
 	log.Println(mapInfo, "create bidding index...over", n)
 }
 }
+func preNUm(data byte) int {
+	var mask byte = 0x80
+	var num int = 0
+	//8bit中首个0bit前有多少个1bits
+	for i:=0; i < 8; i++ {
+		if (data & mask) == mask {
+			num++
+			mask = mask >> 1
+		} else {
+			break
+		}
+	}
+	return num
+}
+
+func isGBK(data []byte) bool {
+	length := len(data)
+	var i int = 0
+	for i < length {
+		if data[i] <= 0x7f {
+			//编码0~127,只有一个字节的编码,兼容ASCII码
+			i++
+			continue
+		} else {
+			//大于127的使用双字节编码,落在gbk编码范围内的字符
+			if  data[i] >= 0x81 &&
+				data[i] <= 0xfe &&
+				data[i + 1] >= 0x40 &&
+				data[i + 1] <= 0xfe &&
+				data[i + 1] != 0xf7 {
+				i += 2
+				continue
+			} else {
+				return false
+			}
+		}
+	}
+	return true
+}
+
+func isUtf8(data []byte) bool {
+	i := 0
+	for i < len(data)  {
+		if (data[i] & 0x80) == 0x00 {
+			// 0XXX_XXXX
+			i++
+			continue
+		} else if num := preNUm(data[i]); num > 2 {
+			// 110X_XXXX 10XX_XXXX
+			// 1110_XXXX 10XX_XXXX 10XX_XXXX
+			// 1111_0XXX 10XX_XXXX 10XX_XXXX 10XX_XXXX
+			// 1111_10XX 10XX_XXXX 10XX_XXXX 10XX_XXXX 10XX_XXXX
+			// 1111_110X 10XX_XXXX 10XX_XXXX 10XX_XXXX 10XX_XXXX 10XX_XXXX
+			// preNUm() 返回首个字节的8个bits中首个0bit前面1bit的个数,该数量也是该字符所使用的字节数
+			i++
+			for j := 0; j < num - 1; j++ {
+				//判断后面的 num - 1 个字节是不是都是10开头
+				if (data[i] & 0xc0) != 0x80 {
+					return false
+				}
+				i++
+			}
+		} else  {
+			//其他情况说明不是utf-8
+			return false
+		}
+	}
+	return true
+}

+ 18 - 1
udpcreateindex/src/biddingindex.go

@@ -3,7 +3,6 @@ package main
 import (
 import (
 	"encoding/json"
 	"encoding/json"
 	"reflect"
 	"reflect"
-
 	//"fmt"
 	//"fmt"
 	"log"
 	"log"
 	mu "mfw/util"
 	mu "mfw/util"
@@ -352,14 +351,32 @@ func doIndex(infos []map[string]interface{}, eMap map[string]map[string]interfac
 						if len(winnerorder_new) > 0 {
 						if len(winnerorder_new) > 0 {
 							newTmp[field] = winnerorder_new
 							newTmp[field] = winnerorder_new
 						}
 						}
+					} else if field == "qualifies" {
+						//项目资质
+						qs := []string{}
+						if q, _ := tmp[field].([]interface{}); len(q) > 0 {
+							for _, v := range q {
+								v1 := v.(map[string]interface{})
+								qs = append(qs, qutil.ObjToString(v1["key"]))
+							}
+						}
+						if len(qs) > 0 {
+							newTmp[field] = strings.Join(qs, ",")
+						}
 					} else if field == "detail" { //过滤
 					} else if field == "detail" { //过滤
 						detail, _ := tmp[field].(string)
 						detail, _ := tmp[field].(string)
+
 						if len([]rune(detail)) > detailLength {
 						if len([]rune(detail)) > detailLength {
 							detail = detail[:detailLength]
 							detail = detail[:detailLength]
 						}
 						}
 						newTmp[field] = FilterDetail(detail)
 						newTmp[field] = FilterDetail(detail)
 					} else if field == "_id" || field == "topscopeclass" { //不做处理
 					} else if field == "_id" || field == "topscopeclass" { //不做处理
 						newTmp[field] = tmp[field]
 						newTmp[field] = tmp[field]
+					} else if field == "publishtime" || field == "comeintime" {
+						//字段类型不正确,特别处理
+						if tmp[field] != nil && qutil.Int64All(tmp[field]) > 0 {
+							newTmp[field] = qutil.Int64All(tmp[field])
+						}
 					} else { //其它字段判断数据类型,不正确舍弃
 					} else { //其它字段判断数据类型,不正确舍弃
 						if fieldval := tmp[field]; reflect.TypeOf(fieldval).String() != ftype {
 						if fieldval := tmp[field]; reflect.TypeOf(fieldval).String() != ftype {
 							continue
 							continue

+ 117 - 99
udpcreateindex/src/config.json

@@ -1,108 +1,126 @@
 {
 {
-    "udpport": ":1483",
-    "msg_server": "10.171.112.160:7070",
-    "mongodb": {
-        "addr": "192.168.3.207:27092",
-        "pool": 10,
-        "db": "mxs"
+  "udpport": ":1483",
+  "msg_server": "10.171.112.160:7070",
+  "mongodb": {
+    "addr": "192.168.3.207:27092",
+    "pool": 10,
+    "db": "wjh"
+  },
+  "savedb": {
+    "addr": "192.168.3.207:27092",
+    "size": 10,
+    "db": "wjh"
+  },
+  "jkmail": {
+    "to": "zhangjinkun@topnet.net.cn",
+    "api": "http://10.171.112.160:19281/_send/_mail"
+  },
+  "winner": {
+    "db": "qfw",
+    "collect": "winner",
+    "index": "winner",
+    "type": "winner"
+  },
+  "buyer": {
+    "db": "mxs",
+    "collect": "buyer_err",
+    "index": "buyer_v6",
+    "type": "buyer"
+  },
+  "biddingback": {
+    "db": "qfw",
+    "collect": "bidding",
+    "index": "bidding",
+    "type": "bidding"
+  },
+  "bidding": {
+    "db": "wjh",
+    "collect": "bidding",
+    "index": "bidding",
+    "type": "bidding",
+    "extractdb": "mxs",
+    "extractcollect": "extract",
+    "indexfields": [
+      "buyerzipcode", "winnertel", "winnerperson", "contractcode", "winneraddr", "agencyaddr", "buyeraddr", "signaturedate", "projectperiod", "projectaddr", "agencytel", "agencyperson",
+      "buyerperson", "agency", "projectscope", "projectcode", "bidopentime", "supervisorrate", "buyertel", "bidamount", "winner", "buyer", "budget", "projectname", "bidstatus", "buyerclass",
+      "topscopeclass", "s_topscopeclass", "s_subscopeclass", "area", "city", "district", "s_winner", "_id", "title", "detail", "site", "comeintime", "href", "infoformat", "publishtime",
+      "s_sha", "spidercode", "subtype", "toptype", "projectinfo", "purchasing", "purchasinglist", "filetext", "channel", "winnerorder", "project_scale", "project_duration", "project_timeunit",
+      "project_startdate", "project_completedate", "payway", "contract_guarantee", "bid_guarantee", "qualifies"
+    ],
+    "indexfieldsmap": {
+      "buyerzipcode": "string", "winnertel": "string", "winnerperson": "string", "contractcode": "string", "winneraddr": "string", "agencyaddr": "string", "buyeraddr": "string", "signaturedate": "int64",
+      "projectperiod": "string", "projectaddr": "string", "agencytel": "string", "agencyperson": "string", "buyerperson": "string", "agency": "string", "projectscope": "string", "projectcode": "string",
+      "bidopentime": "int64", "supervisorrate": "float64", "buyertel": "string", "bidamount": "float64", "winner": "string", "buyer": "string", "budget": "float64", "projectname": "string", "bidstatus": "string",
+      "buyerclass": "string", "topscopeclass": "", "s_topscopeclass": "string", "s_subscopeclass": "string", "area": "string", "city": "string", "district": "string", "s_winner": "string", "_id": "", "title": "string",
+      "detail": "string", "site": "string", "comeintime": "int64", "href": "string", "infoformat": "int", "publishtime": "int64", "s_sha": "string", "spidercode": "string", "subtype": "string", "toptype": "string",
+      "projectinfo": "", "purchasing": "string", "purchasinglist": "", "filetext": "string", "channel": "string", "winnerorder": "", "project_scale": "string", "project_duration": "float64", "project_timeunit": "string",
+      "project_startdate": "int64", "project_completedate": "int64", "payway": "string", "contract_guarantee": "bool", "bid_guarantee": "bool", "qualifies": ""
     },
     },
-	"savedb": {
-        "addr": "192.168.3.207:27092",
-        "size": 10,
-        "db": "mxs"
+    "fields": "buyerzipcode,winnertel,winnerperson,contractcode,winneraddr,agencyaddr,buyeraddr,signaturedate,projectperiod,projectaddr,agencytel,agencyperson,buyerperson,agency,projectscope,projectcode,bidopentime,supervisorrate,buyertel,bidamount,winner,buyer,budget,projectname,buyerclass,topscopeclass,s_topscopeclass,area,city,district,s_winner,toptype,subtype,subscopeclass,s_subscopeclass,dataging,winnerorder",
+    "projectinfo": "approvecode,approvecontent,approvestatus,approvetime,approvedept,approvenumber,projecttype,approvecity",
+    "projectinfomap": {
+      "approvecode": "string", "approvecontent": "string", "approvestatus": "string", "approvetime": "string", "approvedept": "string", "approvenumber": "string", "projecttype": "string", "approvecity": "string"
     },
     },
-    "jkmail": {
-        "to":"zhangjinkun@topnet.net.cn",
-		"api":"http://10.171.112.160:19281/_send/_mail"
+    "purchasinglist": "itemname,brandname,model,unitname,number",
+    "purchasinglistmap": {
+      "itemname": "string", "brandname": "string", "model": "string", "unitname": "string", "number": "float64", "unitprice": "float64", "totalprice": "float64"
     },
     },
-    "winner": {
-        "db": "qfw",
-        "collect": "winner",
-        "index": "winner",
-        "type": "winner"
+    "winnerorder": "sort,sortstr,entname",
+    "winnerordermap": {
+      "sort": "int", "sortstr": "string", "entname": "string"
     },
     },
-    "buyer": {
-        "db": "mxs",
-        "collect": "buyer_err",
-        "index": "buyer_v6",
-        "type": "buyer"
+    "multiIndex": ""
+  },
+  "filelength": 50000,
+  "detaillength": 50000,
+  "project": {
+    "db": "wjh",
+    "collect": "projectset",
+    "index": "projectset",
+    "type": "projectset"
+  },
+  "project2": {
+    "addr": "192.168.3.207:27092",
+    "pool": 1,
+    "db": "mxs",
+    "collect": "huawei_project",
+    "index": "project_v2",
+    "type": "project"
+  },
+  "qyxy_ent": {
+    "addr": "192.168.3.207:27092",
+    "pool": 5,
+    "db": "mxs",
+    "collect": "test2",
+    "index": "qyxy_ent",
+    "type": "qyxy_ent"
+  },
+  "standard": {
+    "addr": "192.168.3.207:27092",
+    "pool": 10,
+    "db": "mixdata",
+    "winnerent": {
+      "collect1": "winner_enterprise",
+      "collect2": "winner_err",
+      "index": "winner_v3",
+      "type": "winner"
     },
     },
-    "biddingback": {
-        "db": "qfw",
-        "collect": "bidding",
-        "index": "bidding",
-        "type": "bidding"
+    "buyerent": {
+      "collect1": "buyer_enterprise",
+      "collect2": "buyer_err",
+      "index": "buyer_v6",
+      "type": "buyer"
     },
     },
-    "bidding": {
-        "db": "mxs",
-        "collect": "test",
-        "index": "bidding_v5",
-        "type": "bidding",
-        "extractdb": "mxs",
-        "extractcollect": "extract",
-        "indexfields":[ 
-        "buyerzipcode","winnertel","winnerperson","contractcode","winneraddr","agencyaddr","buyeraddr","signaturedate","projectperiod","projectaddr","agencytel","agencyperson","buyerperson","agency","projectscope","projectcode","bidopentime","supervisorrate","buyertel","bidamount","winner","buyer","budget","projectname","bidstatus","buyerclass","topscopeclass","s_topscopeclass","s_subscopeclass","area","city","district","s_winner","_id","title","detail","site","comeintime","href","infoformat","publishtime","s_sha","spidercode","subtype","toptype","projectinfo","purchasing","purchasinglist","filetext","channel","winnerorder"
-        ],
-        "indexfieldsmap":{"buyerzipcode":"string","winnertel":"string","winnerperson":"string","contractcode":"string","winneraddr":"string","agencyaddr":"string","buyeraddr":"string","signaturedate":"int64","projectperiod":"string","projectaddr":"string","agencytel":"string","agencyperson":"string","buyerperson":"string","agency":"string","projectscope":"string","projectcode":"string","bidopentime":"int64","supervisorrate":"float64","buyertel":"string","bidamount":"float64","winner":"string","buyer":"string","budget":"float64","projectname":"string","bidstatus":"string","buyerclass":"string","topscopeclass":"","s_topscopeclass":"string","s_subscopeclass":"string","area":"string","city":"string","district":"string","s_winner":"string","_id":"","title":"string","detail":"string","site":"string","comeintime":"int64","href":"string","infoformat":"int","publishtime":"int64","s_sha":"string","spidercode":"string","subtype":"string","toptype":"string","projectinfo":"","purchasing":"string","purchasinglist":"","filetext":"string","channel":"string","winnerorder":""},
-        "fields": "buyerzipcode,winnertel,winnerperson,contractcode,winneraddr,agencyaddr,buyeraddr,signaturedate,projectperiod,projectaddr,agencytel,agencyperson,buyerperson,agency,projectscope,projectcode,bidopentime,supervisorrate,buyertel,bidamount,winner,buyer,budget,projectname,buyerclass,topscopeclass,s_topscopeclass,area,city,district,s_winner,toptype,subtype,subscopeclass,s_subscopeclass,dataging,winnerorder",
-        "projectinfo":"approvecode,approvecontent,approvestatus,approvetime,approvedept,approvenumber,projecttype,approvecity", 
-     	"projectinfomap":{"approvecode":"string","approvecontent":"string","approvestatus":"string","approvetime":"string","approvedept":"string","approvenumber":"string","projecttype":"string","approvecity":"string"},
-        "purchasinglist": "itemname,brandname,model,unitname,number",
-        "purchasinglistmap":{"itemname":"string","brandname": "string","model":"string","unitname":"string","number":"float64","unitprice":"float64","totalprice":"float64"},
-        "winnerorder": "sort,sortstr,entname",
-        "winnerordermap": {"sort":"int","sortstr":"string","entname":"string"},
-        "multiIndex": ""
-    },
-    "filelength": 50000,
-    "detaillength": 50000,
-    "project": {
-        "db": "mxs",
-        "collect": "projectset",
-        "index": "projectset_v5",
-        "type": "projectset"
-    },
-    "project2": {
-		"addr": "192.168.3.207:27092",
-		"pool": 1,
-        "db": "mxs",
-        "collect": "huawei_project",
-        "index": "project_v2",
-        "type": "project"
-    },
-    "qyxy_ent": {
-		"addr": "192.168.3.207:27092",
-		"pool": 5,
-        "db": "mxs",
-        "collect": "test2",
-        "index": "qyxy_ent",
-        "type": "qyxy_ent"
-    },
-    "standard": {
- 		"addr": "192.168.3.207:27092",
-        "pool": 10,
-        "db": "mixdata",
-    	"winnerent":{
-			"collect1": "winner_enterprise",
-			"collect2": "winner_err",
-        	"index": "winner_v3",
-        	"type": "winner"
-		},
-        "buyerent":{
-			"collect1": "buyer_enterprise",
-			"collect2": "buyer_err",
-        	"index": "buyer_v6",
-        	"type": "buyer"
-		},
- 		"agencyent":{
-			"collect": "agency_enterprise",
-       	 	"index": "agencyent_v1",
-       		"type": "agencyent"
-		}
-    },
-    "elastic": {
-        "addr": "http://192.168.3.11:9800",
-        "index": "bidding",
-        "itype": "bidding",
-        "pool": 12
+    "agencyent": {
+      "collect": "agency_enterprise",
+      "index": "agencyent_v1",
+      "type": "agencyent"
     }
     }
+  },
+  "elastic": {
+    "addr": "http://192.168.3.11:9800",
+    "index": "bidding",
+    "itype": "bidding",
+    "pool": 12
+  }
 }
 }