/// <summary> /// 上报问题详情 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult QuestionDetail(int id) { WeixinApiInit(); IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); var question = questionBll.GetEntity(m => m.Id == id); var model = new QuestionDetailModel { Id = question.Id, Title = question.Title, Desc = string.IsNullOrEmpty(question.Desc) ? "" : question.Desc, Status = question.Status, UploadTime = question.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(question.Imgs) ? new string[] { } : question.Imgs.Split(';'), AudioPath = question.AudioPath, VoiceDuration = question.VoiceDuration, PropertyName = question.PropertyPlace.Name, DisposesTime = question.Status == ConstantParam.NO_DISPOSE ? null : question.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss"), DisposeDesc = question.Status == ConstantParam.DISPOSED ? question.QuestionDisposes.FirstOrDefault().DisposeDesc : "" }; return(View(model)); }
public ApiPageResultModel DisposeFeedbackList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取要公示的问题解决反馈 总个数和分页数据 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); //条件已处理和要公示 var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); Expression <Func <T_Question, bool> > where = u => u.Status == ConstantParam.DISPOSED && u.IsPublish == ConstantParam.PUBLISHED_TRUE && placeList.Contains(u.PropertyPlaceId); resultModel.Total = questionBll.Count(where); resultModel.result = questionBll.GetPageList(where, "Id", false, model.PageIndex).ToList().Select(q => new { Id = q.Id, Title = q.Title, Desc = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc, UploadUserName = q.UploadUser.UserName, UploadTime = q.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(q.Imgs) ? new string[] { } : q.Imgs.Split(';'), AudioPath = q.AudioPath, VoiceDuration = q.VoiceDuration, PlaceName = q.PropertyPlace.Name, DisposeDesc = q.QuestionDisposes.FirstOrDefault().DisposeDesc, DisposeUserName = string.IsNullOrEmpty(q.QuestionDisposes.FirstOrDefault().DisposeUser.TrueName) ? q.QuestionDisposes.FirstOrDefault().DisposeUser.UserName : q.QuestionDisposes.FirstOrDefault().DisposeUser.TrueName, DisposesTime = q.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") }); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
/// <summary> /// 上报问题Json方式获取 /// </summary> /// <param name="pageIndex"></param> /// <returns></returns> public JsonResult QuestionJsonList(int pageIndex) { //获取当前用户 var userId = GetCurrentUser().Id; var placeIds = GetVerifiedPlaceIds(); PageResultModel model = new PageResultModel(); IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); model.Total = questionBll.Count(m => m.UploadUserId == userId && placeIds.Contains(m.PropertyPlaceId)); model.Result = questionBll.GetPageList(m => m.UploadUserId == userId && placeIds.Contains(m.PropertyPlaceId), "UploadTime", false, pageIndex).Select(q => new { Id = q.Id, Title = q.Title, Desc = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc, Status = q.Status, StatusImage = q.Status == 0 ? "/Images/WeiXin/unhandled.png" : "/Images/WeiXin/handled.png", UploadTime = q.UploadTime, strUploadTime = q.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(q.Imgs) ? new string[] { } : q.Imgs.Contains(";") ? q.Imgs.Split(';') : new string[] { q.Imgs }, ImgCount = string.IsNullOrEmpty(q.Imgs) ? 0 : q.Imgs.Contains(";") ? q.Imgs.Split(';').Count() : 1, AudioPath = q.AudioPath, VoiceDuration = q.VoiceDuration, PropertyName = q.PropertyPlace.Name, DisposesTime = q.Status == ConstantParam.NO_DISPOSE ? null : q.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") }).ToList(); return(Json(model, JsonRequestBehavior.AllowGet)); }
public ActionResult SetQuestionDisposer(int id) { //获取当前物业小区ID int currentPlaceId = GetSessionModel().PropertyPlaceId.Value; //获取要处理的上报问题 IQuestionBLL resultBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); var result = resultBll.GetEntity(r => r.Id == id); //如果上报问题结果不为空且未指派处理人 if (result != null && result.DisposerId == null) { //初始化异常处理模型 SetQuestionDisposerModel model = new SetQuestionDisposerModel() { Id = result.Id, Title = result.Title, Desc = result.Desc }; model.UserList = GetUserList(currentPlaceId); return(View(model)); } else { return(RedirectToAction("QuestionList")); } }
public JsonResult DeleteQuestion(int id) { JsonModel jm = new JsonModel(); IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); T_Question question = questionBll.GetEntity(m => m.Id == id); if (question != null) { if (questionBll.Delete(question)) { if (!string.IsNullOrEmpty(question.Imgs)) { //删除图片 string[] Imgs = question.Imgs.Split(';'); for (int i = 0; i < Imgs.Count(); i++) { DelFile(Imgs[i]); } } if (!string.IsNullOrEmpty(question.AudioPath)) { //删除语音 DelFile(question.AudioPath); } jm.Content = "删除问题" + question.Title + "成功"; } } else { jm.Msg = "该上报问题不存在"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 获取未处理的上报问题个数 /// </summary> /// <param name="html">HTML对象</param> /// <returns></returns> public static int GetNoDisposeQuestionNum(this HtmlHelper html) { int CurrentPlaceId = GetSessionModel(html).PropertyPlaceId.Value; IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); return(questionBll.Count(q => q.Status == ConstantParam.NO_DISPOSE && q.PropertyPlaceId == CurrentPlaceId)); }
/// <summary> /// 公众号首页 /// </summary> /// <returns></returns> public ActionResult Index() { HomeDataModel model = new HomeDataModel(); var owner = GetCurrentUser(); var PlaceIds = GetVerifiedPlaceIds(); //初始化查询条件 var DoorIds = owner.PropertyIdentityVerification.Where(v => v.DoorId != null && v.IsVerified == 1).Select(m => m.DoorId); var CompanyIds = owner.PropertyIdentityVerification.Where(v => v.BuildCompanyId != null && v.IsVerified == 1).Select(m => m.BuildCompanyId); Expression <Func <T_HouseUserExpenseDetails, bool> > where = u => u.IsPayed == ConstantParam.PAYED_FALSE && (DoorIds.Contains(u.BuildDoorId) || CompanyIds.Contains(u.BuildCompanyId)); // 获取当前用户对应业主的缴费记录 IHouseUserExpenseDetailsBLL expenseDetailsBLL = BLLFactory <IHouseUserExpenseDetailsBLL> .GetBLL("HouseUserExpenseDetailsBLL"); model.ExpenseList = expenseDetailsBLL.GetPageList(where, "CreateDate", false, 1, 1).Select(e => new ExpenseNoticeModel { ExpenseType = e.PropertyExpenseType.Name, PlaceName = e.BuildCompanyId == null ? e.BuildDoor.BuildUnit.Build.PropertyPlace.Name : e.BuildCompany.PropertyPlace.Name, OwnerDoor = e.BuildCompanyId == null ? (e.BuildDoor.BuildUnit.Build.BuildName + e.BuildDoor.BuildUnit.UnitName + e.BuildDoor.DoorName) : e.BuildCompany.Name, ExpenseDateDes = e.ExpenseDateDes, Cost = e.Expense + "元" }).ToList(); // 获取用户关联小区的公告列表 IPostBLL postBll = BLLFactory <IPostBLL> .GetBLL("PostBLL"); var placeList = owner.UserPlaces.Select(m => m.PropertyPlaceId); Expression <Func <T_Post, bool> > where1 = u => placeList.Contains(u.PropertyPlaceId) && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PublishedFlag == ConstantParam.PUBLISHED_TRUE; model.NewsList = postBll.GetPageList(where1, "PublishedTime", false, 1, 3).Select(p => new NewsModel { Id = p.Id, PlaceName = p.PropertyPlace.Name, propertyPic = string.IsNullOrEmpty(p.PropertyPlace.ImgThumbnail) ? "/Images/news_item_default.png" : p.PropertyPlace.ImgThumbnail, PublishTime = p.PublishedTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), Title = p.Title }).ToList(); //获取最新上报的问题 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); Expression <Func <T_Question, bool> > where2 = u => u.UploadUserId == owner.Id && PlaceIds.Contains(u.PropertyPlaceId); model.QuestionList = questionBll.GetPageList(where2, "Id", false, 1, 2).ToList().Select(q => new QuestionModel { Id = q.Id, PlaceName = q.PropertyPlace.Name, Title = q.Title, Desc = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc, Status = q.Status, UploadTime = q.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(q.Imgs) ? new string[] { } : q.Imgs.Split(';'), AudioPath = q.AudioPath, VoiceDuration = q.VoiceDuration }).ToList(); return(View(model)); }
/// <summary> /// 上报问题列表 /// </summary> /// <returns></returns> public ActionResult QuestionList() { var userId = GetCurrentUser().Id; var placeIds = GetVerifiedPlaceIds(); IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); ViewBag.QuestionTotal = questionBll.Count(m => m.UploadUserId == userId && placeIds.Contains(m.PropertyPlaceId)); return(View()); }
public JsonResult DisposeQuestion(DisposeQuestionModel model) { JsonModel jm = new JsonModel(); if (ModelState.IsValid) { //获取要处理的上报问题 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); T_Question question = questionBll.GetEntity(m => m.Id == model.Id); if (question != null) { //修改处理状态并添加处理记录 question.Status = ConstantParam.DISPOSED; question.IsPublish = model.IsPublish ? 1 : 0; T_QuestionDispose questionDispose = new T_QuestionDispose() { DisposeDesc = model.DisposeDesc, DisposeUserId = GetSessionModel().UserID, QuestionId = model.Id, DisposeTime = DateTime.Now }; //保存到数据库 questionBll.DisposeQuestion(question, questionDispose); IUserPushBLL userPushBLL = BLLFactory <IUserPushBLL> .GetBLL("UserPushBLL"); var userPush = userPushBLL.GetEntity(p => p.UserId == question.UploadUserId); if (userPush != null) { string registrationId = userPush.RegistrationId; string alert = "您" + question.UploadTime.ToString("yyyy-MM-dd HH:mm") + "上报的问题已处理"; //通知信息 bool flag = PropertyUtils.SendPush("上报问题处理", alert, ConstantParam.MOBILE_TYPE_OWNER, registrationId); if (!flag) { jm.Msg = "推送发生异常"; } } //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } else { jm.Msg = "该问题不存在"; } } else { jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public ApiResultModel QuestionDetail([FromUri] DetailSearchModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //获取问题总个数和分页数据 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); var question = questionBll.GetEntity(u => u.Id == model.Id); resultModel.result = new { Id = question.Id, Title = question.Title, Desc = string.IsNullOrEmpty(question.Desc) ? "" : question.Desc, Status = question.Status, UploadTime = question.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Imgs = string.IsNullOrEmpty(question.Imgs) ? new string[] {} : question.Imgs.Split(';'), AudioPath = question.AudioPath, VoiceDuration = question.VoiceDuration, PlaceName = question.PropertyPlace.Name, DisposesTime = question.Status == ConstantParam.NO_DISPOSE ? null : question.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") }; } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ActionResult QuestionCompanyPlatformList(QuestionPlatformSearchModel model) { //1.初始化默认查询模型 DateTime today = DateTime.Today; if (model.StartTime == null) { model.StartTime = today.AddDays(-today.Day + 1); } if (model.EndTime == null) { model.EndTime = today; } model.StatusList = GetStatusList(); int CompanyId = GetSessionModel().CompanyId.Value; //根据提报时间查询 DateTime endTime = model.EndTime.Value.AddDays(1); Expression <Func <T_Question, bool> > where = u => u.UploadTime >= model.StartTime.Value && u.UploadTime < endTime && u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CompanyId; //根据小区名称查询 if (model.PropertyPlaceId != null) { where = PredicateBuilder.And(where, u => u.PropertyPlaceId == model.PropertyPlaceId.Value); } //根据状态名称查询 if (model.Status != null) { where = PredicateBuilder.And(where, u => u.Status == model.Status); } //根据问题名称模糊查询 if (!string.IsNullOrEmpty(model.Title)) { where = PredicateBuilder.And(where, u => u.Title.Contains(model.Title)); } //根据查询条件调用BLL层 获取分页数据 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); var sortName = this.SettingSorting("Id", false); model.DataList = questionBll.GetPageList(where, sortName.SortName, sortName.IsAsc, model.PageIndex) as PagedList <T_Question>; //获取所有物业小区列表 model.PropertyPlaceList = GetPropertyPlaceList(); return(View(model)); }
public ApiResultModel SetQuestionDisposer(SetDisposerModel model) { ApiResultModel resultModel = new ApiResultModel(); try { IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); //获取要指派处理人的问题 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); T_Question question = questionBll.GetEntity(m => m.Id == model.Id); if (question != null) { //指派处理人 question.DisposerId = model.DisposerId; //保存到数据库 if (!questionBll.Update(question)) { resultModel.Msg = APIMessage.SET_DISPOSER_FAIL; } } else { resultModel.Msg = APIMessage.QUESTION_NOEXIST; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ActionResult QuestionCompanyPlatformDetail(int id) { IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); //获取要查看的问题 T_Question question = questionBll.GetEntity(m => m.Id == id); if (question != null) { return(View(question)); } else { return(RedirectToAction("QuestionCompanyPlatformList")); } }
public JsonResult SetQuestionDisposer(SetQuestionDisposerModel model) { JsonModel jm = new JsonModel(); if (ModelState.IsValid) { //获取要指派处理人的上报问题结果 IQuestionBLL resultBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); T_Question result = resultBll.GetEntity(m => m.Id == model.Id); if (result != null) { //指派处理人 result.DisposerId = model.DisposerId; //保存到数据库 if (resultBll.Update(result)) { //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); //推送给处理人 IPropertyUserPushBLL userPushBLL = BLLFactory <IPropertyUserPushBLL> .GetBLL("PropertyUserPushBLL"); var userPush = userPushBLL.GetEntity(p => p.UserId == model.DisposerId); if (userPush != null) { string registrationId = userPush.RegistrationId; //通知信息 bool flag = PropertyUtils.SendPush("业主上报问题", "有新的问题需要您处理,请查看", ConstantParam.MOBILE_TYPE_PROPERTY, registrationId); if (!flag) { jm.Msg = "推送发生异常"; } } } else { jm.Msg = "指派处理人失败"; } } } else { jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public JsonResult QuestionReport(T_Question model) { //点击图片input触发的提交事件,不进行提交 if (model.Id == 1) { return(null); } else { int userId = GetCurrentUser().Id; JsonModel jm = new JsonModel(); try { IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); T_Question question = new T_Question(); question.UploadUserId = userId; question.UploadTime = DateTime.Now; question.ClientSaveTime = DateTime.Now; question.Title = model.Title; question.Status = 0; question.PropertyPlaceId = model.PropertyPlaceId; if (string.IsNullOrEmpty(model.Imgs)) { question.Imgs = ""; } else { question.Imgs = GetMultimedia(ConstantParam.QUESTION_DIR, model.Imgs); } question.Desc = model.Desc; question.IsPublish = 0; questionBll.Save(question); } catch { jm.Msg = "提交失败"; } return(Json(jm, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 获取最新上报的问题 /// </summary> /// <param name="html">HTML对象</param> /// <returns></returns> public static List <QuestionIntroModel> GetNewestNoDisposeQuestion(this HtmlHelper html) { int CurrentPlaceId = GetSessionModel(html).PropertyPlaceId.Value; IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); //分页获取前3条数据:分页每页3条数据,获取第一页 var que = questionBll.GetPageList(q => q.Status == ConstantParam.NO_DISPOSE && q.PropertyPlaceId == CurrentPlaceId, "UploadTime", false, 1, 3).Select(q => new QuestionIntroModel { Title = q.Title, TimeAgoStr = (DateTime.Now - q.UploadTime).Days > 0 ? (DateTime.Now - q.UploadTime).Days + "天前" : ((DateTime.Now - q.UploadTime).Hours > 0 ? (DateTime.Now - q.UploadTime).Hours + "小时前" : (DateTime.Now - q.UploadTime).Minutes + "分钟前") }); if (que != null) { return(que.ToList()); } return(null); }
public ActionResult DisposeQuestion(int id) { IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); T_Question question = questionBll.GetEntity(m => m.Id == id); if (question != null) { DisposeQuestionModel model = new DisposeQuestionModel() { Id = question.Id, Title = question.Title }; return(View(model)); } else { return(RedirectToAction("QuestionList")); } }
public ApiPageResultModel OwnQuestionList([FromUri] PagedSearchModel model) { ApiPageResultModel resultModel = new ApiPageResultModel(); try { IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); Expression <Func <T_Question, bool> > where = u => u.PropertyPlaceId == user.PropertyPlaceId && u.DisposerId == user.Id; //获取问题总个数和分页数据 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); resultModel.Total = questionBll.Count(where); resultModel.result = new { ownQuestionList = questionBll.GetOwnQuestionPageList(where, model.PageIndex, ConstantParam.PAGE_SIZE).Select(q => new { Id = q.Id, Title = q.Title, Desc = string.IsNullOrEmpty(q.Desc) ? "" : q.Desc, Status = q.Status, UploadTime = q.UploadTime.ToString("yyyy-MM-dd HH:mm:ss"), Uploader = q.UploadUser.UserName, Imgs = string.IsNullOrEmpty(q.Imgs) ? new string[] { } : q.Imgs.Split(';'), AudioPath = q.AudioPath, VoiceDuration = q.VoiceDuration, DisposeDesc = q.Status == ConstantParam.DISPOSED ? q.QuestionDisposes.FirstOrDefault().DisposeDesc : "", DisposeTime = q.Status == ConstantParam.DISPOSED ? q.QuestionDisposes.FirstOrDefault().DisposeTime.ToString("yyyy-MM-dd HH:mm:ss") : "", DisposeUser = q.Status == ConstantParam.DISPOSED ? q.QuestionDisposes.FirstOrDefault().DisposeUser.UserName : (q.DisposerId != null ? q.Disposer.UserName : ""), IsPublish = q.IsPublish }) }; } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ApiResultModel AddQuestion(QuestionModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //问题基本信息上传 T_Question question = new T_Question() { Title = model.Title, Desc = model.Desc, PropertyPlaceId = model.PropertyPlaceId, UploadTime = DateTime.Now, UploadUserId = model.UserId, Status = ConstantParam.NO_DISPOSE, ClientSaveTime = DateTime.Now }; //问题上报文件资源保存目录 string dir = HttpContext.Current.Server.MapPath(ConstantParam.QUESTION_FILE + model.PropertyPlaceId); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } //问题图片上传 if (!string.IsNullOrEmpty(model.PicList)) { var fileName = DateTime.Now.ToFileTime().ToString() + ".zip"; string filepath = Path.Combine(dir, fileName); using (FileStream fs = new FileStream(filepath, FileMode.Create)) { using (BinaryWriter bw = new BinaryWriter(fs)) { byte[] datas = Convert.FromBase64String(model.PicList); bw.Write(datas); bw.Close(); } } //图片集路径保存 question.Imgs = PropertyUtils.UnZip(filepath, dir, ConstantParam.QUESTION_FILE + model.PropertyPlaceId); } //语音文件上传 if (!string.IsNullOrEmpty(model.VoiceFile)) { var fileName = DateTime.Now.ToFileTime().ToString() + ".amr"; string filepath = Path.Combine(dir, fileName); using (FileStream fs = new FileStream(filepath, FileMode.Create)) { using (BinaryWriter bw = new BinaryWriter(fs)) { byte[] datas = Convert.FromBase64String(model.VoiceFile); bw.Write(datas); bw.Close(); } } //语音路径保存 question.AudioPath = ConstantParam.QUESTION_FILE + model.PropertyPlaceId + "/" + fileName; question.VoiceDuration = model.VoiceDuration; } //保存提报的问题 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); questionBll.Save(question); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }
public ActionResult Index(int id = 1) { CompanyPlatformIndexModel model = new CompanyPlatformIndexModel(); int CurrentCompanyId = GetSessionModel().CompanyId.Value; //获取当前公司物业小区个数并赋值 IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL"); model.PlaceCount = placeBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.CompanyId == CurrentCompanyId); //获取当前公司下属小区物业人员总个数 IPropertyUserBLL placeUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); model.PlaceUserCount = placeUserBll.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //住宅业主个数 IHouseUserBLL houseUserBll = BLLFactory <IHouseUserBLL> .GetBLL("HouseUserBLL"); model.HouseUserCount = houseUserBll.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //办公楼业主个数 IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL"); model.BuildCompanyCount = buildCompanyBll.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //获取物业公告个数 IPostBLL postBLL = BLLFactory <IPostBLL> .GetBLL("PostBLL"); int postCount = postBLL.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.PublishedFlag == ConstantParam.PUBLISHED_TRUE && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); model.PlacePostCount = postCount; //获取业主上报问题个数 IQuestionBLL questionBLL = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); int QuestionCount = questionBLL.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId); //获取业主上报问题已处理个数 int DisposedQuestionCount = questionBLL.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CurrentCompanyId && u.Status == ConstantParam.DISPOSED); //设置上报问题处理率 model.QuestionDisposedRate = Convert.ToDouble(DisposedQuestionCount) / QuestionCount; //获取巡检异常个数 IInspectionResultBLL resultBLL = BLLFactory <IInspectionResultBLL> .GetBLL("InspectionResultBLL"); int InspectionExceptionCount = resultBLL.Count(u => u.InspectionTimePlan.InspectionPlan.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.InspectionTimePlan.InspectionPlan.PropertyPlace.CompanyId == CurrentCompanyId && u.Status == ConstantParam.EXCEPTION && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //获取巡检异常已处理个数 int DisposedInspectionExceptionCount = resultBLL.Count(u => u.InspectionTimePlan.InspectionPlan.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.InspectionTimePlan.InspectionPlan.PropertyPlace.CompanyId == CurrentCompanyId && u.Status == ConstantParam.EXCEPTION && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.DisposeStatus == ConstantParam.DISPOSED); //设置巡检异常处理率 model.InspectionExceptionDisposedRate = Convert.ToDouble(DisposedInspectionExceptionCount) / InspectionExceptionCount; var dataList = placeBll.GetList(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.CompanyId == CurrentCompanyId).ToList(); var ExpenseCountList = new List <ExpenseCountModel>(); foreach (var item in dataList) { var m = new ExpenseCountModel(); m.PlaceName = item.Name; //如果是住宅小区 if (item.PlaceType == ConstantParam.PLACE_TYPE_HOUSE) { IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL"); m.DoorCount = doorBll.Count(d => d.BuildUnit.Build.PropertyPlaceId == item.Id); int ExpensedDoorCount = doorBll.Count(d => d.BuildUnit.Build.PropertyPlaceId == item.Id && d.HouseUserExpenseDetails.Count > 0 && d.HouseUserExpenseDetails.OrderByDescending(e => e.CreateDate).FirstOrDefault().IsPayed == ConstantParam.PAYED_TRUE); m.ExpensedRate = Convert.ToDouble(ExpensedDoorCount) / m.DoorCount; } //如果是办公楼小区 else if (item.PlaceType == ConstantParam.PLACE_TYPE_COMPANY) { m.DoorCount = item.BuildCompanys.Count(c => c.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); int ExpensedDoorCount = item.BuildCompanys.Count(c => c.HouseUserExpenseDetails.Count > 0 && c.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && c.HouseUserExpenseDetails.OrderByDescending(d => d.CreateDate).FirstOrDefault().IsPayed == ConstantParam.PAYED_TRUE); m.ExpensedRate = Convert.ToDouble(ExpensedDoorCount) / m.DoorCount; } ExpenseCountList.Add(m); } model.ExpenseCountList = ExpenseCountList.OrderByDescending(m => m.ExpensedRate).ToPagedList(id, ConstantParam.PAGE_SIZE); return(View(model)); }
public ActionResult Index() { //构造首页数据模型 PropertyIndexModel model = new PropertyIndexModel(); //获取物业小区 int CurrentPlaceId = GetSessionModel().PropertyPlaceId ?? 0; //获取app用户统计数据 IUserBLL userBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); int appUserCount = userBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.UserPlaces.Any(up => up.PropertyPlaceId == CurrentPlaceId)); model.AppUserCount = appUserCount; //获取物业用户统计数据 IPropertyUserBLL pUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); int pUserCount = pUserBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlaceId == CurrentPlaceId); model.PropertyUserCount = pUserCount; //获取新闻发布个数 IPostBLL postBLL = BLLFactory <IPostBLL> .GetBLL("PostBLL"); int postCount = postBLL.Count(u => u.PublishedFlag == ConstantParam.PUBLISHED_TRUE && u.PropertyPlaceId == CurrentPlaceId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); model.NoticeCount = postCount; //获取业主上报问题个数 IQuestionBLL questionBLL = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); int questionCount = questionBLL.Count(u => u.PropertyPlaceId == CurrentPlaceId); model.QuestionCount = questionCount; //获取业主上报本月未处理问题个数 DateTime monthBegin = DateTime.Today.AddDays(1 - DateTime.Today.Day); DateTime monthEnd = DateTime.Now.Date.AddDays(1); int notHandleQuestionCount = questionBLL.Count(u => u.Status == ConstantParam.NO_DISPOSE && u.UploadTime > monthBegin && u.UploadTime < monthEnd && u.PropertyPlaceId == CurrentPlaceId); model.NotHandleQuestionCount = notHandleQuestionCount; //获取本月巡检未处理问题个数 IInspectionResultBLL resultBLL = BLLFactory <IInspectionResultBLL> .GetBLL("InspectionResultBLL"); int notHandleExCount = resultBLL.Count(u => u.Status == ConstantParam.EXCEPTION && u.PlanDate >= monthBegin && u.PlanDate < monthEnd && (u.DisposeStatus == null || u.DisposeStatus == ConstantParam.NO_DISPOSE) && u.InspectionTimePlan.InspectionPlan.PropertyPlaceId == CurrentPlaceId); model.NotHandleExceptionCount = notHandleExCount; //获取最新的为题列表 var list = questionBLL.GetPageList(q => q.PropertyPlaceId == CurrentPlaceId, "UploadTime", false, 1, 5); model.LatestQuestionList = list; //获取当前小区所属公司ID IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL"); var place = placeBll.GetEntity(p => p.Id == CurrentPlaceId); int currentCompanyId = place.CompanyId; //查询条件初始化 Expression <Func <T_CompanyPost, bool> > where = u => u.CompanyId == currentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PublishStatus == ConstantParam.PUBLISHED_TRUE && u.IsOpen == ConstantParam.PUBLISHED_TRUE; //获取最新的5条总公司新闻公告 ICompanyPostBLL postBll = BLLFactory <ICompanyPostBLL> .GetBLL("CompanyPostBLL"); model.LatestCompanyPostList = postBll.GetPageList(where, "PublishedTime", false, 1, 5); return(View(model)); }
public ApiResultModel DisposeQuestion(DisposerModel model) { ApiResultModel resultModel = new ApiResultModel(); try { IPropertyUserBLL userBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL"); T_PropertyUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); //获取要处理的问题 IQuestionBLL questionBll = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL"); T_Question question = questionBll.GetEntity(m => m.Id == model.Id); if (question != null) { //修改处理状态并添加处理记录 question.Status = ConstantParam.DISPOSED; question.IsPublish = model.IsPublish; T_QuestionDispose questionDispose = new T_QuestionDispose() { DisposeDesc = model.DisposeDesc, DisposeUserId = user.Id, QuestionId = model.Id, DisposeTime = DateTime.Now }; //保存到数据库 questionBll.DisposeQuestion(question, questionDispose); //推送通知 IUserPushBLL userPushBLL = BLLFactory <IUserPushBLL> .GetBLL("UserPushBLL"); var userPush = userPushBLL.GetEntity(p => p.UserId == question.UploadUserId); if (userPush != null) { string registrationId = userPush.RegistrationId; string alert = "您" + question.UploadTime.ToString("yyyy-MM-dd HH:mm") + "上报的问题已处理"; //通知信息 bool flag = PropertyUtils.SendPush("上报问题处理", alert, ConstantParam.MOBILE_TYPE_OWNER, registrationId); if (!flag) { resultModel.Msg = "问题处理完成,推送失败"; } } } else { resultModel.Msg = APIMessage.QUESTION_NOEXIST; } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }