duhongyu лет назад: 5
Родитель
Сommit
9fd4d4f5fe

+ 13 - 0
代码/System.IRepositories/Sys/ISys_BottomNumberRepository.cs

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

+ 115 - 0
代码/System.Model/Sys/T_Sys_BottomNumber.cs

@@ -0,0 +1,115 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Text;
4
+
5
+namespace System.Model.Sys
6
+{
7
+    [Serializable]
8
+    public partial class T_Sys_BottomNumber
9
+    {
10
+        public T_Sys_BottomNumber()
11
+        { }
12
+        #region Model
13
+        private int _f_id;
14
+        private string _f_name;
15
+        private string _f_zxzcode;
16
+        private string _f_tel;
17
+        private DateTime? _f_createon;
18
+        private string _f_createby;
19
+        private DateTime? _f_lastmodifyon;
20
+        private string _f_lastmodifyby;
21
+        private int? _f_isdelete;
22
+        private DateTime? _f_deleteon;
23
+        private string _f_deleteby;
24
+        /// <summary>
25
+        /// auto_increment
26
+        /// </summary>
27
+        public int F_ID
28
+        {
29
+            set { _f_id = value; }
30
+            get { return _f_id; }
31
+        }
32
+        /// <summary>
33
+        /// 
34
+        /// </summary>
35
+        public string F_Name
36
+        {
37
+            set { _f_name = value; }
38
+            get { return _f_name; }
39
+        }
40
+        /// <summary>
41
+        /// 
42
+        /// </summary>
43
+        public string F_ZXZCode
44
+        {
45
+            set { _f_zxzcode = value; }
46
+            get { return _f_zxzcode; }
47
+        }
48
+        /// <summary>
49
+        /// 
50
+        /// </summary>
51
+        public string F_Tel
52
+        {
53
+            set { _f_tel = value; }
54
+            get { return _f_tel; }
55
+        }
56
+        /// <summary>
57
+        /// 
58
+        /// </summary>
59
+        public DateTime? F_CreateOn
60
+        {
61
+            set { _f_createon = value; }
62
+            get { return _f_createon; }
63
+        }
64
+        /// <summary>
65
+        /// 
66
+        /// </summary>
67
+        public string F_CreateBy
68
+        {
69
+            set { _f_createby = value; }
70
+            get { return _f_createby; }
71
+        }
72
+        /// <summary>
73
+        /// 
74
+        /// </summary>
75
+        public DateTime? F_LastModifyOn
76
+        {
77
+            set { _f_lastmodifyon = value; }
78
+            get { return _f_lastmodifyon; }
79
+        }
80
+        /// <summary>
81
+        /// 
82
+        /// </summary>
83
+        public string F_LastModifyBy
84
+        {
85
+            set { _f_lastmodifyby = value; }
86
+            get { return _f_lastmodifyby; }
87
+        }
88
+        /// <summary>
89
+        /// 
90
+        /// </summary>
91
+        public int? F_IsDelete
92
+        {
93
+            set { _f_isdelete = value; }
94
+            get { return _f_isdelete; }
95
+        }
96
+        /// <summary>
97
+        /// 
98
+        /// </summary>
99
+        public DateTime? F_DeleteOn
100
+        {
101
+            set { _f_deleteon = value; }
102
+            get { return _f_deleteon; }
103
+        }
104
+        /// <summary>
105
+        /// 
106
+        /// </summary>
107
+        public string F_DeleteBy
108
+        {
109
+            set { _f_deleteby = value; }
110
+            get { return _f_deleteby; }
111
+        }
112
+        #endregion Model
113
+
114
+    }
115
+}

+ 15 - 0
代码/System.Repositories/Sys/Sys_BottomNumberRepository.cs

@@ -0,0 +1,15 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.IRepositories.Sys;
5
+using System.Model.Sys;
6
+using System.Text;
7
+
8
+namespace System.Repositories.Sys
9
+{
10
+   
11
+    public class Sys_BottomNumberRepository
12
+: BaseRepository<T_Sys_BottomNumber>, ISys_BottomNumberRepository
13
+    {
14
+    }
15
+}

+ 184 - 0
代码/TVShoppingCallCenter_ZLJ/Controllers/System/BottomNumberController.cs

