|
@@ -129,11 +129,11 @@ func (p *ProjectTask) startProjectMerge(info *Info, tmp map[string]interface{})
|
|
|
|
|
|
//代理机构完全不相同,直接新建项目
|
|
|
if CheckContain(compareProject.Agency, info.Agency) == 3 {
|
|
|
- break
|
|
|
+ continue
|
|
|
}
|
|
|
//地区(省、市、区)不同,直接新建项目
|
|
|
if ComparePlace(compareProject, info) {
|
|
|
- break
|
|
|
+ continue
|
|
|
}
|
|
|
|
|
|
info.PNBH = 0
|
|
@@ -175,45 +175,54 @@ func (p *ProjectTask) startProjectMerge(info *Info, tmp map[string]interface{})
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- bFindProject = true
|
|
|
- findPid = resN[0].Id.Hex()
|
|
|
- for k2, bv := range []int{bpn, bpc, bptc, bpb} {
|
|
|
- if bv > -1 {
|
|
|
- pids[bv].Arr = append(pids[bv].Arr, findPid)
|
|
|
- if k2 == 0 {
|
|
|
- if resN[0].ProjectName == "" {
|
|
|
- resN[0].ProjectName = info.ProjectName
|
|
|
- } else {
|
|
|
- if resN[0].MPN == nil {
|
|
|
- resN[0].MPN = []string{info.ProjectName}
|
|
|
+ ex := 0
|
|
|
+ resArr := []*ProjectInfo{}
|
|
|
+ for _, res := range resN{
|
|
|
+ choose, e := CompareStatus(resN[0], info)
|
|
|
+ if !choose {
|
|
|
+ ex = e
|
|
|
+ resArr = append(resArr, res)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(resArr) > 0 {
|
|
|
+ bFindProject = true
|
|
|
+ findPid = resArr[0].Id.Hex()
|
|
|
+ for k2, bv := range []int{bpn, bpc, bptc, bpb} {
|
|
|
+ if bv > -1 {
|
|
|
+ pids[bv].Arr = append(pids[bv].Arr, findPid)
|
|
|
+ if k2 == 0 {
|
|
|
+ if resArr[0].ProjectName == "" {
|
|
|
+ resArr[0].ProjectName = info.ProjectName
|
|
|
} else {
|
|
|
- resN[0].MPN = append(resN[0].MPN, info.ProjectName)
|
|
|
+ if resArr[0].MPN == nil {
|
|
|
+ resArr[0].MPN = []string{info.ProjectName}
|
|
|
+ } else {
|
|
|
+ resArr[0].MPN = append(resArr[0].MPN, info.ProjectName)
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- } else if k2 < 3 {
|
|
|
- if resN[0].ProjectCode == "" {
|
|
|
- resN[0].ProjectCode = qu.If(k2 == 1, info.ProjectCode, info.PTC).(string)
|
|
|
- } else {
|
|
|
- if resN[0].MPC == nil {
|
|
|
- resN[0].MPC = []string{qu.If(k2 == 1, info.ProjectCode, info.PTC).(string)}
|
|
|
+ } else if k2 < 3 {
|
|
|
+ if resArr[0].ProjectCode == "" {
|
|
|
+ resArr[0].ProjectCode = qu.If(k2 == 1, info.ProjectCode, info.PTC).(string)
|
|
|
} else {
|
|
|
- resN[0].MPC = append(resN[0].MPC, qu.If(k2 == 1, info.ProjectCode, info.PTC).(string))
|
|
|
+ if resArr[0].MPC == nil {
|
|
|
+ resArr[0].MPC = []string{qu.If(k2 == 1, info.ProjectCode, info.PTC).(string)}
|
|
|
+ } else {
|
|
|
+ resArr[0].MPC = append(resArr[0].MPC, qu.If(k2 == 1, info.ProjectCode, info.PTC).(string))
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- } else {
|
|
|
- if resN[0].Buyer == "" {
|
|
|
- resN[0].Buyer = info.Buyer
|
|
|
+ } else {
|
|
|
+ if resArr[0].Buyer == "" {
|
|
|
+ resArr[0].Buyer = info.Buyer
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- choose, ex := CompareStatus(resN[0], info)
|
|
|
- if !choose {
|
|
|
- p.UpdateProject(tmp, info, resN[0], kv+1, resN[0].comStr, ex)
|
|
|
+ p.UpdateProject(tmp, info, resArr[0], kv+1, resArr[0].comStr, ex)
|
|
|
}else {
|
|
|
bFindProject = false
|
|
|
+ findPid = ""
|
|
|
}
|
|
|
break
|
|
|
}
|
|
@@ -496,15 +505,9 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
|
bt = "招标"
|
|
|
}
|
|
|
set["bidtype"] = bt
|
|
|
- bs, _ := tmp["bidstatus"].(string)
|
|
|
- if bidstatus[bs] != "" {
|
|
|
- set["bidstatus"] = bs
|
|
|
- }
|
|
|
- if set["bidstatus"] == nil && thisinfo.TopType == "结果" {
|
|
|
- bs = thisinfo.SubType
|
|
|
- set["bidstatus"] = thisinfo.SubType
|
|
|
- }
|
|
|
- p1, pkg := p.NewCachePinfo(pId, thisinfo, bs, bt)
|
|
|
+ set["bidstatus"] = thisinfo.SubType
|
|
|
+
|
|
|
+ p1, pkg := p.NewCachePinfo(pId, thisinfo, bt)
|
|
|
if len(thisinfo.Subscopeclass) > 0 {
|
|
|
s_subscopeclass := strings.Join(thisinfo.Subscopeclass, ",")
|
|
|
set["s_subscopeclass"] = s_subscopeclass
|
|
@@ -575,7 +578,7 @@ func (p *ProjectTask) PushListInfo(tmp map[string]interface{}, infoid string) bs
|
|
|
}
|
|
|
|
|
|
//生成存放在内存中的对象
|
|
|
-func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidstatus, bidtype string) (ProjectInfo, map[string]interface{}) {
|
|
|
+func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidtype string) (ProjectInfo, map[string]interface{}) {
|
|
|
pkg := map[string]interface{}{}
|
|
|
if thisinfo.HasPackage {
|
|
|
pkg, _, _ = PackageFormat(thisinfo, nil)
|
|
@@ -602,7 +605,7 @@ func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidst
|
|
|
Budget: thisinfo.Budget,
|
|
|
Package: pkg,
|
|
|
Bidamount: thisinfo.Bidamount,
|
|
|
- Bidstatus: bidstatus,
|
|
|
+ Bidstatus: thisinfo.SubType,
|
|
|
Bidtype: bidtype,
|
|
|
}
|
|
|
if thisinfo.LenPTC > 5 {
|
|
@@ -825,13 +828,14 @@ func CompareStatus(project *ProjectInfo, info *Info) (bool, int) {
|
|
|
if project.Bidstatus == "拟建" || project.Bidstatus == "预告" || project.Bidstatus == "招标" {
|
|
|
return false, 0
|
|
|
}else if project.Bidstatus == info.SubType {
|
|
|
- return true, 0
|
|
|
- }else if project.Bidstatus == "成交" {
|
|
|
- if info.SubType == "中标" {
|
|
|
- return true, 0
|
|
|
- }else {
|
|
|
+ key := titleGetPc.FindStringSubmatch(info.ProjectName)
|
|
|
+ if key != nil {
|
|
|
return false, 0
|
|
|
+ }else {
|
|
|
+ return true, 0
|
|
|
}
|
|
|
+ }else if project.Bidstatus == "成交" && info.SubType == "中标" {
|
|
|
+ return true, 0
|
|
|
}else if project.Bidstatus == "流标" || project.Bidstatus == "废标" {
|
|
|
return false, 2
|
|
|
}else if project.Bidstatus == "合同" || project.Bidstatus == "其它" {
|