|
@@ -4,6 +4,7 @@ import (
|
|
|
"encoding/json"
|
|
|
"log"
|
|
|
"math"
|
|
|
+ "mongodb"
|
|
|
qu "qfw/util"
|
|
|
"sort"
|
|
|
"strings"
|
|
@@ -95,7 +96,7 @@ func (p *ProjectTask) startProjectMerge(info *Info, tmp map[string]interface{})
|
|
|
p.findLock.Lock()
|
|
|
defer p.findLock.Unlock()
|
|
|
// 3.18 isfow=0数据不参与项目合并
|
|
|
- code := qu.ObjToString(tmp["spidercode"])
|
|
|
+ code := strings.ReplaceAll(qu.ObjToString(tmp["spidercode"]), " ", "")
|
|
|
p.mapSpiderLock.Lock()
|
|
|
isflow := p.mapSpider[code]
|
|
|
p.mapSpiderLock.Unlock()
|
|
@@ -420,28 +421,10 @@ func compareResult(resVal, pjVal, score2 int, comStr, compareBuyer, compareCity,
|
|
|
return eqV
|
|
|
}
|
|
|
|
|
|
-//项目中的字段
|
|
|
-var FIELDS = []string{
|
|
|
- "area",
|
|
|
- "city",
|
|
|
- "district",
|
|
|
- "projectname",
|
|
|
- "projectcode",
|
|
|
- "buyer",
|
|
|
- "buyerclass",
|
|
|
- "buyerperson",
|
|
|
- "buyertel",
|
|
|
- "winner",
|
|
|
- "agency",
|
|
|
- "topscopeclass",
|
|
|
- "subscopeclass",
|
|
|
- "package",
|
|
|
-}
|
|
|
-
|
|
|
//招标时间zbtime、中标时间jgtime、项目状态bidstatus、招标类型bidtype、最后发布时间lasttime、首次发布时间firsttime
|
|
|
-
|
|
|
func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (string, *ProjectInfo) {
|
|
|
- pId := primitive.NewObjectID() //NewObjectId()
|
|
|
+ //pId := primitive.NewObjectID() //NewObjectId()
|
|
|
+ pId := mongodb.StringTOBsonId(thisinfo.Id)
|
|
|
set := map[string]interface{}{}
|
|
|
set["_id"] = pId
|
|
|
for _, f := range FIELDS {
|
|
@@ -515,10 +498,10 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
|
}
|
|
|
set["ids"] = []string{thisinfo.Id}
|
|
|
if thisinfo.TopType == "招标" {
|
|
|
- if thisinfo.SubType != "变更" && thisinfo.SubType != "其它" {
|
|
|
+ //if thisinfo.SubType != "变更" && thisinfo.SubType != "其它" {
|
|
|
set["zbtime"] = tmp["publishtime"]
|
|
|
p1.Zbtime = qu.Int64All(tmp["publishtime"])
|
|
|
- }
|
|
|
+ //}
|
|
|
} else if thisinfo.TopType == "结果" || thisinfo.SubType == "合同" {
|
|
|
set["jgtime"] = tmp["publishtime"]
|
|
|
p1.Jgtime = thisinfo.Publishtime
|
|
@@ -669,49 +652,6 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
|
return pId.Hex(), &p1
|
|
|
}
|
|
|
|
|
|
-//招标信息字段
|
|
|
-var INFOFIELDS = []string{
|
|
|
- "projectname",
|
|
|
- "projectcode",
|
|
|
- "projectscope",
|
|
|
- "contractcode",
|
|
|
- "title",
|
|
|
- "href",
|
|
|
- "publishtime",
|
|
|
- "comeintime",
|
|
|
- "bidopentime",
|
|
|
- "toptype",
|
|
|
- "subtype",
|
|
|
- "buyer",
|
|
|
- "buyerclass",
|
|
|
- "agency",
|
|
|
- "winner",
|
|
|
- "budget",
|
|
|
- "bidamount",
|
|
|
- "topscopeclass",
|
|
|
- "subscopclass",
|
|
|
- "infoformat",
|
|
|
- "buyerperson",
|
|
|
- "buyertel",
|
|
|
- "area",
|
|
|
- "city",
|
|
|
- "district",
|
|
|
- "spidercode",
|
|
|
- "site",
|
|
|
- "review_experts",
|
|
|
- "purchasing",
|
|
|
- "project_scale",
|
|
|
- "project_duration",
|
|
|
- "project_timeunit",
|
|
|
- "project_startdate",
|
|
|
- "project_completedate",
|
|
|
- "payway",
|
|
|
- "contract_guarantee",
|
|
|
- "bid_guarantee",
|
|
|
- "qualifies",
|
|
|
- "entidlist",
|
|
|
-}
|
|
|
-
|
|
|
//项目中list的信息
|
|
|
func (p *ProjectTask) PushListInfo(tmp map[string]interface{}, infoid string) bson.M {
|
|
|
res := bson.M{
|
|
@@ -761,7 +701,7 @@ func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidty
|
|
|
return p1
|
|
|
}
|
|
|
|
|
|
-//更新项目
|
|
|
+//更新项目 全量合并
|
|
|
func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info, pInfo *ProjectInfo, weight int, comStr string, ex int) {
|
|
|
if p.currentType != "updateInfo" {
|
|
|
if BinarySearch(pInfo.Ids, thisinfo.Id) > -1 {
|
|
@@ -780,7 +720,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
|
pInfo.LastTime = thisinfo.Publishtime
|
|
|
set["lasttime"] = thisinfo.Publishtime
|
|
|
if thisinfo.TopType == "招标" {
|
|
|
- if thisinfo.SubType != "变更" && thisinfo.SubType != "其它" && pInfo.Zbtime <= 0 {
|
|
|
+ if pInfo.Zbtime <= 0 {
|
|
|
set["zbtime"] = tmp["publishtime"]
|
|
|
}
|
|
|
if pInfo.Jgtime > 0 {
|
|
@@ -790,16 +730,16 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
|
} else if thisinfo.TopType == "结果" {
|
|
|
if thisinfo.SubType == "中标" || thisinfo.SubType == "成交" || thisinfo.SubType == "流标" || thisinfo.SubType == "废标" {
|
|
|
if pInfo.Jgtime > 0 {
|
|
|
- jg1 := int64(math.Abs(float64(pInfo.Jgtime - thisinfo.Publishtime)))
|
|
|
+ //jg1 := int64(math.Abs(float64(pInfo.Jgtime - thisinfo.Publishtime)))
|
|
|
//公告状态和项目状态同样都是中标或者成交,
|
|
|
- if (thisinfo.SubType == "中标" || thisinfo.SubType == "成交") && (pInfo.Bidstatus == "中标" || pInfo.Bidstatus == "成交") {
|
|
|
- if jg1 > p.jgTime {
|
|
|
+ if thisinfo.SubType == "成交" && pInfo.Bidstatus == "中标" {
|
|
|
+ if p.jgTime < thisinfo.Publishtime {
|
|
|
set["jgtime"] = tmp["publishtime"]
|
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
|
}
|
|
|
//公告状态和项目状态同样是流标或者废标
|
|
|
} else if (thisinfo.SubType == "流标" || thisinfo.SubType == "废标") && (pInfo.Bidstatus == "流标" || pInfo.Bidstatus == "废标") {
|
|
|
- if jg1 > p.jgTime {
|
|
|
+ if p.jgTime < thisinfo.Publishtime {
|
|
|
set["jgtime"] = tmp["publishtime"]
|
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
|
}
|
|
@@ -933,7 +873,12 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
|
if pInfo.ContractCode == "" {
|
|
|
set["contractcode"] = thisinfo.ContractCode
|
|
|
}else {
|
|
|
- set["contractcode"] = pInfo.ContractCode + "," + thisinfo.ContractCode
|
|
|
+ list := strings.Split(pInfo.ContractCode, ",")
|
|
|
+ if BinarySearch(list, thisinfo.ContractCode) == -1 {
|
|
|
+ list = append(list, thisinfo.ContractCode)
|
|
|
+ sort.Strings(list)
|
|
|
+ }
|
|
|
+ set["contractcode"] = strings.Join(list, ",")
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1179,6 +1124,10 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func (p *ProjectTask) x() {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 更新项目时,项目状态的处理
|
|
|
* 返回是否新增项目,异常标记
|
|
@@ -1243,18 +1192,6 @@ func ComparePlace(project *ProjectInfo, info *Info) bool {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
-var PackageEle = []string{
|
|
|
- "origin",
|
|
|
- "name",
|
|
|
- //"text",
|
|
|
- "budget",
|
|
|
- "winner",
|
|
|
- "bidamount",
|
|
|
- "bidamounttype",
|
|
|
- "currency",
|
|
|
- "bidstatus",
|
|
|
-}
|
|
|
-
|
|
|
func packageEle(map1 map[string]interface{}, id string) map[string]interface{} {
|
|
|
p2 := map[string]interface{}{}
|
|
|
for _, k := range PackageEle {
|
|
@@ -1494,24 +1431,6 @@ func IsCreatePro(info *Info) (bol bool) {
|
|
|
return bol
|
|
|
}
|
|
|
|
|
|
-var bidtype = map[string]string{
|
|
|
- "招标": "招标",
|
|
|
- "邀标": "邀标",
|
|
|
- "询价": "询价",
|
|
|
- "单一": "单一",
|
|
|
- "竞价": "竞价",
|
|
|
- "竞谈": "竞谈",
|
|
|
-}
|
|
|
-
|
|
|
-var bidstatus = map[string]string{
|
|
|
- "预告": "预告",
|
|
|
- "中标": "中标",
|
|
|
- "成交": "成交",
|
|
|
- "废标": "废标",
|
|
|
- "流标": "流标",
|
|
|
- "合同": "合同",
|
|
|
-}
|
|
|
-
|
|
|
func (p *ProjectTask) GetBidTypeAndBidStatus(info *Info) (string, string) {
|
|
|
p.mapBidLock.Lock()
|
|
|
defer p.mapBidLock.Unlock()
|