|
@@ -419,27 +419,34 @@ func (e *ExtractTask) ExtractDetail(j *ju.Job) {
|
|
|
}
|
|
|
//候选人加入
|
|
|
if len(j.Winnerorder) > 0 {
|
|
|
- winner := &ju.ExtField{
|
|
|
- Field: "winner",
|
|
|
- Code: "",
|
|
|
- RuleText: "",
|
|
|
- Type: "winnerorder",
|
|
|
- MatchType: "winnerorder",
|
|
|
- ExtFrom: "",
|
|
|
- Value: j.Winnerorder[0]["entname"],
|
|
|
- Score: 0,
|
|
|
- }
|
|
|
- if len([]rune(qu.ObjToString(j.Winnerorder[0]["entname"]))) < 4 {
|
|
|
- winner.Score = -5
|
|
|
+ //候选人中标金额
|
|
|
+ if price := j.Winnerorder[0]["price"]; price != nil {
|
|
|
+ bidamount := &ju.ExtField{
|
|
|
+ Field: "bidamount",
|
|
|
+ Code: "",
|
|
|
+ RuleText: "",
|
|
|
+ Type: "winnerorder",
|
|
|
+ MatchType: "winnerorder",
|
|
|
+ ExtFrom: "",
|
|
|
+ Value: price,
|
|
|
+ Score: 0,
|
|
|
+ }
|
|
|
+ j.Result["bidamount"] = []*ju.ExtField{bidamount}
|
|
|
}
|
|
|
- winners := j.Result["winner"]
|
|
|
- if winners != nil {
|
|
|
- winners = append(winners, winner)
|
|
|
- } else {
|
|
|
- winners = []*ju.ExtField{}
|
|
|
- winners = append(winners, winner)
|
|
|
+ //候选人中标单位
|
|
|
+ if entname := j.Winnerorder[0]["entname"]; entname != nil {
|
|
|
+ winner := &ju.ExtField{
|
|
|
+ Field: "winner",
|
|
|
+ Code: "",
|
|
|
+ RuleText: "",
|
|
|
+ Type: "winnerorder",
|
|
|
+ MatchType: "winnerorder",
|
|
|
+ ExtFrom: "",
|
|
|
+ Value: entname,
|
|
|
+ Score: 0,
|
|
|
+ }
|
|
|
+ j.Result["winner"] = []*ju.ExtField{winner}
|
|
|
}
|
|
|
- j.Result["winner"] = winners
|
|
|
}
|
|
|
//函数清理
|
|
|
for key, val := range j.Result {
|
|
@@ -532,27 +539,34 @@ func (e *ExtractTask) ExtractFile(j *ju.Job) {
|
|
|
}
|
|
|
//候选人加入
|
|
|
if len(j.Winnerorder) > 0 {
|
|
|
- winner := &ju.ExtField{
|
|
|
- Field: "winner",
|
|
|
- Code: "",
|
|
|
- RuleText: "",
|
|
|
- Type: "winnerorder",
|
|
|
- MatchType: "winnerorder",
|
|
|
- ExtFrom: "",
|
|
|
- Value: j.Winnerorder[0]["entname"],
|
|
|
- Score: 0,
|
|
|
- }
|
|
|
- if len([]rune(qu.ObjToString(j.Winnerorder[0]["entname"]))) < 4 {
|
|
|
- winner.Score = -5
|
|
|
+ //候选人中标金额
|
|
|
+ if price := j.Winnerorder[0]["price"]; price != nil {
|
|
|
+ bidamount := &ju.ExtField{
|
|
|
+ Field: "bidamount",
|
|
|
+ Code: "",
|
|
|
+ RuleText: "",
|
|
|
+ Type: "winnerorder",
|
|
|
+ MatchType: "winnerorder",
|
|
|
+ ExtFrom: "",
|
|
|
+ Value: price,
|
|
|
+ Score: 0,
|
|
|
+ }
|
|
|
+ j.Result["bidamount"] = []*ju.ExtField{bidamount}
|
|
|
}
|
|
|
- winners := j.Result["winner"]
|
|
|
- if winners != nil {
|
|
|
- winners = append(winners, winner)
|
|
|
- } else {
|
|
|
- winners = []*ju.ExtField{}
|
|
|
- winners = append(winners, winner)
|
|
|
+ //候选人中标单位
|
|
|
+ if entname := j.Winnerorder[0]["entname"]; entname != nil {
|
|
|
+ winner := &ju.ExtField{
|
|
|
+ Field: "winner",
|
|
|
+ Code: "",
|
|
|
+ RuleText: "",
|
|
|
+ Type: "winnerorder",
|
|
|
+ MatchType: "winnerorder",
|
|
|
+ ExtFrom: "",
|
|
|
+ Value: entname,
|
|
|
+ Score: 0,
|
|
|
+ }
|
|
|
+ j.Result["winner"] = []*ju.ExtField{winner}
|
|
|
}
|
|
|
- j.Result["winner"] = winners
|
|
|
}
|
|
|
//函数清理
|
|
|
for key, val := range j.Result {
|
|
@@ -737,6 +751,7 @@ func getKvByLuaFields(vc *RuleCore, j *ju.Job, et *ExtractTask) map[string][]map
|
|
|
text := ju.TrimLRSpace(vv.Value, "")
|
|
|
if text != "" {
|
|
|
kvmap[field] = append(kvmap[field], map[string]interface{}{
|
|
|
+ "code": "CL_" + vv.Key,
|
|
|
"field": field,
|
|
|
"ruletext": vv.Key,
|
|
|
"extfrom": vc.ExtFrom,
|
|
@@ -917,10 +932,10 @@ func ExtRegBack(j *ju.Job, in *RegLuaInfo, t *TaskInfo) {
|
|
|
if text != "" {
|
|
|
text = in.RegPreBac.Reg.ReplaceAllString(text, in.RegPreBac.Replace)
|
|
|
}
|
|
|
- j.Result[in.Field][k].Value = text
|
|
|
if text == qu.ObjToString(v.Value) { //值未发生改变,不存日志
|
|
|
continue
|
|
|
}
|
|
|
+ j.Result[in.Field][k].Value = text
|
|
|
exts = append(exts, map[string]interface{}{
|
|
|
"field": v.Field,
|
|
|
"code": v.Code,
|
|
@@ -947,10 +962,10 @@ func ExtRegBack(j *ju.Job, in *RegLuaInfo, t *TaskInfo) {
|
|
|
if text != "" {
|
|
|
text = in.RegPreBac.Reg.ReplaceAllString(text, in.RegPreBac.Replace)
|
|
|
}
|
|
|
- j.Result[key][k].Value = text
|
|
|
if text == qu.ObjToString(v.Value) { //值未发生改变,不存日志
|
|
|
continue
|
|
|
}
|
|
|
+ j.Result[key][k].Value = text
|
|
|
exts = append(exts, map[string]interface{}{
|
|
|
"field": v.Field,
|
|
|
"code": v.Code,
|
|
@@ -1001,7 +1016,7 @@ func AddExtLog(ftype, sid string, before interface{}, extinfo interface{}, v *Re
|
|
|
return
|
|
|
}
|
|
|
logdata := map[string]interface{}{
|
|
|
- "code": v.Code,
|
|
|
+ "code": qu.If(v.Code == "", "kv", v.Code),
|
|
|
"name": v.Name,
|
|
|
"type": ftype,
|
|
|
"ruletext": v.RuleText,
|
|
@@ -1101,10 +1116,13 @@ func AnalysisSaveResult(j, jf *ju.Job, e *ExtractTask) {
|
|
|
tmp := map[string]interface{}{} //抽取值
|
|
|
tmp["fieldall"] = auxinfo
|
|
|
for _, val := range result {
|
|
|
- for _, v := range val { //取第一个非负数
|
|
|
+ for _, v := range val { //取第一个非负数,项目名称除外
|
|
|
if v.Score > -1 {
|
|
|
tmp[v.Field] = v.Value
|
|
|
break
|
|
|
+ } else if v.Field == "projectname" {
|
|
|
+ tmp[v.Field] = v.Value
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|