/// <summary> /// 处理完成向节点发送提醒短信 /// </summary> /// <param name="licenseEntity">关联案件</param> /// <param name="activityName">发送的节点名称</param> /// <param name="mes">消息</param> /// <param name="receiveTime">发送时间</param> /// <returns></returns> public bool LicenseActionNote(LicenseMainEntity licenseEntity, string activityName, string mes, DateTime receiveTime) { if (string.IsNullOrEmpty(licenseEntity.Id) || string.IsNullOrEmpty(licenseEntity.Area) || string.IsNullOrEmpty(activityName) || string.IsNullOrEmpty(mes) || receiveTime == default(DateTime)) { return(false); } var formId = licenseEntity.Id; var feActivityBll = new FeActivityBll(); var userBll = new CrmUserBll(); var searchModel = new CrmMessageWorkEntity(); searchModel.FormID = formId; searchModel.State = 0;//未处理!! var crmMessageList = new CrmMessageWorkBll().GetSearchResultByEnd(searchModel).Where(i => { var activityEntity = feActivityBll.GetActivity(i.ActivityInstanceID); return(activityEntity.FirstOrDefault(z => z.NoneName.Equals(activityName)) != null); }).ToList(); if (crmMessageList != null && crmMessageList.Count > 0)//存在要发送消息的未处理的待办 { var actionInstance = new FeActionInstanceBll().GetSearchResultByEnd(new FeActionInstanceEntity() { ActivityID = crmMessageList[0].ActivityInstanceID, CommunityID = licenseEntity.Area }); //获取人员 foreach (var item in actionInstance) { var user = userBll.Get(item.UserID); var entity = new ComNoteEntity() { Id = Guid.NewGuid().ToString(), ResourcesId = formId, ReceivePhone = user.Mobile, MistakeInfo = mes, ReceiveTime = receiveTime, Status = 0, RowStatus = 1 }; Add(entity); } return(true); } else { return(false); } }
/// <summary> /// 保存节点对象 /// </summary> /// <param name="activity">节点基本属性</param> /// <param name="note">接收对象Json数据</param> /// <param name="rules">规则Json数据</param> /// <param name="activityId">节点编号</param> /// <param name="processId">流程编号</param> /// <param name="oldNoneName">节点名称</param> /// <returns></returns> public JsonResult SaveActivity(string activity, string note, string rules, string activityId, string processId, string oldNoneName) { var rtEntity = new StatusModel <DBNull> { rtData = null, rtMsrg = "", rtState = 1 }; var strArry = activity.Split('|'); var noneName = strArry[1].Trim(); #region 保存流程 var feOldProcess = new FeProcessBll().QueryByFlowId(processId); if (feOldProcess.Count > 0) { if (!string.IsNullOrEmpty(oldNoneName)) { feOldProcess[0].FlowChart = feOldProcess[0].FlowChart.Replace(oldNoneName, noneName); } feOldProcess[0].Id = Guid.NewGuid().ToString(); if (!new FeProcessBll().SaveProcess(feOldProcess[0])) { rtEntity.rtData = null; rtEntity.rtMsrg = "主流程保存失败!"; rtEntity.rtState = 1; } } else { rtEntity.rtData = null; rtEntity.rtMsrg = "未查到流程!"; rtEntity.rtState = 1; return(Json(rtEntity, JsonRequestBehavior.AllowGet)); } #endregion #region 保存节点属性 var feActivityEntity = new FeActivityEntity(); if (string.IsNullOrEmpty(activityId)) { activityId = Guid.NewGuid().ToString(); } feActivityEntity.ActivityID = activityId; feActivityEntity.ProcessID = processId; feActivityEntity.NoneID = strArry[0].Trim(); feActivityEntity.NoneName = strArry[1].Trim(); feActivityEntity.SendORWithdrawalActivityID = strArry[2].Trim(); feActivityEntity.FormAddress = strArry[3].Trim(); if (strArry[4].Trim() == "1") { feActivityEntity.IsContrastCommunity = true; } if (strArry[5].Trim() == "1") { feActivityEntity.IsContrastRule = true; } if (strArry[6].Trim() == "1") { feActivityEntity.IsSendOnOpener = true; } feActivityEntity.NoneDisposeManner = Convert.ToInt32(strArry[7].Trim()); feActivityEntity.FulfillAssemblyName = strArry[8].Trim(); feActivityEntity.FulfillClassFullName = strArry[9].Trim(); feActivityEntity.OverdueAssemblyName = strArry[10].Trim(); feActivityEntity.OverdueClassFullName = strArry[11].Trim(); feActivityEntity.OverdueHour = Convert.ToInt32(strArry[12].Trim()); feActivityEntity.Remark = strArry[13].Trim(); var istrue = new FeActivityBll().ExitstActivityId(feActivityEntity.ActivityID); if (istrue) { if (new FeActivityBll().DeleActivity(feActivityEntity.ActivityID)) { new FeActivityBll().Save(feActivityEntity); } } else { if (!new FeActivityBll().Save(feActivityEntity)) { rtEntity.rtData = null; rtEntity.rtMsrg = "当前节点不存在!"; rtEntity.rtState = 1; return(Json(rtEntity, JsonRequestBehavior.AllowGet)); } } #endregion #region 保存接收对象 var listActionInstance = JsonConvert.DeserializeObject <List <FeActionInstanceEntity> >(note); //序列化Json var saveActionInstance = new FeActionInstanceBll().SaveActionInstance(listActionInstance, activityId); //保存接收对象 if (!saveActionInstance) { rtEntity.rtData = null; rtEntity.rtMsrg = "保存对象失败!"; rtEntity.rtState = 1; return(Json(rtEntity, JsonRequestBehavior.AllowGet)); } #endregion #region 保存规则 if (!string.IsNullOrEmpty(rules)) { var ruleList = JsonConvert.DeserializeObject <List <FeRuleCodeEntity> >(rules); var saveRule = new FeRuleCodeBll().SaveRule(ruleList, activityId); //保存规则 if (!saveRule) { rtEntity.rtData = null; rtEntity.rtMsrg = "保存规则失败!"; rtEntity.rtState = 1; } } #endregion return(Json(rtEntity, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 读取节点信息 /// 添加人:张西琼 /// 时间:2014/7/29 /// </summary> /// <param name="activityId"></param> /// <param name="isUnlock"></param> /// <returns></returns> public string ReadFeActionInstance(string activityId, int isUnlock) { var feActionInstance = new FeActionInstanceBll().GetActionEntity(activityId, isUnlock); return(JsonConvert.SerializeObject(feActionInstance)); }