123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- package main
- import (
- qu "qfw/util"
- )
- func dealWithGroupScores(indexArr []int, scoreArr []int,siteArr []int) []int {
- //log.Println("下标组",indexArr,"质量分组",scoreArr,"整体站点组",siteArr)
- //处理分组
- sort_scoreArr,sort_indexArr := sortGroupInt(scoreArr,indexArr)
- //log.Println("排序质量分:",sort_scoreArr,sort_indexArr)
- totalIndexArr:=make([][]int,0)
- lastTmp := -1
- for k,v :=range sort_scoreArr {
- if v<lastTmp || k==0 {
- arr_s := make([]int,0)
- arr_i := make([]int,0)
- for index,value :=range scoreArr {
- if v==value {
- arr_s = append(arr_s,value)
- arr_i = append(arr_i,sort_indexArr[index])
- }
- }
- totalIndexArr = append(totalIndexArr,arr_i)
- lastTmp = v
- }
- }
- finallyIndexArr := make([]int,0)
- for _,v:=range totalIndexArr{
- if len(v)>1 {
- //[6 3 4]
- arr_s :=make([]int,0)
- for _,v1:=range v{
- arr_s = append(arr_s,siteArr[v1])
- }
- _,b:=sortGroupInt(arr_s,v)
- for _,v2:=range b {
- finallyIndexArr = append(finallyIndexArr,v2)
- }
- }else {
- finallyIndexArr = append(finallyIndexArr,v[0])
- }
- }
- return finallyIndexArr
- }
- //排序 正常排序 ,站点
- func sortNormalInt(arrValue []int) ([]int){
- for i := 0; i < len(arrValue); i++ {
- for j := i + 1; j < len(arrValue); j++ {
- if arrValue[i] < arrValue[j] {
- arrValue[i], arrValue[j] = arrValue[j], arrValue[i]
- }
- }
- }
- return arrValue
- }
- //排序 质量,分组
- func sortGroupInt(arrValue []int,arrIndex []int) ([]int ,[]int){
- for i := 0; i < len(arrValue); i++ {
- for j := i + 1; j < len(arrValue); j++ {
- if arrValue[i] < arrValue[j] {
- arrValue[i], arrValue[j] = arrValue[j], arrValue[i]
- arrIndex[i], arrIndex[j] = arrIndex[j], arrIndex[i]
- }
- }
- }
- return arrValue,arrIndex
- }
- //分析站点评分
- func analyzeTheSite(tmp map[string]interface{}) int {
- /*
- 站点评分1-N级
- 5、政府采购
- 4、公共资源
- 3、人民政府/政府机构/学校/医院/公司官方网站
- 2、社会公共招标平台/企业公共平台
- 1、其他
- 0、""
- */
- level := 0
- site := qu.ObjToString(tmp["site"])
- if site == "政府采购" {
- level = 5
- }else if site == "公共资源" {
- level = 4
- }else if site=="人民政府"||site=="政府机构"||site=="学校"||site=="医院"||site=="公司官方网站" {
- level = 3
- }else if site == "社会公共招标平台"||site == "企业公共平台" {
- level = 2
- }else if site == "其他" {
- level = 1
- }else {
- }
- return level
- }
- //分析要素评分
- func analyzeTheElements(tmp map[string]interface{}) int {
- //质量评分总分
- score,subtype := 0,qu.ObjToString(tmp["subtype"])
- if subtype=="预告"||subtype=="招标"||subtype=="邀标"||subtype=="询价"||
- subtype=="竞谈"||subtype=="竞价"||subtype=="单一"||subtype=="变更"||subtype=="其它"{
- score = dealWithCallBidTypeScore(tmp)
- }else if subtype=="中标"||subtype=="成交"{
- score = dealWithWinBidTypeScore(tmp)
- }else if subtype=="废标"||subtype=="流标"{
- score = dealWithFailBidTypeScore(tmp)
- }else if subtype=="合同"{
- score = dealWithContractTypeScore(tmp)
- }else {
- }
- return score
- }
- //招标类型
- func dealWithCallBidTypeScore(tmp map[string]interface{}) int {
- /*
- 预告、招标类型:
- 公告类型:预告、招标、邀标、询价、竞谈、竞价、单一、变更、其它
- 2分:项目名称、采购单位
- 1分:代理机构、预算、项目编号、省份、城市
- 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
- */
- score :=0
- //projectname buyer
- projectname := qu.ObjToString(tmp["projectname"])
- if tmp["projectname"]!=nil && projectname !="" {
- score = score+4
- }
- buyer := qu.ObjToString(tmp["buyer"])
- if tmp["buyer"]!=nil && buyer !="" {
- score = score+4
- }
- //projectcode agency area city budget
- projectcode := qu.ObjToString(tmp["projectcode"])
- if tmp["projectcode"]!=nil && projectcode !="" {
- score = score+2
- }
- agency := qu.ObjToString(tmp["agency"])
- if tmp["agency"]!=nil && agency !="" {
- score = score+2
- }
- area := qu.ObjToString(tmp["area"])
- if tmp["area"]!=nil && area !="" {
- score = score+2
- }
- city := qu.ObjToString(tmp["city"])
- if tmp["city"]!=nil && city !="" {
- score = score+2
- }
- budget := qu.Float64All(tmp["budget"])
- if tmp["budget"]!=nil && budget !=0.0 {
- score = score+2
- }
- score = score+dealWithLowScoreData(tmp)
- return score
- }
- //中标类型
- func dealWithWinBidTypeScore(tmp map[string]interface{}) int {
- /*
- 中标结果类型:
- 公告类型:中标、成交、
- 2分:项目名称、采购单位、中标单位
- 1分:代理机构、中标金额、项目编号、省份、城市、预算
- 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
- */
- score :=0
- //projectname buyer winner
- projectname := qu.ObjToString(tmp["projectname"])
- if tmp["projectname"]!=nil && projectname !="" {
- score = score+4
- }
- buyer := qu.ObjToString(tmp["buyer"])
- if tmp["buyer"]!=nil && buyer !="" {
- score = score+4
- }
- winner := qu.ObjToString(tmp["winner"])
- if tmp["winner"]!=nil && winner !="" {
- score = score+4
- }
- //projectcode agency area city budget bidamount
- projectcode := qu.ObjToString(tmp["projectcode"])
- if tmp["projectcode"]!=nil && projectcode !="" {
- score = score+2
- }
- agency := qu.ObjToString(tmp["agency"])
- if tmp["agency"]!=nil && agency !="" {
- score = score+2
- }
- area := qu.ObjToString(tmp["area"])
- if tmp["area"]!=nil && area !="" {
- score = score+2
- }
- city := qu.ObjToString(tmp["city"])
- if tmp["city"]!=nil && city !="" {
- score = score+2
- }
- budget := qu.Float64All(tmp["budget"])
- if tmp["budget"]!=nil && budget !=0.0 {
- score = score+2
- }
- bidamount := qu.Float64All(tmp["bidamount"])
- if tmp["bidamount"]!=nil && bidamount !=0.0 {
- score = score+2
- }
- score = score+dealWithLowScoreData(tmp)
- return score
- }
- func dealWithFailBidTypeScore(tmp map[string]interface{}) int {
- /*
- 流标废标类型:
- 公告类型:废标、流标
- 2分:项目名称、采购单位
- 1分:代理机构、项目编号、省份、城市、预算
- 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
- */
- score :=0
- //projectname buyer
- projectname := qu.ObjToString(tmp["projectname"])
- if tmp["projectname"]!=nil && projectname !="" {
- score = score+4
- }
- buyer := qu.ObjToString(tmp["buyer"])
- if tmp["buyer"]!=nil && buyer !="" {
- score = score+4
- }
- //projectcode agency area city budget
- projectcode := qu.ObjToString(tmp["projectcode"])
- if tmp["projectcode"]!=nil && projectcode !="" {
- score = score+2
- }
- agency := qu.ObjToString(tmp["agency"])
- if tmp["agency"]!=nil && agency !="" {
- score = score+2
- }
- area := qu.ObjToString(tmp["area"])
- if tmp["area"]!=nil && area !="" {
- score = score+2
- }
- city := qu.ObjToString(tmp["city"])
- if tmp["city"]!=nil && city !="" {
- score = score+2
- }
- budget := qu.Float64All(tmp["budget"])
- if tmp["budget"]!=nil && budget !=0.0 {
- score = score+2
- }
- score = score+dealWithLowScoreData(tmp)
- return score
- }
- func dealWithContractTypeScore(tmp map[string]interface{}) int {
- /*
- 公告类型:合同
- 2分:项目名称、采购单位、合同编号、中标单位
- 1分:代理机构、中标金额、项目编号、省份、城市、合同名称、合同签订日期、预算
- 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
- 其它类型:拟建、结果变更、违规、验收、其它
- 暂无
- */
- score :=0
- //projectname buyer winner contractnumber
- projectname := qu.ObjToString(tmp["projectname"])
- if tmp["projectname"]!=nil && projectname !="" {
- score = score+4
- }
- buyer := qu.ObjToString(tmp["buyer"])
- if tmp["buyer"]!=nil && buyer !="" {
- score = score+4
- }
- winner := qu.ObjToString(tmp["winner"])
- if tmp["winner"]!=nil && winner !="" {
- score = score+4
- }
- contractnumber := qu.ObjToString(tmp["contractnumber"])
- if tmp["contractnumber"]!=nil && contractnumber !="" {
- score = score+4
- }
- score = score+dealWithLowScoreData(tmp)
- return score
- }
- //公用低分项
- func dealWithLowScoreData(tmp map[string]interface{}) int {
- score :=0
- //buyerperson buyertel buyeraddr buyerzipcode
- //agencyperson agencytel agencyaddr
- //bidopentime bidendtime
- buyerperson := qu.ObjToString(tmp["buyerperson"])
- if tmp["buyerperson"]!=nil && buyerperson !="" {
- }
- buyertel := qu.ObjToString(tmp["buyertel"])
- if tmp["buyertel"]!=nil && buyertel !="" {
- score = score+1
- }
- buyeraddr := qu.ObjToString(tmp["buyeraddr"])
- if tmp["buyeraddr"]!=nil && buyeraddr !="" {
- score = score+1
- }
- buyerzipcode := qu.ObjToString(tmp["buyerzipcode"])
- if tmp["buyerzipcode"]!=nil && buyerzipcode !="" {
- score = score+1
- }
- agencyperson := qu.ObjToString(tmp["agencyperson"])
- if tmp["agencyperson"]!=nil && agencyperson !="" {
- score = score+1
- }
- agencytel := qu.ObjToString(tmp["agencytel"])
- if tmp["agencytel"]!=nil && agencytel !="" {
- score = score+1
- }
- agencyaddr := qu.ObjToString(tmp["agencyaddr"])
- if tmp["agencyaddr"]!=nil && agencyaddr !="" {
- score = score+1
- }
- bidopentime := qu.Int64All(tmp["bidopentime"])
- if tmp["bidopentime"]!=nil && bidopentime !=0 {
- score = score+1
- }
- bidendtime := qu.Int64All(tmp["bidendtime"])
- if tmp["bidendtime"]!=nil && bidendtime !=0 {
- score = score+1
- }
- return score
- }
|