|
|
@@ -20,65 +20,56 @@ namespace CallCenterApi.Interface.Controllers
|
|
20
|
20
|
/// <returns></returns>
|
|
21
|
21
|
public ActionResult GetList()
|
|
22
|
22
|
{
|
|
23
|
|
- ActionResult res = NoToken("未知错误,请重新登录");
|
|
24
|
|
-
|
|
25
|
|
- DataTable dt = new DataTable();
|
|
26
|
|
- string strpageindex = RequestString.GetQueryString("page");
|
|
27
|
|
- int pageindex = 1;
|
|
28
|
|
- string strpagesize = RequestString.GetQueryString("pagesize");
|
|
29
|
|
- int pagesize = 10;
|
|
|
23
|
+ DataTable dt = new DataTable();
|
|
|
24
|
+ string strpageindex = RequestString.GetQueryString("page");
|
|
|
25
|
+ int pageindex = 1;
|
|
|
26
|
+ string strpagesize = RequestString.GetQueryString("pagesize");
|
|
|
27
|
+ int pagesize = 10;
|
|
30
|
28
|
string strcontent = RequestString.GetQueryString("content");
|
|
31
|
|
-
|
|
|
29
|
+
|
|
32
|
30
|
string sql = "";
|
|
33
|
|
- if (strcontent!=null&&strcontent != "")
|
|
|
31
|
+ if (strcontent != null && strcontent != "")
|
|
34
|
32
|
{
|
|
35
|
33
|
sql = " and( F_ZXZCode like '" + strcontent + "' or F_ZXZName like '" + strcontent + "' or F_WHBDKey like '" + strcontent + "%' or F_WHWDKey like '" + strcontent + "%' or F_ZXAtt like '" + strcontent + "' or F_Des like '" + strcontent + "')";
|
|
36
|
34
|
}
|
|
37
|
|
- if (strpageindex.Trim() != "")
|
|
38
|
|
- {
|
|
39
|
|
- pageindex = Convert.ToInt32(strpageindex);
|
|
40
|
|
- }
|
|
|
35
|
+ if (strpageindex.Trim() != "")
|
|
|
36
|
+ {
|
|
|
37
|
+ pageindex = Convert.ToInt32(strpageindex);
|
|
|
38
|
+ }
|
|
41
|
39
|
|
|
42
|
|
- if (strpagesize.Trim() != "")
|
|
43
|
|
- {
|
|
44
|
|
- pagesize = Convert.ToInt32(strpagesize);
|
|
45
|
|
- }
|
|
46
|
|
- int recordCount = 0;
|
|
47
|
|
- dt = BLL.PagerBLL.GetListPager(
|
|
48
|
|
- "T_Sys_SeatGroup",
|
|
49
|
|
- "F_ZXZID",
|
|
50
|
|
- "*",
|
|
51
|
|
- sql,
|
|
52
|
|
- "ORDER BY F_ZXZID desc",
|
|
53
|
|
- pagesize,
|
|
54
|
|
- pageindex,
|
|
55
|
|
- true,
|
|
56
|
|
- out recordCount);
|
|
|
40
|
+ if (strpagesize.Trim() != "")
|
|
|
41
|
+ {
|
|
|
42
|
+ pagesize = Convert.ToInt32(strpagesize);
|
|
|
43
|
+ }
|
|
|
44
|
+ int recordCount = 0;
|
|
|
45
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
46
|
+ "T_Sys_SeatGroup",
|
|
|
47
|
+ "F_ZXZID",
|
|
|
48
|
+ "*",
|
|
|
49
|
+ sql,
|
|
|
50
|
+ "ORDER BY F_ZXZID desc",
|
|
|
51
|
+ pagesize,
|
|
|
52
|
+ pageindex,
|
|
|
53
|
+ true,
|
|
|
54
|
+ out recordCount);
|
|
57
|
55
|
|
|
58
|
|
- var obj = new
|
|
59
|
|
- {
|
|
60
|
|
- rows = dt,
|
|
61
|
|
- total = recordCount
|
|
62
|
|
- };
|
|
|
56
|
+ var obj = new
|
|
|
57
|
+ {
|
|
|
58
|
+ rows = dt,
|
|
|
59
|
+ total = recordCount
|
|
|
60
|
+ };
|
|
63
|
61
|
|
|
64
|
|
- res = Content(obj.ToJson());
|
|
65
|
|
-
|
|
66
|
|
- return res;
|
|
|
62
|
+ return Content(obj.ToJson());
|
|
67
|
63
|
}
|
|
68
|
64
|
|
|
69
|
|
- //获取坐席组列表
|
|
|
65
|
+ ///获取坐席组列表
|
|
70
|
66
|
public ActionResult GetSeatList()
|
|
71
|
67
|
{
|
|
72
|
|
- ActionResult res = NoToken("未知错误,请重新登录");
|
|
73
|
|
- if (Request.IsAuthenticated)
|
|
74
|
|
- {
|
|
75
|
|
- List<Model.T_Sys_SeatGroup> seatList = seatBLL.GetModelList(" 1=1 order by F_ZXZID desc ");
|
|
76
|
|
- if (seatList.Count > 0)
|
|
77
|
|
- res = Success("坐席组列表加载成功", seatList);
|
|
78
|
|
- else
|
|
79
|
|
- res = Error("坐席组列表加载失败");
|
|
80
|
|
- }
|
|
81
|
|
- return res;
|
|
|
68
|
+ List<Model.T_Sys_SeatGroup> seatList = seatBLL.GetModelList(" 1=1 order by F_ZXZID desc ");
|
|
|
69
|
+ if (seatList.Count > 0)
|
|
|
70
|
+ return Success("坐席组列表加载成功", seatList);
|
|
|
71
|
+ else
|
|
|
72
|
+ return Error("坐席组列表加载失败");
|
|
82
|
73
|
}
|
|
83
|
74
|
|
|
84
|
75
|
/// <summary>
|
|
|
@@ -88,14 +79,10 @@ namespace CallCenterApi.Interface.Controllers
|
|
88
|
79
|
/// <returns></returns>
|
|
89
|
80
|
public ActionResult GetSeatGroup(int ZXZID = 0)
|
|
90
|
81
|
{
|
|
91
|
|
- if (Request.IsAuthenticated)
|
|
92
|
|
- {
|
|
93
|
82
|
Model.T_Sys_SeatGroup sModel = seatBLL.GetModel(ZXZID);
|
|
94
|
83
|
if (sModel != null)
|
|
95
|
84
|
return Success("获取坐席组信息成功", sModel);
|
|
96
|
85
|
return Error("获取坐席组信息失败");
|
|
97
|
|
- }
|
|
98
|
|
- return NoToken("未知错误,请重新登录");
|
|
99
|
86
|
}
|
|
100
|
87
|
|
|
101
|
88
|
/// <summary>
|
|
|
@@ -106,71 +93,67 @@ namespace CallCenterApi.Interface.Controllers
|
|
106
|
93
|
[HttpPost]
|
|
107
|
94
|
public ActionResult AddSeatGroup(SeatGroupInput input)
|
|
108
|
95
|
{
|
|
109
|
|
- ActionResult res = NoToken("未知错误,请重新登录");
|
|
110
|
|
- if (Request.IsAuthenticated)
|
|
111
|
|
- {
|
|
112
|
|
- Model.T_Sys_SeatGroup sModel = new Model.T_Sys_SeatGroup();
|
|
113
|
|
- if (input.ZXZCode != null)
|
|
114
|
|
- sModel.F_ZXZCode = input.ZXZCode.Trim();
|
|
115
|
|
- else
|
|
116
|
|
- {
|
|
117
|
|
- res = Error("编号不能为空");
|
|
118
|
|
- return res;
|
|
119
|
|
- }
|
|
120
|
|
- if (input.ZXZName != null)
|
|
121
|
|
- sModel.F_ZXZName = input.ZXZName.Trim();
|
|
122
|
|
- else
|
|
123
|
|
- {
|
|
124
|
|
- res = Error("名称不能为空");
|
|
125
|
|
- return res;
|
|
126
|
|
- }
|
|
127
|
|
- if (input.ZXAtt != null)
|
|
128
|
|
- sModel.F_ZXAtt = input.ZXAtt.Trim();
|
|
129
|
|
- else
|
|
130
|
|
- {
|
|
131
|
|
- res = Error("坐席地区号不能为空");
|
|
132
|
|
- return res;
|
|
133
|
|
- }
|
|
134
|
|
- if (input.WHWDKey != null)
|
|
135
|
|
- sModel.F_WHWDKey = input.WHWDKey.Trim();
|
|
136
|
|
- else
|
|
137
|
|
- {
|
|
138
|
|
- res = Error("外呼外地前缀不能为空");
|
|
139
|
|
- return res;
|
|
140
|
|
- }
|
|
141
|
|
- if (input.WHBDKey != null)
|
|
142
|
|
- sModel.F_WHBDKey = input.WHBDKey.Trim();
|
|
143
|
|
- else
|
|
144
|
|
- {
|
|
145
|
|
- res = Error("外呼本地前缀不能为空");
|
|
146
|
|
- return res;
|
|
147
|
|
- }
|
|
148
|
|
- if (input.IVRKey != null)
|
|
149
|
|
- sModel.F_IVRKey = input.IVRKey;
|
|
150
|
|
- if (input.Des != null)
|
|
151
|
|
- sModel.F_Des = input.Des.Trim();
|
|
152
|
|
- if (!Validate.IsNumber(input.WHWDKey.ToString()))
|
|
153
|
|
- {
|
|
154
|
|
- res = Error("外呼外地前缀必须为数字");
|
|
155
|
|
- return res;
|
|
156
|
|
- }
|
|
157
|
|
- if (!Validate.IsNumber(input.WHBDKey.ToString()))
|
|
158
|
|
- {
|
|
159
|
|
- res = Error("外呼本地前缀必须为数字");
|
|
160
|
|
- return res;
|
|
161
|
|
- }
|
|
162
|
|
-
|
|
|
96
|
+ ActionResult res = Error("参数获取失败");
|
|
163
|
97
|
|
|
164
|
|
- sModel.F_CreateTime = DateTime.Now;
|
|
165
|
|
- sModel.F_CreateByName = CurrentUser.UserData.F_UserName;
|
|
166
|
|
- sModel.F_CreateBy = CurrentUser.UserData.F_UserId;
|
|
|
98
|
+ if(GetExistByCode(input.ZXZCode,0))
|
|
|
99
|
+ {
|
|
|
100
|
+ return Error("坐席组编号必须唯一,请重新输入!");
|
|
|
101
|
+ }
|
|
167
|
102
|
|
|
168
|
|
- if (seatBLL.Add(sModel) > 0)
|
|
169
|
|
- res = Success("添加成功");
|
|
170
|
|
- else
|
|
171
|
|
- res = Error("添加失败");//res = Success("添加失败");//2017-11-15
|
|
|
103
|
+ Model.T_Sys_SeatGroup sModel = new Model.T_Sys_SeatGroup();
|
|
|
104
|
+ if (input.ZXZCode != null)
|
|
|
105
|
+ sModel.F_ZXZCode = input.ZXZCode.Trim();
|
|
|
106
|
+ else
|
|
|
107
|
+ {
|
|
|
108
|
+ return Error("编号不能为空");
|
|
|
109
|
+ }
|
|
|
110
|
+ if (input.ZXZName != null)
|
|
|
111
|
+ sModel.F_ZXZName = input.ZXZName.Trim();
|
|
|
112
|
+ else
|
|
|
113
|
+ {
|
|
|
114
|
+ return Error("名称不能为空");
|
|
|
115
|
+ }
|
|
|
116
|
+ if (input.ZXAtt != null)
|
|
|
117
|
+ sModel.F_ZXAtt = input.ZXAtt.Trim();
|
|
|
118
|
+ else
|
|
|
119
|
+ {
|
|
|
120
|
+ return Error("坐席地区号不能为空");
|
|
|
121
|
+ }
|
|
|
122
|
+ if (input.WHWDKey != null)
|
|
|
123
|
+ sModel.F_WHWDKey = input.WHWDKey.Trim();
|
|
|
124
|
+ else
|
|
|
125
|
+ {
|
|
|
126
|
+ return Error("外呼外地前缀不能为空");
|
|
|
127
|
+ }
|
|
|
128
|
+ if (input.WHBDKey != null)
|
|
|
129
|
+ sModel.F_WHBDKey = input.WHBDKey.Trim();
|
|
|
130
|
+ else
|
|
|
131
|
+ {
|
|
|
132
|
+ return Error("外呼本地前缀不能为空");
|
|
|
133
|
+ }
|
|
|
134
|
+ if (input.IVRKey != null)
|
|
|
135
|
+ sModel.F_IVRKey = input.IVRKey;
|
|
|
136
|
+ if (input.Des != null)
|
|
|
137
|
+ sModel.F_Des = input.Des.Trim();
|
|
|
138
|
+ if (!Validate.IsNumber(input.WHWDKey.ToString()))
|
|
|
139
|
+ {
|
|
|
140
|
+ return Error("外呼外地前缀必须为数字");
|
|
172
|
141
|
}
|
|
173
|
|
- return res;
|
|
|
142
|
+ if (!Validate.IsNumber(input.WHBDKey.ToString()))
|
|
|
143
|
+ {
|
|
|
144
|
+ return Error("外呼本地前缀必须为数字");
|
|
|
145
|
+ }
|
|
|
146
|
+
|
|
|
147
|
+
|
|
|
148
|
+ sModel.F_CreateTime = DateTime.Now;
|
|
|
149
|
+ sModel.F_CreateByName = CurrentUser.UserData.F_UserName;
|
|
|
150
|
+ sModel.F_CreateBy = CurrentUser.UserData.F_UserId;
|
|
|
151
|
+
|
|
|
152
|
+ if (seatBLL.Add(sModel) > 0)
|
|
|
153
|
+ return Success("添加成功");
|
|
|
154
|
+ else
|
|
|
155
|
+ return Error("添加失败");//res = Success("添加失败");//2017-11-15
|
|
|
156
|
+
|
|
174
|
157
|
}
|
|
175
|
158
|
|
|
176
|
159
|
/// <summary>
|
|
|
@@ -181,35 +164,36 @@ namespace CallCenterApi.Interface.Controllers
|
|
181
|
164
|
[HttpPost]
|
|
182
|
165
|
public ActionResult EditSeatGroup(SeatGroupInput input)
|
|
183
|
166
|
{
|
|
184
|
|
- if (Request.IsAuthenticated)
|
|
|
167
|
+ if (GetExistByCode(input.ZXZCode, input.ZXZID))
|
|
185
|
168
|
{
|
|
186
|
|
- if (input.ZXZID <= 0)
|
|
187
|
|
- return Error("请选择要编辑的坐席组");
|
|
|
169
|
+ return Error("坐席组编号必须唯一,请重新输入!");
|
|
|
170
|
+ }
|
|
188
|
171
|
|
|
189
|
|
- Model.T_Sys_SeatGroup sModel = seatBLL.GetModel(input.ZXZID);
|
|
190
|
|
- if (sModel == null)
|
|
191
|
|
- return Error("获取信息失败");
|
|
|
172
|
+ if (input.ZXZID <= 0)
|
|
|
173
|
+ return Error("请选择要编辑的坐席组");
|
|
192
|
174
|
|
|
193
|
|
- if (input.ZXZCode != null)
|
|
194
|
|
- sModel.F_ZXZCode = input.ZXZCode.Trim();
|
|
195
|
|
- if (input.ZXZName != null)
|
|
196
|
|
- sModel.F_ZXZName = input.ZXZName.Trim();
|
|
197
|
|
- if (input.ZXAtt != null)
|
|
198
|
|
- sModel.F_ZXAtt = input.ZXAtt.Trim();
|
|
199
|
|
- if (input.WHWDKey != null)
|
|
200
|
|
- sModel.F_WHWDKey = input.WHWDKey.Trim();
|
|
201
|
|
- if (input.WHBDKey != null)
|
|
202
|
|
- sModel.F_WHBDKey = input.WHBDKey.Trim();
|
|
203
|
|
- if (input.IVRKey != null)
|
|
204
|
|
- sModel.F_IVRKey = input.IVRKey;
|
|
205
|
|
- if (input.Des != null)
|
|
206
|
|
- sModel.F_Des = input.Des.Trim();
|
|
|
175
|
+ Model.T_Sys_SeatGroup sModel = seatBLL.GetModel(input.ZXZID);
|
|
|
176
|
+ if (sModel == null)
|
|
|
177
|
+ return Error("获取信息失败");
|
|
207
|
178
|
|
|
208
|
|
- if (seatBLL.Update(sModel))
|
|
209
|
|
- return Success("编辑成功");
|
|
210
|
|
- return Error("编辑失败");
|
|
211
|
|
- }
|
|
212
|
|
- return NoToken("未知错误,请重新登录");
|
|
|
179
|
+ if (input.ZXZCode != null)
|
|
|
180
|
+ sModel.F_ZXZCode = input.ZXZCode.Trim();
|
|
|
181
|
+ if (input.ZXZName != null)
|
|
|
182
|
+ sModel.F_ZXZName = input.ZXZName.Trim();
|
|
|
183
|
+ if (input.ZXAtt != null)
|
|
|
184
|
+ sModel.F_ZXAtt = input.ZXAtt.Trim();
|
|
|
185
|
+ if (input.WHWDKey != null)
|
|
|
186
|
+ sModel.F_WHWDKey = input.WHWDKey.Trim();
|
|
|
187
|
+ if (input.WHBDKey != null)
|
|
|
188
|
+ sModel.F_WHBDKey = input.WHBDKey.Trim();
|
|
|
189
|
+ if (input.IVRKey != null)
|
|
|
190
|
+ sModel.F_IVRKey = input.IVRKey;
|
|
|
191
|
+ if (input.Des != null)
|
|
|
192
|
+ sModel.F_Des = input.Des.Trim();
|
|
|
193
|
+
|
|
|
194
|
+ if (seatBLL.Update(sModel))
|
|
|
195
|
+ return Success("编辑成功");
|
|
|
196
|
+ return Error("编辑失败");
|
|
213
|
197
|
}
|
|
214
|
198
|
|
|
215
|
199
|
/// <summary>
|
|
|
@@ -219,20 +203,20 @@ namespace CallCenterApi.Interface.Controllers
|
|
219
|
203
|
/// <returns></returns>
|
|
220
|
204
|
public ActionResult DelSeatGroup(string[] ids)
|
|
221
|
205
|
{
|
|
222
|
|
- if (Request.IsAuthenticated)
|
|
223
|
|
- {
|
|
224
|
|
- if (ids == null || ids.Length <= 0)
|
|
225
|
|
- return Error("请选择要删除的坐席组");
|
|
|
206
|
+ if (ids == null || ids.Length <= 0)
|
|
|
207
|
+ return Error("请选择要删除的坐席组");
|
|
226
|
208
|
|
|
227
|
|
- var idStr = string.Join(",", ids);
|
|
228
|
|
- if (string.IsNullOrEmpty(idStr.Trim()))
|
|
229
|
|
- return Error("请选择要删除的坐席组");
|
|
|
209
|
+ var idStr = string.Join(",", ids);
|
|
|
210
|
+ if (string.IsNullOrEmpty(idStr.Trim()))
|
|
|
211
|
+ return Error("请选择要删除的坐席组");
|
|
230
|
212
|
|
|
231
|
|
- if (seatBLL.DeleteList(idStr))
|
|
232
|
|
- return Success("删除成功");
|
|
233
|
|
- return Error("删除失败");
|
|
234
|
|
- }
|
|
235
|
|
- return NoToken("未知错误,请重新登录");
|
|
|
213
|
+ int cc=new BLL.T_Sys_UserAccount().GetRecordCount(" F_SeartGroupID in (" + idStr + ")");
|
|
|
214
|
+ if (cc > 0)
|
|
|
215
|
+ return Error("请转移坐席组下的所有人员后再进行删除!当前坐席组下还有"+cc+"人。");
|
|
|
216
|
+
|
|
|
217
|
+ if (seatBLL.DeleteList(idStr))
|
|
|
218
|
+ return Success("删除成功");
|
|
|
219
|
+ return Error("删除失败");
|
|
236
|
220
|
}
|
|
237
|
221
|
|
|
238
|
222
|
#region 按内容搜索
|
|
|
@@ -243,20 +227,41 @@ namespace CallCenterApi.Interface.Controllers
|
|
243
|
227
|
/// <returns></returns>
|
|
244
|
228
|
public ActionResult GetSearch()
|
|
245
|
229
|
{
|
|
246
|
|
- if (Request.IsAuthenticated)
|
|
|
230
|
+ string strcontent = RequestString.GetQueryString("content");
|
|
|
231
|
+ string strwhere = "";
|
|
|
232
|
+ if (strcontent != "")
|
|
|
233
|
+ {
|
|
|
234
|
+ strwhere = " F_ZXZCode='" + strcontent + "' or F_ZXZName='" + strcontent + "'";
|
|
|
235
|
+ }
|
|
|
236
|
+ DataSet ds = seatBLL.GetList(strwhere);
|
|
|
237
|
+ if (ds != null)
|
|
|
238
|
+ return Success("查询坐席组信息成功", ds);
|
|
|
239
|
+ return Error("查询坐席组信息失败");
|
|
|
240
|
+ }
|
|
|
241
|
+ #endregion
|
|
|
242
|
+
|
|
|
243
|
+ #region
|
|
|
244
|
+ /// <summary>
|
|
|
245
|
+ /// 根据坐席组编号查询是否存在此坐席组编号
|
|
|
246
|
+ /// </summary>
|
|
|
247
|
+ /// <param name="code"></param>
|
|
|
248
|
+ /// <returns></returns>
|
|
|
249
|
+ private bool GetExistByCode(string code,int? id)
|
|
|
250
|
+ {
|
|
|
251
|
+ string sql = " 1=1 ";
|
|
|
252
|
+ if (code != null)
|
|
|
253
|
+ {
|
|
|
254
|
+ sql += " and F_ZXZCode='" + code.Trim() + "' ";
|
|
|
255
|
+ }
|
|
|
256
|
+ if (id != null)
|
|
247
|
257
|
{
|
|
248
|
|
- string strcontent= RequestString.GetQueryString("content");
|
|
249
|
|
- string strwhere = "";
|
|
250
|
|
- if (strcontent != "")
|
|
251
|
|
- {
|
|
252
|
|
- strwhere = " F_ZXZCode='" + strcontent + "' or F_ZXZName='" + strcontent + "'";
|
|
253
|
|
- }
|
|
254
|
|
- DataSet ds = seatBLL.GetList(strwhere);
|
|
255
|
|
- if (ds != null)
|
|
256
|
|
- return Success("查询坐席组信息成功", ds);
|
|
257
|
|
- return Error("查询坐席组信息失败");
|
|
|
258
|
+ sql += " and F_ZXZID <>" + id;
|
|
258
|
259
|
}
|
|
259
|
|
- return NoToken("未知错误,请重新登录");
|
|
|
260
|
+ var ss = seatBLL.GetRecordCount(sql);
|
|
|
261
|
+ if (ss > 0)
|
|
|
262
|
+ return true;
|
|
|
263
|
+ else
|
|
|
264
|
+ return false;
|
|
260
|
265
|
}
|
|
261
|
266
|
#endregion
|
|
262
|
267
|
}
|