|
@@ -22,32 +22,32 @@ func FileCoalInland() () {
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
path := "/home/code/python/coal_mail/emailFile/内陆17省动力煤终端用户供耗存%s.xlsx"
|
|
path := "/home/code/python/coal_mail/emailFile/内陆17省动力煤终端用户供耗存%s.xlsx"
|
|
- //for i := 0;i < 7;i++{
|
|
|
|
- // npath := fmt.Sprintf(path,time.Now().AddDate(0,0,-i).Format(utils.FormatDateUnSpace))
|
|
|
|
- // fmt.Println(npath)
|
|
|
|
- // exist,err := PathExists(npath)
|
|
|
|
- // if err != nil {
|
|
|
|
- // fmt.Println(err)
|
|
|
|
- // return
|
|
|
|
- // }
|
|
|
|
- // if exist{
|
|
|
|
- // path = npath
|
|
|
|
- // break
|
|
|
|
- // }
|
|
|
|
- // if i < 3 && !exist{
|
|
|
|
- // npath := "/home/code/python/coal_mail/emailFile/内陆17省动力煤终端用户供耗存.xlsx"
|
|
|
|
- // fmt.Println(npath)
|
|
|
|
- // exist,err := PathExists(npath)
|
|
|
|
- // if err != nil {
|
|
|
|
- // fmt.Println(err)
|
|
|
|
- // return
|
|
|
|
- // }
|
|
|
|
- // if exist{
|
|
|
|
- // path = npath
|
|
|
|
- // break
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
|
|
+ for i := 0;i < 7;i++{
|
|
|
|
+ npath := fmt.Sprintf(path,time.Now().AddDate(0,0,-i).Format(utils.FormatDateUnSpace))
|
|
|
|
+ fmt.Println(npath)
|
|
|
|
+ exist,err := PathExists(npath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if exist{
|
|
|
|
+ path = npath
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ if i < 3 && !exist{
|
|
|
|
+ npath := "/home/code/python/coal_mail/emailFile/内陆17省动力煤终端用户供耗存.xlsx"
|
|
|
|
+ fmt.Println(npath)
|
|
|
|
+ exist,err := PathExists(npath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println(err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if exist{
|
|
|
|
+ path = npath
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
exist,err := PathExists(path)
|
|
exist,err := PathExists(path)
|
|
if err != nil {
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
fmt.Println(err)
|
|
@@ -62,20 +62,15 @@ func FileCoalInland() () {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
var xlFile *xlsx.File
|
|
var xlFile *xlsx.File
|
|
- xlFile, err = xlsx.OpenFile(path)
|
|
|
|
- if err != nil {
|
|
|
|
- fmt.Println("OpenFile err:",err)
|
|
|
|
|
|
+ if exist {
|
|
|
|
+ xlFile, err = xlsx.OpenFile(path)
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println("OpenFile err:",err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- //if exist {
|
|
|
|
- // xlFile, err = xlsx.OpenFile(path)
|
|
|
|
- // if err != nil {
|
|
|
|
- // fmt.Println("OpenFile err:",err)
|
|
|
|
- // return
|
|
|
|
- // }
|
|
|
|
- //}else {
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
|
|
|
|
var mappingItems []*models.BaseFromCoalmineMapping
|
|
var mappingItems []*models.BaseFromCoalmineMapping
|
|
var indexItems []*models.BaseFromCoalmineInlandIndex
|
|
var indexItems []*models.BaseFromCoalmineInlandIndex
|