public object getNewProjects([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; OperatorProvider.AppUserId = userId; //设置当前用户 Operator currUser = OperatorProvider.Provider.Current(); DataTable dt = new OutsouringengineerBLL().GetEngineerByCurrDept(); return(new { Code = 0, Count = 0, Info = "操作成功", data = dt }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
public ActionResult GetFormJson(string keyValue) { OutsouringengineerBLL engneerBll = new OutsouringengineerBLL(); var data = workMeetingbll.GetEntity(keyValue); if (data == null) { var loginUser = ERCHTMS.Code.OperatorProvider.Provider.Current(); OutsouringengineerEntity eEntity = null; if (loginUser.isEpiboly == true) { eEntity = engneerBll.GetEntity(loginUser.ProjectID); } data = new WorkMeetingEntity() { MEETINGDATE = DateTime.Now }; if (eEntity != null) { data.ENGINEERID = eEntity.ID; data.ENGINEERNAME = eEntity.ENGINEERNAME; data.ENGINEERLEVEL = eEntity.ENGINEERLEVEL; data.ENGINEERTYPE = eEntity.ENGINEERTYPE; data.ENGINEERAREA = eEntity.ENGINEERAREA; data.ENGINEERLETDEPT = eEntity.ENGINEERLETDEPT; data.ENGINEERCONTENT = eEntity.ENGINEERCONTENT; data.ENGINEERCODE = eEntity.ENGINEERCODE; data.MEETINGNAME = string.Format("{0}{1}开工会", DateTime.Now.ToString("yyyyMMdd"), data.ENGINEERNAME); } } var engneer = engneerBll.GetEntity(data.ENGINEERID); if (engneer != null) { data.OUTPROJECTNAME = new DepartmentBLL().GetEntity(engneer.OUTPROJECTID).FullName; } return(ToJsonResult(data)); }
public object GetProjectList([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!" }); } string orgid = res.Contains("orgid") ? dy.data.orgid : ""; DataTable dt = new OutsouringengineerBLL().GetEngineerDataByCondition(curUser, "100", orgid); return(new { code = 0, count = 0, info = "操作成功", data = dt }); } catch (Exception ex) { return(new { code = -1, count = 0, info = ex.Message }); } }
/// <summary> /// 部门工作计划推送流程 /// </summary> /// <param name="keyValue"></param> /// <param name="entity"></param> /// <returns></returns> private string DepartFlow(string keyValue, PlanApplyEntity entity) { var errorMsg = ""; //此处需要判断当前人角色。 string wfFlag = string.Empty; //当前用户 Operator curUser = OperatorProvider.Provider.Current(); //参与人员 string participant = string.Empty; //EHS部门encode DataItemModel ehsDepart = dataitemdetailbll.GetDataItemListByItemCode("'EHSDepartment'").Where(p => p.ItemName == curUser.OrganizeId).ToList().FirstOrDefault(); //分管领导 //var fgLeaderUser = userbll.GetListForCon(x => x.RoleName.Contains("公司级用户") && x.RoleName.Contains("安全管理员")).Select(x => x.Account).ToList(); //安全管理员、部门负责人 //var isSafer = userbll.HaveRoleListByKey(curUser.UserId, "'100105'").Rows.Count > 0; var isManager = userbll.HaveRoleListByKey(curUser.UserId, "'100104'").Rows.Count > 0; //流程推进 if (ehsDepart != null && ehsDepart.ItemValue == curUser.DeptCode && isManager == true) { wfFlag = "3"; //申请=>审批 errorMsg = ">分管领导"; //分管领导 var fgLeaderUser = userbll.GetListForCon(x => x.RoleName.Contains("公司级用户") && x.RoleName.Contains("安全管理员")).Select(x => x.Account).ToList(); participant = string.Join(",", fgLeaderUser); } else if ((ehsDepart != null && ehsDepart.ItemValue == curUser.DeptCode) || (curUser.RoleName.Contains("部门级") && isManager == true)) { //EHS部 wfFlag = "2"; //申请=>EHS负责人审核 errorMsg = ">EHS负责人"; var deptUser = userbll.GetUserListByRole(ehsDepart.ItemValue, "'100104'", ""); participant = string.Join(",", deptUser.Select(x => x.Account)); } else if (curUser.RoleName.Contains("承包商")) { //承包商走所有工程的责任部门 wfFlag = "1";//申请=>部门负责人审核 errorMsg = "工程责任部门负责人"; var projectList = new OutsouringengineerBLL().GetList().Where(x => x.OUTPROJECTID == curUser.DeptId).ToList(); var deptUser = new List <UserEntity>(); for (int i = 0; i < projectList.Count; i++) { var pDept = new DepartmentBLL().GetEntity(projectList[i].ENGINEERLETDEPTID); if (pDept != null) { deptUser = userbll.GetUserListByRole(pDept.EnCode, "'100104'", "").ToList(); } if (!string.IsNullOrWhiteSpace(participant)) { participant += "," + string.Join(",", deptUser.Select(x => x.Account)); } else { participant += string.Join(",", deptUser.Select(x => x.Account)); } } } else { //安全管理员 wfFlag = "1";//申请=>部门负责人审核 errorMsg = "部门负责人"; if (curUser.RoleName.Contains("部门级")) { var deptUser = userbll.GetUserListByRole(curUser.DeptCode, "'100104'", ""); participant = string.Join(",", deptUser.Select(x => x.Account)); } else { var pDept = new DepartmentBLL().GetParentDeptBySpecialArgs(curUser.ParentId, "部门"); var deptUser = userbll.GetUserListByRole(pDept.DeptCode, "'100104'", ""); participant = string.Join(",", deptUser.Select(x => x.Account)); } } if (!string.IsNullOrEmpty(participant)) { entity.CheckUserAccount = participant; planApplyBll.SaveForm(keyValue, entity); int count = htworkflowbll.SubmitWorkFlow(keyValue, participant, wfFlag, curUser.UserId); if (count > 0) { htworkflowbll.UpdateFlowStateByObjectId("hrs_PlanApply", "flowstate", keyValue); //更新业务流程状态 } errorMsg = ""; } return(errorMsg); }
public ActionResult SubmitForm(string keyValue, SecurityDynamicsEntity entity) { Operator curUser = ERCHTMS.Code.OperatorProvider.Provider.Current(); string state = string.Empty; string outengineerid = curUser.DeptId; string flowid = string.Empty; string moduleName = "安全动态"; /// <param name="currUser">当前登录人</param> /// <param name="state">是否有权限审核 1:能审核 0 :不能审核</param> /// <param name="moduleName">模块名称</param> /// <param name="outengineerid">工程Id</param> ManyPowerCheckEntity mpcEntity = dailyexaminebll.CheckAuditPower(curUser, out state, moduleName, curUser.DeptId); //新增时会根据角色自动审核,此时需根据工程和审核配置查询审核流程Id OutsouringengineerEntity engineerEntity = new OutsouringengineerBLL().GetEntity(curUser.DeptId); List <ManyPowerCheckEntity> powerList = new ManyPowerCheckBLL().GetListBySerialNum(curUser.OrganizeCode, "安全动态"); List <ManyPowerCheckEntity> checkPower = new List <ManyPowerCheckEntity>(); //先查出执行部门编码 for (int i = 0; i < powerList.Count; i++) { if (powerList[i].CHECKDEPTCODE == "-1" || powerList[i].CHECKDEPTID == "-1") { //powerList[i].CHECKDEPTCODE = new DepartmentBLL().GetEntity(entity.PROJECTID).EnCode; //powerList[i].CHECKDEPTID = new DepartmentBLL().GetEntity(entity.PROJECTID).DepartmentId; //powerList[i].CHECKDEPTCODE = new DepartmentBLL().GetEntityByCode(entity.CreateUserDeptCode).EnCode; //powerList[i].CHECKDEPTID = new DepartmentBLL().GetEntityByCode(entity.CreateUserDeptCode).DepartmentId; powerList[i].CHECKDEPTCODE = curUser.DeptCode; powerList[i].CHECKDEPTID = curUser.DeptId; } //创建部门 if (powerList[i].CHECKDEPTCODE == "-3" || powerList[i].CHECKDEPTID == "-3") { if (entity.CreateUserDeptCode == null || entity.CreateUserDeptCode == "") { powerList[i].CHECKDEPTCODE = new DepartmentBLL().GetEntityByCode(curUser.DeptCode).EnCode; powerList[i].CHECKDEPTID = new DepartmentBLL().GetEntityByCode(curUser.DeptCode).DepartmentId; } else { powerList[i].CHECKDEPTCODE = new DepartmentBLL().GetEntityByCode(entity.CreateUserDeptCode).EnCode; powerList[i].CHECKDEPTID = new DepartmentBLL().GetEntityByCode(entity.CreateUserDeptCode).DepartmentId; } } } //登录人是否有审核权限--有审核权限直接审核通过 for (int i = 0; i < powerList.Count; i++) { if (powerList[i].CHECKDEPTID == curUser.DeptId) { var rolelist = curUser.RoleName.Split(','); for (int j = 0; j < rolelist.Length; j++) { if (powerList[i].CHECKROLENAME.Contains(rolelist[j])) { checkPower.Add(powerList[i]); break; } } } } if (checkPower.Count > 0) { ManyPowerCheckEntity check = checkPower.Last();//当前 for (int i = 0; i < powerList.Count; i++) { if (check.ID == powerList[i].ID) { flowid = powerList[i].ID; } } } if (null != mpcEntity) { //保存安全动态记录 entity.FLOWDEPT = mpcEntity.CHECKDEPTID; entity.FLOWDEPTNAME = mpcEntity.CHECKDEPTNAME; entity.FLOWROLE = mpcEntity.CHECKROLEID; entity.FLOWROLENAME = mpcEntity.CHECKROLENAME; entity.IsSend = "0"; //标记已经从登记到审核阶段 entity.ISOVER = "0"; //流程未完成,1表示完成 entity.FLOWNAME = mpcEntity.CHECKDEPTNAME + "审核中"; entity.FlowId = mpcEntity.ID; //DataTable dt = new UserBLL().GetUserAccountByRoleAndDept(curUser.OrganizeId, mpcEntity.CHECKDEPTID, mpcEntity.CHECKROLENAME); //var userAccount = dt.Rows[0]["account"].ToString(); //var userName = dt.Rows[0]["realname"].ToString(); //JPushApi.PushMessage(userAccount, userName, "WB001", entity.ID); } else //为空则表示已经完成流程 { entity.FLOWDEPT = ""; entity.FLOWDEPTNAME = ""; entity.FLOWROLE = ""; entity.FLOWROLENAME = ""; entity.IsSend = "0"; //标记已经从登记到审核阶段 entity.ISOVER = "1"; //流程未完成,1表示完成 entity.FLOWNAME = ""; entity.FlowId = flowid; entity.ReleaseTime = DateTime.Now;//发布时间 } securitydynamicsbll.SaveForm(keyValue, entity); //添加审核记录 if (state == "1") { //审核信息表 AptitudeinvestigateauditEntity aidEntity = new AptitudeinvestigateauditEntity(); aidEntity.AUDITRESULT = "0"; //通过 aidEntity.AUDITTIME = DateTime.Now; aidEntity.AUDITPEOPLE = curUser.UserName; aidEntity.AUDITPEOPLEID = curUser.UserId; aidEntity.APTITUDEID = entity.Id; //关联的业务ID aidEntity.AUDITOPINION = ""; //审核意见 aidEntity.AUDITSIGNIMG = curUser.SignImg; if (null != mpcEntity) { aidEntity.REMARK = (powerList[0].AUTOID.Value - 1).ToString(); //备注 存流程的顺序号 //aidEntity.FlowId = mpcEntity.ID; } else { aidEntity.REMARK = "7"; } aidEntity.FlowId = flowid; //if (curUser.RoleName.Contains("公司级用户") || curUser.RoleName.Contains("厂级部门用户")) //{ // aidEntity.AUDITDEPTID = curUser.OrganizeId; // aidEntity.AUDITDEPT = curUser.OrganizeName; //} //else //{ aidEntity.AUDITDEPTID = curUser.DeptId; aidEntity.AUDITDEPT = curUser.DeptName; //} aptitudeinvestigateauditbll.SaveForm(aidEntity.ID, aidEntity); } return(Success("操作成功!")); }
public object GetDetial([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userid = dy.userid; string id = dy.data ?? ""; //获取用户基本信息 OperatorProvider.AppUserId = userid; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!", data = new object() }); } var entity = workMeetingbll.GetEntity(id); if (entity != null) { //外包单位 OutsouringengineerBLL engneerBll = new OutsouringengineerBLL(); var engneer = engneerBll.GetEntity(entity.ENGINEERID); if (engneer != null) { entity.OUTPROJECTNAME = new DepartmentBLL().GetEntity(engneer.OUTPROJECTID).FullName; } if (!string.IsNullOrWhiteSpace(engneer.OUTPROJECTID)) { var dept = deptbll.GetEntity(engneer.OUTPROJECTID); entity.OUTPROJECTCODE = dept.EnCode; entity.OUTPROJECTNAME = dept.FullName; } Dictionary <string, List <Photo> > files = new Dictionary <string, List <Photo> >(); //内容1附件 DataTable file = fileInfoBLL.GetFiles(entity.ID + "c1"); var pC1 = new List <Photo>(); foreach (DataRow dr in file.Rows) { Photo p = new Photo(); p.id = dr["fileid"].ToString(); p.filename = dr["filename"].ToString(); p.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1); pC1.Add(p); } files.Add("c1", pC1); //内容2附件 file = fileInfoBLL.GetFiles(entity.ID + "c2"); var pC2 = new List <Photo>(); foreach (DataRow dr in file.Rows) { Photo p = new Photo(); p.id = dr["fileid"].ToString(); p.filename = dr["filename"].ToString(); p.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1); pC2.Add(p); } files.Add("c2", pC2); //内容3附件 file = fileInfoBLL.GetFiles(entity.ID + "c3"); var pC3 = new List <Photo>(); foreach (DataRow dr in file.Rows) { Photo p = new Photo(); p.id = dr["fileid"].ToString(); p.filename = dr["filename"].ToString(); p.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1); pC3.Add(p); } files.Add("c3", pC3); //签名附件 file = fileInfoBLL.GetFiles(entity.ID); var pList = new List <Photo>(); foreach (DataRow dr in file.Rows) { Photo p = new Photo(); p.id = dr["fileid"].ToString(); p.filename = dr["filename"].ToString(); p.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1); pList.Add(p); } files.Add("sign", pList); entity.FILES = files; //return json(new //{ // code = 0, // info = "获取数据成功", // count = 0, // data = entity //}, new jsonserializersettings() { dateformatstring = "yyyy-mm-dd hh:mm:ss" }); JsonSerializerSettings settings = new JsonSerializerSettings { //ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换 DateFormatString = "yyyy-MM-dd HH:mm:ss", //格式化日期 //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现 }; return(new { code = 0, info = "获取数据成功", count = 0, data = JObject.Parse(JsonConvert.SerializeObject(entity, Formatting.None, settings)) }); } else { return(new { code = -1, count = 0, info = "获取失败,记录不存在。", data = new object() }); } } catch (Exception ex) { return(new { code = -1, count = 0, info = "获取失败,错误:" + ex.Message, data = new object() }); } }
public object GetInfo([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; string disid = dy.data.disid; var disBll = new DistrictBLL(); var didBll = new DataItemDetailBLL(); var deptBll = new DepartmentBLL(); //获取用户基本信息 OperatorProvider.AppUserId = userId; //设置当前用户 Operator user = OperatorProvider.Provider.Current(); var entity = techdisclosurebll.GetEntity(disid); var project = new OutsouringengineerBLL().GetEntity(entity.PROJECTID); if (project != null) { if (!string.IsNullOrWhiteSpace(project.OUTPROJECTID)) { var dept = new DepartmentBLL().GetEntity(project.OUTPROJECTID); project.OUTPROJECTCODE = dept.EnCode; project.OUTPROJECTNAME = dept.FullName; } //if (!string.IsNullOrWhiteSpace(project.ENGINEERAREA)) //{ // var area = disBll.GetEntity(project.ENGINEERAREA); // if (area != null) project.ENGINEERAREANAME = project.EngAreaName; //} if (!string.IsNullOrWhiteSpace(project.ENGINEERTYPE)) { var listType = didBll.GetDataItem("ProjectType", project.ENGINEERTYPE).ToList(); if (listType != null && listType.Count > 0) { entity.ENGINEERTYPENAME = listType[0].ItemName; } } if (!string.IsNullOrWhiteSpace(project.ENGINEERLEVEL)) { var listLevel = didBll.GetDataItem("ProjectLevel", project.ENGINEERLEVEL).ToList(); if (listLevel != null && listLevel.Count > 0) { entity.ENGINEERLEVELNAME = listLevel[0].ItemName; } } } else { var listLevel = didBll.GetDataItem("ProjectLevel", entity.ENGINEERLEVEL).ToList(); if (listLevel != null && listLevel.Count > 0) { entity.ENGINEERLEVELNAME = listLevel[0].ItemName; } var listType = didBll.GetDataItem("ProjectType", entity.ENGINEERTYPE).ToList(); if (listType != null && listType.Count > 0) { entity.ENGINEERTYPENAME = listType[0].ItemName; } } var listmaj = didBll.GetDataItem("BelongMajor", entity.DISCLOSUREMAJOR).ToList(); if (listmaj != null && listmaj.Count > 0) { entity.DISCLOSUREMAJORNAME = listmaj[0].ItemName; } var files = new FileInfoBLL().GetFiles(disid); //获取相关附件 var pics = new FileInfoBLL().GetFiles(disid + "01"); //获取相关附件 string webUrl = new DataItemDetailBLL().GetItemValue("imgUrl"); foreach (DataRow dr in files.Rows) { dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/"); } foreach (DataRow dr in pics.Rows) { dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/"); } List <AptitudeinvestigateauditEntity> AptitudeList = aptitudeinvestigateauditbll.GetAuditList(entity.ID); for (int i = 0; i < AptitudeList.Count; i++) { if (string.IsNullOrWhiteSpace(AptitudeList[i].AUDITSIGNIMG)) { AptitudeList[i].AUDITSIGNIMG = string.Empty; } else { AptitudeList[i].AUDITSIGNIMG = webUrl + AptitudeList[i].AUDITSIGNIMG.ToString().Replace("../../", "/").ToString(); } } //查询审核流程图 List <CheckFlowData> nodeList = new AptitudeinvestigateinfoBLL().GetAppFlowList(entity.ID, "13", curUser); var data = new { AuditInfo = AptitudeList, nodeList = nodeList, project = project, entity = entity, piclist = pics, filelist = files }; Dictionary <string, string> dict_props = new Dictionary <string, string>(); //Id 转换前的列名 keyvalue 转换后的列名 //dict_props.Add("Id", "keyvalue"); JsonSerializerSettings settings = new JsonSerializerSettings { ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换 DateFormatString = "yyyy-MM-dd HH:mm", //格式化日期 //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现 }; return(new { code = 0, info = "获取数据成功", count = 1, data = JObject.Parse(JsonConvert.SerializeObject(data, Formatting.None, settings)) }); } catch (Exception ex) { return(new { code = -1, count = 0, info = ex.Message }); } }
public object GetInfo([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; string id = dy.data.uid; bool IsPermission = false; //是否有权限 OperatorProvider.AppUserId = userId; //设置当前用户 var user = userBll.GetUserInfoEntity(id); //获取用户基本信息 DataItemDetailBLL itemBll = new DataItemDetailBLL(); string path = itemBll.GetItemValue("imgUrl"); var cert = new ERCHTMS.Busines.PersonManage.CertificateBLL().GetList(id).Select(t => new { t.CertName, t.CertNum, SendDate = t.SendDate.Value.ToString("yyyy-MM-dd"), t.Years, t.SendOrgan, FilePath = path + t.FilePath }).ToList(); //获取人员证书信息 var wzInfo = new DesktopBLL().GetWZInfoByUserId(id); //违章信息 var health = new ERCHTMS.Busines.OccupationalHealthManage.OccupationalstaffdetailBLL().GetUserTable(id); //职业病信息 //20190326 fwz 新增查询个人接触职业危害因素 string Hazardfactor = ""; //判断是否是本人\厂领导\EHS部与人力资源部的人 if (userId == id) { IsPermission = true; } //获取当前操作用户 var Appuser = userBll.GetUserInfoEntity(userId); //获取用户基本信息 //EHS部与人力资源部配置在字典中 通过字典查找 var Perdeptname = Appuser.DepartmentCode; DataItemDetailBLL dataItemDetailBLL = new DataItemDetailBLL(); var data = dataItemDetailBLL.GetDataItemListByItemCode("'SelectDept'").ToList(); if (data != null) { foreach (var Peritem in data) { string value = Peritem.ItemValue; string[] values = value.Split('|'); for (int i = 0; i < values.Length; i++) { if (values[i] == Perdeptname) //如果部门编码对应则是有权限的人 { IsPermission = true; break; } } } } //如果是厂领导也有权限 if (Appuser.RoleName.Contains("厂级部门用户") && Appuser.RoleName.Contains("公司领导")) { IsPermission = true; } if (IsPermission) { Hazardfactor = new HazardfactoruserBLL().GetUserHazardfactor(user.Account); } var work = new WorkRecordBLL().GetList(id).Select(t => new { EnterDate = t.EnterDate.ToString().Contains("0001") ? "" : t.EnterDate.ToString("yyyy-MM-dd"), LeaveTime = t.LeaveTime.ToString().Contains("0001") ? "" : t.LeaveTime.ToString("yyyy-MM-dd"), t.DeptName, t.PostName, t.OrganizeName, t.JobName }).ToList();//工作记录 string deptname = new TransferBLL().GetDeptName(user.DepartmentId); string projectName = ""; if (!string.IsNullOrEmpty(user.ProjectId)) { OutsouringengineerEntity entity = new OutsouringengineerBLL().GetEntity(user.ProjectId); if (entity != null) { projectName = entity.ENGINEERNAME; } } string photo = ""; if (!string.IsNullOrEmpty(user.HeadIcon)) { if (!string.IsNullOrEmpty(path)) { photo = path + user.HeadIcon; } } int score = 100; var item = itemBll.GetEntity("csjf"); if (item != null) { score = int.Parse(item.ItemValue); } int point = 0; string argValue = new DataItemDetailBLL().GetItemValue("Point"); if (!string.IsNullOrEmpty(argValue) && argValue == "point") { dynamic pointdata = UpdatePoint(user.Account); if (pointdata != null && pointdata.Qualitydata.Count > 0) { point = pointdata.Qualitydata[0].point; } } //2019-03-08 Fwz修改 加入职务字段 部门显示改为层级显示 return(new { Code = 0, Count = 1, Info = "获取数据成功", data = new { realname = user.RealName, point = point, sex = user.Gender, identifyid = user.IdentifyID, deptname = deptname, postname = user.DutyName, dutyname = user.PostName, organizename = user.OrganizeName, native = user.Native, nation = user.Nation, isSpecial = user.IsSpecial, isSpecialEqu = user.IsSpecialEqu, isBlack = user.IsBlack, mobile = user.Mobile, usertype = user.UserType, isEpiboly = user.isEpiboly, enterDate = user.EnterTime == null ? "" : user.EnterTime.Value.ToString("yyyy-MM-dd"), leaveTime = user.DepartureTime == null ? "" : user.DepartureTime.Value.ToString("yyyy-MM-dd"), isPresence = user.isPresence, score = new UserScoreBLL().GetUserScore(user.UserId, DateTime.Now.Year.ToString()) + score, projectName = projectName, faceUrl = photo, CertInfo = cert, IllInfo = health, Hazardfactor = Hazardfactor, IsPermission = IsPermission, WorkInfo = work, IllegalInfo = wzInfo, isfourperson = user.IsFourPerson, fourpersontype = user.FourPersonType } }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
public object GetInfo([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; string disid = dy.data.disid; var disBll = new DistrictBLL(); var didBll = new DataItemDetailBLL(); var deptBll = new DepartmentBLL(); //获取用户基本信息 OperatorProvider.AppUserId = userId; //设置当前用户 Operator user = OperatorProvider.Provider.Current(); var entity = techdisclosurebll.GetEntity(disid); var project = new OutsouringengineerBLL().GetEntity(entity.PROJECTID); if (!string.IsNullOrWhiteSpace(project.OUTPROJECTID)) { var dept = new DepartmentBLL().GetEntity(project.OUTPROJECTID); project.OUTPROJECTCODE = dept.EnCode; project.OUTPROJECTNAME = dept.FullName; } if (!string.IsNullOrWhiteSpace(project.ENGINEERAREA)) { var area = disBll.GetEntity(project.ENGINEERAREA); if (area != null) { project.ENGINEERAREANAME = area.DistrictName; } } if (!string.IsNullOrWhiteSpace(project.ENGINEERTYPE)) { var listType = didBll.GetDataItem("ProjectType", project.ENGINEERTYPE).ToList(); if (listType != null && listType.Count > 0) { project.ENGINEERTYPENAME = listType[0].ItemName; } } if (!string.IsNullOrWhiteSpace(project.ENGINEERLEVEL)) { var listLevel = didBll.GetDataItem("ProjectLevel", project.ENGINEERLEVEL).ToList(); if (listLevel != null && listLevel.Count > 0) { project.ENGINEERLEVELNAME = listLevel[0].ItemName; } } var files = new FileInfoBLL().GetFiles(disid); //获取相关附件 var pics = new FileInfoBLL().GetFiles(disid + "01"); //获取相关附件 string webUrl = new DataItemDetailBLL().GetItemValue("imgUrl"); foreach (DataRow dr in files.Rows) { dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/"); } foreach (DataRow dr in pics.Rows) { dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/"); } var data = new { project = project, entity = entity, piclist = pics, filelist = files }; Dictionary <string, string> dict_props = new Dictionary <string, string>(); //Id 转换前的列名 keyvalue 转换后的列名 //dict_props.Add("Id", "keyvalue"); JsonSerializerSettings settings = new JsonSerializerSettings { ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换 DateFormatString = "yyyy-MM-dd HH:mm", //格式化日期 //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现 }; return(new { code = 0, info = "获取数据成功", count = 1, data = JObject.Parse(JsonConvert.SerializeObject(data, Formatting.None, settings)) }); } catch (Exception ex) { return(new { code = -1, count = 0, info = ex.Message }); } }