/// <summary> /// 获取接单师傅信息列表 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public string GetReceiveMaster(string pRequest) { var rd = new APIResponse <GetReceiveMasterRD>(); try { var req = pRequest.DeserializeJSONTo <APIRequest <GetReceiveMasterRP> >(); if (req.Parameters == null) { throw new ArgumentException(); } req.Parameters.Validate(); // 根据师傅id查询师傅详情 var personIdList = ServiceOrderManager.Instance.GetAppliedServicePerson(req.Parameters.ServiceOrderNO); var resultList = personIdList.Select(id => GreeCommon.GetServicePerson(req.CustomerID, req.UserID, id)).ToList(); var rdData = new GetReceiveMasterRD { ServicePersonList = resultList }; rd.Data = rdData; rd.ResultCode = 0; } catch (Exception ex) { rd.Message = ex.Message; rd.ResultCode = 101; } return(rd.ToJSON()); }
/// <summary> /// 获取师傅个人信息 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public string GetServicePerson(string pRequest) { var rd = new APIResponse <GetServicePersonRD>(); try { var req = pRequest.DeserializeJSONTo <APIRequest <GetServicePersonRP> >(); if (req.Parameters == null) { throw new ArgumentException(); } req.Parameters.Validate(); // 根据师傅id查询师傅详情 var model = GreeCommon.GetServicePerson(req.CustomerID, req.UserID, req.Parameters.ServicePersonId); var rdData = new GetServicePersonRD { ServicePerson = model }; rd.Data = rdData; rd.ResultCode = 0; } catch (Exception ex) { rd.Message = ex.Message; rd.ResultCode = 101; } return(rd.ToJSON()); }
/// <summary> /// 选择师傅 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public string SelectServicePerson(string pRequest) { var rd = new APIResponse <SelectServicePersonRD>(); try { var req = pRequest.DeserializeJSONTo <APIRequest <SelectServicePersonRP> >(); if (req.Parameters == null) { throw new ArgumentException(); } req.Parameters.Validate(); // 创建任务 var session = Default.GetBSLoggingSession(req.CustomerID, req.UserID); var bll = new GLServiceTaskBLL(session); var serviceOrder = ServiceOrderManager.Instance.GetServiceOrder(req.Parameters.ServiceOrderNO); if (serviceOrder == null) { throw new ArgumentException(); } //删除 var entity = bll.Query(new IWhereCondition[] { new EqualsCondition { DateTimeAccuracy = null, FieldName = "ServiceOrderID", Value = req.Parameters.ServiceOrderNO }, new EqualsCondition { DateTimeAccuracy = null, FieldName = "CustomerID", Value = req.CustomerID }, new EqualsCondition { DateTimeAccuracy = null, FieldName = "IsDelete", Value = "0" }, new EqualsCondition { DateTimeAccuracy = null, FieldName = "UserID", Value = req.Parameters.PersonID } }, null); if (entity != null && entity.Length > 0) { bll.Delete(entity); } bll.Create(new GLServiceTaskEntity { CreateBy = "", CreateTime = DateTime.Now, CustomerID = req.CustomerID, IsDelete = 0, LastUpdateBy = "", LastUpdateTime = DateTime.Now, ServiceDate = serviceOrder.InstallOrderDate, ServiceOrderID = req.Parameters.ServiceOrderNO, ServiceTaskID = GreeCommon.GetGuid(), UserID = req.Parameters.PersonID }); // 标记赢得预约单的师傅 ServiceOrderManager.Instance.SelectServicePerson(req.Parameters.ServiceOrderNO, req.Parameters.PersonID); if (!string.IsNullOrEmpty(serviceOrder.VipID)) { VipEntity vipInfo = new VipBLL(session).GetByID(serviceOrder.VipID); if (vipInfo == null || vipInfo.VIPID.Equals("")) { throw new APIException("用户不存在"); } #region 推送师傅联系方式url到用户的微信端。 string message = "安装师傅联系方式,请点击<a href='" + req.Parameters.RetUrl + "'>查看师傅详情 </a>"; string code = JIT.CPOS.BS.BLL.WX.CommonBLL.SendWeixinMessage(message, serviceOrder.VipID, session, vipInfo); #endregion } var rdData = new SelectServicePersonRD { IsSuccess = true }; rd.Data = rdData; rd.ResultCode = 0; } catch (Exception ex) { rd.Message = ex.Message; rd.ResultCode = 101; } return(rd.ToJSON()); }
/// <summary> /// 提交预约订单 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> private string SubmitAppOrder(string pRequest) { var rd = new APIResponse <SubmitAppOrderRD>(); var rdData = new SubmitAppOrderRD(); var rp = pRequest.DeserializeJSONTo <APIRequest <SubmitAppOrderRP> >(); if (rp.Parameters == null) { throw new ArgumentException(); } if (rp.Parameters != null) { rp.Parameters.Validate(); } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID); #region 提交预约单 //根据订单号获取订单ID GLProductOrderBLL glpobll = new GLProductOrderBLL(loggingSessionInfo); GLProductOrderEntity glpoe = glpobll.GetProductOrderByOrderNo(rp.CustomerID, rp.Parameters.OrderNO); //更新客户VipID //if (glpoe != null && !string.IsNullOrEmpty(rp.Parameters.VipID)) if (glpoe != null && !string.IsNullOrEmpty(rp.UserID)) { glpoe.VipID = rp.UserID; glpoe.CustomerGender = rp.Parameters.Gender; glpoe.CustomerName = rp.Parameters.Surname; glpobll.Update(glpoe); } //插入预约 GLServiceOrderBLL glsobll = new GLServiceOrderBLL(loggingSessionInfo); GLServiceOrderEntity glsoe = glsobll.GetGLServiceOrderEntityByOrderID(rp.CustomerID, glpoe.ProductOrderID); ServiceOrderDataAccess orderManager = new ServiceOrderDataAccess(loggingSessionInfo); if (glsoe == null) { glsoe = new GLServiceOrderEntity(); } //订单ID glsoe.ProductOrderID = glpoe.ProductOrderID; glsoe.ServiceType = rp.Parameters.ServiceType; glsoe.ServiceDate = rp.Parameters.ServiceOrderDate; glsoe.ServiceDateEnd = rp.Parameters.ServiceOrderDateEnd; glsoe.ServiceAddress = rp.Parameters.ServiceAddress; glsoe.CustomerMessage = rp.Parameters.Msg; glsoe.Latitude = Convert.ToDecimal(rp.Parameters.Latitude); glsoe.Longitude = Convert.ToDecimal(rp.Parameters.Longitude); glsoe.CustomerID = rp.CustomerID; if (!string.IsNullOrEmpty(glsoe.ServiceOrderID)) { //删除预约单 glsobll.Update(glsoe); //删除预约单设备 orderManager.DeleteInstallDeviceList(glsoe.CustomerID, glsoe.ServiceOrderID); } else { glsoe.ServiceOrderID = GreeCommon.GetGuid(); glsobll.Create(glsoe); } //插入安装设备 orderManager.SaveInstallDeviceList(glsoe, rp.Parameters.DeviceList); //预约单管理 //SubscribeOrderViewModel order = orderManager.GetSubscribeOrder(rp.CustomerID, rp.Parameters.OrderNO); SubscribeOrderViewModel order = orderManager.GetSubscribeOrderDetail(rp.CustomerID, glsoe.ServiceOrderID); ServiceOrderManager.Instance.AddServiceOrder(order); rdData.ServiceOrderNO = glsoe.ServiceOrderID; #endregion #region 推送信息给服务师傅IOS,Android消息推送 GLServicePersonInfoBLL glspibll = new GLServicePersonInfoBLL(loggingSessionInfo); DataSet dsPerson = glspibll.GetServicePerson(rp.CustomerID, string.Empty); string msg = rp.Parameters.Msg; if (dsPerson != null && dsPerson.Tables != null && dsPerson.Tables[0].Rows.Count > 0) { foreach (DataRow row in dsPerson.Tables[0].Rows) { new PushIOSMessage(loggingSessionInfo).PushMessage(row["ServicePersonID"].ToString(), msg); new PushAndroidMessage(loggingSessionInfo).PushMessage(row["ServicePersonID"].ToString(), msg); } } #endregion rd.Data = rdData; rd.ResultCode = 0; return(rd.ToJSON()); }