Browse Source

自动外呼对接中间件,自动外呼通话记录表

duhongyu 5 years ago
parent
commit
d0b0359d14

+ 16 - 0
代码/System.IRepositories/Call/ICall_CallOutboundRepository.cs

@@ -0,0 +1,16 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.Model.Call;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace System.IRepositories.Call
9
+{
10
+   
11
+    public interface ICall_CallOutboundRepository : IRepository<T_Call_CallOutbound>
12
+    {
13
+        Task<int> GetCallNumber(string DeptCode, int teamid, DateTime dtime);
14
+        Task<int> GetTotleCallNumber(string DeptCode, int teamid, DateTime dtime);
15
+    }
16
+}

+ 13 - 0
代码/System.IRepositories/Call/Iauto_cdrRepository.cs

@@ -0,0 +1,13 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.Model.Call;
5
+using System.Text;
6
+
7
+namespace System.IRepositories.Call
8
+{
9
+   
10
+    public interface Iauto_cdrRepository : IRepository<auto_cdr>
11
+    {
12
+    }
13
+}

+ 13 - 0
代码/System.IRepositories/Call/ItaskRepository.cs

@@ -0,0 +1,13 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.Model.Call;
5
+using System.Text;
6
+
7
+namespace System.IRepositories.Call
8
+{
9
+   
10
+    public interface ItaskRepository : IRepository<task>
11
+    {
12
+    }
13
+}

+ 571 - 0
代码/System.Model/Call/T_Call_CallOutbound.cs

