main_test.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/flipped-aurora/gin-vue-admin/server/core"
  5. "github.com/flipped-aurora/gin-vue-admin/server/global"
  6. "github.com/flipped-aurora/gin-vue-admin/server/initialize"
  7. "github.com/flipped-aurora/gin-vue-admin/server/model/autocode"
  8. "github.com/flipped-aurora/gin-vue-admin/server/service"
  9. "github.com/xuri/excelize/v2"
  10. "strings"
  11. "testing"
  12. )
  13. func TestName(t *testing.T) {
  14. //ssk:="4Iki42L+u5IYKcYABCDe/A=="
  15. //r:="K8yfw2N2JjgdoYwxSvTq39dKEYRruSftVIZHQQEAs9Kh3XRazd1wArh0kkvWKLvxySX/xLI68p973ea9f4cevYPeMENLX/6dFEyCbxv2dcZlKh8sFSi4rqDXuPf36Hayf024ek/35EylDt8n+XqqUfKv1RZePQYZuxThsQ92yba4FB4Nh2VHC7GFoIRQEkOBCq9sTqjX0IAVrUxhs0hz092+1AMZv+pptw9hjYv144/OIzmwxV97H9svAjVvqYbeWexlIocbAp7Z6+dmyHyQILpKFFgWlUE5vVZkDQAAeh+KcV//7aShZu+l7az1er3B5AOkNQ8UJX85Ux5wyCeduxbmOzGdViycrFQVa86r0cEGVFcNWmyGElUse5jzU3H+P/XMJ9AiZZ2ybvT3NrwgdBck49iulEXoWQKjczTGBIE="
  16. //vi:="gIEEvlb9cEjErJxZ5sflrw=="
  17. //phone , _ := weapp.DecryptMobile(ssk, r, vi)
  18. //fmt.Print(phone)
  19. global.GVA_VP = core.Viper() // 初始化Viper
  20. global.GVA_LOG = core.Zap() // 初始化zap日志库
  21. global.GVA_DB = initialize.Gorm() // gorm连接数据库
  22. //var dictionaryDetailService = service.ServiceGroupApp.SystemServiceGroup.DictionaryDetailService
  23. //f,_:=excelize.OpenFile("C:\\Users\\ice\\Documents\\WeChat Files\\zk1006\\FileStorage\\File\\2021-09\\21类.xlsx")
  24. //files := f.GetSheetList()
  25. //s:= true
  26. //var ss *bool
  27. //ss=&s
  28. //j:=10
  29. //for _, sheet := range files {
  30. // rows,_:=f.GetRows(sheet)
  31. // fmt.Println(j)
  32. // i:=0
  33. // for _, row := range rows {
  34. // if len(row)>1&& row[1]!="" {
  35. // fmt.Printf("\t%v",i )
  36. //
  37. // ditc:=system.SysDictionaryDetail{Label:strings.Replace(strings.Replace(row[1], "\n", "", -1),"◎","",-1),
  38. // Value: i,Status: ss ,Sort: i,SysDictionaryID: j}
  39. // dictionaryDetailService.CreateSysDictionaryDetail(ditc)
  40. // fmt.Println()
  41. // i++
  42. // }
  43. // //for index, value := range row {
  44. //
  45. // // fmt.Printf("\t%v", index)
  46. // //
  47. // //}
  48. //
  49. // }
  50. // j++
  51. // fmt.Println()
  52. //}
  53. var places = service.ServiceGroupApp.AutoCodeServiceGroup.PlaceService
  54. f, _ := excelize.OpenFile("C:\\Users\\ice\\Documents\\WeChat Files\\zk1006\\FileStorage\\File\\2021-09\\点位信息(经开区).xlsx")
  55. files := f.GetSheetList()
  56. for _, sheet := range files {
  57. rows, _ := f.GetRows(sheet)
  58. for _, row := range rows {
  59. if len(row) > 1 && row[1] != "" {
  60. fmt.Printf("\t%v", row[0])
  61. places.CreatePlace(autocode.Place{Name: strings.Replace(row[0], "\n", "", -1),Position:strings.Replace(row[1], "\n", "", -1) ,
  62. Type:strings.Replace(row[2], "\n", "", -1),Region:strings.Replace(row[3], "\n", "", -1) })
  63. fmt.Println()
  64. }
  65. }
  66. fmt.Println()
  67. }
  68. }