/// <summary> /// 获取执行信息记录 /// </summary> /// <param name="keyvalue"></param> /// <returns></returns> public ActionResult GetConditonToJson(string keyvalue) { try { if (!string.IsNullOrEmpty(keyvalue)) { IList <FireWaterCondition> data = firewaterbll.GetConditionList(keyvalue).OrderBy(t => t.CreateDate).ToList(); for (int i = 0; i < data.Count; i++) { List <FileInfoEntity> filelist = fileinfobll.GetFileList(data[i].Id); //现场图片 if (filelist.Count > 0) { data[i].ScenePicPath = filelist[0].FilePath; } List <FileInfoEntity> filelist2 = fileinfobll.GetFileList(data[i].Id + "_02"); //附件 data[i].filenum = filelist2.Count().ToString(); data[i].num = i / 2 + 1; } return(ToJsonResult(data)); } return(ToJsonResult(null)); } catch (Exception ex) { return(Error(ex.ToString())); } }
public ActionResult CopyForm(string keyValue, string recid) { try { IList <FileInfoEntity> filelist = fileinfobll.GetFileList(recid); IList <FileInfoEntity> filelist1 = fileinfobll.GetFileList(keyValue); foreach (var item in filelist1) { fileinfobll.RemoveForm(item.FileId); } string dir = string.Format("~/Resource/{0}/{1}", "ht/images", DateTime.Now.ToString("yyyyMMdd")); foreach (var item in filelist) { if (!Directory.Exists(Server.MapPath(dir))) { Directory.CreateDirectory(Server.MapPath(dir)); } if (System.IO.File.Exists(Server.MapPath(item.FilePath))) { string newFileName = Guid.NewGuid().ToString() + item.FileExtensions; string newFilePath = dir + "/" + newFileName; System.IO.File.Copy(Server.MapPath(item.FilePath), Server.MapPath(newFilePath)); item.FilePath = newFilePath; } item.RecId = keyValue; item.FileId = Guid.NewGuid().ToString(); fileinfobll.SaveForm("", item); } return(Success("操作成功。")); } catch (Exception ex) { return(Error(ex.ToString())); } }
public void DeleteFileByRec(string recId) { if (!string.IsNullOrWhiteSpace(recId)) { var list = fileinfobll.GetFileList(recId); foreach (var file in list) { fileinfobll.RemoveForm(file.FileId); var filePath = ctx.Server.MapPath(file.FilePath); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } } } }
public void DeleteFileByRec(string recId) { if (!string.IsNullOrWhiteSpace(recId)) { var list = fileInfoBLL.GetFileList(recId); foreach (var file in list) { fileInfoBLL.RemoveForm(file.FileId); var filePath = dataitemdetailbll.GetItemValue("imgPath") + file.FilePath.Replace("~", ""); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } } } }
/// <summary> /// 获取证件照片 /// </summary> /// <param name="userId"></param> /// <returns></returns> public object GetCertImages([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string id = dy.data.id; string path = itemBll.GetItemValue("imgUrl"); FileInfoBLL fileInfoBLL = new FileInfoBLL(); var files = fileInfoBLL.GetFileList(id).Select(f => new { id = f.FileId, url = path + f.FilePath.Replace("~", "") }); return(new { code = 0, info = "操作成功", data = files }); } catch (Exception ex) { return(new { code = 1, info = ex.Message }); } }
/// <summary> /// 删除记录关联的附件及物理文件 /// </summary> /// <param name="recId"></param> public void DeleteFiles(string recId) { if (!string.IsNullOrWhiteSpace(recId)) { FileInfoBLL fileBll = new FileInfoBLL(); var list = fileBll.GetFileList(recId); foreach (var file in list) { fileBll.ThoroughRemoveForm(file.FileId); var filePath = HttpContext.Server.MapPath(file.FilePath); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } } } }
public object GetSafePunishDetail([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; string keyValue = res.Contains("id") ? dy.data.id : ""; //获取用户基本信息 OperatorProvider.AppUserId = userId; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!" }); } object data = SafePunish.GetEntity(keyValue); List <FileInfoEntity> file = fileInfoBLL.GetFileList(keyValue); string strurl = new DataItemDetailBLL().GetItemValue("imgUrl"); List <object> objects = new List <object>(); foreach (FileInfoEntity itemEntity in file) { objects.Add(new { fileid = itemEntity.FileId, filepath = strurl + itemEntity.FilePath.Replace("~", "") }); } var kpidata = safekpidatabll.GetList("").Where(p => p.SafePunishId == keyValue).FirstOrDefault(); var punishdetaildata = safepunishdetailbll.GetList("").Where(p => p.PunishId == keyValue); object obj = new { punishdata = data, kpidata = kpidata, punishdetaildata = punishdetaildata, punishfile = objects }; return(new { Code = 0, Count = -1, Info = "获取数据成功", data = obj }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
/// <summary> ///获取单条证书信息 /// </summary> /// <param name="userId"></param> /// <returns></returns> public object GetCertInfo([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string id = dy.data.id; string path = itemBll.GetItemValue("imgUrl"); FileInfoBLL fileInfoBLL = new FileInfoBLL(); CertificateEntity cert = certificatebll.GetEntity(id); return(new { code = 0, info = "获取数据成功", data = new { cert.Id, cert.CertNum, cert.CertName, cert.CertType, cert.WorkType, cert.WorkItem, SendDate = cert.SendDate.Value.ToString("yyyy-MM-dd"), StartDate = cert.StartDate == null ? "" : cert.StartDate.Value.ToString("yyyy-MM-dd"), cert.UserId, cert.Grade, cert.ZGName, cert.Craft, cert.Industry, cert.UserType, cert.Years, cert.SendOrgan, EndDate = cert.EndDate == null ? "" : cert.EndDate.Value.ToString("yyyy-MM-dd"), ApplyDate = cert.ApplyDate == null ? "" : cert.ApplyDate.Value.ToString("yyyy-MM-dd"), files = fileInfoBLL.GetFileList(id).Select(f => new { id = f.FileId, url = path + f.FilePath.Replace("~", "") }) } }); } catch (Exception ex) { return(new { code = 1, info = ex.Message }); } }
public JsonResult GetData(FormCollection fc) { var year = fc.Get("year"); var month = fc.Get("month"); var category = fc.Get("category"); var deptname = fc.Get("dept"); var page = int.Parse(fc.Get("page") ?? "1"); var rows = int.Parse(fc.Get("rows") ?? "20"); var costbll = new CostBLL(); var user = OperatorProvider.Provider.Current(); var total = 0; var costdept = Config.GetValue("CostDept"); var deptbll = new DepartmentBLL(); var dept = new DepartmentBLL().GetEntity(user.DeptId); var depts = default(List <DepartmentEntity>); if (dept == null || dept.FullName == costdept) { dept = deptbll.GetRootDepartment(); depts = deptbll.GetSubDepartments(dept.DepartmentId, null); } else { depts = deptbll.GetSubDepartments(dept.DepartmentId, null); depts.Add(dept); } var data = costbll.GetCostRecords(page, rows, out total, depts == null ? null : depts.Select(x => x.DepartmentId).ToArray(), year, month, category, deptname); var filebll = new FileInfoBLL(); foreach (var item in data) { var files = filebll.GetFileList(item.RecordId.ToString()); if (files.Count > 0) { item.FilePath = Url.Action("DownloadFile", new { area = "PublicInfoManage", controller = "ResourceFile", keyValue = files[0].FileId, filename = files[0].FileName, recId = files[0].RecId }); item.FileName = files[0].FileName; } } return(Json(new { rows = data, records = total, total = Math.Ceiling((double)total / rows), page })); }
public object GetSafeRewardDetail([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; string keyValue = res.Contains("id") ? dy.data.id : ""; //获取用户基本信息 OperatorProvider.AppUserId = userId; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!" }); } object obj = safereward.GetEntity(keyValue); List <FileInfoEntity> file = fileInfoBLL.GetFileList(keyValue); string strurl = new DataItemDetailBLL().GetItemValue("imgUrl"); List <object> objects = new List <object>(); foreach (FileInfoEntity itemEntity in file) { objects.Add(new { fileid = itemEntity.FileId, filepath = strurl + itemEntity.FilePath.Replace("~", "") }); } object reward = new { safereward = obj, rewardfile = objects }; return(new { Code = 0, Count = -1, Info = "获取数据成功", data = reward }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
public object GetToolDetail([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); int pageSize = res.Contains("pagesize") ? int.Parse(dy.data.pagesize.ToString()) : 10; //每页条数 int pageIndex = res.Contains("pageindex") ? int.Parse(dy.data.pageindex.ToString()) : 1; //请求页码 string userId = dy.userid; string keyValue = res.Contains("id") ? dy.data.id : ""; //获取用户基本信息 OperatorProvider.AppUserId = userId; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!" }); } ToolequipmentEntity toolequipment = toolequipmentBll.GetEntity(keyValue); object data = new object(); int records = -1; if (toolequipment != null) { object obj = new { id = toolequipment.Id, createuserid = toolequipment.CreateUserId, createuserdeptcode = toolequipment.CreateUserDeptCode, createuserorgcode = toolequipment.CreateUserOrgCode, createdate = toolequipment.CreateDate, createusername = toolequipment.CreateUserName, modifydate = toolequipment.ModifyDate, modifyuserid = toolequipment.ModifyUserId, modifyusername = toolequipment.ModifyUserName, equipmentvalue = toolequipment.EquipmentValue, equipmentname = toolequipment.EquipmentName, equipmenttype = toolequipment.EquipmentType, equipmentno = toolequipment.EquipmentNo, securitymanageruser = toolequipment.SecurityManagerUser, securitymanageruserid = toolequipment.SecurityManagerUserId, telephone = toolequipment.Telephone, specifications = toolequipment.Specifications, district = toolequipment.District, districtid = toolequipment.DistrictId, districtcode = toolequipment.DistrictCode, depositary = toolequipment.Depositary, checkdate = toolequipment.CheckDate, nextcheckdate = toolequipment.NextCheckDate, validitydate = toolequipment.ValidityDate, operuser = toolequipment.OperUser, operuserid = toolequipment.OperUserId, ischeck = toolequipment.IsCheck, outputdeptname = toolequipment.OutputDeptName, factoryno = toolequipment.FactoryNo, factorydate = toolequipment.FactoryDate, state = toolequipment.State, controluserid = toolequipment.ControlUserId, controlusername = toolequipment.ControlUserName, controldept = toolequipment.ControlDept, controldeptid = toolequipment.ControlDeptId, controldeptcode = toolequipment.ControlDeptCode, checkdatecycle = toolequipment.CheckDateCycle, acceptance = toolequipment.Acceptance, tooltype = toolequipment.ToolType, appraise = toolequipment.Appraise, descriptionfileid = toolequipment.DescriptionFileId, contractfileid = toolequipment.ContractFileId, belongdept = toolequipment.BelongDept, belongdeptid = toolequipment.BelongDeptId, belongdeptcode = toolequipment.BelongDeptCode }; List <FileInfoEntity> descriptionfile = fileInfoBLL.GetFileList(toolequipment.DescriptionFileId); List <FileInfoEntity> contractfile = fileInfoBLL.GetFileList(toolequipment.ContractFileId); string strurl = new DataItemDetailBLL().GetItemValue("imgUrl"); List <object> objects = new List <object>(); foreach (FileInfoEntity itemEntity in descriptionfile) { objects.Add(new { fileid = itemEntity.FileId, filepath = strurl + itemEntity.FilePath.Replace("~", ""), filename = itemEntity.FileName, recid = itemEntity.RecId }); } foreach (FileInfoEntity itemEntity in contractfile) { objects.Add(new { fileid = itemEntity.FileId, filepath = strurl + itemEntity.FilePath.Replace("~", ""), filename = itemEntity.FileName, recid = itemEntity.RecId }); } DataTable recordlist = GetToolRecordList(toolequipment.Id, pageIndex, pageSize, out records); List <object> recordfiles = new List <object>(); if (recordlist.Rows.Count > 0) { foreach (DataRow recordEntity in recordlist.Rows) { List <FileInfoEntity> fileinfos = fileInfoBLL.GetFileList(recordEntity["Id"].ToString()); if (fileinfos.Count > 0) { foreach (var fileInfoEntity in fileinfos) { recordfiles.Add(new { fileid = fileInfoEntity.FileId, filepath = strurl + fileInfoEntity.FilePath.Replace("~", ""), filename = fileInfoEntity.FileName, recid = fileInfoEntity.RecId }); } } } } //检查记录信息与附件信息 object toolrecord = new { recordlist = recordlist, recordfile = recordfiles }; data = new { tooldetail = obj, toolrecord = toolrecord, toolfile = objects, }; } //var recordentity = toolrecordbll.GetList("").Where(p => p.ToolEquipmentId == keyValue).ToList(); //List<object> toolrecord = new List<object>(); //foreach (var entity in recordentity) //{ // toolrecord.Add(new // { // id = entity.Id, // createuserid = entity.CreateUserId, // createuserdeptcode = entity.CreateUserDeptCode, // createuserorgcode = entity.CreateUserOrgCode, // createdate = entity.CreateDate, // createusername = entity.CreateUserName, // modifydate = entity.ModifyDate, // modifyuserid = entity.ModifyUserId, // modifyusername = entity.ModifyUserName, // nextcheckdate = entity.NextCheckDate, // equipmentname = entity.EquipmentName, // equipmentno = entity.EquipmentNo, // operuserid = entity.OperUserId, // voltagelevel = entity.VoltageLevel, // operuser = entity.OperUser, // appraise = entity.Appraise, // trialvoltage = entity.TrialVoltage, // checkdate = entity.CheckDate, // toolequipmentid = entity.ToolEquipmentId, // specification = entity.Specification, // checkproject = entity.CheckProject // }); //} return(new { Code = 0, Count = records, Info = "获取数据成功", data = data }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
/// <summary> /// 获取人员证件 /// </summary> /// <param name="userId"></param> /// <returns></returns> public object GetCertList([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userId; string path = itemBll.GetItemValue("imgUrl"); FileInfoBLL fileBll = new FileInfoBLL(); var certs = new ERCHTMS.Busines.PersonManage.CertificateBLL().GetList(userId).Select(t => new { t.Id, t.CertName, t.CertType, t.CertNum, SendDate = t.SendDate.Value.ToString("yyyy-MM-dd"), StartDate = t.StartDate == null ? "" : t.StartDate.Value.ToString("yyyy-MM-dd"), EndDate = t.EndDate == null ? "" : t.EndDate.Value.ToString("yyyy-MM-dd"), ApplyDate = t.ApplyDate == null ? "" : t.ApplyDate.Value.ToString("yyyy-MM-dd"), t.Years, t.SendOrgan, Status = GetStatus(t.Id, t.EndDate, t.ApplyDate), files = fileBll.GetFileList(t.Id).Select(f => new { id = f.FileId, url = path + f.FilePath.Replace("~", "") }) }).ToList();//获取人员证书信息 return(new { code = 0, info = "获取数据成功", data = certs, count = certs.Count }); } catch (Exception ex) { return(new { code = 1, info = ex.Message }); } }
public object GetForm([FromBody] JObject json) { try { string res = json.Value <string>("json"); var dy = JsonConvert.DeserializeAnonymousType(res, new { userid = string.Empty, data = new { id = string.Empty } }); //获取用户Id OperatorProvider.AppUserId = dy.userid; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, info = "请求失败,请登录!" }); } if (dy.data == null) { throw new ArgumentException("缺少参数:data为空"); } if (string.IsNullOrEmpty(dy.data.id)) { throw new ArgumentException("缺少参数:id为空"); } var fireWaterEntity = firewaterbll.GetEntity(dy.data.id); if (fireWaterEntity == null) { throw new ArgumentException("未找到信息"); } string webUrl = new DataItemDetailBLL().GetItemValue("imgUrl"); string jsondata = JsonConvert.SerializeObject(fireWaterEntity); FireWaterModel model = JsonConvert.DeserializeObject <FireWaterModel>(jsondata); if (model.SpecialtyType != null) { model.SpecialtyTypeName = scaffoldbll.getName(fireWaterEntity.SpecialtyType, "SpecialtyType"); } model.FireWaterAudits = scaffoldauditrecordbll.GetList(fireWaterEntity.Id); foreach (var item in model.FireWaterAudits) { item.AuditSignImg = string.IsNullOrWhiteSpace(item.AuditSignImg) ? "" : webUrl + item.AuditSignImg.ToString().Replace("../../", "/"); } DataTable cdt = fileInfoBLL.GetFiles(model.Id); IList <Photo> cfiles = new List <Photo>(); foreach (DataRow item in cdt.Rows) { Photo p = new Photo(); p.fileid = item[0].ToString(); p.filename = item[1].ToString(); p.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + item[2].ToString().Substring(1); cfiles.Add(p); } model.cfiles = cfiles; DataTable conditionfile = fileInfoBLL.GetFiles(model.Id + "01"); IList <Photo> conditionFiles = new List <Photo>(); foreach (DataRow item in conditionfile.Rows) { Photo p = new Photo(); p.fileid = item[0].ToString(); p.filename = item[1].ToString(); p.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + item[2].ToString().Substring(1); conditionFiles.Add(p); } model.conditionFiles = conditionFiles; model.conditionEntity = firewaterbll.GetConditionEntity(model.Id); model.RiskRecord = highriskrecordbll.GetList(model.Id).ToList(); string moduleName = string.Empty; string projectid = ""; if (fireWaterEntity.WorkDeptType == "0")//单位内部 { moduleName = "消防水使用-内部审核"; } else { moduleName = "消防水使用-外部审核"; projectid = fireWaterEntity.EngineeringId; } var nodelist = firewaterbll.GetAppFlowList(fireWaterEntity.Id, moduleName); model.CheckFlow = nodelist; #region 获取执行情况 IList <FireWaterCondition> conditionlist = firewaterbll.GetConditionList(fireWaterEntity.Id).OrderBy(t => t.CreateDate).ToList(); for (int i = 0; i < conditionlist.Count; i++) { var item = conditionlist[i]; List <FileInfoEntity> piclist = fileInfoBLL.GetFileList(item.Id); IList <ERCHTMS.Entity.HighRiskWork.ViewModel.Photo> temppiclist = new List <ERCHTMS.Entity.HighRiskWork.ViewModel.Photo>(); foreach (var temp in piclist) { ERCHTMS.Entity.HighRiskWork.ViewModel.Photo pic = new ERCHTMS.Entity.HighRiskWork.ViewModel.Photo(); pic.filename = temp.FileName; pic.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + temp.FilePath.Substring(1); pic.fileid = temp.FileId; temppiclist.Add(pic); } item.piclist = temppiclist; List <FileInfoEntity> filelist = fileInfoBLL.GetFileList(item.Id + "_02"); IList <ERCHTMS.Entity.HighRiskWork.ViewModel.Photo> tempfilelist = new List <ERCHTMS.Entity.HighRiskWork.ViewModel.Photo>(); foreach (var temp in filelist) { ERCHTMS.Entity.HighRiskWork.ViewModel.Photo pic = new ERCHTMS.Entity.HighRiskWork.ViewModel.Photo(); pic.filename = temp.FileName; pic.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + temp.FilePath.Substring(1); pic.fileid = temp.FileId; tempfilelist.Add(pic); } item.filelist = tempfilelist; item.num = i / 2 + 1; } model.conditionlist = conditionlist; #endregion Dictionary <string, string> dict_props = new Dictionary <string, string>(); JsonSerializerSettings settings = new JsonSerializerSettings { ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换 DateFormatString = "yyyy-MM-dd HH:mm" }; return(new { code = 0, info = "获取数据成功", data = JObject.Parse(JsonConvert.SerializeObject(model, Formatting.None, settings)) }); } catch (Exception ex) { return(new { code = -1, data = "", info = ex.Message }); } }