@ -13,7 +13,9 @@ func (x paixuArr) Len() int {
return len ( x )
}
func ( x paixuArr ) Less ( i , j int ) bool {
if x [ i ] . GetMap ( "declare" ) != nil {
return x [ i ] . GetMap ( "declare" ) . GetFloat64 ( "matching_degree" ) > x [ j ] . GetMap ( "declare" ) . GetFloat64 ( "matching_degree" )
}
return x [ i ] . GetCeilInt64 ( "count" ) > x [ j ] . GetCeilInt64 ( "count" )
}
func ( x paixuArr ) Swap ( i , j int ) {
@ -108,38 +110,14 @@ var DeclareCtr = Ctr{
delete ( company , "create_time" )
delete ( company , "modify_time" )
data := Map { }
//for k, _ := range company {
// if that.Req.Form[k] != nil {
// if k == "technology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" {
// data[k] = ObjToStr(that.Req.Form[k])
// } else {
// data[k] = that.Req.FormValue(k)
// }
//
// }
//}
for k , _ := range company {
// 前端传传值不规范
if k == "high_level_talents_flag" {
if k == "high_level_talents_flag1" && that . Req . FormValue ( "highLevel_talents_flag" ) != "" {
that . Req . Form [ k ] = that . Req . Form [ "highLevel_talents_flag" ]
}
if that . Req . Form [ k ] != nil {
if k == "t echnology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" {
if k == "tags" || k == "high_level_talents_flag1" || k == "technology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" {
data [ k ] = ObjToStr ( that . Req . Form [ k ] )
} else if k == "tags" || k == "high_level_talents_flag" {
keyObj := that . Req . Form [ k ]
if keyObj != nil && ObjToStr ( keyObj ) != "" {
tagsStr := ""
for k2 , v2 := range keyObj {
if k == "tags" && k2 < len ( keyObj ) - 1 {
tagsStr = tagsStr + v2 + ","
} else {
tagsStr += v2
}
}
data [ k ] = tagsStr
}
} else {
data [ k ] = that . Req . FormValue ( k )
}
@ -148,14 +126,14 @@ var DeclareCtr = Ctr{
//如果企业名称相同则允许变更企业信息
if companyName == company . GetString ( "name" ) {
that . Db . Update ( "company" , company , Map { "user_id" : that . Session ( "user_id" ) . Data } )
that . Db . Update ( "company" , data , Map { "user_id" : that . Session ( "user_id" ) . Data } )
}
if companyName != company . GetString ( "name" ) {
//扫码绑定后,第一次使用匹配功能,自动进行认证,并更新企业信息
if user . GetCeilInt ( "certification_flag" ) == 0 && user . GetCeilInt64 ( "salesman_id" ) != 0 {
that . Db . Update ( "user" , Map { "certification_flag" : 1 } , Map { "id" : user . GetCeilInt ( "id" ) } )
company [ "name" ] = companyName
that . Db . Update ( "company" , company , Map { "user_id" : that . Session ( "user_id" ) . Data } )
that . Db . Update ( "company" , data , Map { "user_id" : that . Session ( "user_id" ) . Data } )
}
//其余情况,不存储数据
}
@ -227,6 +205,7 @@ var DeclareCtr = Ctr{
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "engineering_center_flag" : flagslice } } )
for _ , v1 := range dtag {
@ -237,6 +216,7 @@ var DeclareCtr = Ctr{
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "engineering_center_flag_count" ] = 1
}
}
//是否是有效期内的工程实验室称号:0-否,1-市级,2-省级,3-国家级
flags = that . Req . Form [ "engineering_laboratory_flag" ]
@ -250,6 +230,7 @@ var DeclareCtr = Ctr{
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "engineering_laboratory_flag" : flagslice } } )
for _ , v1 := range dtag {
@ -260,7 +241,7 @@ var DeclareCtr = Ctr{
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "engineering_laboratory_flag_count" ] = 1
}
}
//是否是有效期内的重点实验室称号:0-否,1-市级,2-省级,3-国家级
flags = that . Req . Form [ "key_laboratory_flag" ]
flagslice = Slice { }
@ -273,6 +254,7 @@ var DeclareCtr = Ctr{
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "key_laboratory_flag" : flagslice } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
@ -281,6 +263,7 @@ var DeclareCtr = Ctr{
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "key_laboratory_flag_count" ] = 1
}
}
//是否是有效期内的工业设计中心称号:0-否,1-市级,2-省级,3-国家级
flags = that . Req . Form [ "industrial_design_center_flag" ]
@ -294,6 +277,7 @@ var DeclareCtr = Ctr{
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "industrial_design_center_flag" : flagslice } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
@ -302,6 +286,7 @@ var DeclareCtr = Ctr{
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "industrial_design_center_flag_count" ] = 1
}
}
//上年度有无研发投入:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "research_input_flag" ) ) > 0 {
@ -354,15 +339,55 @@ var DeclareCtr = Ctr{
}
}
//高层次人才情况:0-否,1-3个及以上博士-1,2-1个及以上博士-2,3-知名企业中高管1个及以上
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "high_level_talents_flag" : ObjToInt ( that . Req . FormValue ( "high_level_talents_flag" ) ) } } )
//dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "high_level_talents_flag1": ObjToInt(that.Req.FormValue("high_level_talents_flag1"))}})
//for _, v1 := range dtag {
//
// if declares[v1.GetCeilInt64("declare_id")] == nil {
// declares[v1.GetCeilInt64("declare_id")] = v1
// }
// declares[v1.GetCeilInt64("declare_id")]["count"] = declares[v1.GetCeilInt64("declare_id")].GetCeilInt64("count") + 1
// declares[v1.GetCeilInt64("declare_id")]["high_level_talents_flag1_count"] = 1
//}
//
//
//flags := that.Req.Form["engineering_center_flag"]
//flagslice := Slice{}
//if flags != nil {
// for _, v := range flags {
// if v == "0" {
// continue
// }
// flagslice = append(flagslice, v)
// }
//
//}
//高层次人才情况:0-否,1-3个及以上博士-1,2-1个及以上博士-2,3-知名企业中高管1个及以上
flags = that . Req . Form [ "high_level_talents_flag1" ]
flagslice = Slice { }
if flags != nil {
for _ , v := range flags {
if v == "0" {
continue
}
flagslice = append ( flagslice , v )
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "high_level_talents_flag1" : flagslice } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "high_level_talents_flag_count" ] = 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "high_level_talents_flag 1 "] = 1
}
}
//企业股东或成员是否有国内外高校或科研院在编、全职人员:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "shareholders_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "shareholders_flag" : ObjToInt ( that . Req . FormValue ( "shareholders_flag" ) ) } } )
@ -450,6 +475,492 @@ var DeclareCtr = Ctr{
that . Display ( 0 , res )
} ,
//政策匹配
"match_v2" : func ( that * Context ) {
if that . Session ( "user_id" ) . Data == nil {
that . Display ( 2 , "没有登录" )
return
}
user := that . Db . Get ( "user" , "*" , Map { "id" : that . Session ( "user_id" ) . Data } )
if user == nil {
that . Display ( 4 , "找不到用户" )
return
}
//消除company没有创建的影响
if user . GetCeilInt ( "company_id" ) == 0 {
companyId := that . Db . Insert ( "company" , Map {
"user_id" : user [ "id" ] ,
"create_time[#]" : "now()" ,
"modify_time[#]" : "now()" ,
"del_flag" : 0 ,
} )
user [ "company_id" ] = companyId
that . Db . Update ( "user" , Map { "company_id" : companyId } , Map { "id" : user . GetCeilInt ( "id" ) } )
}
companyName := that . Req . FormValue ( "company_name" )
if companyName == "" {
that . Display ( 3 , "参数错误" )
return
}
qu := that . Req . FormValue ( "register_address" )
qus := strings . Split ( qu , "/" )
for _ , v := range qus {
if v != "" {
qu = v
}
}
if ! strings . Contains ( qu , "区" ) && ! strings . Contains ( qu , "县" ) {
qu = "没有此项数据随意填充的"
}
company := that . Db . Get ( "company" , "*" , Map { "id" : user . GetCeilInt ( "company_id" ) } )
//消除company没有创建的影响
if company == nil {
companyId := that . Db . Insert ( "company" , Map {
"user_id" : user [ "id" ] ,
"create_time[#]" : "now()" ,
"modify_time[#]" : "now()" ,
"provider_id" : user [ "provider_id" ] ,
"salesman_id" : user [ "salesman_id" ] ,
"del_flag" : 0 ,
} )
user [ "company_id" ] = companyId
that . Db . Update ( "user" , Map { "company_id" : companyId } , Map { "id" : user . GetCeilInt ( "id" ) } )
company = that . Db . Get ( "company" , "*" , Map { "id" : user . GetCeilInt ( "company_id" ) } )
}
delete ( company , "id" )
delete ( company , "salesman_id" )
delete ( company , "provider_id" )
delete ( company , "user_id" )
delete ( company , "del_flag" )
delete ( company , "state" )
delete ( company , "create_time" )
delete ( company , "modify_time" )
data := Map { }
for k , _ := range company {
if k == "high_level_talents_flag1" && that . Req . FormValue ( "highLevel_talents_flag" ) != "" {
that . Req . Form [ k ] = that . Req . Form [ "highLevel_talents_flag" ]
}
if that . Req . Form [ k ] != nil {
if k == "tags" || k == "high_level_talents_flag1" || k == "technology_center_flag" || k == "engineering_center_flag" || k == "engineering_laboratory_flag" || k == "key_laboratory_flag" || k == "industrial_design_center_flag" {
//data[k] = ObjToStr(that.Req.Form[k])
data [ k ] = arrayToStr ( ObjToSlice ( that . Req . Form [ k ] ) )
} else {
data [ k ] = that . Req . FormValue ( k )
}
}
}
//如果企业名称相同则允许变更企业信息
if companyName == company . GetString ( "name" ) || company . GetString ( "name" ) == "" {
that . Db . Update ( "company" , data , Map { "user_id" : that . Session ( "user_id" ) . Data } )
}
if companyName != company . GetString ( "name" ) {
//扫码绑定后,第一次使用匹配功能,自动进行认证,并更新企业信息
if ( user . GetCeilInt ( "certification_flag" ) == 0 || company . GetString ( "name" ) == "" ) && user . GetCeilInt64 ( "salesman_id" ) != 0 {
that . Db . Update ( "user" , Map { "certification_flag" : 1 } , Map { "id" : user . GetCeilInt ( "id" ) } )
company [ "name" ] = companyName
that . Db . Update ( "company" , data , Map { "user_id" : that . Session ( "user_id" ) . Data } )
}
//其余情况,不存储数据
}
tags := that . Req . Form [ "tags" ]
declares := map [ int64 ] Map { }
//标签分析
if tags != nil {
for _ , v := range tags {
dtag := that . Db . Select ( "declare_tag" , Map { "[><]declare" : "declare_tag.declare_id=declare.id" } , "declare_tag.declare_id" , Map { "AND" : Map { "OR" : Map { "declare.policy_level" : Slice { "省" , "市" } , "declare.dispatch_department[~]" : qu } , "declare_tag.tag_id" : v } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "tag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "tag_count" ) + 1
}
}
}
//企业规模分析
dtag := that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "company_scale[<=]" : ObjToInt ( that . Req . FormValue ( "company_scale" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "company_scale_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "company_scale_count" ) + 1
}
//是否是有效期内的科技型中小企业称号:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "smes_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "smes_flag" : ObjToInt ( that . Req . FormValue ( "smes_flag" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "smes_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "smes_flag_count" ) + 1
}
}
//是否是有效期内的高新区技术企业称号:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "htzte_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "htzte_flag" : ObjToInt ( that . Req . FormValue ( "htzte_flag" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "htzte_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "htzte_flag_count" ) + 1
}
}
//是否是有效期内的工程中心称号:0-否,1-市级,2-省级,3-国家级
flags := that . Req . Form [ "engineering_center_flag" ]
flagslice := Slice { }
if flags != nil {
for _ , v := range flags {
if v == "0" {
continue
}
flagslice = append ( flagslice , v )
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "engineering_center_flag" : flagslice } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "engineering_center_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "engineering_center_flag_count" ) + 1
}
}
//是否是有效期内的工程实验室称号:0-否,1-市级,2-省级,3-国家级
flags = that . Req . Form [ "engineering_laboratory_flag" ]
flagslice = Slice { }
if flags != nil {
for _ , v := range flags {
if v == "0" {
continue
}
flagslice = append ( flagslice , v )
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "engineering_laboratory_flag" : flagslice } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "engineering_laboratory_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "engineering_laboratory_flag_count" ) + 1
}
}
//是否是有效期内的重点实验室称号:0-否,1-市级,2-省级,3-国家级
flags = that . Req . Form [ "key_laboratory_flag" ]
flagslice = Slice { }
if flags != nil {
for _ , v := range flags {
if v == "0" {
continue
}
flagslice = append ( flagslice , v )
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "key_laboratory_flag" : flagslice } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "key_laboratory_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "key_laboratory_flag_count" ) + 1
}
}
//是否是有效期内的工业设计中心称号:0-否,1-市级,2-省级,3-国家级
flags = that . Req . Form [ "industrial_design_center_flag" ]
flagslice = Slice { }
if flags != nil {
for _ , v := range flags {
if v == "0" {
continue
}
flagslice = append ( flagslice , v )
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "industrial_design_center_flag" : flagslice } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "industrial_design_center_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "industrial_design_center_flag_count" ) + 1
}
}
//上年度有无研发投入:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "research_input_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "del_flag" : 0 , "research_input_flag" : ObjToInt ( that . Req . FormValue ( "research_input_flag" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "research_input_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "research_input_flag_count" ) + 1
}
}
//有无授权发明专利:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "invention_patent_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "invention_patent_flag" : ObjToInt ( that . Req . FormValue ( "invention_patent_flag" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "invention_patent_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "invention_patent_flag_count" ) + 1
}
}
//有无国际科技合作:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "international_cooperation_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "international_cooperation_flag" : ObjToInt ( that . Req . FormValue ( "international_cooperation_flag" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "international_cooperation_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "international_cooperation_flag_count" ) + 1
}
}
//上年度有无固定资产投入:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "investment_fixed_assets_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "investment_fixed_assets_flag" : ObjToInt ( that . Req . FormValue ( "investment_fixed_assets_flag" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "investment_fixed_assets_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "investment_fixed_assets_flag_count" ) + 1
}
}
//高层次人才情况:0-否,1-3个及以上博士-1,2-1个及以上博士-2,3-知名企业中高管1个及以上
//dtag = that.Db.Select("declare", "id AS declare_id", Map{"AND": Map{"OR": Map{"policy_level": Slice{"省", "市"}, "dispatch_department[~]": qu}, "del_flag": 0, "high_level_talents_flag1": ObjToInt(that.Req.FormValue("high_level_talents_flag1"))}})
//for _, v1 := range dtag {
//
// if declares[v1.GetCeilInt64("declare_id")] == nil {
// declares[v1.GetCeilInt64("declare_id")] = v1
// }
// declares[v1.GetCeilInt64("declare_id")]["count"] = declares[v1.GetCeilInt64("declare_id")].GetCeilInt64("count") + 1
// declares[v1.GetCeilInt64("declare_id")]["high_level_talents_flag1_count"] = 1
//}
//
//
//flags := that.Req.Form["engineering_center_flag"]
//flagslice := Slice{}
//if flags != nil {
// for _, v := range flags {
// if v == "0" {
// continue
// }
// flagslice = append(flagslice, v)
// }
//
//}
//高层次人才情况:0-否,1-3个及以上博士-1,2-1个及以上博士-2,3-知名企业中高管1个及以上
flags = that . Req . Form [ "high_level_talents_flag1" ]
flagslice = Slice { }
if flags != nil {
for _ , v := range flags {
if v == "0" {
continue
}
flagslice = append ( flagslice , v )
}
}
if len ( flagslice ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "high_level_talents_flag1" : flagslice } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "high_level_talents_flag1_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "high_level_talents_flag1_count" ) + 1
}
}
//企业股东或成员是否有国内外高校或科研院在编、全职人员:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "shareholders_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "shareholders_flag" : ObjToInt ( that . Req . FormValue ( "shareholders_flag" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "shareholders_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "shareholders_flag_count" ) + 1
}
}
//企业有无从外地引进博士学历人才:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "nonlocal_dr_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "nonlocal_dr_flag" : ObjToInt ( that . Req . FormValue ( "nonlocal_dr_flag" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "nonlocal_dr_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "nonlocal_dr_flag_count" ) + 1
}
}
//上年度是否有贷款/融资或未来有贷款/融资计划:0-否,1-是
if ObjToInt ( that . Req . FormValue ( "loan_flag" ) ) > 0 {
dtag = that . Db . Select ( "declare" , "id AS declare_id" , Map { "AND" : Map { "OR" : Map { "policy_level" : Slice { "省" , "市" } , "dispatch_department[~]" : qu } , "del_flag" : 0 , "loan_flag" : ObjToInt ( that . Req . FormValue ( "loan_flag" ) ) } } )
for _ , v1 := range dtag {
if declares [ v1 . GetCeilInt64 ( "declare_id" ) ] == nil {
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] = v1
}
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetCeilInt64 ( "count" ) + 1
declares [ v1 . GetCeilInt64 ( "declare_id" ) ] [ "loan_flag_count" ] = declares [ v1 . GetCeilInt64 ( "declare_id" ) ] . GetInt64 ( "loan_flag_count" ) + 1
}
}
px := paixuArr { }
for _ , v := range declares {
px = append ( px , v )
}
//获取到排序后的数据
sort . Sort ( px )
res := paixuArr { }
//总参数量, 除了tag标签
columns := [ ] string {
"loan_flag" , "nonlocal_dr_flag" , "shareholders_flag" , "high_level_talents_flag1" ,
"investment_fixed_assets_flag" , "international_cooperation_flag" , "invention_patent_flag" ,
"research_input_flag" , "industrial_design_center_flag" , "key_laboratory_flag" ,
"engineering_laboratory_flag" , "engineering_center_flag" , "htzte_flag" ,
"smes_flag" , "company_scale" }
RecommendValue := 0
RecommendDeclare := Map { }
for _ , v := range px {
id := v . GetCeilInt ( "declare_id" )
article := that . Db . Get ( "article" , "id,title,description,department_id,click_num+click_num_base AS click_num," +
"favorite_num_base+favorite_num AS favorite_num,dispatch_num,dispatch_name,prepare_date,release_time,expire_date,area_id,status,declare_id,declare_id,declare_id" , Map { "declare_id" : id } )
declare := that . Db . Get ( "declare" , "*" , Map { "id" : id } )
//查询是否已关注
if that . Session ( "user_id" ) . Data != nil {
favorite := that . Db . Get ( "favorite" , "user_id,declare_id" , Map { "AND" : Map { "declare_id" : id , "user_id" : that . Session ( "user_id" ) . ToCeilInt ( ) , "del_flag" : 0 } } )
declare [ "favorite" ] = favorite
}
matchingDegree := 0
matchingDegreeCount := 0
for _ , v1 := range columns {
if declare . GetCeilInt ( v1 ) != 0 {
matchingDegreeCount = matchingDegreeCount + 1
}
if declare . GetCeilInt ( v1 ) != 0 && v . GetCeilInt ( v1 + "_count" ) != 0 {
matchingDegree ++
}
}
if RecommendValue < matchingDegree {
RecommendValue = matchingDegree
RecommendDeclare = declare
}
matchingDegreePercent := ObjToFloat64 ( matchingDegree ) / ObjToFloat64 ( matchingDegreeCount )
if matchingDegreePercent < 0.5 {
matchingDegreePercent = 0.5 + matchingDegreePercent
}
if matchingDegreePercent == 1 {
matchingDegreePercent = 0.95
}
declare [ "matching_degree" ] = matchingDegreePercent
article [ "declare" ] = declare
res = append ( res , article )
}
sort . Sort ( res )
minMoney := float64 ( 0 )
maxMoney := float64 ( 0 )
for _ , v := range res {
if v . GetMap ( "declare" ) != nil {
if v . GetMap ( "declare" ) . GetFloat64 ( "money_scope_min" ) < minMoney {
minMoney = v . GetMap ( "declare" ) . GetFloat64 ( "money_scope_min" )
}
if v . GetMap ( "declare" ) . GetFloat64 ( "money_scope_max" ) > maxMoney {
maxMoney = v . GetMap ( "declare" ) . GetFloat64 ( "money_scope_max" )
}
}
}
seData := Map {
"user_id" : that . Session ( "user_id" ) . Data ,
"search_company_name" : companyName ,
"policy_match_count" : len ( res ) ,
"json_data" : ObjToStr ( company ) ,
"create_time[#]" : "now()" ,
"modify_time[#]" : "now()" ,
"del_flag" : 0 ,
}
if maxMoney != minMoney {
seData [ "money_scope" ] = ObjToStr ( ObjToInt ( minMoney ) ) + "-" + ObjToStr ( ObjToInt ( maxMoney ) ) + ""
} else if maxMoney == 0 {
seData [ "money_scope" ] = ""
} else {
seData [ "money_scope" ] = ObjToStr ( ObjToInt ( maxMoney ) ) + ""
}
//匹配记录存储
that . Db . Insert ( "search_record" , seData )
re := Map { "recomend" : RecommendDeclare , "count" : len ( res ) , "data" : res }
//company,e:=aliyun.Company.GetCompanyBaseInfo(companyName)
//if e==nil{
// re["company"]=
//}
that . Display ( 0 , re )
} ,
//用户微信公众号或者小程序登录
"search" : func ( that * Context ) {