From 0649f389f1b1f9fe861dda579d2469a17a438ebb Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期六, 08 二月 2025 18:38:27 +0800
Subject: [PATCH] 测试 场景分析 bug
---
models/locationAnalysis.go | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/models/locationAnalysis.go b/models/locationAnalysis.go
index 79eaf36..de0e469 100644
--- a/models/locationAnalysis.go
+++ b/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 {
--
Gitblit v1.8.0