Exemplo n.º 1
0
        public string GetExternalParkingData()
        {
            Dictionary <string, string> parkings = new Dictionary <string, string>();
            List <BWYGateMapping>       gates    = BWYGateMappingServices.QueryAll();

            foreach (var item in gates)
            {
                if (!parkings.ContainsKey(item.ParkingID))
                {
                    parkings.Add(item.ParkingID, item.ParkingName);
                }
            }
            StringBuilder strTree = new StringBuilder();

            strTree.Append("[");
            strTree.Append("{\"id\":\"-1\",");
            strTree.Append("\"text\":\"所有\",\"selected\":true");
            strTree.Append("}");
            foreach (var item in parkings)
            {
                strTree.Append(",{\"id\":\"" + item.Key + "\",");
                strTree.Append("\"text\":\"" + item.Value + "\"");
                strTree.Append("}");
            }
            strTree.Append("]");
            return(strTree.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <returns></returns>
        public ActionResult Export()
        {
            List <BWYGateMapping> gates       = BWYGateMappingServices.QueryAll();
            List <OnlineOrder>    onlineOrder = OnlineOrderServices.ExportQueryPage(GetOnlineOrderCondition());
            var result = from p in onlineOrder
                         select new
            {
                订单编号   = p.OrderID.ToString(),
                车场名称   = p.PKName,
                车牌号    = p.PlateNo,
                支付金额   = p.Amount,
                续期月数   = p.OrderType == OnlineOrderType.MonthCardRecharge ? p.MonthNum.ToString() : string.Empty,
                支付人    = p.PayerNickName,
                步支付次数  = p.SyncResultTimes,
                最后同步时间 = p.LastSyncResultTime != DateTime.MinValue ? p.LastSyncResultTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                退款订单号  = p.RefundOrderId,
                订单类型   = p.OrderType.GetDescription(),
                订单状态   = p.Status.GetDescription(),
                订单时间   = p.OrderTime.ToString("yyyy-MM-dd HH:mm:ss"),
                支付时间   = p.RealPayTime != DateTime.MinValue ? p.RealPayTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                外部车场名称 = GetBWYParkingName(p.ExternalPKID, gates),
                备注     = p.Remark
            };
            StringBuilder sb = new StringBuilder();

            sb.Append(JsonHelper.GetJsonString(result));
            var dt = JsonToDataTable(sb.ToString());
            var dl = DownLoadExcel(dt);

            return(dl);
        }
Exemplo n.º 3
0
        public string GetBWYParkGateData()
        {
            JsonResult json     = new JsonResult();
            string     parkName = Request.Params["ParkName"];
            string     gateName = Request.Params["GateName"];
            int        page     = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
            int        rows     = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]);

            int?dataSource = null;
            int source     = 0;

            if (!string.IsNullOrWhiteSpace(Request.Params["DataSource"]) && int.TryParse(Request.Params["DataSource"], out source))
            {
                dataSource = source;
            }
            StringBuilder strData = new StringBuilder();

            try
            {
                int total = 0;
                List <BWYGateMapping> models = BWYGateMappingServices.QueryPage(parkName, gateName, dataSource, page, rows, out total);

                strData.Append("{");
                strData.Append("\"total\":" + total + ",");
                strData.Append("\"rows\":" + JsonHelper.GetJsonString(models) + ",");
                strData.Append("\"index\":" + page);
                strData.Append("}");
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "查询错误日志失败");
            }
            return(strData.ToString());
        }
Exemplo n.º 4
0
 public JsonResult SaveEdit(BWYGateMapping model)
 {
     try
     {
         bool result = false;
         if (string.IsNullOrWhiteSpace(model.RecordID))
         {
             model.DataSource = 0;
             result           = BWYGateMappingServices.Add(model);
             if (!result)
             {
                 throw new MyException("添加失败");
             }
             return(Json(MyResult.Success()));
         }
         else
         {
             result = BWYGateMappingServices.Update(model);
             if (!result)
             {
                 throw new MyException("修改失败");
             }
             return(Json(MyResult.Success()));
         }
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存岗亭信息失败");
         return(Json(MyResult.Error("保存岗亭信息失败")));
     }
 }