@@ -0,0 +1,571 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Text;
4
+
5
+namespace System.Model.Call
6
+{
7
+    /// <summary>
8
+    /// 通话记录表
9
+    /// </summary>
10
+    [Serializable]
11
+    public partial class T_Call_CallOutbound
12
+    {
13
+        public T_Call_CallOutbound()
14
+        { }
15
+        #region Model
16
+        private int _id;
17
+        private int _cdrid;
18
+        private string _callid;
19
+        private string _turnid;
20
+        private string _callnumber;
21
+        private string _relaynumber;
22
+        private int? _cusid;
23
+        private string _cuscode;
24
+        private int? _calltype = 0;
25
+        private int? _callstate;
26
+        private int? _dealtype;
27
+        private DateTime? _begintime = DateTime.Now;
28
+        private DateTime? _ivrstarttime;
29
+        private DateTime? _ivrendtime;
30
+        private DateTime? _ringstarttime;
31
+        private DateTime? _ringendtime;
32
+        private DateTime? _talkstarttime;
33
+        private DateTime? _talkendtime;
34
+        private DateTime? _endtime = DateTime.Now;
35
+        private int? _longtime;
36
+        private int? _ivrlongtime;
37
+        private int? _ringlongtime;
38
+        private int? _talklongtime;
39
+        private int? _userid;
40
+        private string _usercode;
41
+        private string _username;
42
+        private string _extnumber;
43
+        private string _filepath;
44
+        private bool _isexitworkorder = false;
45
+        private int? _isdeal = 0;
46
+        private int? _operatetype;
47
+        private string _operateobject;
48
+        private DateTime? _operatetime;
49
+        private string _remark;
50
+        private int? _myd;
51
+        private int? _businesstype;
52
+        private string _location;
53
+        private DateTime? _waitstarttime;
54
+        private DateTime? _waitendtime;
55
+        private int? _waitlongtime = 0;
56
+        private int? _nocallstate = 0;
57
+        private int? _worktimesdiff;
58
+        private int? _f_qcstate = 0;
59
+        private decimal? _f_qcscore = 0M;
60
+        private string _f_qcremark;
61
+        private int? _f_qcuserid;
62
+        private string _f_qcusername;
63
+        private DateTime? _f_qctime;
64
+        private int? _f_qcisselect;
65
+        private string _f_qcquestion;
66
+        private string _f_qcadvise;
67
+        private int? _f_zxreasonid;
68
+        private int? _f_lsreasonid;
69
+        private int? _f_zsreasonid;
70
+        private string _tasktype;
71
+        private string _taskphoneid;
72
+        private string _taskid;
73
+        private int? _actionid = 1;
74
+        private int? _actiontype = 0;
75
+        private string _groupcode;
76
+        /// <summary>
77
+        /// 来电Id
78
+        /// </summary>
79
+        public int Id
80
+        {
81
+            set { _id = value; }
82
+            get { return _id; }
83
+        }
84
+        /// <summary>
85
+        /// cdr自增id 用于同步
86
+        /// </summary>
87
+        public int CdrId
88
+        {
89
+            set { _cdrid = value; }
90
+            get { return _cdrid; }
91
+        }
92
+        /// <summary>
93
+        /// 电话流转ID 从始至终贯穿 无论中间换过多少次通话
94
+        /// </summary>
95
+        public string TurnId
96
+        {
97
+            set { _turnid = value; }
98
+            get { return _turnid; }
99
+        }
100
+
101
+        /// <summary>
102
+        /// 呼叫编号
103
+        /// </summary>
104
+        public string CallId
105
+        {
106
+            set { _callid = value; }
107
+            get { return _callid; }
108
+        }
109
+        /// <summary>
110
+        /// 主叫号码
111
+        /// </summary>
112
+        public string Caller
113
+        {
114
+            set { _callnumber = value; }
115
+            get { return _callnumber; }
116
+        }
117
+        /// <summary>
118
+        /// 客户id
119
+        /// </summary>
120
+        public int? CusId
121
+        {
122
+            set { _cusid = value; }
123
+            get { return _cusid; }
124
+        }
125
+        /// <summary>
126
+        /// 客户编号
127
+        /// </summary>
128
+        public string CusCode
129
+        {
130
+            set { _cuscode = value; }
131
+            get { return _cuscode; }
132
+        }
133
+        /// <summary>
134
+        /// 中继号
135
+        /// </summary>
136
+        public string RelayNumber
137
+        {
138
+            set { _relaynumber = value; }
139
+            get { return _relaynumber; }
140
+        }
141
+
142
+        /// <summary>
143
+        /// 呼叫类型,0呼入1呼出
144
+        /// </summary>
145
+        public int? CallType
146
+        {
147
+            set { _calltype = value; }
148
+            get { return _calltype; }
149
+        }
150
+        /// <summary>
151
+        /// 呼叫状态,0:未接通电话1已接通电话
152
+        /// </summary>
153
+        public int? CallState
154
+        {
155
+            set { _callstate = value; }
156
+            get { return _callstate; }
157
+        }
158
+        /// <summary>
159
+        /// 处理方式0:IVR处理1骚扰电话2自助服务3转值班电话4留言5呼损6人工处理
160
+        /// </summary>
161
+        public int? DealType
162
+        {
163
+            set { _dealtype = value; }
164
+            get { return _dealtype; }
165
+        }
166
+        /// <summary>
167
+        /// 开始时间
168
+        /// </summary>
169
+        public DateTime? BeginTime
170
+        {
171
+            set { _begintime = value; }
172
+            get { return _begintime; }
173
+        }
174
+        /// <summary>
175
+        /// ivr开始时间
176
+        /// </summary>
177
+        public DateTime? IvrStartTime
178
+        {
179
+            set { _ivrstarttime = value; }
180
+            get { return _ivrstarttime; }
181
+        }
182
+        /// <summary>
183
+        /// ivr结束时间
184
+        /// </summary>
185
+        public DateTime? IvrEndTime
186
+        {
187
+            set { _ivrendtime = value; }
188
+            get { return _ivrendtime; }
189
+        }
190
+        /// <summary>
191
+        /// 振铃开始时间
192
+        /// </summary>
193
+        public DateTime? RingStartTime
194
+        {
195
+            set { _ringstarttime = value; }
196
+            get { return _ringstarttime; }
197
+        }
198
+        /// <summary>
199
+        /// 振铃结束时间
200
+        /// </summary>
201
+        public DateTime? RingEndTime
202
+        {
203
+            set { _ringendtime = value; }
204
+            get { return _ringendtime; }
205
+        }
206
+        /// <summary>
207
+        /// 通话开始时间
208
+        /// </summary>
209
+        public DateTime? TalkStartTime
210
+        {
211
+            set { _talkstarttime = value; }
212
+            get { return _talkstarttime; }
213
+        }
214
+        /// <summary>
215
+        /// 通话结束时间
216
+        /// </summary>
217
+        public DateTime? TalkEndTime
218
+        {
219
+            set { _talkendtime = value; }
220
+            get { return _talkendtime; }
221
+        }
222
+        /// <summary>
223
+        /// 结束时间
224
+        /// </summary>
225
+        public DateTime? EndTime
226
+        {
227
+            set { _endtime = value; }
228
+            get { return _endtime; }
229
+        }
230
+        /// <summary>
231
+        /// 总时长(s)
232
+        /// </summary>
233
+        public int? LongTime
234
+        {
235
+            set { _longtime = value; }
236
+            get { return _longtime; }
237
+        }
238
+        /// <summary>
239
+        /// IVR时长(s)
240
+        /// </summary>
241
+        public int? IvrLongTime
242
+        {
243
+            set { _ivrlongtime = value; }
244
+            get { return _ivrlongtime; }
245
+        }
246
+        /// <summary>
247
+        /// 振铃时长(s)
248
+        /// </summary>
249
+        public int? RingLongTime
250
+        {
251
+            set { _ringlongtime = value; }
252
+            get { return _ringlongtime; }
253
+        }
254
+        /// <summary>
255
+        /// 通话时长(s)
256
+        /// </summary>
257
+        public int? TalkLongTime
258
+        {
259
+            set { _talklongtime = value; }
260
+            get { return _talklongtime; }
261
+        }
262
+        /// <summary>
263
+        /// 坐席id
264
+        /// </summary>
265
+        public int? UserId
266
+        {
267
+            set { _userid = value; }
268
+            get { return _userid; }
269
+        }
270
+        /// <summary>
271
+        /// 坐席工号
272
+        /// </summary>
273
+        public string UserCode
274
+        {
275
+            set { _usercode = value; }
276
+            get { return _usercode; }
277
+        }
278
+        /// <summary>
279
+        /// 坐席姓名
280
+        /// </summary>
281
+        public string UserName
282
+        {
283
+            set { _username = value; }
284
+            get { return _username; }
285
+        }
286
+        /// <summary>
287
+        /// 被叫号码 如果是座机显示的是 中继号后的分机号
288
+        /// </summary>
289
+        public string Callee
290
+        {
291
+            set { _extnumber = value; }
292
+            get { return _extnumber; }
293
+        }
294
+        /// <summary>
295
+        /// 用于获取录音的编号
296
+        /// </summary>
297
+        public string FilePath
298
+        {
299
+            set { _filepath = value; }
300
+            get { return _filepath; }
301
+        }
302
+        /// <summary>
303
+        /// 是否录入工单
304
+        /// </summary>
305
+        public bool IsExitWorkOrder
306
+        {
307
+            set { _isexitworkorder = value; }
308
+            get { return _isexitworkorder; }
309
+        }
310
+        /// <summary>
311
+        /// 是否处理0未处理1已处理2注销
312
+        /// </summary>
313
+        public int? IsDeal
314
+        {
315
+            set { _isdeal = value; }
316
+            get { return _isdeal; }
317
+        }
318
+        /// <summary>
319
+        /// 操作类型,0正常1转移2三方通话
320
+        /// </summary>
321
+        public int? OperateType
322
+        {
323
+            set { _operatetype = value; }
324
+            get { return _operatetype; }
325
+        }
326
+        /// <summary>
327
+        /// 操作目标
328
+        /// </summary>
329
+        public string OperateObject
330
+        {
331
+            set { _operateobject = value; }
332
+            get { return _operateobject; }
333
+        }
334
+        /// <summary>
335
+        /// 操作时间
336
+        /// </summary>
337
+        public DateTime? OperateTime
338
+        {
339
+            set { _operatetime = value; }
340
+            get { return _operatetime; }
341
+        }
342
+        /// <summary>
343
+        /// 备注
344
+        /// </summary>
345
+        public string Remark
346
+        {
347
+            set { _remark = value; }
348
+            get { return _remark; }
349
+        }
350
+        /// <summary>
351
+        /// 满意度,1非常满意、2基本满意、3不满意
352
+        /// </summary>
353
+        public int? MYD
354
+        {
355
+            set { _myd = value; }
356
+            get { return _myd; }
357
+        }
358
+        /// <summary>
359
+        /// IVR中选择的业务类型
360
+        /// </summary>
361
+        public int? BusinessType
362
+        {
363
+            set { _businesstype = value; }
364
+            get { return _businesstype; }
365
+        }
366
+        /// <summary>
367
+        /// 
368
+        /// </summary>
369
+        public string Location
370
+        {
371
+            set { _location = value; }
372
+            get { return _location; }
373
+        }
374
+
375
+        /// <summary>
376
+        /// 排队开始时间
377
+        /// </summary>
378
+        public DateTime? WaitStartTime
379
+        {
380
+            set { _waitstarttime = value; }
381
+            get { return _waitstarttime; }
382
+        }
383
+        /// <summary>
384
+        /// 排队结束时间
385
+        /// </summary>
386
+        public DateTime? WaitEndTime
387
+        {
388
+            set { _waitendtime = value; }
389
+            get { return _waitendtime; }
390
+        }
391
+        /// <summary>
392
+        /// 排队时长
393
+        /// </summary>
394
+        public int? WaitLongTime
395
+        {
396
+            set { _waitlongtime = value; }
397
+            get { return _waitlongtime; }
398
+        }
399
+        /// <summary>
400
+        /// 未接通状态(0其他、1坐席未登录、2坐席忙、3振铃)
401
+        /// </summary>
402
+        public int? NoCallState
403
+        {
404
+            set { _nocallstate = value; }
405
+            get { return _nocallstate; }
406
+        }
407
+        /// <summary>
408
+        /// 与工作时间间隔秒数
409
+        /// </summary>
410
+        public int? WorkTimesDiff
411
+        {
412
+            set { _worktimesdiff = value; }
413
+            get { return _worktimesdiff; }
414
+        }
415
+
416
+
417
+        #region 质检
418
+        /// <summary>
419
+        /// 质检状态(0未质检、1已质检)
420
+        /// </summary>
421
+        public int? F_QCState
422
+        {
423
+            set { _f_qcstate = value; }
424
+            get { return _f_qcstate; }
425
+        }
426
+        /// <summary>
427
+        /// 质检分值
428
+        /// </summary>
429
+        public decimal? F_QCScore
430
+        {
431
+            set { _f_qcscore = value; }
432
+            get { return _f_qcscore; }
433
+        }
434
+        /// <summary>
435
+        /// 质检备注
436
+        /// </summary>
437
+        public string F_QCRemark
438
+        {
439
+            set { _f_qcremark = value; }
440
+            get { return _f_qcremark; }
441
+        }
442
+        /// <summary>
443
+        /// 质检人Id
444
+        /// </summary>
445
+        public int? F_QCUserId
446
+        {
447
+            set { _f_qcuserid = value; }
448
+            get { return _f_qcuserid; }
449
+        }
450
+        /// <summary>
451
+        /// 质检人名称
452
+        /// </summary>
453
+        public string F_QCUserName
454
+        {
455
+            set { _f_qcusername = value; }
456
+            get { return _f_qcusername; }
457
+        }
458
+        /// <summary>
459
+        /// 质检时间
460
+        /// </summary>
461
+        public DateTime? F_QCTime
462
+        {
463
+            set { _f_qctime = value; }
464
+            get { return _f_qctime; }
465
+        }
466
+
467
+
468
+
469
+        /// <summary>
470
+        /// 质检客服-存在的问题
471
+        /// </summary>
472
+        public string F_QCQuestion
473
+        {
474
+            set { _f_qcquestion = value; }
475
+            get { return _f_qcquestion; }
476
+        }
477
+        /// <summary>
478
+        /// 质检客服-修改意见
479
+        /// </summary>
480
+        public string F_QCAdvise
481
+        {
482
+            set { _f_qcadvise = value; }
483
+            get { return _f_qcadvise; }
484
+        }
485
+        #endregion
486
+
487
+
488
+        /// <summary>
489
+        /// 是否推荐
490
+        /// </summary>
491
+        public int? F_QCIsSelect
492
+        {
493
+            set { _f_qcisselect = value; }
494
+            get { return _f_qcisselect; }
495
+        }
496
+        /// <summary>
497
+        /// 咨询来电原因ID
498
+        /// </summary>
499
+        public int? F_ZXReasonID
500
+        {
501
+            set { _f_zxreasonid = value; }
502
+            get { return _f_zxreasonid; }
503
+        }
504
+        /// <summary>
505
+        /// 临时来电原因ID
506
+        /// </summary>
507
+        public int? F_LSReasonID
508
+        {
509
+            set { _f_lsreasonid = value; }
510
+            get { return _f_lsreasonid; }
511
+        }
512
+        /// <summary>
513
+        /// 招商来电原因ID
514
+        /// </summary>
515
+        public int? F_ZSReasonID
516
+        {
517
+            set { _f_zsreasonid = value; }
518
+            get { return _f_zsreasonid; }
519
+        }
520
+        /// <summary>
521
+        /// 拨号类型:0:拨号外呼;1:95005回访外呼;2:电销回访外呼
522
+        /// </summary>
523
+        public string TaskType
524
+        {
525
+            set { _tasktype = value; }
526
+            get { return _tasktype; }
527
+        }
528
+        /// <summary>
529
+        /// 回访的电话ID
530
+        /// </summary>
531
+        public string TaskPhoneID
532
+        {
533
+            set { _taskphoneid = value; }
534
+            get { return _taskphoneid; }
535
+        }
536
+        /// <summary>
537
+        /// 回访记录编号:GUID编号唯一
538
+        /// </summary>
539
+        public string TaskID
540
+        {
541
+            set { _taskid = value; }
542
+            get { return _taskid; }
543
+        }
544
+        /// <summary>
545
+        /// 区别正常呼入呼出、转移、三方通话
546
+        /// </summary>
547
+        public int? ActionID
548
+        {
549
+            set { _actionid = value; }
550
+            get { return _actionid; }
551
+        }
552
+        /// <summary>
553
+        /// 1正常呼入呼出、2转移、3三方通话
554
+        /// </summary>
555
+        public int? ActionType
556
+        {
557
+            set { _actiontype = value; }
558
+            get { return _actiontype; }
559
+        }
560
+        /// <summary>
561
+        /// 
562
+        /// </summary>
563
+        public string GroupCode
564
+        {
565
+            set { _groupcode = value; }
566
+            get { return _groupcode; }
567
+        }
568
+        #endregion Model
569
+
570
+    }
571
+}