@@ -0,0 +1,184 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Common;
4
+using System.IRepositories;
5
+using System.IRepositories.Sys;
6
+using System.Linq;
7
+using System.Model.Sys;
8
+using System.Security.Claims;
9
+using System.Threading.Tasks;
10
+using Microsoft.AspNetCore.Authorization;
11
+using Microsoft.AspNetCore.Mvc;
12
+using SqlSugar;
13
+
14
+namespace TVShoppingCallCenter_ZLJ.Controllers.System
15
+{
16
+    [Authorize]
17
+    [Produces("application/json")]
18
+    [Route("api/[controller]")]
19
+    public class BottomNumberController : BaseController
20
+    {
21
+        private readonly ISys_BottomNumberRepository _sys_bottomnumberrepository;
22
+        private readonly ISys_SeatGroupRepository _sys_seatGroupRepository;
23
+        public BottomNumberController(ISys_BottomNumberRepository sys_bottomnumberrepository
24
+            , ISys_SeatGroupRepository sys_seatGroupRepository)
25
+        {
26
+            _sys_bottomnumberrepository = sys_bottomnumberrepository;
27
+            _sys_seatGroupRepository = sys_seatGroupRepository;
28
+        }
29
+        /// <summary>
30
+        /// 添加
31
+        /// </summary>
32
+        /// <param name="input"></param>
33
+        /// <returns></returns>
34
+        [HttpPost("add")]
35
+        public async Task<IActionResult> AddAsync(T_Sys_BottomNumber input)
36
+        {
37
+            if (string.IsNullOrEmpty(input.F_Name))
38
+                return Error("请输入名称");
39
+            if (string.IsNullOrEmpty(input.F_ZXZCode))
40
+                return Error("请选择坐席组");
41
+            if (string.IsNullOrEmpty(input.F_Tel))
42
+                return Error("请输入底号");
43
+            input.F_CreateOn = DateTime.Now;
44
+            input.F_IsDelete = 0;
45
+            input.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
46
+            var res = await _sys_bottomnumberrepository.Add(input);
47
+            if (res > 0)
48
+            {
49
+                return Success("添加成功");
50
+            }
51
+            else
52
+            {
53
+                return Error("添加失败");
54
+            }
55
+        }
56
+        /// <summary>
57
+        /// 修改
58
+        /// </summary>
59
+        [HttpPost("update")]
60
+        public async Task<IActionResult> UpdateAsync(T_Sys_BottomNumber input)
61
+        {
62
+            if (input.F_ID <= 0)
63
+                return Error("参数错误");
64
+            if (string.IsNullOrEmpty(input.F_Name))
65
+                return Error("请输入名称");
66
+            if (string.IsNullOrEmpty(input.F_ZXZCode))
67
+                return Error("请选择坐席组");
68
+            if (string.IsNullOrEmpty(input.F_Tel))
69
+                return Error("请输入底号");
70
+            var model = await _sys_bottomnumberrepository.GetSingle(x => x.F_ID == input.F_ID);
71
+            if (model == null)
72
+                return Error("操作失败");
73
+            input.F_IsDelete = 0;
74
+            input.F_CreateBy = model.F_CreateBy;
75
+            input.F_CreateOn = model.F_CreateOn;
76
+            model = input;
77
+            model.F_LastModifyOn = DateTime.Now;
78
+            model.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
79
+            var b = await _sys_bottomnumberrepository.Update(model);
80
+            if (b)
81
+                return Success("修改成功");
82
+            return Error("修改失败");
83
+        }
84
+        /// <summary>
85
+        /// 删除
86
+        /// </summary>
87
+        /// <param name="ids"></param>
88
+        /// <returns></returns>
89
+        [HttpPost("delete")]
90
+        public async Task<IActionResult> Remove(int[] ids)
91
+        {
92
+            var res = 0;
93
+            if (ids != null && ids.Length > 0)
94
+            {
95
+                foreach (var item in ids)
96
+                {
97
+                    var model = await _sys_bottomnumberrepository.GetSingle(x => x.F_ID == item);
98
+                    model.F_IsDelete = (int)EnumUserCountState.Delete;
99
+                    model.F_DeleteOn = DateTime.Now.ToLocalTime();
100
+                    model.F_DeleteBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
101
+                    if (_sys_bottomnumberrepository.Update(model).Result)
102
+                        res += 1;
103
+                }
104
+                if (res == ids.Length)
105
+                    return Success("删除成功");
106
+                else if (res > 0 && res < ids.Length)
107
+                    return Error("部分删除失败,请查看后重新操作");
108
+                else
109
+                    return Error("删除失败,请查看后重新操作");
110
+            }
111
+            else
112
+                return Error("请选择要删除的记录");
113
+        }
114
+
115
+        /// <summary>
116
+        /// 获取列表
117
+        /// </summary>
118
+        /// <param name="keyword"></param>
119
+        /// <param name="pageindex"></param>
120
+        /// <param name="pagesize"></param>
121
+        /// <returns></returns>
122
+        [HttpGet("getlist")]
123
+        public async Task<IActionResult> GetLisAsync(string keyword, string code, int pageindex = 1, int pagesize = 20)
124
+        {
125
+            List<IConditionalModel> conModels = new List<IConditionalModel>();
126
+            #region 条件筛选
127
+            conModels.Add(new ConditionalModel() { FieldName = "F_IsDelete", ConditionalType = ConditionalType.Equal, FieldValue = ((int)EnumUserCountState.Enabled).ToString() });
128
+            if (!string.IsNullOrEmpty(keyword))
129
+            {
130
+                conModels.Add(new ConditionalCollections()
131
+                {
132
+                    ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
133
+                    {
134
+                        new  KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel() { FieldName = "F_Tel", ConditionalType = ConditionalType.Like, FieldValue = keyword }),
135
+                        new  KeyValuePair<WhereType, ConditionalModel>( WhereType.Or , new ConditionalModel() { FieldName = "F_Name", ConditionalType = ConditionalType.Like, FieldValue = keyword }),
136
+                    }
137
+                });
138
+            }
139
+            conModels.Add(new ConditionalModel() { FieldName = "F_ZXZCode", ConditionalType = ConditionalType.Equal, FieldValue = code });
140
+            #endregion
141
+            int recordCount = 0;
142
+            var list = await _sys_bottomnumberrepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount });
143
+
144
+
145
+            var obj = new
146
+            {
147
+                state = "success",
148
+                message = "成功",
149
+                rows = WokeTimes(list),
150
+                total = list.Totals,
151
+            };
152
+
153
+            return Content(obj.ToJson());
154
+        }
155
+        private PageData<T_Sys_BottomNumber> WokeTimes(PageData<T_Sys_BottomNumber> pageData)
156
+
157
+        {
158
+            foreach (var it in pageData.Rows)
159
+            {
160
+                it.F_ZXZCode  = _sys_seatGroupRepository.GetListALL(x => x.F_ZXZCode == it.F_ZXZCode).Result != null ? _sys_seatGroupRepository.GetListALL(x => x.F_ZXZCode == it.F_ZXZCode).Result.FirstOrDefault().F_ZXZName : "";
161
+            }
162
+            return pageData;
163
+        }
164
+        /// <summary>
165
+        /// 获取详情
166
+        /// </summary>
167
+        /// <param name="id">id</param>
168
+        /// <returns></returns>
169
+        [HttpGet("getdetails")]
170
+        public async Task<IActionResult> GetDetailsAsync(int id)
171
+        {
172
+            if (id <= 0)
173
+                return Error("参数错误");
174
+
175
+            var model = await _sys_bottomnumberrepository.GetSingle(x => x.F_ID == id);
176
+            if (model == null)
177
+            {
178
+                return Error("获取失败");
179
+            }
180
+
181
+            return Success("获取成功!", model);
182
+        }
183
+    }
184
+}

+ 1 - 0
代码/TVShoppingCallCenter_ZLJ/Startup.cs

@@ -209,6 +209,7 @@ namespace TVShoppingCallCenter_ZLJ
209 209
             services.AddTransient<Iauto_cdrRepository , auto_cdrRepository>();
210 210
             services.AddTransient<ICall_CallOutboundRepository, Call_CallOutboundRepository>();
211 211
             services.AddTransient<Ipoint_agentRepository, point_agentRepository>();
212
+            services.AddTransient<ISys_BottomNumberRepository, Sys_BottomNumberRepository>();
212 213
             
213 214
             #endregion
214 215