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