Browse Source

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

apple 5 years ago
parent
commit
de634a2835

+ 4 - 4
src/config.json

@@ -1,7 +1,7 @@
 {
     "port": "9090",
-    "mgodb": "127.0.0.1:27092",
-    "dbsize": 10,
+    "mgodb": "192.168.3.207:27092",
+    "dbsize": 3,
     "dbname": "extract_kf",
     "redis": "buyer=127.0.0.1:6379,winner=127.0.0.1:6379,agency=127.0.0.1:6379,qyk_redis=127.0.0.1:6379",
     "elasticsearch": "http://127.0.0.1:9800",
@@ -18,7 +18,7 @@
     "redis_winner_db": "1",
     "redis_buyer_db": "2",
     "redis_agency_db": "3",
-    "elasticPoolSize": 5,
+    "elasticPoolSize": 1,
     "mergetable": "projectset",
     "mergetablealias": "projectset_v1",
     "saveresult": false,
@@ -28,7 +28,7 @@
     "filelength": 100000,
     "iscltlog": false,
     "brandgoods": false,
-    "udptaskid": "5cdd3025698414032c8322b1",
+    "udptaskid": "5cdd3021698414032c8322b1",
     "udpport": "1484",
     "nextNode": [
         {

+ 34 - 15
src/jy/extract/extpackage.go

@@ -7,7 +7,7 @@ import (
 	"log"
 	qu "qfw/util"
 	"reflect"
-	regexp "regexp"
+	"regexp"
 	"sort"
 )
 
@@ -60,8 +60,8 @@ func kvparse(p *ju.JobKv, e *ExtractTask, sonJobResult *map[string]interface{},
 					cfn := e.ClearFn["budget"]
 					lock.Unlock()
 					data := clear.DoClearFn(cfn, []interface{}{pv[0].Value, ""})
-					if data[0] ==0{
-						if istrue,ok:= data[len(data)-1].(bool);istrue&&ok{
+					if data[0] == 0 {
+						if istrue, ok := data[len(data)-1].(bool); istrue && ok {
 							(*sonJobResult)["budget"] = data[0]
 						}
 					}
@@ -72,13 +72,13 @@ func kvparse(p *ju.JobKv, e *ExtractTask, sonJobResult *map[string]interface{},
 					cfn := e.ClearFn["bidamount"]
 					lock.Unlock()
 					data := clear.DoClearFn(cfn, []interface{}{pv[0].Value, ""})
-					if istrue,ok:= data[len(data)-1].(bool);istrue&&ok{
+					if istrue, ok := data[len(data)-1].(bool); istrue && ok {
 						(*sonJobResult)["bidamount"] = data[0]
 					}
 					continue
 				}
 				if ((*sonJobResult)["winner"] == nil || (*sonJobResult)["winner"] == "") && tags[0].Key == "中标单位" {
-					if winnerorderNotReg.MatchString(pv[0].Value){
+					if winnerorderNotReg.MatchString(pv[0].Value) {
 						continue
 					}
 					(*sonJobResult)["winner"] = pv[0].Value
@@ -91,7 +91,8 @@ func kvparse(p *ju.JobKv, e *ExtractTask, sonJobResult *map[string]interface{},
 		}
 	}
 }
-var winnerorderNotReg =regexp.MustCompile(`(附件|否决原因|候选|招标失败|注册表|交易中心|序号内容|不足|公告|变更|采购|招标|废标|废止|流标|中标|投标|评标|开标|供应商|金额|万元|元整|预算|报价|单价|第(\d|一|二|三|四|五)(名|包)|排名|候选|确定|标段|(标|一|二|三|四|五)包|中选|成交|包号|(A|B|C|D|E|F|G)包|地址|详情|要求|推荐|名称|评审|得分|合同|平方米|公示期|结果|备注|说明|单位|代表|委托|工作日|营业(执|期)|通过|代码|电话|联系|条件|合理|费率|以上|以下|拟定|为|注:|\d[\s]{0,10}(\.|元|包|米|平米|平方米|吨|辆|千克|克|毫克|毫升|公升|套|件|瓶|箱|只|台|年|月|日|天|号)|(:|:|;|;|?|¥|\*|%)|^[a-zA-Z0-9-]{5,100}|^[a-zA-Z0-9-]{1,100}$|[a-zA-Z0-9-]{10,100})`)
+
+var winnerorderNotReg = regexp.MustCompile(`(附件|否决原因|候选|招标失败|注册表|交易中心|序号内容|不足|公告|变更|采购|招标|废标|废止|流标|中标|投标|评标|开标|供应商|金额|万元|元整|预算|报价|单价|第(\d|一|二|三|四|五)(名|包)|排名|候选|确定|标段|(标|一|二|三|四|五)包|中选|成交|包号|(A|B|C|D|E|F|G)包|地址|详情|要求|推荐|名称|评审|得分|合同|平方米|公示期|结果|备注|说明|单位|代表|委托|工作日|营业(执|期)|通过|代码|电话|联系|条件|合理|费率|以上|以下|拟定|为|注:|\d[\s]{0,10}(\.|元|包|米|平米|平方米|吨|辆|千克|克|毫克|毫升|公升|套|件|瓶|箱|只|台|年|月|日|天|号)|(:|:|;|;|?|¥|\*|%)|^[a-zA-Z0-9-]{5,100}|^[a-zA-Z0-9-]{1,100}$|[a-zA-Z0-9-]{10,100})`)
 //处理分包信息
 func PackageDetail(j *ju.Job, e *ExtractTask, isSite bool, codeSite string) {
 	qu.Try(func() {
@@ -108,6 +109,21 @@ func PackageDetail(j *ju.Job, e *ExtractTask, isSite bool, codeSite string) {
 					}
 				}
 			}
+			ordertmp := map[int][]map[string]interface{}{}
+			ordertmpint := []int{}//中标排序人一共几组
+			//中标候选人
+			for _, v := range j.Winnerorder {
+				if vtype, ok := v["type"].(int); ok {
+					if ordertmp[vtype] == nil {
+						ordertmpint = append(ordertmpint, vtype)
+						tmp := make([]map[string]interface{}, 0)
+						tmp = append(tmp, v)
+						ordertmp[vtype] = tmp
+					} else {
+						ordertmp[vtype] = append(ordertmp[vtype], v)
+					}
+				}
+			}
 			tmpkeys := []string{}
 			for k, _ := range j.BlockPackage {
 				if k == "" {
@@ -118,7 +134,9 @@ func PackageDetail(j *ju.Job, e *ExtractTask, isSite bool, codeSite string) {
 			sort.Strings(tmpkeys)
 			packageResult := map[string]map[string]interface{}{}
 			//packagenum := len(j.BlockPackage)
+			tmpindex :=-1
 			for _, pkName := range tmpkeys {
+				tmpindex++
 				pkg, ok := j.BlockPackage[pkName]
 				if !ok {
 					continue
@@ -135,14 +153,15 @@ func PackageDetail(j *ju.Job, e *ExtractTask, isSite bool, codeSite string) {
 					if pkg.IsTrueBudget{
 						sonJobResult["budget"] = pkg.Budget
 					}
-					if pkg.IsTrueBidamount{
+					if pkg.IsTrueBidamount {
 						sonJobResult["bidamount"] = pkg.Bidamount
 					}
 					if pkg.Winner == "" && len(j.Winnerorder) > 0 {
-						if sonJobResult["winnerorder"] == nil {
-							sonJobResult["winnerorder"] = j.Winnerorder
-							if  sonJobResult["bidamount"] == nil ||sonJobResult["bidamount"].(float64) <= 0 {
-								if j.Winnerorder[0]["price"] != nil{
+						if sonJobResult["winnerorder"] == nil && len(tmpkeys) == len(ordertmpint) {//分包和中标候选人长度一样
+							//ordertmp[ordertmpint[tmpindex]] 取中标候选人组
+							sonJobResult["winnerorder"] = ordertmp[ordertmpint[tmpindex]]
+							if sonJobResult["bidamount"] == nil || sonJobResult["bidamount"].(float64) <= 0 {
+								if j.Winnerorder[0]["price"] != nil {
 									sonJobResult["bidamount"] = qu.Float64All(j.Winnerorder[0]["price"])
 								}
 							}
@@ -152,7 +171,7 @@ func PackageDetail(j *ju.Job, e *ExtractTask, isSite bool, codeSite string) {
 						}
 					} else {
 						if len(j.Winnerorder) > 0 {
-							if j.Winnerorder[0]["price"] !=nil{
+							if j.Winnerorder[0]["price"] != nil {
 								sonJobResult["bidamount"] = qu.Float64All(j.Winnerorder[0]["price"])
 							}
 							sonJobResult["winner"] = j.Winnerorder[0]["entname"]
@@ -177,7 +196,7 @@ func PackageDetail(j *ju.Job, e *ExtractTask, isSite bool, codeSite string) {
 							}
 						}
 					}
-					if sonJobResult["name"] == nil ||sonJobResult["name"] == ""{
+					if sonJobResult["name"] == nil || sonJobResult["name"] == "" {
 						sonJobResult["name"] = j.Title
 					}
 				}
@@ -282,8 +301,8 @@ func PackageDetail(j *ju.Job, e *ExtractTask, isSite bool, codeSite string) {
 					if qu.ObjToString(sonJobResult["winner"]) == "" || (!pkg.Accuracy && qu.ObjToString(firstWinnerOrder["entname"]) != "" && qu.Int64All(firstWinnerOrder["sort"]) == 1) {
 						sonJobResult["winner"] = firstWinnerOrder["entname"]
 					}
-					if (qu.Float64All(sonJobResult["bidamount"]) == 0 && pkg.IsTrueBidamount)|| (!pkg.Accuracy && qu.Float64All(firstWinnerOrder["price"]) > 0 && qu.Int64All(firstWinnerOrder["sort"]) == 1) {
-						if firstWinnerOrder["price"] != nil{
+					if (qu.Float64All(sonJobResult["bidamount"]) == 0 && pkg.IsTrueBidamount) || (!pkg.Accuracy && qu.Float64All(firstWinnerOrder["price"]) > 0 && qu.Int64All(firstWinnerOrder["sort"]) == 1) {
+						if firstWinnerOrder["price"] != nil {
 							sonJobResult["bidamount"] = firstWinnerOrder["price"]
 						}
 					}

+ 21 - 20
src/jy/extract/extract.go

@@ -784,6 +784,7 @@ func ExtRuleCore(doc map[string]interface{}, e *ExtractTask, vc *RuleCore, j *ju
 							text := ju.TrimLRSpace(vv.Value, "")
 							if text != "" {
 								tmp := &ju.ExtField{
+									ExtFrom:     "package",
 									Field:       vc.Field,
 									Code:        "CL_分包",
 									Type:        tp,
@@ -812,10 +813,10 @@ func ExtRuleCore(doc map[string]interface{}, e *ExtractTask, vc *RuleCore, j *ju
 				field := &ju.ExtField{Weight: qu.IntAll(tmp["weight"]),
 					ExtFrom: qu.ObjToString(tmp["extfrom"]), Field: k,
 					Code: qu.ObjToString(tmp["code"]), Type: qu.ObjToString(tmp["type"]),
-					MatchType: qu.ObjToString(tmp["matchtype"]),
-					RuleText: qu.ObjToString(tmp["ruletext"]),
+					MatchType:   qu.ObjToString(tmp["matchtype"]),
+					RuleText:    qu.ObjToString(tmp["ruletext"]),
 					SourceValue: tmp["sourcevalue"],
-					Value: tmp["value"]}
+					Value:       tmp["value"]}
 				if k == "bidamount" && field.ExtFrom == "第一候选人" {
 					field.Score = 1
 				}
@@ -1232,7 +1233,7 @@ func extRegCoreToResult(extfrom, text string, tag *map[string]string, j *ju.Job,
 	var score float64
 	score = vre.Score
 	if isSite {
-		score = score+1.0
+		score = score + 1.0
 	}
 
 	extinfo := map[string][]map[string]interface{}{}
@@ -1309,16 +1310,16 @@ func extRegCoreToResult(extfrom, text string, tag *map[string]string, j *ju.Job,
 					tmps = append(tmps, tmp)
 
 					exfield := ju.ExtField{
-						BlockTag: *tag,
-						Field: vre.Field,
-						Code: vre.Code,
-						RuleText: vre.RuleText,
-						Type: "regexp",
-						MatchType: "regcontent",
-						ExtFrom: extfrom,
+						BlockTag:    *tag,
+						Field:       vre.Field,
+						Code:        vre.Code,
+						RuleText:    vre.RuleText,
+						Type:        "regexp",
+						MatchType:   "regcontent",
+						ExtFrom:     extfrom,
 						SourceValue: rep[vre.Field+"_"+fmt.Sprint(i)],
-						Value: rep[vre.Field+"_"+fmt.Sprint(i)],
-						Score:score}
+						Value:       rep[vre.Field+"_"+fmt.Sprint(i)],
+						Score:       score}
 					if tmp["blocktag"] != nil {
 						exfield.BlockTag = tmp["blocktag"].(map[string]string)
 					}
@@ -1361,7 +1362,7 @@ func extRegCoreToResult(extfrom, text string, tag *map[string]string, j *ju.Job,
 			}
 			field := &ju.ExtField{BlockTag: *tag, Field: vre.Field, Code: vre.Code, RuleText: vre.RuleText, Type: "regexp", MatchType: "regcontent", ExtFrom: extfrom, SourceValue: text,
 				Value: val,
-				Score:score}
+				Score: score}
 			if tmp["blocktag"] != nil {
 				field.BlockTag = tmp["blocktag"].(map[string]string)
 			}
@@ -1387,7 +1388,7 @@ func ExtRegBack(j *ju.Job, in *RegLuaInfo, t *TaskInfo) {
 				for _, tmp := range tmps {
 					field := &ju.ExtField{Field: k, Code: qu.ObjToString(tmp["code"]), RuleText: qu.ObjToString(tmp["ruletext"]), Type: qu.ObjToString(tmp["type"]), MatchType: qu.ObjToString(tmp["matchtype"]),
 						ExtFrom: qu.ObjToString(tmp["extfrom"]),
-						Value: tmp["value"]}
+						Value:   tmp["value"]}
 					if tmp["blocktag"] != nil {
 						field.BlockTag = tmp["blocktag"].(map[string]string)
 					}
@@ -1674,14 +1675,14 @@ func AnalysisSaveResult(j, jf *ju.Job, e *ExtractTask) {
 				}
 			}
 		}
-		if len(j.PackageInfo) > 10 {
+		if len(j.PackageInfo) > 15 {
 			for k, v := range j.PackageInfo {
 				j.PackageInfo = map[string]map[string]interface{}{}
 				j.PackageInfo[k] = v
 				break
 			}
 		}
-		if len(j.PackageInfo) > 0 { //分包信息
+		if len(j.PackageInfo) >= 0 { //分包信息
 			tmp["package"] = j.PackageInfo
 			//包预算,中标金额合并大于抽取就覆盖
 			var tmpBidamount, tmpBudget float64
@@ -1694,7 +1695,7 @@ func AnalysisSaveResult(j, jf *ju.Job, e *ExtractTask) {
 				}
 			}
 			//包预算,中标金额合并大于抽取就覆盖
-			if len(j.PackageInfo) > 1 {
+			if len(j.PackageInfo) >= 1 {
 				//包数大于1累加
 				for _, v := range j.PackageInfo {
 					if v["budget"] != nil {
@@ -1903,7 +1904,7 @@ func AnalysisSaveResult(j, jf *ju.Job, e *ExtractTask) {
 			}
 		} else { //测试结果
 			delete(tmp, "_id")
-			//delete(tmp, "fieldall")
+			delete(tmp, "fieldall")
 			if len(j.BlockPackage) > 0 { //分包详情
 				if len(j.BlockPackage) > 10 {
 					tmp["epackage"] = "分包异常"
@@ -1912,7 +1913,7 @@ func AnalysisSaveResult(j, jf *ju.Job, e *ExtractTask) {
 					tmp["epackage"] = string(bs)
 				}
 			}
-			tmp["result"] = result
+			//tmp["result"] = result
 			tmp["resultf"] = resultf
 			b := db.Mgo.Update(e.TaskInfo.TestColl, `{"_id":"`+_id+`"}`, map[string]interface{}{"$set": tmp}, true, false)
 			if !b {

+ 2 - 1
src/jy/pretreated/analystep.go

@@ -56,9 +56,10 @@ func AnalyStart(job *util.Job, isSite bool, codeSite string) {
 		if len(tabs) > 0 { //解析表格逻辑
 			job.HasTable = 1 //添加标识:文本中有table
 			newCon = TextAfterRemoveTable(con)
+			//log.Println(newCon)
 			job.BlockPackage = FindPackageFromText(job.Title, newCon, isSite, codeSite)
 			for i := 0; i < len(tabs); i++ {
-				//log.Println(tabs[i].Text())
+				//log.Println(tabs[i].Html())
 				//添加标识:文本中有table
 				tabres := AnalyTableV2(tabs[i], job.Category, "", con, 1, job.SourceMid, job.RuleBlock, isSite, codeSite) //解析表格入口 返回:汇总表格对象
 				processTableResult(tabres, bl, job, isSite, codeSite)

+ 7 - 2
src/jy/pretreated/analytable.go

@@ -49,7 +49,8 @@ var (
 	FindVal_1  = regexp.MustCompile("[第]?([一二三四五六七八九十0-9A-Za-zⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ]+)((子|合同|分|施工|监理)?(标段?|包|合同段|标包))|((子|合同|分|施工|监理)?(标|包)(段|号)?)[  \u3000\u2003\u00a0]*([一二三四五六七八九十0-9A-Za-zⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ]+)")
 	FindVal2_1 = regexp.MustCompile("([一二三四五六七八九十0-9A-Za-zⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ\\-]+)|^(设计|施工|监理|验收)[分子]?[标包]?[段号]?$")
 	//判断分包前排除
-	excludeKey = regexp.MustCompile("(标段代码|涉及包号|分包数量|包件号?|项目标号|规格|型号|招标范围|业绩|废标)|(^编号$)|([^包段标]编号)") //编号|划分
+	excludeKey  = regexp.MustCompile("(标段代码|涉及包号|分包数量|包件号?|项目标号|规格|型号|招标范围|业绩|废标)|(^编号$)|([^包段标]编号)") //编号|划分
+	excludeKey2 = regexp.MustCompile("包/[0-9]{0,4}[|箱|纸|张]")
 	//-------------
 
 	cut = u.NewCut()
@@ -1843,7 +1844,8 @@ func (table *Table) FindTdVal(td *TD, direct, vdirect int) (b bool) {
 					}
 				}
 				if bvalfind && varrpos > -1 && len(vals) > varrpos {
-					vals[varrpos] = td.Val // += "__" + td.Val
+					vals = append(vals, td.Val) // 累加
+					//vals[varrpos] = td.Val // += "__" + td.Val
 				} else {
 					//添加时候去除空值和nil
 					newVals := []string{}
@@ -2259,6 +2261,9 @@ func (tn *Table) isGoonNext(isSite bool, codeSite string) {
 		} else {
 			str += fmt.Sprintf("%s:%s\n", nk, v)
 		}
+		if excludeKey2.MatchString(str) {
+			continue
+		}
 		b, _ := divisionPackageChild(&blockPackage, str, tn.Tag, false, false, isSite, codeSite) //分块之后分包
 		if b && len(blockPackage) > 0 {
 			tn.BPackage = true

+ 2 - 2
src/jy/pretreated/colonkv.go

@@ -19,8 +19,8 @@ var (
 	regReplKV      = regexp.MustCompile("(.+?[\u4e00-\u9fa5))][\\s\u3000\u2003\u00a0]*[::].*[((]?[^\r\n\\s\u3000\u2003\u00a0]+?[))]?)[\\s\u3000\u2003\u00a0,。;;][((]?(.+?[\u4e00-\u9fa5))][\\s\u3000\u2003\u00a0]*[::].+)[))]?")
 	regReplKV2     = regexp.MustCompile("(.+?[\u4e00-\u9fa5))][\\s\u3000\u2003\u00a0]*[::].*[((]?[^\r\n\\s\u3000\u2003\u00a0标段包]+?[))]?)([一二三四五六七八九十]+[、..][^一二三四五六七八九十]+?)")
 	regKV          = regexp.MustCompile("([\\p{Han}][^,,。、.;;\r\n]{1,30}?)[::](.*)")
-	filterK        = regexp.MustCompile("[((\\[【].*?[))\\]】]|<[^>].+?>|[①②③¥·;;‘“'’”,*<>((\\[【、))/\\]】??,。.\".\\s\u3000\u2003\u00a0\u001c]+|^[一二三四五六七八九十0-91234567890]+")
-	filterValue    = regexp.MustCompile("(^(无)$|.+%.*|^[\r\n\\s\u3000\u2003\u00a0]+$|^<.*>)")
+	filterK        = regexp.MustCompile("[((\\[【].*?[))\\]】]|<[^>].+?>|[①②③¥·;;‘“'’”,*<>((\\[【、))/\\]】??,。.\".\\s\u3000\u2003\u00a0]+|^[一二三四五六七八九十0-91234567890]+")
+	filterValue    = regexp.MustCompile("(^(无)$|^[\r\n\\s\u3000\u2003\u00a0]+$|^<.*>)")
 	regReplKey     = regexp.MustCompile("^(包(.+[A-Za-z\\d])?|本项目|推荐|的|本次)|([约为元万亿]+|[大小]写|人民币|[全]称|姓名)$")
 	buyerAndAgency = regexp.MustCompile("(代理(机构|人)|采购(人|单位))")
 	BlockTagMap    = map[string]bool{

+ 65 - 12
src/jy/pretreated/division.go

@@ -4,7 +4,6 @@ import (
 	"fmt"
 	"jy/clear"
 	"jy/util"
-
 	qutil "qfw/util"
 	"regexp"
 	"sort"
@@ -562,13 +561,9 @@ func FindPackageFromBlocks(blocks *[]*util.Block, isSite bool, codeSite string)
 		//var ok bool
 		//var surplusText string
 		divisionPackageChild(&blockPackage, text, v.Title, true, v.Tag["中标单位"], isSite, codeSite)
-		////把分包内容摘除掉有问题 有的项目名称中包含二标段
-		//if ok && false {
-		//	v.Text = surplusText
-		//	v.ColonKV = GetKVAll(surplusText, v.Title, nil, 1)
-		//	v.SpaceKV = SspacekvEntity.Entrance(surplusText, v.Title, nil)
-		//}
 	}
+	//orderwinner := winnerOrderEntity.Find(content, true, 2, isSite, codeSite)
+
 	for k, v := range blockPackage {
 		if v.ColonKV != nil && v.ColonKV.KvTags != nil {
 			for kc, cv := range v.ColonKV.KvTags {
@@ -634,6 +629,64 @@ func FindPackageFromText(title string, content string, isSite bool, codeSite str
 	blockPackage = map[string]*util.BlockPackage{}
 	//从正文里面找分包
 	divisionPackageChild(&blockPackage, content, title, true, false, isSite, codeSite)
+	for k, v := range blockPackage {
+		if v.ColonKV != nil && v.ColonKV.KvTags != nil {
+			for kc, cv := range v.ColonKV.KvTags {
+				if kc == "预算" && v.Budget <= 0 {
+					moneys := clear.ObjToMoney([]interface{}{cv[0].Value, ""})
+					if len(moneys) > 0 {
+						if vf, ok := moneys[0].(float64); ok {
+							blockPackage[k].Budget = vf
+							blockPackage[k].IsTrueBudget = moneys[len(moneys)-1].(bool)
+						} else if vi, ok := moneys[0].(int); ok {
+							blockPackage[k].Budget = float64(vi)
+							blockPackage[k].IsTrueBudget = moneys[len(moneys)-1].(bool)
+						}
+					}
+				} else if kc == "中标金额" && v.Bidamount <= 0 {
+					moneys := clear.ObjToMoney([]interface{}{cv[0].Value, ""})
+					if len(moneys) > 0 {
+						if vf, ok := moneys[0].(float64); ok {
+							blockPackage[k].Bidamount = vf
+							blockPackage[k].IsTrueBidamount = moneys[len(moneys)-1].(bool)
+						} else if vi, ok := moneys[0].(int); ok {
+							blockPackage[k].Bidamount = float64(vi)
+							blockPackage[k].IsTrueBidamount = moneys[len(moneys)-1].(bool)
+						}
+					}
+				}
+			}
+		}
+		if v.SpaceKV != nil && v.SpaceKV.KvTags != nil {
+			for kc, cv := range v.SpaceKV.KvTags {
+				if kc == "预算" && v.Budget <= 0 {
+					moneys := clear.ObjToMoney([]interface{}{cv[0].Value, ""})
+					if len(moneys) > 0 {
+						if vf, ok := moneys[0].(float64); ok {
+							blockPackage[k].Budget = vf
+							blockPackage[k].IsTrueBudget = moneys[len(moneys)-1].(bool)
+						} else if vi, ok := moneys[0].(int); ok {
+							blockPackage[k].Budget = float64(vi)
+							blockPackage[k].IsTrueBudget = moneys[len(moneys)-1].(bool)
+						}
+					}
+
+				} else if kc == "中标金额" && v.Bidamount <= 0 {
+					moneys := clear.ObjToMoney([]interface{}{cv[0].Value, ""})
+					if len(moneys) > 0 {
+						if vf, ok := moneys[0].(float64); ok {
+							blockPackage[k].Bidamount = vf
+							blockPackage[k].IsTrueBidamount = moneys[len(moneys)-1].(bool)
+						} else if vi, ok := moneys[0].(int); ok {
+							blockPackage[k].Bidamount = float64(vi)
+							blockPackage[k].IsTrueBidamount = moneys[len(moneys)-1].(bool)
+						}
+					}
+				}
+			}
+		}
+	}
+	//winnerOrderEntity.Find(content, true, 2, isSite, codeSite)
 	return
 }
 
@@ -805,11 +858,11 @@ func divisionPackageChild(blockPackage *map[string]*util.BlockPackage, content,
 		}
 	}
 	//中标人排序
-	if isFindWinnerOrder && blockPackage != nil && len(*blockPackage) > 0 {
-		for _, v := range *blockPackage {
-			v.WinnerOrder = winnerOrderEntity.Find(v.Text, true, 2, isSite, codeSite)
-		}
-	}
+	//if isFindWinnerOrder && blockPackage != nil && len(*blockPackage) > 0 {
+	//	for _, v := range *blockPackage {
+	//		v.WinnerOrder = winnerOrderEntity.Find(v.Text, true, 2, isSite, codeSite)
+	//	}
+	//}
 	return true, surplusText
 }
 func getPkgIndex(indexs []int) []int {

+ 3 - 1
src/jy/pretreated/tablev2.go

@@ -346,7 +346,9 @@ func (td *TD) tdIsHb(tr *TR, table *Table, bsontable,isSite bool,codeSite string
 			if len(ub) > 0 {
 				blockPackage = FindPackageFromBlocks(&ub,isSite,codeSite) //从块里面找分包
 			} else {
-				blockPackage = FindPackageFromText("", td.Val,isSite,codeSite) //从正文里面找分包
+				if !excludeKey2.MatchString(td.Val){
+					blockPackage = FindPackageFromText("", td.Val,isSite,codeSite) //从正文里面找分包
+				}
 			}
 		}
 		if len(blockPackage) > 0 {

+ 12 - 9
src/jy/pretreated/winnerorder.go

@@ -33,6 +33,7 @@ var (
 	winnerReg4     = regexp.MustCompile("((确认|推荐|评审|排(名|序))[为::]+|(由高到低排序前.名|公示下列内容|(确定|推荐)的?中(标|选)候选人|\n中(标|选)候选.{1,3}\\s*\n|\n(中(标|选)候选.{1,3}[::\u3000\u2003\u00a0\\s]|成交候选供应商)|(排(名|序)|公(示|告)|具体|推荐|结果(公示)?|中(标|选)候选人.{0,2})如下|[一二三四五六七八九十\\d]+、(中(标|选)候选[^\n::]{1,8}|.{0,8}(成交|结果)信息|成交[^\n::]{2,8}))[为::]?)")
 	winnerReg5     = regexp.MustCompile("([^,;;。,、\n]+?)(为?)(第[一二三四五六七八九十1-9]+(成交|中标)?((候|侯)选(人|供应商|单位|机构)|名)|排名第[一二三四五六七八九十1-9]+)([,;;。,、]|\\s+\n)")
 	winnerReg6     = regexp.MustCompile("(^(排名)?第[一二三四五六七八九十1-9]+[名中标成交备选候选人单位供应商]*)")
+	winnerReg7     = regexp.MustCompile("第[一二三四五六七八九十]{1}标段[::]")
 	colonEndReg    = regexp.MustCompile("[::]$")
 	toWarpReg      = regexp.MustCompile("[,。,;;]+")
 	findamountReg  = regexp.MustCompile("[,。,;;\u3000\u2003\u00a0\\s]+")
@@ -51,7 +52,7 @@ var (
  *text文本,flag非否精确查找
  *from 来源
  */
-func (wo *WinnerOrderEntity) Find(text string, flag bool, from int,isSite bool,codeSite string) []map[string]interface{} {
+func (wo *WinnerOrderEntity) Find(text string, flag bool, from int, isSite bool, codeSite string) []map[string]interface{} {
 	text = winnerReg5.ReplaceAllString(text, "\n$3:$1\n")
 	/*
 		"_id" : ObjectId("5c2c6f60a5cb26b9b7b62cd8")
@@ -69,14 +70,16 @@ func (wo *WinnerOrderEntity) Find(text string, flag bool, from int,isSite bool,c
 	blocks := winnerReg4.Split(text, -1)
 	if len(blocks) == 0 {
 		blocks = append(blocks, text)
+	} else if len(blocks) == 1 {
+		blocks = winnerReg7.Split(text, -1)
 	}
-	winners := wo.findByReg(text, blocks, winnerReg1, from,isSite,codeSite)
+	winners := wo.findByReg(text, blocks, winnerReg1, from, isSite, codeSite)
 	if len(winners) == 0 {
-		winners = wo.findByReg(text, blocks, winnerReg2, from,isSite,codeSite)
+		winners = wo.findByReg(text, blocks, winnerReg2, from, isSite, codeSite)
 	}
 	if len(winners) == 0 {
 		if flag {
-			winners = wo.findByReg(text, blocks, winnerReg3, from,isSite,codeSite)
+			winners = wo.findByReg(text, blocks, winnerReg3, from, isSite, codeSite)
 		} else {
 			indexs_4 := winnerReg4.Split(text, -1)
 			if len(indexs_4) > 1 {
@@ -87,7 +90,7 @@ func (wo *WinnerOrderEntity) Find(text string, flag bool, from int,isSite bool,c
 					}
 					for _, v_3 := range indexs_3 {
 						if strings.Count(v_4[:v_3[1]], "\n") <= 3 {
-							winners = wo.findByReg(text, blocks, winnerReg3, from,isSite,codeSite)
+							winners = wo.findByReg(text, blocks, winnerReg3, from, isSite, codeSite)
 							break
 						}
 					}
@@ -206,7 +209,7 @@ func (wo *WinnerOrderEntity) getText(text string, blocks []string, reg_2 *regexp
 }
 
 //抽取对应的排序结果
-func (wo *WinnerOrderEntity) findByReg(content string, blocks []string, reg_2 *regexp.Regexp, from int,isSite bool,codeSite string) []map[string]interface{} {
+func (wo *WinnerOrderEntity) findByReg(content string, blocks []string, reg_2 *regexp.Regexp, from int, isSite bool, codeSite string) []map[string]interface{} {
 	text := wo.getText(content, blocks, reg_2, from)
 	winners := []map[string]interface{}{}
 	if len(text) < 1 {
@@ -215,7 +218,7 @@ func (wo *WinnerOrderEntity) findByReg(content string, blocks []string, reg_2 *r
 	for i, v := range text {
 		object := map[string]interface{}{}
 		count := 0
-		kvs := colonkvEntity.getColonSpaceKV(v,isSite,codeSite)
+		kvs := colonkvEntity.getColonSpaceKV(v, isSite, codeSite)
 		for _, kv := range kvs {
 			k, v := kv.Key, kv.Value
 			if regDivision.MatchString(v) {
@@ -239,10 +242,10 @@ func (wo *WinnerOrderEntity) findByReg(content string, blocks []string, reg_2 *r
 				}
 			} else { //中标金额
 				findOfferFlag := false
-				if offerReg.MatchString(k) {
+				if offerReg.MatchString(k) && !strings.Contains(k, "费率") {
 					findOfferFlag = true
 				} else {
-					kvTags := GetKvTags([]*util.Kv{&util.Kv{Key: k, Value: v}}, "", []string{"中标金额"},isSite,codeSite)
+					kvTags := GetKvTags([]*util.Kv{&util.Kv{Key: k, Value: v}}, "", []string{"中标金额"}, isSite, codeSite)
 					if len(kvTags["中标金额"]) > 0 {
 						findOfferFlag = true
 					}

+ 1 - 1
udp_winner/config.json

@@ -8,7 +8,7 @@
   "mgodb_enterprise": "enterprise",
   "mgodb_enterprise_c": "qyxy",
   "mgourl": "172.17.145.163:27082",
-  "mgodb_extract_kf": "extract_v3",
+  "mgodb_extract_kf": "extract_kf",
   "mgo_qyk_c": "winner_2",
   "mgo_qyk_c_w_new": "winner_new_2",
   "mgo_qyk_c_w_err": "winner_err_2",

+ 4 - 4
udp_winner/main.go

@@ -84,9 +84,9 @@ func main() {
 	udpclient = mu.UdpClient{Local: updport, BufSize: 1024}
 	udpclient.Listen(processUdpMsg)
 	log.Println("Udp服务监听", updport)
-	//go TimedTaskWinner() //定时任务
+	go TimedTaskWinner() //定时任务
 	go TimedTaskBuyer()  //定时任务
-	//go TimedTaskAgency() //定时任务
+	go TimedTaskAgency() //定时任务
 	go checkMapJob()
 	c := make(chan int, 1)
 	<-c
@@ -117,7 +117,7 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 				CPoolWinner <- true
 				go func(mapinfo *map[string]interface{}) {
 					defer func() { <-CPoolWinner }()
-					//TaskWinner(mapinfo)
+					TaskWinner(mapinfo)
 				}(tmp)
 				CPoolBuery <- true
 				go func(mapinfo *map[string]interface{}) {
@@ -127,7 +127,7 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 				CPoolAgency <- true
 				go func(mapinfo *map[string]interface{}) {
 					defer func() { <-CPoolAgency }()
-					//TaskAgency(mapinfo)
+					TaskAgency(mapinfo)
 				}(tmp)
 			}else if tmpstype =="winner" {
 				CPoolWinner <- true