+ 127 - 0
代码/System.Model/Call/auto_cdr.cs

@@ -0,0 +1,127 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Text;
4
+
5
+namespace System.Model.Call
6
+{
7
+    /// <summary>
8
+    /// auto_cdr:实体类(属性说明自动提取数据库字段的描述信息)
9
+    /// </summary>
10
+    [Serializable]
11
+    public partial class auto_cdr
12
+    {
13
+        public auto_cdr()
14
+        { }
15
+        #region Model
16
+        private long _id;
17
+        private string _uuid;
18
+        private string _agent;
19
+        private string _caller;
20
+        private string _callee;
21
+        private DateTime? _create_time;
22
+        private DateTime? _ring_time;
23
+        private DateTime? _answer_time;
24
+        private DateTime? _end_time;
25
+        private string _record_path;
26
+        private long? _task_id;
27
+        private string _hangup_cause;
28
+        /// <summary>
29
+        /// auto_increment
30
+        /// </summary>
31
+        public long id
32
+        {
33
+            set { _id = value; }
34
+            get { return _id; }
35
+        }
36
+        /// <summary>
37
+        /// 
38
+        /// </summary>
39
+        public string uuid
40
+        {
41
+            set { _uuid = value; }
42
+            get { return _uuid; }
43
+        }
44
+        /// <summary>
45
+        /// 
46
+        /// </summary>
47
+        public string agent
48
+        {
49
+            set { _agent = value; }
50
+            get { return _agent; }
51
+        }
52
+        /// <summary>
53
+        /// 
54
+        /// </summary>
55
+        public string caller
56
+        {
57
+            set { _caller = value; }
58
+            get { return _caller; }
59
+        }
60
+        /// <summary>
61
+        /// 
62
+        /// </summary>
63
+        public string callee
64
+        {
65
+            set { _callee = value; }
66
+            get { return _callee; }
67
+        }
68
+        /// <summary>
69
+        /// 
70
+        /// </summary>
71
+        public DateTime? create_time
72
+        {
73
+            set { _create_time = value; }
74
+            get { return _create_time; }
75
+        }
76
+        /// <summary>
77
+        /// 
78
+        /// </summary>
79
+        public DateTime? ring_time
80
+        {
81
+            set { _ring_time = value; }
82
+            get { return _ring_time; }
83
+        }
84
+        /// <summary>
85
+        /// 
86
+        /// </summary>
87
+        public DateTime? answer_time
88
+        {
89
+            set { _answer_time = value; }
90
+            get { return _answer_time; }
91
+        }
92
+        /// <summary>
93
+        /// 
94
+        /// </summary>
95
+        public DateTime? end_time
96
+        {
97
+            set { _end_time = value; }
98
+            get { return _end_time; }
99
+        }
100
+        /// <summary>
101
+        /// 
102
+        /// </summary>
103
+        public string record_path
104
+        {
105
+            set { _record_path = value; }
106
+            get { return _record_path; }
107
+        }
108
+        /// <summary>
109
+        /// 
110
+        /// </summary>
111
+        public long? task_id
112
+        {
113
+            set { _task_id = value; }
114
+            get { return _task_id; }
115
+        }
116
+        /// <summary>
117
+        /// 
118
+        /// </summary>
119
+        public string hangup_cause
120
+        {
121
+            set { _hangup_cause = value; }
122
+            get { return _hangup_cause; }
123
+        }
124
+        #endregion Model
125
+
126
+    }
127
+}

