/// <summary> /// 年审机构 /// </summary> /// <param name="id"></param> /// <param name="startTime"></param> /// <param name="endTime"></param> /// <returns></returns> public List <OrgEntity> GetAudit(string id, string startTime, string endTime) { List <OrgEntity> list = new List <OrgEntity>(); AuditOrganizationEntity para = new AuditOrganizationEntity(); if (id != "") { para.OrganizationId = id; } para.Status = (int)QX360.Model.Enums.UseStatus.启用; var auditList = AuditOrganizationBLL.Instance.GetList(para); if (auditList.Count > 0) { auditList.ForEach((o) => { var item = new OrgEntity(); item.Type = 3; item.Id = o.OrganizationId; item.Name = o.Name; item.KpiList = new List <KpiEntity>(); //年审订单 item.KpiList.Add(new KpiEntity() { Name = "年审订单", Count = AuditOrderBLL.Instance.GetList(new AuditOrderEntity() { StartTime = startTime, EndTime = endTime, OrganizationId = o.OrganizationId, }).Where(p => p.Status != (int)QX360.Model.Enums.PaySatus.已取消).Count().ToString() }); //代审订单 item.KpiList.Add(new KpiEntity() { Name = "代审订单", Count = TakeAuditOrderBLL.Instance.GetList(new TakeAuditOrderEntity() { StartTime = startTime, EndTime = endTime, OrganizationId = o.OrganizationId, }).Where(p => p.Status != (int)QX360.Model.Enums.PaySatus.已取消).Count().ToString() }); //代审订单 item.KpiList.Add(new KpiEntity() { Name = "集团年审订单", Count = GroupAuditOrderBLL.Instance.GetList(new GroupAuditOrderEntity() { StartTime = startTime, EndTime = endTime, OrganizationId = o.OrganizationId, }).Where(p => p.Status != (int)QX360.Model.Enums.PaySatus.已取消).Count().ToString() }); list.Add(item); }); } return(list); }
public JsonResult GetList(string queryJson) { var result = new ReturnMessage(false) { Message = "加载列表失败!" }; try { int type = 1; AuditOrganizationEntity para = new AuditOrganizationEntity(); if (!string.IsNullOrWhiteSpace(queryJson)) { var queryParam = queryJson.ToJObject(); if (!queryParam["lat"].IsEmpty()) { para.Lat = decimal.Parse(queryParam["lat"].ToString()); } if (!queryParam["lng"].IsEmpty()) { para.Lng = decimal.Parse(queryParam["lng"].ToString()); } if (!queryParam["type"].IsEmpty()) { type = int.Parse(queryParam["type"].ToString()); } } para.IsTake = 1; para.Status = (int)Model.Enums.UseStatus.启用; var pageList = AuditOrganizationBLL.Instance.GetList(para); if (pageList != null) { pageList.ForEach((page) => { if (page.FaceImage != null) { var imageHost = System.Configuration.ConfigurationManager.AppSettings["ImageHost"] == "" ? string.Format("http://{0}{1}", Request.Url.Host, Request.Url.Port == 80 ? "" : ":" + Request.Url.Port) : System.Configuration.ConfigurationManager.AppSettings["ImageHost"]; page.FaceImage = imageHost + page.FaceImage; } if (page.ProvinceId != null) { page.ProvinceName = AreaBLL.Instance.GetEntity(page.ProvinceId).AreaName; } if (page.CityId != null) { page.CityName = AreaBLL.Instance.GetEntity(page.CityId).AreaName; } if (page.CountyId != null) { page.CountyName = AreaBLL.Instance.GetEntity(page.CountyId).AreaName; } page.AddressInfo = page.ProvinceName + page.CityName + page.CountyName + page.AddressInfo; if (page.Lat != null && page.Lng != null && para.Lat != null && para.Lng != null) { page.HowLong = HarvenSin.GetDistance( new Point2D() { Lng = (double)para.Lng, Lat = (double)para.Lat }, new Point2D() { Lng = (double)page.Lng, Lat = (double)page.Lat }).ToString("f2"); } else { page.HowLong = "未知"; } }); } switch (type) { case 1: //按距离 pageList = pageList.OrderBy(i => i.HowLong).ThenBy(i => i.HowLong).ToList(); break; case 2: //按默认排序 pageList = pageList.OrderBy(i => i.MakeMoney).ThenBy(i => i.MakeMoney).ToList(); break; } result.IsSuccess = true; result.Message = "加载列表成功!"; result.ResultData["List"] = pageList; } catch (Exception ex) { ex.Data["Method"] = "TakeAuditController>>List"; new ExceptionHelper().LogException(ex); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult ImportExcel(HttpPostedFileBase file) { int count = 0; var result = new ReturnMessage(false) { Message = "上传失败!" }; try { var data = ExcelHelper.ExcelImport(file.InputStream); if (data != null) { if (data.Columns.Count != 8) { result.Message = "请按照模板格式正确填写内容!"; return(Json(result)); } int successcount = 0, errorcount = 0; foreach (System.Data.DataRow row in data.Rows) { try { if (row[0].ToString() != "") { AuditOrganizationEntity entity = new AuditOrganizationEntity(); entity.OrganizationId = Util.Util.NewUpperGuid(); entity.Name = row[0].ToString(); var provincelist = AreaBLL.Instance.GetList().Where((o) => { return(o.AreaName == row[1].ToString()); }); if (provincelist != null && provincelist.Count() > 0) { var province = provincelist.FirstOrDefault(); entity.ProvinceId = province.AreaId; entity.ProvinceName = province.AreaName; } var citylist = AreaBLL.Instance.GetList().Where((o) => { return(o.AreaName == row[2].ToString()); }); if (citylist != null && citylist.Count() > 0) { var city = citylist.FirstOrDefault(); entity.CityId = city.AreaId; entity.CityName = city.AreaName; } var countyList = AreaBLL.Instance.GetList().Where((o) => { return(o.AreaName == row[3].ToString()); }); if (countyList != null && countyList.Count() > 0) { var county = countyList.FirstOrDefault(); entity.CountyId = county.AreaId; entity.CountyName = county.AreaName; } entity.AddressInfo = row[4].ToString(); entity.ConectName = row[5].ToString(); entity.ConectTel = row[6].ToString(); entity.IsTake = row[7].ToString() == "是" ? 1 : 0; entity.Status = (int)RCHL.Model.Enums.UseStatus.启用; entity.CreateTime = DateTime.Now; entity.CreateId = LoginUser.UserId; AuditOrganizationBLL.Instance.Add(entity); successcount++; } } catch (Exception) { errorcount++; } } result.IsSuccess = true; result.Message = string.Format("导入成功({0}条),失败({1}条))!", successcount, errorcount); } } catch (Exception ex) { ex.Data["Method"] = "AuditOrganizationController>>Import"; new ExceptionHelper().LogException(ex); } return(Json(result)); }
public ActionResult GetPageListJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); AuditOrganizationEntity para = new AuditOrganizationEntity(); if (!string.IsNullOrWhiteSpace(queryJson)) { var queryParam = queryJson.ToJObject(); //类型 if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty()) { var condition = queryParam["condition"].ToString().ToLower(); switch (condition) { case "name": para.Name = queryParam["keyword"].ToString(); break; case "conecttel": para.ConectTel = queryParam["keyword"].ToString(); break; case "addressinfo": para.AddressInfo = queryParam["keyword"].ToString(); break; } } } var pageList = AuditOrganizationBLL.Instance.GetPageList(para, ref pagination); if (pageList != null) { pageList.ForEach((o) => { if (o.ProvinceId != null) { o.ProvinceName = AreaBLL.Instance.GetEntity(o.ProvinceId).AreaName; } if (o.CityId != null) { o.CityName = AreaBLL.Instance.GetEntity(o.CityId).AreaName; } if (o.CountyId != null) { o.CountyName = AreaBLL.Instance.GetEntity(o.CountyId).AreaName; } o.AddressInfo = o.ProvinceName + o.CityName + o.CountyName + o.AddressInfo; if (o.OrganizationId != null) { o.WeekAuditOrderCount = AuditOrderBLL.Instance.GetList(new AuditOrderEntity() { OrganizationId = o.OrganizationId, StartTime = Util.Time.CalculateFirstDateOfWeek(DateTime.Now).ToString(), EndTime = Util.Time.CalculateLastDateOfWeek(DateTime.Now).ToString() }).Count(); o.TotalAuditOrderCount = AuditOrderBLL.Instance.GetList(new AuditOrderEntity() { OrganizationId = o.OrganizationId }).Count(); o.WeekTakeAuditOrderCount = TakeAuditOrderBLL.Instance.GetList(new TakeAuditOrderEntity() { OrganizationId = o.OrganizationId, StartTime = Util.Time.CalculateFirstDateOfWeek(DateTime.Now).ToString(), EndTime = Util.Time.CalculateLastDateOfWeek(DateTime.Now).ToString() }).Count(); o.TotalTakeAuditOrderCount = TakeAuditOrderBLL.Instance.GetList(new TakeAuditOrderEntity() { OrganizationId = o.OrganizationId }).Count(); } }); } var JsonData = new { rows = pageList, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(Content(JsonData.ToJson())); }
/// <summary> /// 导出EXCEL /// </summary> public void ExportExcel(string queryJson) { string cacheKey = Request["cacheid"] as string; HttpRuntime.Cache[cacheKey + "-state"] = "processing"; HttpRuntime.Cache[cacheKey + "-row"] = "0"; try { //这里要url解码 var queryParam = Server.UrlDecode(queryJson).ToJObject(); AuditOrganizationEntity para = new AuditOrganizationEntity(); //类型 if (!queryParam["condition"].IsEmpty() && !queryParam["keyword"].IsEmpty()) { var condition = queryParam["condition"].ToString().ToLower(); switch (condition) { case "name": para.Name = queryParam["keyword"].ToString(); break; case "conecttel": para.ConectTel = queryParam["keyword"].ToString(); break; case "addressinfo": para.AddressInfo = queryParam["keyword"].ToString(); break; } } var list = AuditOrganizationBLL.Instance.GetList(para); if (list != null) { list.ForEach((o) => { if (o.ProvinceId != null) { o.ProvinceName = AreaBLL.Instance.GetEntity(o.ProvinceId).AreaName; } if (o.CityId != null) { o.CityName = AreaBLL.Instance.GetEntity(o.CityId).AreaName; } if (o.CountyId != null) { o.CountyName = AreaBLL.Instance.GetEntity(o.CountyId).AreaName; } o.AddressInfo = o.ProvinceName + o.CityName + o.CountyName + o.AddressInfo; if (o.OrganizationId != null) { o.WeekAuditOrderCount = AuditOrderBLL.Instance.GetList(new AuditOrderEntity() { OrganizationId = o.OrganizationId, StartTime = Util.Time.CalculateFirstDateOfWeek(DateTime.Now).ToString(), EndTime = Util.Time.CalculateLastDateOfWeek(DateTime.Now).ToString() }).Count(); o.TotalAuditOrderCount = AuditOrderBLL.Instance.GetList(new AuditOrderEntity() { OrganizationId = o.OrganizationId }).Count(); o.WeekTakeAuditOrderCount = TakeAuditOrderBLL.Instance.GetList(new TakeAuditOrderEntity() { OrganizationId = o.OrganizationId, StartTime = Util.Time.CalculateFirstDateOfWeek(DateTime.Now).ToString(), EndTime = Util.Time.CalculateLastDateOfWeek(DateTime.Now).ToString() }).Count(); o.TotalTakeAuditOrderCount = TakeAuditOrderBLL.Instance.GetList(new TakeAuditOrderEntity() { OrganizationId = o.OrganizationId }).Count(); if (o.IsTake != null) { o.IsTakeName = o.IsTake == 1 ? "是" : "否"; } if (o.Status != null) { o.StatusName = ((RCHL.Model.Enums.UseStatus)o.Status).ToString(); } } }); //设置导出格式 ExcelConfig excelconfig = new ExcelConfig(); excelconfig.Title = "年检机构信息"; excelconfig.TitleFont = "微软雅黑"; excelconfig.TitlePoint = 10; excelconfig.FileName = "年检机构信息.xls"; excelconfig.IsAllSizeColumn = true; //每一列的设置,没有设置的列信息,系统将按datatable中的列名导出 List <ColumnEntity> listColumnEntity = new List <ColumnEntity>(); excelconfig.ColumnEntity = listColumnEntity; ColumnEntity columnentity = new ColumnEntity(); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "Name", ExcelColumn = "机构名称", Width = 20 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "AddressInfo", ExcelColumn = "地址", Width = 20 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "ConectName", ExcelColumn = "联系人", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "ConectTel", ExcelColumn = "联系电话", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "MakeMoney", ExcelColumn = "年检费用", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "WeekAuditOrderCount", ExcelColumn = "本周年检订单数", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "TotalAuditOrderCount", ExcelColumn = "总年检订单数", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "WeekTakeAuditOrderCount", ExcelColumn = "本周代审订单数", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "TotalTakeAuditOrderCount", ExcelColumn = "总代审订单数", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "IsTakeName", ExcelColumn = "是否代审", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "StatusName", ExcelColumn = "状态", Width = 15 }); //需合并索引 //excelconfig.MergeRangeIndexArr = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; //调用导出方法 ExcelHelper <AuditOrganizationEntity> .ExcelDownload(list, excelconfig); HttpRuntime.Cache[cacheKey + "-state"] = "done"; } } catch (Exception) { HttpRuntime.Cache[cacheKey + "-state"] = "error"; } }
public ActionResult SaveForm(string keyValue, AuditOrganizationEntity entity) { try { var result = new ReturnMessage(false) { Message = "编辑失败!" }; if (string.IsNullOrWhiteSpace(entity.Name)) { result.Message = "名称不能为空"; return(Json(result)); } if (keyValue == "") { entity.OrganizationId = Util.Util.NewUpperGuid(); entity.CreateTime = DateTime.Now; entity.CreateId = LoginUser.UserId; entity.Content = entity.Content == null ? "" : entity.Content.Replace("&", "&").Replace(">", ">").Replace("<", "<"); entity.PriceContent = entity.PriceContent == null ? "" : entity.PriceContent.Replace("&", "&").Replace(">", ">").Replace("<", "<"); AuditOrganizationBLL.Instance.Add(entity); if (entity.ImageListStr != null) { //删除 AttachmentPicBLL.Instance.DeleteByObjectId(entity.OrganizationId); //插入 var imags = JsonConvert.DeserializeObject <List <string> >(entity.ImageListStr); int index = 0; foreach (string item in imags) { if (item != "") { AttachmentPicEntity pic = new AttachmentPicEntity(); pic.PicId = Util.Util.NewUpperGuid(); pic.PicName = item; pic.SortNum = index; pic.ObjectId = entity.OrganizationId; pic.Type = (int)RCHL.Model.Enums.AttachmentPicType.年检机构; AttachmentPicBLL.Instance.Add(pic); } index++; } } } else { entity.OrganizationId = keyValue; entity.Content = entity.Content == null ? "" : entity.Content.Replace("&", "&").Replace(">", ">").Replace("<", "<"); entity.PriceContent = entity.PriceContent == null ? "" : entity.PriceContent.Replace("&", "&").Replace(">", ">").Replace("<", "<"); AuditOrganizationBLL.Instance.Update(entity); if (entity.ImageListStr != null) { //删除 AttachmentPicBLL.Instance.DeleteByObjectId(entity.OrganizationId); //插入 var imags = JsonConvert.DeserializeObject <List <string> >(entity.ImageListStr); int index = 0; foreach (string item in imags) { if (item != "") { AttachmentPicEntity pic = new AttachmentPicEntity(); pic.PicId = Util.Util.NewUpperGuid(); pic.PicName = item; pic.SortNum = index; pic.ObjectId = entity.OrganizationId; pic.Type = (int)RCHL.Model.Enums.AttachmentPicType.年检机构; AttachmentPicBLL.Instance.Add(pic); } index++; } } } return(Success("保存成功")); } catch (Exception ex) { ex.Data["Method"] = "AuditOrganizationController>>Register"; new ExceptionHelper().LogException(ex); return(Error("保存失败")); } }