Browse Source

Merget branch 'dev3.2' of http://192.168.3.207:10080/qmx/jy-data-extract into dev3.2

maxiaoshan 5 years ago
parent
commit
51e1d2c420
3 changed files with 18 additions and 15 deletions
  1. 4 3
      fullproject/src_dev5/project.go
  2. 9 8
      fullproject/src_dev5/task.go
  3. 5 4
      udp_ocr_conter/main.go

+ 4 - 3
fullproject/src_dev5/project.go

@@ -489,12 +489,13 @@ var INFOFIELDS = []string{
 	"topscopeclass",
 	"subscopclass",
 	"infoformat",
+	"buyerperson",
+	"buyertel",
 }
 
 //项目中list的信息
 func (p *ProjectTask) PushListInfo(tmp map[string]interface{}) bson.M {
 	res := bson.M{
-
 		"infoid": qu.BsonIdToSId(tmp["_id"]),
 	}
 	for _, k := range INFOFIELDS {
@@ -614,12 +615,12 @@ func (p *ProjectTask) UpdateProject(tmp map[string]interface{}, thisinfo *Info,
 	}
 	//9--采购单位联系人
 	if thisinfo.Buyerperson != "" && strings.Index(pInfo.Buyerperson, thisinfo.Buyerperson) < 0 {
-		pInfo.Buyerperson += thisinfo.Buyerperson
+		pInfo.Buyerperson = thisinfo.Buyerperson
 		set["buyerperson"] = pInfo.Buyerperson
 	}
 	//10--采购单位電話
 	if thisinfo.Buyertel != "" && strings.Index(pInfo.Buyertel, thisinfo.Buyertel) < 0 {
-		pInfo.Buyertel += thisinfo.Buyertel
+		pInfo.Buyertel = thisinfo.Buyertel
 		set["buyertel"] = pInfo.Buyertel
 	}
 

+ 9 - 8
fullproject/src_dev5/task.go

@@ -189,18 +189,19 @@ func (p *ProjectTask) taskQl(udpInfo map[string]interface{}) {
 	if coll == "" {
 		coll = ExtractColl
 	}
-	sess := MongoTool.GetMgoConn()
-	bcon := false
-	if sess.DB(db).C(coll).EnsureIndexKey("publishtime_1", "publishtime_-1") == nil {
-		bcon = true
-	} else {
-		log.Println("publishtime_1索引不存在")
-	}
-	MongoTool.DestoryMongoConn(sess)
+	//	sess := MongoTool.GetMgoConn()
+	//	bcon := false
+	//	if sess.DB(db).C(coll).EnsureIndexKey("publishtime_1", "publishtime_-1") == nil {
+	//		bcon = true
+	//	} else {
+	//		log.Println("publishtime_1索引不存在")
+	//	}
+	//	MongoTool.DestoryMongoConn(sess)
 	thread := util.IntAllDef(udpInfo["thread"], 3)
 	if thread > 0 {
 		p.thread = thread
 	}
+	bcon := true
 	if bcon {
 		//生成查询语句执行
 		p.enter(db, coll, map[string]interface{}{})

+ 5 - 4
udp_ocr_conter/main.go

@@ -277,7 +277,7 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 		tmp["isrun"] = "run"
 		bytes, _ := json.Marshal(tmp)
 		b := mongodb.Save("ocr_task", string(bytes))
-		mongodb.Save("ocr_task_bak", string(bytes))
+		//mongodb.Save("ocr_task_bak", string(bytes))
 		log.Println("保存id:", b)
 	case mu.OP_NOOP: //其他节点回应消息打印
 		log.Println("节点接收成功", string(data), ra.String())
@@ -328,7 +328,8 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 				//	}
 				//}
 				tobyte, _ := json.Marshal(totmp)
-				//go config.Udpclient.WriteUdp(tobyte, mu.OP_TYPE_DATA, &net.UDPAddr{
+				mongodb.Save("ocr_flie_over",string(tobyte))
+			//go config.Udpclient.WriteUdp(tobyte, mu.OP_TYPE_DATA, &net.UDPAddr{
 				//	IP:   net.ParseIP(qu.ObjToString(config.Sysconfig["toudpip"])),
 				//	Port: qu.IntAll(config.Sysconfig["toudpport"]),
 				//})
@@ -336,8 +337,8 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 
 				mongodb.Del("ocr_task", bson.M{"_id": ObjectId.(bson.ObjectId)})
 				tmp["end_time"] = time.Now().Unix()
-				mongodb.Save("ocr_flie_over",totmp)
-				mongodb.Update("ocr_task_bak", bson.M{"_id": ObjectId.(bson.ObjectId)}, map[string]interface{}{"$set": tmp}, false, false)
+
+				//mongodb.Update("ocr_task_bak", bson.M{"start": ObjectId.(bson.ObjectId)}, map[string]interface{}{"$set": tmp}, false, false)
 			//}else {
 			//	tmp["isrun"] = "stop"
 			//	mongodb.Update("ocr_task",