+ 97 - 0
代码/System.Model/Call/task.cs

@@ -0,0 +1,97 @@
1
+using System;
2
+namespace System.Model.Call
3
+{
4
+    /// <summary>
5
+    /// task:实体类(属性说明自动提取数据库字段的描述信息)
6
+    /// </summary>
7
+    [Serializable]
8
+    public partial class task
9
+    {
10
+        public task()
11
+        { }
12
+        #region Model
13
+        private long _id;
14
+        private string _agent;
15
+        private string _number;
16
+        private int? _state;
17
+        private int? _type;
18
+        private string _content;
19
+        private DateTime? _op_time;
20
+        private int? _outbound_id;
21
+        private int? _status;
22
+        /// <summary>
23
+        /// auto_increment
24
+        /// </summary>
25
+        public long id
26
+        {
27
+            set { _id = value; }
28
+            get { return _id; }
29
+        }
30
+        /// <summary>
31
+        /// 
32
+        /// </summary>
33
+        public string agent
34
+        {
35
+            set { _agent = value; }
36
+            get { return _agent; }
37
+        }
38
+        /// <summary>
39
+        /// 
40
+        /// </summary>
41
+        public string number
42
+        {
43
+            set { _number = value; }
44
+            get { return _number; }
45
+        }
46
+        /// <summary>
47
+        /// 
48
+        /// </summary>
49
+        public int? state
50
+        {
51
+            set { _state = value; }
52
+            get { return _state; }
53
+        }
54
+        /// <summary>
55
+        /// 
56
+        /// </summary>
57
+        public int? type
58
+        {
59
+            set { _type = value; }
60
+            get { return _type; }
61
+        }
62
+        /// <summary>
63
+        /// 
64
+        /// </summary>
65
+        public string content
66
+        {
67
+            set { _content = value; }
68
+            get { return _content; }
69
+        }
70
+        /// <summary>
71
+        /// 
72
+        /// </summary>
73
+        public DateTime? op_time
74
+        {
75
+            set { _op_time = value; }
76
+            get { return _op_time; }
77
+        }
78
+        /// <summary>
79
+        /// 
80
+        /// </summary>
81
+        public int? outbound_id
82
+        {
83
+            set { _outbound_id = value; }
84
+            get { return _outbound_id; }
85
+        }
86
+        /// <summary>
87
+        /// 
88
+        /// </summary>
89
+        public int? status
90
+        {
91
+            set { _status = value; }
92
+            get { return _status; }
93
+        }
94
+        #endregion Model
95
+
96
+    }
97
+}

