|
@@ -1,6 +1,7 @@
|
|
|
package extract
|
|
|
|
|
|
import (
|
|
|
+ "encoding/json"
|
|
|
"fmt"
|
|
|
"jy/clear"
|
|
|
db "jy/mongodbutil"
|
|
@@ -466,10 +467,16 @@ func getKvByLuaFields(extfrom string, j *ju.Job, in *RegLuaInfo, t map[string][]
|
|
|
for k, v := range tkv.Kv {
|
|
|
if k == fieldname {
|
|
|
if len(tags) > -tkv.KvIndex[fieldname] {
|
|
|
+ ruletext := ""
|
|
|
+ if fieldname == "项目名称" && -tkv.KvIndex[fieldname] == -100 {
|
|
|
+ ruletext = "项目名称"
|
|
|
+ } else {
|
|
|
+ ruletext = tags[-tkv.KvIndex[fieldname]].Key
|
|
|
+ }
|
|
|
kvmap[field] = append(kvmap[field], map[string]interface{}{
|
|
|
"field": field,
|
|
|
"code": in.Code,
|
|
|
- "ruletext": tags[-tkv.KvIndex[fieldname]].Key,
|
|
|
+ "ruletext": ruletext,
|
|
|
"extfrom": "table",
|
|
|
"value": v,
|
|
|
"type": "table",
|
|
@@ -719,7 +726,7 @@ func AnalysisSaveResult(j *ju.Job, e *ExtractTask) {
|
|
|
_id := qu.BsonIdToSId((*doc)["_id"])
|
|
|
iscore, _ := ju.Config["fieldscore"].(bool)
|
|
|
if iscore { //打分
|
|
|
- result = ScoreFields(result)
|
|
|
+ result = ScoreFields(j)
|
|
|
}
|
|
|
//结果排序
|
|
|
values := map[string][]*ju.SortObject{}
|
|
@@ -765,32 +772,32 @@ func AnalysisSaveResult(j *ju.Job, e *ExtractTask) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //resulttmp := tmp
|
|
|
- resulttmp, _ := ju.DeepCopy(tmp).(map[string]interface{}) //保存结果
|
|
|
- resulttmp["result"] = result
|
|
|
if len(j.PackageInfo) > 0 { //分包信息
|
|
|
- resulttmp["package"] = j.PackageInfo
|
|
|
+ tmp["package"] = j.PackageInfo
|
|
|
}
|
|
|
if len(j.Winnerorder) > 0 { //候选人信息
|
|
|
- resulttmp["winnerorder"] = j.Winnerorder
|
|
|
+ tmp["winnerorder"] = j.Winnerorder
|
|
|
}
|
|
|
for k, v := range *doc {
|
|
|
- if resulttmp[k] == nil { //&& (k != "detail" || k != "contenthtml") {
|
|
|
- resulttmp[k] = v
|
|
|
+ if k == "detail" || k == "contenthtml" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if tmp[k] == nil {
|
|
|
+ tmp[k] = v
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//质量审核
|
|
|
if ju.Config["qualityaudit"].(bool) {
|
|
|
- e.QualityAudit(resulttmp)
|
|
|
+ e.QualityAudit(tmp)
|
|
|
}
|
|
|
if e.IsExtractCity { //城市抽取
|
|
|
- b, p, c, d := e.TransmitData(resulttmp, _id) //抽取省份城市
|
|
|
+ b, p, c, d := e.TransmitData(tmp, _id) //抽取省份城市
|
|
|
//log.Println("省份---", p, "城市---", c, "区---", d)
|
|
|
- resulttmp["district"] = d
|
|
|
+ tmp["district"] = d
|
|
|
if b {
|
|
|
- resulttmp["city"] = c
|
|
|
- resulttmp["area"] = p
|
|
|
+ tmp["city"] = c
|
|
|
+ tmp["area"] = p
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -805,21 +812,24 @@ func AnalysisSaveResult(j *ju.Job, e *ExtractTask) {
|
|
|
e.BidArr = append(e.BidArr, tmparr)
|
|
|
}
|
|
|
if b, ok := ju.Config["saveresult"].(bool); ok && b {
|
|
|
- id := resulttmp["_id"]
|
|
|
- delete(resulttmp, "_id")
|
|
|
+ id := tmp["_id"]
|
|
|
+ tmp["result"] = result
|
|
|
+ delete(tmp, "_id")
|
|
|
tmparr := []map[string]interface{}{
|
|
|
map[string]interface{}{
|
|
|
"_id": id,
|
|
|
},
|
|
|
- map[string]interface{}{"$set": resulttmp},
|
|
|
+ map[string]interface{}{"$set": tmp},
|
|
|
}
|
|
|
e.ResultArr = append(e.ResultArr, tmparr)
|
|
|
}
|
|
|
} else { //测试结果
|
|
|
+ delete(tmp, "_id")
|
|
|
if len(j.BlockPackage) > 0 { //分包详情
|
|
|
- resulttmp["epackage"] = j.BlockPackage
|
|
|
+ bs, _ := json.Marshal(j.BlockPackage)
|
|
|
+ tmp["epackage"] = string(bs)
|
|
|
}
|
|
|
- b := db.Mgo.Update(e.TaskInfo.TestColl, `{"_id":"`+_id+`"}`, map[string]interface{}{"$set": resulttmp}, true, false)
|
|
|
+ b := db.Mgo.Update(e.TaskInfo.TestColl, `{"_id":"`+_id+`"}`, map[string]interface{}{"$set": tmp}, true, false)
|
|
|
if !b {
|
|
|
log.Println(e.TaskInfo.TestColl, _id)
|
|
|
}
|