|
@@ -177,8 +177,8 @@ func YongyiDownloadDaily(cont context.Context) (err error) {
|
|
|
now = now.AddDate(0, 0, -offset)
|
|
|
}
|
|
|
|
|
|
- filePath := fmt.Sprintf("%s/%s%s", utils.YongyiReadFilePath, now.Format("2006年1月2日"), "涌益咨询日度数据.xlsx")
|
|
|
-
|
|
|
+ filePath := fmt.Sprintf("%s%s", now.Format("2006年1月2日"), "涌益咨询日度数据.xlsx")
|
|
|
+ filePath = filepath.Join(utils.YongyiReadFilePath, filePath)
|
|
|
fmt.Println("YongyiDownloadDaily: " + filePath)
|
|
|
_, e := os.Stat(filePath)
|
|
|
if e == nil { //文件或者目录存在
|
|
@@ -217,19 +217,40 @@ func YongyiDownloadWeekyly(cont context.Context) (err error) {
|
|
|
fmt.Printf("endDate: %s\n", endDate)
|
|
|
dataFileExsit := false
|
|
|
chartFileExist := false
|
|
|
- filePath := fmt.Sprintf("%s/%s-%s%s", utils.YongyiReadFilePath, startDate, endDate, "涌益咨询 周度数据.xlsx")
|
|
|
+ filePath := fmt.Sprintf("%s-%s%s", startDate, endDate, "涌益咨询 周度数据.xlsx")
|
|
|
+ filePath = filepath.Join(utils.YongyiReadFilePath, filePath)
|
|
|
+
|
|
|
fmt.Println("YongyiDownloadWeekyly: " + filePath)
|
|
|
|
|
|
// 从已处理的表格中查询是否已存在,如果已存在,也无需下载
|
|
|
_, e := os.Stat(filePath)
|
|
|
if e == nil { //文件或者目录存在
|
|
|
dataFileExsit = true
|
|
|
+ } else if os.IsNotExist(e) { //文件或者目录不存在
|
|
|
+ filePath = filepath.Join(utils.YongyiFilePath, filePath)
|
|
|
+
|
|
|
+ fmt.Println("YongyiDownloadWeekyly: " + filePath)
|
|
|
+
|
|
|
+ // 从已处理的表格中查询是否已存在,如果已存在,也无需下载
|
|
|
+ _, e = os.Stat(filePath)
|
|
|
+ if e == nil { //文件或者目录存在
|
|
|
+ dataFileExsit = true
|
|
|
+ }
|
|
|
}
|
|
|
- filePath = fmt.Sprintf("%s/%s-%s%s", utils.YongyiReadFilePath, startDate, endDate, "周度图表版图.xlsx")
|
|
|
+ filePath = fmt.Sprintf("%s-%s%s", utils.YongyiReadFilePath, startDate, endDate, "周度图表版图.xlsx")
|
|
|
+ filePath = filepath.Join(utils.YongyiReadFilePath, filePath)
|
|
|
fmt.Println("YongyiDownloadWeekyly: " + filePath)
|
|
|
_, e = os.Stat(filePath)
|
|
|
if e == nil { //文件或者目录存在
|
|
|
chartFileExist = true
|
|
|
+ } else if os.IsNotExist(e) { //文件或者目录不存在
|
|
|
+ filePath = filepath.Join(utils.YongyiFilePath, filePath)
|
|
|
+ fmt.Println("YongyiDownloadWeekyly: " + filePath)
|
|
|
+ // 从已处理的表格中查询是否已存在,如果已存在,也无需下载
|
|
|
+ _, e = os.Stat(filePath)
|
|
|
+ if e == nil { //文件或者目录存在
|
|
|
+ chartFileExist = true
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if dataFileExsit && chartFileExist {
|
|
@@ -296,7 +317,7 @@ func ReadWatchYongyiFile(cont context.Context) (err error) {
|
|
|
}
|
|
|
}
|
|
|
if err != nil {
|
|
|
- err = fmt.Errorf("handlerYongyi err: %s", err.Error())
|
|
|
+ err = fmt.Errorf("file name: %s, handlerYongyi err: %s", path, err.Error())
|
|
|
return err
|
|
|
}
|
|
|
|
|
@@ -403,9 +424,10 @@ func HandleYongyiExcelDailyV2(filePath string) (err error) {
|
|
|
if !ok {
|
|
|
continue // 如果没有,则跳过当前sheet
|
|
|
}
|
|
|
-
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelDailyV2 %s start", sheetName))
|
|
|
// 调用处理函数,并处理可能发生的错误
|
|
|
indexList, e := handler(f, sheetName)
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelDailyV2 %s end", sheetName))
|
|
|
if e != nil {
|
|
|
utils.FileLog.Info(fmt.Sprintf("解析sheet:%s 失败, Err: %s", sheetName, err))
|
|
|
continue
|
|
@@ -463,7 +485,9 @@ func HandleYongyiExcelWeeklyV2(filePath string) (err error) {
|
|
|
}
|
|
|
|
|
|
// 调用处理函数,并处理可能发生的错误
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeeklyV2 %s start", sheetName))
|
|
|
indexList, e := handler(f, sheetName)
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeeklyV2 %s end", sheetName))
|
|
|
if e != nil {
|
|
|
utils.FileLog.Info(fmt.Sprintf("解析sheet:%s 失败, Err: %s", sheetName, err))
|
|
|
continue
|
|
@@ -519,9 +543,10 @@ func HandleYongyiExcelWeeklyChart(filePath string) (err error) {
|
|
|
if !ok {
|
|
|
continue // 如果没有,则跳过当前sheet
|
|
|
}
|
|
|
-
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeeklyChart %s start", sheetName))
|
|
|
// 调用处理函数,并处理可能发生的错误
|
|
|
indexList, e := handler(f, sheetName)
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("HandleYongyiExcelWeeklyChart %s end", sheetName))
|
|
|
if e != nil {
|
|
|
utils.FileLog.Info(fmt.Sprintf("解析sheet:%s 失败, Err: %s", sheetName, err))
|
|
|
continue
|