+ 1 - 0
代码/System.Model/Sys/T_Sys_AutoDial.cs

@@ -83,6 +83,7 @@ namespace System.Model.Sys
83 83
             set { _f_isdelete = value; }
84 84
             get { return _f_isdelete; }
85 85
         }
86
+
86 87
         #endregion Model
87 88
 
88 89
     }

+ 70 - 0
代码/System.Repositories/Call/Call_CallOutboundRepository.cs

@@ -0,0 +1,70 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.Data;
5
+using System.IRepositories.Call;
6
+using System.Model.Call;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using SqlSugar;
10
+
11
+namespace System.Repositories.Call
12
+{
13
+    
14
+    public class Call_CallOutboundRepository : BaseRepository<T_Call_CallOutbound>, ICall_CallOutboundRepository
15
+    {
16
+
17
+        public async Task<int> GetCallNumber(string DeptCode, int teamid, DateTime dtime)
18
+        {
19
+            string sql = "SELECT COUNT(1) FROM T_Call_CallOutbound where  TalkLongTime>0 AND BeginTime BETWEEN @stime AND @etime ";
20
+            if (!string.IsNullOrEmpty(DeptCode))
21
+            {
22
+                sql += $" AND UserCode in (SELECT F_UserCode FROM `T_Sys_UserAccount` WHERE F_DeptId IN(SELECT F_DeptId FROM  T_Sys_Department WHERE F_DeptCode LIKE '{DeptCode}%'))";
23
+                DeptCode = "|0|1|";
24
+            }
25
+
26
+            if (teamid > 0)
27
+            {
28
+                sql += $" AND UserCode in (SELECT F_UserCode FROM `T_Sys_UserAccount` WHERE F_DeptTeamId ={teamid})";
29
+            }
30
+            List<SugarParameter> sugarParameter = new List<SugarParameter>()
31
+            {
32
+                new SugarParameter("@stime",dtime),
33
+                new SugarParameter("@etime",dtime.AddMonths(1)),
34
+            };
35
+
36
+            DataTable dt = await GetTableSugar(sql, sugarParameter);
37
+            if (dt != null && dt.Rows.Count > 0)
38
+            {
39
+                return dt.Rows[0][0].ObjToInt();
40
+            }
41
+            return 0;
42
+        }
43
+        public async Task<int> GetTotleCallNumber(string DeptCode, int teamid, DateTime dtime)
44
+        {
45
+            string sql = "SELECT COUNT(1) FROM T_Call_CallOutbound where  BeginTime BETWEEN @stime AND @etime ";
46
+            if (!string.IsNullOrEmpty(DeptCode))
47
+            {
48
+                sql += $" AND UserCode in (SELECT F_UserCode FROM `T_Sys_UserAccount` WHERE F_DeptId IN(SELECT F_DeptId FROM  T_Sys_Department WHERE F_DeptCode LIKE '{DeptCode}%'))";
49
+                DeptCode = "|0|1|";
50
+            }
51
+
52
+            if (teamid > 0)
53
+            {
54
+                sql += $" AND UserCode in (SELECT F_UserCode FROM `T_Sys_UserAccount` WHERE F_DeptTeamId ={teamid})";
55
+            }
56
+
57
+            List<SugarParameter> sugarParameter = new List<SugarParameter>()
58
+            {
59
+                new SugarParameter("@stime",dtime),
60
+                new SugarParameter("@etime",dtime.AddMonths(1)),
61
+            };
62
+            DataTable dt = await GetTableSugar(sql, sugarParameter);
63
+            if (dt != null && dt.Rows.Count > 0)
64
+            {
65
+                return dt.Rows[0][0].ObjToInt();
66
+            }
67
+            return 0;
68
+        }
69
+    }
70
+}

+ 14 - 0
代码/System.Repositories/Call/auto_cdrRepository.cs

@@ -0,0 +1,14 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.IRepositories.Call;
5
+using System.Model.Call;
6
+using System.Text;
7
+
8
+namespace System.Repositories.Call
9
+{
10
+    
11
+    public class auto_cdrRepository : BaseMysqlRepository<auto_cdr>, Iauto_cdrRepository
12
+    {
13
+    }
14
+}

+ 15 - 0
代码/System.Repositories/Call/taskRepository.cs

@@ -0,0 +1,15 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.IRepositories.Call;
5
+using System.Model.Call;
6
+using System.Text;
7
+
8
+
9
+namespace System.Repositories.Call
10
+{
11
+   
12
+    public class taskRepository : BaseMysqlRepository<task>, ItaskRepository
13
+    {
14
+    }
15
+}

