week30.go 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187
  1. package base_from_yongyi_v2
  2. import (
  3. "eta/eta_data_analysis/models"
  4. "eta/eta_data_analysis/utils"
  5. "fmt"
  6. "github.com/xuri/excelize/v2"
  7. "strconv"
  8. "strings"
  9. "time"
  10. )
  11. // HandleYongyiExcelWeekly21 仔猪、母猪
  12. func HandleYongyiExcelWeekly21(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  13. defer func() {
  14. if err != nil {
  15. fmt.Printf("HandleYongyiExcelWeekly21 仔猪、母猪 ErrMsg: %s\n", err.Error())
  16. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly21 仔猪、母猪 ErrMsg: %s", err.Error()))
  17. }
  18. }()
  19. rows, e := f.GetRows(sheetName)
  20. if e != nil {
  21. err = fmt.Errorf("f GetRows err: %s", e.Error())
  22. return
  23. }
  24. // 获取指标分类
  25. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  26. // 遍历行读取
  27. indexList = make([]*models.YongyiExcelIndex, 0)
  28. provinceMap := make(map[int]string)
  29. sort := 0
  30. fmt.Println("最大行")
  31. // 指标名称
  32. indexMap := make(map[string]*models.YongyiExcelIndex)
  33. for i, row := range rows {
  34. fmt.Printf("当前第%d行 \n", i)
  35. if i == 0 {
  36. continue
  37. } else if i == 1 { //表示表头
  38. // 处理 index指标表
  39. for k, text := range row {
  40. if text != "" {
  41. text = strings.TrimSpace(text)
  42. provinceMap[k] = text
  43. }
  44. }
  45. } else { //数据列
  46. date := ""
  47. name := ""
  48. for k, text := range row {
  49. fmt.Printf("当前第%d列 \n", k)
  50. if k == 0 {
  51. text = strings.TrimSpace(text)
  52. var dateT time.Time
  53. dateT, e = time.ParseInLocation("2006/1/2", text, time.Local)
  54. if e != nil {
  55. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  56. continue
  57. }
  58. date = dateT.Format(utils.FormatDate)
  59. fmt.Println(date)
  60. continue
  61. } else if k == 1 {
  62. name = text
  63. continue
  64. } else {
  65. // 判断出不是字符的,则过滤
  66. if text == "" {
  67. continue
  68. }
  69. if strings.Contains(text, "%") {
  70. text = strings.Replace(text, "%", "", 1)
  71. }
  72. _, e := strconv.ParseFloat(text, 64)
  73. if e != nil {
  74. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  75. continue
  76. }
  77. }
  78. province, ok2 := provinceMap[k]
  79. if !ok2 {
  80. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  81. return
  82. }
  83. if strings.Contains(name, "二元母猪价") {
  84. continue
  85. }
  86. fmt.Printf("当前第%d行第%d列, 当前省份%s \n", i, k, province)
  87. // 处理指标名称
  88. fullIndexName := fmt.Sprintf("%s/%s/%s", namePrefix, name, province)
  89. provincePingyin := utils.GetFullPingYin(province)
  90. namePingin := utils.GetFirstPingYin(name)
  91. fullIndexNamePingyin := namePrefixPingin + namePingin + provincePingyin
  92. if strings.Contains(name, "二元母猪价") {
  93. fullIndexName = fmt.Sprintf("%s/%s", name, province)
  94. fullIndexNamePingyin = "yyzx" + namePingin + provincePingyin
  95. }
  96. indexItem, okIndex := indexMap[fullIndexName]
  97. if !okIndex {
  98. // 新增指标
  99. indexItem = new(models.YongyiExcelIndex)
  100. indexItem.IndexName = fullIndexName
  101. indexItem.ClassifyName = classifyName
  102. indexItem.ClassifySort = classifySort
  103. indexItem.IndexCode = fullIndexNamePingyin
  104. indexItem.Frequency = frequency
  105. indexItem.Sort = sort
  106. indexItem.Unit = unit
  107. indexItem.ExcelDataMap = make(map[string]string)
  108. sort++
  109. }
  110. fmt.Printf("IndexCode: %s", indexItem.IndexCode)
  111. indexItem.ExcelDataMap[date] = text
  112. indexMap[fullIndexName] = indexItem
  113. continue
  114. }
  115. }
  116. }
  117. for _, v := range indexMap {
  118. indexList = append(indexList, v)
  119. }
  120. return
  121. }
  122. // HandleYongyiExcelWeekly22 周度-河南屠宰白条成本
  123. func HandleYongyiExcelWeekly22(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  124. defer func() {
  125. if err != nil {
  126. fmt.Printf("HandleYongyiExcelWeekly22 周度-河南屠宰白条成本 ErrMsg: %s\n", err.Error())
  127. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly22 周度-河南屠宰白条成本 ErrMsg: %s", err.Error()))
  128. }
  129. }()
  130. rows, e := f.GetRows(sheetName)
  131. if e != nil {
  132. err = fmt.Errorf("f GetRows err: %s", e.Error())
  133. return
  134. }
  135. // 获取指标分类
  136. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  137. // 遍历行读取
  138. indexList = make([]*models.YongyiExcelIndex, 0)
  139. nameMap := make(map[int]string)
  140. sort := 0
  141. // 指标名称
  142. indexMap := make(map[string]*models.YongyiExcelIndex)
  143. for i, row := range rows {
  144. fmt.Printf("当前第%d行 \n", i)
  145. if i == 0 {
  146. continue
  147. } else if i == 1 { //表示表头
  148. // 处理 index指标表
  149. for k, text := range row {
  150. if text != "" {
  151. text = strings.TrimSpace(text)
  152. nameMap[k] = text
  153. }
  154. }
  155. } else { //数据列
  156. date := ""
  157. for k, text := range row {
  158. fmt.Printf("当前第%d列 \n", k)
  159. if k == 0 {
  160. text = strings.TrimSpace(text)
  161. var dateT time.Time
  162. dateT, e = time.ParseInLocation("2006/1/2", text, time.Local)
  163. if e != nil {
  164. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  165. continue
  166. }
  167. date = dateT.Format(utils.FormatDate)
  168. fmt.Println(date)
  169. continue
  170. } else {
  171. // 判断出不是字符的,则过滤
  172. if text == "" {
  173. continue
  174. }
  175. if strings.Contains(text, "%") {
  176. text = strings.Replace(text, "%", "", 1)
  177. }
  178. _, e := strconv.ParseFloat(text, 64)
  179. if e != nil {
  180. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  181. continue
  182. }
  183. }
  184. name, ok2 := nameMap[k]
  185. if !ok2 {
  186. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  187. return
  188. }
  189. nameSlice := strings.Split(name, "\n")
  190. nameSlice = strings.Split(name, "(")
  191. unitNew := unit
  192. if len(nameSlice) > 1 {
  193. name = nameSlice[0]
  194. }
  195. switch name {
  196. case "生猪重量", "净白条重":
  197. unitNew = "kg"
  198. case "生猪结算", "白条成本", "6个等级白条均价":
  199. unitNew = "元/kg"
  200. case "副产品回", "屠宰费用", "白条头均利润":
  201. unitNew = "元/头"
  202. }
  203. if name == "预冷损耗" {
  204. continue
  205. }
  206. fmt.Printf("当前第%d行第%d列, 当前省份%s \n", i, k, name)
  207. // 处理指标名称
  208. fullIndexName := fmt.Sprintf("%s/%s", namePrefix, name)
  209. namePingin := utils.GetFirstPingYin(name)
  210. fullIndexNamePingyin := namePrefixPingin + namePingin
  211. indexItem, okIndex := indexMap[fullIndexName]
  212. if !okIndex {
  213. // 新增指标
  214. indexItem = new(models.YongyiExcelIndex)
  215. indexItem.IndexName = fullIndexName
  216. indexItem.ClassifyName = classifyName
  217. indexItem.ClassifySort = classifySort
  218. indexItem.IndexCode = fullIndexNamePingyin
  219. indexItem.Frequency = frequency
  220. indexItem.Sort = sort
  221. indexItem.Unit = unitNew
  222. indexItem.ExcelDataMap = make(map[string]string)
  223. sort++
  224. }
  225. fmt.Printf("IndexCode: %s", indexItem.IndexCode)
  226. indexItem.ExcelDataMap[date] = text
  227. indexMap[fullIndexName] = indexItem
  228. continue
  229. }
  230. }
  231. }
  232. for _, v := range indexMap {
  233. indexList = append(indexList, v)
  234. }
  235. return
  236. }
  237. // HandleYongyiExcelWeekly23 周度-淘汰母猪价格
  238. func HandleYongyiExcelWeekly23(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  239. defer func() {
  240. if err != nil {
  241. fmt.Printf("HandleYongyiExcelWeekly23 周度-淘汰母猪价格 ErrMsg: %s\n", err.Error())
  242. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly23 周度-淘汰母猪价格 ErrMsg: %s", err.Error()))
  243. }
  244. }()
  245. rows, e := f.GetRows(sheetName)
  246. if e != nil {
  247. err = fmt.Errorf("f GetRows err: %s", e.Error())
  248. return
  249. }
  250. // 获取指标分类
  251. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  252. // 遍历行读取
  253. indexList = make([]*models.YongyiExcelIndex, 0)
  254. provinceMap := make(map[int]string)
  255. sort := 0
  256. fmt.Println("最大行")
  257. // 指标名称
  258. indexMap := make(map[string]*models.YongyiExcelIndex)
  259. for i, row := range rows {
  260. fmt.Printf("当前第%d行 \n", i)
  261. if i == 0 {
  262. continue
  263. } else if i == 1 { //表示表头
  264. // 处理 index指标表
  265. for k, text := range row {
  266. if text != "" {
  267. text = strings.TrimSpace(text)
  268. provinceMap[k] = text
  269. }
  270. }
  271. } else { //数据列
  272. date := ""
  273. for k, text := range row {
  274. fmt.Printf("当前第%d列 \n", k)
  275. if k == 0 {
  276. continue
  277. } else if k == 1 {
  278. text = strings.TrimSpace(text)
  279. var dateT time.Time
  280. dateT, e = time.ParseInLocation("2006/1/2", text, time.Local)
  281. if e != nil {
  282. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  283. continue
  284. }
  285. date = dateT.Format(utils.FormatDate)
  286. fmt.Println(date)
  287. continue
  288. } else {
  289. // 判断出不是字符的,则过滤
  290. if text == "" {
  291. continue
  292. }
  293. if strings.Contains(text, "%") {
  294. text = strings.Replace(text, "%", "", 1)
  295. }
  296. _, e := strconv.ParseFloat(text, 64)
  297. if e != nil {
  298. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  299. continue
  300. }
  301. }
  302. province, ok2 := provinceMap[k]
  303. if !ok2 {
  304. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  305. return
  306. }
  307. fmt.Printf("当前第%d行第%d列, 当前省份%s \n", i, k, province)
  308. // 处理指标名称
  309. fullIndexName := fmt.Sprintf("%s/%s", namePrefix, province)
  310. provincePingyin := utils.GetFullPingYin(province)
  311. fullIndexNamePingyin := namePrefixPingin + provincePingyin
  312. indexItem, okIndex := indexMap[fullIndexName]
  313. if !okIndex {
  314. // 新增指标
  315. indexItem = new(models.YongyiExcelIndex)
  316. indexItem.IndexName = fullIndexName
  317. indexItem.ClassifyName = classifyName
  318. indexItem.ClassifySort = classifySort
  319. indexItem.IndexCode = fullIndexNamePingyin
  320. indexItem.Frequency = frequency
  321. indexItem.Sort = sort
  322. indexItem.Unit = unit
  323. indexItem.ExcelDataMap = make(map[string]string)
  324. sort++
  325. }
  326. fmt.Printf("IndexCode: %s", indexItem.IndexCode)
  327. indexItem.ExcelDataMap[date] = text
  328. indexMap[fullIndexName] = indexItem
  329. continue
  330. }
  331. }
  332. }
  333. for _, v := range indexMap {
  334. indexList = append(indexList, v)
  335. }
  336. return
  337. }
  338. // HandleYongyiExcelWeekly24 鲜销率
  339. func HandleYongyiExcelWeekly24(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  340. defer func() {
  341. if err != nil {
  342. fmt.Printf("HandleYongyiExcelWeekly24 鲜销率 ErrMsg: %s\n", err.Error())
  343. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly24 鲜销率 ErrMsg: %s", err.Error()))
  344. }
  345. }()
  346. rows, e := f.GetRows(sheetName)
  347. if e != nil {
  348. err = fmt.Errorf("f GetRows err: %s", e.Error())
  349. return
  350. }
  351. // 获取指标分类
  352. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  353. // 遍历行读取
  354. indexList = make([]*models.YongyiExcelIndex, 0)
  355. provinceMap := make(map[int]string)
  356. sort := 0
  357. fmt.Println("最大行")
  358. // 指标名称
  359. indexMap := make(map[string]*models.YongyiExcelIndex)
  360. for i, row := range rows {
  361. fmt.Printf("当前第%d行 \n", i)
  362. if i <= 1 || i > 2 && i <= 5 {
  363. continue
  364. } else if i == 2 { //表示表头
  365. // 处理 index指标表
  366. for k, text := range row {
  367. if text != "" {
  368. text = strings.TrimSpace(text)
  369. provinceMap[k] = text
  370. }
  371. }
  372. } else { //数据列
  373. date := ""
  374. for k, text := range row {
  375. fmt.Printf("当前第%d列 \n", k)
  376. if k == 0 {
  377. continue
  378. } else if k == 1 {
  379. text = strings.TrimSpace(text)
  380. var dateT time.Time
  381. dateT, e = time.ParseInLocation("2006/1/2", text, time.Local)
  382. if e != nil {
  383. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  384. continue
  385. }
  386. date = dateT.Format(utils.FormatDate)
  387. fmt.Println(date)
  388. continue
  389. } else {
  390. // 判断出不是字符的,则过滤
  391. if text == "" {
  392. continue
  393. }
  394. if strings.Contains(text, "%") {
  395. text = strings.Replace(text, "%", "", 1)
  396. }
  397. _, e := strconv.ParseFloat(text, 64)
  398. if e != nil {
  399. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  400. continue
  401. }
  402. }
  403. province, ok2 := provinceMap[k]
  404. if !ok2 {
  405. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  406. return
  407. }
  408. fmt.Printf("当前第%d行第%d列, 当前省份%s \n", i, k, province)
  409. // 处理指标名称
  410. fullIndexName := fmt.Sprintf("%s/%s", namePrefix, province)
  411. provincePingyin := utils.GetFullPingYin(province)
  412. fullIndexNamePingyin := namePrefixPingin + provincePingyin
  413. indexItem, okIndex := indexMap[fullIndexName]
  414. if !okIndex {
  415. // 新增指标
  416. indexItem = new(models.YongyiExcelIndex)
  417. indexItem.IndexName = fullIndexName
  418. indexItem.ClassifyName = classifyName
  419. indexItem.ClassifySort = classifySort
  420. indexItem.IndexCode = fullIndexNamePingyin
  421. indexItem.Frequency = frequency
  422. indexItem.Sort = sort
  423. indexItem.Unit = unit
  424. indexItem.ExcelDataMap = make(map[string]string)
  425. sort++
  426. }
  427. fmt.Printf("IndexCode: %s", indexItem.IndexCode)
  428. indexItem.ExcelDataMap[date] = text
  429. indexMap[fullIndexName] = indexItem
  430. continue
  431. }
  432. }
  433. }
  434. for _, v := range indexMap {
  435. indexList = append(indexList, v)
  436. }
  437. return
  438. }
  439. // HandleYongyiExcelWeekly25 周度-猪肉产品价格
  440. func HandleYongyiExcelWeekly25(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  441. defer func() {
  442. if err != nil {
  443. fmt.Printf("HandleYongyiExcelWeekly25 周度-猪肉产品价格 ErrMsg: %s\n", err.Error())
  444. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly25 周度-猪肉产品价格 ErrMsg: %s", err.Error()))
  445. }
  446. }()
  447. rows, e := f.GetRows(sheetName)
  448. if e != nil {
  449. err = fmt.Errorf("f GetRows err: %s", e.Error())
  450. return
  451. }
  452. // 获取指标分类
  453. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  454. // 遍历行读取
  455. indexList = make([]*models.YongyiExcelIndex, 0)
  456. provinceMap := make(map[int]string)
  457. sort := 0
  458. fmt.Println("最大行")
  459. // 指标名称
  460. indexMap := make(map[string]*models.YongyiExcelIndex)
  461. for i, row := range rows {
  462. fmt.Printf("当前第%d行 \n", i)
  463. if i == 0 {
  464. continue
  465. } else if i == 1 { //表示表头
  466. // 处理 index指标表
  467. for k, text := range row {
  468. if text != "" {
  469. text = strings.TrimSpace(text)
  470. provinceMap[k] = text
  471. }
  472. }
  473. } else { //数据列
  474. date := ""
  475. name := ""
  476. for k, text := range row {
  477. fmt.Printf("当前第%d列 \n", k)
  478. if k == 0 {
  479. continue
  480. } else if k == 1 {
  481. text = strings.TrimSpace(text)
  482. dateSlice := strings.Split(text, "(")
  483. if len(dateSlice) > 1 {
  484. text = dateSlice[0]
  485. }
  486. var dateT time.Time
  487. dateT, e = time.ParseInLocation("2006/1/2", text, time.Local)
  488. if e != nil {
  489. dateT, e = time.ParseInLocation("01-02-06", text, time.Local)
  490. if e != nil {
  491. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  492. continue
  493. }
  494. }
  495. date = dateT.Format(utils.FormatDate)
  496. fmt.Println(date)
  497. continue
  498. } else if k == 2 {
  499. name = text
  500. continue
  501. } else {
  502. // 判断出不是字符的,则过滤
  503. if text == "" {
  504. continue
  505. }
  506. if strings.Contains(text, "%") {
  507. text = strings.Replace(text, "%", "", 1)
  508. }
  509. _, e := strconv.ParseFloat(text, 64)
  510. if e != nil {
  511. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  512. continue
  513. }
  514. }
  515. province, ok2 := provinceMap[k]
  516. if !ok2 {
  517. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  518. return
  519. }
  520. if strings.Contains(name, "二元母猪价") {
  521. continue
  522. }
  523. fmt.Printf("当前第%d行第%d列, 当前省份%s \n", i, k, province)
  524. // 处理指标名称
  525. fullIndexName := fmt.Sprintf("%s/%s/%s", namePrefix, name, province)
  526. provincePingyin := utils.GetFullPingYin(province)
  527. namePingin := utils.GetFirstPingYin(name)
  528. fullIndexNamePingyin := namePrefixPingin + namePingin + provincePingyin
  529. if strings.Contains(name, "二元母猪价") {
  530. fullIndexName = fmt.Sprintf("%s/%s", name, province)
  531. fullIndexNamePingyin = "yyzx" + namePingin + provincePingyin
  532. }
  533. indexItem, okIndex := indexMap[fullIndexName]
  534. if !okIndex {
  535. // 新增指标
  536. indexItem = new(models.YongyiExcelIndex)
  537. indexItem.IndexName = fullIndexName
  538. indexItem.ClassifyName = classifyName
  539. indexItem.ClassifySort = classifySort
  540. indexItem.IndexCode = fullIndexNamePingyin
  541. indexItem.Frequency = frequency
  542. indexItem.Sort = sort
  543. indexItem.Unit = unit
  544. indexItem.ExcelDataMap = make(map[string]string)
  545. sort++
  546. }
  547. indexItem.ExcelDataMap[date] = text
  548. indexMap[fullIndexName] = indexItem
  549. continue
  550. }
  551. }
  552. }
  553. for _, v := range indexMap {
  554. fmt.Printf("IndexName: %s \n", v.IndexName)
  555. fmt.Printf("IndexCode: %s \n", v.IndexCode)
  556. indexList = append(indexList, v)
  557. }
  558. return
  559. }
  560. // HandleYongyiExcelWeekly26 周度-淘汰母猪价格
  561. func HandleYongyiExcelWeekly26(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  562. defer func() {
  563. if err != nil {
  564. fmt.Printf("HandleYongyiExcelWeekly26 周度-屠宰企业日度屠宰量 ErrMsg: %s\n", err.Error())
  565. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly26 周度-屠宰企业日度屠宰量 ErrMsg: %s", err.Error()))
  566. }
  567. }()
  568. rows, e := f.GetRows(sheetName)
  569. if e != nil {
  570. err = fmt.Errorf("f GetRows err: %s", e.Error())
  571. return
  572. }
  573. // 获取指标分类
  574. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  575. // 遍历行读取
  576. indexList = make([]*models.YongyiExcelIndex, 0)
  577. provinceMap := make(map[int]string)
  578. sort := 0
  579. fmt.Println("最大行")
  580. // 指标名称
  581. indexMap := make(map[string]*models.YongyiExcelIndex)
  582. for i, row := range rows {
  583. fmt.Printf("当前第%d行 \n", i)
  584. if i == 0 { //表示表头
  585. // 处理 index指标表
  586. for k, text := range row {
  587. if text != "" {
  588. text = strings.TrimSpace(text)
  589. provinceMap[k] = text
  590. }
  591. }
  592. } else { //数据列
  593. date := ""
  594. for k, text := range row {
  595. fmt.Printf("当前第%d列 \n", k)
  596. if k == 0 {
  597. text = strings.TrimSpace(text)
  598. var dateT time.Time
  599. dateT, e = time.ParseInLocation("2006/1/2", text, time.Local)
  600. if e != nil {
  601. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  602. continue
  603. }
  604. date = dateT.Format(utils.FormatDate)
  605. fmt.Println(date)
  606. continue
  607. } else {
  608. // 判断出不是字符的,则过滤
  609. if text == "" {
  610. continue
  611. }
  612. if strings.Contains(text, "%") {
  613. text = strings.Replace(text, "%", "", 1)
  614. }
  615. _, e := strconv.ParseFloat(text, 64)
  616. if e != nil {
  617. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  618. continue
  619. }
  620. }
  621. province, ok2 := provinceMap[k]
  622. if !ok2 {
  623. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  624. return
  625. }
  626. fmt.Printf("当前第%d行第%d列, 当前省份%s \n", i, k, province)
  627. // 处理指标名称
  628. fullIndexName := fmt.Sprintf("%s/%s", namePrefix, province)
  629. provincePingyin := utils.GetFullPingYin(province)
  630. fullIndexNamePingyin := namePrefixPingin + provincePingyin
  631. if strings.Contains(province, "合计") {
  632. province = "合计"
  633. fullIndexName = fmt.Sprintf("%s/%s", namePrefix, province)
  634. provincePingyin = utils.GetFirstPingYin(province)
  635. fullIndexNamePingyin = namePrefixPingin + provincePingyin
  636. }
  637. indexItem, okIndex := indexMap[fullIndexName]
  638. if !okIndex {
  639. // 新增指标
  640. indexItem = new(models.YongyiExcelIndex)
  641. indexItem.IndexName = fullIndexName
  642. indexItem.ClassifyName = classifyName
  643. indexItem.ClassifySort = classifySort
  644. indexItem.IndexCode = fullIndexNamePingyin
  645. indexItem.Frequency = frequency
  646. indexItem.Sort = sort
  647. indexItem.Unit = unit
  648. indexItem.ExcelDataMap = make(map[string]string)
  649. sort++
  650. }
  651. fmt.Printf("IndexCode: %s", indexItem.IndexCode)
  652. indexItem.ExcelDataMap[date] = text
  653. indexMap[fullIndexName] = indexItem
  654. continue
  655. }
  656. }
  657. }
  658. for _, v := range indexMap {
  659. indexList = append(indexList, v)
  660. }
  661. return
  662. }
  663. // HandleYongyiExcelWeekly27 周度-屠宰新2022.10.28
  664. func HandleYongyiExcelWeekly27(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  665. defer func() {
  666. if err != nil {
  667. fmt.Printf("HandleYongyiExcelWeekly27 周度-屠宰新2022.10.28 ErrMsg: %s\n", err.Error())
  668. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly27 周度-屠宰新2022.10.28 ErrMsg: %s", err.Error()))
  669. }
  670. }()
  671. rows, e := f.GetRows(sheetName)
  672. if e != nil {
  673. err = fmt.Errorf("f GetRows err: %s", e.Error())
  674. return
  675. }
  676. // 获取指标分类
  677. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  678. // 遍历行读取
  679. indexList = make([]*models.YongyiExcelIndex, 0)
  680. nameMap := make(map[int]string)
  681. sort := 0
  682. fmt.Println("最大行")
  683. // 指标名称
  684. indexMap := make(map[string]*models.YongyiExcelIndex)
  685. for i, row := range rows {
  686. fmt.Printf("当前第%d行 \n", i)
  687. if i == 0 {
  688. continue
  689. } else if i == 1 { //表示表头
  690. // 处理 index指标表
  691. for k, text := range row {
  692. if text != "" {
  693. text = strings.TrimSpace(text)
  694. nameMap[k] = text
  695. }
  696. }
  697. } else { //数据列
  698. date := ""
  699. for k, text := range row {
  700. fmt.Printf("当前第%d列 \n", k)
  701. if k == 0 {
  702. continue
  703. } else if k == 1 {
  704. text = strings.TrimSpace(text)
  705. var dateT time.Time
  706. //判断是否是数字,如果是数字,另外单独处理
  707. if dateFloat, e := strconv.ParseFloat(text, 64); e == nil {
  708. dateT, e = excelize.ExcelDateToTime(dateFloat, false)
  709. if e != nil {
  710. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  711. continue
  712. }
  713. } else {
  714. dateT, e = time.ParseInLocation("2006年1月2日", text, time.Local)
  715. if e != nil {
  716. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  717. continue
  718. }
  719. }
  720. date = dateT.Format(utils.FormatDate)
  721. fmt.Println(date)
  722. continue
  723. } else {
  724. // 判断出不是字符的,则过滤
  725. if text == "" {
  726. continue
  727. }
  728. if strings.Contains(text, "%") {
  729. text = strings.Replace(text, "%", "", 1)
  730. }
  731. _, e := strconv.ParseFloat(text, 64)
  732. if e != nil {
  733. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  734. continue
  735. }
  736. }
  737. name, ok2 := nameMap[k]
  738. if !ok2 {
  739. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  740. return
  741. }
  742. if name != "规模屠宰厂全国前10家" && name != "各省规模屠宰厂100家" && name != "县区+乡镇宰杀 70家" {
  743. continue
  744. }
  745. fmt.Printf("当前第%d行第%d列, 当前省份%s \n", i, k, name)
  746. // 处理指标名称不同规模屠宰厂宰杀量/县区+乡镇宰杀 70家
  747. name = strings.Replace(name, " ", "", -1)
  748. fullIndexName := fmt.Sprintf("%s/%s", namePrefix, name)
  749. namePingin := utils.GetFirstPingYin(name)
  750. fullIndexNamePingyin := namePrefixPingin + namePingin
  751. indexItem, okIndex := indexMap[fullIndexName]
  752. if !okIndex {
  753. // 新增指标
  754. indexItem = new(models.YongyiExcelIndex)
  755. indexItem.IndexName = fullIndexName
  756. indexItem.ClassifyName = classifyName
  757. indexItem.ClassifySort = classifySort
  758. indexItem.IndexCode = fullIndexNamePingyin
  759. indexItem.Frequency = frequency
  760. indexItem.Sort = sort
  761. indexItem.Unit = unit
  762. indexItem.ExcelDataMap = make(map[string]string)
  763. sort++
  764. }
  765. fmt.Printf("IndexCode: %s", indexItem.IndexCode)
  766. indexItem.ExcelDataMap[date] = text
  767. indexMap[fullIndexName] = indexItem
  768. continue
  769. }
  770. }
  771. }
  772. for _, v := range indexMap {
  773. indexList = append(indexList, v)
  774. }
  775. return
  776. }
  777. // HandleYongyiExcelWeekly28 月度-淘汰母猪屠宰厂宰杀量
  778. func HandleYongyiExcelWeekly28(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  779. defer func() {
  780. if err != nil {
  781. fmt.Printf("HandleYongyiExcelWeekly28 月度-淘汰母猪屠宰厂宰杀量 ErrMsg: %s\n", err.Error())
  782. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly28 月度-淘汰母猪屠宰厂宰杀量 ErrMsg: %s", err.Error()))
  783. }
  784. }()
  785. rows, e := f.GetRows(sheetName)
  786. if e != nil {
  787. err = fmt.Errorf("f GetRows err: %s", e.Error())
  788. return
  789. }
  790. // 获取指标分类
  791. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  792. // 遍历行读取
  793. indexList = make([]*models.YongyiExcelIndex, 0)
  794. provinceMap := make(map[int]string)
  795. nameMap := make(map[int]string)
  796. sort := 0
  797. fmt.Println("最大行")
  798. // 指标名称
  799. indexMap := make(map[string]*models.YongyiExcelIndex)
  800. mergeCellMap, err := GetMergeCells(f, sheetName)
  801. if err != nil {
  802. err = fmt.Errorf("获取合并单元格失败, sheetName: %s", sheetName)
  803. return
  804. }
  805. for i, row := range rows {
  806. fmt.Printf("当前第%d行 \n", i)
  807. currentMergeCells, mergeOk := mergeCellMap[i]
  808. if i == 0 { //表示表头
  809. // 处理 index指标表
  810. for k, text := range row {
  811. if text != "" {
  812. text = strings.TrimSpace(text)
  813. if mergeOk {
  814. for j, v := range currentMergeCells {
  815. provinceMap[j] = v
  816. nameMap[j] = v
  817. }
  818. }
  819. provinceMap[k] = text
  820. }
  821. }
  822. } else if i == 1 { //表示表头
  823. // 处理 index指标表
  824. for k, text := range row {
  825. if text != "" {
  826. text = strings.TrimSpace(text)
  827. nameMap[k] = text
  828. }
  829. }
  830. } else { //数据列
  831. date := ""
  832. for k, text := range row {
  833. fmt.Printf("当前第%d列 \n", k)
  834. if k == 0 {
  835. text = strings.TrimSpace(text)
  836. var dateT time.Time
  837. dateT, e = time.ParseInLocation("2006年1月", text, time.Local)
  838. if e != nil {
  839. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  840. continue
  841. }
  842. // 查询当月的最后一天
  843. monthDate := dateT.Format(utils.FormatYearMonthDate)
  844. firstDayStr := monthDate + "-01"
  845. tmpT, _ := time.ParseInLocation(utils.FormatDate, firstDayStr, time.Local)
  846. date = tmpT.AddDate(0, 1, -1).Format(utils.FormatDate)
  847. fmt.Println(date)
  848. continue
  849. } else if k == 1 {
  850. continue
  851. } else {
  852. // 判断出不是字符的,则过滤
  853. if text == "" {
  854. continue
  855. }
  856. if strings.Contains(text, "%") {
  857. text = strings.Replace(text, "%", "", 1)
  858. }
  859. _, e := strconv.ParseFloat(text, 64)
  860. if e != nil {
  861. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  862. continue
  863. }
  864. }
  865. province, ok2 := provinceMap[k]
  866. if !ok2 {
  867. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  868. return
  869. }
  870. name, ok1 := nameMap[k]
  871. if !ok1 {
  872. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  873. return
  874. }
  875. if strings.Contains(name, "环比") {
  876. continue
  877. }
  878. fmt.Printf("当前第%d行第%d列, 当前省份: %s \n", i, k, province)
  879. // 处理指标名称
  880. fullIndexName := fmt.Sprintf("%s/%s%s", namePrefix, province, name)
  881. provincePingyin := utils.GetFullPingYin(province)
  882. namePingin := utils.GetFirstPingYin(name)
  883. fullIndexNamePingyin := namePrefixPingin + provincePingyin + namePingin
  884. indexItem, okIndex := indexMap[fullIndexName]
  885. if !okIndex {
  886. // 新增指标
  887. indexItem = new(models.YongyiExcelIndex)
  888. indexItem.IndexName = fullIndexName
  889. indexItem.ClassifyName = classifyName
  890. indexItem.ClassifySort = classifySort
  891. indexItem.IndexCode = fullIndexNamePingyin
  892. indexItem.Frequency = frequency
  893. indexItem.Sort = sort
  894. indexItem.Unit = unit
  895. indexItem.ExcelDataMap = make(map[string]string)
  896. sort++
  897. }
  898. fmt.Printf("IndexCode: %s\n", indexItem.IndexCode)
  899. indexItem.ExcelDataMap[date] = text
  900. indexMap[fullIndexName] = indexItem
  901. continue
  902. }
  903. }
  904. }
  905. for _, v := range indexMap {
  906. indexList = append(indexList, v)
  907. }
  908. return
  909. }
  910. // HandleYongyiExcelWeekly29 月度-猪料销量
  911. func HandleYongyiExcelWeekly29(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  912. defer func() {
  913. if err != nil {
  914. fmt.Printf("HandleYongyiExcelWeekly29 月度-猪料销量 ErrMsg: %s\n", err.Error())
  915. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly29 月度-猪料销量 ErrMsg: %s", err.Error()))
  916. }
  917. }()
  918. rows, e := f.GetRows(sheetName)
  919. if e != nil {
  920. err = fmt.Errorf("f GetRows err: %s", e.Error())
  921. return
  922. }
  923. // 获取指标分类
  924. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  925. // 遍历行读取
  926. indexList = make([]*models.YongyiExcelIndex, 0)
  927. nameMap := make(map[int]string)
  928. sort := 0
  929. fmt.Println("最大行")
  930. // 指标名称
  931. indexMap := make(map[string]*models.YongyiExcelIndex)
  932. for i, row := range rows {
  933. fmt.Printf("当前第%d行 \n", i)
  934. if i == 0 {
  935. continue
  936. } else if i == 1 { //表示表头
  937. // 处理 index指标表
  938. for k, text := range row {
  939. if text != "" {
  940. text = strings.TrimSpace(text)
  941. nameMap[k] = text
  942. }
  943. }
  944. } else { //数据列
  945. date := ""
  946. for k, text := range row {
  947. fmt.Printf("当前第%d列 \n", k)
  948. if k == 0 {
  949. text = strings.TrimSpace(text)
  950. var dateT time.Time
  951. //判断是否是数字,如果是数字,另外单独处理
  952. if dateFloat, e := strconv.ParseFloat(text, 64); e == nil {
  953. dateT, e = excelize.ExcelDateToTime(dateFloat, false)
  954. if e != nil {
  955. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  956. continue
  957. }
  958. } else {
  959. dateT, e = time.ParseInLocation("2006年1月", text, time.Local)
  960. if e != nil {
  961. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  962. continue
  963. }
  964. }
  965. // 查询当月的最后一天
  966. monthDate := dateT.Format(utils.FormatYearMonthDate)
  967. firstDayStr := monthDate + "-01"
  968. tmpT, _ := time.ParseInLocation(utils.FormatDate, firstDayStr, time.Local)
  969. date = tmpT.AddDate(0, 1, -1).Format(utils.FormatDate)
  970. fmt.Println(date)
  971. continue
  972. } else {
  973. // 判断出不是字符的,则过滤
  974. if text == "" {
  975. continue
  976. }
  977. if strings.Contains(text, "%") {
  978. text = strings.Replace(text, "%", "", 1)
  979. }
  980. _, e := strconv.ParseFloat(text, 64)
  981. if e != nil {
  982. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  983. continue
  984. }
  985. }
  986. name, ok2 := nameMap[k]
  987. if !ok2 {
  988. err = fmt.Errorf("找不到对应的列名,第%d行,第%d列", i, k)
  989. return
  990. }
  991. fmt.Printf("当前第%d行第%d列, 当前省份%s \n", i, k, name)
  992. fullIndexName := fmt.Sprintf("%s/%s", namePrefix, name)
  993. namePingin := utils.GetFirstPingYin(name)
  994. fullIndexNamePingyin := namePrefixPingin + namePingin
  995. indexItem, okIndex := indexMap[fullIndexName]
  996. if !okIndex {
  997. // 新增指标
  998. indexItem = new(models.YongyiExcelIndex)
  999. indexItem.IndexName = fullIndexName
  1000. indexItem.ClassifyName = classifyName
  1001. indexItem.ClassifySort = classifySort
  1002. indexItem.IndexCode = fullIndexNamePingyin
  1003. indexItem.Frequency = frequency
  1004. indexItem.Sort = sort
  1005. indexItem.Unit = unit
  1006. indexItem.ExcelDataMap = make(map[string]string)
  1007. sort++
  1008. }
  1009. fmt.Printf("IndexCode: %s", indexItem.IndexCode)
  1010. indexItem.ExcelDataMap[date] = text
  1011. indexMap[fullIndexName] = indexItem
  1012. continue
  1013. }
  1014. }
  1015. }
  1016. for _, v := range indexMap {
  1017. indexList = append(indexList, v)
  1018. }
  1019. return
  1020. }
  1021. // HandleYongyiExcelWeekly30 月度-屠宰企业开工率
  1022. func HandleYongyiExcelWeekly30(f *excelize.File, sheetName string) (indexList []*models.YongyiExcelIndex, err error) {
  1023. defer func() {
  1024. if err != nil {
  1025. fmt.Printf("HandleYongyiExcelWeekly30 月度-屠宰企业开工率 ErrMsg: %s\n", err.Error())
  1026. utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeekly30 月度-屠宰企业开工率 ErrMsg: %s", err.Error()))
  1027. }
  1028. }()
  1029. rows, e := f.GetRows(sheetName)
  1030. if e != nil {
  1031. err = fmt.Errorf("f GetRows err: %s", e.Error())
  1032. return
  1033. }
  1034. // 获取指标分类
  1035. classifyName, classifySort, frequency, unit, namePrefix, namePrefixPingin := GetBaseInfo(sheetName)
  1036. // 遍历行读取
  1037. indexList = make([]*models.YongyiExcelIndex, 0)
  1038. sort := 0
  1039. fmt.Println("最大行")
  1040. // 指标名称
  1041. indexMap := make(map[string]*models.YongyiExcelIndex)
  1042. for i, row := range rows {
  1043. fmt.Printf("当前第%d行 \n", i)
  1044. if i > 0 { //数据列
  1045. date := ""
  1046. for k, text := range row {
  1047. fmt.Printf("当前第%d列 \n", k)
  1048. if k == 0 {
  1049. text = strings.TrimSpace(text)
  1050. var dateT time.Time
  1051. dateT, e = time.ParseInLocation("2006年1月", text, time.Local)
  1052. if e != nil {
  1053. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 读取行,时间列失败 Err:%s", sheetName, i, k, e))
  1054. continue
  1055. }
  1056. // 查询当月的最后一天
  1057. monthDate := dateT.Format(utils.FormatYearMonthDate)
  1058. firstDayStr := monthDate + "-01"
  1059. tmpT, _ := time.ParseInLocation(utils.FormatDate, firstDayStr, time.Local)
  1060. date = tmpT.AddDate(0, 1, -1).Format(utils.FormatDate)
  1061. fmt.Println(date)
  1062. continue
  1063. } else {
  1064. // 判断出不是字符的,则过滤
  1065. if text == "" {
  1066. continue
  1067. }
  1068. if strings.Contains(text, "%") {
  1069. text = strings.Replace(text, "%", "", 1)
  1070. }
  1071. _, e := strconv.ParseFloat(text, 64)
  1072. if e != nil {
  1073. utils.FileLog.Info(fmt.Sprintf("sheet:%s 第%d行, 第%d列 strconv.ParseFloat Err:%s", sheetName, i, k, e))
  1074. continue
  1075. }
  1076. }
  1077. name := "屠宰企业开工率全国平均"
  1078. fmt.Printf("当前第%d行第%d列, 当前省份%s \n", i, k, name)
  1079. fullIndexName := fmt.Sprintf("%s%s", namePrefix, name)
  1080. namePingin := utils.GetFirstPingYin(name)
  1081. fullIndexNamePingyin := namePrefixPingin + namePingin
  1082. indexItem, okIndex := indexMap[fullIndexName]
  1083. if !okIndex {
  1084. // 新增指标
  1085. indexItem = new(models.YongyiExcelIndex)
  1086. indexItem.IndexName = fullIndexName
  1087. indexItem.ClassifyName = classifyName
  1088. indexItem.ClassifySort = classifySort
  1089. indexItem.IndexCode = fullIndexNamePingyin
  1090. indexItem.Frequency = frequency
  1091. indexItem.Sort = sort
  1092. indexItem.Unit = unit
  1093. indexItem.ExcelDataMap = make(map[string]string)
  1094. sort++
  1095. }
  1096. fmt.Printf("IndexCode: %s", indexItem.IndexCode)
  1097. indexItem.ExcelDataMap[date] = text
  1098. indexMap[fullIndexName] = indexItem
  1099. continue
  1100. }
  1101. }
  1102. }
  1103. for _, v := range indexMap {
  1104. indexList = append(indexList, v)
  1105. }
  1106. return
  1107. }