zhangqian
2024-12-12 378445b97b115be44b25957ef71e01caae598593
模型任务处理结果保存时间
1个文件已修改
23 ■■■■■ 已修改文件
models/gather_model.go 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/gather_model.go
@@ -89,18 +89,19 @@
        return err
    }
    event := strings.Join(typeNames, ",")
    for location, persons := range aggregation {
    for lt, persons := range aggregation {
        result := &db.ModelTaskResults{
            Title:       m.Task.Name,
            Event:       fmt.Sprintf("%s/%d人", event, len(persons)),
            ModelID:     m.Task.ModelID,
            ModelTaskID: m.Task.ID,
            CommunityId: location.CommunityId,
            OrgID:       location.OrgId,
            CommunityId: lt.CommunityId,
            OrgID:       lt.OrgId,
            ObjectIds:   strings.Join(persons.Elements(), ","),
            Location:    location.Location,
            Building:    location.Building,
            Floor:       location.Floor,
            Location:    lt.Location,
            Building:    lt.Building,
            Floor:       lt.Floor,
            PicDate:     lt.Time,
        }
        results = append(results, result)
    }
@@ -344,16 +345,17 @@
    return records, nil
}
type GatherLocation struct {
type GatherLocationTime struct {
    CommunityId string
    OrgId       string
    Building    string
    Floor       string
    Location    string
    Time        string
}
func analyzeAndAggregate(records []GatherRecord) (map[GatherLocation]set.StringSet, error) {
    aggregation := make(map[GatherLocation]set.StringSet)
func analyzeAndAggregate(records []GatherRecord) (map[GatherLocationTime]set.StringSet, error) {
    aggregation := make(map[GatherLocationTime]set.StringSet)
    domainIds := set.NewStringSet()
    for _, record := range records {
        domainIds.Add(record.CommunityId)
@@ -369,12 +371,13 @@
            continue
        }
        location := GatherLocation{
        location := GatherLocationTime{
            CommunityId: record.CommunityId,
            OrgId:       record.OrgId,
            Building:    record.Building,
            Floor:       record.Floor,
            Location:    fmt.Sprintf("%s%s%s", domains[record.CommunityId].Name, record.Building, record.Floor),
            Time:        record.PicDate,
        }
        if aggregation[location] == nil {
            aggregation[location] = set.NewStringSet()