Example #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);
        }
Example #2
0
        /// <summary>
        /// SSO数据推送, 重推
        /// </summary>
        /// <param name="ssoResultId">ssoResultId</param>
        public void SsoPushOne(int ssoResultId)
        {
            int planId = 0;

            try
            {
                SSOResultBLL ssoResultBll = Factory.BusinessFactory.CreateBll <SSOResultBLL>();
                SSOResult    ssoResult    = ssoResultBll.Get("Id", ssoResultId);

                if (ssoResult != null)
                {
                    PopupMsgPlanBLL opupMsgPlanBll = Factory.BusinessFactory.CreateBll <PopupMsgPlanBLL>();
                    PopupMsgPlan    popupMsgPlan   = opupMsgPlanBll.Get("PlanId", ssoResult.PlanId);
                    planId = (int)ssoResult.PlanId;

                    if (popupMsgPlan != null)
                    {
                        List <string> listUserName = GetUserNameToGroup(ssoResult.ErrorUser); //所有错误用户, 每100个一组
                        string        parameter    = string.Empty;
                        int           i            = 0;
                        foreach (var userName in listUserName)
                        {
                            parameter = GetAddOutWindowParameter(popupMsgPlan, userName);
                            string res = RequestHelper.WebRequest(AddOutWindow, "post", parameter, "UTF-8", true);
                            if (!string.IsNullOrEmpty(res))
                            {
                                res = new EncDecUtil().decyptData(res, accesskey);
                            }
                            Loger.Info("PlanId:" + planId + ",SSO数据重推返回结果:" + res);
                            UpDataSsoResult(userName, res, ssoResult, i);
                            i++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Loger.Error(ex, "\r\n=====error=====\r\nPlanId:" + planId + ",SSO数据重推异常:");
            }
        }
Example #3
0
 /// <summary>
 /// 删除单条数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Delete(SSOResult obj)
 {
     return(dal.Delete(obj));
 }
Example #4
0
 /// <summary>
 /// 更新单条数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Update(SSOResult obj)
 {
     return(dal.Update(obj));
 }
Example #5
0
 /// <summary>
 /// 添加单条数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Add(SSOResult obj)
 {
     return(dal.Add(obj));
 }
Example #6
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));
            }
        }
Example #7
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));
                }
            }
        }