+ 17 - 3
代码/TVShoppingCallCenter_ZLJ/Controllers/AutoDial/OutboundTaskController.cs

@@ -3,12 +3,13 @@ using System.Collections.Generic;
3 3
 using System.Common;
4 4
 using System.Common.Helpers;
5 5
 using System.Data;
6
+using System.IRepositories.Call;
6 7
 using System.IRepositories.Sys;
7 8
 using System.Linq;
9
+using System.Model.Call;
8 10
 using System.Model.Sys;
9 11
 using System.Security.Claims;
10 12
 using System.Threading.Tasks;
11
-using Maticsoft.Model;
12 13
 using Microsoft.AspNetCore.Mvc;
13 14
 using SqlSugar;
14 15
 using TVShoppingCallCenter_ZLJ.Models.Inputs.System;
@@ -20,12 +21,14 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.AutoDial
20 21
     public class OutboundTaskController : BaseController
21 22
     {
22 23
         private readonly ISys_OutboundTaskReposity _sys_outboundTaskrepository;
24
+        private readonly ItaskRepository _taskrepository;
23 25
         private readonly ISys_AutoDialRepository _sys_autodialrepository;
24 26
         public OutboundTaskController(ISys_OutboundTaskReposity sys_outboundTaskrepository
25
-            , ISys_AutoDialRepository sys_autodialrepository)
27
+            , ISys_AutoDialRepository sys_autodialrepository, ItaskRepository taskrepository)
26 28
         {
27 29
             _sys_outboundTaskrepository = sys_outboundTaskrepository;
28 30
             _sys_autodialrepository = sys_autodialrepository;
31
+            _taskrepository = taskrepository;
29 32
         }
30 33
         /// <summary>
31 34
         /// 添加外呼任务
@@ -130,7 +133,6 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.AutoDial
130 133
         /// <summary>
131 134
         /// 添加中间件外呼任务
132 135
         /// </summary>
133
-        /// <param name="input"></param>
134 136
         /// <returns></returns>
135 137
         [HttpPost("addmiddleware")]
136 138
         public async Task<IActionResult> Addmiddleware()
@@ -150,6 +152,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.AutoDial
150 152
             conModels.Add(new ConditionalModel() { FieldName = "F_EndTime", ConditionalType = ConditionalType.LessThanOrEqual , FieldValue = DateTime.Now.ToString() });
151 153
             conModels.Add(new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.LessThanOrEqual, FieldValue = "1" });
152 154
             var list = await _sys_outboundTaskrepository.GetListALL (conModels,  "  F_AddTime  desc");
155
+            int n = 0;
153 156
             if (list != null)
154 157
             {
155 158
                 if (list.Count > 0)
@@ -160,6 +163,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.AutoDial
160 163
                         #region 条件筛选
161 164
                         conModel.Add(new ConditionalModel() { FieldName = "F_IsDelete", ConditionalType = ConditionalType.Equal, FieldValue = ((int)EnumUserCountState.Enabled).ToString() });
162 165
                         conModel.Add(new ConditionalModel() { FieldName = "F_Parentid", ConditionalType = ConditionalType.Equal, FieldValue = it.F_ID .ToString() });
166
+                        conModel.Add(new ConditionalModel() { FieldName = "F_ISOutbound", ConditionalType = ConditionalType.Equal, FieldValue = "0" });
163 167
                         #endregion
164 168
                         var modellist = await _sys_autodialrepository.GetListALL (conModels, "  F_ID  asc");
165 169
                         if (modellist!=null )
@@ -173,10 +177,20 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.AutoDial
173 177
                                 tasks.type  = it .F_Type ;
174 178
                                 tasks.content  = it.F_Content ;
175 179
                                 tasks.outbound_id   = iv .F_ID ;
180
+                                tasks.status = 0;
181
+                                var res = await _taskrepository.Add (tasks);
182
+                                if (res>0)
183
+                                {
184
+                                  n=  n + 1;
185
+
186
+                                }
176 187
                             }
177 188
                         }
178 189
                     }
190
+                    if (n >0)
179 191
                     return Success("任务启动", list.Count);
192
+                    else
193
+                     return Success("暂无任务", 0);
180 194
                 }
181 195
                 else
182 196
                     return Success("暂无任务", 0);

+ 153 - 3
代码/TVShoppingCallCenter_ZLJ/Controllers/CallCenter/CallFunctionController.cs

@@ -2,8 +2,12 @@
2 2
 using System.Collections.Generic;
3 3
 using System.Common;
4 4
 using System.IRepositories;
5
+using System.IRepositories.Call;
6
+using System.IRepositories.Sys;
5 7
 using System.Linq;
6 8
 using System.Model;
9
+using System.Model.Call;
10
+using System.Model.Sys;
7 11
 using System.Security.Claims;
8 12
 using System.Threading.Tasks;
9 13
 using System.Utility;
@@ -26,10 +30,16 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.CallCenter
26 30
         private readonly IConfiguration config;
27 31
         private readonly ISys_MobileDataRepository busMobileDataRepository;
28 32
         private readonly ICall_CallRecordsRepository busCallRecordsRepository;
33
+        private readonly ICall_CallOutboundRepository CallOutboundRecordsRepository;
29 34
         private readonly ICDRRepository busCdrRepository;
35
+        private readonly Iauto_cdrRepository auto_cdrRepository;
36
+        private readonly ItaskRepository taskRepository;
37
+        private readonly ISys_AutoDialRepository sys_autodialrepository;
30 38
         private readonly ISys_SystemConfigRepository busSystemConfigRepository;
31 39
         private readonly ICus_VipInfoRepository _cus_vip_infoRepository;//客户
