示例#1
0
        /// <summary>
        /// SSO接口重推记录更新
        /// </summary>
        /// <param name="userName">此次调用接口用户</param>
        /// <param name="res">SSO接口返回值</param>
        /// <param name="ssoResultID">调用SSO结果表ID</param>
        /// <param name="i">是否第一次标识</param>
        private void UpDataSsoResult(string userName, string res, SSOResult ssoResult, int i)
        {
            SSOResultBLL ssoResultBll = Factory.BusinessFactory.CreateBll <SSOResultBLL>();

            if (string.IsNullOrEmpty(res))//sso接口返回空时,不往下执行了
            {
                return;
            }
            SsoRes ssoRes = JsonHelper.DeserializeJson <SsoRes>(res);

            ssoResult.SuccessUser += UserArryToString(ssoRes.success_user);
            ssoResult.Status       = ssoRes.error;

            //重推首次覆盖错误用户
            if (i == 0 && ssoRes.error == 0)
            {
                ssoResult.ErrorUser     = UserArryToString(ssoRes.error_user);
                ssoResult.RepeatUser    = UserArryToString(ssoRes.repeat_user);
                ssoResult.UndefinedUser = UserArryToString(ssoRes.undefined_user);
            }
            else
            {
                ssoResult.ErrorUser     += UserArryToString(ssoRes.error_user) == "" ? "" : "," + UserArryToString(ssoRes.error_user);
                ssoResult.RepeatUser    += UserArryToString(ssoRes.repeat_user) == "" ? "" : "," + UserArryToString(ssoRes.repeat_user);
                ssoResult.UndefinedUser += UserArryToString(ssoRes.undefined_user) == "" ? "" : "," + UserArryToString(ssoRes.undefined_user);
            }

            ssoResultBll.Update(ssoResult);
        }
示例#2
0
        /// <summary>
        /// SSO接口调用记录更新(成功部分)
        /// </summary>
        /// <param name="popupMsgPlan">弹窗信息计划</param>
        /// <param name="userName">此次调用接口用户</param>
        /// <param name="res">SSO接口返回值</param>
        /// <param name="ssoResultId">调用SSO结果表ID</param>
        /// <returns></returns>
        private int UpDataSsoResult(PopupMsgPlan popupMsgPlan, List <SsoRes> listSsoRes, int ssoResultId)
        {
            SSOResultBLL ssoResultBll = Factory.BusinessFactory.CreateBll <SSOResultBLL>();
            //if(string.IsNullOrEmpty(res))//sso接口返回空时,不往下执行了
            //    return 0;
            //SsoRes ssoRes = JsonHelper.DeserializeJson<SsoRes>(res);

            SSOResult ssoResult;

            if (ssoResultId > 0)
            {
                ssoResult = ssoResultBll.Get("Id", ssoResultId);
            }
            else
            {
                ssoResult = new SSOResult();
            }

            ssoResult.PlanId    = popupMsgPlan.PlanId;
            ssoResult.Url       = OutWindowUrl + popupMsgPlan.PlanId;
            ssoResult.BeginTime = popupMsgPlan.BeginTime;
            ssoResult.EndTime   = popupMsgPlan.EndTime;
            ssoResult.PopupType = popupMsgPlan.PopupType;
            ssoResult.Status    = 0;

            string success_user   = "";
            string error_user     = "";
            string repeat_user    = "";
            string undefined_user = "";

            foreach (var item in listSsoRes)
            {
                string success   = UserArryToString(item.success_user);
                string error     = UserArryToString(item.error_user);
                string repeat    = UserArryToString(item.repeat_user);
                string undefined = UserArryToString(item.undefined_user);

                if (success != "")
                {
                    success_user += (success_user == "" ? success : "," + success);
                }
                if (error != "")
                {
                    error_user += (error_user == "" ? error : "," + error);
                }
                if (repeat != "")
                {
                    repeat_user += (repeat_user == "" ? repeat : "," + repeat);
                }
                if (undefined != "")
                {
                    undefined_user += (undefined_user == "" ? undefined : "," + undefined);
                }
            }


            //数据库已经存在这条数据
            if (ssoResultId > 0)
            {
                ssoResult.Id             = ssoResultId;
                ssoResult.SuccessUser   += success_user;
                ssoResult.ErrorUser     += error_user;
                ssoResult.RepeatUser    += repeat_user;
                ssoResult.UndefinedUser += undefined_user;
                ssoResultBll.Update(ssoResult);
                Loger.Info("[调用结果][更新] SSO调用记录: PlanId = " + popupMsgPlan.PlanId + ", 成功 = " + (ssoResult.SuccessUser == "" ? "0" : ssoResult.SuccessUser.Split(',').Length.ToString()) + " , 失败 = " + (ssoResult.ErrorUser == "" ? "0" : ssoResult.ErrorUser.Split(',').Length.ToString()) + " , 重复 = " + (ssoResult.RepeatUser == "" ? "0" : ssoResult.RepeatUser.Split(',').Length.ToString()) + " , 不存在 = " + (ssoResult.UndefinedUser == "" ? "0" : ssoResult.UndefinedUser.Split(',').Length.ToString()));
                return(ssoResultId);
            }
            else
            {
                ssoResult.SuccessUser   = success_user;
                ssoResult.ErrorUser     = error_user;
                ssoResult.RepeatUser    = repeat_user;
                ssoResult.UndefinedUser = undefined_user;
                Loger.Info("[调用结果][新增] SSO调用记录: PlanId = " + popupMsgPlan.PlanId + ", 成功 = " + (ssoResult.SuccessUser == "" ? "0" : ssoResult.SuccessUser.Split(',').Length.ToString()) + " , 失败 = " + (ssoResult.ErrorUser == "" ? "0" : ssoResult.ErrorUser.Split(',').Length.ToString()) + " , 重复 = " + (ssoResult.RepeatUser == "" ? "0" : ssoResult.RepeatUser.Split(',').Length.ToString()) + " , 不存在 = " + (ssoResult.UndefinedUser == "" ? "0" : ssoResult.UndefinedUser.Split(',').Length.ToString()));
                return(ssoResultBll.Add(ssoResult));
            }
        }
