数据分析平台
This commit is contained in:
parent
002074faa6
commit
edc414df11
@ -1,7 +1,9 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
"sort"
|
||||
"strings"
|
||||
"testData/global"
|
||||
"testData/model"
|
||||
"testData/repository/test.data"
|
||||
@ -27,15 +29,31 @@ func TestFilesHandlerCron() {
|
||||
sort.Slice(fileTexts, func(i, j int) bool {
|
||||
return fileTexts[i].Name < fileTexts[j].Name
|
||||
})
|
||||
for i := 0; i < len(fileTexts)/2; i++ {
|
||||
test_data.MT737(fileTexts[2*i+1], fileTexts[2*i])
|
||||
global.PostGreSQL.Model(&fileTexts[2*i+1]).Updates(map[string]interface{}{
|
||||
"processed": true,
|
||||
})
|
||||
global.PostGreSQL.Model(&fileTexts[2*i]).Updates(map[string]interface{}{
|
||||
"processed": true,
|
||||
})
|
||||
index := 0
|
||||
for {
|
||||
if strings.Contains(strings.ToUpper(fileTexts[index].Name), "SUMMARY") {
|
||||
index++
|
||||
continue
|
||||
}
|
||||
if index+1 < len(fileTexts) {
|
||||
test_data.MT737(fileTexts[index+1], fileTexts[index])
|
||||
global.PostGreSQL.Transaction(func(tx *gorm.DB) error {
|
||||
tx.Model(&fileTexts[index+1]).Updates(map[string]interface{}{
|
||||
"processed": true,
|
||||
})
|
||||
tx.Model(&fileTexts[index]).Updates(map[string]interface{}{
|
||||
"processed": true,
|
||||
})
|
||||
return nil
|
||||
})
|
||||
index += 2
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
//for i := 0; i < len(fileTexts)/2; i++ {
|
||||
// test_data.MT737(fileTexts[2*i+1], fileTexts[2*i])
|
||||
//}
|
||||
fileTexts = []*model.FileText{}
|
||||
global.PostGreSQL.Where("processed = ? AND doubt = ? AND factory = ?", false, false, "铜陵碁明").Order("procedure").Find(&fileTexts)
|
||||
sort.Slice(fileTexts, func(i, j int) bool {
|
||||
|
Loading…
Reference in New Issue
Block a user