Explorar el Código

知识库对外接口

zhoufan %!s(int64=4) %!d(string=hace) años
padre
commit
10e2c64726

+ 148 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Out/OutApiController.cs

@@ -1,12 +1,17 @@
1
-using CallCenterApi.Interface.Controllers.Base;
1
+using CallCenter.Utility;
2
+using CallCenterApi.DB;
3
+using CallCenterApi.Interface.App_Start;
4
+using CallCenterApi.Interface.Controllers.Base;
2 5
 using System;
3 6
 using System.Collections.Generic;
7
+using System.Data;
4 8
 using System.Linq;
5 9
 using System.Web;
6 10
 using System.Web.Mvc;
7 11
 
8 12
 namespace CallCenterApi.Interface.Controllers.Out
9 13
 {
14
+    [OutOutActionFilter]
10 15
     public class OutApiController : BaseController
11 16
     {
12 17
         // GET: OutApi
@@ -14,5 +19,147 @@ namespace CallCenterApi.Interface.Controllers.Out
14 19
         {
15 20
             return View();
16 21
         }
22
+
23
+        /// <summary>
24
+        /// 获取部门列表
25
+        /// </summary>
26
+        /// <returns></returns>
27
+        public ActionResult GetDeptList(string deptname)
28
+        {
29
+            BLL.T_Sys_Department departmentBLL = new BLL.T_Sys_Department();
30
+            DataTable dt = new DataTable();
31
+            string sql = " and F_State=0";
32
+            if (!string.IsNullOrEmpty(deptname))
33
+            {
34
+                sql += " and F_DeptName like '%" + deptname.Trim() + "%'";
35
+            }
36
+            //dt = departmentBLL.GetList(0, "F_State=0" + sql, " F_Sort").Tables[0];
37
+
38
+            dt = DbHelperSQL.Query("select F_DeptId Id,F_DeptName Name,F_PartentId PartentId,F_Sort Sort from T_Sys_Department where 1=1 " + sql).Tables[0];
39
+
40
+            return Success("加载成功", dt);
41
+        }
42
+
43
+        /// <summary>
44
+        /// 获取知识库列表
45
+        /// </summary>
46
+        /// <returns></returns>
47
+        public ActionResult GetRepositoryList()
48
+        {
49
+            DataTable dt = new DataTable();
50
+            string sql = " and F_IsDelete=0 ";
51
+            string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
52
+            string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
53
+            string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
54
+            int deptid = RequestString.GetInt("deptid", 0);
55
+            int type = RequestString.GetInt("type", 1);
56
+            int state = RequestString.GetInt("state", 0);
57
+
58
+            string strpageindex = RequestString.GetQueryString("page");
59
+            int pageindex = 1;
60
+            string strpagesize = RequestString.GetQueryString("pagesize");
61
+            int pagesize = 10;
62
+
63
+            #region sql 语句相关处理
64
+            if (type == 1)
65
+            {//查看通过审核和紧急事项
66
+                sql += " and F_State in (" + (int)Model.EnumRepositoryState.AuditPass + "," + (int)Model.EnumRepositoryState.Urgent + ")";
67
+            }
68
+            else if (type == 2)
69
+            {//待审核列表
70
+                sql += " and F_State in (" + (int)Model.EnumRepositoryState.Audit + ")";
71
+            }
72
+
73
+            if (strkey.Trim() != "" && strkey != "undefined")
74
+            {
75
+                sql += " and (F_Key like '%" + strkey + "%' or F_Title like '%" + strkey + "%') ";
76
+            }
77
+            if (state != 0)
78
+            {
79
+                sql += " and F_State =" + state + " ";
80
+            }
81
+
82
+            if (deptid != 0)
83
+            {
84
+                sql += " and F_DeptId ='" + deptid + "'";
85
+            }
86
+            if (strstarttime.Trim() != "" && strstarttime != "undefined")
87
+            {
88
+                sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
89
+            }
90
+            if (strendtime.Trim() != "" && strendtime != "undefined")
91
+            {
92
+                sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0   ";
93
+            }
94
+            #endregion
95
+
96
+            if (strpageindex.Trim() != "")
97
+            {
98
+                pageindex = Convert.ToInt32(strpageindex);
99
+            }
100
+
101
+            if (strpagesize.Trim() != "")
102
+            {
103
+                pagesize = Convert.ToInt32(strpagesize);
104
+            }
105
+            string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_DeptId) as DeptName";
106
+
107
+            int recordCount = 0;
108
+            dt = BLL.PagerBLL.GetListPager(
109
+                "T_Repository_List",
110
+                "F_Id",
111
+                cols,
112
+                sql,
113
+                "ORDER BY F_CreateTime DESC",
114
+                pagesize,
115
+                pageindex,
116
+                true,
117
+                out recordCount);
118
+
119
+            var obj = new
120
+            {
121
+                state = "success",
122
+                message = "成功",
123
+                rows = dt,
124
+                total = recordCount
125
+            };
126
+            return Content(obj.ToJson());
127
+
128
+        }
129
+
130
+        /// <summary>
131
+        /// 获取知识库
132
+        /// </summary>
133
+        /// <param name="areaId"></param>
134
+        /// <returns></returns>
135
+        public ActionResult GetRepository()
136
+        {
137
+            int id = RequestString.GetInt("id", 0);
138
+            Model.T_Repository_List dModel = new BLL.T_Repository_List().GetModel(id);
139
+
140
+            if (dModel != null)
141
+            {
142
+                DataTable dtfile = new DataTable();
143
+                if (!string.IsNullOrEmpty(dModel.F_File))
144
+                {
145
+                    var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
146
+
147
+                    dtfile = DbHelperSQL.Query("select * from T_Sys_Accessories where F_FileId in (" + dModel.F_File + ")").Tables[0];
148
+
149
+                    foreach (DataRow dr in dtfile.Rows)
150
+                    {
151
+                        dr["F_FileUrl"] = configfj.F_ParamValue + dr["F_FileUrl"].ToString();
152
+                    }
153
+                }
154
+
155
+                var obj = new
156
+                {
157
+                    data = dModel,
158
+                    file = dtfile
159
+                };
160
+                return Success("获取信息成功", obj);
161
+            }
162
+            return Error("获取信息失败");
163
+        }
17 164
     }
18 165
 }