Jianghan 5 tahun lalu
induk
melakukan
f48aa8a1cb
3 mengubah file dengan 36 tambahan dan 31 penghapusan
  1. 2 2
      fullproject/src_v1/load_data.go
  2. 5 6
      fullproject/src_v1/main.go
  3. 29 23
      fullproject/src_v1/project.go

+ 2 - 2
fullproject/src_v1/load_data.go

@@ -85,7 +85,7 @@ func (p *ProjectTask) loadData(starttime int64) {
 				bys, _ := json.Marshal(result)
 				var tmp *ProjectInfo
 				_ = json.Unmarshal(bys, &tmp)
-				saveData(p, result, tmp)
+				saveFiled(p, result, tmp)
 				pool <- tmp
 			}(result)
 		} else {
@@ -142,7 +142,7 @@ func (p *ProjectTask) loadSite() {
 
 }
 
-func saveData(p *ProjectTask, res map[string]interface{}, tmp *ProjectInfo) {
+func saveFiled(p *ProjectTask, res map[string]interface{}, tmp *ProjectInfo) {
 	if jsonData, ok := res["jsondata"].(map[string]interface{}); ok {
 		proHref := util.ObjToString(jsonData["projecthref"])
 		if jsonData != nil && proHref != "" {

+ 5 - 6
fullproject/src_v1/main.go

@@ -2,7 +2,6 @@ package main
 
 import (
 	"encoding/json"
-	"flag"
 	"log"
 	mu "mfw/util"
 	"net"
@@ -79,11 +78,11 @@ func main() {
 
 //测试组人员使用
 func mainT() {
-	//sid = "5649a0fcaf5374672e005704"
-	//eid = "5e169e5250b5ea296ec896f0"
-	flag.StringVar(&sid, "sid", "", "开始id")
-	flag.StringVar(&eid, "eid", "", "结束id")
-	flag.Parse()
+	sid = "5d18eca4a5cb26b9b7c7f587"
+	eid = "5e381b7650b5ea296ed16e51"
+	//flag.StringVar(&sid, "sid", "", "开始id")
+	//flag.StringVar(&eid, "eid", "", "结束id")
+	//flag.Parse()
 
 	mapinfo := map[string]interface{}{}
 	if sid == "" || eid == "" {

+ 29 - 23
fullproject/src_v1/project.go

@@ -420,7 +420,6 @@ var FIELDS = []string{
 	"buyertel",
 	"winner",
 	"agency",
-	"projectscope",
 	"topscopeclass",
 	"subscopeclass",
 	"winnerorder",
@@ -479,25 +478,31 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
 	bt := qu.ObjToString(tmp["toptype"])
 	bs := qu.ObjToString(tmp["subtype"])
 	p.mapBidLock.Lock()
-	set["bidtype"] = bidtype[bs]
-	if bt == "招标" {
-		set["projectscope"] = qu.ObjToString(tmp["projectscope"])
-		set["bidstatus"] = bt
-	} else {
-		if bidstatus[bs] != "" {
-			set["bidstatus"] = thisinfo.SubType
-		} else if tmp["infoformat"] == 2 {
-			set["bidstatus"] = "拟建"
-		} else if bs == "" {
-			set["bidstatus"] = ""
+	if thisinfo.Infoformat == 2 {
+		set["bidstatus"] = "拟建"
+		bt = "拟建"
+	}else {
+		set["bidtype"] = bidtype[bs]
+		if bt == "招标" {
+			set["projectscope"] = qu.ObjToString(tmp["projectscope"])
+			set["bidstatus"] = bt
 		} else {
-			set["bidstatus"] = "其它"
+			if bidstatus[bs] != "" {
+				set["bidstatus"] = thisinfo.SubType
+				bt = thisinfo.SubType
+			} else if bs == "" {
+				set["bidstatus"] = ""
+				bt = ""
+			} else {
+				set["bidstatus"] = "其它"
+				bt = "其它"
+			}
 		}
 	}
 	p.mapBidLock.Unlock()
 
 	pkg := PackageFormat(thisinfo, nil)
-	p1 := p.NewCachePinfo(pId, thisinfo, bt, pkg)
+	p1 := p.NewCachePinfo(pId, thisinfo, bs, bt, pkg)
 
 	now := time.Now().Unix()
 	set["createtime"] = now
@@ -512,8 +517,10 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
 			set["zbtime"] = tmp["publishtime"]
 		}
 	} else if thisinfo.TopType == "结果" || thisinfo.SubType == "合同" {
-		set["jgtime"] = tmp["publishtime"]
-		p1.Jgtime = thisinfo.Publishtime
+		if thisinfo.Infoformat != 2 {
+			set["jgtime"] = tmp["publishtime"]
+			p1.Jgtime = thisinfo.Publishtime
+		}
 	}
 
 	if len(thisinfo.Subscopeclass) > 0 {
@@ -630,7 +637,7 @@ func (p *ProjectTask) PushListInfo(tmp map[string]interface{}, infoid string) bs
 }
 
 //生成存放在内存中的对象
-func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidtype string, pkg map[string]interface{}) ProjectInfo {
+func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidtype, bidstatus string, pkg map[string]interface{}) ProjectInfo {
 	p1 := ProjectInfo{
 		Id:            id,
 		Ids:           []string{thisinfo.Id},
@@ -654,7 +661,7 @@ func (p *ProjectTask) NewCachePinfo(id primitive.ObjectID, thisinfo *Info, bidty
 		Budget:        thisinfo.Budget,
 		Package:       pkg,
 		Bidamount:     thisinfo.Bidamount,
-		Bidstatus:     thisinfo.SubType,
+		Bidstatus:     bidstatus,
 		Bidtype:       bidtype,
 		Winners:       thisinfo.Winners,
 	}
@@ -683,7 +690,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 	pInfo.LastTime = thisinfo.Publishtime
 	set["lasttime"] = thisinfo.Publishtime
 	if thisinfo.TopType == "招标" {
-		if thisinfo.SubType != "变更" && thisinfo.SubType != "其它" {
+		if thisinfo.SubType != "变更" && thisinfo.SubType != "其它" && tmp["zbtime"] == nil {
 			set["zbtime"] = tmp["publishtime"]
 		}
 		if pInfo.Jgtime > 0 {
@@ -722,7 +729,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 		if bidstatus[bs] != "" {
 			set["bidstatus"] = thisinfo.SubType
 			pInfo.Bidstatus = thisinfo.SubType
-		} else if tmp["infoformat"] == 2 {
+		} else if thisinfo.Infoformat == 2 {
 			set["bidstatus"] = "拟建"
 			pInfo.Bidstatus = "拟建"
 		} else if bs == "" {
@@ -908,7 +915,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 /**
  *	更新项目时,项目状态的处理
  *	返回是否新增项目,异常标记
- *	1、项目时,新项目时,招标信息的状态(toptype)不是招标、拟建、预告	异常:1
+ *	1、新项目时,招标信息的状态(toptype)不是招标、拟建、预告	异常:1
  *	   异常1是在项目新建的时候才会产生
  *	3、项目合并时,项目状态是”流标“/”废标“,招标信息状态不是”招标“		异常:2
  *	4、项目合并时,项目状态是”合同“/”其它“,招标信息类型是”结果“		异常:3
@@ -927,7 +934,7 @@ func (p *ProjectTask) CompareStatus(project *ProjectInfo, info *Info) (bool, int
 			return false, 0
 		} else if project.Bidstatus == info.SubType {
 			//状态一样,根据发布时间判断是否合并
-			if (info.Publishtime - project.FirstTime) > p.statusTime {
+			if (info.Publishtime - project.LastTime) > p.statusTime {
 				return true, 0
 			} else {
 				return false, 0
@@ -1060,7 +1067,6 @@ func CountAmount(project *ProjectInfo, info *Info, tmp map[string]interface{}) {
 				} else {
 					project.Budgettag = 1
 				}
-
 			}
 		}
 		if budget > 0 {