bidding.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. package main
  2. import (
  3. "data_tidb/config"
  4. "fmt"
  5. "reflect"
  6. "regexp"
  7. "sort"
  8. "strconv"
  9. "strings"
  10. "sync"
  11. "time"
  12. "github.com/shopspring/decimal"
  13. util "jygit.jydev.jianyu360.cn/data_processing/common_utils"
  14. "jygit.jydev.jianyu360.cn/data_processing/common_utils/log"
  15. "jygit.jydev.jianyu360.cn/data_processing/common_utils/mongodb"
  16. )
  17. var (
  18. regLetter = regexp.MustCompile("[a-z]*")
  19. )
  20. func doBiddingTask(gtid, lteid string, mapInfo map[string]interface{}) {
  21. sess := MongoB.GetMgoConn()
  22. defer MongoB.DestoryMongoConn(sess)
  23. ch := make(chan bool, 10)
  24. wg := &sync.WaitGroup{}
  25. stype := util.ObjToString(mapInfo["stype"])
  26. q := map[string]interface{}{"_id": map[string]interface{}{"$gt": mongodb.StringTOBsonId(gtid),
  27. "$lte": mongodb.StringTOBsonId(lteid)}}
  28. query := sess.DB(config.Conf.DB.MongoB.Dbname).C("bidding").Find(q).Sort("_id").Iter()
  29. count := 0
  30. for tmp := make(map[string]interface{}); query.Next(tmp); count++ {
  31. if count%1000 == 0 {
  32. log.Info(fmt.Sprintf("current --- %d", count))
  33. }
  34. ch <- true
  35. wg.Add(1)
  36. go func(tmp map[string]interface{}) {
  37. defer func() {
  38. <-ch
  39. wg.Done()
  40. }()
  41. if util.IntAll(tmp["dataprocess"]) != 8 {
  42. return
  43. }
  44. if stype == "bidding_history" && tmp["history_updatetime"] == nil {
  45. return
  46. }
  47. taskBase(tmp)
  48. taskTags(tmp)
  49. taskExpand(tmp)
  50. taskAtts(tmp)
  51. taskInfoformat(tmp)
  52. taskIntent(tmp)
  53. taskWinner(tmp)
  54. taskPackage(tmp)
  55. taskPur(tmp)
  56. }(tmp)
  57. tmp = make(map[string]interface{})
  58. }
  59. wg.Wait()
  60. log.Info(fmt.Sprintf("over --- %d", count))
  61. }
  62. func Tbase(tmp map[string]interface{}) {
  63. taskBase(tmp)
  64. }
  65. func taskB() {
  66. sess := MongoB.GetMgoConn()
  67. defer MongoB.DestoryMongoConn(sess)
  68. ch := make(chan bool, 10)
  69. wg := &sync.WaitGroup{}
  70. //q := map[string]interface{}{"_id": mongodb.StringTOBsonId("634eac71911e1eb345b2d861")}
  71. q := map[string]interface{}{"_id": map[string]interface{}{"$gt": mongodb.StringTOBsonId("632d42d667a6b0a2861eef92")}}
  72. query := sess.DB(config.Conf.DB.MongoB.Dbname).C("bidding").Find(q).Sort("_id").Iter()
  73. count := 0
  74. for tmp := make(map[string]interface{}); query.Next(tmp); count++ {
  75. if count%20000 == 0 {
  76. log.Info(fmt.Sprintf("current --- %d", count))
  77. }
  78. ch <- true
  79. wg.Add(1)
  80. go func(tmp map[string]interface{}) {
  81. defer func() {
  82. <-ch
  83. wg.Done()
  84. }()
  85. if util.IntAll(tmp["extracttype"]) != -1 {
  86. taskBase(tmp)
  87. taskTags(tmp)
  88. taskExpand(tmp)
  89. taskAtts(tmp)
  90. taskInfoformat(tmp)
  91. taskIntent(tmp)
  92. taskWinner(tmp)
  93. //taskPackage(tmp)
  94. taskPur(tmp)
  95. }
  96. }(tmp)
  97. tmp = make(map[string]interface{})
  98. }
  99. wg.Wait()
  100. log.Info(fmt.Sprintf("over --- %d", count))
  101. }
  102. // @Description 基本信息
  103. // @Author J 2022/9/22 11:12
  104. func taskBase(tmp map[string]interface{}) {
  105. saveM := make(map[string]interface{})
  106. var errf []string // 异常字段
  107. for _, f := range BaseField {
  108. if f == "infoid" {
  109. saveM[f] = mongodb.BsonIdToSId(tmp["_id"])
  110. } else if f == "area_code" {
  111. if tmp["area"] != nil {
  112. saveM[f] = AreaCode[util.ObjToString(tmp["area"])]
  113. }
  114. } else if f == "city_code" {
  115. if tmp["area"] != nil && tmp["city"] != nil {
  116. c := util.ObjToString(tmp["area"]) + "," + util.ObjToString(tmp["city"])
  117. saveM[f] = AreaCode[c]
  118. }
  119. } else if f == "district_code" {
  120. if tmp["area"] != nil && tmp["city"] != nil && tmp["district"] != nil {
  121. c := util.ObjToString(tmp["area"]) + "," + util.ObjToString(tmp["city"]) + "," + util.ObjToString(tmp["district"])
  122. saveM[f] = AreaCode[c]
  123. }
  124. } else if f == "toptype_code" {
  125. if obj := util.ObjToString(tmp["toptype"]); obj != "" {
  126. saveM[f] = TopTypeCode[obj]
  127. }
  128. } else if f == "subtype_code" {
  129. if obj := util.ObjToString(tmp["subtype"]); obj != "" {
  130. saveM[f] = SubTypeCode[obj]
  131. }
  132. } else if f == "buyerclass_code" {
  133. if obj := util.ObjToString(tmp["buyerclass"]); obj != "" {
  134. saveM[f] = BuyerCode[obj]
  135. }
  136. } else if f == "createtime" || f == "updatetime" {
  137. saveM[f] = time.Now().Format(util.Date_Full_Layout)
  138. } else if f == "comeintime" || f == "publishtime" || f == "bidopentime" {
  139. if tmp[f] != nil && util.IntAll(tmp[f]) > 0 {
  140. t := util.Int64All(tmp[f])
  141. saveM[f] = util.FormatDateByInt64(&t, util.Date_Full_Layout)
  142. }
  143. } else if f == "multipackage" || f == "isValidFile" {
  144. if tmp[f] == nil {
  145. saveM[f] = 0
  146. } else {
  147. saveM[f] = tmp[f]
  148. }
  149. } else if f == "buyer_id" {
  150. if b := util.ObjToString(tmp["buyer"]); b != "" {
  151. saveM["buyer"] = b
  152. //if code := redis.GetStr("qyxy_id", b); code != "" {
  153. if code := getNameId(b); code != "" {
  154. saveM[f] = code
  155. }
  156. }
  157. } else if f == "agency_id" {
  158. if b := util.ObjToString(tmp["agency"]); b != "" {
  159. saveM["agency"] = b
  160. //if code := redis.GetStr("qyxy_id", b); code != "" {
  161. if code := getNameId(b); code != "" {
  162. saveM[f] = code
  163. }
  164. } else {
  165. if tmp[f] != nil {
  166. saveM[f] = tmp[f]
  167. }
  168. }
  169. } else if f == "tag_topinformation" {
  170. if tmp["tag_topinformation"] != nil {
  171. tag, _ := tmp["tag_topinformation"].([]interface{})
  172. tag_topinformation_arr := util.ObjArrToStringArr(tag)
  173. tag_topinformation := ""
  174. for k, v := range tag_topinformation_arr {
  175. tag_topinformation += v
  176. if k != len(tag_topinformation_arr)-1 {
  177. tag_topinformation += ","
  178. }
  179. }
  180. saveM["tag_topinformation"] = tag_topinformation
  181. } else {
  182. saveM[f] = nil
  183. }
  184. } else {
  185. if tmp[f] != nil {
  186. if BaseVMap[f] != nil {
  187. var b bool
  188. saveM[f], b = verifyF(f, tmp[f], BaseVMap[f])
  189. // 保存异常字段数据
  190. if b {
  191. errf = append(errf, f)
  192. }
  193. } else {
  194. saveM[f] = tmp[f]
  195. }
  196. }
  197. }
  198. }
  199. // fmt.Println(saveM)
  200. saveBasePool <- saveM
  201. if len(errf) > 0 {
  202. saveErrPool <- map[string]interface{}{"infoid": mongodb.BsonIdToSId(tmp["_id"]), "f": strings.Join(errf, ",")}
  203. }
  204. }
  205. func getNameId(name string) string {
  206. info := MysqlTool.FindOne("dws_f_ent_baseinfo", map[string]interface{}{"name": name}, "name_id", "")
  207. if info != nil && (*info)["name_Id"] != nil {
  208. return util.ObjToString((*info)["name_Id"])
  209. } else {
  210. return ""
  211. }
  212. }
  213. // @Description 扩展信息
  214. // @Author J 2022/9/22 11:13
  215. func taskExpand(tmp map[string]interface{}) {
  216. saveM := make(map[string]interface{})
  217. var errf []string // 异常字段
  218. for _, f := range ExpandField {
  219. if f == "infoid" {
  220. saveM[f] = mongodb.BsonIdToSId(tmp["_id"])
  221. } else if f == "project_startdate" || f == "project_completedate" || f == "signstarttime" || f == "bidendtime" || f == "bidstarttime" || f == "docstarttime" ||
  222. f == "docendtime" || f == "signaturedate" || f == "signendtime" {
  223. if tmp[f] != nil && util.IntAll(tmp[f]) > 0 {
  224. t := util.Int64All(tmp[f])
  225. saveM[f] = util.FormatDateByInt64(&t, util.Date_Full_Layout)
  226. }
  227. } else if f == "createtime" || f == "updatetime" {
  228. saveM[f] = time.Now().Format(util.Date_Full_Layout)
  229. } else if f == "bidway" {
  230. if util.ObjToString(tmp[f]) == "电子投标" {
  231. saveM[f] = 1
  232. } else if util.ObjToString(tmp[f]) == "纸质投标" {
  233. saveM[f] = 0
  234. }
  235. } else if f == "review_experts" {
  236. if tmp[f] != nil {
  237. if reflect.TypeOf(tmp[f]).String() == "string" {
  238. saveM[f] = tmp[f]
  239. } else if reflect.TypeOf(tmp[f]).String() == "[]interface {}" {
  240. if arr, ok := tmp[f].([]interface{}); ok {
  241. saveM[f] = strings.Join(util.ObjArrToStringArr(arr), ",")
  242. }
  243. }
  244. }
  245. } else if f == "bid_guarantee" || f == "contract_guarantee" {
  246. if tmp[f] != nil {
  247. if tmp[f].(bool) {
  248. saveM[f] = 1
  249. } else {
  250. saveM[f] = 0
  251. }
  252. }
  253. } else if f == "supervisorrate" || f == "agencyfee" {
  254. if tmp[f] != nil {
  255. if reflect.TypeOf(tmp[f]).String() == "string" {
  256. v2, err := strconv.ParseFloat(strings.ReplaceAll(util.ObjToString(tmp[f]), "%", ""), 64)
  257. if err != nil {
  258. v, _ := decimal.NewFromFloat(v2).Div(decimal.NewFromFloat(float64(100))).Float64()
  259. saveM[f] = v
  260. }
  261. } else {
  262. saveM[f], _ = util.FormatFloat(util.Float64All(tmp[f]), 4)
  263. }
  264. }
  265. } else if f == "project_duration" {
  266. if tmp[f] != nil {
  267. tmp[f] = util.IntAll(tmp[f])
  268. }
  269. } else {
  270. if tmp[f] != nil {
  271. if ExpandVMap[f] != nil {
  272. var b bool
  273. saveM[f], b = verifyF(f, tmp[f], ExpandVMap[f])
  274. // 保存异常字段数据
  275. if b {
  276. errf = append(errf, f)
  277. }
  278. } else {
  279. saveM[f] = tmp[f]
  280. }
  281. }
  282. }
  283. }
  284. saveExpandPool <- saveM
  285. if len(errf) > 0 {
  286. saveErrPool <- map[string]interface{}{"infoid": mongodb.BsonIdToSId(tmp["_id"]), "f": strings.Join(errf, ",")}
  287. }
  288. }
  289. // @Description 标签记录
  290. // @Author J 2022/9/22 11:13
  291. func taskTags(tmp map[string]interface{}) {
  292. id := mongodb.BsonIdToSId(tmp["_id"])
  293. if topArr, ok := tmp["topscopeclass"].([]interface{}); ok {
  294. for _, i2 := range topArr {
  295. tclass := regLetter.ReplaceAllString(util.ObjToString(i2), "") // 去除字母
  296. code := TopScopeCode[tclass]
  297. saveTagPool <- map[string]interface{}{"infoid": id, "labelcode": "1", "labelvalues": code, "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)}
  298. //MysqlTool.Insert("bid_tags", map[string]interface{}{"infoid": id, "labelcode": "1", "labelvalues": code, "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)})
  299. }
  300. }
  301. if subArr, ok := tmp["subscopeclass"].([]interface{}); ok {
  302. for _, i2 := range subArr {
  303. sc := strings.Split(util.ObjToString(i2), "_")
  304. if len(sc) > 1 {
  305. code := SubScopeCode[sc[1]]
  306. saveTagPool <- map[string]interface{}{"infoid": id, "labelcode": "2", "labelvalues": code, "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)}
  307. }
  308. //MysqlTool.Insert("bid_tags", map[string]interface{}{"infoid": id, "labelcode": "2", "labelvalues": code, "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)})
  309. }
  310. }
  311. if tArr, ok := tmp["certificate_class"].([]interface{}); ok {
  312. for _, i2 := range tArr {
  313. if util.ObjToString(i2) == "ISO" {
  314. saveTagPool <- map[string]interface{}{"infoid": id, "labelcode": "3", "labelvalues": "01", "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)}
  315. //MysqlTool.Insert("bid_tags", map[string]interface{}{"infoid": id, "labelcode": "3", "labelvalues": "01", "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)})
  316. } else if util.ObjToString(i2) == "AAA" {
  317. saveTagPool <- map[string]interface{}{"infoid": id, "labelcode": "3", "labelvalues": "02", "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)}
  318. //MysqlTool.Insert("bid_tags", map[string]interface{}{"infoid": id, "labelcode": "3", "labelvalues": "02", "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)})
  319. } else if util.ObjToString(i2) == "ISO,AAA" {
  320. saveTagPool <- map[string]interface{}{"infoid": id, "labelcode": "3", "labelvalues": "03", "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)}
  321. //MysqlTool.Insert("bid_tags", map[string]interface{}{"infoid": id, "labelcode": "3", "labelvalues": "03", "labelweight": 1, "createtime": time.Now().Format(util.Date_Full_Layout)})
  322. }
  323. }
  324. }
  325. }
  326. // @Description 附件
  327. // @Author J 2022/9/22 11:13
  328. func taskAtts(tmp map[string]interface{}) {
  329. id := mongodb.BsonIdToSId(tmp["_id"])
  330. if tmp["projectinfo"] != nil {
  331. if pinfo, o := tmp["projectinfo"].(map[string]interface{}); o {
  332. if attsMap, ok := pinfo["attachments"].(map[string]interface{}); ok {
  333. for _, attr := range attsMap {
  334. if at, ok := attr.(map[string]interface{}); ok {
  335. if util.ObjToString(at["fid"]) != "" {
  336. ftype := ""
  337. for _, s := range FileTypeArr {
  338. ft := strings.ToLower(util.ObjToString(tmp["ftype"]))
  339. if strings.Contains(ft, s) {
  340. ftype = s
  341. break
  342. }
  343. }
  344. saveAttrPool <- map[string]interface{}{"infoid": id, "org_url": at["org_url"], "size": at["size"], "fid": at["fid"],
  345. "filename": at["filename"], "ftype": ftype, "file_type": 0, "createtime": time.Now().Format(util.Date_Full_Layout)}
  346. }
  347. }
  348. }
  349. }
  350. }
  351. }
  352. if attachTxt, o := tmp["attach_text"].(map[string]interface{}); o {
  353. if len(attachTxt) > 0 {
  354. for _, at := range attachTxt {
  355. at1 := at.(map[string]interface{})
  356. if len(at1) > 0 {
  357. for k, v := range at1 {
  358. if reflect.TypeOf(v).String() == "string" {
  359. if util.ObjToString(at1["attach_url"]) != "" {
  360. saveAttrPool <- map[string]interface{}{"infoid": id, "fid": at1["attach_url"], "filename": at1["file_name"], "file_type": 1, "createtime": time.Now().Format(util.Date_Full_Layout)}
  361. }
  362. break
  363. } else {
  364. if at2, ok := at1[k].(map[string]interface{}); ok {
  365. if util.ObjToString(at2["attach_url"]) != "" {
  366. saveAttrPool <- map[string]interface{}{"infoid": id, "fid": at2["attach_url"], "filename": at2["file_name"], "file_type": 1, "createtime": time.Now().Format(util.Date_Full_Layout)}
  367. }
  368. }
  369. }
  370. }
  371. }
  372. }
  373. }
  374. }
  375. }
  376. // @Description 拟建
  377. // @Author J 2022/9/22 15:56
  378. func taskInfoformat(tmp map[string]interface{}) {
  379. if util.IntAll(tmp["infoformat"]) != 2 && tmp["projectinfo"] != nil {
  380. return
  381. }
  382. if info, ok := tmp["projectinfo"].(map[string]interface{}); ok {
  383. delete(info, "attachments")
  384. if len(info) > 0 {
  385. saveM := make(map[string]interface{})
  386. for _, f := range IfmField {
  387. if f == "infoid" {
  388. saveM[f] = mongodb.BsonIdToSId(tmp["_id"])
  389. } else if f == "createtime" || f == "updatetime" {
  390. saveM[f] = time.Now().Format(util.Date_Full_Layout)
  391. } else if f == "approvetime" {
  392. if info[f] != nil && util.IntAll(tmp[f]) > 0 {
  393. saveM[f] = info[f]
  394. }
  395. } else {
  396. if info[f] != nil {
  397. saveM[f] = info[f]
  398. }
  399. }
  400. }
  401. saveIfmPool <- saveM
  402. }
  403. }
  404. }
  405. // @Description 采购意向
  406. // @Author J 2022/9/22 16:27
  407. func taskIntent(tmp map[string]interface{}) {
  408. if arr, ok := tmp["procurementlist"].([]interface{}); ok {
  409. for _, p := range arr {
  410. p1 := p.(map[string]interface{})
  411. saveM := make(map[string]interface{})
  412. for _, f := range IntentField {
  413. if f == "infoid" {
  414. saveM[f] = mongodb.BsonIdToSId(tmp["_id"])
  415. } else if f == "createtime" || f == "updatetime" {
  416. saveM[f] = time.Now().Format(util.Date_Full_Layout)
  417. } else if f == "buyer_id" {
  418. if b := util.ObjToString(tmp["buyer"]); b != "" {
  419. //if code := redis.GetStr("qyxy_id", b); code != "" {
  420. // saveM[f] = code
  421. //}
  422. if code := getNameId(b); code != "" {
  423. saveM[f] = code
  424. }
  425. }
  426. } else {
  427. if p1[f] != nil {
  428. saveM[f] = p1[f]
  429. }
  430. }
  431. }
  432. saveIntentPool <- saveM
  433. }
  434. }
  435. }
  436. // @Description 中标单位
  437. // @Author J 2022/9/27 10:58
  438. func taskWinner(tmp map[string]interface{}) {
  439. if wod, ok := tmp["winnerorder"].([]interface{}); ok {
  440. for _, w := range wod {
  441. w1 := w.(map[string]interface{})
  442. if w1["sort"] != nil {
  443. saveM := make(map[string]interface{})
  444. for _, f := range WinnerField {
  445. if f == "infoid" {
  446. saveM[f] = mongodb.BsonIdToSId(tmp["_id"])
  447. } else if f == "createtime" || f == "updatetime" {
  448. saveM[f] = time.Now().Format(util.Date_Full_Layout)
  449. } else if f == "winnersort" {
  450. saveM[f] = util.IntAll(w1["sort"])
  451. } else if f == "winner_id" {
  452. if b := util.ObjToString(w1["entname"]); b != "" {
  453. saveM["winner"] = b
  454. //if code := redis.GetStr("qyxy_id", b); code != "" {
  455. // saveM[f] = code
  456. //}
  457. if code := getNameId(b); code != "" {
  458. saveM[f] = code
  459. }
  460. }
  461. } else if f == "package_id" {
  462. }
  463. }
  464. saveWinnerPool <- saveM
  465. }
  466. }
  467. }
  468. warr := strings.Split(util.ObjToString(tmp["s_winner"]), ",")
  469. if BinarySearch(warr, util.ObjToString(tmp["winner"])) == -1 {
  470. warr = append(warr, util.ObjToString(tmp["winner"]))
  471. }
  472. for _, s := range warr {
  473. saveM := make(map[string]interface{})
  474. for _, f := range WinnerField {
  475. if f == "infoid" {
  476. saveM[f] = mongodb.BsonIdToSId(tmp["_id"])
  477. } else if f == "createtime" || f == "updatetime" {
  478. saveM[f] = time.Now().Format(util.Date_Full_Layout)
  479. } else if f == "winnersort" {
  480. saveM[f] = 0
  481. } else if f == "winner_id" {
  482. if s != "" {
  483. saveM["winner"] = s
  484. //if code := redis.GetStr("qyxy_id", s); code != "" {
  485. // saveM[f] = code
  486. //}
  487. if code := getNameId(s); code != "" {
  488. saveM[f] = code
  489. }
  490. }
  491. }
  492. }
  493. saveWinnerPool <- saveM
  494. }
  495. }
  496. func BinarySearch(s []string, k string) int {
  497. sort.Strings(s)
  498. lo, hi := 0, len(s)-1
  499. for lo <= hi {
  500. m := (lo + hi) >> 1
  501. if s[m] < k {
  502. lo = m + 1
  503. } else if s[m] > k {
  504. hi = m - 1
  505. } else {
  506. return m
  507. }
  508. }
  509. return -1
  510. }
  511. func taskPackage(tmp map[string]interface{}) {
  512. }
  513. // @Description 标的物
  514. // @Author J 2022/9/29 16:48
  515. func taskPur(tmp map[string]interface{}) {
  516. if plist, ok := tmp["purchasinglist"].([]interface{}); ok {
  517. for _, p := range plist {
  518. saveM := make(map[string]interface{})
  519. p1 := p.(map[string]interface{})
  520. for _, f := range PurField {
  521. if f == "infoid" {
  522. saveM[f] = mongodb.BsonIdToSId(tmp["_id"])
  523. } else if f == "unitprice" || f == "totalprice" {
  524. if p1[f] != nil {
  525. if reflect.TypeOf(p1[f]).String() == "string" {
  526. } else {
  527. if util.Float64All(p1[f]) <= 10000000000 {
  528. saveM[f], _ = util.FormatFloat(util.Float64All(p1[f]), 4)
  529. }
  530. }
  531. }
  532. } else {
  533. if p1[f] != nil {
  534. if reflect.TypeOf(p1[f]).String() == "string" {
  535. if f == "item" || f == "itemname" || f == "brandname" {
  536. if len(util.ObjToString(p1[f])) <= 500 {
  537. saveM[f] = p1[f]
  538. }
  539. } else {
  540. saveM[f] = p1[f]
  541. }
  542. } else {
  543. saveM[f] = p1[f]
  544. }
  545. }
  546. }
  547. }
  548. savePurPool <- saveM
  549. }
  550. }
  551. }