修改dataFileName规则
This commit is contained in:
parent
ba17b10a50
commit
0eb1fa02f2
BIN
iniDataForLinux
BIN
iniDataForLinux
Binary file not shown.
BIN
iniDataForMacOs
BIN
iniDataForMacOs
Binary file not shown.
13
main.go
13
main.go
@ -460,8 +460,8 @@ func batchInsert(fileName string, isLastCall bool, excludedFilename string) int
|
||||
var batchName, dataFileName string
|
||||
|
||||
if isLastCall {
|
||||
batchName = fmt.Sprintf("lastCall-%s-%s-%s", record[1], excludedFilename, strconv.Itoa(int(communicationChannelID)))
|
||||
dataFileName = fmt.Sprintf("lastCall-%s-%s", excludedFilename, fileName)
|
||||
batchName = fmt.Sprintf("lastCall-%s-%s-%s", record[1], record[0], excludedFilename)
|
||||
dataFileName = fmt.Sprintf("lastCall-%s", excludedFilename)
|
||||
} else {
|
||||
batchName = fmt.Sprintf("%s-%s", record[1], record[0])
|
||||
dataFileName = fileName
|
||||
@ -627,8 +627,7 @@ func batchDataInsert(fileName string, lastCallKeys map[string]bool, excludedFile
|
||||
fields := strings.Split(fileName, "_")
|
||||
datetime := fields[len(fields)-1]
|
||||
if lastCallKeys != nil {
|
||||
newFileName := "Communication_definition_SMS_1_wemedia_" + datetime
|
||||
fileNameDate = fmt.Sprintf("lastCall-%s-%s", excludedFilename, newFileName)
|
||||
fileNameDate = fmt.Sprintf("lastCall-%s", excludedFilename)
|
||||
fmt.Printf("fileNameDate : %s\n", fileNameDate)
|
||||
// 模糊查询文件名包含“20230103”字符串的批次记录
|
||||
db.Table("batches b1").
|
||||
@ -637,7 +636,7 @@ func batchDataInsert(fileName string, lastCallKeys map[string]bool, excludedFile
|
||||
Joins("INNER JOIN (SELECT communication_channel_id, MAX(created_at) AS created_at FROM batches GROUP BY communication_channel_id) b2 ON b1.communication_channel_id = b2.communication_channel_id AND b1.created_at = b2.created_at").
|
||||
Order("b1.created_at desc").
|
||||
Find(&batches)
|
||||
dataFileName = fmt.Sprintf("lastCall-%s-%s", excludedFilename, fileName)
|
||||
dataFileName = fmt.Sprintf("lastCall-%s", excludedFilename)
|
||||
} else {
|
||||
fileNameDate = datetime[:8]
|
||||
db.Table("batches b1").
|
||||
@ -646,7 +645,7 @@ func batchDataInsert(fileName string, lastCallKeys map[string]bool, excludedFile
|
||||
Joins("INNER JOIN (SELECT communication_channel_id, MAX(created_at) AS created_at FROM batches GROUP BY communication_channel_id) b2 ON b1.communication_channel_id = b2.communication_channel_id AND b1.created_at = b2.created_at").
|
||||
Order("b1.created_at desc").
|
||||
Find(&batches)
|
||||
dataFileName = fileName
|
||||
dataFileName = strings.Replace(fileName, "targets", "definition", -1)
|
||||
}
|
||||
|
||||
batchCount := len(batches)
|
||||
@ -660,7 +659,7 @@ func batchDataInsert(fileName string, lastCallKeys map[string]bool, excludedFile
|
||||
// 定义一个名为result的map类型的变量,并以CommunicationChannelID作为键
|
||||
result := make(map[string][]Batch)
|
||||
for _, batch := range batches {
|
||||
cckdKey := strconv.FormatUint(uint64(batch.CommunicationChannelID), 10)
|
||||
cckdKey := batch.CommunicationChannelID
|
||||
result[cckdKey] = append(result[cckdKey], batch)
|
||||
print(batch.CommunicationChannelID, "\n")
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user