Esempio n. 1
0
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            Operator user  = OperatorProvider.Provider.Current();
            var      watch = CommonHelper.TimerStart();

            pagination.p_kid         = "id";
            pagination.p_fields      = "examinecode,examinetype,examinetodept,examinemoney,examineperson,remark,flowdept,flowrolename,createuserid,createuserdeptcode,createuserorgcode,issaved,isover,examinecontent";
            pagination.p_tablename   = " epg_dailyexamine";
            pagination.conditionJson = "1=1";
            //pagination.sidx = "createdate";
            //pagination.sord = "desc";
            if (!user.IsSystem)
            {
                pagination.conditionJson += " and createuserorgcode='" + user.OrganizeCode + "'";
            }
            var data     = dailyexaminebll.GetPageList(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
Esempio n. 2
0
        public object GetList([FromBody] JObject json)
        {
            try
            {
                string  res           = json.Value <string>("json");
                dynamic dy            = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  userId        = dy.userid;
                string  actiontype    = dy.data.actiontype;//0全部 1 我的 2 待审核
                long    pageIndex     = dy.pageindex;
                long    pageSize      = dy.pagesize;
                string  examinetodept = res.Contains("examinetodept") ? dy.data.examinetodept : "";
                string  startdate     = res.Contains("startdate") ? dy.data.startdate : "";
                string  enddate       = res.Contains("enddate") ? dy.data.enddate : "";
                string  examinetype   = res.Contains("examinetype") ? dy.data.examinetype : "";
                //获取用户基本信息
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Pagination pagination = new Pagination();
                pagination.page        = int.Parse(pageIndex.ToString());
                pagination.rows        = int.Parse(pageSize.ToString());
                pagination.p_kid       = "id";
                pagination.p_fields    = @"examinetodept,examineperson,to_char(examinetime,'yyyy-mm-dd') examinetime,flowrolename,flowdept,'' as approveuserid,'' as approveusername,
                                        case when isover='1' then '1'
                                          when isover ='0' and issaved='1' then '2'
                                            when isover='0' and issaved ='0' then '0' end status,
                                              case when isover='1' then '审核完成'
                                          when isover ='0' and issaved='1' then '待审核'
                                            when isover='0' and issaved ='0' then '待提交' end statusinfo";
                pagination.p_tablename = "epg_dailyexamine ";
                pagination.sidx        = "createdate"; //排序字段
                pagination.sord        = "desc";       //排序方式
                Operator currUser = OperatorProvider.Provider.Current();
                pagination.conditionJson += "1=1 ";


                string role = currUser.RoleName;
                if (actiontype == "0")
                {
                    if (currUser.IsSystem)
                    {
                    }
                    else
                    {
                        pagination.conditionJson += " and createuserorgcode ='" + currUser.OrganizeCode + "'";
                    }
                    //(s.issaved = '0' and s.createuserid ='{0}')

                    pagination.conditionJson += " and issaved = '1'";
                }
                else if (actiontype == "1")
                {
                    //查询我的
                    pagination.conditionJson += string.Format(" and ((flowdept ='{0}'", currUser.DeptId);

                    string[] arr = currUser.RoleName.Split(',');
                    if (arr.Length > 0)
                    {
                        pagination.conditionJson += " and (";
                        foreach (var item in arr)
                        {
                            pagination.conditionJson += string.Format(" flowrolename  like '%{0}%' or", item);
                        }
                        pagination.conditionJson  = pagination.conditionJson.Substring(0, pagination.conditionJson.Length - 2);
                        pagination.conditionJson += " )";
                    }
                    pagination.conditionJson += string.Format(") or (issaved = '0' and createuserid ='{0}'))", currUser.UserId);
                }
                else if (actiontype == "2")//待我审核审批
                {
                    //查询我的
                    pagination.conditionJson += string.Format(" and ((flowdept ='{0}'", currUser.DeptId);

                    string[] arr = currUser.RoleName.Split(',');
                    if (arr.Length > 0)
                    {
                        pagination.conditionJson += " and (";
                        foreach (var item in arr)
                        {
                            pagination.conditionJson += string.Format(" flowrolename  like '%{0}%' or", item);
                        }
                        pagination.conditionJson  = pagination.conditionJson.Substring(0, pagination.conditionJson.Length - 2);
                        pagination.conditionJson += " )";
                    }
                    pagination.conditionJson += string.Format(") and isover='0' and issaved='1')");
                }

                if (!string.IsNullOrEmpty(startdate))
                {
                    pagination.conditionJson += string.Format(" and examinetime>= to_date('{0}','yyyy-MM-dd') ", startdate);
                }
                if (!string.IsNullOrEmpty(enddate))
                {
                    pagination.conditionJson += string.Format(" and examinetime<= to_date('{0}','yyyy-MM-dd') ", Convert.ToDateTime(enddate).AddDays(1).ToString("yyyy-MM-dd"));
                }
                if (!string.IsNullOrEmpty(examinetodept))
                {
                    pagination.conditionJson += string.Format(" and examinetodeptid = '{0}' ", examinetodept);
                }
                if (!string.IsNullOrEmpty(examinetype))
                {
                    pagination.conditionJson += string.Format(" and examinetype like '%{0}%' ", examinetype);
                }
                string queryJson = Newtonsoft.Json.JsonConvert.SerializeObject(new
                {
                });
                var data = dailyexaminebll.GetPageList(pagination, queryJson);
                foreach (DataRow row in data.Rows)
                {
                    string str = new ScaffoldBLL().GetUserName(row["flowdept"].ToString(), row["flowrolename"].ToString(), "0");
                    row["approveuserid"]   = str.Split('|')[1];
                    row["approveusername"] = str.Split('|')[0];
                }
                return(new { Code = 0, Count = pagination.records, Info = "获取数据成功", data = data });
            }
            catch (Exception ex)
            {
                return(new { Code = -1, Count = 0, Info = ex.Message });
            }
        }