Przeglądaj źródła

一键转接和三方通话修改

lihai 6 lat temu
rodzic
commit
b6008fbb1d

+ 4 - 4
codegit/CallCenterApi/CallCenterApi.DAL/T_Con_Conversation.cs

164
                 {
164
                 {
165
                     model.F_Type = int.Parse(row["F_Type"].ToString());
165
                     model.F_Type = int.Parse(row["F_Type"].ToString());
166
                 }
166
                 }
167
-                if (row["F_Department"] != null)
167
+                if (row["F_Department"] != null && row["F_Department"].ToString() != "")
168
                 {
168
                 {
169
-                    model.F_Department = row["F_Department"].ToString();
169
+                    model.F_Department = int.Parse(row["F_Department"].ToString());
170
                 }
170
                 }
171
-                if (row["F_Section"] != null)
171
+                if (row["F_Section"] != null && row["F_Section"].ToString() != "")
172
                 {
172
                 {
173
-                    model.F_Section = row["F_Section"].ToString();
173
+                    model.F_Section = int.Parse(row["F_Section"].ToString());
174
                 }
174
                 }
175
                 if (row["F_Telephone"] != null)
175
                 if (row["F_Telephone"] != null)
176
                 {
176
                 {

+ 45 - 25
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/ConversationController.cs

21
     public class ConversationController : BaseController
21
     public class ConversationController : BaseController
22
     {
22
     {
23
         BLL.T_Con_Conversation bll = new BLL.T_Con_Conversation();
23
         BLL.T_Con_Conversation bll = new BLL.T_Con_Conversation();
24
+        BLL.T_Sys_Department bll_Dep = new BLL.T_Sys_Department();
24
         /// <summary>
25
         /// <summary>
25
         /// 获取内外线列表
26
         /// 获取内外线列表
26
         /// </summary>
27
         /// </summary>
36
                 string keyword = RequestString.GetQueryString("keyword");
37
                 string keyword = RequestString.GetQueryString("keyword");
37
                 //电话
38
                 //电话
38
                 string strtel = RequestString.GetQueryString("tel");
39
                 string strtel = RequestString.GetQueryString("tel");
39
-                ////部门
40
-               string department = RequestString.GetQueryString("department");
41
-                ////科室
42
-                string section = RequestString.GetQueryString("section");
43
-                ////医师
40
+                //部门id
41
+                int department = RequestString.GetInt("department", 0);
42
+                //科室id
43
+                int section = RequestString.GetInt("section", 0);
44
+                //医师
44
                 string physician = RequestString.GetQueryString("physician");
45
                 string physician = RequestString.GetQueryString("physician");
45
                 string stringtype = RequestString.GetQueryString("type");
46
                 string stringtype = RequestString.GetQueryString("type");
46
                 int type = 0;
47
                 int type = 0;
51
 
52
 
52
                 if (keyword.Trim() != "" && keyword != "undefined")
53
                 if (keyword.Trim() != "" && keyword != "undefined")
53
                 {
54
                 {
54
-                    sql += $"  and (F_Telephone like '%" + keyword.Trim() + "%' or F_Department like '%" + keyword.Trim() + "%'or F_Section like '%" + keyword.Trim() + "%'  or F_Physician like '%" + keyword.Trim() + "%' or F_Title like '%" + keyword.Trim() + "%') ";
55
+                    sql += $" and (F_Telephone like '%" + keyword.Trim() + "%' or F_Physician like '%" + keyword.Trim() + "%' or F_Title like '%" + keyword.Trim() + "%') ";
55
                 }
56
                 }
56
                 if (strtel.Trim() != "" && strtel != "undefined")
57
                 if (strtel.Trim() != "" && strtel != "undefined")
57
                 {
58
                 {
58
-                    sql += "and  F_Telephone=" + strtel;
59
+                    sql += " and F_Telephone=" + strtel;
59
                 }
60
                 }
60
-                if (department.Trim() != "" && department != "undefined")
61
+                if (department > 0)
61
                 {
62
                 {
62
-                    sql += "and  F_Department=" + department;
63
+                    sql += " and F_Department=" + department;
63
                 }
64
                 }
64
-                if (section.Trim() != "" && section != "undefined")
65
+                if (section > 0)
65
                 {
66
                 {
66
-                    sql += "and  F_Section=" + section;
67
+                    sql += " and F_Section=" + section;
67
                 }
68
                 }
68
                 if (physician.Trim() != "" && physician != "undefined")
69
                 if (physician.Trim() != "" && physician != "undefined")
69
                 {
70
                 {
70
-                    sql += "and  F_Physician=" + physician;
71
+                    sql += " and F_Physician=" + physician;
71
                 }
72
                 }
72
                 if (strpageindex.Trim() != "")
73
                 if (strpageindex.Trim() != "")
73
                 {
74
                 {
80
                 if (stringtype .Trim() != "")
81
                 if (stringtype .Trim() != "")
81
                 {
82
                 {
82
                     type  = Convert.ToInt32(stringtype);
83
                     type  = Convert.ToInt32(stringtype);
83
-                    sql += "and  F_Type=" + type;
84
+                    sql += " and F_Type=" + type;
84
                 }
85
                 }
85
                 int recordCount = 0;
86
                 int recordCount = 0;
86
                 dt = BLL.PagerBLL.GetListPager(
87
                 dt = BLL.PagerBLL.GetListPager(
87
                         "T_Con_Conversation",
88
                         "T_Con_Conversation",
88
                         "T_Con_Conversation.ID",
89
                         "T_Con_Conversation.ID",
89
-                        "*",
90
+                        "*,(SELECT F_DeptName FROM dbo.T_Sys_Department WHERE F_DeptId = dbo.T_Con_Conversation.F_Department) AS Department_Name,(SELECT F_DeptName FROM dbo.T_Sys_Department WHERE F_DeptId = dbo.T_Con_Conversation.F_Section) AS Section_Name ",
90
                         sql,
91
                         sql,
91
                        "ORDER BY T_Con_Conversation.ID desc",
92
                        "ORDER BY T_Con_Conversation.ID desc",
92
                         pagesize,
93
                         pagesize,
93
                         pageindex,
94
                         pageindex,
94
                         true,
95
                         true,
95
                         out recordCount);
96
                         out recordCount);
96
-                List<Model.T_Con_Conversation> modlelist = new BLL.T_Con_Conversation().DataTableToList(dt);
97
+                //List<Model.T_Con_Conversation> modlelist = new BLL.T_Con_Conversation().DataTableToList(dt);
97
                 var obj = new
98
                 var obj = new
98
                 {
99
                 {
99
                     state = "success",
100
                     state = "success",
100
                     message = "成功",
101
                     message = "成功",
101
-                    rows = modlelist,
102
+                    rows = dt,
102
                     total = recordCount
103
                     total = recordCount
103
                 };
104
                 };
104
                 res = Content(obj.ToJson());
105
                 res = Content(obj.ToJson());
142
         {
143
         {
143
             public int ID { get; set; }
144
             public int ID { get; set; }
144
             public int  F_Type { get; set; }// 1内线2外线
145
             public int  F_Type { get; set; }// 1内线2外线
145
-            public string F_Department { get; set; }// 部门
146
-            public string F_Section { get; set; }//科室
146
+            public int F_Department { get; set; }// 部门
147
+            public int F_Section { get; set; }//科室
147
             public string F_Telephone { get; set; }//电话
148
             public string F_Telephone { get; set; }//电话
148
             public string F_Physician { get; set; }//医师
149
             public string F_Physician { get; set; }//医师
149
             public string F_Title { get; set; }//职称
150
             public string F_Title { get; set; }//职称
168
         /// <returns></returns>
169
         /// <returns></returns>
169
         public ActionResult Add(Conversation input)
170
         public ActionResult Add(Conversation input)
170
         {
171
         {
172
+            #region 获取部门id by 科室id
173
+            var model_Dep = new Model.T_Sys_Department();
174
+            int dep_Sectionid = input.F_Section;
175
+            if (dep_Sectionid > 0)
176
+                model_Dep = bll_Dep.GetModel(dep_Sectionid);
177
+            #endregion
178
+
171
             #region 添加验证判断
179
             #region 添加验证判断
172
             if (string.IsNullOrEmpty(input.F_Telephone))
180
             if (string.IsNullOrEmpty(input.F_Telephone))
173
                 return Error("电话不能为空!");
181
                 return Error("电话不能为空!");
178
             #endregion
186
             #endregion
179
             var model = new Model.T_Con_Conversation();
187
             var model = new Model.T_Con_Conversation();
180
             model.F_Type = input.F_Type;    //1内线2外线
188
             model.F_Type = input.F_Type;    //1内线2外线
181
-            model.F_Department = input.F_Department;    //部门
182
-            model.F_Section = input.F_Section;    // 科室
189
+            model.F_Department = model_Dep != null ? model_Dep.F_ParentId : input.F_Department;    //部门id
190
+            model.F_Section = input.F_Section;    // 科室id
183
             model.F_Telephone = input.F_Telephone;  // 电话
191
             model.F_Telephone = input.F_Telephone;  // 电话
184
             model.F_Physician = input.F_Physician;      //医师
192
             model.F_Physician = input.F_Physician;      //医师
185
             model.F_Title = input.F_Title;//职称
193
             model.F_Title = input.F_Title;//职称
198
         {
206
         {
199
             int userId = CurrentUser.UserData.F_UserId;
207
             int userId = CurrentUser.UserData.F_UserId;
200
 
208
 
209
+            #region 获取部门id by 科室id
210
+            var model_Dep = new Model.T_Sys_Department();
211
+            int dep_Sectionid = input.F_Section;
212
+            if(dep_Sectionid > 0)
213
+                model_Dep = bll_Dep.GetModel(dep_Sectionid);
214
+            #endregion
215
+
201
             #region 添加验证判断
216
             #region 添加验证判断
202
             if (input.ID <= 0)
217
             if (input.ID <= 0)
203
                 return Error("参数错误!");
218
                 return Error("参数错误!");
206
             if (input.F_Type <= 0)
221
             if (input.F_Type <= 0)
207
                 return Error("请选择电话类别");
222
                 return Error("请选择电话类别");
208
             #endregion
223
             #endregion
209
-            var model = bll.GetModel(input.ID );
224
+            var model = bll.GetModel(input.ID);
210
             model.F_Type = input.F_Type;    //1内线2外线
225
             model.F_Type = input.F_Type;    //1内线2外线
211
-            model.F_Department = input.F_Department;    //部门
212
-            model.F_Section = input.F_Section;    // 科室
226
+            model.F_Department = model_Dep != null ? model_Dep.F_ParentId : input.F_Department;    //部门id
227
+            model.F_Section = input.F_Section;    // 科室id
213
             model.F_Telephone = input.F_Telephone;  // 电话
228
             model.F_Telephone = input.F_Telephone;  // 电话
214
             model.F_Physician = input.F_Physician;      //医师
229
             model.F_Physician = input.F_Physician;      //医师
215
             model.F_Title = input.F_Title;//职称
230
             model.F_Title = input.F_Title;//职称
320
                         dModel.F_IsDelete  = 0;
335
                         dModel.F_IsDelete  = 0;
321
                         dModel.F_FileId = fid;
336
                         dModel.F_FileId = fid;
322
                         dModel.F_Type  = type ;
337
                         dModel.F_Type  = type ;
338
+
339
+                        //获取之前所有客户档案信息
340
+                        var list_Dep = bll_Dep.DataTableToList(bll_Dep.GetList(" 1=1 and F_DeleteFlag = 0 ").Tables[0]).ToList();
323
                         foreach (DataRow dr in dt.Rows)
341
                         foreach (DataRow dr in dt.Rows)
324
                         {
342
                         {
325
                           
343
                           
329
                             {
347
                             {
330
                                 if (!getunphone(0, dr["电话"].ToString()))
348
                                 if (!getunphone(0, dr["电话"].ToString()))
331
                                 {
349
                                 {
332
-                                    dModel.F_Department = dr["部门"].ToString();
333
-                                    dModel.F_Section = dr["科室"].ToString();
350
+                                    var model_Dept = list_Dep.SingleOrDefault(x => x.F_DeptName.Equals(dr["部门"].ToString()));
351
+                                    var model_Sec = list_Dep.SingleOrDefault(x => x.F_DeptName.Equals(dr["科室"].ToString()));
352
+                                    dModel.F_Department = model_Dept != null ? model_Dept.F_DeptId : 0;     //dr["部门"].ToString();
353
+                                    dModel.F_Section = model_Sec != null ? model_Sec.F_DeptId : 0;    //dr["科室"].ToString();
334
                                     dModel.F_Telephone = dr["电话"].ToString();
354
                                     dModel.F_Telephone = dr["电话"].ToString();
335
 
355
 
336
                                     if (type == 2)
356
                                     if (type == 2)

+ 6 - 6
codegit/CallCenterApi/CallCenterApi.Model/T_Con_Conversation.cs

13
         #region Model
13
         #region Model
14
         private long? _id;
14
         private long? _id;
15
         private int? _f_type;
15
         private int? _f_type;
16
-        private string _f_department;
17
-        private string _f_section;
16
+        private int _f_department = 0;
17
+        private int _f_section = 0;
18
         private string _f_telephone;
18
         private string _f_telephone;
19
         private string _f_physician;
19
         private string _f_physician;
20
         private string _f_title;
20
         private string _f_title;
37
             get { return _f_type; }
37
             get { return _f_type; }
38
         }
38
         }
39
         /// <summary>
39
         /// <summary>
40
-        /// 部门
40
+        /// 部门id
41
         /// </summary>
41
         /// </summary>
42
-        public string F_Department
42
+        public int F_Department
43
         {
43
         {
44
             set { _f_department = value; }
44
             set { _f_department = value; }
45
             get { return _f_department; }
45
             get { return _f_department; }
46
         }
46
         }
47
         /// <summary>
47
         /// <summary>
48
-        /// 科室
48
+        /// 科室id
49
         /// </summary>
49
         /// </summary>
50
-        public string F_Section
50
+        public int F_Section
51
         {
51
         {
52
             set { _f_section = value; }
52
             set { _f_section = value; }
53
             get { return _f_section; }
53
             get { return _f_section; }