using Ninject; using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Text; using WX.CRM.BLL.Util; using WX.CRM.Common; using WX.CRM.IBLL.Util; using WX.CRM.WebHelper; using WX.CRM.WebHelper.Infrastructure; namespace WX.CRM.WEB.ViewModel.Level2 { #region L2接口Json序列化数据 /// /// L2订单信息 /// [Serializable] public class Soft_OrderDetail { [DisplayName("订单号:")] public decimal ORDERID { get; set; }//模块id [DisplayName("子类产品id:")] public decimal PRODUCTID { get; set; }//子类产品Id [DisplayName("子类代码:")] public string PRODUCTCODE { get; set; }//子类代码 [DisplayName("大类代码:")] public string BIGPRODUCTCODE { get; set; }//大类代码 [DisplayName("渠道:")] public string CHANNEL { get; set; }//渠道 [DisplayName("客户ID:")] public string L2RESID { get; set; }//客户ID [DisplayName("套数:")] public Nullable BOOKNUM { get; set; }//套数 [DisplayName("开通天数:")] public decimal TOTALDAYS { get; set; }//开通天数 [DisplayName("总金额:")] public decimal TOTALPRICE { get; set; }//总金额 [DisplayName("手机App用户名:")] public string USERNAME { get; set; }//手机app用户名 [DisplayName("pc用户名:")] public string PcUserName { get; set; }//Pc用户名 [DisplayName("订单状态:")] public decimal ORDERSTATUS { get; set; }//订单状态 :新订单180、已开通220、已取消70 public decimal ORDERSOURCE { get; set; }//订单来源:1营业部座席订单、2网站接口订单 public string OPENUSER { get; set; }//开通用户(网上支付开通传用户名,营业部手工开通传营业部编码-工号) [DisplayName("开通时间:")] public Nullable OTIME { get; set; }//开通时间 public Nullable OPENTYPE { get; set; }//开通方式:1营业部客服工通、2网上支付开通 public string CANCELUSER { get; set; }//撤销用户(营业部编码-工号) public Nullable CANCELTIME { get; set; }//撤销时间 public Nullable COMPANYID { get; set; }//归属公司(用户所属营业部) public string CREATEUSER { get; set; }//创建用户 public System.DateTime CTIME { get; set; }//创建时间 [DisplayName("支付状态:")] public Nullable ISPAYED { get; set; }//支付状态 [DisplayName("开通状态:")] public Nullable ISOPEN { get; set; }//开通状态 public Nullable ISREFUND { get; set; }//退款状态 public List orderModule { get; set; } public List orderExt { get; set; } public List orderWebPay { get; set; } } /// /// L2订单模块 /// [Serializable] public class Soft_OrderModule { public decimal MODULEID { get; set; }//模块id } public class Soft_OrderSt { public string PayDate { get; set; } /// /// 产品大类Code /// public string ProductCode { get; set; } public string ProductName { get; set; } public decimal RegCampainid { get; set; } public decimal CountOrder { get; set; } public decimal SumPaytotal { get; set; } } /// /// L2订单支付 /// [Serializable] public class Soft_OrderWebPay { public string WEBPAYID { get; set; }//支付流水号 public decimal PAYTYPE { get; set; }//支付方式 public decimal PAYTOTAL { get; set; }//支付金额 } [Serializable] public class Soft_OtderExtend { public string USERCAMPAINID { get; set; }//用户的注册渠道 public string RESOURCETAG { get; set; }//引导下单的活动标签 public string FULLNAME { get; set; }//用户姓名 public string MOBILE { get; set; }//联系手机 public string CARDID { get; set; }//用户身份证 public string EMAIL { get; set; }//用户邮箱 public string ADDRESS { get; set; }//用户地址 public string MEMO { get; set; }//订单备注 public string IP { get; set; }//IP } /// /// 支付列表 /// public class Soft_OrderWebPayList { public decimal ORDERID { get; set; } public string USERNAME { get; set; } public decimal? RegCampainid { get; set; } public string PcUserName { get; set; }//Pc用户名 public string PRODUCTCODE { get; set; } public string BIGPRODUCTCODE { get; set; } public string WEBPAYID { get; set; } public decimal PAYTOTAL { get; set; } public decimal PAYTYPE { get; set; } public string PAYMEMO { get; set; } public System.DateTime CTIME { get; set; } } #endregion #region L2接口参数 #region 互踢 public class SOFT_USERHTDATA { public decimal PKID { get; set; } public string USERNAME { get; set; } public Nullable CTIME { get; set; } } /// /// 修改互踢的model /// public class HtModel { [DisplayName("用户名:")] [Required(ErrorMessage = "用户名不能为空")] public string userName { get; set; } [DisplayName("是否禁止互踢:")] public string u { get; set; } } /// /// 互踢modlelist /// public class GetHtModelList { public string username { get; set; } public int pageIndex { get; set; } public int pageSize { get; set; } } /// /// 用户互踢getHtList /// public class Soft_CRMUserKickedModel { public int pageIndex { get; private set; } public int pageSize { get; private set; } public string username { get; private set; } public Soft_CRMUserKickedModel(string username, int pageIndex, int pageSize) { this.username = username; this.pageIndex = pageIndex; this.pageSize = pageSize; } /// /// 获取接用户是否禁止互踢的列表 /// /// /// /// public List GetHtList(out string msg, out int total, string apllay = "getHtList") { msg = ""; total = 0; GetHtModelList htmodel = new GetHtModelList(); htmodel.username = this.username; htmodel.pageIndex = this.pageIndex; htmodel.pageSize = this.pageSize; returnResult result = getResult(apllay, htmodel); List _orderDetail = new List(); if (result.result) { total = result.total; _orderDetail = Utility.JSONToObject>(result.retMessage); } else { msg = "接口数据:" + result.retMessage; } return _orderDetail; } private returnResult getResult(string apllay, GetHtModelList Htmodel) { string json = Utility.ObjectToJsonAndConvertTime(Htmodel); string url = Utility.GetSettingByKey("L2Order") + apllay; ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get(); string key = sHelper.createSignEncodingStr(json, SecurityHelper.OrderClientIdKey); string response = Utility.PostData(url + "?" + key, Encoding.UTF8); string _retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, response); returnResult result = Utility.JSONToObject(_retmsg); return result; } } /// /// 修改互踢 modHt /// public class Soft_CRMOperationKickedmodel { public bool UpdateHt(HtModel model) { returnResult result = UpdateHtResult(model); return result.result; } /// /// 修改互踢 /// /// /// private returnResult UpdateHtResult(HtModel model, string apllay = "modHt") { string json = Utility.ConvertToJSON(model); string url = Utility.GetSettingByKey("L2Order") + apllay; ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get(); string key = sHelper.createSignEncodingStr(json, SecurityHelper.OrderClientIdKey); string response = Utility.PostData(url + "?" + key, Encoding.UTF8); string _retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, response); returnResult result = Utility.JSONToObject(_retmsg); return result; } } #endregion #region 密码重置 public class CrmRetPass { public string UserName { get; set; } public string mobile { get; set; } } public class Soft_CRMRetPwd { public returnResult Retpaw(string uname, string mobile) { CrmRetPass rp = new CrmRetPass(); rp.UserName = uname; rp.mobile = mobile; return UpdateRPResult(rp); } private returnResult UpdateRPResult(CrmRetPass rp) { string json = Utility.ConvertToJSON(rp); string url = Utility.GetSettingByKey("jrzdCrmRetpwd"); ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get(); //string key = sHelper.createSignEncodingStr2(json); string key = sHelper.createSignEncodingStr2(json, SecurityHelper.OrderClientIdKey); string response = Utility.PostData(url + "?" + key, Encoding.UTF8); string _retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, response); returnResult result = Utility.JSONToObject(_retmsg); return result; } } #endregion /// /// 退款申请 /// [Serializable] public class Soft_RefundOrder { [Required(ErrorMessage = "订单号不能为空")] public string org_orderid { get; set; } [Required(ErrorMessage = "用户名不能为空")] public string org_username { get; set; } } /// /// 获取订单信息 /// public class Soft_CRMOrderModel { public int pageIndex { get; private set; } public int pageSize { get; private set; } public decimal companyId { get; private set; } public string bigproductCode { get; private set; } public string productCode { get; private set; } public string username { get; private set; } public decimal orderid { get; private set; } public Nullable isOpen { get; private set; } public Nullable stime { get; private set; } public Nullable etime { get; private set; } public Nullable openstime { get; private set; } public Nullable openetime { get; private set; } public string resid { get; private set; } public string payno { get; private set; } //注册渠道号 public decimal? regCampainid { get; set; } public Soft_CRMOrderModel(string orderid) : this(orderid, "") { } public Soft_CRMOrderModel(string orderid, string username) : this(orderid, username, 1, 1000) { } public Soft_CRMOrderModel(string orderid, string username, int pageindex, int pagesize) : this("", "", "", username, orderid, "", "", "", "", "", "", pageindex, pagesize) { } public Soft_CRMOrderModel(string payno, bool ispay) : this("", "", "", "", "", "", "", "", "", "", "", payno, 1, 1000) { } public Soft_CRMOrderModel(string comanyId, string bigproductCode, string productCode, string username, string orderid, string isOpen, string stime, string etime, string openstime, string openetime, string resid, int pageIndex, int pageSize) : this(comanyId, bigproductCode, productCode, username, orderid, isOpen, stime, etime, openstime, openetime, resid, "", pageIndex, pageSize) { } public Soft_CRMOrderModel(string bigproductCode, string stime, string etime, decimal? regCampainid, int pageIndex, int pageSize) : this("", bigproductCode, "", "", "", "", stime, etime, "", "", "", "", regCampainid, pageIndex, pageSize) { } public Soft_CRMOrderModel(string comanyId, string bigproductCode, string productCode, string username, string orderid, string isOpen, string stime, string etime, string openstime, string openetime, string resid, string payno, int pageIndex, int pageSize) : this(comanyId, bigproductCode, productCode, username, orderid, isOpen, stime, etime, openstime, openetime, resid, "", null, pageIndex, pageSize) { } public Soft_CRMOrderModel(string comanyId, string bigproductCode, string productCode, string username, string orderid, string isOpen, string stime, string etime, string openstime, string openetime, string resid, string payno, decimal? regCampainid, int pageIndex, int pageSize) { this.companyId = comanyId.GetDecimal(0); this.bigproductCode = bigproductCode; this.productCode = productCode; this.username = username; this.orderid = orderid.GetDecimal(0); this.isOpen = isOpen.GetDecimal(); this.stime = stime.GetDateTime(); this.etime = etime.GetDateTime(); this.openstime = openstime.GetDateTime(); this.openetime = openetime.GetDateTime(); this.resid = resid; this.payno = payno; this.regCampainid = regCampainid; this.pageIndex = pageIndex; this.pageSize = pageSize; } /// /// 获取接口订单信息 /// /// /// /// public List GetOderDetail(out string msg, out int total, string apllay = "GetApplyOrder") { msg = ""; total = 0; returnResult result = getResult(apllay); List _orderDetail = new List(); if (result.result) { total = result.total; _orderDetail = Utility.MAXJSONToObject>(result.retMessage); } else { msg = "接口数据:" + result.retMessage; } return _orderDetail; } private returnResult getResult(string apllay) { string json = Utility.ObjectToJsonAndConvertTime(this); string url = Utility.GetSettingByKey("L2Order") + apllay; returnResult result = new returnResult(); result = result.getResult(json, url); return result; } /// /// 获取接口支付列表 /// /// /// /// /// public List GetOderPayList(out string msg, out int total, string apllay = "GetApplyOrderPayList") { msg = ""; total = 0; returnResult result = getResult(apllay); List _orderDetail = new List(); if (result.result) { total = result.total; _orderDetail = Utility.MAXJSONToObject>(result.retMessage); } else { msg = "接口数据:" + result.retMessage; } return _orderDetail; } /// /// 获取接口订单信息 /// /// /// /// public List GetOrderSt(out string msg, string apllay = "GetOrderRPTForInCRM") { msg = ""; //total = 0; returnResult result = getResult(apllay); List _orderDetail = new List(); if (result.result) { //total = result.total; _orderDetail = Utility.MAXJSONToObject>(result.retMessage); } else { msg = "接口数据:" + result.retMessage; } return _orderDetail; } /// /// 获取接口订单统计详情信息 /// /// /// /// public List GetOrderStDetail(out string msg, out int total, string apllay = "GetOrderListForInCRM") { msg = ""; total = 0; returnResult result = getResult(apllay); List _orderDetail = new List(); if (result.result) { total = result.total; _orderDetail = Utility.MAXJSONToObject>(result.retMessage); } else { msg = "接口数据:" + result.retMessage; } return _orderDetail; } } /// ///订单 操作 /// public class Soft_CRMOperationordermodel { public returnResult AddOrdermodel(AddOrderModel model) { returnResult result = addResult(model); return result; } public bool OpenOrdermodel(OpenOrderModel model) { returnResult result = openResult(model); return result.result; } public bool CancelOrdermodel(CancelModel model) { returnResult result = cancelResult(model); return result.result; } /// /// 下单 /// /// /// private returnResult addResult(AddOrderModel model) { string json = Utility.ConvertToJSON(model); string url = Utility.GetSettingByKey("L2AddOrder"); ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get(); string key = sHelper.createSignEncodingStr(json, SecurityHelper.OrderClientIdKey); string response = Utility.PostData(url + "?" + key, Encoding.UTF8); string _retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, response); returnResult result = Utility.JSONToObject(_retmsg); return result; } /// /// 开通订单 /// /// /// private returnResult openResult(OpenOrderModel model) { string json = Utility.ConvertToJSON(model); string url = Utility.GetSettingByKey("L2OpenOrder"); ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get(); string key = sHelper.createSignEncodingStr(json, SecurityHelper.OrderClientIdKey); string response = Utility.PostData(url + "?" + key, Encoding.UTF8); string _retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, response); returnResult result = Utility.JSONToObject(_retmsg); return result; } /// /// 取消订单 /// /// /// private returnResult cancelResult(CancelModel model) { string json = Utility.ConvertToJSON(model); string url = Utility.GetSettingByKey("L2CancelOrder"); ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get(); string key = sHelper.createSignEncodingStr(json, SecurityHelper.OrderClientIdKey); string response = Utility.PostData(url + "?" + key, Encoding.UTF8); string _retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, response); returnResult result = Utility.JSONToObject(_retmsg); return result; } } #endregion public class AddOrderModel { [DisplayName("活动小类:")] public string productCode { get; set; } [DisplayName("用户名:")] [Required(ErrorMessage = "*必填")] public string userName { get; set; } [DisplayName("用户卡号:")] public string userCardNo { get; set; } [DisplayName("身份证号码:")] [Required(ErrorMessage = "*必填")] [RegularExpression(@"\d{17}[\d|x]|\d{15}", ErrorMessage = "身份证号码格式错误")] public string cradNo { get; set; } [DisplayName("手机号:")] [Required(ErrorMessage = "*必填")] [RegularExpression(@"\d{11}$", ErrorMessage = "请输入正确的手机电话号码")] public string mobile { get; set; } [DisplayName("备注:")] public string mark { get; set; } public int orderNum { get; set; } public string campaignId { get; set; } [DisplayName("活动id:")] public string ActivityId { get; set; } [DisplayName("用户姓名:")] [Required(ErrorMessage = "*必填")] public string fullName { get; set; } public decimal campanyId { get; set; } [DisplayName("限定IP")] [RegularExpression(@"^((0|(?:[1-9]\d{0,1})|(?:1\d{2})|(?:2[0-4]\d)|(?:25[0-5]))\.){3}((?:[1-9]\d{0,1})|(?:1\d{2})|(?:2[0-4]\d)|(?:25[0-5]))$", ErrorMessage = "IP格式错误")] public string IP { get; set; } [DisplayName("创建用户名:")] [Required(ErrorMessage = "*必填")] public string CreateUser { get; set; } } public class OpenOrderModel { public string ApplyOrderId { get; set; } public string UserName { get; set; } public string PayNo { get; set; } public decimal PayPrice { get; set; } public string PayType { get; set; } public string PayMark { get; set; } public string PayExt1 { get; set; } public string PayExt2 { get; set; } } public class CancelModel { public string ApplyOrderId { get; set; } /// /// 营业部编码-工号 /// public string CancelUser { get; set; } } public class retResult { public bool result { get; set; } public int retcode { get; set; } public string ApplyOrderId { get; set; } } }