|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+using CallCenter.Utility;
|
|
|
2
|
+using CallCenterApi.Common;
|
|
|
3
|
+using CallCenterApi.DB;
|
|
|
4
|
+using CallCenterApi.Interface.Controllers.Base;
|
|
|
5
|
+using System;
|
|
|
6
|
+using System.Collections.Generic;
|
|
|
7
|
+using System.Data;
|
|
|
8
|
+using System.Linq;
|
|
|
9
|
+using System.Web;
|
|
|
10
|
+using System.Web.Mvc;
|
|
|
11
|
+
|
|
|
12
|
+namespace CallCenterApi.Interface.Controllers.knowledge
|
|
|
13
|
+{
|
|
|
14
|
+ [Authority]
|
|
|
15
|
+ public class RepositoryController : BaseController
|
|
|
16
|
+ {
|
|
|
17
|
+ // GET: Repository
|
|
|
18
|
+ /// <summary>
|
|
|
19
|
+ /// 获取区域列表
|
|
|
20
|
+ /// </summary>
|
|
|
21
|
+ /// <returns></returns>
|
|
|
22
|
+ public ActionResult GetList(int isdc = 0)
|
|
|
23
|
+ {
|
|
|
24
|
+ int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
|
|
|
25
|
+ Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
|
|
|
26
|
+
|
|
|
27
|
+ DataTable dt = new DataTable();
|
|
|
28
|
+ string sql = " and F_IsDelete=0 ";
|
|
|
29
|
+ string strkey = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
|
|
|
30
|
+ string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
|
|
|
31
|
+ string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
|
|
|
32
|
+ string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));
|
|
|
33
|
+ int deptid = RequestString.GetInt("deptid", 0);
|
|
|
34
|
+
|
|
|
35
|
+ string strpageindex = RequestString.GetQueryString("page");
|
|
|
36
|
+ int pageindex = 1;
|
|
|
37
|
+ string strpagesize = RequestString.GetQueryString("pagesize");
|
|
|
38
|
+ int pagesize = 10;
|
|
|
39
|
+
|
|
|
40
|
+ #region sql 语句相关处理
|
|
|
41
|
+
|
|
|
42
|
+ if (strkey.Trim() != "" && strkey != "undefined")
|
|
|
43
|
+ {
|
|
|
44
|
+ sql += " and (F_Key like '%" + strkey + "%' or F_Title like '%" + strkey + "%') ";
|
|
|
45
|
+ }
|
|
|
46
|
+ if (strusercode.Trim() != "" && strusercode != "undefined")
|
|
|
47
|
+ {
|
|
|
48
|
+ sql += " and F_CreateUser = '" + strusercode + "' ";
|
|
|
49
|
+ }
|
|
|
50
|
+
|
|
|
51
|
+ if (deptid != 0)
|
|
|
52
|
+ {
|
|
|
53
|
+ sql += " and F_DeptId ='" + deptid + "'";
|
|
|
54
|
+ }
|
|
|
55
|
+ if (strstarttime.Trim() != "" && strstarttime != "undefined")
|
|
|
56
|
+ {
|
|
|
57
|
+ sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
|
|
|
58
|
+ }
|
|
|
59
|
+ if (strendtime.Trim() != "" && strendtime != "undefined")
|
|
|
60
|
+ {
|
|
|
61
|
+ sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
|
|
|
62
|
+ }
|
|
|
63
|
+ #endregion
|
|
|
64
|
+
|
|
|
65
|
+ if (strpageindex.Trim() != "")
|
|
|
66
|
+ {
|
|
|
67
|
+ pageindex = Convert.ToInt32(strpageindex);
|
|
|
68
|
+ }
|
|
|
69
|
+
|
|
|
70
|
+ if (strpagesize.Trim() != "")
|
|
|
71
|
+ {
|
|
|
72
|
+ pagesize = Convert.ToInt32(strpagesize);
|
|
|
73
|
+ }
|
|
|
74
|
+ string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDeptName(F_DeptId) as DeptName";
|
|
|
75
|
+
|
|
|
76
|
+ if (isdc > 0)
|
|
|
77
|
+ {
|
|
|
78
|
+ var dtdc = DbHelperSQL.Query(" select " + cols + " from T_Repository_List where 1=1 " + sql).Tables[0];
|
|
|
79
|
+ var msg = new NPOIHelper().ExportToExcel("工单列表", dtdc);
|
|
|
80
|
+ if (msg == "")
|
|
|
81
|
+ {
|
|
|
82
|
+ return Success("导出成功");
|
|
|
83
|
+ }
|
|
|
84
|
+ else
|
|
|
85
|
+ {
|
|
|
86
|
+ return Error("导出失败");
|
|
|
87
|
+ }
|
|
|
88
|
+ }
|
|
|
89
|
+
|
|
|
90
|
+ int recordCount = 0;
|
|
|
91
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
92
|
+ "T_Repository_List",
|
|
|
93
|
+ "F_Id",
|
|
|
94
|
+ cols,
|
|
|
95
|
+ sql,
|
|
|
96
|
+ "ORDER BY F_CreateTime DESC",
|
|
|
97
|
+ pagesize,
|
|
|
98
|
+ pageindex,
|
|
|
99
|
+ true,
|
|
|
100
|
+ out recordCount);
|
|
|
101
|
+
|
|
|
102
|
+ var obj = new
|
|
|
103
|
+ {
|
|
|
104
|
+ state = "success",
|
|
|
105
|
+ message = "成功",
|
|
|
106
|
+ rows = dt,
|
|
|
107
|
+ total = recordCount
|
|
|
108
|
+ };
|
|
|
109
|
+ return Content(obj.ToJson());
|
|
|
110
|
+
|
|
|
111
|
+ }
|
|
|
112
|
+
|
|
|
113
|
+ /// <summary>
|
|
|
114
|
+ /// 获取区域
|
|
|
115
|
+ /// </summary>
|
|
|
116
|
+ /// <param name="areaId"></param>
|
|
|
117
|
+ /// <returns></returns>
|
|
|
118
|
+ public ActionResult GetRepository()
|
|
|
119
|
+ {
|
|
|
120
|
+ int id = RequestString.GetInt("id", 0);
|
|
|
121
|
+ Model.T_Repository_List dModel = new BLL.T_Repository_List().GetModel(id);
|
|
|
122
|
+ if (dModel != null)
|
|
|
123
|
+ {
|
|
|
124
|
+
|
|
|
125
|
+ }
|
|
|
126
|
+
|
|
|
127
|
+ return Success("获取信息成功", dModel);
|
|
|
128
|
+ }
|
|
|
129
|
+
|
|
|
130
|
+ /// <summary>
|
|
|
131
|
+ /// 添加部门
|
|
|
132
|
+ /// </summary>
|
|
|
133
|
+ /// <param name="input"></param>
|
|
|
134
|
+ /// <returns></returns>
|
|
|
135
|
+ [HttpPost]
|
|
|
136
|
+ public ActionResult AddRepository()
|
|
|
137
|
+ {
|
|
|
138
|
+ int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
|
|
|
139
|
+ Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
|
|
|
140
|
+
|
|
|
141
|
+ int id = RequestString.GetInt("id", 0);
|
|
|
142
|
+ int deptid = RequestString.GetInt("deptid", 0);
|
|
|
143
|
+ string key = RequestString.GetFormString("key");
|
|
|
144
|
+ string title = RequestString.GetFormString("title");
|
|
|
145
|
+ string maindept = RequestString.GetFormString("maindept");
|
|
|
146
|
+ string publicphone1 = RequestString.GetFormString("publicphone1");
|
|
|
147
|
+ string publicphone2 = RequestString.GetFormString("publicphone2");
|
|
|
148
|
+ string privatephone1 = RequestString.GetFormString("privatephone1");
|
|
|
149
|
+ string privatephone2 = RequestString.GetFormString("privatephone2");
|
|
|
150
|
+ string points = RequestString.GetFormString("points");
|
|
|
151
|
+ string baseanswer = RequestString.GetFormString("baseanswer");
|
|
|
152
|
+ string endanswer = RequestString.GetFormString("endanswer");
|
|
|
153
|
+ string dealtype = RequestString.GetFormString("dealtype");
|
|
|
154
|
+ string legallimittime = RequestString.GetFormString("legallimittime");
|
|
|
155
|
+ string promiselimittime = RequestString.GetFormString("promiselimittime");
|
|
|
156
|
+ int ispay = RequestString.GetInt("ispay", 0);
|
|
|
157
|
+ float paymoney = RequestString.GetFloat("paymoney",0);
|
|
|
158
|
+ string officeaddress = RequestString.GetFormString("officeaddress");
|
|
|
159
|
+ string serobject = RequestString.GetFormString("serobject");
|
|
|
160
|
+ string busline = RequestString.GetFormString("busline");
|
|
|
161
|
+ string officetime = RequestString.GetFormString("officetime");
|
|
|
162
|
+ string otherdept = RequestString.GetFormString("otherdept");
|
|
|
163
|
+ string otherpublicphone = RequestString.GetFormString("otherpublicphone");
|
|
|
164
|
+ string otherprivatephone = RequestString.GetFormString("otherprivatephone");
|
|
|
165
|
+ string remark = RequestString.GetFormString("remark");
|
|
|
166
|
+ string baseon = WebHelper.UrlDecode(RequestString.GetFormString("baseon"));
|
|
|
167
|
+ string process = WebHelper.UrlDecode(RequestString.GetFormString("process"));
|
|
|
168
|
+ string material = WebHelper.UrlDecode(RequestString.GetFormString("material"));
|
|
|
169
|
+ string template = WebHelper.UrlDecode(RequestString.GetFormString("template"));
|
|
|
170
|
+ string payinfo = WebHelper.UrlDecode(RequestString.GetFormString("payinfo"));
|
|
|
171
|
+ string files = RequestString.GetFormString("files");
|
|
|
172
|
+
|
|
|
173
|
+ Model.T_Repository_List dModel = new Model.T_Repository_List();
|
|
|
174
|
+ if (id == 0)
|
|
|
175
|
+ {
|
|
|
176
|
+ dModel.F_DeptId = deptid;
|
|
|
177
|
+ dModel.F_Key = key;
|
|
|
178
|
+ dModel.F_Title = title;
|
|
|
179
|
+ dModel.F_MainDept = maindept;
|
|
|
180
|
+ dModel.F_PublicPhone1 = publicphone1;
|
|
|
181
|
+ dModel.F_PublicPhone2 = publicphone2;
|
|
|
182
|
+ dModel.F_PrivatePhone1 = privatephone1;
|
|
|
183
|
+ dModel.F_PrivatePhone2 = privatephone2;
|
|
|
184
|
+ dModel.F_Points = points;
|
|
|
185
|
+ dModel.F_BaseAnswer = baseanswer;
|
|
|
186
|
+ dModel.F_EndAnswer = endanswer;
|
|
|
187
|
+ dModel.F_DealType = dealtype;
|
|
|
188
|
+ dModel.F_LegalLimitTime = legallimittime;
|
|
|
189
|
+ dModel.F_PromiseLimitTime = promiselimittime;
|
|
|
190
|
+ dModel.F_IsPay = ispay;
|
|
|
191
|
+ dModel.F_PayMoney = Decimal.Parse(paymoney.ToString());
|
|
|
192
|
+ dModel.F_OfficeAddress = officeaddress;
|
|
|
193
|
+ dModel.F_Object = serobject;
|
|
|
194
|
+ dModel.F_BusLine = busline;
|
|
|
195
|
+ dModel.F_OfficeTime = officetime;
|
|
|
196
|
+ dModel.F_OtherDept = otherdept;
|
|
|
197
|
+ dModel.F_OtherPublicPhone = otherpublicphone;
|
|
|
198
|
+ dModel.F_OtherPrivatePhone = otherprivatephone;
|
|
|
199
|
+ dModel.F_Remark = remark;
|
|
|
200
|
+ dModel.F_BaseOn = baseon;
|
|
|
201
|
+ dModel.F_Process = process;
|
|
|
202
|
+ dModel.F_Material = material;
|
|
|
203
|
+ dModel.F_Template = template;
|
|
|
204
|
+ dModel.F_PayInfo = payinfo;
|
|
|
205
|
+ dModel.F_File = files;
|
|
|
206
|
+
|
|
|
207
|
+ dModel.F_IsDelete = 0;
|
|
|
208
|
+ dModel.F_CreateUser = userModel.F_UserCode;
|
|
|
209
|
+ dModel.F_CreateTime = DateTime.Now;
|
|
|
210
|
+ int n = new BLL.T_Repository_List().Add(dModel);
|
|
|
211
|
+ if (n > 0)
|
|
|
212
|
+ return Success("添加成功", n);
|
|
|
213
|
+ else
|
|
|
214
|
+ return Error("添加失败");
|
|
|
215
|
+ }
|
|
|
216
|
+ else
|
|
|
217
|
+ {
|
|
|
218
|
+ dModel = new BLL.T_Repository_List().GetModel(id);
|
|
|
219
|
+ if (dModel != null)
|
|
|
220
|
+ {
|
|
|
221
|
+ dModel.F_DeptId = deptid;
|
|
|
222
|
+ dModel.F_Key = key;
|
|
|
223
|
+ dModel.F_Title = title;
|
|
|
224
|
+ dModel.F_MainDept = maindept;
|
|
|
225
|
+ dModel.F_PublicPhone1 = publicphone1;
|
|
|
226
|
+ dModel.F_PublicPhone2 = publicphone2;
|
|
|
227
|
+ dModel.F_PrivatePhone1 = privatephone1;
|
|
|
228
|
+ dModel.F_PrivatePhone2 = privatephone2;
|
|
|
229
|
+ dModel.F_Points = points;
|
|
|
230
|
+ dModel.F_BaseAnswer = baseanswer;
|
|
|
231
|
+ dModel.F_EndAnswer = endanswer;
|
|
|
232
|
+ dModel.F_DealType = dealtype;
|
|
|
233
|
+ dModel.F_LegalLimitTime = legallimittime;
|
|
|
234
|
+ dModel.F_PromiseLimitTime = promiselimittime;
|
|
|
235
|
+ dModel.F_IsPay = ispay;
|
|
|
236
|
+ dModel.F_PayMoney = Decimal.Parse(paymoney.ToString());
|
|
|
237
|
+ dModel.F_OfficeAddress = officeaddress;
|
|
|
238
|
+ dModel.F_Object = serobject;
|
|
|
239
|
+ dModel.F_BusLine = busline;
|
|
|
240
|
+ dModel.F_OfficeTime = officetime;
|
|
|
241
|
+ dModel.F_OtherDept = otherdept;
|
|
|
242
|
+ dModel.F_OtherPublicPhone = otherpublicphone;
|
|
|
243
|
+ dModel.F_OtherPrivatePhone = otherprivatephone;
|
|
|
244
|
+ dModel.F_Remark = remark;
|
|
|
245
|
+ dModel.F_BaseOn = baseon;
|
|
|
246
|
+ dModel.F_Process = process;
|
|
|
247
|
+ dModel.F_Material = material;
|
|
|
248
|
+ dModel.F_Template = template;
|
|
|
249
|
+ dModel.F_PayInfo = payinfo;
|
|
|
250
|
+ dModel.F_File = files;
|
|
|
251
|
+
|
|
|
252
|
+ if (new BLL.T_Repository_List().Update(dModel))
|
|
|
253
|
+ return Success("修改成功");
|
|
|
254
|
+ else
|
|
|
255
|
+ return Error("修改失败");
|
|
|
256
|
+ }
|
|
|
257
|
+ else
|
|
|
258
|
+ {
|
|
|
259
|
+ return Error("修改失败");
|
|
|
260
|
+ }
|
|
|
261
|
+ }
|
|
|
262
|
+ }
|
|
|
263
|
+
|
|
|
264
|
+ /// <summary>
|
|
|
265
|
+ /// 删除部门
|
|
|
266
|
+ /// </summary>
|
|
|
267
|
+ /// <param name="ids"></param>
|
|
|
268
|
+ /// <returns></returns>
|
|
|
269
|
+ public ActionResult DelRepository(string[] ids)
|
|
|
270
|
+ {
|
|
|
271
|
+ int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
|
|
|
272
|
+ Model.T_Sys_UserAccount userModel = new BLL.T_Sys_UserAccount().GetModel(userId);
|
|
|
273
|
+
|
|
|
274
|
+ if (ids == null || ids.Length <= 0)
|
|
|
275
|
+ return Error("请选择要删除的部门");
|
|
|
276
|
+
|
|
|
277
|
+ var idStr = string.Join(",", ids);
|
|
|
278
|
+ if (string.IsNullOrEmpty(idStr.Trim()))
|
|
|
279
|
+ return Error("请选择要删除的部门");
|
|
|
280
|
+
|
|
|
281
|
+ //if (new BLL.T_Repository_List().DeleteList(idStr))
|
|
|
282
|
+ int n = DbHelperSQL.ExecuteSql(" update T_Repository_List set F_IsDelete=1,F_DeleteUser='" + userModel.F_UserCode + "',F_DeleteTime=getdate() where F_Id in (" + idStr + ")");
|
|
|
283
|
+ if (n > 0)
|
|
|
284
|
+ {
|
|
|
285
|
+ return Success("删除成功");
|
|
|
286
|
+ }
|
|
|
287
|
+ return Error("删除失败");
|
|
|
288
|
+ }
|
|
|
289
|
+
|
|
|
290
|
+ }
|
|
|
291
|
+}
|