zhaoqingang
2025-02-08 0649f389f1b1f9fe861dda579d2469a17a438ebb
测试 场景分析 bug
1个文件已修改
17 ■■■■ 已修改文件
models/locationAnalysis.go 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/locationAnalysis.go
@@ -28,6 +28,7 @@
    KeyPersonType  string       // 人员类型
    PersonLabel    string       // 人员标签
    PersonIdentity []string     // 人员身份
    KeyTypes       []string     // 人员身份
    Duration       int          // 时间范围
    Appearances    int          // 出现次数,
    StartTime      int          // 时间范围, 开始时间
@@ -54,10 +55,14 @@
    m.Building = task.Building
    m.AlarmType = task.AlarmType
    m.PersonIdentity = []string{"stranger", "visitor", "resident"} //task.IdentityType
    m.KeyTypes = []string{"1", "2", "3", "4", "5"}                 //task.IdentityType
    m.KeyPersonType = task.PersonType
    m.PersonLabel = task.PersonLabel
    if task.IdentityType != "" {
        m.PersonIdentity = strings.Split(task.IdentityType, ",")
    }
    if task.PersonType != "" {
        m.KeyTypes = strings.Split(task.PersonType, ",")
    }
    if len(m.AreaIds) == 0 {
@@ -185,13 +190,11 @@
    document_number_list = []string{}
    for _, i := range labelFilter {
        document_number_list = append(document_number_list, i.Id)
    }
    if m.KeyPersonType != "" {
        keyTypes := strings.Split(m.KeyPersonType, ",")
    if len(m.KeyTypes) > 0 {
        //keyTypes := strings.Split(m.KeyPersonType, ",")
        err := db.GetDB().Raw(`
        SELECT
            p.id,
@@ -202,17 +205,15 @@
        WHERE
            p.id IN ?
            AND k.person_type IN ?
        `, document_number_list, keyTypes).Scan(&keyFilter).Error
        `, document_number_list, m.KeyTypes).Scan(&keyFilter).Error
        if err != nil {
            logger.Warnf(err.Error())
        }
        if len(keyFilter) == 0 {
            return fmt.Errorf("no results found that match the key condition %s", m.KeyPersonType)
            return fmt.Errorf("no results found that match the key condition%s------ %s", document_number_list, m.KeyTypes)
        }
        logger.Debugf("task %s match key person result %d", m.Task.Name, len(keyFilter))
    }
    logger.Debugf("task %s last result %d", m.Task.Name, len(lastFilter))
    document_number_list = []string{}
    for _, i := range keyFilter {