qixiaoning
2025-08-08 ef51da5404827e826e979ad614950a9e0192f4c6
调整数据推送相关接口
14个文件已修改
277 ■■■■■ 已修改文件
api-gateway/auth/auth.go 补丁 | 查看 | 原始文档 | blame | 历史
api-gateway/models/base.go 补丁 | 查看 | 原始文档 | blame | 历史
camera-common/models/Record.go 补丁 | 查看 | 原始文档 | blame | 历史
camera-common/models/task.go 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
camera-service/controllers/camera.go 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
camera-service/main.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
camera-service/models/milvus.go 补丁 | 查看 | 原始文档 | blame | 历史
chanmanage-service/models/camera.go 补丁 | 查看 | 原始文档 | blame | 历史
push-service/controllers/pushSet.go 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
push-service/models/eventPush.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
push-service/service/eventPushService.go 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
push-service/vo/eventPush.go 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
search-service/main.go 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
system-service/controllers/dictionary.go 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api-gateway/auth/auth.go
api-gateway/models/base.go
camera-common/models/Record.go
camera-common/models/task.go
@@ -44,3 +44,18 @@
    }
    return
}
// 查询列表数据
func GetAllTask() (items []Task, err error) {
    // 主查询SQL
    sqlStr := fmt.Sprintf(`
        SELECT task_id, task_name
        FROM  mal_smart_task
        ORDER BY task_id DESC
    `)
    if err := db.Raw(sqlStr).Scan(&items).Error; err != nil {
        fmt.Println(err.Error())
        return nil, err
    }
    return
}
camera-service/controllers/camera.go
@@ -1211,3 +1211,14 @@
    return &bhomeclient.Reply{Success: true, Msg: "获取成功", Data: tasks}
}
// 获取所有
func (cc CameraController) GetAllTasks(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply {
    //绑定json和结构体
    var tasks []models.Task
    tasks, _ = models.GetAllTask()
    return &bhomeclient.Reply{Success: true, Msg: "获取成功", Data: tasks}
}
camera-service/main.go
@@ -133,6 +133,8 @@
    //获取任务根据摄像机ids
    funcMap[urlPrefix+"/camera/getTasks"] = cc.GetTasks
    funcMap[urlPrefix+"/task/aggregateTaskList"] = cc.GetAllTasks
    var pubTopics []string
    for key, _ := range funcMap {
        pubTopics = append(pubTopics, key)
camera-service/models/milvus.go
chanmanage-service/models/camera.go
push-service/controllers/pushSet.go
@@ -1,10 +1,11 @@
package controllers
import (
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/logger.git"
    "vamicro/config"
    "vamicro/push-service/vo"
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/logger.git"
)
type PushSetController struct {
@@ -36,18 +37,32 @@
            {Checked: true, Id: "cameraAddr", Name: "摄像机地址", Alias: "cameraAddr"},
        },
    }
    sceneInfoSet := vo.PushSetMenu{
        Id:      "alarmRules", //报警规则
        Name:    "场景信息",
        Alias:   "alarmRules",
    // sceneInfoSet := vo.PushSetMenu{
    //     Id:      "alarmRules", //报警规则
    //     Name:    "场景信息",
    //     Alias:   "alarmRules",
    //     Checked: true,
    //     Children: []vo.PushSetMenu{
    //         {Checked: true, Id: "taskId", Name: "场景ID", Alias: "taskId"},
    //         {Checked: true, Id: "taskName", Name: "场景名称", Alias: "taskName"},
    //         {Checked: true, Id: "alarmRules.#.alarmLevel", Name: "事件等级", Alias: "alarmLevel"},
    //         {Checked: true, Id: "alarmRules.#.ruleText", Name: "场景描述", Alias: "groupText"},
    //         {Checked: true, Id: "alarmRules.#.linkInfo", Name: "联动信息", Alias: "linkInfo"},
    //         {Checked: true, Id: "alarmRules.#.groupId", Name: "报警规则组id", Alias: "groupId"},
    //     },
    // }
    taskInfoSet := vo.PushSetMenu{
        Id:      "aiTasks", //ai任务
        Name:    "任务信息",
        Alias:   "aiTasks",
        Checked: true,
        Children: []vo.PushSetMenu{
            {Checked: true, Id: "taskId", Name: "场景ID", Alias: "taskId"},
            {Checked: true, Id: "taskName", Name: "场景名称", Alias: "taskName"},
            {Checked: true, Id: "alarmRules.#.alarmLevel", Name: "事件等级", Alias: "alarmLevel"},
            {Checked: true, Id: "alarmRules.#.ruleText", Name: "场景描述", Alias: "groupText"},
            {Checked: true, Id: "alarmRules.#.linkInfo", Name: "联动信息", Alias: "linkInfo"},
            {Checked: true, Id: "alarmRules.#.groupId", Name: "报警规则组id", Alias: "groupId"},
            {Checked: true, Id: "taskId", Name: "任务id", Alias: "taskId"},
            {Checked: true, Id: "taskName", Name: "任务名称", Alias: "taskName"},
            {Checked: true, Id: "aiTasks.#.eventLevel", Name: "事件等级", Alias: "eventLevel"},
            {Checked: true, Id: "aiTasks.#.workingTime", Name: "时间段", Alias: "workingTime"},
            {Checked: true, Id: "aiTasks.#.rules", Name: "任务描述", Alias: "rules"},
            {Checked: true, Id: "aiTasks.#.taskDescription", Name: "备注", Alias: "taskDescription"},
        },
    }
    serverSet := vo.PushSetMenu{
@@ -87,57 +102,58 @@
            {Checked: true, Id: "isAlarm", Name: "是否报警", Alias: "isAlarm"},
        },
    }
    detectAreaSet := vo.PushSetMenu{
        Id:      "detectAreaInfo",
        Name:    "检测区域",
        Alias:   "detectAreaInfo",
        Checked: true,
        Children: []vo.PushSetMenu{
            {Checked: true, Id: "targetInfo.#.areaId", Name: "检测区域id", Alias: "areaId"},
            {Checked: true, Id: "targetInfo.#.areaName", Name: "检测区域名称", Alias: "areaName"},
        },
    }
    targetSet := vo.PushSetMenu{
        Id:      "targetInfo",
        Name:    "目标",
        Alias:   "targetInfo",
        Checked: true,
        Children: []vo.PushSetMenu{
            {Checked: true, Id: "targetInfo.#.attribute", Name: "算法属性", Alias: "attribute"},
            {Checked: true, Id: "targetInfo.#.targetLocation", Name: "目标坐标", Alias: "targetLocation"},
            {Checked: true, Id: "targetInfo.#.targetScore", Name: "目标置信度", Alias: "targetScore"},
            {Checked: true, Id: "targetInfo.#.targetType", Name: "目标类别", Alias: "targetType"},
        },
    }
    dtSet := vo.PushSetMenu{
        Id:      "tableInfo",
        Name:    "底库信息",
        Alias:   "tableInfo",
        Checked: true,
        Children: []vo.PushSetMenu{
            {Checked: true, Id: "baseInfo.#.tableId", Name: "底库ID", Alias: "tableId"},
            {Checked: true, Id: "baseInfo.#.tableName", Name: "底库名称", Alias: "tableName"},
            {Checked: true, Id: "baseInfo.#.bwType", Name: "黑白名单", Alias: "bwType"},
            {Checked: true, Id: "baseInfo.#.targetPicUrl", Name: "目标抓拍图片", Alias: "targetPicUrl"},
            {Checked: true, Id: "baseInfo.#.compareScore", Name: "相似度", Alias: "compareScore"},
            {Checked: true, Id: "baseInfo.#.content", Name: "内容", Alias: "content"},
        },
    }
    dbpInfo := vo.PushSetMenu{
        Id:      "baseInfo",
        Name:    "底库人员信息",
        Alias:   "baseInfo",
        Checked: true,
        Children: []vo.PushSetMenu{
            {Checked: true, Id: "baseInfo.#.targetId", Name: "目标ID", Alias: "targetId"},
            {Checked: true, Id: "baseInfo.#.targetName", Name: "姓名", Alias: "targetName"},
            {Checked: true, Id: "baseInfo.#.sex", Name: "性别", Alias: "sex"},
            {Checked: true, Id: "baseInfo.#.idCard", Name: "身份证号", Alias: "idCard"},
            {Checked: true, Id: "baseInfo.#.phoneNum", Name: "手机号", Alias: "phoneNum"},
            {Checked: true, Id: "baseInfo.#.monitorLevel", Name: "人员等级", Alias: "monitorLevel"},
        },
    }
    set = append(set, camInfoSet, sceneInfoSet, serverSet, dataSet, detectAreaSet, targetSet, dtSet, dbpInfo)
    // detectAreaSet := vo.PushSetMenu{
    //     Id:      "detectAreaInfo",
    //     Name:    "检测区域",
    //     Alias:   "detectAreaInfo",
    //     Checked: true,
    //     Children: []vo.PushSetMenu{
    //         {Checked: true, Id: "targetInfo.#.areaId", Name: "检测区域id", Alias: "areaId"},
    //         {Checked: true, Id: "targetInfo.#.areaName", Name: "检测区域名称", Alias: "areaName"},
    //     },
    // }
    // targetSet := vo.PushSetMenu{
    //     Id:      "targetInfo",
    //     Name:    "目标",
    //     Alias:   "targetInfo",
    //     Checked: true,
    //     Children: []vo.PushSetMenu{
    //         {Checked: true, Id: "targetInfo.#.attribute", Name: "算法属性", Alias: "attribute"},
    //         {Checked: true, Id: "targetInfo.#.targetLocation", Name: "目标坐标", Alias: "targetLocation"},
    //         {Checked: true, Id: "targetInfo.#.targetScore", Name: "目标置信度", Alias: "targetScore"},
    //         {Checked: true, Id: "targetInfo.#.targetType", Name: "目标类别", Alias: "targetType"},
    //     },
    // }
    // dtSet := vo.PushSetMenu{
    //     Id:      "tableInfo",
    //     Name:    "底库信息",
    //     Alias:   "tableInfo",
    //     Checked: true,
    //     Children: []vo.PushSetMenu{
    //         {Checked: true, Id: "baseInfo.#.tableId", Name: "底库ID", Alias: "tableId"},
    //         {Checked: true, Id: "baseInfo.#.tableName", Name: "底库名称", Alias: "tableName"},
    //         {Checked: true, Id: "baseInfo.#.bwType", Name: "黑白名单", Alias: "bwType"},
    //         {Checked: true, Id: "baseInfo.#.targetPicUrl", Name: "目标抓拍图片", Alias: "targetPicUrl"},
    //         {Checked: true, Id: "baseInfo.#.compareScore", Name: "相似度", Alias: "compareScore"},
    //         {Checked: true, Id: "baseInfo.#.content", Name: "内容", Alias: "content"},
    //     },
    // }
    // dbpInfo := vo.PushSetMenu{
    //     Id:      "baseInfo",
    //     Name:    "底库人员信息",
    //     Alias:   "baseInfo",
    //     Checked: true,
    //     Children: []vo.PushSetMenu{
    //         {Checked: true, Id: "baseInfo.#.targetId", Name: "目标ID", Alias: "targetId"},
    //         {Checked: true, Id: "baseInfo.#.targetName", Name: "姓名", Alias: "targetName"},
    //         {Checked: true, Id: "baseInfo.#.sex", Name: "性别", Alias: "sex"},
    //         {Checked: true, Id: "baseInfo.#.idCard", Name: "身份证号", Alias: "idCard"},
    //         {Checked: true, Id: "baseInfo.#.phoneNum", Name: "手机号", Alias: "phoneNum"},
    //         {Checked: true, Id: "baseInfo.#.monitorLevel", Name: "人员等级", Alias: "monitorLevel"},
    //     },
    // }
    // set = append(set, camInfoSet, sceneInfoSet, serverSet, dataSet, detectAreaSet, targetSet, dtSet, dbpInfo)
    set = append(set, camInfoSet, taskInfoSet, serverSet, dataSet)
    return &bhomeclient.Reply{Success: true, Data: set}
}
push-service/models/eventPush.go
@@ -3,6 +3,7 @@
type EventPush struct {
    Id           string `gorm:"primary_key;column:id" json:"id"`
    Name         string `gorm:"column:name" json:"name"`
    PushType     int    `gorm:"column:push_type" json:"push_type"`
    TimeStart    string `gorm:"column:time_start" json:"time_start"`
    TimeEnd      string `gorm:"column:time_end" json:"time_end"`
    IsSatisfyAll bool   `gorm:"column:is_satisfy_all" json:"is_satisfy_all"`
push-service/service/eventPushService.go
@@ -1,16 +1,17 @@
package service
import (
    "basic.com/pubsub/protomsg.git"
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/bhomedbapi.git"
    "encoding/json"
    "errors"
    "github.com/satori/go.uuid"
    "vamicro/extend/util"
    "vamicro/push-service/models"
    "vamicro/push-service/vo"
    sysModel "vamicro/system-service/models"
    "basic.com/pubsub/protomsg.git"
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/bhomedbapi.git"
    uuid "github.com/satori/go.uuid"
)
type EventPushService struct {
push-service/vo/eventPush.go
@@ -9,6 +9,7 @@
type EventPushVo struct {
    Id                 string                     `json:"id"`
    Name             string                     `json:"name"`
    PushType     int    `json:"push_type"`
    TimeStart         string                     `json:"time_start"`
    TimeEnd         string                     `json:"time_end"`
    IsSatisfyAll     bool                     `json:"is_satisfy_all"`
@@ -74,6 +75,7 @@
        IsSatisfyAll:epv.IsSatisfyAll,
        RuleText:epv.RuleText,
        Enable:epv.Enable,
        PushType:     epv.PushType,
        LinkType:epv.LinkType,
        LinkDevice:epv.LinkDevice,
        PushSet: string(d),
@@ -86,6 +88,7 @@
    epv.TimeStart = epE.TimeStart
    epv.TimeEnd = epE.TimeEnd
    epv.IsSatisfyAll = epE.IsSatisfyAll
    epv.PushType = epE.PushType
    epv.RuleText = epE.RuleText
    epv.Enable = epE.Enable
    epv.LinkType = epE.LinkType
@@ -101,7 +104,6 @@
        epv.PushSet = make([]PushSetMenu, 0)
    }
}
type KeyValueVo struct {
    Value string `json:"value"`
search-service/main.go
@@ -1,10 +1,6 @@
package main
import (
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/bhomedbapi.git"
    "basic.com/valib/logger.git"
    "basic.com/valib/version.git"
    "context"
    "flag"
    "os"
@@ -12,6 +8,11 @@
    "syscall"
    "vamicro/config"
    "vamicro/search-service/controllers"
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/bhomedbapi.git"
    "basic.com/valib/logger.git"
    vaversion "basic.com/valib/version.git"
)
var (
@@ -71,7 +72,7 @@
func initFuncMap() (map[string]bhomeclient.MicroFunc, []string) {
    funcMap := make(map[string]bhomeclient.MicroFunc)
    sc := new(controllers.EsSearchController)
    tc := new(controllers.TaskController)
    // tc := new(controllers.TaskController)
    funcMap[urlPrefix+"/dbperson/faceExtract"] = sc.FaceExtract
    funcMap[urlPrefix+"/dbperson/searchByPhoto"] = sc.SearchByPhoto
@@ -79,7 +80,7 @@
    funcMap[urlPrefix+"/es/esSearch"] = sc.PostEsSearch
    funcMap[urlPrefix+"/es/tagList"] = sc.PostEsTagList
    funcMap[urlPrefix+"/es/taskList"] = sc.PostEsTaskList
    funcMap[urlPrefix+"/task/aggregateTaskList"] = tc.AggregateTaskList
    // funcMap[urlPrefix+"/task/aggregateTaskList"] = tc.AggregateTaskList
    funcMap[urlPrefix+"/es/collect"] = sc.Collect
    funcMap[urlPrefix+"/es/deleteById"] = sc.PostEsDelete
    funcMap[urlPrefix+"/es/signMisreport"] = sc.SignMisreport
system-service/controllers/dictionary.go
@@ -8,7 +8,7 @@
    "basic.com/valib/bhomeclient.git"
    "basic.com/valib/bhomedbapi.git"
    "basic.com/valib/logger.git"
    "github.com/satori/go.uuid"
    uuid "github.com/satori/go.uuid"
)
type DictionaryController struct {
@@ -25,6 +25,7 @@
}
type DicList []DicWithChildren
func (dl DicList) Len()int {
    return len(dl)
}
@@ -70,7 +71,7 @@
    resMap := make(map[string]DicList, 0)
    wg := &sync.WaitGroup{}
    wg.Add(4)
    wg.Add(2)
    go func() {
        defer wg.Done()
        for _, dic := range allDics {
@@ -102,47 +103,47 @@
            }
        }
    }()
    //人员底库
    personTableList := make(DicList, 0)
    var tableApi bhomedbapi.DbTableApi
    go func() {
        defer wg.Done()
        personTables, dtErr := tableApi.FindAllDbTablesByType("0", "person")
        if dtErr == nil && personTables != nil {
            for idx, t := range personTables {
                dwc := DicWithChildren{}
                dwc.Dictionary = models.Dictionary{
                    Value: t.Id,
                    Name:  t.TableName,
                    Sort:  idx + 1,
                }
                personTableList = append(personTableList, dwc)
            }
        }
    }()
    // 车辆底库
    carTableList := make(DicList, 0)
    go func() {
        defer wg.Done()
        carTables, _ := tableApi.FindAllDbTablesByType("0", "car")
        if carTables != nil {
            for idx, t := range carTables {
                dwc := DicWithChildren{}
                dwc.Dictionary = models.Dictionary{
                    Value: t.Id,
                    Name:  t.TableName,
                    Sort:  idx + 1,
                }
                carTableList = append(carTableList, dwc)
            }
        }
    }()
    // //人员底库
    // personTableList := make(DicList, 0)
    // var tableApi bhomedbapi.DbTableApi
    // go func() {
    //     defer wg.Done()
    //     personTables, dtErr := tableApi.FindAllDbTablesByType("0", "person")
    //     if dtErr == nil && personTables != nil {
    //         for idx, t := range personTables {
    //             dwc := DicWithChildren{}
    //             dwc.Dictionary = models.Dictionary{
    //                 Value: t.Id,
    //                 Name:  t.TableName,
    //                 Sort:  idx + 1,
    //             }
    //             personTableList = append(personTableList, dwc)
    //         }
    //     }
    // }()
    // // 车辆底库
    // carTableList := make(DicList, 0)
    // go func() {
    //     defer wg.Done()
    //     carTables, _ := tableApi.FindAllDbTablesByType("0", "car")
    //     if carTables != nil {
    //         for idx, t := range carTables {
    //             dwc := DicWithChildren{}
    //             dwc.Dictionary = models.Dictionary{
    //                 Value: t.Id,
    //                 Name:  t.TableName,
    //                 Sort:  idx + 1,
    //             }
    //             carTableList = append(carTableList, dwc)
    //         }
    //     }
    // }()
    wg.Wait()
    resMap["time_rule"] = timeList
    resMap["compareBase"] = personTableList
    resMap["compareCarBase"] = carTableList
    // resMap["compareBase"] = personTableList
    // resMap["compareCarBase"] = carTableList
    for k, dList := range resMap {
        v := dList
@@ -187,7 +188,6 @@
        return &bhomeclient.Reply{ Msg: "查询失败"}
    }
}
// @Summary 根据type查找字典列表
// @Description  根据type查找字典列表