Exemplo n.º 5
0
        public static TempParkingFeeResult SFMTempParkingFeeResult(string ParkNo, string GateID)
        {
            TempParkingFeeResult result = new TempParkingFeeResult();

            result.Result    = APPResult.OtherException;
            result.ErrorDesc = "车场或通道编号未配置";

            if (!string.IsNullOrWhiteSpace(SystemDefaultConfig.SFMPKID) && !string.IsNullOrWhiteSpace(ParkNo) && !string.IsNullOrWhiteSpace(GateID))
            {
                try
                {
                    BWYGateMapping gate = BWYGateMappingServices.QueryByGateID(1, ParkNo, GateID);
                    if (gate == null)
                    {
                        result.Result    = APPResult.OtherException;
                        result.ErrorDesc = "获取车场信息失败";
                        TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,获取车场信息失败,通道编号:{0}", GateID));
                        return(result);
                    }

                    TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,SFMInterfaceUrl:{0},SFMSecretKey:{1},SFMPKID:{2}", SFMInterfaceUrl, SFMSecretKey, SFMPKID));
                    if (!string.IsNullOrWhiteSpace(SFMInterfaceUrl) && !string.IsNullOrWhiteSpace(SFMSecretKey) && !string.IsNullOrWhiteSpace(SFMPKID))
                    {
                        OutCarInfoResult sfmResult = SFMInterfaceProcess.QueryOutCarOrder(gate.ParkNo, GateID);
                        if (!sfmResult.Success)
                        {
                            result.Result    = APPResult.OtherException;
                            result.ErrorDesc = string.Format("{0}[{1}]", sfmResult.Message, sfmResult.Code);
                            return(result);
                        }
                        if (sfmResult.Data == null)
                        {
                            result.Result    = APPResult.NoCarInBox;
                            result.ErrorDesc = string.Empty;
                            return(result);
                        }
                        return(SFMTransforTempParkingFeeResult(result, sfmResult));
                    }
                }
                catch (Exception ex)
                {
                    TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,异常:{0}", ex.Message));
                }
            }
            else
            {
                TxtLogServices.WriteTxtLogEx("SFMError", string.Format("SFMTempParkingFeeResult方法,参数无效:{0},GateID:{1}", SystemDefaultConfig.SFMPKID, GateID));
            }
            return(result);
        }
Exemplo n.º 6
0
        public string GetOnlineOrderData()
        {
            StringBuilder strData = new StringBuilder();

            try
            {
                if (string.IsNullOrWhiteSpace(Request.Params["Query"]))
                {
                    return(strData.ToString());
                }
                int page = string.IsNullOrEmpty(Request.Params["page"]) ? 0 : int.Parse(Request.Params["page"]);
                int rows = string.IsNullOrEmpty(Request.Params["rows"]) ? 0 : int.Parse(Request.Params["rows"]);
                List <BWYGateMapping> gates = BWYGateMappingServices.QueryAll();
                int total = 0;
                List <OnlineOrder> result = OnlineOrderServices.QueryPage(GetOnlineOrderCondition(), page, rows, out total);
                var obj = from p in result
                          select new
                {
                    OrderID            = p.OrderID.ToString(),
                    PKName             = p.PKName,
                    PlateNo            = p.PlateNo,
                    Amount             = p.Amount,
                    MonthNum           = p.OrderType == OnlineOrderType.MonthCardRecharge ? p.MonthNum.ToString() : string.Empty,
                    PayerNickName      = p.PayerNickName,
                    SyncResultTimes    = p.SyncResultTimes,
                    LastSyncResultTime = p.LastSyncResultTime != DateTime.MinValue ? p.LastSyncResultTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                    RefundOrderId      = p.RefundOrderId,
                    Remark             = p.Remark,
                    OrderType          = (int)p.OrderType,
                    OrderTypeDes       = p.OrderType.GetDescription(),
                    Status             = (int)p.Status,
                    StatusDes          = p.Status.GetDescription(),
                    OrderTime          = p.OrderTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    RealPayTime        = p.RealPayTime != DateTime.MinValue ? p.RealPayTime.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty,
                    BWYParkingName     = GetBWYParkingName(p.ExternalPKID, gates)
                };
                strData.Append("{");
                strData.Append("\"total\":" + total + ",");
                strData.Append("\"rows\":" + JsonHelper.GetJsonString(obj) + ",");
                strData.Append("\"index\":" + page);
                strData.Append("}");
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "查询微信订单信息失败");
            }

            return(strData.ToString());
        }
Exemplo n.º 7
0
 public JsonResult Delete(string recordId)
 {
     try
     {
         bool result = BWYGateMappingServices.Delete(recordId);
         if (!result)
         {
             throw new MyException("删除失败");
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "删除信息失败");
         return(Json(MyResult.Error("删除信息失败")));
     }
 }
Exemplo n.º 8
0
 public JsonResult SaveQRCodeParkNo(BWYGateMapping model)
 {
     try
     {
         bool result = BWYGateMappingServices.UpdateParkNo(model.RecordID, model.ParkNo);
         if (!result)
         {
             throw new MyException("保存失败");
         }
         return(Json(MyResult.Success()));
     }
     catch (MyException ex)
     {
         return(Json(MyResult.Error(ex.Message)));
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "保存二维码车场编号失败");
         return(Json(MyResult.Error("保存二维码车场编号失败")));
     }
 }
