45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
package repository
|
|
|
|
import (
|
|
"sort"
|
|
"testData/global"
|
|
"testData/model"
|
|
"testData/repository/test.data"
|
|
)
|
|
|
|
func TestFilesHandlerCron() {
|
|
var 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)
|
|
for _, fileText := range fileTexts {
|
|
if err := test_data.HandleSTS8200Excel(fileText); err != nil {
|
|
continue
|
|
}
|
|
global.PostGreSQL.Model(&fileTexts).Updates(map[string]interface{}{
|
|
"processed": true,
|
|
})
|
|
}
|
|
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 {
|
|
return fileTexts[i].Name < fileTexts[j].Name
|
|
})
|
|
for _, fileText := range fileTexts {
|
|
if err := test_data.HandleSTS8200Excel(fileText); err != nil {
|
|
continue
|
|
}
|
|
global.PostGreSQL.Model(&fileTexts).Updates(map[string]interface{}{
|
|
"processed": true,
|
|
})
|
|
}
|
|
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,
|
|
})
|
|
}
|
|
}
|