zhangzengfei
2024-06-13 15dc6df83a839f5913997e4e2a252a0714dc2978
repository/captureRepo.go
@@ -93,7 +93,7 @@
         // 处理梯控填写的楼层信息 暂时使用otherFeature字段
         if face.OtherFeature != "" {
            pd.CameraFloor = face.OtherFeature
            pd.CameraFloor, _ = pkg.RestoreFloor(face.OtherFeature)
         }
         // 尝试从faceId提取楼层
@@ -113,7 +113,7 @@
            c.CacheData(cacheItem, "basic")
            logger.Warn("The data forwarding failed, adding to local cache.")
         } else {
            logger.Debug("The data forwarding successful. deviceId:%s, picId:", deviceId, face.FaceID)
            logger.Debug("The data forwarding successful. deviceId:%s, picId:%s", deviceId, face.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)