示例#3
0
        /// <summary>
        /// SSO接口调用记录更新(失败部分)
        /// </summary>
        /// <param name="popupMsgPlan">弹窗信息计划</param>
        /// <param name="userName">此次调用接口用户</param>
        /// <param name="res">SSO接口返回值</param>
        /// <param name="ssoResultId">调用SSO结果表ID</param>
        /// <returns></returns>
        private int UpDataSsoResult(PopupMsgPlan popupMsgPlan, string userName, SsoRes ssoRes, int ssoResultId)
        {
            SSOResultBLL ssoResultBll = Factory.BusinessFactory.CreateBll <SSOResultBLL>();
            //if(string.IsNullOrEmpty(res))//sso接口返回空时,不往下执行了
            //    return 0;
            //SsoRes ssoRes = JsonHelper.DeserializeJson<SsoRes>(res);

            SSOResult ssoResult;

            if (ssoResultId > 0)
            {
                ssoResult = ssoResultBll.Get("Id", ssoResultId);
            }
            else
            {
                ssoResult = new SSOResult();
            }

            ssoResult.PlanId    = popupMsgPlan.PlanId;
            ssoResult.Url       = OutWindowUrl + popupMsgPlan.PlanId;
            ssoResult.BeginTime = popupMsgPlan.BeginTime;
            ssoResult.EndTime   = popupMsgPlan.EndTime;
            ssoResult.PopupType = popupMsgPlan.PopupType;
            ssoResult.Status    = ssoRes.error;

            //SSO接口返回调用成功
            if (ssoRes.error == 0)
            {
                //数据库已经存在这条数据
                if (ssoResultId > 0)
                {
                    ssoResult.Id             = ssoResultId;
                    ssoResult.SuccessUser   += UserArryToString(ssoRes.success_user) == "" ? "" : "," + UserArryToString(ssoRes.success_user);
                    ssoResult.ErrorUser     += UserArryToString(ssoRes.error_user) == "" ? "" : "," + UserArryToString(ssoRes.error_user);
                    ssoResult.RepeatUser    += UserArryToString(ssoRes.repeat_user) == "" ? "" : "," + UserArryToString(ssoRes.repeat_user);
                    ssoResult.UndefinedUser += UserArryToString(ssoRes.undefined_user) == "" ? "" : "," + UserArryToString(ssoRes.undefined_user);
                    ssoResultBll.Update(ssoResult);
                    return(ssoResultId);
                }
                else
                {
                    ssoResult.SuccessUser   = UserArryToString(ssoRes.success_user);
                    ssoResult.ErrorUser     = UserArryToString(ssoRes.error_user);
                    ssoResult.RepeatUser    = UserArryToString(ssoRes.repeat_user);
                    ssoResult.UndefinedUser = UserArryToString(ssoRes.undefined_user);
                    return(ssoResultBll.Add(ssoResult));
                }
            }
            else //SSO接口调用失败,所有用户加到出错用户字段
            {
                //数据库已经存在这条数据
                if (ssoResultId > 0)
                {
                    ssoResult.Id         = ssoResultId;
                    ssoResult.ErrorUser += ssoResult.ErrorUser == "" ?  "" : "," + userName;
                    ssoResultBll.Update(ssoResult);
                    return(ssoResultId);
                }
                else
                {
                    ssoResult.ErrorUser = userName;
                    return(ssoResultBll.Add(ssoResult));
                }
            }
        }