|
@@ -9,7 +9,7 @@ import (
|
|
// 审批数据判断字段,包含三个以上属于拟建
|
|
// 审批数据判断字段,包含三个以上属于拟建
|
|
//var spFields = []string{"approvecode", "owner", "projectaddr", "project_scale_info", "projectname"}
|
|
//var spFields = []string{"approvecode", "owner", "projectaddr", "project_scale_info", "projectname"}
|
|
|
|
|
|
-//ChargeDetailResult 检测内容是否符合 toptype=结果
|
|
|
|
|
|
+// ChargeDetailResult 检测内容是否符合 toptype=结果
|
|
func ChargeDetailResult(detail string) bool {
|
|
func ChargeDetailResult(detail string) bool {
|
|
if ChargeDetailZB(detail) || ChargeDetailCJ(detail) {
|
|
if ChargeDetailZB(detail) || ChargeDetailCJ(detail) {
|
|
return true
|
|
return true
|
|
@@ -17,7 +17,7 @@ func ChargeDetailResult(detail string) bool {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
-//ChargeDetailCJ 检测内容是否符合 toptype=结果;subtype=成交
|
|
|
|
|
|
+// ChargeDetailCJ 检测内容是否符合 toptype=结果;subtype=成交
|
|
func ChargeDetailCJ(detail string) bool {
|
|
func ChargeDetailCJ(detail string) bool {
|
|
var reg = regexp.MustCompile("(成交单位|成交人|成交供应商)[::][\\s ]*(.{2,25}(公司))")
|
|
var reg = regexp.MustCompile("(成交单位|成交人|成交供应商)[::][\\s ]*(.{2,25}(公司))")
|
|
//含有 投标截止时间 关键词,代表不是结果,需要排除
|
|
//含有 投标截止时间 关键词,代表不是结果,需要排除
|
|
@@ -35,7 +35,7 @@ func ChargeDetailCJ(detail string) bool {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
-//ChargeDetailZB 检测内容是否符合 toptype=结果;subtype=中标
|
|
|
|
|
|
+// ChargeDetailZB 检测内容是否符合 toptype=结果;subtype=中标
|
|
func ChargeDetailZB(detail string) bool {
|
|
func ChargeDetailZB(detail string) bool {
|
|
var reg = regexp.MustCompile("(中标人单位名称|中标供应商|中标供应商名称|中标人名称|中签单位名称|中签单位|中标商家)[::][\\s ]*(.{2,25}(公司|单位|局|厅))")
|
|
var reg = regexp.MustCompile("(中标人单位名称|中标供应商|中标供应商名称|中标人名称|中签单位名称|中签单位|中标商家)[::][\\s ]*(.{2,25}(公司|单位|局|厅))")
|
|
var reg2 = regexp.MustCompile("(投标截止时间)")
|
|
var reg2 = regexp.MustCompile("(投标截止时间)")
|
|
@@ -48,7 +48,7 @@ func ChargeDetailZB(detail string) bool {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
-//GetJyKey 免费订阅:o_jy.a_key.key/appendkey
|
|
|
|
|
|
+// GetJyKey 免费订阅:o_jy.a_key.key/appendkey
|
|
func GetJyKey(data map[string]interface{}) (res []interface{}) {
|
|
func GetJyKey(data map[string]interface{}) (res []interface{}) {
|
|
// 获取o_jy.a_key.key的值
|
|
// 获取o_jy.a_key.key的值
|
|
if ojy, ok := data["o_jy"].(map[string]interface{}); ok {
|
|
if ojy, ok := data["o_jy"].(map[string]interface{}); ok {
|
|
@@ -69,7 +69,7 @@ func GetJyKey(data map[string]interface{}) (res []interface{}) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//GetVipKey 超级订阅:o_vipjy.a_items.a_key.key/appendkey
|
|
|
|
|
|
+// GetVipKey 超级订阅:o_vipjy.a_items.a_key.key/appendkey
|
|
func GetVipKey(data map[string]interface{}) (res []interface{}) {
|
|
func GetVipKey(data map[string]interface{}) (res []interface{}) {
|
|
//o_vipjy.a_items.a_key.key
|
|
//o_vipjy.a_items.a_key.key
|
|
if o_vipjy, ok := data["o_vipjy"].(map[string]interface{}); ok {
|
|
if o_vipjy, ok := data["o_vipjy"].(map[string]interface{}); ok {
|
|
@@ -96,7 +96,7 @@ func GetVipKey(data map[string]interface{}) (res []interface{}) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//GetMemberKey 大会员订阅:o_member_jy.a_items.a_key.key/appendkey
|
|
|
|
|
|
+// GetMemberKey 大会员订阅:o_member_jy.a_items.a_key.key/appendkey
|
|
func GetMemberKey(data map[string]interface{}) (res []interface{}) {
|
|
func GetMemberKey(data map[string]interface{}) (res []interface{}) {
|
|
//o_member_jy.a_items.a_key.key
|
|
//o_member_jy.a_items.a_key.key
|
|
if o_member_jy, ok := data["o_member_jy"].(map[string]interface{}); ok {
|
|
if o_member_jy, ok := data["o_member_jy"].(map[string]interface{}); ok {
|
|
@@ -123,7 +123,7 @@ func GetMemberKey(data map[string]interface{}) (res []interface{}) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//RemoveDuplicates 过滤重复数据
|
|
|
|
|
|
+// RemoveDuplicates 过滤重复数据
|
|
func RemoveDuplicates(elements []interface{}) []interface{} {
|
|
func RemoveDuplicates(elements []interface{}) []interface{} {
|
|
encountered := map[interface{}]bool{}
|
|
encountered := map[interface{}]bool{}
|
|
result := []interface{}{}
|
|
result := []interface{}{}
|
|
@@ -138,7 +138,7 @@ func RemoveDuplicates(elements []interface{}) []interface{} {
|
|
return result
|
|
return result
|
|
}
|
|
}
|
|
|
|
|
|
-//GetUserKeys 获取用户订阅关键词
|
|
|
|
|
|
+// GetUserKeys 获取用户订阅关键词
|
|
func GetUserKeys(data map[string]interface{}) (res []interface{}) {
|
|
func GetUserKeys(data map[string]interface{}) (res []interface{}) {
|
|
keys := GetJyKey(data)
|
|
keys := GetJyKey(data)
|
|
vkeys := GetVipKey(data)
|
|
vkeys := GetVipKey(data)
|
|
@@ -152,7 +152,7 @@ func GetUserKeys(data map[string]interface{}) (res []interface{}) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//RemoveDuplicateString 去除重复字符串
|
|
|
|
|
|
+// RemoveDuplicateString 去除重复字符串
|
|
func RemoveDuplicateString(arr []string) []string {
|
|
func RemoveDuplicateString(arr []string) []string {
|
|
encountered := map[string]bool{}
|
|
encountered := map[string]bool{}
|
|
result := []string{}
|
|
result := []string{}
|
|
@@ -171,7 +171,7 @@ func RemoveDuplicateString(arr []string) []string {
|
|
return result
|
|
return result
|
|
}
|
|
}
|
|
|
|
|
|
-//DealYuce 处理一级是预告,符合条件到采购意向
|
|
|
|
|
|
+// DealYuce 处理一级是预告,符合条件到采购意向
|
|
func DealYuce(data string) bool {
|
|
func DealYuce(data string) bool {
|
|
//标题含有招标计划,并且含有 预公告或者预公示,分类划分到采购意向
|
|
//标题含有招标计划,并且含有 预公告或者预公示,分类划分到采购意向
|
|
re1 := strings.Contains(data, "招标计划")
|
|
re1 := strings.Contains(data, "招标计划")
|
|
@@ -184,7 +184,7 @@ func DealYuce(data string) bool {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
-//IsPurchasingIntent 采购意向判断处理,符合采购意向返回true
|
|
|
|
|
|
+// IsPurchasingIntent 采购意向判断处理,符合采购意向返回true
|
|
func IsPurchasingIntent(data map[string]interface{}) bool {
|
|
func IsPurchasingIntent(data map[string]interface{}) bool {
|
|
if channel, ok := data["channel"]; ok {
|
|
if channel, ok := data["channel"]; ok {
|
|
if strings.Contains(channel.(string), "项目登记") {
|
|
if strings.Contains(channel.(string), "项目登记") {
|
|
@@ -203,3 +203,35 @@ func IsPurchasingIntent(data map[string]interface{}) bool {
|
|
|
|
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// ProcessTopscopeclass 处理行业分类
|
|
|
|
+func ProcessTopscopeclass(tops, subs []string) ([]string, []string) {
|
|
|
|
+ // 去除 tops 中每个元素末尾的不固定字符
|
|
|
|
+ cleanedTops := make([]string, 0)
|
|
|
|
+ for _, top := range tops {
|
|
|
|
+ parts := strings.Split(top, "")
|
|
|
|
+ cleanedTop := strings.Join(parts[:len(parts)-1], "")
|
|
|
|
+ cleanedTops = append(cleanedTops, cleanedTop)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 用于标记 cleanedTops 中已存在于 subs 的元素
|
|
|
|
+ presentMap := make(map[string]bool)
|
|
|
|
+
|
|
|
|
+ // 遍历 subs 数组,标记已存在的 cleanedTops 元素
|
|
|
|
+ for _, sub := range subs {
|
|
|
|
+ for _, top := range cleanedTops {
|
|
|
|
+ if strings.Contains(sub, top) {
|
|
|
|
+ presentMap[top] = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 补充缺失的 cleanedTops 元素到 subs 中
|
|
|
|
+ for _, top := range cleanedTops {
|
|
|
|
+ if !presentMap[top] {
|
|
|
|
+ subs = append(subs, top+"_其它")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return tops, subs
|
|
|
|
+}
|