///// <summary> ///// 车道半小时内过的车 ///// </summary> ///// <returns></returns> //public List<VehicleInOutModel> DriveWayHalfHourCarsRecord(string drivewayguid, string carNo) //{ // List<VehicleInOutModel> result = new List<VehicleInOutModel>(); // try // { // IDatabase db = FollowRedisHelper.GetDatabase(3); //通过车道的半小时数据的db // IServer srv = FollowRedisHelper.GetCurrentServer(); // IEnumerable<RedisKey> allRecordKey = srv.Keys(3); // //改之前的 // // foreach (var RecordKey in allRecordKey) // //{ // // if (RecordKey.ToString().IndexOf(drivewayguid) > -1) // // { // // VehicleInOutModel content = m_serializer.Deserialize<VehicleInOutModel>(db.StringGet(RecordKey)); // // if (content != null) result.Add(content); // // } // //} // //llp 改为可以兼容传输多个值 // string[] sArray = drivewayguid.Split(','); // foreach (string i in sArray) // { // foreach (var RecordKey in allRecordKey) // { // if (RecordKey.ToString().IndexOf(i) > -1) // { // VehicleInOutModel content = m_serializer.Deserialize<VehicleInOutModel>(db.StringGet(RecordKey)); // if (content != null) result.Add(content); // } // } // } // if (result.Count > 0 && carNo != null) // { // result = result.FindAll(m => m.CarNo.Contains(carNo)); // } // } // catch (Exception ex) // { // result = null; // } // return result.OrderByDescending(a => a.EventTime).ToList();//降序 //} /// <summary> /// 获取某车的进场记录 /// </summary> /// <param name="carno">车牌号码</param> /// <param name="parkingCode">停车场编号</param> /// <returns></returns> public VehicleInOutModel GetEntryRecord(string carno, string parkingCode) { VehicleInOutModel result = null; try { IDatabase db = RedisHelper.GetDatabase(GetDatabaseNumber(carno)); VehicleEntryDetailModel content = m_serializer.Deserialize <VehicleEntryDetailModel>(db.HashGet(carno, parkingCode)); if (content != null) { result = new VehicleInOutModel() { Guid = content.RecordGuid, CarNo = content.CarNo, CarTypeGuid = content.CarTypeGuid, EventTime = content.BeginTime, ImgUrl = content.InImgUrl, DriveWayMAC = content.DriveWayMAC, Remark = content.Description, Entrance = content.Entrance }; } } catch (Exception ex) { } return(result); }
/// <summary> /// 被扫(用户出示微信/支付宝缴费二维码) /// </summary> public PassiveScanningResponseModel PassiveScanning(PassiveScanningModel model) { PassiveScanningResponseModel responseModel = null; if (model == null || string.IsNullOrEmpty(model.DeviceMACAddress) || string.IsNullOrEmpty(model.Guid) || string.IsNullOrEmpty(model.CarNo) || model.LaneSenseDate == null) { LastErrorDescribe = BussinessErrorCodeEnum.BUSINESS_PARAM_ERROR.GetDesc(); return(responseModel); } responseModel = new PassiveScanningResponseModel() { CarNo = model.CarNo, }; //找到对应车道 DrivewayModel drivewayModel = _parkLotManager.GetDrivewayByMacAddress(model.DeviceMACAddress); if (drivewayModel == null) { LastErrorDescribe = BussinessErrorCodeEnum.BUSINESS_NOTEXISTS_DRIVEWAY.GetDesc(); return(responseModel); } //读取车辆的在场记录并验证停车标识是否一致 VehicleInOutModel entermodel = _parkLotManager.GetEntryRecord(model.CarNo, drivewayModel.ParkCode); if (entermodel == null || entermodel.Guid != model.Guid) { LastErrorDescribe = BussinessErrorCodeEnum.BUSINESS_NOTEXISTS_CAR.GetDesc(); return(responseModel); } //请求Fujica Pay Api 发送支付授权码,申请扣费 bool result = SendAuthCodeToFujica(drivewayModel.ParkCode, entermodel.CarNo, model.ParkingFee, model.PayAuthCode); if (result) { responseModel.PayState = true; } else { responseModel.PayState = false; } responseModel.Remark = ""; responseModel.Extend = ""; return(responseModel); }
/// <summary> /// 主扫(用户扫描固定车道码缴费) /// </summary> public ActiveScanningResponseModel ActiveScanning(ActiveScanningModel model) { ActiveScanningResponseModel responseModel = null; if (model == null || string.IsNullOrEmpty(model.DeviceMACAddress) || string.IsNullOrEmpty(model.Guid) || string.IsNullOrEmpty(model.CarNo) || model.LaneSenseDate == null) { LastErrorDescribe = BussinessErrorCodeEnum.BUSINESS_PARAM_ERROR.GetDesc(); return(responseModel); } //找到对应车道 DrivewayModel drivewayModel = _parkLotManager.GetDrivewayByMacAddress(model.DeviceMACAddress); if (drivewayModel == null) { LastErrorDescribe = BussinessErrorCodeEnum.BUSINESS_NOTEXISTS_DRIVEWAY.GetDesc(); return(responseModel); } //读取车辆的在场记录并验证停车标识是否一致 VehicleInOutModel entermodel = _parkLotManager.GetEntryRecord(model.CarNo, drivewayModel.ParkCode); if (entermodel == null || entermodel.Guid != model.Guid) { LastErrorDescribe = BussinessErrorCodeEnum.BUSINESS_NOTEXISTS_CAR.GetDesc(); return(responseModel); } //请求Fujica Api 获取车道应缴费用和入场时间信息 decimal actualAmount = 0; DateTime beginTime = DateTime.MinValue; bool fujicaResult = GetLaneCostInfoByFujica(drivewayModel.ParkCode, entermodel.CarNo, drivewayModel.DeviceMacAddress, model.LaneSenseDate, out actualAmount, out beginTime); if (fujicaResult) { responseModel = new ActiveScanningResponseModel(); responseModel.CarNo = model.CarNo; responseModel.ParkingFee = actualAmount; responseModel.BeginTime = beginTime.ToString("yyyy-MM-dd HH:mm:ss"); //93+车编+车道号 responseModel.QRCode = "http://mops-test.fujica.com.cn/v2/Login/Index?key=FUJICA93" + drivewayModel.ParkCode + drivewayModel.DeviceMacAddress; //responseModel.QRCode = "http://mops.fujica.com.cn/v2/Login/Index?key=FUJICA93" + drivewayModel.ParkCode + drivewayModel.DeviceMacAddress;//项目更新发布,这里一定要改回来 responseModel.Remark = ""; responseModel.Extend = ""; } return(responseModel); }
/// <summary> /// 免费放行(人工免费=应缴费金额) /// </summary> /// <param name="parkingCode">车编</param> /// <param name="carNumber">车牌号</param> /// <param name="tolloperator">操作员</param> /// <param name="deviceIdentify">设备标识</param> /// <returns></returns> public bool FreeOpenGate(FreeOpenGateModel model) { bool falg = false; try { //判断 是否有入场数据 VehicleInOutModel entryModel = _iVehicleInOutContext.GetEntryRecord(model.CarNo, model.ParkingCode); if (entryModel != null) { //通过主平台api接口读取停车费用信息 RequestFujicaStandard requestFujica = new RequestFujicaStandard(); //请求方法 string servername = "Park/GetTempCarPaymentInfoByCarNo"; //请求参数 Dictionary <string, object> dicParam = new Dictionary <string, object>(); dicParam["ParkingCode"] = model.ParkingCode; dicParam["CarNo"] = model.CarNo; falg = requestFujica.RequestInterfaceV2(servername, dicParam); if (falg) { string fujicaResult = requestFujica.FujicaResult; if (!string.IsNullOrEmpty(fujicaResult)) { Dictionary <string, object> tempResultDic = m_serializer.Deserialize <Dictionary <string, object> >(fujicaResult); if (tempResultDic["Result"] != null) { fujicaResult = Convert.ToString(tempResultDic["Result"]); Dictionary <string, object> dicFujicaResult = null; dicFujicaResult = m_serializer.Deserialize <Dictionary <string, object> >(fujicaResult); #region 线下临时卡缴费 添加 Dictionary <string, object> dicParam2 = new Dictionary <string, object>(); string servername2 = "CalculationCost/OfflinePayV2"; //添加线下临时卡缴费 dicParam2["CarType"] = dicFujicaResult["CarType"].ToString(); dicParam2["AdmissionDate"] = Convert.ToDateTime(dicFujicaResult["BeginTime"].ToString()); // 计费开始时间 (算费接口返回的 最后一次缴费时间(如果缴费时间>1970说明有过缴费,否则就是入场时间) dicParam2["BillingStartTime"] = Convert.ToDateTime(Convert.ToDateTime(dicFujicaResult["FinalPaymentTime"].ToString()).Year > 1970 ? dicFujicaResult["FinalPaymentTime"].ToString() : dicFujicaResult["BeginTime"].ToString()); dicParam2["BillingDeadline"] = Convert.ToDateTime(dicFujicaResult["ChargeableTime"].ToString()); dicParam2["TollOperator"] = model.TolloPerator; dicParam2["PayStyle"] = PaymentTypeEnum.SP4G; //支付类型:G4车场 dicParam2["OrderType"] = OrderTypeEnum.ReadyMoney; //订单类型:现金支付 dicParam2["FreeAdmission"] = Convert.ToDecimal(dicFujicaResult["ActualAmount"].ToString()); //人工免费 dicParam2["CarNo"] = model.CarNo; dicParam2["ParkingCode"] = model.ParkingCode; dicParam2["LineRecordCode"] = dicFujicaResult["LineRecordCode"].ToString(); dicParam2["Amount"] = Convert.ToDecimal(dicFujicaResult["ParkingFee"].ToString()); dicParam2["AmountTime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); dicParam2["CouponList"] = m_serializer.Deserialize <List <CouponCalculateView> >(dicFujicaResult["CouponList"].ToString()); dicParam2["DealNo"] = "4G"; //值给4G,和小乔确认过 dicParam2["Remarks"] = model.Remark; falg = requestFujica.RequestInterfaceV2(servername2, dicParam2); #endregion falg = OpenGateToCamera(new OpenGateModel() { DeviceIdentify = model.DeviceIdentify, OpenType = OpenTypeEnum.Free, Operator = model.TolloPerator, Remark = model.Remark }, model.ParkingCode); } } } return(falg); } else { return(falg); } } catch (Exception ex) { m_logger.LogFatal(LoggerLogicEnum.Bussiness, "", model.ParkingCode, model.CarNo, "Fujica.com.cn.Business.ParkLot.CarInOutManager.FreeOpenGate", "免费开闸时发生异常", ex.ToString()); return(false); } }
///// <summary> ///// 车道半小时内过的车 ///// </summary> ///// <returns></returns> //public List<VehicleInOutModel> DriveWayHalfHourCarsRecord(string drivewayguid, string parkcode, string carNo) //{ // List<VehicleInOutModel> list = _iVehicleInOutContext.DriveWayHalfHourCarsRecord(drivewayguid, carNo); // List<CarTypeModel> content =AllCarType(parkcode); // // CarTypeModel content = AllCarType(parkcode); // foreach (var item in list) // { // CarTypeModel cartypemode = content.Where(o => o.Guid == item.CarTypeGuid).FirstOrDefault(); // item.CarTypeName = cartypemode.CarTypeName; // } // return list; //} /// <summary> /// 获取某车的进场记录 /// </summary> /// <param name="carno"></param> /// <returns></returns> public VehicleInOutModel GetEntryRecord(string carno, string parkcode) { VehicleInOutModel model = _iVehicleInOutContext.GetEntryRecord(carno, parkcode); return(model); }