|
@@ -70,7 +70,7 @@ func ListenFolderNewMerge() {
|
|
|
for {
|
|
|
select {
|
|
|
case event, ok := <-watcher.Events:
|
|
|
- if ok && event.Op == fsnotify.Create &&
|
|
|
+ if ok && (event.Op == fsnotify.Create || event.Op == fsnotify.Write) &&
|
|
|
!strings.Contains(event.Name, "tmp") &&
|
|
|
!strings.Contains(event.Name, ".TMP") &&
|
|
|
!strings.Contains(event.Name, "~") &&
|
|
@@ -342,7 +342,7 @@ func WatchIndexFileMergeRelease(filePath string) {
|
|
|
fmt.Println("filePath:", filePath)
|
|
|
//return
|
|
|
//filePath:D:\mysteel_data\CM0000568866_release.xlsx
|
|
|
- time.Sleep(10 * time.Second)
|
|
|
+ time.Sleep(5 * time.Second)
|
|
|
if !utils.FileIsExist(filePath) {
|
|
|
fmt.Println("filePath is not exist:" + filePath)
|
|
|
return
|
|
@@ -355,19 +355,11 @@ func WatchIndexFileMergeRelease(filePath string) {
|
|
|
fmt.Println("OpenFile:" + filePath + ",Err:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
- var newFilePath string
|
|
|
defer func() {
|
|
|
if err := f.Close(); err != nil {
|
|
|
fmt.Println("FileClose Err:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
- //重命名文件
|
|
|
- if filePath != newFilePath {
|
|
|
- err := os.Rename(filePath, newFilePath)
|
|
|
- if err != nil {
|
|
|
- fmt.Println("os.Rename Err:" + err.Error())
|
|
|
- }
|
|
|
- }
|
|
|
}()
|
|
|
|
|
|
runMode := "release"
|
|
@@ -461,9 +453,6 @@ func WatchIndexFileMergeRelease(filePath string) {
|
|
|
for k, excelDataMap := range indexExcelDataList {
|
|
|
mysteelIndexHandle(runMode, indexNameMap[k], indexCodeMap[k], unitMap[k], sourceMap[k], frequencyMap[k], startDateMap[k], endDateMap[k], describeMap[k], excelDataMap)
|
|
|
}
|
|
|
-
|
|
|
- return
|
|
|
-
|
|
|
}
|
|
|
|
|
|
wg.Done()
|