/// <summary> /// 新增 /// </summary> /// <param name="t"></param> /// <returns></returns> public override int Insert(ModSysFlow t) { try { int result = CurrentDAL.Insert(t); try { #region 推送 if (result > 0)//发送推送消息 { //获取公司id string cid = t.CompanyId; //获取公司管理员id BllSysMaster bllSysMaster = new BllSysMaster(); var masterlist = bllSysMaster.GetCIdByList(cid); if (masterlist != null) { var master = masterlist.FirstOrDefault(c => !string.IsNullOrEmpty(c.BDUserId) && (c.Attribute == (int)AdminTypeEnum.单位管理员 || c.Attribute == (int)AdminTypeEnum.供应商管理员 || c.Attribute == (int)AdminTypeEnum.维保公司管理员 || c.Attribute == (int)AdminTypeEnum.系统管理员 || c.Attribute == (int)AdminTypeEnum.消防部门管理员)); if (master != null) { ModPushView view = new ModPushView(); view.PushType = 1; //推送类型,依次往后推(0:巡检通知,1:审核通知) view.Id = Guid.NewGuid().ToString(); view.CreateTime = DateTime.Now; //纪录推送时间 view.Infomation = t.Title; view.Correlation = ""; string custom_content = JsonHelper.ToJson(view);//自定义格式有 PushResultView response = GeTuiPush.PushMessage(master.PaltForm, master.BDUserId, master.MobileCode, "审核通知", t.Title, custom_content); if (response.result == "ok") { BllSysPushMessage bllSysPushMessage = new BllSysPushMessage(); ModSysPushMessage info = new ModSysPushMessage() { Id = view.Id, CreateTime = DateTime.Now, CorrelativeId = "", CompanyId = cid, UserId = master.Id, Info = view.Infomation, PTitle = "审核通知", Status = 1, Type = view.PushType }; int a = bllSysPushMessage.Insert(info); } } } } #endregion } catch (Exception) { } return(result); } catch (Exception e) { return(0); } }
/// <summary> /// 审核流程 /// </summary> /// <param name="userid">审核人id</param> /// <param name="cid">审核人单位id</param> /// <param name="reamrk">描述</param> /// <param name="flowId">流程id</param> /// <param name="isResult">1:通过,2:不通过</param> /// <returns></returns> public bool WaitWork(string userid, string cid, string reamrk, string flowId, int isResult = 0) { var model = this.LoadData(flowId); StringBuilder sb = new StringBuilder(); if (model.FlowType == 1) //(1:单位管理员注册时的审核 2:普通用户注册审核 3:用户单位变更审核) { if (isResult == 1) //通过 { sb.Append("update Sys_Company set Status=" + (int)StatusEnum.正常 + " where Id='" + model.CompanyId + "';"); sb.AppendLine(); sb.Append("update Sys_Master set Status=" + (int)StatusEnum.正常 + " where Cid='" + model.CompanyId + "' and IsMain=1;");//一个单位关联一个管理员 sb.AppendLine(); sb.Append("update Sys_Flow set Reamrk='" + reamrk + "',FlowStatus=" + (int)StatusEnum.正常 + ",AuditUser='******',AuditTime=getdate() where Id='" + flowId + "';"); } else { //不通过 sb.Append("update Sys_Company set Status=" + (int)StatusEnum.除 + " where Id='" + model.CompanyId + "';"); sb.AppendLine(); sb.Append("update Sys_Master set Status=" + (int)StatusEnum.除 + " where Cid='" + model.CompanyId + "' and IsMain=1;"); //一个单位关联一个管理员 sb.AppendLine(); sb.Append("update Sys_Flow set Reamrk='" + reamrk + "',FlowStatus=" + (int)StatusEnum.除 + ",AuditUser='******',AuditTime=getdate() where Id='" + flowId + "';"); } } else if (model.FlowType == 2) { if (isResult == 1) { sb.Append("update Sys_Master set Status=" + (int)StatusEnum.正常 + " where Id='" + model.MasterId + "';"); sb.AppendLine(); sb.Append("update Sys_Flow set Reamrk='" + reamrk + "',FlowStatus=" + (int)StatusEnum.正常 + ",AuditUser='******',AuditTime=getdate() where Id='" + flowId + "';"); } else { sb.Append("update Sys_Master set Status=" + (int)StatusEnum.除 + " where Id='" + model.MasterId + "';"); sb.AppendLine(); sb.Append("update Sys_Flow set Reamrk='" + reamrk + "',FlowStatus=" + (int)StatusEnum.除 + ",AuditUser='******',AuditTime=getdate() where Id='" + flowId + "';"); } } else if (model.FlowType == 3) { //上级单位审核 if (isResult == 1) { sb.Append("update Sys_CompanyCognate set Status=" + (int)StatusEnum.正常 + " where FlowId='" + flowId + "';"); sb.AppendLine(); sb.Append("update Sys_Flow set Reamrk='" + reamrk + "',FlowStatus=" + (int)StatusEnum.正常 + ",AuditUser='******',AuditTime=getdate() where Id='" + flowId + "';"); } else { sb.Append("update Sys_CompanyCognate set Status=" + (int)StatusEnum.除 + " where FlowId='" + flowId + "';"); sb.AppendLine(); sb.Append("update Sys_Flow set Reamrk='" + reamrk + "',FlowStatus=" + (int)StatusEnum.除 + ",AuditUser='******',AuditTime=getdate() where Id='" + flowId + "';"); } } else if (model.FlowType == 4) { var r = "通过"; if (isResult == 1)//通过 { sb.Append("update Sys_Appointed set ResponsibleId='" + model.ApprovalUser + "' where Id='" + model.MasterId + "';"); sb.AppendLine(); sb.Append("update Sys_Flow set Reamrk='" + reamrk + "',FlowStatus=" + (int)StatusEnum.正常 + ",AuditUser='******',AuditTime=getdate() where Id='" + flowId + "';"); } else //不通过 { r = "不通过"; sb.Append("update Sys_Flow set Reamrk='" + reamrk + "',FlowStatus=" + (int)StatusEnum.除 + ",AuditUser='******',AuditTime=getdate() where Id='" + flowId + "';"); } try { #region 推送 BllSysMaster bllSysMaster = new BllSysMaster(); var master = bllSysMaster.LoadData(model.ApprovalUser); if (master != null && !string.IsNullOrEmpty(master.BDUserId)) { ModPushView view = new ModPushView(); view.PushType = 1; //推送类型,依次往后推(0:巡检通知,1:审核通知,2:变更责任人) view.Id = Guid.NewGuid().ToString(); view.CreateTime = DateTime.Now; //纪录推送时间 view.Infomation = model.Title; view.Correlation = ""; string custom_content = JsonHelper.ToJson(view);//自定义格式有 PushResultView response = GeTuiPush.PushMessage(master.PaltForm, master.BDUserId, master.MobileCode, "变更责任人:(" + r + ")", model.Title, custom_content); if (response.result == "ok") { BllSysPushMessage bllSysPushMessage = new BllSysPushMessage(); ModSysPushMessage info = new ModSysPushMessage() { Id = view.Id, CreateTime = DateTime.Now, CorrelativeId = "", CompanyId = cid, UserId = master.Id, Info = view.Infomation, PTitle = "变更责任人", Status = 1, Type = view.PushType }; int a = bllSysPushMessage.Insert(info); } } #endregion } catch (Exception) { } } int result = this.ExecuteNonQueryByText(sb.ToString()); if (result > 0) { return(true); } else { return(false); } }