|
@@ -407,6 +407,7 @@ func compareResult(resVal, pjVal, score2 int, comStr, compareBuyer, compareCity,
|
|
return eqV
|
|
return eqV
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//项目中的字段
|
|
var FIELDS = []string{
|
|
var FIELDS = []string{
|
|
"area",
|
|
"area",
|
|
"city",
|
|
"city",
|
|
@@ -418,18 +419,23 @@ var FIELDS = []string{
|
|
"buyerperson",
|
|
"buyerperson",
|
|
"buyertel",
|
|
"buyertel",
|
|
"winner",
|
|
"winner",
|
|
- //"budget",
|
|
|
|
- //"bidamount",
|
|
|
|
- //"bidstatus",
|
|
|
|
"agency",
|
|
"agency",
|
|
"projectscope",
|
|
"projectscope",
|
|
-
|
|
|
|
"topscopeclass",
|
|
"topscopeclass",
|
|
"subscopeclass",
|
|
"subscopeclass",
|
|
"winnerorder",
|
|
"winnerorder",
|
|
"package",
|
|
"package",
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+var bidtype = map[string]string{
|
|
|
|
+ "招标": "招标",
|
|
|
|
+ "邀标": "邀标",
|
|
|
|
+ "询价": "询价",
|
|
|
|
+ "单一": "单一",
|
|
|
|
+ "竞价": "竞价",
|
|
|
|
+ "竞谈": "竞谈",
|
|
|
|
+}
|
|
|
|
+
|
|
var bidstatus = map[string]string{
|
|
var bidstatus = map[string]string{
|
|
"预告": "预告",
|
|
"预告": "预告",
|
|
"中标": "中标",
|
|
"中标": "中标",
|
|
@@ -473,9 +479,14 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
set["ids"] = []string{thisinfo.Id}
|
|
set["ids"] = []string{thisinfo.Id}
|
|
if thisinfo.TopType == "招标" {
|
|
if thisinfo.TopType == "招标" {
|
|
set["zbtime"] = tmp["publishtime"]
|
|
set["zbtime"] = tmp["publishtime"]
|
|
- } else if thisinfo.TopType == "结果" {
|
|
|
|
|
|
+ } else if thisinfo.TopType == "结果" || thisinfo.SubType == "合同" {
|
|
set["jgtime"] = tmp["publishtime"]
|
|
set["jgtime"] = tmp["publishtime"]
|
|
}
|
|
}
|
|
|
|
+ //废标、流标 处理时间
|
|
|
|
+ if thisinfo.SubType == "流标" || thisinfo.SubType == "废标" {
|
|
|
|
+ set["zbtime"] = int64(0)
|
|
|
|
+ set["bidopentime"] = int64(0)
|
|
|
|
+ }
|
|
//异常标记
|
|
//异常标记
|
|
if thisinfo.TopType != "招标" && thisinfo.TopType != "拟建" && thisinfo.TopType != "预告" {
|
|
if thisinfo.TopType != "招标" && thisinfo.TopType != "拟建" && thisinfo.TopType != "预告" {
|
|
set["exception"] = 1
|
|
set["exception"] = 1
|
|
@@ -487,19 +498,22 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //招标类型
|
|
|
|
bt := qu.ObjToString(tmp["toptype"])
|
|
bt := qu.ObjToString(tmp["toptype"])
|
|
- set["bidtype"] = bt
|
|
|
|
- bs, _ := tmp["subtype"].(string)
|
|
|
|
|
|
+ bs := qu.ObjToString(tmp["subtype"])
|
|
p.mapBidLock.Lock()
|
|
p.mapBidLock.Lock()
|
|
- if bidstatus[bs] != "" {
|
|
|
|
- set["bidstatus"] = thisinfo.SubType
|
|
|
|
- } else if tmp["infoformat"] == 2 {
|
|
|
|
- set["bidstatus"] = "拟建"
|
|
|
|
- } else if tmp["subytpe"] == "招标" {
|
|
|
|
- set["bidstatus"] = thisinfo.TopType
|
|
|
|
- } else {
|
|
|
|
- set["bidstatus"] = "其它"
|
|
|
|
|
|
+ if bt == "招标" {
|
|
|
|
+ set["projectscope"] = qu.ObjToString(tmp["projectscope"])
|
|
|
|
+ set["bidtype"] = bidtype[bs]
|
|
|
|
+ set["bidstatus"] = bs
|
|
|
|
+ }else {
|
|
|
|
+ set["bidtype"] = bt
|
|
|
|
+ if bidstatus[bs] != "" {
|
|
|
|
+ set["bidstatus"] = thisinfo.SubType
|
|
|
|
+ } else if tmp["infoformat"] == 2 {
|
|
|
|
+ set["bidstatus"] = "拟建"
|
|
|
|
+ } else {
|
|
|
|
+ set["bidstatus"] = "其它"
|
|
|
|
+ }
|
|
}
|
|
}
|
|
p.mapBidLock.Unlock()
|
|
p.mapBidLock.Unlock()
|
|
|
|
|
|
@@ -518,7 +532,20 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
} else {
|
|
} else {
|
|
set["multipackage"] = 0
|
|
set["multipackage"] = 0
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ p1.InfoFiled = make(map[string]InfoFiled)
|
|
|
|
+ p1.InfoFiled[thisinfo.Id] =
|
|
|
|
+ InfoFiled{
|
|
|
|
+ budget: thisinfo.Budget,
|
|
|
|
+ bidamount: thisinfo.Bidamount,
|
|
|
|
+ projectName: thisinfo.ProjectName,
|
|
|
|
+ contractCode: thisinfo.ContractCode,
|
|
|
|
+ projectCode: thisinfo.ProjectCode,
|
|
|
|
+ bidstatus: bs,
|
|
|
|
+ }
|
|
|
|
+
|
|
push := p.PushListInfo(tmp, thisinfo.Id)
|
|
push := p.PushListInfo(tmp, thisinfo.Id)
|
|
|
|
+ push["s_winner"] = strings.Join(thisinfo.Winners, ",")
|
|
set["list"] = []bson.M{
|
|
set["list"] = []bson.M{
|
|
push,
|
|
push,
|
|
}
|
|
}
|
|
@@ -534,9 +561,11 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
return pId.Hex(), &p1
|
|
return pId.Hex(), &p1
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//招标信息字段
|
|
var INFOFIELDS = []string{
|
|
var INFOFIELDS = []string{
|
|
"projectname",
|
|
"projectname",
|
|
"projectcode",
|
|
"projectcode",
|
|
|
|
+ "projectscope",
|
|
"title",
|
|
"title",
|
|
"href",
|
|
"href",
|
|
"publishtime",
|
|
"publishtime",
|
|
@@ -557,7 +586,8 @@ var INFOFIELDS = []string{
|
|
"buyertel",
|
|
"buyertel",
|
|
"area",
|
|
"area",
|
|
"city",
|
|
"city",
|
|
- "list",
|
|
|
|
|
|
+ "spidercode",
|
|
|
|
+ "site",
|
|
}
|
|
}
|
|
|
|
|
|
//项目中list的信息
|
|
//项目中list的信息
|
|
@@ -603,6 +633,7 @@ func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidty
|
|
Bidamount: thisinfo.Bidamount,
|
|
Bidamount: thisinfo.Bidamount,
|
|
Bidstatus: thisinfo.SubType,
|
|
Bidstatus: thisinfo.SubType,
|
|
Bidtype: bidtype,
|
|
Bidtype: bidtype,
|
|
|
|
+ Winners: thisinfo.Winners,
|
|
}
|
|
}
|
|
if thisinfo.LenPTC > 5 {
|
|
if thisinfo.LenPTC > 5 {
|
|
p1.MPC = append(p1.MPC, thisinfo.PTC)
|
|
p1.MPC = append(p1.MPC, thisinfo.PTC)
|
|
@@ -632,20 +663,31 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
//2--lasttime
|
|
//2--lasttime
|
|
pInfo.LastTime = thisinfo.Publishtime
|
|
pInfo.LastTime = thisinfo.Publishtime
|
|
set["lasttime"] = thisinfo.Publishtime
|
|
set["lasttime"] = thisinfo.Publishtime
|
|
- set["bidtype"] = tmp["toptype"]
|
|
|
|
- bs, _ := tmp["subtype"].(string)
|
|
|
|
|
|
+ if thisinfo.TopType == "招标" {
|
|
|
|
+ set["zbtime"] = tmp["publishtime"]
|
|
|
|
+ } else if thisinfo.TopType == "结果" || thisinfo.SubType == "合同" {
|
|
|
|
+ set["jgtime"] = tmp["publishtime"]
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ bt := qu.ObjToString(tmp["toptype"])
|
|
|
|
+ bs := qu.ObjToString(tmp["subtype"])
|
|
p.mapBidLock.Lock()
|
|
p.mapBidLock.Lock()
|
|
- if bidstatus[bs] != "" {
|
|
|
|
- set["bidstatus"] = thisinfo.SubType
|
|
|
|
- if bidstatus[bs] != "预告" && bidstatus[bs] != "合同" {
|
|
|
|
- set["jgtime"] = tmp["publishtime"]
|
|
|
|
|
|
+ if bt == "招标" {
|
|
|
|
+ //招标状态,更新projectscope
|
|
|
|
+ if tmp["projectscope"] != nil {
|
|
|
|
+ set["projectscope"] = qu.ObjToString(tmp["projectscope"])
|
|
|
|
+ }
|
|
|
|
+ set["bidtype"] = bidtype[bs]
|
|
|
|
+ set["bidstatus"] = bs
|
|
|
|
+ }else {
|
|
|
|
+ set["bidtype"] = bt
|
|
|
|
+ if bidstatus[bs] != "" {
|
|
|
|
+ set["bidstatus"] = thisinfo.SubType
|
|
|
|
+ } else if tmp["infoformat"] == 2 {
|
|
|
|
+ set["bidstatus"] = "拟建"
|
|
|
|
+ } else {
|
|
|
|
+ set["bidstatus"] = "其它"
|
|
}
|
|
}
|
|
- } else if tmp["infoformat"] == 2 {
|
|
|
|
- set["bidstatus"] = "拟建"
|
|
|
|
- } else if tmp["subytpe"] == "招标" {
|
|
|
|
- set["bidstatus"] = thisinfo.TopType
|
|
|
|
- } else {
|
|
|
|
- set["bidstatus"] = "其它"
|
|
|
|
}
|
|
}
|
|
p.mapBidLock.Unlock()
|
|
p.mapBidLock.Unlock()
|
|
|
|
|
|
@@ -759,10 +801,8 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
sort.Strings(pInfo.Winners)
|
|
sort.Strings(pInfo.Winners)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //set["winners"] = pInfo.Winners
|
|
|
|
set["s_winner"] = strings.Join(pInfo.Winners, ",")
|
|
set["s_winner"] = strings.Join(pInfo.Winners, ",")
|
|
}
|
|
}
|
|
-
|
|
|
|
if thisinfo.HasPackage { //多包处理
|
|
if thisinfo.HasPackage { //多包处理
|
|
set["multipackage"] = 1
|
|
set["multipackage"] = 1
|
|
pkg := PackageFormat(thisinfo, pInfo)
|
|
pkg := PackageFormat(thisinfo, pInfo)
|
|
@@ -775,18 +815,17 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
CountAmount(pInfo, thisinfo)
|
|
CountAmount(pInfo, thisinfo)
|
|
set["budget"] = pInfo.Budget
|
|
set["budget"] = pInfo.Budget
|
|
set["bidamount"] = pInfo.Bidamount
|
|
set["bidamount"] = pInfo.Bidamount
|
|
- //
|
|
|
|
|
|
|
|
set["mpn"] = pInfo.MPN
|
|
set["mpn"] = pInfo.MPN
|
|
set["mpc"] = pInfo.MPC
|
|
set["mpc"] = pInfo.MPC
|
|
set["pici"] = p.pici
|
|
set["pici"] = p.pici
|
|
-
|
|
|
|
update := map[string]interface{}{}
|
|
update := map[string]interface{}{}
|
|
if len(set) > 0 {
|
|
if len(set) > 0 {
|
|
update["$set"] = set
|
|
update["$set"] = set
|
|
}
|
|
}
|
|
//保留原数据吧
|
|
//保留原数据吧
|
|
push := p.PushListInfo(tmp, thisinfo.Id)
|
|
push := p.PushListInfo(tmp, thisinfo.Id)
|
|
|
|
+ push["s_winner"] = strings.Join(thisinfo.Winners, ",")
|
|
push["compareStr"] = comStr
|
|
push["compareStr"] = comStr
|
|
push["resVal"] = pInfo.resVal
|
|
push["resVal"] = pInfo.resVal
|
|
push["pjVal"] = pInfo.pjVal
|
|
push["pjVal"] = pInfo.pjVal
|
|
@@ -979,8 +1018,20 @@ func CountAmount(project *ProjectInfo, info *Info) {
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
//招标不是单包
|
|
//招标不是单包
|
|
- if project.Budget < info.Budget {
|
|
|
|
- project.Budget = info.Budget
|
|
|
|
|
|
+ flag := false
|
|
|
|
+ if project.InfoFiled != nil && len(project.InfoFiled) > 0 {
|
|
|
|
+ for _, res := range project.InfoFiled {
|
|
|
|
+ if res.projectName == info.ProjectName {
|
|
|
|
+ if res.budget < info.Budget {
|
|
|
|
+ project.Budget = project.Budget - res.budget + info.Budget
|
|
|
|
+ }
|
|
|
|
+ flag = true
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if !flag {
|
|
|
|
+ project.Budget = project.Budget + info.Budget
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1023,59 +1074,41 @@ func CountAmount(project *ProjectInfo, info *Info) {
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
//招标不是单包
|
|
//招标不是单包
|
|
- if project.Bidamount < info.Bidamount {
|
|
|
|
- project.Bidamount = info.Bidamount
|
|
|
|
|
|
+ flag := false
|
|
|
|
+ if project.InfoFiled != nil && len(project.InfoFiled) > 0 {
|
|
|
|
+ for _, res := range project.InfoFiled {
|
|
|
|
+ if res.bidstatus == "合同" && res.contractCode != "" && info.SubType == "合同" && info.ContractCode != "" {
|
|
|
|
+ if res.contractCode == info.ContractCode {
|
|
|
|
+ if res.bidamount < info.Bidamount {
|
|
|
|
+ project.Bidamount = project.Bidamount - res.bidamount + info.Bidamount
|
|
|
|
+ }
|
|
|
|
+ flag = true
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if res.projectName == info.ProjectName {
|
|
|
|
+ if res.bidamount < info.Bidamount {
|
|
|
|
+ project.Bidamount = project.Bidamount - res.bidamount + info.Bidamount
|
|
|
|
+ }
|
|
|
|
+ flag = true
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if !flag {
|
|
|
|
+ project.Bidamount = project.Bidamount + info.Bidamount
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- //if info.Budget > 0 {
|
|
|
|
- // //项目中第一条招标信息是否是包/段项目
|
|
|
|
- // key := KeyPackage.FindStringSubmatch(project.ProjectName)
|
|
|
|
- // if len(key) > 0 {
|
|
|
|
- // //判断项目中是否已经计算过该包/段的预算
|
|
|
|
- // if !isCount(project, info.ProjectName) {
|
|
|
|
- // project.Budget = project.Budget + info.Budget
|
|
|
|
- // }
|
|
|
|
- // }else {
|
|
|
|
- // if project.Budget < info.Budget {
|
|
|
|
- // project.Budget = info.Budget
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
- ////中标、成交、合同 处理中标金额(bidamount)
|
|
|
|
- //if info.SubType == "中标" || info.SubType == "成交" || info.SubType == "合同" {
|
|
|
|
- // if info.Bidamount > 0 {
|
|
|
|
- // key := KeyPackage.FindStringSubmatch(project.ProjectName)
|
|
|
|
- // if len(key) > 0 {
|
|
|
|
- // if !isCount(project, info.ProjectName) {
|
|
|
|
- // project.Bidamount = project.Bidamount + info.Bidamount
|
|
|
|
- // }
|
|
|
|
- // }else {
|
|
|
|
- // if project.Bidamount > info.Bidamount {
|
|
|
|
- // project.Bidamount = info.Bidamount
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
- //
|
|
|
|
- ////保存信息到IdStatusInfo
|
|
|
|
- //if project.IdStatusInfo != nil {
|
|
|
|
- // project.IdStatusInfo[info.Id] = map[string]interface{}{
|
|
|
|
- // "projectname": info.ProjectName,
|
|
|
|
- // "bidstatus": info.SubType,
|
|
|
|
- // "budget": info.Budget,
|
|
|
|
- // "bidamount": info.Bidamount,
|
|
|
|
- // }
|
|
|
|
- //}else {
|
|
|
|
- // project.IdStatusInfo = map[string]map[string]interface{}{}
|
|
|
|
- // project.IdStatusInfo[info.Id] = map[string]interface{}{
|
|
|
|
- // "projectname": info.ProjectName,
|
|
|
|
- // "bidstatus": info.SubType,
|
|
|
|
- // "budget": info.Budget,
|
|
|
|
- // "bidamount": info.Bidamount,
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
|
|
+ project.InfoFiled[info.Id] = InfoFiled{
|
|
|
|
+ budget: info.Budget,
|
|
|
|
+ bidamount: info.Bidamount,
|
|
|
|
+ contractCode: info.ContractCode,
|
|
|
|
+ projectName: info.ProjectName,
|
|
|
|
+ projectCode: info.ProjectCode,
|
|
|
|
+ bidstatus: info.SubType,
|
|
|
|
+ }
|
|
}
|
|
}
|