Browse Source

涌溢咨询

xyxie 1 năm trước cách đây
mục cha
commit
0815e1330a
5 tập tin đã thay đổi với 225 bổ sung115 xóa
  1. 9 1
      go.mod
  2. 20 2
      go.sum
  3. 5 4
      services/base_from_yongyi.go
  4. 55 32
      services/base_from_yongyi/daily.go
  5. 136 76
      services/base_from_yongyi/week.go

+ 9 - 1
go.mod

@@ -7,17 +7,18 @@ require (
 	github.com/beego/beego/v2 v2.1.4
 	github.com/gonum/stat v0.0.0-20181125101827-41a0da705a5b
 	github.com/mozillazg/go-pinyin v0.20.0
-	github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
 	github.com/patrickmn/go-cache v2.1.0+incompatible
 	github.com/rdlucklib/rdluck_tools v1.0.3
 	github.com/robfig/cron/v3 v3.0.1
 	github.com/shopspring/decimal v1.3.1
 	github.com/tealeg/xlsx v1.0.5
+	github.com/tealeg/xlsx/v3 v3.3.5
 )
 
 require (
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cespare/xxhash/v2 v2.2.0 // indirect
+	github.com/frankban/quicktest v1.14.6 // indirect
 	github.com/golang/protobuf v1.5.3 // indirect
 	github.com/gonum/blas v0.0.0-20181208220705-f22b278b28ac // indirect
 	github.com/gonum/floats v0.0.0-20181209220543-c233463c7e82 // indirect
@@ -25,15 +26,22 @@ require (
 	github.com/gonum/internal v0.0.0-20181124074243-f884aa714029 // indirect
 	github.com/gonum/lapack v0.0.0-20181123203213-e4cdc5a0bff9 // indirect
 	github.com/gonum/matrix v0.0.0-20181209220409-c518dec07be9 // indirect
+	github.com/google/btree v1.0.0 // indirect
+	github.com/google/go-cmp v0.5.9 // indirect
 	github.com/hashicorp/golang-lru v0.5.4 // indirect
+	github.com/kr/pretty v0.3.1 // indirect
 	github.com/kr/text v0.2.0 // indirect
 	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
 	github.com/mitchellh/mapstructure v1.5.0 // indirect
+	github.com/peterbourgon/diskv/v3 v3.0.1 // indirect
 	github.com/pkg/errors v0.9.1 // indirect
 	github.com/prometheus/client_golang v1.16.0 // indirect
 	github.com/prometheus/client_model v0.3.0 // indirect
 	github.com/prometheus/common v0.42.0 // indirect
 	github.com/prometheus/procfs v0.10.1 // indirect
+	github.com/rogpeppe/fastuuid v1.2.0 // indirect
+	github.com/rogpeppe/go-internal v1.10.0 // indirect
+	github.com/shabbyrobe/xmlwriter v0.0.0-20200208144257-9fca06d00ffa // indirect
 	github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
 	golang.org/x/crypto v0.10.0 // indirect
 	golang.org/x/net v0.10.0 // indirect

+ 20 - 2
go.sum

@@ -35,6 +35,8 @@ github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt
 github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
 github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
 github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw=
+github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
+github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/garyburd/redigo v1.6.3/go.mod h1:rTb6epsqigu3kYKBnaF028A7Tf/Aw5s0cqA47doKKqw=
 github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
@@ -77,11 +79,14 @@ github.com/gonum/matrix v0.0.0-20181209220409-c518dec07be9 h1:V2IgdyerlBa/MxaEFR
 github.com/gonum/matrix v0.0.0-20181209220409-c518dec07be9/go.mod h1:0EXg4mc1CNP0HCqCz+K4ts155PXIlUywf0wqN+GfPZw=
 github.com/gonum/stat v0.0.0-20181125101827-41a0da705a5b h1:fbskpz/cPqWH8VqkQ7LJghFkl2KPAiIFUHrTJ2O3RGk=
 github.com/gonum/stat v0.0.0-20181125101827-41a0da705a5b/go.mod h1:Z4GIJBJO3Wa4gD4vbwQxXXZ+WHmW6E9ixmNrwvs0iZs=
+github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
+github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
+github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
 github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
@@ -93,6 +98,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
 github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
 github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -117,17 +123,19 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
 github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
 github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
-github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88=
-github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
 github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
 github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
 github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
+github.com/peterbourgon/diskv/v3 v3.0.1 h1:x06SQA46+PKIUftmEujdwSEpIx8kR+M9eLYsUxeYveU=
+github.com/peterbourgon/diskv/v3 v3.0.1/go.mod h1:kJ5Ny7vLdARGU3WUuy6uzO6T0nb/2gWcT1JiBvRmb5o=
 github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
+github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
 github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/profile v1.5.0 h1:042Buzk+NhDI+DeSAA62RwJL8VAuZUMQZUjCsRz1Mug=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@@ -153,7 +161,13 @@ github.com/rdlucklib/rdluck_tools v1.0.3 h1:iOtK2QPlPQ6CL6c1htCk5VnFCHzyG6DCfJtu
 github.com/rdlucklib/rdluck_tools v1.0.3/go.mod h1:9Onw9o4w19C8KE5lxb8GyxgRBbZweRVkQSc79v38EaA=
 github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
 github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
+github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s=
+github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
+github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
 github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
+github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
+github.com/shabbyrobe/xmlwriter v0.0.0-20200208144257-9fca06d00ffa h1:2cO3RojjYl3hVTbEvJVqrMaFmORhL6O06qdW42toftk=
+github.com/shabbyrobe/xmlwriter v0.0.0-20200208144257-9fca06d00ffa/go.mod h1:Yjr3bdWaVWyME1kha7X0jsz3k2DgXNa1Pj3XGyUAbx8=
 github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
 github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 h1:DAYUYH5869yV94zvCES9F51oYtN5oGlwjxJJz7ZCnik=
 github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
@@ -175,6 +189,8 @@ github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2K
 github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
 github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
 github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
+github.com/tealeg/xlsx/v3 v3.3.5 h1:dzmns01jRf0SveBe7VqkcO2LCLOcypcDI6H66PiZycQ=
+github.com/tealeg/xlsx/v3 v3.3.5/go.mod h1:KV4FTFtvGy0TBlOivJLZu/YNZk6e0Qtk7eOSglWksuA=
 github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
 github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
 github.com/ylywyn/jpush-api-go-client v0.0.0-20190906031852-8c4466c6e369/go.mod h1:Nv7wKD2/bCdKUFNKcJRa99a+1+aSLlCRJFriFYdjz/I=
@@ -207,8 +223,10 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
 golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
 golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
 golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
 google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=

+ 5 - 4
services/base_from_yongyi.go

@@ -9,11 +9,12 @@ import (
 	"fmt"
 	"github.com/patrickmn/go-cache"
 	"github.com/rdlucklib/rdluck_tools/http"
-	"github.com/tealeg/xlsx"
+	"github.com/tealeg/xlsx/v3"
 	"io/fs"
 	"os"
 	"path/filepath"
 	"strings"
+	"syscall"
 	"time"
 )
 
@@ -49,7 +50,7 @@ func HandleYongyiExcelDaily(filePath string) (err error) {
 		return
 	}
 	terminalCode := utils.TerminalCode
-	for _, sheet := range xlFile.Sheet {
+	for _, sheet := range xlFile.Sheets {
 		var indexList []*models.YongyiExcelIndex
 		switch sheet.Name {
 		case "出栏价":
@@ -101,7 +102,7 @@ func HandleYongyiExcelWeekly(filePath string) (err error) {
 		return
 	}
 	terminalCode := utils.TerminalCode
-	for _, sheet := range xlFile.Sheet {
+	for _, sheet := range xlFile.Sheets {
 		var indexList []*models.YongyiExcelIndex
 		switch sheet.Name {
 		case "周度-商品猪出栏价":
@@ -250,8 +251,8 @@ func ReadWatchYongyiFile(cont context.Context) (err error) {
 			modifyTimeStr := utils.SecondToTime(winFileAttr.LastWriteTime.Nanoseconds() / 1e9).Format(utils.FormatDateTime)
 			fmt.Println("ReadWatchYongyiFile modifyTimeStr" + modifyTimeStr)
 			existModifyTime, ok := cacheClient.Get(path)
-			fmt.Println("ReadWatchYongyiFile existModifyTime" + existModifyTime.(string))
 			if ok {
+				fmt.Println("ReadWatchYongyiFile existModifyTime" + existModifyTime.(string))
 				existModifyTimeStr := existModifyTime.(string)
 				if existModifyTimeStr != modifyTimeStr {
 					if strings.Contains(path, "涌益咨询") && strings.Contains(path, "日度") {

+ 55 - 32
services/base_from_yongyi/daily.go

@@ -4,7 +4,7 @@ import (
 	"eta/eta_data_analysis/models"
 	"eta/eta_data_analysis/utils"
 	"fmt"
-	"github.com/tealeg/xlsx"
+	"github.com/tealeg/xlsx/v3"
 	"strconv"
 	"strings"
 	"time"
@@ -25,6 +25,7 @@ func HandleYongyiExcelDaily1(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 	dateMap := make(map[int]string)
 	nameMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -33,13 +34,18 @@ func HandleYongyiExcelDaily1(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if stopFlag {
 			break
 		}
+
 		if i == 0 { // 首行,表示时间
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if k > 1 && text != "" {
 					if cell.IsTime() {
@@ -57,18 +63,16 @@ func HandleYongyiExcelDaily1(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 				}
 			}
 		} else if i == 1 { //表示表头
-			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				nameMap[k] = text
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			province := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				fmt.Printf("当前第%d列,内容为%s \n", k, text)
 				if k == 0 {
@@ -167,6 +171,7 @@ func HandleYongyiExcelDaily2(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 	dateMap := make(map[int]string)
 	nameMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -175,13 +180,18 @@ func HandleYongyiExcelDaily2(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if stopFlag {
 			break
 		}
 		if i == 0 { // 首行,表示时间
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					if cell.IsTime() {
@@ -200,17 +210,17 @@ func HandleYongyiExcelDaily2(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 			}
 		} else if i == 1 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				nameMap[k] = text
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			province := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -312,6 +322,7 @@ func HandleYongyiExcelDaily3(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 	indexList = make([]*models.YongyiExcelIndex, 0)
 	nameMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -323,18 +334,24 @@ func HandleYongyiExcelDaily3(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 			break
 		}
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
+
 		if i == 0 { // 首行,名称
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				nameMap[k] = text
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -424,6 +441,7 @@ func HandleYongyiExcelDaily4(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 	indexList = make([]*models.YongyiExcelIndex, 0)
 	dateMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -432,13 +450,18 @@ func HandleYongyiExcelDaily4(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if stopFlag {
 			break
 		}
 		if i == 0 { // 首行,表示时间
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" && text != "省份" {
 					if cell.IsTime() {
@@ -461,10 +484,10 @@ func HandleYongyiExcelDaily4(sheet *xlsx.Sheet) (indexList []*models.YongyiExcel
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			province := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {

+ 136 - 76
services/base_from_yongyi/week.go

@@ -4,7 +4,7 @@ import (
 	"eta/eta_data_analysis/models"
 	"eta/eta_data_analysis/utils"
 	"fmt"
-	"github.com/tealeg/xlsx"
+	"github.com/tealeg/xlsx/v3"
 	"strconv"
 	"strings"
 	"time"
@@ -56,6 +56,7 @@ func HandleYongyiExcelWeekly1(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	areaMap := make(map[int]string)
 	provinceMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -63,10 +64,15 @@ func HandleYongyiExcelWeekly1(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i == 0 { // 首行,表示时间
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if k > 1 && text != "" {
 					// 检查单元格是否为合并单元格
@@ -83,19 +89,19 @@ func HandleYongyiExcelWeekly1(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 			}
 		} else if i == 1 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					provinceMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -190,6 +196,7 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	areaMap := make(map[int]string)
 	provinceMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -197,10 +204,15 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i == 0 { // 首行,表示时间
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if k > 2 && text != "" {
 					// 检查单元格是否为合并单元格
@@ -217,20 +229,20 @@ func HandleYongyiExcelWeekly2(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 			}
 		} else if i == 1 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					provinceMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
 			name := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -331,6 +343,7 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexList = make([]*models.YongyiExcelIndex, 0)
 	provinceMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -338,13 +351,18 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i < 2 {
 			continue
 		}
 		if i == 2 { // 首行,表示时间
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if k > 2 && text != "" {
 					// 检查单元格是否为合并单元格
@@ -355,19 +373,19 @@ func HandleYongyiExcelWeekly3(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 			}
 		} else if i == 3 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					provinceMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -456,6 +474,7 @@ func HandleYongyiExcelWeekly4(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexList = make([]*models.YongyiExcelIndex, 0)
 	provinceMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -463,24 +482,29 @@ func HandleYongyiExcelWeekly4(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i == 0 {
 			continue
 		} else if i == 1 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					provinceMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
 			name := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -591,6 +615,7 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexList = make([]*models.YongyiExcelIndex, 0)
 	provinceMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -598,10 +623,15 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i == 0 {
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if k > 1 && text != "" {
 					if cell.VMerge > 0 {
@@ -612,19 +642,19 @@ func HandleYongyiExcelWeekly5(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 			continue
 		} else if i == 1 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					provinceMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -719,6 +749,7 @@ func HandleYongyiExcelWeekly6(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexList = make([]*models.YongyiExcelIndex, 0)
 	areaMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -726,23 +757,28 @@ func HandleYongyiExcelWeekly6(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i == 0 {
 			continue
 		} else if i == 1 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					areaMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -827,6 +863,7 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	provinceMap := make(map[int]string)
 	firstMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -834,11 +871,16 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i == 0 {
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					firstMap[k] = text
@@ -847,19 +889,19 @@ func HandleYongyiExcelWeekly7(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 			continue
 		} else if i == 1 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					provinceMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -958,6 +1000,7 @@ func HandleYongyiExcelWeekly8(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexList = make([]*models.YongyiExcelIndex, 0)
 	areaMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -965,23 +1008,28 @@ func HandleYongyiExcelWeekly8(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i <= 2 {
 			continue
 		} else if i == 3 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					areaMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -1073,6 +1121,7 @@ func HandleYongyiExcelWeekly9(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexList = make([]*models.YongyiExcelIndex, 0)
 	areaMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -1080,23 +1129,28 @@ func HandleYongyiExcelWeekly9(sheet *xlsx.Sheet) (indexList []*models.YongyiExce
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i <= 1 {
 			continue
 		} else if i == 2 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					areaMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {
@@ -1184,6 +1238,7 @@ func HandleYongyiExcelWeekly10(sheet *xlsx.Sheet) (indexList []*models.YongyiExc
 	indexList = make([]*models.YongyiExcelIndex, 0)
 	areaMap := make(map[int]string)
 	maxRow := sheet.MaxRow
+	maxCell := sheet.MaxCol
 	sort := 0
 	fmt.Println("最大行")
 	fmt.Println(maxRow)
@@ -1191,23 +1246,28 @@ func HandleYongyiExcelWeekly10(sheet *xlsx.Sheet) (indexList []*models.YongyiExc
 	indexMap := make(map[string]*models.YongyiExcelIndex)
 	for i := 0; i < maxRow; i++ {
 		fmt.Printf("当前第%d行 \n", i)
+		row, e := sheet.Row(i)
+		if e != nil {
+			err = fmt.Errorf("读取行失败")
+			return
+		}
 		if i == 0 {
 			continue
 		} else if i == 1 { //表示表头
 			// 处理 index指标表
-			row := sheet.Row(i)
-			cells := row.Cells
-			for k, cell := range cells {
+
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				text := cell.String()
 				if text != "" {
 					areaMap[k] = text
 				}
 			}
 		} else { //数据列
-			row := sheet.Row(i)
-			cells := row.Cells
+
 			date := ""
-			for k, cell := range cells {
+			for k := 0; k < maxCell; k++ {
+				cell := row.GetCell(k)
 				fmt.Printf("当前第%d列 \n", k)
 				text := cell.String()
 				if k == 0 {