ソースを参照

3.13 jgtime修改

Jianghan 5 年 前
コミット
a380568f36
3 ファイル変更43 行追加25 行削除
  1. 2 1
      fullproject/src_v1/init.go
  2. 26 12
      fullproject/src_v1/project.go
  3. 15 12
      fullproject/src_v1/task.go

+ 2 - 1
fullproject/src_v1/init.go

@@ -294,7 +294,8 @@ type ProjectInfo struct {
 	Buyerclass  string                 `json:"buyerclass"`            //采购单位分类
 	Bidopentime int64                  `json:"bidopentime,omitempty"` //开标时间
 	//	Zbtime        int64                  `json:"zbtime"`        //招标时间
-	Jgtime    int64   `json:"jgtime"`              //结果中标时间
+	Jgtime		int64   `json:"jgtime"`              //结果中标时间
+	Zbtime		int64	`json:"zbtime"`				//招标时间
 	Bidamount float64 `json:"bidamount,omitempty"` //中标金额
 	Budget    float64 `json:"budget,omitempty"`    //预算
 	//Winnerorder []string `json:"winnerorder"` //中标候选人

+ 26 - 12
fullproject/src_v1/project.go

@@ -515,12 +515,11 @@ func (p *ProjectTask) NewProject(tmp map[string]interface{}, thisinfo *Info) (st
 	if thisinfo.TopType == "招标" {
 		if thisinfo.SubType != "变更" && thisinfo.SubType != "其它" {
 			set["zbtime"] = tmp["publishtime"]
+			p1.Zbtime = tmp["publishtime"].(int64)
 		}
 	} else if thisinfo.TopType == "结果" || thisinfo.SubType == "合同" {
-		if thisinfo.Infoformat != 2 {
 			set["jgtime"] = tmp["publishtime"]
 			p1.Jgtime = thisinfo.Publishtime
-		}
 	}
 
 	if len(thisinfo.Subscopeclass) > 0 {
@@ -690,7 +689,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 != "其它" && tmp["zbtime"] == nil {
+		if thisinfo.SubType != "变更" && thisinfo.SubType != "其它" && pInfo.Zbtime <= 0 {
 			set["zbtime"] = tmp["publishtime"]
 		}
 		if pInfo.Jgtime > 0 {
@@ -698,15 +697,20 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 			set["jgtime"] = int64(0)
 		}
 	} else if thisinfo.TopType == "结果" {
-		pInfo.Jgtime = thisinfo.Publishtime
-		set["jgtime"] = thisinfo.Publishtime
-	} else if thisinfo.SubType == "合同" {
-		if pInfo.Jgtime <= 0 {
+		if thisinfo.SubType == "中标" || thisinfo.SubType == "成交" || thisinfo.SubType == "流标" || thisinfo.SubType == "废标" {
+			jg1 := int64(math.Abs(float64(pInfo.Jgtime - thisinfo.Publishtime)))
+			if pInfo.Jgtime <= 0 {
+				set["jgtime"] = tmp["publishtime"]
+				pInfo.Jgtime = thisinfo.Publishtime
+			}else if jg1 > p.jgTime {
+				set["jgtime"] = tmp["publishtime"]
+				pInfo.Jgtime = thisinfo.Publishtime
+			}
+		}else if thisinfo.SubType == "合同" {
 			set["jgtime"] = tmp["publishtime"]
 			pInfo.Jgtime = thisinfo.Publishtime
 		}
 	}
-
 	if thisinfo.Bidopentime > pInfo.Bidopentime {
 		pInfo.Bidopentime = thisinfo.Bidopentime
 		set["bidopentime"] = pInfo.Bidopentime
@@ -828,7 +832,7 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 		set["subscopeclass"] = pInfo.Subscopeclass
 		set["s_subscopeclass"] = strings.Join(pInfo.Subscopeclass, ",")
 	}
-	//winner
+
 	if len(thisinfo.Winners) > 0 {
 		if len(pInfo.Winners) <= 0 {
 			set["winner"] = qu.ObjToString(tmp["winner"])
@@ -836,13 +840,23 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 
 		sort.Strings(pInfo.Winners)
 		for _, k := range thisinfo.Winners {
-			if BinarySearch(pInfo.Winners, k) == -1 {
-				pInfo.Winners = append(pInfo.Winners, k)
-				sort.Strings(pInfo.Winners)
+			if thisinfo.SubType == "流标" || thisinfo.SubType == "废标" {
+				if BinarySearch(pInfo.Winners, k) != -1 {
+					arr := strings.Split(pInfo.Winners, ",")
+					deleteSlice(arr, k, "")
+					pInfo.Winners = strings.Join(pInfo.Winners, ",")
+					sort.Strings(pInfo.Winners)
+				}
+			}else {
+				if BinarySearch(pInfo.Winners, k) == -1 {
+					pInfo.Winners = append(pInfo.Winners, k)
+					sort.Strings(pInfo.Winners)
+				}
 			}
 		}
 		set["s_winner"] = strings.Join(pInfo.Winners, ",")
 	}
+
 	if thisinfo.HasPackage { //多包处理
 		set["multipackage"] = 1
 		pkg := PackageFormat(thisinfo, pInfo)

+ 15 - 12
fullproject/src_v1/task.go

@@ -58,10 +58,12 @@ type ProjectTask struct {
 	//当前时间
 	currentTime int64
 	//保存长度
-	saveSize   int
-	pici       int64
-	validTime  int64
-	statusTime int64
+	saveSize   	int
+	pici       	int64
+	validTime  	int64
+	statusTime 	int64
+	//结果时间的更新		最近两天的公告不再更新jgtime
+	jgTime		int64
 	//	LockPool     chan *sync.Mutex
 	//	LockPoolLock sync.Mutex
 	//	m1, m23, m4  map[int]int
@@ -90,6 +92,7 @@ func NewPT() *ProjectTask {
 		coll:       ProjectColl,
 		validTime:  int64(util.IntAllDef(Sysconfig["validdays"], 150) * 86400),
 		statusTime: int64(util.IntAllDef(Sysconfig["statusdays"], 7) * 86400),
+		jgTime:		int64(util.IntAllDef("", 2) * 86400),
 	}
 	return p
 }
@@ -617,16 +620,16 @@ func (p *ProjectTask) updateJudge(tmp map[string]interface{}, info *Info) {
 	index := -1
 	pInfoId := ""
 	p.AllIdsMapLock.Lock()
-F:
-	for k, ID := range p.AllIdsMap {
-		for i, id := range ID.P.Ids {
-			if info.Id == id {
-				pInfoId = k
-				index = i
-				break F
+	F:
+		for k, ID := range p.AllIdsMap {
+			for i, id := range ID.P.Ids {
+				if info.Id == id {
+					pInfoId = k
+					index = i
+					break F
+				}
 			}
 		}
-	}
 	p.AllIdsMapLock.Unlock()
 	//未找到招标信息
 	if index == -1 {