|
@@ -430,16 +430,6 @@ var FIELDS = []string{
|
|
"package",
|
|
"package",
|
|
}
|
|
}
|
|
|
|
|
|
-var bidtype = map[string]string{
|
|
|
|
- "招标": "招标",
|
|
|
|
- "询价": "询价",
|
|
|
|
- "竞谈": "竞谈",
|
|
|
|
- "单一": "单一",
|
|
|
|
- "竞价": "竞价",
|
|
|
|
- "变更": "变更",
|
|
|
|
- "邀标": "邀标",
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
var bidstatus = map[string]string{
|
|
var bidstatus = map[string]string{
|
|
"预告": "预告",
|
|
"预告": "预告",
|
|
"中标": "中标",
|
|
"中标": "中标",
|
|
@@ -492,34 +482,28 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
}
|
|
}
|
|
//projecthref保存
|
|
//projecthref保存
|
|
if jsonData, ok := tmp["jsondata"].(map[string]interface{}); ok {
|
|
if jsonData, ok := tmp["jsondata"].(map[string]interface{}); ok {
|
|
- if jsonData != nil && jsonData["projecthref"] != "" {
|
|
|
|
|
|
+ if jsonData != nil && qu.ObjToString(jsonData["projecthref"]) != "" {
|
|
set["projecthref"] = jsonData["projecthref"]
|
|
set["projecthref"] = jsonData["projecthref"]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//招标类型
|
|
//招标类型
|
|
|
|
+ bt := qu.ObjToString(tmp["toptype"])
|
|
|
|
+ set["bidtype"] = bt
|
|
|
|
+ bs, _ := tmp["subtype"].(string)
|
|
p.mapBidLock.Lock()
|
|
p.mapBidLock.Lock()
|
|
- bt := bidtype[thisinfo.SubType]
|
|
|
|
- p.mapBidLock.Unlock()
|
|
|
|
- if bt == "" {
|
|
|
|
- bt = "招标"
|
|
|
|
|
|
+ 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"] = "其它"
|
|
}
|
|
}
|
|
- set["bidtype"] = bt
|
|
|
|
- set["bidstatus"] = thisinfo.SubType
|
|
|
|
|
|
+ p.mapBidLock.Unlock()
|
|
|
|
|
|
p1, pkg := p.NewCachePinfo(pId, thisinfo, bt)
|
|
p1, pkg := p.NewCachePinfo(pId, thisinfo, bt)
|
|
- //招标信息是中标或者成交,保存bidstatus、budget、bidamount
|
|
|
|
- if thisinfo.SubType == "中标" || thisinfo.SubType == "成交" {
|
|
|
|
- p1.IdStatusInfo = map[string]map[string]interface{}{
|
|
|
|
- thisinfo.Id: {
|
|
|
|
- "projectname": thisinfo.ProjectName,
|
|
|
|
- "bidstatus": thisinfo.SubType,
|
|
|
|
- "budget": thisinfo.Budget,
|
|
|
|
- "bidamount": thisinfo.Bidamount,
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if len(thisinfo.Subscopeclass) > 0 {
|
|
if len(thisinfo.Subscopeclass) > 0 {
|
|
s_subscopeclass := strings.Join(thisinfo.Subscopeclass, ",")
|
|
s_subscopeclass := strings.Join(thisinfo.Subscopeclass, ",")
|
|
set["s_subscopeclass"] = s_subscopeclass
|
|
set["s_subscopeclass"] = s_subscopeclass
|
|
@@ -646,29 +630,24 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//2--lasttime
|
|
//2--lasttime
|
|
- if thisinfo.Publishtime > pInfo.LastTime {
|
|
|
|
- pInfo.LastTime = thisinfo.Publishtime
|
|
|
|
- set["lasttime"] = thisinfo.Publishtime
|
|
|
|
- p.mapBidLock.Lock()
|
|
|
|
- defer p.mapBidLock.Unlock()
|
|
|
|
- bt := bidtype[thisinfo.SubType]
|
|
|
|
- if bt != "" {
|
|
|
|
- set["bidtype"] = bt
|
|
|
|
- }
|
|
|
|
- bs, _ := tmp["subtype"].(string)
|
|
|
|
- if bidstatus[bs] != "" {
|
|
|
|
- set["bidstatus"] = thisinfo.SubType
|
|
|
|
- if bidstatus[bs] != "预告" && bidstatus[bs] != "合同" {
|
|
|
|
- set["jgtime"] = tmp["publishtime"]
|
|
|
|
- }
|
|
|
|
- } else if tmp["infoformat"] == 2 {
|
|
|
|
- set["bidstatus"] = "拟建"
|
|
|
|
- } else if tmp["subytpe"] == "招标" {
|
|
|
|
- set["bidstatus"] = thisinfo.TopType
|
|
|
|
- } else {
|
|
|
|
- set["bidstatus"] = "其它"
|
|
|
|
|
|
+ pInfo.LastTime = thisinfo.Publishtime
|
|
|
|
+ set["lasttime"] = thisinfo.Publishtime
|
|
|
|
+ set["bidtype"] = tmp["toptype"]
|
|
|
|
+ bs, _ := tmp["subtype"].(string)
|
|
|
|
+ p.mapBidLock.Lock()
|
|
|
|
+ if bidstatus[bs] != "" {
|
|
|
|
+ set["bidstatus"] = thisinfo.SubType
|
|
|
|
+ if bidstatus[bs] != "预告" && bidstatus[bs] != "合同" {
|
|
|
|
+ set["jgtime"] = tmp["publishtime"]
|
|
}
|
|
}
|
|
|
|
+ } else if tmp["infoformat"] == 2 {
|
|
|
|
+ set["bidstatus"] = "拟建"
|
|
|
|
+ } else if tmp["subytpe"] == "招标" {
|
|
|
|
+ set["bidstatus"] = thisinfo.TopType
|
|
|
|
+ } else {
|
|
|
|
+ set["bidstatus"] = "其它"
|
|
}
|
|
}
|
|
|
|
+ p.mapBidLock.Unlock()
|
|
|
|
|
|
//废标、流标 处理时间
|
|
//废标、流标 处理时间
|
|
if thisinfo.SubType == "流标" || thisinfo.SubType == "废标" {
|
|
if thisinfo.SubType == "流标" || thisinfo.SubType == "废标" {
|
|
@@ -849,7 +828,7 @@ func (p *ProjectTask) CompareStatus(project *ProjectInfo, info *Info) (bool, int
|
|
if (info.Publishtime - project.FirstTime) > p.statusTime {
|
|
if (info.Publishtime - project.FirstTime) > p.statusTime {
|
|
return true, 0
|
|
return true, 0
|
|
} else {
|
|
} else {
|
|
- return true, 0
|
|
|
|
|
|
+ return false, 0
|
|
}
|
|
}
|
|
} else if project.Bidstatus == "成交" && info.SubType == "中标" {
|
|
} else if project.Bidstatus == "成交" && info.SubType == "中标" {
|
|
return true, 0
|
|
return true, 0
|
|
@@ -920,8 +899,6 @@ func packageEle(map1 map[string]interface{}, id string) map[string]interface{} {
|
|
}
|
|
}
|
|
|
|
|
|
func PackageFormat(info *Info, project *ProjectInfo) map[string]interface{} {
|
|
func PackageFormat(info *Info, project *ProjectInfo) map[string]interface{} {
|
|
- budget := 0
|
|
|
|
- bidamount := 0
|
|
|
|
p1 := map[string]interface{}{}
|
|
p1 := map[string]interface{}{}
|
|
if project != nil && project.Package != nil && len(project.Package) > 0 {
|
|
if project != nil && project.Package != nil && len(project.Package) > 0 {
|
|
p1 = project.Package
|
|
p1 = project.Package
|
|
@@ -932,15 +909,6 @@ func PackageFormat(info *Info, project *ProjectInfo) map[string]interface{} {
|
|
if v2["bidstatus"] == nil {
|
|
if v2["bidstatus"] == nil {
|
|
v2["bidstatus"] = info.SubType
|
|
v2["bidstatus"] = info.SubType
|
|
}
|
|
}
|
|
- if isCount(project, v2[""]) {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- if v2["budget"] != nil {
|
|
|
|
- budget = budget + v2["budget"].(float64)
|
|
|
|
- }
|
|
|
|
- if v2["bidamount"] != nil {
|
|
|
|
- bidamount = bidamount + v2["bidamount"].(float64)
|
|
|
|
- }
|
|
|
|
addFlag := false
|
|
addFlag := false
|
|
for k1, v3 := range p1 {
|
|
for k1, v3 := range p1 {
|
|
if v4, ok := v3.([]map[string]interface{}); ok {
|
|
if v4, ok := v3.([]map[string]interface{}); ok {
|
|
@@ -965,72 +933,149 @@ func PackageFormat(info *Info, project *ProjectInfo) map[string]interface{} {
|
|
if p2["bidstatus"] == nil {
|
|
if p2["bidstatus"] == nil {
|
|
p2["bidstatus"] = info.SubType
|
|
p2["bidstatus"] = info.SubType
|
|
}
|
|
}
|
|
- if p2["budget"] != nil {
|
|
|
|
- budget = p2["budget"].(float64)
|
|
|
|
- }
|
|
|
|
- if p2["bidamount"] != nil {
|
|
|
|
- bidamount = p2["bidamount"].(float64)
|
|
|
|
- }
|
|
|
|
p1[k] = []map[string]interface{}{p2}
|
|
p1[k] = []map[string]interface{}{p2}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- info.Budget = budget
|
|
|
|
- info.Bidamount = bidamount
|
|
|
|
return p1
|
|
return p1
|
|
}
|
|
}
|
|
|
|
|
|
//计算预算(budget)、中标金额(bidamount)
|
|
//计算预算(budget)、中标金额(bidamount)
|
|
func CountAmount(project *ProjectInfo, info *Info) {
|
|
func CountAmount(project *ProjectInfo, info *Info) {
|
|
- //if project!= nil && project.Package != nil && len(project.Package) > 0 {
|
|
|
|
- ////暂时未考虑太多情况,简单处理
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
- if info.Budget > 0 {
|
|
|
|
- //项目中第一条招标信息是否是包/段项目
|
|
|
|
- key := titleGetPc.FindStringSubmatch(project.ProjectName)
|
|
|
|
- if len(key) > 0 {
|
|
|
|
- //判断项目中是否已经计算过该包/段的预算
|
|
|
|
- if !isCount(project, info.ProjectName) {
|
|
|
|
- project.Budget = project.Budget + info.Budget
|
|
|
|
|
|
+ if info.HasPackage {
|
|
|
|
+ budget := 0.0
|
|
|
|
+ for _, v := range project.Package{
|
|
|
|
+ v1, _ := v.([]map[string]interface{})
|
|
|
|
+ for _, v2 := range v1{
|
|
|
|
+ b1 := qu.Float64All(v2["budget"])
|
|
|
|
+ if b1 > 0 {
|
|
|
|
+ budget = budget + b1
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ project.Budget = budget
|
|
|
|
+ }else {
|
|
|
|
+ //招标没有多包
|
|
|
|
+ k := KeyPackage.FindStringSubmatch(project.ProjectName)
|
|
|
|
+ if len(k) > 0 {
|
|
|
|
+ //招标是单包
|
|
|
|
+ if len(project.Package) > 0 {
|
|
|
|
+ //项目有多包
|
|
|
|
+ flag := false
|
|
|
|
+ for _, v := range project.Package{
|
|
|
|
+ v1, _ := v.([]map[string]interface{})
|
|
|
|
+ if len(v1) > 0 && v1[0]["name"] == info.ProjectName {
|
|
|
|
+ flag = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if !flag {
|
|
|
|
+ project.Budget = project.Budget + info.Budget
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ //项目没有多包
|
|
|
|
+ if info.Budget > 0 {
|
|
|
|
+ project.Budget = project.Budget + info.Budget
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
|
|
+ //招标不是单包
|
|
if project.Budget < info.Budget {
|
|
if project.Budget < info.Budget {
|
|
project.Budget = info.Budget
|
|
project.Budget = info.Budget
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //中标、成交、合同 处理中标金额(bidamount)
|
|
|
|
if info.SubType == "中标" || info.SubType == "成交" || info.SubType == "合同" {
|
|
if info.SubType == "中标" || info.SubType == "成交" || info.SubType == "合同" {
|
|
- if info.Bidamount > 0 {
|
|
|
|
- key := titleGetPc.FindStringSubmatch(project.ProjectName)
|
|
|
|
- if len(key) > 0 {
|
|
|
|
- if !isCount(project, info.ProjectName) {
|
|
|
|
- project.Bidamount = project.Bidamount + info.Bidamount
|
|
|
|
|
|
+ if info.HasPackage {
|
|
|
|
+ bidamount := 0.0
|
|
|
|
+ for _, v := range project.Package{
|
|
|
|
+ v1, _ := v.([]map[string]interface{})
|
|
|
|
+ for _, v2 := range v1{
|
|
|
|
+ b1 := qu.Float64All(v2["bidamount"])
|
|
|
|
+ if b1 > 0 {
|
|
|
|
+ bidamount = bidamount + b1
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ project.Bidamount = bidamount
|
|
|
|
+ }else {
|
|
|
|
+ //招标没有多包
|
|
|
|
+ k := KeyPackage.FindStringSubmatch(project.ProjectName)
|
|
|
|
+ if len(k) > 0 {
|
|
|
|
+ //招标是单包
|
|
|
|
+ if len(project.Package) > 0 {
|
|
|
|
+ //项目有多包
|
|
|
|
+ flag := false
|
|
|
|
+ for _, v := range project.Package{
|
|
|
|
+ v1, _ := v.([]map[string]interface{})
|
|
|
|
+ if len(v1) > 0 {
|
|
|
|
+ flag = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if !flag {
|
|
|
|
+ project.Bidamount = project.Bidamount + info.Bidamount
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ //项目没有多包
|
|
|
|
+ if info.Bidamount > 0 {
|
|
|
|
+ project.Bidamount = project.Bidamount + info.Bidamount
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
- if project.Bidamount < project.Bidamount {
|
|
|
|
|
|
+ //招标不是单包
|
|
|
|
+ if project.Bidamount < info.Bidamount {
|
|
project.Bidamount = info.Bidamount
|
|
project.Bidamount = info.Bidamount
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //保存信息到IdStatusInfo
|
|
|
|
- project.IdStatusInfo[info.Id] = map[string]interface{}{
|
|
|
|
- "projectname": info.ProjectName,
|
|
|
|
- "bidstatus": info.SubType,
|
|
|
|
- "budget": info.Budget,
|
|
|
|
- "bidamount": info.Bidamount,
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
|
|
-func isCount(project *ProjectInfo, infoName string) bool {
|
|
|
|
- if project.IdStatusInfo != nil && len(project.IdStatusInfo) > 0 {
|
|
|
|
- for _, v := range project.IdStatusInfo{
|
|
|
|
- if v["projectname"] == infoName {
|
|
|
|
- return true
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return false
|
|
|
|
|
|
+ //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,
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
}
|
|
}
|