|
|
@@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|
10
|
10
|
using Microsoft.AspNetCore.Authorization;
|
|
11
|
11
|
using Microsoft.AspNetCore.Mvc;
|
|
12
|
12
|
using SqlSugar;
|
|
|
13
|
+using TVShoppingCallCenter_ZLJ.Models.Inputs;
|
|
13
|
14
|
|
|
14
|
15
|
namespace TVShoppingCallCenter_ZLJ.Controllers.System
|
|
15
|
16
|
{
|
|
|
@@ -30,7 +31,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.System
|
|
30
|
31
|
/// <returns></returns>
|
|
31
|
32
|
[Authorize]
|
|
32
|
33
|
[HttpGet("getlistbypage")]
|
|
33
|
|
- public async Task<IActionResult> GetListsByPage(string key, int pageindex = 1, int pagesize = 10)
|
|
|
34
|
+ public async Task<IActionResult> GetListsByPage(string key, int pageindex = 1, int pagesize = 20)
|
|
34
|
35
|
{
|
|
35
|
36
|
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
|
36
|
37
|
#region 条件筛选
|
|
|
@@ -87,8 +88,8 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.System
|
|
87
|
88
|
/// 获取实体
|
|
88
|
89
|
/// </summary>
|
|
89
|
90
|
[Authorize]
|
|
90
|
|
- [HttpGet("getsingle")]
|
|
91
|
|
- public async Task<IActionResult> GetSingle(int id)
|
|
|
91
|
+ [HttpGet("getdetails")]
|
|
|
92
|
+ public async Task<IActionResult> GetDetails(int id)
|
|
92
|
93
|
{
|
|
93
|
94
|
if (id > 0)
|
|
94
|
95
|
{
|
|
|
@@ -114,55 +115,52 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.System
|
|
114
|
115
|
/// </summary>
|
|
115
|
116
|
[Authorize]
|
|
116
|
117
|
[HttpPost("add")]
|
|
117
|
|
- public async Task<IActionResult> Add(string zxzcode, string zxzname, string zxatt,
|
|
118
|
|
- string whwdkey, string whbdkey, int ivrkey, string outcallnum, string des)
|
|
|
118
|
+ public async Task<IActionResult> Add(SeatGroupInput input)
|
|
119
|
119
|
{
|
|
120
|
|
- T_Sys_SeatGroup clmodel = new T_Sys_SeatGroup();
|
|
121
|
|
- if (await GetExistByCodeAsync(zxzcode, 0) || await GetExistByNameAsync(zxzname, 0))
|
|
122
|
|
- {
|
|
123
|
|
- return Error("坐席组编号和名称必须唯一,请重新输入!");
|
|
124
|
|
- }
|
|
125
|
|
- if (!string.IsNullOrWhiteSpace(zxzcode))
|
|
126
|
|
- clmodel.F_ZXZCode = zxzcode.Trim();
|
|
127
|
|
- else
|
|
|
120
|
+ #region 验证
|
|
|
121
|
+ if (string.IsNullOrWhiteSpace(input.zxzcode))
|
|
128
|
122
|
{
|
|
129
|
123
|
return Error("编号不能为空");
|
|
130
|
124
|
}
|
|
131
|
|
- if (!string.IsNullOrWhiteSpace(zxzname))
|
|
132
|
|
- clmodel.F_ZXZName = zxzname.Trim();
|
|
133
|
|
- else
|
|
|
125
|
+ if (string.IsNullOrWhiteSpace(input.zxzname))
|
|
134
|
126
|
{
|
|
135
|
127
|
return Error("名称不能为空");
|
|
136
|
128
|
}
|
|
137
|
|
- if (!string.IsNullOrWhiteSpace(zxatt))
|
|
138
|
|
- clmodel.F_ZXAtt = zxatt.Trim();
|
|
139
|
|
- else
|
|
|
129
|
+ if (string.IsNullOrWhiteSpace(input.zxatt))
|
|
140
|
130
|
{
|
|
141
|
131
|
return Error("坐席地区号不能为空");
|
|
142
|
132
|
}
|
|
143
|
|
- if (!string.IsNullOrWhiteSpace(whwdkey))
|
|
144
|
|
- clmodel.F_WHWDKey = whwdkey.Trim();
|
|
145
|
|
- else
|
|
|
133
|
+ if (string.IsNullOrWhiteSpace(input.whwdkey))
|
|
146
|
134
|
{
|
|
147
|
135
|
return Error("外呼外地前缀不能为空");
|
|
148
|
136
|
}
|
|
149
|
|
- if (!string.IsNullOrWhiteSpace(whbdkey))
|
|
150
|
|
- clmodel.F_WHBDKey = whbdkey.Trim();
|
|
151
|
|
- else
|
|
|
137
|
+ if (string.IsNullOrWhiteSpace(input.whbdkey))
|
|
152
|
138
|
{
|
|
153
|
139
|
return Error("外呼本地前缀不能为空");
|
|
154
|
140
|
}
|
|
155
|
|
- if (!ValidateString.IsNumberStr(whwdkey.Trim().ToString()))
|
|
|
141
|
+ if (!ValidateString.IsNumberStr(input.whwdkey.Trim().ToString()))
|
|
156
|
142
|
{
|
|
157
|
143
|
return Error("外呼外地前缀必须为数字");
|
|
158
|
144
|
}
|
|
159
|
|
- if (!ValidateString.IsNumberStr(whbdkey.Trim().ToString()))
|
|
|
145
|
+ if (!ValidateString.IsNumberStr(input.whbdkey.Trim().ToString()))
|
|
160
|
146
|
{
|
|
161
|
147
|
return Error("外呼本地前缀必须为数字");
|
|
162
|
148
|
}
|
|
|
149
|
+ if (await GetExistByCodeAsync(input.zxzcode, 0) || await GetExistByNameAsync(input.zxzname, 0))
|
|
|
150
|
+ {
|
|
|
151
|
+ return Error("坐席组编号和名称必须唯一,请重新输入!");
|
|
|
152
|
+ }
|
|
|
153
|
+ #endregion
|
|
|
154
|
+ T_Sys_SeatGroup clmodel = new T_Sys_SeatGroup();
|
|
|
155
|
+ clmodel.F_ZXZCode = input.zxzcode.Trim();
|
|
|
156
|
+
|
|
|
157
|
+ clmodel.F_IVRKey = input.ivrkey;
|
|
|
158
|
+ clmodel.F_ZXZName = input.zxzname.Trim();
|
|
|
159
|
+ clmodel.F_ZXAtt = input.zxatt.Trim();
|
|
|
160
|
+ clmodel.F_WHWDKey = input.whwdkey.Trim();
|
|
|
161
|
+ clmodel.F_WHBDKey = input.whbdkey.Trim();
|
|
163
|
162
|
|
|
164
|
|
- clmodel.F_IVRKey = ivrkey;
|
|
165
|
|
- clmodel.F_Des = des;
|
|
|
163
|
+ clmodel.F_Des = input.des;
|
|
166
|
164
|
clmodel.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value; //"8000";
|
|
167
|
165
|
clmodel.F_CreateOn = DateTime.Now;
|
|
168
|
166
|
clmodel.F_State = (int)EnumDelState.Enabled;
|
|
|
@@ -181,62 +179,53 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.System
|
|
181
|
179
|
/// </summary>
|
|
182
|
180
|
[Authorize]
|
|
183
|
181
|
[HttpPost("update")]
|
|
184
|
|
- public async Task<IActionResult> Edit(int id, string zxzcode, string zxzname, string zxatt,
|
|
185
|
|
- string whwdkey, string whbdkey, int ivrkey, string outcallnum, string des)
|
|
|
182
|
+ public async Task<IActionResult> Edit(SeatGroupInput input)
|
|
186
|
183
|
{
|
|
187
|
|
- if (id > 0)
|
|
|
184
|
+ #region
|
|
|
185
|
+ if (input.id <= 0)
|
|
|
186
|
+ return Error("请选择要编辑的坐席组");
|
|
|
187
|
+ if (string.IsNullOrWhiteSpace(input.whwdkey))
|
|
|
188
|
+ return Error("外呼外地前缀不能为空");
|
|
|
189
|
+ if (string.IsNullOrWhiteSpace(input.whbdkey))
|
|
|
190
|
+ return Error("外呼本地前缀不能为空");
|
|
|
191
|
+ if (!ValidateString.IsNumberStr(input.whwdkey.Trim().ToString()))
|
|
188
|
192
|
{
|
|
189
|
|
- if (await GetExistByCodeAsync(zxzcode, id) || await GetExistByNameAsync(zxzname, id))
|
|
190
|
|
- {
|
|
191
|
|
- return Error("坐席组编号和名称必须唯一,请重新输入!");
|
|
192
|
|
- }
|
|
193
|
|
- if (string.IsNullOrWhiteSpace(whwdkey))
|
|
194
|
|
- return Error("外呼外地前缀不能为空");
|
|
195
|
|
- if (string.IsNullOrWhiteSpace(whbdkey))
|
|
196
|
|
- return Error("外呼本地前缀不能为空");
|
|
197
|
|
-
|
|
198
|
|
- if (!ValidateString.IsNumberStr(whwdkey.Trim().ToString()))
|
|
199
|
|
- {
|
|
200
|
|
- return Error("外呼外地前缀必须为数字");
|
|
201
|
|
- }
|
|
202
|
|
- if (!ValidateString.IsNumberStr(whbdkey.Trim().ToString()))
|
|
203
|
|
- {
|
|
204
|
|
- return Error("外呼本地前缀必须为数字");
|
|
205
|
|
- }
|
|
|
193
|
+ return Error("外呼外地前缀必须为数字");
|
|
|
194
|
+ }
|
|
|
195
|
+ if (!ValidateString.IsNumberStr(input.whbdkey.Trim().ToString()))
|
|
|
196
|
+ {
|
|
|
197
|
+ return Error("外呼本地前缀必须为数字");
|
|
|
198
|
+ }
|
|
|
199
|
+ if (await GetExistByCodeAsync(input.zxzcode, input.id) || await GetExistByNameAsync(input.zxzname, input.id))
|
|
|
200
|
+ {
|
|
|
201
|
+ return Error("坐席组编号和名称必须唯一,请重新输入!");
|
|
|
202
|
+ }
|
|
|
203
|
+ #endregion
|
|
206
|
204
|
|
|
207
|
|
- var res = false;
|
|
208
|
|
- var clmodel = await _sys_seatgroupRepository.GetSingle(x => x.F_ZXZID == id);
|
|
209
|
|
- if (clmodel != null)
|
|
210
|
|
- {
|
|
211
|
|
- if (!string.IsNullOrWhiteSpace(zxzcode))
|
|
212
|
|
- clmodel.F_ZXZCode = zxzcode.Trim();
|
|
213
|
|
- if (!string.IsNullOrWhiteSpace(zxzname))
|
|
214
|
|
- clmodel.F_ZXZName = zxzname.Trim();
|
|
215
|
|
- if (!string.IsNullOrWhiteSpace(zxatt))
|
|
216
|
|
- clmodel.F_ZXAtt = zxatt.Trim();
|
|
217
|
|
- if (!string.IsNullOrWhiteSpace(whwdkey))
|
|
218
|
|
- clmodel.F_WHWDKey = whwdkey.Trim();
|
|
219
|
|
- if (!string.IsNullOrWhiteSpace(whbdkey))
|
|
220
|
|
- clmodel.F_WHBDKey = whbdkey.Trim();
|
|
|
205
|
+ var res = false;
|
|
|
206
|
+ var clmodel = await _sys_seatgroupRepository.GetSingle(x => x.F_ZXZID == input.id);
|
|
|
207
|
+ if (clmodel != null)
|
|
|
208
|
+ {
|
|
|
209
|
+ clmodel.F_ZXZCode = input.zxzcode.Trim();
|
|
|
210
|
+ clmodel.F_ZXZName = input.zxzname.Trim();
|
|
|
211
|
+ clmodel.F_ZXAtt = input.zxatt.Trim();
|
|
|
212
|
+ clmodel.F_WHWDKey = input.whwdkey.Trim();
|
|
|
213
|
+ clmodel.F_WHBDKey = input.whbdkey.Trim();
|
|
221
|
214
|
|
|
222
|
|
- clmodel.F_IVRKey = ivrkey;
|
|
223
|
|
- if (!string.IsNullOrWhiteSpace(des))
|
|
224
|
|
- clmodel.F_Des = des;
|
|
|
215
|
+ clmodel.F_IVRKey = input.ivrkey;
|
|
|
216
|
+ clmodel.F_Des = input.des;
|
|
225
|
217
|
|
|
226
|
|
- clmodel.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value; //"8000";
|
|
227
|
|
- clmodel.F_LastModifyOn = DateTime.Now;
|
|
|
218
|
+ clmodel.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
|
|
|
219
|
+ clmodel.F_LastModifyOn = DateTime.Now;
|
|
228
|
220
|
|
|
229
|
|
- res = await _sys_seatgroupRepository.Update(clmodel);
|
|
230
|
|
- }
|
|
231
|
|
- if (res)
|
|
232
|
|
- return Success("坐席组保存成功");
|
|
233
|
|
- else
|
|
234
|
|
- {
|
|
235
|
|
- return Error("坐席组保存失败");
|
|
236
|
|
- }
|
|
|
221
|
+ res = await _sys_seatgroupRepository.Update(clmodel);
|
|
237
|
222
|
}
|
|
|
223
|
+ if (res)
|
|
|
224
|
+ return Success("坐席组保存成功");
|
|
238
|
225
|
else
|
|
239
|
|
- return Error("请选择要编辑的坐席组");
|
|
|
226
|
+ {
|
|
|
227
|
+ return Error("坐席组保存失败");
|
|
|
228
|
+ }
|
|
240
|
229
|
}
|
|
241
|
230
|
|
|
242
|
231
|
[Authorize]
|