zhangzengfei
2024-06-13 4151389fb92c3f1444d033c1eed0a76165799eea
repository/captureRepo.go
@@ -93,7 +93,7 @@
         // 处理梯控填写的楼层信息 暂时使用otherFeature字段
         if face.OtherFeature != "" {
            pd.CameraFloor = face.OtherFeature
            pd.CameraFloor, _ = pkg.RestoreFloor(face.OtherFeature)
         }
         // 尝试从faceId提取楼层
@@ -252,24 +252,29 @@
func (c CaptureRepository) VIIDFaceMsgForward(msg *vo.RequestFaceList) {
   faceInfo := msg.FaceListObject.FaceObject[0]
   // 匹配楼层
   faceAppearTime, err := time.ParseInLocation("20060102150405", faceInfo.FaceAppearTime, time.Local)
   if err != nil {
      logger.Warn("Parse face appear time error, %s", err.Error())
      faceAppearTime = time.Now()
   }
   var devPos models.Positions
   _ = devPos.FindPositionByTime(faceAppearTime.Unix() + 5) // 加5秒电梯关门的时间
   if devPos.Pos == "" {
      devPos.Pos = "1F"
   }
   for idx, face := range msg.FaceListObject.FaceObject {
      msg.FaceListObject.FaceObject[idx].OtherFeature = devPos.Pos
      if config.ClientConf.AddFloorToFaceId {
         msg.FaceListObject.FaceObject[idx].FaceID = pkg.GenerateFaceIdContainFloor(face.FaceID, devPos.Pos)
   // 判断是否开启了梯控
   if config.NVCSConf.Model != "" {
      // 匹配楼层
      faceAppearTime, err := time.ParseInLocation("20060102150405", faceInfo.FaceAppearTime, time.Local)
      if err != nil {
         logger.Warn("Parse face appear time error, %s", err.Error())
         faceAppearTime = time.Now()
      }
      var devPos models.Positions
      _ = devPos.FindPositionByTime(faceAppearTime.Unix() + 5) // 加5秒电梯关门的时间
      if devPos.Pos == "" {
         devPos.Pos = "1F"
      }
      for idx, face := range msg.FaceListObject.FaceObject {
         msg.FaceListObject.FaceObject[idx].OtherFeature, _ = pkg.ParseFloor(devPos.Pos)
         if config.ClientConf.AddFloorToFaceId {
            msg.FaceListObject.FaceObject[idx].FaceID = pkg.GenerateFaceIdContainFloor(face.FaceID, devPos.Pos)
         }
      }
   }
   b, _ := json.Marshal(msg)