weightValueMethod.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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. siteType :=siteJsonData[site]
  81. if siteType == "政府采购" {
  82. level = 5
  83. }else if siteType == "公共资源" {
  84. level = 4
  85. }else if siteType=="人民政府"||siteType=="政府机构"||siteType=="学校"||siteType=="医院"||siteType=="公司官方网站" {
  86. level = 3
  87. }else if siteType == "社会公共招标平台"||siteType == "企业公共平台" {
  88. level = 2
  89. }else if siteType == "其他" {
  90. level = 1
  91. }else {
  92. }
  93. return level
  94. }
  95. //分析要素评分
  96. func analyzeTheElements(tmp map[string]interface{}) int {
  97. //质量评分总分
  98. score,subtype := 0,qu.ObjToString(tmp["subtype"])
  99. if subtype=="预告"||subtype=="招标"||subtype=="邀标"||subtype=="询价"||
  100. subtype=="竞谈"||subtype=="竞价"||subtype=="单一"||subtype=="变更"||subtype=="其它"{
  101. score = dealWithCallBidTypeScore(tmp)
  102. }else if subtype=="中标"||subtype=="成交"{
  103. score = dealWithWinBidTypeScore(tmp)
  104. }else if subtype=="废标"||subtype=="流标"{
  105. score = dealWithFailBidTypeScore(tmp)
  106. }else if subtype=="合同"{
  107. score = dealWithContractTypeScore(tmp)
  108. }else {
  109. }
  110. return score
  111. }
  112. //招标类型
  113. func dealWithCallBidTypeScore(tmp map[string]interface{}) int {
  114. /*
  115. 预告、招标类型:
  116. 公告类型:预告、招标、邀标、询价、竞谈、竞价、单一、变更、其它
  117. 2分:项目名称、采购单位
  118. 1分:代理机构、预算、项目编号、省份、城市
  119. 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
  120. */
  121. score :=0
  122. //projectname buyer
  123. projectname := qu.ObjToString(tmp["projectname"])
  124. if tmp["projectname"]!=nil && projectname !="" {
  125. score = score+4
  126. }
  127. buyer := qu.ObjToString(tmp["buyer"])
  128. if tmp["buyer"]!=nil && buyer !="" {
  129. score = score+4
  130. }
  131. //projectcode agency area city budget
  132. projectcode := qu.ObjToString(tmp["projectcode"])
  133. if tmp["projectcode"]!=nil && projectcode !="" {
  134. score = score+2
  135. }
  136. agency := qu.ObjToString(tmp["agency"])
  137. if tmp["agency"]!=nil && agency !="" {
  138. score = score+2
  139. }
  140. area := qu.ObjToString(tmp["area"])
  141. if tmp["area"]!=nil && area !="" {
  142. score = score+2
  143. }
  144. city := qu.ObjToString(tmp["city"])
  145. if tmp["city"]!=nil && city !="" {
  146. score = score+2
  147. }
  148. budget := qu.Float64All(tmp["budget"])
  149. if tmp["budget"]!=nil && budget !=0.0 {
  150. score = score+2
  151. }
  152. score = score+dealWithLowScoreData(tmp)
  153. return score
  154. }
  155. //中标类型
  156. func dealWithWinBidTypeScore(tmp map[string]interface{}) int {
  157. /*
  158. 中标结果类型:
  159. 公告类型:中标、成交、
  160. 2分:项目名称、采购单位、中标单位
  161. 1分:代理机构、中标金额、项目编号、省份、城市、预算
  162. 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
  163. */
  164. score :=0
  165. //projectname buyer winner
  166. projectname := qu.ObjToString(tmp["projectname"])
  167. if tmp["projectname"]!=nil && projectname !="" {
  168. score = score+4
  169. }
  170. buyer := qu.ObjToString(tmp["buyer"])
  171. if tmp["buyer"]!=nil && buyer !="" {
  172. score = score+4
  173. }
  174. winner := qu.ObjToString(tmp["winner"])
  175. if tmp["winner"]!=nil && winner !="" {
  176. score = score+4
  177. }
  178. //projectcode agency area city budget bidamount
  179. projectcode := qu.ObjToString(tmp["projectcode"])
  180. if tmp["projectcode"]!=nil && projectcode !="" {
  181. score = score+2
  182. }
  183. agency := qu.ObjToString(tmp["agency"])
  184. if tmp["agency"]!=nil && agency !="" {
  185. score = score+2
  186. }
  187. area := qu.ObjToString(tmp["area"])
  188. if tmp["area"]!=nil && area !="" {
  189. score = score+2
  190. }
  191. city := qu.ObjToString(tmp["city"])
  192. if tmp["city"]!=nil && city !="" {
  193. score = score+2
  194. }
  195. budget := qu.Float64All(tmp["budget"])
  196. if tmp["budget"]!=nil && budget !=0.0 {
  197. score = score+2
  198. }
  199. bidamount := qu.Float64All(tmp["bidamount"])
  200. if tmp["bidamount"]!=nil && bidamount !=0.0 {
  201. score = score+2
  202. }
  203. score = score+dealWithLowScoreData(tmp)
  204. return score
  205. }
  206. func dealWithFailBidTypeScore(tmp map[string]interface{}) int {
  207. /*
  208. 流标废标类型:
  209. 公告类型:废标、流标
  210. 2分:项目名称、采购单位
  211. 1分:代理机构、项目编号、省份、城市、预算
  212. 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
  213. */
  214. score :=0
  215. //projectname buyer
  216. projectname := qu.ObjToString(tmp["projectname"])
  217. if tmp["projectname"]!=nil && projectname !="" {
  218. score = score+4
  219. }
  220. buyer := qu.ObjToString(tmp["buyer"])
  221. if tmp["buyer"]!=nil && buyer !="" {
  222. score = score+4
  223. }
  224. //projectcode agency area city budget
  225. projectcode := qu.ObjToString(tmp["projectcode"])
  226. if tmp["projectcode"]!=nil && projectcode !="" {
  227. score = score+2
  228. }
  229. agency := qu.ObjToString(tmp["agency"])
  230. if tmp["agency"]!=nil && agency !="" {
  231. score = score+2
  232. }
  233. area := qu.ObjToString(tmp["area"])
  234. if tmp["area"]!=nil && area !="" {
  235. score = score+2
  236. }
  237. city := qu.ObjToString(tmp["city"])
  238. if tmp["city"]!=nil && city !="" {
  239. score = score+2
  240. }
  241. budget := qu.Float64All(tmp["budget"])
  242. if tmp["budget"]!=nil && budget !=0.0 {
  243. score = score+2
  244. }
  245. score = score+dealWithLowScoreData(tmp)
  246. return score
  247. }
  248. func dealWithContractTypeScore(tmp map[string]interface{}) int {
  249. /*
  250. 公告类型:合同
  251. 2分:项目名称、采购单位、合同编号、中标单位
  252. 1分:代理机构、中标金额、项目编号、省份、城市、合同名称、合同签订日期、预算
  253. 0.5分:采购单位联系人、采购单位电话、采购单位地址、采购单位邮编、招标代理机构联系人、招标代理机构联系方式、招标代理机构地址、投标截止日期、开标日期
  254. 其它类型:拟建、结果变更、违规、验收、其它
  255. 暂无
  256. */
  257. score :=0
  258. //projectname buyer winner contractnumber
  259. projectname := qu.ObjToString(tmp["projectname"])
  260. if tmp["projectname"]!=nil && projectname !="" {
  261. score = score+4
  262. }
  263. buyer := qu.ObjToString(tmp["buyer"])
  264. if tmp["buyer"]!=nil && buyer !="" {
  265. score = score+4
  266. }
  267. winner := qu.ObjToString(tmp["winner"])
  268. if tmp["winner"]!=nil && winner !="" {
  269. score = score+4
  270. }
  271. contractnumber := qu.ObjToString(tmp["contractnumber"])
  272. if tmp["contractnumber"]!=nil && contractnumber !="" {
  273. score = score+4
  274. }
  275. //projectcode agency area city contractname bidamount budget signaturedate
  276. projectcode := qu.ObjToString(tmp["projectcode"])
  277. if tmp["projectcode"]!=nil && projectcode !="" {
  278. score = score+2
  279. }
  280. agency := qu.ObjToString(tmp["agency"])
  281. if tmp["agency"]!=nil && agency !="" {
  282. score = score+2
  283. }
  284. area := qu.ObjToString(tmp["area"])
  285. if tmp["area"]!=nil && area !="" {
  286. score = score+2
  287. }
  288. city := qu.ObjToString(tmp["city"])
  289. if tmp["city"]!=nil && city !="" {
  290. score = score+2
  291. }
  292. contractname := qu.ObjToString(tmp["contractname"])
  293. if tmp["contractname"]!=nil && contractname !="" {
  294. score = score+2
  295. }
  296. budget := qu.Float64All(tmp["budget"])
  297. if tmp["budget"]!=nil && budget !=0.0 {
  298. score = score+2
  299. }
  300. bidamount := qu.Float64All(tmp["bidamount"])
  301. if tmp["bidamount"]!=nil && bidamount !=0.0 {
  302. score = score+2
  303. }
  304. signaturedate := qu.Int64All(tmp["signaturedate"])
  305. if tmp["signaturedate"]!=nil && signaturedate !=0 {
  306. score = score+2
  307. }
  308. score = score+dealWithLowScoreData(tmp)
  309. return score
  310. }
  311. //公用低分项
  312. func dealWithLowScoreData(tmp map[string]interface{}) int {
  313. score :=0
  314. //buyerperson buyertel buyeraddr buyerzipcode
  315. //agencyperson agencytel agencyaddr
  316. //bidopentime bidendtime
  317. buyerperson := qu.ObjToString(tmp["buyerperson"])
  318. if tmp["buyerperson"]!=nil && buyerperson !="" {
  319. }
  320. buyertel := qu.ObjToString(tmp["buyertel"])
  321. if tmp["buyertel"]!=nil && buyertel !="" {
  322. score = score+1
  323. }
  324. buyeraddr := qu.ObjToString(tmp["buyeraddr"])
  325. if tmp["buyeraddr"]!=nil && buyeraddr !="" {
  326. score = score+1
  327. }
  328. buyerzipcode := qu.ObjToString(tmp["buyerzipcode"])
  329. if tmp["buyerzipcode"]!=nil && buyerzipcode !="" {
  330. score = score+1
  331. }
  332. agencyperson := qu.ObjToString(tmp["agencyperson"])
  333. if tmp["agencyperson"]!=nil && agencyperson !="" {
  334. score = score+1
  335. }
  336. agencytel := qu.ObjToString(tmp["agencytel"])
  337. if tmp["agencytel"]!=nil && agencytel !="" {
  338. score = score+1
  339. }
  340. agencyaddr := qu.ObjToString(tmp["agencyaddr"])
  341. if tmp["agencyaddr"]!=nil && agencyaddr !="" {
  342. score = score+1
  343. }
  344. bidopentime := qu.Int64All(tmp["bidopentime"])
  345. if tmp["bidopentime"]!=nil && bidopentime !=0 {
  346. score = score+1
  347. }
  348. bidendtime := qu.Int64All(tmp["bidendtime"])
  349. if tmp["bidendtime"]!=nil && bidendtime !=0 {
  350. score = score+1
  351. }
  352. return score
  353. }