| | |
| | | |
| | | type RealTimeController struct{} |
| | | |
| | | type RealTimeArg struct { |
| | | TreeNodes []string `json:"treeNodes"` |
| | | } |
| | | |
| | | // @Summary 实时抓拍 |
| | | // @Description 实时抓拍数据 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags realTime |
| | | // @Param obj body map true "底库数据" |
| | | // @Param obj body controllers.RealTimeArg true "底库数据" |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Router /data/api-v/realTime/capture [POST] |
| | | //实时抓拍 |
| | | func (rc *RealTimeController) PostCapture(c *gin.Context) { |
| | | searchBody := make(map[string]interface{}, 0) |
| | | |
| | | var searchBody RealTimeArg |
| | | c.BindJSON(&searchBody) |
| | | index := config.EsInfo.EsIndex.VideoPersons.IndexName + "," + config.EsInfo.EsIndex.Personaction.IndexName |
| | | cameraIdStr := "" |
| | | cameraId := searchBody["treeNodes"].([]interface{}) |
| | | cameraId := searchBody.TreeNodes |
| | | if cameraId != nil && len(cameraId) > 0 { |
| | | esCameraId := strings.Replace(strings.Trim(fmt.Sprint(cameraId), "[]"), " ", "\",\"", -1) |
| | | cameraIdStr = "{\"terms\":{\"cameraId\":[\"" + esCameraId + "\"]}}," |
| | |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param obj body models.Dbtablepersons true "底库人员数据" |
| | | // @Success 200 {object} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Failure 400 {object} json code.RequestParamError |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Router /data/api-v/dbperson/addDbPerson [PUT] |
| | | func (dbc DbPersonController) AddDbPerson(c *gin.Context) { |
| | | dbperson := new(models.Dbtablepersons) |
| | |
| | | } |
| | | } |
| | | |
| | | type DelMultiPerson []string |
| | | |
| | | // @Summary 删除底库人员 |
| | | // @Description 删除库人员 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param uuids body []string true "底库人员ids " |
| | | // @Param uuids body controllers.DelMultiPerson true "底库人员ids " |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Router /data/api-v/dbperson/deleteMoreDbPerson [POST] |
| | | func (dbc DbPersonController) DeleteMoreDbPerson(c *gin.Context) { |
| | | uuids := make([]string, 0, 5) |
| | | var uuids DelMultiPerson |
| | | err := c.BindJSON(&uuids) |
| | | if err !=nil || len(uuids)==0{ |
| | | util.ResponseFormat(c,code.RequestParamError,"参数有误") |
| | | return |
| | | } |
| | | logger.Debug("DeleteMoreDbPerson len(uuids):",len(uuids)) |
| | | var pApi dbapi.DbPersonApi |
| | | paramBody := util.Struct2Map(uuids) |
| | | b, _ := pApi.DeleteMoreDbPerson(paramBody) |
| | |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param reqMap body map false "{"tableId":"","orderName":"uuid","orderType":"desc","contentValue":"","page":1,"size":8}" |
| | | // @Param reqMap body controllers.DbtSearch false "{"tableId":"","orderName":"id","orderType":"desc","contentValue":"","page":1,"size":8}" |
| | | // @Success 200 {string} json "{"code":200, "msg":"目录结构数据", "success":true,"data":{}}" |
| | | // @Failure 500 {string} json "{code:500, msg:"返回错误信息", success:false,data:{}}" |
| | | // @Router /data/api-v/dbperson/queryDbPersonsByTbId [POST] |
| | | func (dbc DbPersonController) QueryDbPersonsByTbId(c *gin.Context) { |
| | | reqBody := make(map[string]interface{}, 5) |
| | | c.BindJSON(&reqBody) |
| | | tableId := "" |
| | | if reqBody["tableId"] != nil { |
| | | tableId = reqBody["tableId"].(string) |
| | | //reqBody := make(map[string]interface{}, 5) |
| | | var reqBody DbtSearch |
| | | err := c.BindJSON(&reqBody) |
| | | if err !=nil || reqBody.Page <=0 || reqBody.Size <=0 { |
| | | util.ResponseFormat(c,code.RequestParamError,"参数有误") |
| | | return |
| | | } |
| | | if tableId == "" { |
| | | |
| | | if reqBody.TableId == "" { |
| | | util.ResponseFormat(c,code.RequestParamError,"参数有误,底库id不能为空") |
| | | return |
| | | } |
| | | orderName := "id" |
| | | if reqBody["orderName"] != nil { |
| | | orderName = reqBody["orderName"].(string) |
| | | if reqBody.OrderName != "" { |
| | | orderName = reqBody.OrderName |
| | | } // 列名 |
| | | orderType := "desc" |
| | | if reqBody["orderType"] != nil { |
| | | orderType = reqBody["orderType"].(string) |
| | | if reqBody.OrderType != "" { |
| | | orderType = reqBody.OrderType |
| | | } // 列类型 |
| | | contentValue := "" |
| | | if reqBody["contentValue"] != nil { |
| | | contentValue = reqBody["contentValue"].(string) |
| | | } //输入框内容 |
| | | |
| | | page := 1 |
| | | if reqBody["page"] != nil { |
| | | page = int(reqBody["page"].(float64)) |
| | | if reqBody.Page >1 { |
| | | page = reqBody.Page |
| | | } // 页码 |
| | | size := 8 |
| | | if reqBody["size"] != nil { |
| | | size = int(reqBody["size"].(float64)) |
| | | if reqBody.Size >8 { |
| | | size = reqBody.Size |
| | | } // 条数 |
| | | |
| | | if tableId == "all" || tableId == "" { |
| | | // / 所有人员 |
| | | } |
| | | |
| | | if orderType == "desc" { |
| | | orderType = "desc" |
| | |
| | | } |
| | | var pApi dbapi.DbPersonApi |
| | | paramBody := map[string]interface{}{ |
| | | "tableId":tableId, |
| | | "tableId": reqBody.TableId, |
| | | "orderName":orderName, |
| | | "orderType":orderType, |
| | | "contentValue":contentValue, |
| | |
| | | } |
| | | } |
| | | |
| | | type DbtSearch struct { |
| | | TableId string `json:"tableId"` |
| | | OrderName string `json:"orderName"` |
| | | OrderType string `json:"orderType"` |
| | | ContentValue string `json:"contentValue"` |
| | | Page int `json:"page"` |
| | | Size int `json:"size"` |
| | | } |
| | | |
| | | /* |
| | | // @Summary 查询底库人员列表 |
| | | // @Description 查询库人员列表 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param reqMap body map false "{"tableId":"","orderName":"uuid","orderType":"desc","contentValue":"","page":1,"size":8}" |
| | | // @Success 200 {string} json "{"code":200, "msg":"目录结构数据", "success":true,"data":{}}" |
| | | // @Failure 500 {string} json "{code:500, msg:"返回错误信息", success:false,data:{}}" |
| | | // @Param reqMap body controllers.DbtSearch false "{"tableId":"","orderName":"id","orderType":"desc","contentValue":"","page":1,"size":8}" |
| | | // @Success 200 {string} json "{"code":200, "msg":"", "success":true,"data":{}}" |
| | | // @Failure 500 {string} json "{code:500, msg:"", success:false,data:{}}" |
| | | // @Router /data/api-v/dbperson/queryDbPersonsByCampare [POST] |
| | | func (dbc DbPersonController) QueryDbPersonsByCampare(c *gin.Context) { |
| | | url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + |
| | | "/" + config.EsInfo.EsIndex.Dbtablepersons.IndexName + "/_search" // ?refresh=wait_for |
| | | reqBody := make(map[string]interface{}, 5) |
| | | var reqBody DbtSearch |
| | | c.BindJSON(&reqBody) |
| | | tableId := "" |
| | | if reqBody["tableId"] != nil { |
| | | tableId = reqBody["tableId"].(string) |
| | | if reqBody.TableId != "" { |
| | | tableId = reqBody.TableId |
| | | } |
| | | orderName := "_id" |
| | | if reqBody["orderName"] != nil { |
| | | orderName = reqBody["orderName"].(string) |
| | | if reqBody.OrderName != "" { |
| | | orderName = reqBody.OrderName |
| | | } // 列名 |
| | | orderType := "desc" |
| | | if reqBody["orderType"] != nil { |
| | | orderType = reqBody["orderType"].(string) |
| | | if reqBody.OrderType != "" { |
| | | orderType = reqBody.OrderType |
| | | } // 列类型 |
| | | faceUrl := "" |
| | | var threshold float32 |
| | |
| | | data := esutil.GetEsDataReq(url, params, true) |
| | | featByte := make([]byte, 0, 1024) |
| | | if len(faceUrl) > 3 { // linux |
| | | /*fileName := picUrl // picIp 定义在 fileController weedfs 文件服务器 访问 路径 前缀 |
| | | detect := gorun.GetSimpleFaceDetect(fileName) |
| | | if len(detect) != 1 { |
| | | util.ResponseFormat(c,code.TooManyFeatureFindError,"图片特征值过多") |
| | | return |
| | | }else { |
| | | featByte = detect[0]["feature"].([]byte) |
| | | }*/ // linux |
| | | |
| | | } |
| | | to := page * size |
| | | datalist := sourceCompare(data["datalist"].([]interface{}), false, featByte, threshold) |
| | |
| | | data["total"] = len(datalist) |
| | | //c.JSON(200, data) |
| | | util.ResponseFormat(c, code.Success, data) |
| | | } |
| | | }*/ |
| | |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags realTime |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Param obj body controllers.RealTimeArg false "抓拍实时图初始化参数" |
| | | // @Success 200 {string} json "{"code":200, msg:"", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"", success:false}" |
| | | // @Router /data/api-v/realTime/initForCaptureData [POST] |
| | | //实时抓拍数据初始化 |
| | | func (rc *RealTimeController) InitForCaptureData(c *gin.Context) { |
| | | searchBody := make(map[string]interface{}, 0) |
| | | //searchBody := make(map[string]interface{}, 0) |
| | | var searchBody RealTimeArg |
| | | c.BindJSON(&searchBody) |
| | | index := config.EsInfo.EsIndex.VideoPersons.IndexName + "," + config.EsInfo.EsIndex.Personaction.IndexName |
| | | url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + |
| | | "/" + index + "/_search" |
| | | cameraIdStr := "" |
| | | if searchBody["treeNodes"] !=nil { |
| | | cameraId := searchBody["treeNodes"].([]interface{}) |
| | | if searchBody.TreeNodes !=nil { |
| | | cameraId := searchBody.TreeNodes |
| | | if cameraId != nil && len(cameraId) > 0 { |
| | | esCameraId := strings.Replace(strings.Trim(fmt.Sprint(cameraId), "[]"), " ", "\",\"", -1) |
| | | cameraIdStr = "{\"terms\":{\"cameraId\":[\"" + esCameraId + "\"]}}," |
| | |
| | | util.ResponseFormat(c, code.Success, tokenRes) |
| | | } |
| | | |
| | | type InitForMonitorArg struct { |
| | | TreeNodes []string `json:"treeNodes"` |
| | | Tasks []string `json:"tasks"` |
| | | } |
| | | |
| | | // @Summary 实时任务监控数据初始化 |
| | | // @Description 实时监控比对数据 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags realTime |
| | | // @Param obj body map true "底库数据" |
| | | // @Param obj body controllers.InitForMonitorArg true "实时任务监控参数" |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Router /data/api-v/realTime/initForMonitoringData [POST] |
| | | //实时监控数据初始化 |
| | | func (rc *RealTimeController) InitForMonitoringData(c *gin.Context) { |
| | | searchBody := make(map[string]interface{}, 0) |
| | | |
| | | //searchBody := make(map[string]interface{}, 0) |
| | | var searchBody InitForMonitorArg |
| | | c.BindJSON(&searchBody) |
| | | index := config.EsInfo.EsIndex.VideoPersons.IndexName + "," + config.EsInfo.EsIndex.Personaction.IndexName |
| | | cameraIdStr := "" |
| | | cameraId := searchBody["treeNodes"].([]interface{}) |
| | | cameraId := searchBody.TreeNodes |
| | | if cameraId != nil && len(cameraId) > 0 { |
| | | esCameraId := strings.Replace(strings.Trim(fmt.Sprint(cameraId), "[]"), " ", "\",\"", -1) |
| | | cameraIdStr = "{\"terms\":{\"cameraId\":[\"" + esCameraId + "\"]}}," |
| | | } |
| | | //判断任务ID |
| | | taskIdStr := "{\"terms\":{\"taskId\":[]}}," |
| | | taskId := searchBody["tasks"].([]interface{}) |
| | | taskId := searchBody.Tasks |
| | | if taskId != nil && len(taskId) > 0 { |
| | | esTaskId := strings.Replace(strings.Trim(fmt.Sprint(taskId), "[]"), " ", "\",\"", -1) |
| | | taskIdStr = "{\"terms\":{\"taskId\":[\"" + esTaskId + "\"]}}," |
| | |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags realTime |
| | | // @Param obj body map true "底库数据" |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Param obj body controllers.InitForMonitorArg true "实时监控参数" |
| | | // @Success 200 {string} json "{"code":200, msg:"", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"", success:false}" |
| | | // @Router /data/api-v/realTime/monitoring [POST] |
| | | //实时监控 |
| | | func (rc *RealTimeController) PostMonitoring(c *gin.Context) { |
| | | searchBody := make(map[string]interface{}, 0) |
| | | //searchBody := make(map[string]interface{}, 0) |
| | | var searchBody InitForMonitorArg |
| | | |
| | | c.BindJSON(&searchBody) |
| | | index := config.EsInfo.EsIndex.VideoPersons.IndexName + "," + config.EsInfo.EsIndex.Personaction.IndexName |
| | | cameraIdStr := "" |
| | | cameraId := searchBody["treeNodes"].([]interface{}) |
| | | cameraId := searchBody.TreeNodes |
| | | if cameraId != nil && len(cameraId) > 0 { |
| | | esCameraId := strings.Replace(strings.Trim(fmt.Sprint(cameraId), "[]"), " ", "\",\"", -1) |
| | | cameraIdStr = "{\"terms\":{\"cameraId\":[\"" + esCameraId + "\"]}}," |
| | | } |
| | | //判断任务ID |
| | | taskIdStr := "{\"terms\":{\"taskId\":[]}}," |
| | | taskId := searchBody["tasks"].([]interface{}) |
| | | taskId := searchBody.Tasks |
| | | if taskId != nil && len(taskId) > 0 { |
| | | esTaskId := strings.Replace(strings.Trim(fmt.Sprint(taskId), "[]"), " ", "\",\"", -1) |
| | | taskIdStr = "{\"terms\":{\"taskId\":[\"" + esTaskId + "\"]}}," |