|
@@ -648,7 +648,7 @@ func ExtRegBack(j *ju.Job, in *RegLuaInfo, t *TaskInfo) {
|
|
|
tmp := j.Result[in.Field]
|
|
|
exts := []interface{}{}
|
|
|
for k, v := range tmp {
|
|
|
- if v.Type == "table" { //table抽取到的数据不清理
|
|
|
+ if v.Type == "table" && v.Field != "projectname" { //table抽取到的数据不清理
|
|
|
continue
|
|
|
}
|
|
|
text := qu.ObjToString(v.Value)
|
|
@@ -858,66 +858,66 @@ func AnalysisSaveResult(j *ju.Job, e *ExtractTask) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //质量审核
|
|
|
- if ju.Config["qualityaudit"].(bool) {
|
|
|
- e.QualityAudit(tmp)
|
|
|
- }
|
|
|
- if e.IsExtractCity { //城市抽取
|
|
|
- b, p, c, d := e.TransmitData(tmp, _id) //抽取省份城市
|
|
|
- //log.Println("省份---", p, "城市---", c, "区---", d)
|
|
|
- tmp["district"] = d
|
|
|
- if b {
|
|
|
- tmp["city"] = c
|
|
|
- tmp["area"] = p
|
|
|
- }
|
|
|
- }
|
|
|
- //品牌抽取
|
|
|
- if ju.IsBrandGoods {
|
|
|
- tmp["checkhas"] = map[string]int{
|
|
|
- "hastable": j.HasTable,
|
|
|
- "hasgoods": j.HasGoods,
|
|
|
- "hasbrand": j.HasBrand,
|
|
|
- "haskey": j.HasKey,
|
|
|
+ //质量审核
|
|
|
+ if ju.Config["qualityaudit"].(bool) {
|
|
|
+ e.QualityAudit(tmp)
|
|
|
}
|
|
|
- if len(j.BrandData) > 0 {
|
|
|
- tmp["brand"] = j.BrandData
|
|
|
+ if e.IsExtractCity { //城市抽取
|
|
|
+ b, p, c, d := e.TransmitData(tmp, _id) //抽取省份城市
|
|
|
+ //log.Println("省份---", p, "城市---", c, "区---", d)
|
|
|
+ tmp["district"] = d
|
|
|
+ if b {
|
|
|
+ tmp["city"] = c
|
|
|
+ tmp["area"] = p
|
|
|
+ }
|
|
|
}
|
|
|
- //log.Println("============", j.HasBrand, j.HasGoods, j.HasKey, j.HasTable, j.BrandData)
|
|
|
- }
|
|
|
- if e.TaskInfo.TestColl == "" {
|
|
|
- if len(tmp) > 0 { //保存抽取结果
|
|
|
- tmparr := []map[string]interface{}{
|
|
|
- map[string]interface{}{
|
|
|
- "_id": qu.StringTOBsonId(_id),
|
|
|
- },
|
|
|
- map[string]interface{}{"$set": tmp},
|
|
|
+ //品牌抽取
|
|
|
+ if ju.IsBrandGoods {
|
|
|
+ tmp["checkhas"] = map[string]int{
|
|
|
+ "hastable": j.HasTable,
|
|
|
+ "hasgoods": j.HasGoods,
|
|
|
+ "hasbrand": j.HasBrand,
|
|
|
+ "haskey": j.HasKey,
|
|
|
}
|
|
|
- e.BidArr = append(e.BidArr, tmparr)
|
|
|
+ if len(j.BrandData) > 0 {
|
|
|
+ tmp["brand"] = j.BrandData
|
|
|
+ }
|
|
|
+ //log.Println("============", j.HasBrand, j.HasGoods, j.HasKey, j.HasTable, j.BrandData)
|
|
|
}
|
|
|
- if b, ok := ju.Config["saveresult"].(bool); ok && b {
|
|
|
- id := tmp["_id"]
|
|
|
- tmp["result"] = result
|
|
|
+ if e.TaskInfo.TestColl == "" {
|
|
|
+ if len(tmp) > 0 { //保存抽取结果
|
|
|
+ tmparr := []map[string]interface{}{
|
|
|
+ map[string]interface{}{
|
|
|
+ "_id": qu.StringTOBsonId(_id),
|
|
|
+ },
|
|
|
+ map[string]interface{}{"$set": tmp},
|
|
|
+ }
|
|
|
+ e.BidArr = append(e.BidArr, tmparr)
|
|
|
+ }
|
|
|
+ if b, ok := ju.Config["saveresult"].(bool); ok && b {
|
|
|
+ id := tmp["_id"]
|
|
|
+ tmp["result"] = result
|
|
|
+ delete(tmp, "_id")
|
|
|
+ tmparr := []map[string]interface{}{
|
|
|
+ map[string]interface{}{
|
|
|
+ "_id": id,
|
|
|
+ },
|
|
|
+ map[string]interface{}{"$set": tmp},
|
|
|
+ }
|
|
|
+ e.ResultArr = append(e.ResultArr, tmparr)
|
|
|
+ }
|
|
|
+ } else { //测试结果
|
|
|
delete(tmp, "_id")
|
|
|
- tmparr := []map[string]interface{}{
|
|
|
- map[string]interface{}{
|
|
|
- "_id": id,
|
|
|
- },
|
|
|
- map[string]interface{}{"$set": tmp},
|
|
|
+ if len(j.BlockPackage) > 0 { //分包详情
|
|
|
+ bs, _ := json.Marshal(j.BlockPackage)
|
|
|
+ tmp["epackage"] = string(bs)
|
|
|
+ }
|
|
|
+ tmp["result"] = result
|
|
|
+ b := db.Mgo.Update(e.TaskInfo.TestColl, `{"_id":"`+_id+`"}`, map[string]interface{}{"$set": tmp}, true, false)
|
|
|
+ if !b {
|
|
|
+ log.Println(e.TaskInfo.TestColl, _id)
|
|
|
}
|
|
|
- e.ResultArr = append(e.ResultArr, tmparr)
|
|
|
- }
|
|
|
- } else { //测试结果
|
|
|
- delete(tmp, "_id")
|
|
|
- if len(j.BlockPackage) > 0 { //分包详情
|
|
|
- bs, _ := json.Marshal(j.BlockPackage)
|
|
|
- tmp["epackage"] = string(bs)
|
|
|
- }
|
|
|
- tmp["result"] = result
|
|
|
- b := db.Mgo.Update(e.TaskInfo.TestColl, `{"_id":"`+_id+`"}`, map[string]interface{}{"$set": tmp}, true, false)
|
|
|
- if !b {
|
|
|
- log.Println(e.TaskInfo.TestColl, _id)
|
|
|
}
|
|
|
- }
|
|
|
}, func(err interface{}) {
|
|
|
log.Println("AnalysisSaveResult err", err)
|
|
|
})
|