32
-        public CallFunctionController(ISys_SystemConfigRepository _busSystemConfigRepository,ICDRRepository _busCdrRepository,ICall_CallRecordsRepository _busCallRecordsRepository,IConfiguration _configuration, ISys_MobileDataRepository _busMobileDataRepository, ICus_VipInfoRepository cus_vip_infoRepository)
40
+        public CallFunctionController(ISys_SystemConfigRepository _busSystemConfigRepository,ICDRRepository _busCdrRepository,ICall_CallRecordsRepository _busCallRecordsRepository,IConfiguration _configuration, ISys_MobileDataRepository _busMobileDataRepository, ICus_VipInfoRepository cus_vip_infoRepository,
41
+            ICall_CallOutboundRepository _CallOutboundRecordsRepository, Iauto_cdrRepository _auto_cdrRepository
42
+            , ItaskRepository _taskRepository, ISys_AutoDialRepository _sys_autodialrepository)
33 43
         {
34 44
             busSystemConfigRepository = _busSystemConfigRepository;
35 45
             busCdrRepository = _busCdrRepository;
@@ -37,7 +47,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.CallCenter
37 47
             config = _configuration;
38 48
             busMobileDataRepository = _busMobileDataRepository;
39 49
             _cus_vip_infoRepository = cus_vip_infoRepository;
40
-
50
+            CallOutboundRecordsRepository = _CallOutboundRecordsRepository;
51
+            auto_cdrRepository = _auto_cdrRepository;
52
+            taskRepository = _taskRepository;
53
+            sys_autodialrepository = _sys_autodialrepository;
41 54
     }
42 55
 
43 56
         /// <summary>
@@ -223,7 +236,144 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.CallCenter
223 236
             }
224 237
             return $"同步情况  成功/总数 = {n1}/{totle}";
225 238
         }
226
-        #endregion
239
+        /// <summary>
240
+        /// 同步自动外呼通话记录
241
+        /// </summary>
242
+        /// <returns></returns>
243
+        [NonAction]
244
+        internal async Task<string> SyncOutbound()
245
+        {
246
+            DateTime dtime = DateTime.Now.AddYears(-10);
247
+            int maxid = 0;
248
+            T_Call_CallOutbound modelCallRecord = await CallOutboundRecordsRepository.GetFirst(q => q.CdrId > 0, o => new { o.CdrId }, OrderByType.Desc);
249
+            if (modelCallRecord != null)
250
+            {
251
+                maxid = modelCallRecord.CdrId;
252
+            }
253
+            modelCallRecord = await CallOutboundRecordsRepository.GetFirst(q => q.CdrId > 0, o => new { o.EndTime }, OrderByType.Desc);
254
+            if (modelCallRecord != null)
255
+            {
256
+                if (modelCallRecord.EndTime != null)
257
+                    dtime = modelCallRecord.EndTime.GetValueOrDefault();
258
+            }
259
+            List<auto_cdr > modellist = await auto_cdrRepository.GetListALL(q => q.id > maxid || q.end_time >= dtime);
260
+            int totle = 0;
261
+            int n = 0;
262
+            int n1 = 0;
263
+            if (modellist != null && modellist.Count > 0)
264
+            {
265
+                string url = "请配置videoURL/";
266
+                T_Sys_SystemConfig model = await busSystemConfigRepository.GetSingle(q => q.F_ParamCode == "videoURL");
267
+                if (model != null)
268
+                {
269
+                    url = model.F_ParamValue;
270
+                }
271
+                totle = modellist.Count;
272
+                List<T_Call_CallOutbound> modelRecordList = new List<T_Call_CallOutbound>();
273
+                foreach (auto_cdr modelcdr in modellist)
274
+                {
275
+
276
+                    T_Call_CallOutbound modelRecord = new T_Call_CallOutbound();
277
+                    modelRecord.ActionID =1;
278
+                    modelRecord.TalkStartTime = modelcdr.answer_time;
279
+                    modelRecord.Callee = modelcdr.callee;
280
+                     modelRecord.UserCode = modelcdr.agent ;
281
+                        string tel = modelcdr.callee.TrimStart('0');
282
+                        modelRecord.UserCode = modelcdr.agent;
283
+                        var cus = await _cus_vip_infoRepository.GetListALL(x => x.F_State == 1 && x.F_Phone
284
+                       == modelcdr.caller || x.F_Phone
285
+                       == tel);
286
+                        if (cus != null && cus.Count > 0)
287
+                        {
288
+                            modelRecord.CusCode = cus.FirstOrDefault().F_Name;
289
+                            modelRecord.CusId = cus.FirstOrDefault().F_ID;
290
+                        }
291
+                    modelRecord.Caller = modelcdr.caller;
292
+                    modelRecord.CallType = 1;
293
+                    modelRecord.BeginTime = modelcdr.create_time;
294
+                    modelRecord.EndTime = modelcdr.end_time;
295
+                    //  modelcdr.hangup_cause;挂机原因不赋值  HangUpReason
296
+                    //  modelcdr.leave_path 留言 赋值给了FilePath
297
+                    modelRecord.FilePath = url + modelcdr.record_path;
298
+                    if (string.IsNullOrEmpty(modelcdr.record_path))
299
+                    {
300
+                        modelRecord.FilePath = url + modelcdr.record_path;
301
+                    }
302
+                    modelRecord.RingStartTime = modelcdr.ring_time;
303
+                    modelRecord.CallId = modelcdr.uuid;
304
+                    modelRecord.Location = await GetLocationFunc(modelcdr.caller, 1);
305
+                    #region 计算时长
306
+                    modelRecord.LongTime = (int)DateTimeConvert.DateDiff(DateInterval.Second, modelcdr.create_time.GetValueOrDefault(), modelcdr.end_time.GetValueOrDefault());
307
+
308
+                    if (modelcdr.answer_time != null)
309
+                        modelRecord.TalkLongTime = (int)DateTimeConvert.DateDiff(DateInterval.Second, modelcdr.answer_time.GetValueOrDefault(), modelcdr.end_time.GetValueOrDefault());
310
+                    else
311
+                        modelRecord.TalkLongTime = 0;
312
+                    #endregion
313
+                    n++;
314
+                    n1++;
315
+                    modelRecordList.Add(modelRecord);
316
+                    if (n >= 2000)
317
+                    {
318
+                        await CallOutboundRecordsRepository.AddAndUpdateList(modelRecordList);
319
+                        modelRecordList.Clear();
320
+                        n = 0;
321
+                    }
322
+
323
+                }
324
+                await CallOutboundRecordsRepository.AddAndUpdateList(modelRecordList);
325
+            }
326
+            return $"同步情况  成功/总数 = {n1}/{totle}";
327
+        }
328
+
329
+        /// <summary>
330
+        /// 同步外呼状态
331
+        /// </summary>
332
+        /// <returns></returns>
333
+        [NonAction]
334
+        internal async Task<string> SyncAutodial()
335
+        {
336
+            List<task > modellist = await taskRepository.GetListALL(q => q.status  ==0 &&q .state ==1);
337
+            int totle = 0;
338
+            int n = 0;
339
+            int n1 = 0;
340
+            if (modellist != null && modellist.Count > 0)
341
+            {
342
+                List<T_Sys_AutoDial> modelAutoDial = new List<T_Sys_AutoDial>();
343
+                List<task> taskList  = new List<task>();
344
+                foreach (task  it  in modellist)
345
+                {
346
+                    var AutoDial = await sys_autodialrepository.GetSingle (q => q.F_ID  == it.outbound_id );
347
+                    if (AutoDial!=null )
348
+                    {
349
+                        AutoDial.F_ISOutbound = 1;
350
+                        modelAutoDial.Add(AutoDial);
351
+                        n++;
352
+                    }
353
+                    it.status = 1;
354
+                    taskList.Add(it);
355
+                    #endregion
356
+                    n1++;
357
+                    if (n >= 2000)
358
+                    {
359
+                        await sys_autodialrepository.AddAndUpdateList(modelAutoDial);
360
+                        modelAutoDial.Clear();
361
+                        n = 0;
362
+                    }
363
+                    if (n1 >=2000)
364
+                    {
365
+                        await taskRepository.AddAndUpdateList(taskList);
366
+                        taskList.Clear();
367
+                        n1 = 0;
368
+                    }
369
+                }
370
+                await sys_autodialrepository.AddAndUpdateList(modelAutoDial);
371
+                await taskRepository.AddAndUpdateList(taskList);
372
+
373
+            }
374
+            return $"同步情况  成功/总数 = {n1}/{totle}";
375
+        }
376
+       
227 377
 
