|
|
@@ -1,4 +1,5 @@
|
|
1
|
1
|
using CallCenter.Utility;
|
|
|
2
|
+using CallCenterApi.DB;
|
|
2
|
3
|
using CallCenterApi.Interface.Controllers.Base;
|
|
3
|
4
|
using CallCenterApi.Interface.Models.Filter;
|
|
4
|
5
|
using CallCenterApi.Interface.Models.Input;
|
|
|
@@ -16,7 +17,7 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
16
|
17
|
private readonly BLL.T_Call_BanCallOut banCallOutBLL = new BLL.T_Call_BanCallOut();
|
|
17
|
18
|
private readonly BLL.T_Sys_BanCallOutTime banCallOutTimeBLL = new BLL.T_Sys_BanCallOutTime();
|
|
18
|
19
|
private readonly BLL.T_Sys_BanCallOut sysBanCallOutBLL = new BLL.T_Sys_BanCallOut();
|
|
19
|
|
-
|
|
|
20
|
+ private readonly BLL.T_Sys_UserAccount userAccountBLL = new BLL.T_Sys_UserAccount();
|
|
20
|
21
|
#region 禁止外呼号码管理
|
|
21
|
22
|
public ActionResult GetList(FilterBanCallOut filter)
|
|
22
|
23
|
{
|
|
|
@@ -41,18 +42,54 @@ namespace CallCenterApi.Interface.Controllers.callout
|
|
41
|
42
|
true,
|
|
42
|
43
|
out recordCount);
|
|
43
|
44
|
List<Model.T_Call_BanCallOut> modelList = new BLL.T_Call_BanCallOut().DataTableToList(dt);
|
|
|
45
|
+ var userList = userAccountBLL.DataTableToList1(userAccountBLL.GetList("").Tables[0]);
|
|
44
|
46
|
var obj = new
|
|
45
|
47
|
{
|
|
46
|
|
- rows = modelList,
|
|
|
48
|
+ rows = modelList.Select(x => new
|
|
|
49
|
+ {
|
|
|
50
|
+ id = x.Id,
|
|
|
51
|
+ phone = x.F_Phone,
|
|
|
52
|
+ settime = x.F_SetTime,
|
|
|
53
|
+ remark = x.F_Remark,
|
|
|
54
|
+ username = userList.SingleOrDefault(m => m.F_UserId == x.F_UserId)?.F_UserName ?? "系统管理"
|
|
|
55
|
+ }),
|
|
47
|
56
|
total = recordCount
|
|
48
|
57
|
};
|
|
49
|
58
|
return Content(obj.ToJson());
|
|
50
|
59
|
}
|
|
51
|
60
|
|
|
|
61
|
+ public ActionResult Export()
|
|
|
62
|
+ {
|
|
|
63
|
+ var rows = new BLL.T_Call_BanCallOut().DataTableToList(DbHelperSQL.Query("SELECT F_Id,F_Phone,F_SetTime,F_Remark,F_UserId FROM T_Call_BanCallOut").Tables[0]);
|
|
|
64
|
+ var userList = userAccountBLL.DataTableToList1(userAccountBLL.GetList("").Tables[0]);
|
|
|
65
|
+ List<List<string>> list = new List<List<string>>();
|
|
|
66
|
+ foreach (var item in rows)
|
|
|
67
|
+ {
|
|
|
68
|
+ List<string> listItem = new List<string>();
|
|
|
69
|
+ list.Add(new List<string>()
|
|
|
70
|
+ {
|
|
|
71
|
+ item.F_Phone.ToString(),
|
|
|
72
|
+ item.F_SetTime.ToString(),
|
|
|
73
|
+ item.F_Remark.ToString(),
|
|
|
74
|
+ userList.SingleOrDefault(m => m.F_UserId == item.F_UserId)?.F_UserName ?? "系统管理"
|
|
|
75
|
+ });
|
|
|
76
|
+ }
|
|
|
77
|
+
|
|
|
78
|
+ NPOIHelper npoi = new NPOIHelper();
|
|
|
79
|
+ var res = npoi.ExportToExcel($"限制号码_{DateTime.Now.ToString("yyyyMMddHHmmss")}", list, new string[] { "号码", "添加时间", "备注", "添加人" });
|
|
|
80
|
+ return !string.IsNullOrWhiteSpace(res) ? Error(res) : Success("导出成功");
|
|
|
81
|
+ }
|
|
|
82
|
+
|
|
52
|
83
|
public ActionResult Add(BanCallOutInput input)
|
|
53
|
84
|
{
|
|
54
|
85
|
if (string.IsNullOrWhiteSpace(input.Phone))
|
|
55
|
86
|
return Error("号码不可为空");
|
|
|
87
|
+ input.Phone = input.Phone.Trim();
|
|
|
88
|
+ string phone = RequestString.ToDBC(RequestString.RemoveNotNumber(WebHelper.NoHtml(input.Phone)));
|
|
|
89
|
+ if (phone.Length != input.Phone.Length)
|
|
|
90
|
+ return Error("号码格式不正确");
|
|
|
91
|
+ if (string.IsNullOrWhiteSpace(input.Remark))
|
|
|
92
|
+ return Error("备注不可以为空");
|
|
56
|
93
|
var model = banCallOutBLL.GetModel(input.Phone);
|
|
57
|
94
|
if (model != null)
|
|
58
|
95
|
return Error("该号码已被限制外呼");
|