/// <summary> /// 发送消息列表到MQ /// </summary> /// <param name="list"></param> private int SendMessageList2MQ(List <OAMQMessage> list) { int successCount = 0; int errorCount = 10; string strActiveMQErrorCount = System.Configuration.ConfigurationManager.AppSettings["ActivceMQ_ErrorCount"]; Int32.TryParse(strActiveMQErrorCount, out errorCount); try { foreach (OAMQMessage message in list) { try { if (message.Flowmess == 9) { var arrayParam = BuildMQMessageDelete(message); using (Plugin.OAMessage.OAMessage.WebServices.OfsTodoDataWebService service = new Plugin.OAMessage.OAMessage.WebServices.OfsTodoDataWebService()) { var result = service.deleteUserRequestInfoByMap(arrayParam); message.MessageRemark = string.Join(",", result.ToList().Select(x => string.Format("{0}:{1}", x.key, x.value))); } } else { var arrayParam = BuildMQMessage(message); using (Plugin.OAMessage.OAMessage.WebServices.OfsTodoDataWebService service = new Plugin.OAMessage.OAMessage.WebServices.OfsTodoDataWebService()) { Common.Log.Info("【输入】{0}", Newtonsoft.Json.JsonConvert.SerializeObject(arrayParam)); var result = service.receiveRequestInfoByMap(arrayParam); message.MessageRemark = string.Join(",", result.ToList().Select(x => string.Format("{0}:{1}", x.key, x.value))); } } message.Status = 1; successCount++; } catch (Exception ex) { message.ErrorCount += 1; //如果大于重发次数,标记为发送失败 if (message.ErrorCount >= errorCount) { message.Status = 2; } else { message.Status = 0; } //将下面的异常写入到log中 BPF.OAMQServices.Common.Log.Error("发送消息到MQ出错,消息编号:" + message.MessageId, ex); } //更新消息表 OAMQAdapter.Instance.Update(message); } return(successCount); } finally { } }
/// <summary> /// 通用接收待办类 /// </summary> /// <param name="flowid">流程ID</param> /// <param name="flowtitle">流程标题</param> /// <param name="workflowname">工作流名称</param> /// <param name="nodename">当前节点</param> /// <param name="pcurl">PC端审批地址</param> /// <param name="appurl">App端审批地址</param> /// <param name="creator">流程创建人</param> /// <param name="receiver">流程接收人</param> /// <param name="isremark">流程处理状态 0待办 2已办 4办结</param> /// <param name="viewtype">流程查看状态 0未读 1已读</param> public static void CommonReceive(string flowid, string flowtitle, string workflowname, string nodename, string pcurl, string appurl, string creator, string receiver, int isremark, int viewtype, DateTime createtime) { try { using (Plugin.OAMessage.OAMessage.WebServices.OfsTodoDataWebService service = new Plugin.OAMessage.OAMessage.WebServices.OfsTodoDataWebService()) { var receiveTime = DateTime.Now; var paramList = new Dictionary <string, string>(); paramList.Add("syscode", ConfigurationManager.AppSettings["OA.SysCode"]); paramList.Add("flowid", flowid); paramList.Add("requestname", flowtitle); paramList.Add("workflowname", workflowname); paramList.Add("nodename", nodename); paramList.Add("pcurl", SSOToolkit.Instance.GetAuthOAUrlWithSSO(pcurl, receiver, flowid)); paramList.Add("appurl", SSOToolkit.Instance.GetAuthOAUrlWithSSO(appurl, receiver, flowid)); paramList.Add("creator", creator); paramList.Add("isremark", isremark.ToString()); paramList.Add("viewtype", viewtype.ToString()); paramList.Add("createdatetime", createtime.ToString("yyyy-MM-dd HH:mm:ss")); paramList.Add("receiver", receiver); paramList.Add("receivedatetime", receiveTime.ToString("yyyy-MM-dd HH:mm:ss")); var array = paramList.Select(x => new Plugin.OAMessage.OAMessage.WebServices.anyType2anyTypeMapEntry() { key = x.Key, value = x.Value }).ToArray(); var result = service.receiveRequestInfoByMap(array); } } catch (Exception ex) { throw new OAMessageException("调用OA接口出现异常", ex); } }