|
@@ -492,32 +492,35 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
|
|
|
}
|
|
|
//projecthref保存
|
|
|
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"]
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//招标类型
|
|
|
+ bt := qu.ObjToString(tmp["toptype"])
|
|
|
+ set["bidtype"] = bt
|
|
|
+ bs, _ := tmp["subtype"].(string)
|
|
|
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)
|
|
|
- //招标信息是中标或者成交,保存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,
|
|
|
- },
|
|
|
- }
|
|
|
+ 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 {
|
|
@@ -646,29 +649,24 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
|
|
|
}
|
|
|
}
|
|
|
//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 == "废标" {
|
|
@@ -920,8 +918,8 @@ func packageEle(map1 map[string]interface{}, id string) map[string]interface{} {
|
|
|
}
|
|
|
|
|
|
func PackageFormat(info *Info, project *ProjectInfo) map[string]interface{} {
|
|
|
- budget := 0
|
|
|
- bidamount := 0
|
|
|
+ budget := 0.0
|
|
|
+ bidamount := 0.0
|
|
|
p1 := map[string]interface{}{}
|
|
|
if project != nil && project.Package != nil && len(project.Package) > 0 {
|
|
|
p1 = project.Package
|
|
@@ -931,15 +929,16 @@ func PackageFormat(info *Info, project *ProjectInfo) map[string]interface{} {
|
|
|
v2 = packageEle(v1, info.Id)
|
|
|
if v2["bidstatus"] == nil {
|
|
|
v2["bidstatus"] = info.SubType
|
|
|
- }
|
|
|
- if isCount(project, v2[""]) {
|
|
|
-
|
|
|
}
|
|
|
if v2["budget"] != nil {
|
|
|
budget = budget + v2["budget"].(float64)
|
|
|
+ }else {
|
|
|
+ budget = info.Budget
|
|
|
}
|
|
|
if v2["bidamount"] != nil {
|
|
|
bidamount = bidamount + v2["bidamount"].(float64)
|
|
|
+ }else {
|
|
|
+ bidamount = info.Bidamount
|
|
|
}
|
|
|
addFlag := false
|
|
|
for k1, v3 := range p1 {
|
|
@@ -967,9 +966,13 @@ func PackageFormat(info *Info, project *ProjectInfo) map[string]interface{} {
|
|
|
}
|
|
|
if p2["budget"] != nil {
|
|
|
budget = p2["budget"].(float64)
|
|
|
+ }else {
|
|
|
+ budget = info.Budget
|
|
|
}
|
|
|
if p2["bidamount"] != nil {
|
|
|
bidamount = p2["bidamount"].(float64)
|
|
|
+ }else {
|
|
|
+ bidamount = info.Bidamount
|
|
|
}
|
|
|
p1[k] = []map[string]interface{}{p2}
|
|
|
}
|
|
@@ -981,13 +984,10 @@ func PackageFormat(info *Info, project *ProjectInfo) map[string]interface{} {
|
|
|
|
|
|
//计算预算(budget)、中标金额(bidamount)
|
|
|
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)
|
|
|
+ key := KeyPackage.FindStringSubmatch(project.ProjectName)
|
|
|
if len(key) > 0 {
|
|
|
//判断项目中是否已经计算过该包/段的预算
|
|
|
if !isCount(project, info.ProjectName) {
|
|
@@ -1002,13 +1002,13 @@ func CountAmount(project *ProjectInfo, info *Info) {
|
|
|
//中标、成交、合同 处理中标金额(bidamount)
|
|
|
if info.SubType == "中标" || info.SubType == "成交" || info.SubType == "合同" {
|
|
|
if info.Bidamount > 0 {
|
|
|
- key := titleGetPc.FindStringSubmatch(project.ProjectName)
|
|
|
+ key := KeyPackage.FindStringSubmatch(project.ProjectName)
|
|
|
if len(key) > 0 {
|
|
|
if !isCount(project, info.ProjectName) {
|
|
|
project.Bidamount = project.Bidamount + info.Bidamount
|
|
|
}
|
|
|
}else {
|
|
|
- if project.Bidamount < project.Bidamount {
|
|
|
+ if project.Bidamount > info.Bidamount {
|
|
|
project.Bidamount = info.Bidamount
|
|
|
}
|
|
|
}
|
|
@@ -1016,11 +1016,21 @@ func CountAmount(project *ProjectInfo, info *Info) {
|
|
|
}
|
|
|
|
|
|
//保存信息到IdStatusInfo
|
|
|
- project.IdStatusInfo[info.Id] = map[string]interface{}{
|
|
|
- "projectname": info.ProjectName,
|
|
|
- "bidstatus": info.SubType,
|
|
|
- "budget": info.Budget,
|
|
|
- "bidamount": info.Bidamount,
|
|
|
+ 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,
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|