Browse Source

项目合并9.14

Jianghan 4 years ago
parent
commit
020f748c0e
3 changed files with 97 additions and 42 deletions
  1. 36 36
      fullproject/src_v1/init.go
  2. 60 5
      fullproject/src_v1/project.go
  3. 1 1
      fullproject/src_v1/task.go

+ 36 - 36
fullproject/src_v1/init.go

@@ -224,28 +224,30 @@ func NewKeyMap() *KeyMap {
 
 //招标信息实体类
 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"`
-	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"`
+	HasPackage    bool                     // `json:"haspackage"`
+	Package       map[string]interface{}   `json:"package"`
 	//PNum          string                 `json:"pnum"`
 	Topscopeclass []string `json:"topscopeclass"`
 	Subscopeclass []string `json:"subscopeclass"`
@@ -255,14 +257,11 @@ type Info struct {
 	Bidamount     float64  `json:"bidamount"`
 	Winners       []string
 	dealtype      int
-
-	Winnerorder []string
-
-	PTC    string //从标题中抽的项目编号
-	pnbval int    //项目名称、编号、采购单位存在的个数
-	LenPC  int    //项目编号长度
-	LenPN  int    //项目名称长度
-	LenPTC int    //标题抽的项目编号长度
+	PTC           string //从标题中抽的项目编号
+	pnbval        int    //项目名称、编号、采购单位存在的个数
+	LenPC         int    //项目编号长度
+	LenPN         int    //项目名称长度
+	LenPTC        int    //标题抽的项目编号长度
 	//以下三个元素做对比,计算包含时候使用
 	PNBH  int //0初始,+包含,-被包含
 	PCBH  int
@@ -292,17 +291,18 @@ type ProjectInfo struct {
 	District      string             `json:"district"`                //区县
 	Bidstatus     string             `json:"bidstatus"`               //
 	Bidtype       string             `json:"bidtype"`                 //
-	ReviewExperts []string			 `json:"review_experts"`			 // 项目评审专家
+	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"` //中标候选人
+	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

+ 60 - 5
fullproject/src_v1/project.go

@@ -420,7 +420,6 @@ var FIELDS = []string{
 	"agency",
 	"topscopeclass",
 	"subscopeclass",
-	"winnerorder",
 	"package",
 }
 
@@ -480,7 +479,11 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
 		set["bidstatus"] = "拟建"
 		bt = "拟建"
 	} else {
-		set["bidtype"] = bidtype[bs]
+		if bidtype[bs] != "" {
+			set["bidtype"] = bidtype[bs]
+		}else {
+			set["bidtype"] = "招标"
+		}
 		if bt == "招标" {
 			set["projectscope"] = qu.ObjToString(tmp["projectscope"])
 			set["bidstatus"] = bt
@@ -569,6 +572,21 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
 	//项目评审专家
 	if len(thisinfo.ReviewExperts) > 0 {
 		set["review_experts"] = thisinfo.ReviewExperts
+		p1.ReviewExperts = thisinfo.ReviewExperts
+	}
+	//标的物
+	if thisinfo.Purchasing != "" {
+		set["purchasing"] = thisinfo.Purchasing
+		p1.Purchasing = thisinfo.Purchasing
+	}
+	//中标候选人
+	if len(thisinfo.WinnerOrder) > 0 {
+		var list = []string{}
+		for _, v := range thisinfo.WinnerOrder{
+			list = append(list, qu.ObjToString(v["entname"]))
+		}
+		set["winnerorder"] = list
+		p1.Winnerorder = list
 	}
 
 	p1.InfoFiled = make(map[string]InfoField)
@@ -633,6 +651,8 @@ var INFOFIELDS = []string{
 	"district",
 	"spidercode",
 	"site",
+	"review_experts",
+	"purchasing",
 }
 
 //项目中list的信息
@@ -677,6 +697,7 @@ func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidty
 		Bidtype:       bidtype,
 		Winners:       thisinfo.Winners,
 		ReviewExperts: thisinfo.ReviewExperts,
+		Purchasing:	   thisinfo.Purchasing,
 	}
 	if thisinfo.LenPTC > 5 {
 		p1.MPC = append(p1.MPC, thisinfo.PTC)
@@ -748,9 +769,6 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 	bt := qu.ObjToString(tmp["toptype"])
 	bs := qu.ObjToString(tmp["subtype"])
 	p.mapBidLock.Lock()
-	if bidtype[bs] != "" {
-		set["bidtype"] = bidtype[bs]
-	}
 	if bt == "招标" {
 		//招标状态,更新projectscope
 		if tmp["projectscope"] != nil {
@@ -758,6 +776,13 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 		}
 		set["bidstatus"] = bt
 		pInfo.Bidstatus = bt
+		if bidtype[bs] != "" {
+			set["bidtype"] = bidtype[bs]
+			pInfo.Bidtype = bidtype[bs]
+		}else {
+			set["bidtype"] = "招标"
+			pInfo.Bidtype = "招标"
+		}
 	} else {
 		if bidstatus[bs] != "" {
 			set["bidstatus"] = thisinfo.SubType
@@ -862,6 +887,36 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 		}
 		set["review_experts"] = pInfo.ReviewExperts
 	}
+	if thisinfo.Purchasing != "" {
+		if pInfo.Purchasing == "" {
+			pInfo.Purchasing = thisinfo.Purchasing
+			set["purchasing"] = thisinfo.Purchasing
+		}else {
+			list := strings.Split(pInfo.Purchasing, ",")
+			for _, k := range list {
+				if BinarySearch(strings.Split(thisinfo.Purchasing, ","), k) == -1 {
+					list = append(list, k)
+					sort.Strings(list)
+				}
+			}
+			set["purchasing"] = strings.Join(list, ",")
+		}
+	}
+
+	//中标候选人
+	if len(thisinfo.WinnerOrder) > 0 {
+		var list = []string{}
+		for _, v := range thisinfo.WinnerOrder{
+			list = append(list, qu.ObjToString(v["entname"]))
+		}
+		for _, k := range list {
+			if BinarySearch(list, k) == -1 {
+				pInfo.Winnerorder = append(pInfo.Winnerorder, k)
+				sort.Strings(pInfo.Winnerorder)
+			}
+		}
+		set["winnerorder"] = pInfo.Winnerorder
+	}
 
 	if len(thisinfo.Subscopeclass) > 0 {
 		sort.Strings(pInfo.Subscopeclass)

+ 1 - 1
fullproject/src_v1/task.go

@@ -595,7 +595,7 @@ func (p *ProjectTask) enter(db, coll string, q map[string]interface{}) {
 	}()
 	fields := map[string]interface{} {"area": 1, "city": 1, "district": 1, "comeintime": 1, "publishtime": 1, "bidopentime": 1, "title": 1, "projectname": 1, "href": 1,
 		"projectcode": 1, "buyerclass": 1, "winner": 1, "s_winner": 1, "buyer": 1, "buyerperson": 1, "buyertel": 1, "infoformat": 1, "toptype": 1, "subtype": 1, "spidercode": 1,
-		"site": 1, "topscopeclass": 1, "subscopeclass": 1, "bidamount": 1, "budget": 1, "agency": 1, "package": 1, "jsondata": 1, "review_experts": 1}
+		"site": 1, "topscopeclass": 1, "subscopeclass": 1, "bidamount": 1, "budget": 1, "agency": 1, "package": 1, "jsondata": 1, "review_experts": 1, "purchasing": 1}
 	ms := sess.DB(db).C(coll).Find(q).Select(fields).Sort("publishtime")
 	if Sysconfig["hints"] != nil {
 		ms.Hint(Sysconfig["hints"])