|
@@ -6,48 +6,58 @@ import (
|
|
|
"unicode/utf8"
|
|
|
)
|
|
|
|
|
|
-func winnerFieldScore(tmp map[string]interface{}) (int64) {
|
|
|
+func winnerFieldScore(tmp map[string]interface{}) (map[string]interface{}) {
|
|
|
s_winner := qu.ObjToString(tmp["s_winner"])
|
|
|
buyer := qu.ObjToString(tmp["buyer"])
|
|
|
agency := qu.ObjToString(tmp["agency"])
|
|
|
- subtype := qu.ObjToString(tmp["subtype"])
|
|
|
package_map:=*qu.ObjToMap(tmp["package"])
|
|
|
score := int64(100)
|
|
|
+ reason := ""
|
|
|
s_winner_arr := strings.Split(s_winner,",")
|
|
|
- if len(s_winner_arr)!=len(package_map) {
|
|
|
- score -= 2
|
|
|
+ if len(s_winner_arr)!=len(package_map) && len(package_map)>0 {
|
|
|
+ reason+="~分包量-1"
|
|
|
+ score -= 1
|
|
|
}
|
|
|
|
|
|
for _,winner:=range s_winner_arr{
|
|
|
/*错误项*/
|
|
|
- if ((subtype=="中标"||subtype=="成交") && winner=="") || !isIncludingHan(buyer) ||
|
|
|
- (utf8.RuneCountInString(winner) > 0 && utf8.RuneCountInString(winner) < 4 ) {
|
|
|
- return 0
|
|
|
+ if (utf8.RuneCountInString(winner) > 0 && utf8.RuneCountInString(winner) < 4 ) ||
|
|
|
+ winner=="" || !isIncludingHan(winner) {
|
|
|
+ return map[string]interface{}{
|
|
|
+ "score":int64(0),
|
|
|
+ "reason":"错误项",
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/*减分项*/
|
|
|
//1、企业库匹配
|
|
|
- if !isTest && !qyNameIsExistsQYXY(buyer){
|
|
|
- score -= 2
|
|
|
+ if !isTest && !qyNameIsExistsQYXY(winner){
|
|
|
+ reason+="~企业-1"
|
|
|
+ score -= 1
|
|
|
}
|
|
|
//2、前缀校验
|
|
|
if specHeadReg.MatchString(winner) || !unHanHeadReg.MatchString(winner) {
|
|
|
+ reason+="~前缀-2"
|
|
|
score -= 2
|
|
|
}
|
|
|
//3、后缀校验
|
|
|
if unConReg.MatchString(winner) || unEndReg.MatchString(winner) {
|
|
|
if unenableReg1.MatchString(winner) || unenableReg2.MatchString(winner) {
|
|
|
+ reason+="~略特殊-2"
|
|
|
score -= 2
|
|
|
}
|
|
|
}else {
|
|
|
+ reason+="~后缀-2"
|
|
|
score -= 2
|
|
|
}
|
|
|
//4、与其他单位比对
|
|
|
if (winner==agency || winner==buyer) && winner !="" {
|
|
|
+ reason+="~其他单位-2"
|
|
|
score -= 2
|
|
|
}
|
|
|
//5、中英文结合
|
|
|
- if isIncludingOtherHan(buyer){
|
|
|
+ if isIncludingOtherHan(winner){
|
|
|
+ reason+="~非纯中文-2"
|
|
|
score -= 2
|
|
|
}
|
|
|
|
|
@@ -56,9 +66,13 @@ func winnerFieldScore(tmp map[string]interface{}) (int64) {
|
|
|
if len(winner_jb_arr)>0 && winner_jb_arr!=nil {
|
|
|
head_char := qu.ObjToString(winner_jb_arr[0])
|
|
|
if utf8.RuneCountInString(head_char) == 1{
|
|
|
+ reason+="~分词-2"
|
|
|
score -= 2
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return score
|
|
|
+ return map[string]interface{}{
|
|
|
+ "score":score,
|
|
|
+ "reason":reason,
|
|
|
+ }
|
|
|
}
|