| | |
| | | } |
| | | 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 |
| | | } |
| | |
| | | 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} |
| | | |
| | | } |
| | |
| | | //获取任务根据摄像机ids |
| | | funcMap[urlPrefix+"/camera/getTasks"] = cc.GetTasks |
| | | |
| | | funcMap[urlPrefix+"/task/aggregateTaskList"] = cc.GetAllTasks |
| | | |
| | | var pubTopics []string |
| | | for key, _ := range funcMap { |
| | | pubTopics = append(pubTopics, key) |
| | |
| | | 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 { |
| | |
| | | {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{ |
| | |
| | | {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} |
| | | } |
| | |
| | | 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"` |
| | |
| | | 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 { |
| | |
| | | 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"` |
| | |
| | | IsSatisfyAll:epv.IsSatisfyAll, |
| | | RuleText:epv.RuleText, |
| | | Enable:epv.Enable, |
| | | PushType: epv.PushType, |
| | | LinkType:epv.LinkType, |
| | | LinkDevice:epv.LinkDevice, |
| | | PushSet: string(d), |
| | |
| | | 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 |
| | |
| | | epv.PushSet = make([]PushSetMenu, 0) |
| | | } |
| | | } |
| | | |
| | | |
| | | type KeyValueVo struct { |
| | | Value string `json:"value"` |
| | |
| | | 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" |
| | |
| | | "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 ( |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | "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 { |
| | |
| | | } |
| | | |
| | | type DicList []DicWithChildren |
| | | |
| | | func (dl DicList) Len()int { |
| | | return len(dl) |
| | | } |
| | |
| | | resMap := make(map[string]DicList, 0) |
| | | |
| | | wg := &sync.WaitGroup{} |
| | | wg.Add(4) |
| | | wg.Add(2) |
| | | go func() { |
| | | defer wg.Done() |
| | | for _, dic := range allDics { |
| | |
| | | } |
| | | } |
| | | }() |
| | | //人员底库 |
| | | 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 |
| | |
| | | return &bhomeclient.Reply{ Msg: "查询失败"} |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Summary 根据type查找字典列表 |
| | | // @Description 根据type查找字典列表 |