228 378
     }
229 379
 }

+ 25 - 1
代码/TVShoppingCallCenter_ZLJ/Controllers/hangfire/HangfireController.cs

@@ -185,7 +185,31 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.hangfire
185 185
         }
186 186
         #endregion
187 187
 
188
-
188
+        /// <summary>
189
+        /// 同步自动外呼通话记录
190
+        /// </summary>
191
+        /// <returns></returns>
192
+        [NonAction]
193
+        public async Task<IActionResult> MinutelyOutbound()
194
+        {
195
+            string str = "";
196
+            //同步通话记录
197
+            str = await busCallFunctionController.SyncOutbound();
198
+            return Success(str);
199
+        }
200
+        /// <summary>
201
+        /// 同步自动外呼通话记录
202
+        /// </summary>
203
+        /// <returns></returns>
204
+        [NonAction]
205
+        public async Task<IActionResult> AutodialOutbound()
206
+        {
207
+            string str = "";
208
+            //同步通话记录
209
+            str = await busCallFunctionController.SyncAutodial();
210
+            return Success(str);
211
+        }
212
+        
189 213
         #region 月12循环 
190 214
 
191 215
         /// <summary>

+ 6 - 2
代码/TVShoppingCallCenter_ZLJ/Startup.cs

@@ -206,6 +206,9 @@ namespace TVShoppingCallCenter_ZLJ
206 206
             services.AddTransient<ISys_AutoDialRepository, Sys_AutoDialRepository>();
207 207
 
208 208
             services.AddTransient<ItaskRepository, taskRepository>();
209
+            services.AddTransient<Iauto_cdrRepository , auto_cdrRepository>();
210
+            services.AddTransient<ICall_CallOutboundRepository, Call_CallOutboundRepository>();
211
+            
209 212
             #endregion
210 213
 
211 214
 
@@ -248,7 +251,7 @@ namespace TVShoppingCallCenter_ZLJ
248 251
 
249 252
             app.UseHangfireServer(new BackgroundJobServerOptions
250 253
             {
251
-                Queues = new[] { "daily", "minutely", "monthly", "month12" },//队列名称,只能为小写
254
+                Queues = new[] { "daily", "minutely", "monthly", "outbound", "autodial", "month12" },//队列名称,只能为小写
252 255
                 WorkerCount = Environment.ProcessorCount * 3, //并发任务数
253 256
                 ServerName = "hangfireMysql",//服务器名称
254 257
             });//启动Hangfire服务  有可选参数
@@ -260,7 +263,8 @@ namespace TVShoppingCallCenter_ZLJ
260 263
 
261 264
             RecurringJob.AddOrUpdate<HangfireController>(a => a.DailyRecurring(), Cron.Daily, TimeZoneInfo.Local, "daily");
262 265
             RecurringJob.AddOrUpdate<HangfireController>(a => a.MinutelyRecurring(), Cron.Minutely, TimeZoneInfo.Local, "minutely");
263
-           
266
+            RecurringJob.AddOrUpdate<HangfireController>(a => a.MinutelyOutbound(), Cron.Minutely, TimeZoneInfo.Local, "outbound");
267
+            RecurringJob.AddOrUpdate<HangfireController>(a => a.AutodialOutbound(), Cron.Minutely, TimeZoneInfo.Local, "autodial");
264 268
             //秒 分 时 日   *每
265 269
             RecurringJob.AddOrUpdate<HangfireController>(a => a.Month12Recurring(), "0 0 0 12 * ?", TimeZoneInfo.Local, "month12");
266 270
             #region steeltoe