weightValueMethod.go 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. package main
  2. import (
  3. qu "qfw/util"
  4. )
  5. func dealWithGroupScores(indexArr []int, scoreArr []int,siteArr []int) []int {
  6. //log.Println("下标组",indexArr,"质量分组",scoreArr,"整体站点组",siteArr)
  7. //处理分组
  8. sort_scoreArr,sort_indexArr := sortGroupInt(scoreArr,indexArr)
  9. //log.Println("排序质量分:",sort_scoreArr,sort_indexArr)
  10. totalIndexArr:=make([][]int,0)
  11. lastTmp := -1
  12. for k,v :=range sort_scoreArr {
  13. if v<lastTmp || k==0 {
  14. arr_s := make([]int,0)
  15. arr_i := make([]int,0)
  16. for index,value :=range scoreArr {
  17. if v==value {
  18. arr_s = append(arr_s,value)
  19. arr_i = append(arr_i,sort_indexArr[index])
  20. }
  21. }
  22. totalIndexArr = append(totalIndexArr,arr_i)
  23. lastTmp = v
  24. }
  25. }
  26. finallyIndexArr := make([]int,0)
  27. for _,v:=range totalIndexArr{
  28. if len(v)>1 {
  29. //[6 3 4]
  30. arr_s :=make([]int,0)
  31. for _,v1:=range v{
  32. arr_s = append(arr_s,siteArr[v1])
  33. }
  34. _,b:=sortGroupInt(arr_s,v)
  35. for _,v2:=range b {
  36. finallyIndexArr = append(finallyIndexArr,v2)
  37. }
  38. }else {
  39. finallyIndexArr = append(finallyIndexArr,v[0])
  40. }
  41. }
  42. return finallyIndexArr
  43. }
  44. //排序 正常排序 ,站点
  45. func sortNormalInt(arrValue []int) ([]int){
  46. for i := 0; i < len(arrValue); i++ {
  47. for j := i + 1; j < len(arrValue); j++ {
  48. if arrValue[i] < arrValue[j] {
  49. arrValue[i], arrValue[j] = arrValue[j], arrValue[i]
  50. }
  51. }
  52. }
  53. return arrValue
  54. }
  55. //排序 质量,分组
  56. func sortGroupInt(arrValue []int,arrIndex []int) ([]int ,[]int){
  57. for i := 0; i < len(arrValue); i++ {
  58. for j := i + 1; j < len(arrValue); j++ {
  59. if arrValue[i] < arrValue[j] {
  60. arrValue[i], arrValue[j] = arrValue[j], arrValue[i]
  61. arrIndex[i], arrIndex[j] = arrIndex[j], arrIndex[i]
  62. }
  63. }
  64. }
  65. return arrValue,arrIndex
  66. }
  67. //分析站点评分
  68. func analyzeTheSite(tmp map[string]interface{}) int {
  69. /*
  70. 站点评分1-N级
  71. 5、政府采购
  72. 4、公共资源
  73. 3、人民政府/政府机构/学校/医院/公司官方网站
  74. 2、社会公共招标平台/企业公共平台
  75. 1、其他
  76. 0、""
  77. */
  78. level := 0
  79. site := qu.ObjToString(tmp["site"])
  80. if site == "政府采购" {
  81. level = 5
  82. }else if site == "公共资源" {
  83. level = 4
  84. }else if site=="人民政府"||site=="政府机构"||site=="学校"||site=="医院"||site=="公司官方网站" {
  85. level = 3
  86. }else if site == "社会公共招标平台"||site == "企业公共平台" {
  87. level = 2
  88. }else if site == "其他" {
  89. level = 1
  90. }else {
  91. }
  92. return level
  93. }
  94. //分析要素评分
  95. func analyzeTheElements(tmp map[string]interface{}) int {
  96. //质量评分总分
  97. score,subtype := 0,qu.ObjToString(tmp["subtype"])
  98. if subtype=="预告"||subtype=="招标"||subtype=="邀标"||subtype=="询价"||
  99. subtype=="竞谈"||subtype=="竞价"||subtype=="单一"||subtype=="变更"||subtype=="其它"{
  100. score = dealWithCallBidTypeScore(tmp)
  101. }else if subtype=="中标"||subtype=="成交"{
  102. score = dealWithWinBidTypeScore(tmp)
  103. }else if subtype=="废标"||subtype=="流标"{
  104. score = dealWithFailBidTypeScore(tmp)
  105. }else if subtype=="合同"{
  106. score = dealWithContractTypeScore(tmp)
  107. }else {
  108. }
  109. return score
  110. }
  111. //招标类型
  112. func dealWithCallBidTypeScore(tmp map[string]interface{}) int {
  113. /*
  114. 预告、招标类型:
  115. 公告类型:预告、招标、邀标、询价、竞谈、竞价、单一、变更、其它
  116. 2分:项目名称、采购单位
  117. 1分:代理机构、预算、项目编号、省份、城市
  118. 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
  119. */
  120. score :=0
  121. //projectname buyer
  122. projectname := qu.ObjToString(tmp["projectname"])
  123. if tmp["projectname"]!=nil && projectname !="" {
  124. score = score+4
  125. }
  126. buyer := qu.ObjToString(tmp["buyer"])
  127. if tmp["buyer"]!=nil && buyer !="" {
  128. score = score+4
  129. }
  130. //projectcode agency area city budget
  131. projectcode := qu.ObjToString(tmp["projectcode"])
  132. if tmp["projectcode"]!=nil && projectcode !="" {
  133. score = score+2
  134. }
  135. agency := qu.ObjToString(tmp["agency"])
  136. if tmp["agency"]!=nil && agency !="" {
  137. score = score+2
  138. }
  139. area := qu.ObjToString(tmp["area"])
  140. if tmp["area"]!=nil && area !="" {
  141. score = score+2
  142. }
  143. city := qu.ObjToString(tmp["city"])
  144. if tmp["city"]!=nil && city !="" {
  145. score = score+2
  146. }
  147. budget := qu.Float64All(tmp["budget"])
  148. if tmp["budget"]!=nil && budget !=0.0 {
  149. score = score+2
  150. }
  151. score = score+dealWithLowScoreData(tmp)
  152. return score
  153. }
  154. //中标类型
  155. func dealWithWinBidTypeScore(tmp map[string]interface{}) int {
  156. /*
  157. 中标结果类型:
  158. 公告类型:中标、成交、
  159. 2分:项目名称、采购单位、中标单位
  160. 1分:代理机构、中标金额、项目编号、省份、城市、预算
  161. 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
  162. */
  163. score :=0
  164. //projectname buyer winner
  165. projectname := qu.ObjToString(tmp["projectname"])
  166. if tmp["projectname"]!=nil && projectname !="" {
  167. score = score+4
  168. }
  169. buyer := qu.ObjToString(tmp["buyer"])
  170. if tmp["buyer"]!=nil && buyer !="" {
  171. score = score+4
  172. }
  173. winner := qu.ObjToString(tmp["winner"])
  174. if tmp["winner"]!=nil && winner !="" {
  175. score = score+4
  176. }
  177. //projectcode agency area city budget bidamount
  178. projectcode := qu.ObjToString(tmp["projectcode"])
  179. if tmp["projectcode"]!=nil && projectcode !="" {
  180. score = score+2
  181. }
  182. agency := qu.ObjToString(tmp["agency"])
  183. if tmp["agency"]!=nil && agency !="" {
  184. score = score+2
  185. }
  186. area := qu.ObjToString(tmp["area"])
  187. if tmp["area"]!=nil && area !="" {
  188. score = score+2
  189. }
  190. city := qu.ObjToString(tmp["city"])
  191. if tmp["city"]!=nil && city !="" {
  192. score = score+2
  193. }
  194. budget := qu.Float64All(tmp["budget"])
  195. if tmp["budget"]!=nil && budget !=0.0 {
  196. score = score+2
  197. }
  198. bidamount := qu.Float64All(tmp["bidamount"])
  199. if tmp["bidamount"]!=nil && bidamount !=0.0 {
  200. score = score+2
  201. }
  202. score = score+dealWithLowScoreData(tmp)
  203. return score
  204. }
  205. func dealWithFailBidTypeScore(tmp map[string]interface{}) int {
  206. /*
  207. 流标废标类型:
  208. 公告类型:废标、流标
  209. 2分:项目名称、采购单位
  210. 1分:代理机构、项目编号、省份、城市、预算
  211. 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
  212. */
  213. score :=0
  214. //projectname buyer
  215. projectname := qu.ObjToString(tmp["projectname"])
  216. if tmp["projectname"]!=nil && projectname !="" {
  217. score = score+4
  218. }
  219. buyer := qu.ObjToString(tmp["buyer"])
  220. if tmp["buyer"]!=nil && buyer !="" {
  221. score = score+4
  222. }
  223. //projectcode agency area city budget
  224. projectcode := qu.ObjToString(tmp["projectcode"])
  225. if tmp["projectcode"]!=nil && projectcode !="" {
  226. score = score+2
  227. }
  228. agency := qu.ObjToString(tmp["agency"])
  229. if tmp["agency"]!=nil && agency !="" {
  230. score = score+2
  231. }
  232. area := qu.ObjToString(tmp["area"])
  233. if tmp["area"]!=nil && area !="" {
  234. score = score+2
  235. }
  236. city := qu.ObjToString(tmp["city"])
  237. if tmp["city"]!=nil && city !="" {
  238. score = score+2
  239. }
  240. budget := qu.Float64All(tmp["budget"])
  241. if tmp["budget"]!=nil && budget !=0.0 {
  242. score = score+2
  243. }
  244. score = score+dealWithLowScoreData(tmp)
  245. return score
  246. }
  247. func dealWithContractTypeScore(tmp map[string]interface{}) int {
  248. /*
  249. 公告类型:合同
  250. 2分:项目名称、采购单位、合同编号、中标单位
  251. 1分:代理机构、中标金额、项目编号、省份、城市、合同名称、合同签订日期、预算
  252. 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
  253. 其它类型:拟建、结果变更、违规、验收、其它
  254. 暂无
  255. */
  256. score :=0
  257. //projectname buyer winner contractnumber
  258. projectname := qu.ObjToString(tmp["projectname"])
  259. if tmp["projectname"]!=nil && projectname !="" {
  260. score = score+4
  261. }
  262. buyer := qu.ObjToString(tmp["buyer"])
  263. if tmp["buyer"]!=nil && buyer !="" {
  264. score = score+4
  265. }
  266. winner := qu.ObjToString(tmp["winner"])
  267. if tmp["winner"]!=nil && winner !="" {
  268. score = score+4
  269. }
  270. contractnumber := qu.ObjToString(tmp["contractnumber"])
  271. if tmp["contractnumber"]!=nil && contractnumber !="" {
  272. score = score+4
  273. }
  274. score = score+dealWithLowScoreData(tmp)
  275. return score
  276. }
  277. //公用低分项
  278. func dealWithLowScoreData(tmp map[string]interface{}) int {
  279. score :=0
  280. //buyerperson buyertel buyeraddr buyerzipcode
  281. //agencyperson agencytel agencyaddr
  282. //bidopentime bidendtime
  283. buyerperson := qu.ObjToString(tmp["buyerperson"])
  284. if tmp["buyerperson"]!=nil && buyerperson !="" {
  285. }
  286. buyertel := qu.ObjToString(tmp["buyertel"])
  287. if tmp["buyertel"]!=nil && buyertel !="" {
  288. score = score+1
  289. }
  290. buyeraddr := qu.ObjToString(tmp["buyeraddr"])
  291. if tmp["buyeraddr"]!=nil && buyeraddr !="" {
  292. score = score+1
  293. }
  294. buyerzipcode := qu.ObjToString(tmp["buyerzipcode"])
  295. if tmp["buyerzipcode"]!=nil && buyerzipcode !="" {
  296. score = score+1
  297. }
  298. agencyperson := qu.ObjToString(tmp["agencyperson"])
  299. if tmp["agencyperson"]!=nil && agencyperson !="" {
  300. score = score+1
  301. }
  302. agencytel := qu.ObjToString(tmp["agencytel"])
  303. if tmp["agencytel"]!=nil && agencytel !="" {
  304. score = score+1
  305. }
  306. agencyaddr := qu.ObjToString(tmp["agencyaddr"])
  307. if tmp["agencyaddr"]!=nil && agencyaddr !="" {
  308. score = score+1
  309. }
  310. bidopentime := qu.Int64All(tmp["bidopentime"])
  311. if tmp["bidopentime"]!=nil && bidopentime !=0 {
  312. score = score+1
  313. }
  314. bidendtime := qu.Int64All(tmp["bidendtime"])
  315. if tmp["bidendtime"]!=nil && bidendtime !=0 {
  316. score = score+1
  317. }
  318. return score
  319. }