public JsonResponse DeleteAccountList([FromBody] AccountListDto dto)
        {
            //判断用户是否登录
            if (!TokenHelper.CheckLoginStateByUserId(dto.UserId))
            {
                return(BadResponse("用户未登录", null, false));
            }
            //获取账单基本信息
            AccountList accountListModel = new AccountList();

            accountListModel = AccountListBll.GetModelByCode(dto.Code);
            if (accountListModel == null)
            {
                return(BadResponse("无该账单信息!", null));
            }
            string[] userIdArray = dto.AllUserId.Split(',');
            if (userIdArray.Length == 1)
            {
                SystemNoticeBll.ExecuteSql("DELETE FROM AccountList WHERE Code='" + dto.Code + "';DROP TTABLE " + dto.Code);
                return(OkResponse(null, "账单已删除。"));
            }
            //获取账单成员并通知账单成员(写入通知表)
            string content = "账单:" + accountListModel.Name + "即将被账单创建者删除,请校验账单信息无资金纠纷后确认删除。";

            SystemNoticeBll.ExecuteSql(SystemNoticeHelper.InsertNotice(dto.AllUserId, content));

            //写入操作记录
            AccountListLog log = new AccountListLog
            {
                Code    = dto.Code,
                NewInfo = "删除账单" + accountListModel.Name,
                Type    = LogType.Delete
            };

            AccountListLogBll.Insert(log);
            //若都确认后、自动删除该表,每一个人确认时都查看此人是否为最后确认的人、若是、则直接删除账单
            //否则十五天后数据库定时作业会删除该表)
            return(OkResponse(null, "账单已提交删除,待所有成员均已确认后账单可立即删除,若确认时间超过15日则自动删除。"));
        }
        public JsonResponse ModifyAccountListInfo([FromBody] AccountListDto dto)
        {
            //判断用户是否登录
            if (!TokenHelper.CheckLoginStateByUserId(dto.UserId))
            {
                return(BadResponse("用户未登录", null, false));
            }
            AccountList model = new AccountList();

            model = AccountListBll.GetModelByCode(dto.Code);
            if (model == null)
            {
                return(BadResponse("该账单不存在", null));
            }
            if (dto.Name != null && dto.Name != "" && dto.Name != null && dto.Name != "")
            {
                return(BadResponse("参数提供不完整", null));
            }
            //修改名字
            if (dto.Name != null && dto.Name != "")
            {
                AccountListLog log = new AccountListLog
                {
                    Code    = dto.Code,
                    OldInfo = "账单名:" + model.Name,
                    NewInfo = "账单名:" + dto.Name
                };
                AccountListLogBll.Insert(log);
                model.Name = dto.Name;
            }
            if (dto.AllUserId != null && dto.AllUserId != "")
            {
                //根据AllUserId返回昵称
                AccountListLog log = new AccountListLog();
                log.Code = dto.Code;
                string sql = "proc_GetNicknameByUserId";
                //Old
                DynamicParameters p = new DynamicParameters();
                p.Add("@UserId", model.AllUserId, DbType.String);
                List <UserInfo> oldList = new List <UserInfo>();
                oldList.AddRange(SqlHelper.QuerySP <UserInfo>(sql, p).ToList());
                log.OldInfo = "账单使用人:";
                foreach (UserInfo user in oldList)
                {
                    log.OldInfo += (user.Nickname + ";");
                }
                //New
                p = new DynamicParameters();
                p.Add("@UserId", dto.AllUserId, DbType.String);
                List <UserInfo> newList = new List <UserInfo>();
                newList.AddRange(SqlHelper.QuerySP <UserInfo>(sql, p).ToList());
                log.OldInfo = "账单使用人:";
                foreach (UserInfo user in newList)
                {
                    log.NewInfo += (user.Nickname + ";");
                }
                //Note
                //del
                string delName = "";
                bool   have    = false;
                for (var i = 0; i < oldList.Count; i++)
                {
                    have = false;
                    for (var j = 0; j < newList.Count; j++)
                    {
                        if (oldList[i] == newList[j])
                        {
                            have = true;
                            break;
                        }
                    }
                    if (!have)
                    {
                        delName += oldList[i].Nickname;
                    }
                }
                if (delName != "")
                {
                    log.Note += ("移除成员:" + delName);
                }
                //add
                string addName = "";
                for (var i = 0; i < newList.Count; i++)
                {
                    have = false;
                    for (var j = 0; j < oldList.Count; j++)
                    {
                        if (newList[i] == oldList[j])
                        {
                            have = true;
                            break;
                        }
                    }
                    if (!have)
                    {
                        addName += oldList[i].Nickname;
                    }
                }
                if (addName != "")
                {
                    log.Note += ("新增成员:" + addName);
                }
                AccountListLogBll.Insert(log);
                model.AllUserId = dto.AllUserId;
            }
            if (AccountListBll.Update(model))
            {
                return(OkResponse(null, "修改成功!"));
            }
            else
            {
                return(BadResponse("修改失败!", null));
            }
        }