| | |
| | | // 拿到本摄像机的区域 |
| | | cameraPolygons := GetPolygons(args.CameraId) |
| | | // 把所有的sdk提取的数据都按所属摄像机的区域归置 |
| | | logger.Debug("当前摄像机id为:",message.Cid,"当前摄像机执行的任务是:",message.Tasklab.Taskname) |
| | | for _, arg := range args.Sdkdata { |
| | | SdkDataFormat(args.CameraId, arg, cameraPolygons) |
| | | } |
| | |
| | | args.RuleResult = make(map[string]interface{}) |
| | | args.RuleResult["yolo"] = []Result{} |
| | | args.RuleResult["face"] = []Arg{} |
| | | for _, group := range taskGroup.GroupRules { |
| | | //logger.Println("------------------------------任务规则:",taskRule) |
| | | taskId := taskGroup.TaskId |
| | | //logger.Println("------------本组任务下的规则组的数量:",len(ruleList)) |
| | | temp := group.Rules // temp为一组完整规则 在此需要判断规则是否是联动规则 |
| | | if len(temp) > 0 { |
| | | if group.SetType == "linkTask" { |
| | | // groupId中含有link则为联动任务 |
| | | LinkTask(args, group, taskId, message) |
| | | } else { |
| | | // 独立任务的处理 |
| | | RunRule(args, group, taskId, message) |
| | | if taskGroup != nil && len(taskGroup.GroupRules) > 0 { |
| | | for _, group := range taskGroup.GroupRules { |
| | | //logger.Println("------------------------------任务规则:",taskRule) |
| | | taskId := taskGroup.TaskId |
| | | //logger.Println("------------本组任务下的规则组的数量:",len(ruleList)) |
| | | temp := group.Rules // temp为一组完整规则 在此需要判断规则是否是联动规则 |
| | | if len(temp) > 0 { |
| | | if group.SetType == "linkTask" { |
| | | // groupId中含有link则为联动任务 |
| | | LinkTask(args, group, taskId, message) |
| | | } else { |
| | | // 独立任务的处理 |
| | | RunRule(args, group, taskId, message) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | if completeFormula != "" { |
| | | logger.Info("结果公式-----------:", completeFormula) |
| | | expression, _ := govaluate.NewEvaluableExpression(completeFormula) |
| | | if strings.HasPrefix(completeFormula, "&&") || strings.HasPrefix(completeFormula, "||") { |
| | | expression, err := govaluate.NewEvaluableExpression(completeFormula) |
| | | if strings.HasPrefix(completeFormula, "&&") || strings.HasPrefix(completeFormula, "||") || err != nil{ |
| | | panic("规则有误,得到的数学公式不可解析") |
| | | } |
| | | result, _ := expression.Evaluate(nil) // 得到数学公式的结果 |