|
@@ -3,14 +3,15 @@ package main
|
|
import (
|
|
import (
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"log"
|
|
"log"
|
|
- "time"
|
|
|
|
-
|
|
|
|
- "go.mongodb.org/mongo-driver/bson"
|
|
|
|
- "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
|
"math"
|
|
"math"
|
|
qu "qfw/util"
|
|
qu "qfw/util"
|
|
|
|
+ "regexp"
|
|
"sort"
|
|
"sort"
|
|
"strings"
|
|
"strings"
|
|
|
|
+ "time"
|
|
|
|
+
|
|
|
|
+ "go.mongodb.org/mongo-driver/bson"
|
|
|
|
+ "go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
)
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -225,7 +226,7 @@ func (p *ProjectTask) startProjectMerge(info *Info, tmp map[string]interface{})
|
|
}
|
|
}
|
|
|
|
|
|
if !bFindProject {
|
|
if !bFindProject {
|
|
- if info.SubType == "" || info.SubType == "变更" || info.SubType == "验收" || info.SubType == "违规" ||
|
|
|
|
|
|
+ if info.SubType == "" || info.SubType == "变更" || info.SubType == "验收" || info.SubType == "违规" ||
|
|
info.SubType == "结果变更" || info.SubType == "其它" {
|
|
info.SubType == "结果变更" || info.SubType == "其它" {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -489,7 +490,7 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
} else {
|
|
} else {
|
|
if bidtype[bs] != "" {
|
|
if bidtype[bs] != "" {
|
|
set["bidtype"] = bidtype[bs]
|
|
set["bidtype"] = bidtype[bs]
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
set["bidtype"] = "招标"
|
|
set["bidtype"] = "招标"
|
|
}
|
|
}
|
|
if bt == "招标" {
|
|
if bt == "招标" {
|
|
@@ -522,7 +523,7 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
//增量用系统时间,全量(历史)入库时间
|
|
//增量用系统时间,全量(历史)入库时间
|
|
if p.currentType == "project" {
|
|
if p.currentType == "project" {
|
|
set["pici"] = p.pici
|
|
set["pici"] = p.pici
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
set["pici"] = tmp["comeintime"]
|
|
set["pici"] = tmp["comeintime"]
|
|
}
|
|
}
|
|
set["ids"] = []string{thisinfo.Id}
|
|
set["ids"] = []string{thisinfo.Id}
|
|
@@ -532,8 +533,8 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
p1.Zbtime = qu.Int64All(tmp["publishtime"])
|
|
p1.Zbtime = qu.Int64All(tmp["publishtime"])
|
|
}
|
|
}
|
|
} else if thisinfo.TopType == "结果" || thisinfo.SubType == "合同" {
|
|
} else if thisinfo.TopType == "结果" || thisinfo.SubType == "合同" {
|
|
- set["jgtime"] = tmp["publishtime"]
|
|
|
|
- p1.Jgtime = thisinfo.Publishtime
|
|
|
|
|
|
+ set["jgtime"] = tmp["publishtime"]
|
|
|
|
+ p1.Jgtime = thisinfo.Publishtime
|
|
}
|
|
}
|
|
|
|
|
|
if len(thisinfo.Subscopeclass) > 0 {
|
|
if len(thisinfo.Subscopeclass) > 0 {
|
|
@@ -558,7 +559,7 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
}
|
|
}
|
|
if p1.Bidamount > 0 {
|
|
if p1.Bidamount > 0 {
|
|
set["sortprice"] = p1.Bidamount
|
|
set["sortprice"] = p1.Bidamount
|
|
- }else if p1.Budget > 0 {
|
|
|
|
|
|
+ } else if p1.Budget > 0 {
|
|
set["sortprice"] = p1.Budget
|
|
set["sortprice"] = p1.Budget
|
|
}
|
|
}
|
|
|
|
|
|
@@ -574,8 +575,13 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
}
|
|
}
|
|
//项目评审专家
|
|
//项目评审专家
|
|
if len(thisinfo.ReviewExperts) > 0 {
|
|
if len(thisinfo.ReviewExperts) > 0 {
|
|
- set["review_experts"] = thisinfo.ReviewExperts
|
|
|
|
- p1.ReviewExperts = thisinfo.ReviewExperts
|
|
|
|
|
|
+ arr := FormatRp(thisinfo.ReviewExperts)
|
|
|
|
+ if len(arr) > 0 {
|
|
|
|
+ set["review_experts"] = thisinfo.ReviewExperts
|
|
|
|
+ p1.ReviewExperts = thisinfo.ReviewExperts
|
|
|
|
+ } else {
|
|
|
|
+ p1.ReviewExperts = arr
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//标的物
|
|
//标的物
|
|
if thisinfo.Purchasing != "" {
|
|
if thisinfo.Purchasing != "" {
|
|
@@ -585,7 +591,7 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
//中标候选人
|
|
//中标候选人
|
|
if len(thisinfo.WinnerOrder) > 0 {
|
|
if len(thisinfo.WinnerOrder) > 0 {
|
|
var list = []string{}
|
|
var list = []string{}
|
|
- for _, v := range thisinfo.WinnerOrder{
|
|
|
|
|
|
+ for _, v := range thisinfo.WinnerOrder {
|
|
list = append(list, qu.ObjToString(v["entname"]))
|
|
list = append(list, qu.ObjToString(v["entname"]))
|
|
}
|
|
}
|
|
set["winnerorder"] = list
|
|
set["winnerorder"] = list
|
|
@@ -699,7 +705,7 @@ func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidty
|
|
Bidtype: bidtype,
|
|
Bidtype: bidtype,
|
|
Winners: thisinfo.Winners,
|
|
Winners: thisinfo.Winners,
|
|
ReviewExperts: thisinfo.ReviewExperts,
|
|
ReviewExperts: thisinfo.ReviewExperts,
|
|
- Purchasing: thisinfo.Purchasing,
|
|
|
|
|
|
+ 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)
|
|
@@ -743,14 +749,14 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
set["jgtime"] = tmp["publishtime"]
|
|
set["jgtime"] = tmp["publishtime"]
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
}
|
|
}
|
|
- //公告状态和项目状态同样是流标或者废标
|
|
|
|
- }else if (thisinfo.SubType == "流标" || thisinfo.SubType == "废标") && (pInfo.Bidstatus == "流标" || pInfo.Bidstatus == "废标") {
|
|
|
|
|
|
+ //公告状态和项目状态同样是流标或者废标
|
|
|
|
+ } else if (thisinfo.SubType == "流标" || thisinfo.SubType == "废标") && (pInfo.Bidstatus == "流标" || pInfo.Bidstatus == "废标") {
|
|
if jg1 > p.jgTime {
|
|
if jg1 > p.jgTime {
|
|
set["jgtime"] = tmp["publishtime"]
|
|
set["jgtime"] = tmp["publishtime"]
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
set["jgtime"] = tmp["publishtime"]
|
|
set["jgtime"] = tmp["publishtime"]
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
}
|
|
}
|
|
@@ -758,7 +764,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
} else if thisinfo.SubType == "合同" {
|
|
} else if thisinfo.SubType == "合同" {
|
|
if pInfo.Bidstatus == "中标" || pInfo.Bidstatus == "成交" || pInfo.Bidstatus == "" {
|
|
if pInfo.Bidstatus == "中标" || pInfo.Bidstatus == "成交" || pInfo.Bidstatus == "" {
|
|
//中标、成交不更新jgtime
|
|
//中标、成交不更新jgtime
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
set["jgtime"] = tmp["publishtime"]
|
|
set["jgtime"] = tmp["publishtime"]
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
pInfo.Jgtime = thisinfo.Publishtime
|
|
}
|
|
}
|
|
@@ -781,7 +787,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
if bidtype[bs] != "" {
|
|
if bidtype[bs] != "" {
|
|
set["bidtype"] = bidtype[bs]
|
|
set["bidtype"] = bidtype[bs]
|
|
pInfo.Bidtype = bidtype[bs]
|
|
pInfo.Bidtype = bidtype[bs]
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
set["bidtype"] = "招标"
|
|
set["bidtype"] = "招标"
|
|
pInfo.Bidtype = "招标"
|
|
pInfo.Bidtype = "招标"
|
|
}
|
|
}
|
|
@@ -792,7 +798,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
} else if thisinfo.Infoformat == 2 {
|
|
} else if thisinfo.Infoformat == 2 {
|
|
set["bidstatus"] = "拟建"
|
|
set["bidstatus"] = "拟建"
|
|
pInfo.Bidstatus = "拟建"
|
|
pInfo.Bidstatus = "拟建"
|
|
- }else if bs == "" && bt == "结果" {
|
|
|
|
|
|
+ } else if bs == "" && bt == "结果" {
|
|
if pInfo.Bidstatus == "招标" {
|
|
if pInfo.Bidstatus == "招标" {
|
|
set["bidstatus"] = ""
|
|
set["bidstatus"] = ""
|
|
pInfo.Bidstatus = ""
|
|
pInfo.Bidstatus = ""
|
|
@@ -852,7 +858,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
if thisinfo.Buyerperson != "" {
|
|
if thisinfo.Buyerperson != "" {
|
|
pInfo.Buyerperson = thisinfo.Buyerperson
|
|
pInfo.Buyerperson = thisinfo.Buyerperson
|
|
set["buyerperson"] = pInfo.Buyerperson
|
|
set["buyerperson"] = pInfo.Buyerperson
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
pInfo.Buyerperson = ""
|
|
pInfo.Buyerperson = ""
|
|
set["buyerperson"] = ""
|
|
set["buyerperson"] = ""
|
|
}
|
|
}
|
|
@@ -860,7 +866,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
if thisinfo.Buyertel != "" {
|
|
if thisinfo.Buyertel != "" {
|
|
pInfo.Buyertel = thisinfo.Buyertel
|
|
pInfo.Buyertel = thisinfo.Buyertel
|
|
set["buyertel"] = pInfo.Buyertel
|
|
set["buyertel"] = pInfo.Buyertel
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
pInfo.Buyertel = ""
|
|
pInfo.Buyertel = ""
|
|
set["buyertel"] = ""
|
|
set["buyertel"] = ""
|
|
}
|
|
}
|
|
@@ -887,19 +893,20 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
|
|
|
|
//项目评审专家
|
|
//项目评审专家
|
|
if len(thisinfo.ReviewExperts) > 0 {
|
|
if len(thisinfo.ReviewExperts) > 0 {
|
|
- for _, k := range thisinfo.ReviewExperts {
|
|
|
|
- if BinarySearch(pInfo.ReviewExperts, k) == -1 {
|
|
|
|
- pInfo.ReviewExperts = append(pInfo.ReviewExperts, k)
|
|
|
|
- sort.Strings(pInfo.ReviewExperts)
|
|
|
|
- }
|
|
|
|
|
|
+ arr := FormatRp(thisinfo.ReviewExperts)
|
|
|
|
+ if len(arr) > 0 {
|
|
|
|
+ set["review_experts"] = thisinfo.ReviewExperts
|
|
|
|
+ pInfo.ReviewExperts = thisinfo.ReviewExperts
|
|
|
|
+ } else {
|
|
|
|
+ pInfo.ReviewExperts = arr
|
|
|
|
+ set["review_experts"] = arr
|
|
}
|
|
}
|
|
- set["review_experts"] = pInfo.ReviewExperts
|
|
|
|
}
|
|
}
|
|
if thisinfo.Purchasing != "" {
|
|
if thisinfo.Purchasing != "" {
|
|
if pInfo.Purchasing == "" {
|
|
if pInfo.Purchasing == "" {
|
|
pInfo.Purchasing = thisinfo.Purchasing
|
|
pInfo.Purchasing = thisinfo.Purchasing
|
|
set["purchasing"] = thisinfo.Purchasing
|
|
set["purchasing"] = thisinfo.Purchasing
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
list := strings.Split(pInfo.Purchasing, ",")
|
|
list := strings.Split(pInfo.Purchasing, ",")
|
|
for _, k := range list {
|
|
for _, k := range list {
|
|
if BinarySearch(strings.Split(thisinfo.Purchasing, ","), k) == -1 {
|
|
if BinarySearch(strings.Split(thisinfo.Purchasing, ","), k) == -1 {
|
|
@@ -914,7 +921,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
//中标候选人
|
|
//中标候选人
|
|
if len(thisinfo.WinnerOrder) > 0 {
|
|
if len(thisinfo.WinnerOrder) > 0 {
|
|
var list = []string{}
|
|
var list = []string{}
|
|
- for _, v := range thisinfo.WinnerOrder{
|
|
|
|
|
|
+ for _, v := range thisinfo.WinnerOrder {
|
|
list = append(list, qu.ObjToString(v["entname"]))
|
|
list = append(list, qu.ObjToString(v["entname"]))
|
|
}
|
|
}
|
|
set["winnerorder"] = list
|
|
set["winnerorder"] = list
|
|
@@ -945,7 +952,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
deleteSlice(pInfo.Winners, k, "")
|
|
deleteSlice(pInfo.Winners, k, "")
|
|
sort.Strings(pInfo.Winners)
|
|
sort.Strings(pInfo.Winners)
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
if BinarySearch(pInfo.Winners, k) == -1 {
|
|
if BinarySearch(pInfo.Winners, k) == -1 {
|
|
pInfo.Winners = append(pInfo.Winners, k)
|
|
pInfo.Winners = append(pInfo.Winners, k)
|
|
sort.Strings(pInfo.Winners)
|
|
sort.Strings(pInfo.Winners)
|
|
@@ -973,7 +980,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
}
|
|
}
|
|
if pInfo.Bidamount >= pInfo.Budget {
|
|
if pInfo.Bidamount >= pInfo.Budget {
|
|
set["sortprice"] = pInfo.Bidamount
|
|
set["sortprice"] = pInfo.Bidamount
|
|
- }else if pInfo.Budget >= pInfo.Bidamount {
|
|
|
|
|
|
+ } else if pInfo.Budget >= pInfo.Bidamount {
|
|
set["sortprice"] = pInfo.Budget
|
|
set["sortprice"] = pInfo.Budget
|
|
}
|
|
}
|
|
|
|
|
|
@@ -999,7 +1006,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
set["mpc"] = pInfo.MPC
|
|
set["mpc"] = pInfo.MPC
|
|
if p.currentType == "project" {
|
|
if p.currentType == "project" {
|
|
set["pici"] = p.pici
|
|
set["pici"] = p.pici
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
set["pici"] = tmp["comeintime"]
|
|
set["pici"] = tmp["comeintime"]
|
|
}
|
|
}
|
|
update := map[string]interface{}{}
|
|
update := map[string]interface{}{}
|
|
@@ -1164,7 +1171,7 @@ func PackageFormat(info *Info, project *ProjectInfo) map[string]interface{} {
|
|
return p1
|
|
return p1
|
|
}
|
|
}
|
|
|
|
|
|
-//计算预算(budget)、中标金额(bidamount)
|
|
|
|
|
|
+// 计算预算(budget)、中标金额(bidamount)
|
|
func CountAmount(project *ProjectInfo, info *Info, tmp map[string]interface{}) {
|
|
func CountAmount(project *ProjectInfo, info *Info, tmp map[string]interface{}) {
|
|
if info.HasPackage {
|
|
if info.HasPackage {
|
|
budget := 0.0
|
|
budget := 0.0
|
|
@@ -1330,3 +1337,20 @@ func ClearData(clearMap, tmp map[string]interface{}) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//校验评审专家
|
|
|
|
+func FormatRp(tmp []string) []string {
|
|
|
|
+ arrTmp := []string{}
|
|
|
|
+ for _, v := range tmp {
|
|
|
|
+ // 汉字过滤(全汉字,2-4个字)
|
|
|
|
+ if ok, _ := regexp.MatchString("^[\\p{Han}]{2,4}$", v); !ok {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ //黑名单过滤
|
|
|
|
+ if BlaskListMap[v] {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ arrTmp = append(arrTmp, v)
|
|
|
|
+ }
|
|
|
|
+ return arrTmp
|
|
|
|
+}
|