Exemplo n.º 9
0
        public JsonResult DownloadQRCode(string gateId, int size)
        {
            try
            {
                List <int> dics = new List <int>();
                dics.Add(258);
                dics.Add(344);
                dics.Add(430);
                dics.Add(860);
                dics.Add(1280);

                List <string> imgs = new List <string>();

                BWYGateMapping gate = BWYGateMappingServices.QueryByRecordId(gateId);
                if (gate == null)
                {
                    throw new MyException("获取车场信息失败");
                }


                if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SystemDomain))
                {
                    throw new MyException("获取域名失败");
                }
                BaseCompany company = null;
                if (gate.DataSource == 0)
                {
                    if (string.IsNullOrWhiteSpace(SystemDefaultConfig.BWPKID))
                    {
                        throw new MyException("获取车场编号失败");
                    }
                    company = CompanyServices.QueryByParkingId(SystemDefaultConfig.BWPKID);
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(SystemDefaultConfig.SFMPKID))
                    {
                        throw new MyException("获取车场编号失败");
                    }
                    if (string.IsNullOrWhiteSpace(gate.ParkNo))
                    {
                        throw new MyException("二维码车场编号不能为空");
                    }
                    company = CompanyServices.QueryByParkingId(SystemDefaultConfig.SFMPKID);
                }
                if (company == null)
                {
                    throw new MyException("获取单位编号失败");
                }

                string content = string.Format("{0}/qrl/scio_ix_pid={1}^io={2}^source=0", SystemDefaultConfig.SystemDomain, SystemDefaultConfig.BWPKID, gate.GateID);
                if (gate.DataSource == 1)
                {
                    content = string.Format("{0}/qrl/scio_ix_pid={1}^io={2}^source=0", SystemDefaultConfig.SystemDomain, SystemDefaultConfig.SFMPKID, gate.ParkNo + "$" + gate.GateID);
                }
                foreach (var item in dics)
                {
                    string parkingName = string.Format("{0}_{1}_{2}", gate.ParkingName, gate.GateName, item);
                    string result      = QRCodeServices.GenerateQRCode(company.CPID, content, item, parkingName);
                    imgs.Add(item.ToString() + "|" + result);
                }

                return(Json(MyResult.Success("", imgs)));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "下载外部车场二维码失败");
                return(Json(MyResult.Error("下载外部车场二维码失败")));
            }
        }
Exemplo n.º 10
0
        public JsonResult ImportSFMParking()
        {
            try
            {
                SFMParkInfoResult result = SFMInterfaceProcess.GetParkInfo();
                if (result == null || !result.Success)
                {
                    throw new MyException("获取车场信息失败");
                }
                if (result.Data == null || result.Data.TotalRecord == 0 ||
                    result.Data.ResultList == null || result.Data.ResultList.Count == 0)
                {
                    throw new MyException("无车场信息");
                }

                List <BWYGateMapping> models = new List <BWYGateMapping>();
                foreach (var item in result.Data.ResultList)
                {
                    BWYGateMapping model = new BWYGateMapping();
                    model.ParkingID   = item.parkKey;
                    model.ParkingName = item.parkName;
                    model.DataSource  = 1;
                    List <ParkSentry> parkSentry = item.parkSentry;
                    if (parkSentry != null && parkSentry.Count > 0)
                    {
                        foreach (var sentry in parkSentry)
                        {
                            model.ParkBoxID   = sentry.sentryNo;
                            model.ParkBoxName = sentry.sentryName;
                            List <ParkLane> parkLanes = sentry.parkLane;
                            if (parkLanes != null)
                            {
                                foreach (var lane in parkLanes)
                                {
                                    if (lane.vehicleType != "1")
                                    {
                                        continue;
                                    }

                                    BWYGateMapping gateMap = new BWYGateMapping();

                                    gateMap.ParkingID   = model.ParkingID;
                                    gateMap.ParkingName = model.ParkingName;
                                    gateMap.DataSource  = model.DataSource;
                                    gateMap.ParkBoxID   = model.ParkBoxID;
                                    gateMap.ParkBoxName = model.ParkBoxName;

                                    gateMap.GateID   = lane.vehicleNo;
                                    gateMap.GateName = lane.vehicleName;
                                    models.Add(gateMap);
                                }
                            }
                        }
                    }
                }
                if (models.Count == 0)
                {
                    throw new MyException("请核实塞菲姆车场数据的完整性");
                }

                bool addResult = BWYGateMappingServices.UpdateSFMParking(models);
                if (!addResult)
                {
                    throw new MyException("导入塞菲姆车场信息失败");
                }
                return(Json(MyResult.Success()));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "导入塞菲姆车场信息失败");
                return(Json(MyResult.Error("导入塞菲姆车场信息失败")));
            }
        }