private void Process(string fileName, FacilityCameraDto cam) { try { var preset = _facilityCameraPresetPoinService.GetByCameraId(cam.Serialnum);//根据摄像机编码获取摄像机预置点信息(一个摄像机只能有一个预置点???) PictureRepDto pic = new PictureRepDto { Serialnum = Guid.NewGuid().ToString(), Type = "Facility", Title = DateTime.Now.ToString(CultureInfo.InvariantCulture), Description = "", Url = Path.Combine(_companyPicsPath, fileName), Href = "company-pics" + fileName.Replace(_companyPicsPath, "").Replace("\\", "/"), CreateTime = DateTime.Now }; //RedisClient.Sadd("PicsRep-LIST", pic,DataType.Protobuf); _pictureRepService.Add(pic); if (preset != null) { FacilityPicsDto fp = new FacilityPicsDto { Serialnum = Guid.NewGuid().ToString(), FacilityCameraPresetSerialnum = preset.Serialnum, FacilitySerialnum = cam.FacilitySerialnum, PicSerialnum = pic.Serialnum, CreateTime = DateTime.Now }; //RedisClient.Sadd("FacilityPics-LIST", fp, DataType.Protobuf); _facilityPicsRepService.Add(fp); } } catch (Exception ex) { throw; } }
/// <summary> /// 处理文件及记录 /// </summary> /// <param name="fileName"></param> /// <param name="station"></param> private async void Process(string fileName, CameraStationPresetPointDto preset) { //图片记录 PictureRepDto pic = new PictureRepDto(); pic.Serialnum = Guid.NewGuid().ToString(); pic.Type = "CameraStation"; pic.Title = DateTime.Now.ToString(CultureInfo.InvariantCulture); pic.Description = ""; pic.Url = Path.Combine(_picsPath, fileName); pic.Href = "CameraStation-pics" + fileName.Replace(_picsPath, "").Replace("\\", "/"); pic.CreateTime = DateTime.Now; await _pictureRepService.AddAsync(pic); //映射关系 CameraStationPicsDto fp = new CameraStationPicsDto(); fp.Serialnum = Guid.NewGuid().ToString(); fp.CameraStationsPresetSerialnum = preset.Serialnum;//预置点编码??? fp.PicSerialnum = pic.Serialnum; fp.CreateTime = DateTime.Now; await _cameraStationPicsService.AddAsny(fp); }