Browse Source

心连心短信列表知识库修改,坐席满意度,通话记录导出,物料修改

duhongyu 6 years ago
parent
commit
bea490fba5

+ 1 - 4
codegit/CallCenterApi/CallCenterApi.BLL/T_SMS_RecvSMS.cs

@@ -106,10 +106,7 @@ namespace CallCenterApi.BLL
106 106
                     {
107 107
                         model.SMSID = int.Parse(dt.Rows[n]["SMSID"].ToString());
108 108
                     }
109
-                    if (dt.Rows[n]["F_CreateDate"].ToString() != "")
110
-                    {
111
-                        model.F_CreateDate = DateTime.Parse(dt.Rows[n]["F_CreateDate"].ToString());
112
-                    }
109
+                 
113 110
                     model.CallerNum = dt.Rows[n]["CallerNum"].ToString();
114 111
                     model.Content = dt.Rows[n]["Content"].ToString();
115 112
                     if (dt.Rows[n]["RecvTime"].ToString() != "")

+ 2 - 2
codegit/CallCenterApi/CallCenterApi.DAL/T_Call_CallRecords.cs

@@ -994,8 +994,8 @@ namespace CallCenterApi.DAL
994 994
             StringBuilder strSql = new StringBuilder();
995 995
             strSql.Append(" select ");
996 996
             //20180523 通话记录导出增加客户姓名
997
-            strSql.Append(" (select TOP 1 d.F_CustomerName from T_Cus_CustomerBase d ");
998
-            strSql.Append(" where d.F_Telephone=c.CallNumber and d.F_DeleteFlag=0) cusname, ");
997
+            strSql.Append(" (select TOP 1 d.F_Legal from T_Cus_CustomerBaseNew d ");
998
+            strSql.Append(" where d.F_LegalPhone=c.CallNumber and d.F_IsDelete=0) cusname, ");
999 999
             strSql.Append(" callnumber, ");
1000 1000
             strSql.Append("filepath,");
1001 1001
             strSql.Append(" case calltype when 1 then '呼出' else '呼入' end calltypes, ");

+ 10 - 14
codegit/CallCenterApi/CallCenterApi.DAL/T_SMS_RecvSMS.cs

@@ -44,13 +44,13 @@ namespace CallCenterApi.DAL
44 44
         {
45 45
             StringBuilder strSql = new StringBuilder();
46 46
             strSql.Append("insert into T_SMS_RecvSMS(");
47
-            strSql.Append("F_CreateDate,CallerNum,Content,RecvTime,F_UserID,F_CustomerID,F_Name,State");
47
+            strSql.Append("RecvModemIMEI,CallerNum,Content,RecvTime,F_UserID,F_CustomerID,F_Name,State");
48 48
             strSql.Append(") values (");
49
-            strSql.Append("@F_CreateDate,@CallerNum,@Content,@RecvTime,@F_UserID,@F_CustomerID,@F_Name,@State");
49
+            strSql.Append("@RecvModemIMEI,@CallerNum,@Content,@RecvTime,@F_UserID,@F_CustomerID,@F_Name,@State");
50 50
             strSql.Append(") ");
51 51
             strSql.Append(";select @@IDENTITY");
52 52
             SqlParameter[] parameters = {
53
-                        new SqlParameter("@F_CreateDate", SqlDbType.DateTime) ,
53
+                     new SqlParameter("@RecvModemIMEI", SqlDbType.VarChar,20) ,
54 54
                         new SqlParameter("@CallerNum", SqlDbType.VarChar,20) ,
55 55
                         new SqlParameter("@Content", SqlDbType.NVarChar,100) ,
56 56
                         new SqlParameter("@RecvTime", SqlDbType.DateTime) ,
@@ -60,8 +60,7 @@ namespace CallCenterApi.DAL
60 60
                         new SqlParameter("@State", SqlDbType.Int,4)
61 61
 
62 62
             };
63
-
64
-            parameters[0].Value = model.F_CreateDate;
63
+            parameters[0].Value = model.RecvModemIMEI;
65 64
             parameters[1].Value = model.CallerNum;
66 65
             parameters[2].Value = model.Content;
67 66
             parameters[3].Value = model.RecvTime;
@@ -92,8 +91,8 @@ namespace CallCenterApi.DAL
92 91
         {
93 92
             StringBuilder strSql = new StringBuilder();
94 93
             strSql.Append("update T_SMS_RecvSMS set ");
95
-
96
-            strSql.Append(" F_CreateDate = @F_CreateDate , ");
94
+            
95
+             strSql.Append(" RecvModemIMEI = @RecvModemIMEI , ");
97 96
             strSql.Append(" CallerNum = @CallerNum , ");
98 97
             strSql.Append(" Content = @Content , ");
99 98
             strSql.Append(" RecvTime = @RecvTime , ");
@@ -105,7 +104,7 @@ namespace CallCenterApi.DAL
105 104
 
106 105
             SqlParameter[] parameters = {
107 106
                         new SqlParameter("@SMSID", SqlDbType.Int,4) ,
108
-                        new SqlParameter("@F_CreateDate", SqlDbType.DateTime) ,
107
+                         new SqlParameter("@RecvModemIMEI", SqlDbType.VarChar,20) ,
109 108
                         new SqlParameter("@CallerNum", SqlDbType.VarChar,20) ,
110 109
                         new SqlParameter("@Content", SqlDbType.NVarChar,100) ,
111 110
                         new SqlParameter("@RecvTime", SqlDbType.DateTime) ,
@@ -117,7 +116,7 @@ namespace CallCenterApi.DAL
117 116
             };
118 117
 
119 118
             parameters[0].Value = model.SMSID;
120
-            parameters[1].Value = model.F_CreateDate;
119
+            parameters[1].Value = model.RecvModemIMEI;
121 120
             parameters[2].Value = model.CallerNum;
122 121
             parameters[3].Value = model.Content;
123 122
             parameters[4].Value = model.RecvTime;
@@ -208,10 +207,6 @@ namespace CallCenterApi.DAL
208 207
                 {
209 208
                     model.SMSID = int.Parse(ds.Tables[0].Rows[0]["SMSID"].ToString());
210 209
                 }
211
-                if (ds.Tables[0].Rows[0]["F_CreateDate"].ToString() != "")
212
-                {
213
-                    model.F_CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["F_CreateDate"].ToString());
214
-                }
215 210
                 model.CallerNum = ds.Tables[0].Rows[0]["CallerNum"].ToString();
216 211
                 model.Content = ds.Tables[0].Rows[0]["Content"].ToString();
217 212
                 if (ds.Tables[0].Rows[0]["RecvTime"].ToString() != "")
@@ -231,7 +226,8 @@ namespace CallCenterApi.DAL
231 226
                 {
232 227
                     model.State = int.Parse(ds.Tables[0].Rows[0]["State"].ToString());
233 228
                 }
234
-
229
+                model.RecvModemIMEI = ds.Tables[0].Rows[0]["RecvModemIMEI"].ToString();
230
+                
235 231
                 return model;
236 232
             }
237 233
             else

+ 232 - 34
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/SMSController.cs

@@ -6,6 +6,9 @@ using System.Web.Mvc;
6 6
 using qcloudsms_csharp;
7 7
 using qcloudsms_csharp.json;
8 8
 using qcloudsms_csharp.httpclient;
9
+using System.Data;
10
+using System.Collections.Generic;
11
+using CallCenter.Utility;
9 12
 
10 13
 namespace CallCenterApi.Interface.Controllers
11 14
 {
@@ -17,65 +20,196 @@ namespace CallCenterApi.Interface.Controllers
17 20
         // 短信应用SDK AppKey
18 21
         string appkey = "2b2094bcaf2c841fdb50bcaebabf6f54";
19 22
         // 需要发送短信的手机号码
20
-        int templateId = 392016; // NOTE: 这里的模板ID`7839`只是一个示例,真实的模板ID需要在短信控制台中申请
23
+        // int templateId = 392016; // NOTE: 这里的模板ID`7839`只是一个示例,真实的模板ID需要在短信控制台中申请
21 24
         // 签名
22
-        string smsSign = "河南心连心客服"; // NOTE: 这里的签名只是示例,请使用真实的已申请的签名, 签名参数使用的是`签名内容`,而不是`签名ID`
25
+        string smsSign = "心连心客服中心"; // NOTE: 这里的签名只是示例,请使用真实的已申请的签名, 签名参数使用的是`签名内容`,而不是`签名ID`
26
+        BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
23 27
         #endregion
24
-        public ActionResult SMSSend(string name,string phone,string cusphone)
28
+        public ActionResult SMSSend(string name, string phone, string cusphone)
25 29
         {
26
-            if (string .IsNullOrEmpty (name))
27
-                return Error("请输入联系人姓名");
28
-            if (string.IsNullOrEmpty(phone))
29
-                return Error("请输入联系人电话");
30
-            if (string.IsNullOrEmpty(cusphone))
31
-                return Error("请输入发送号码");
32
-            SmsSingleSenderResult result = SMSSingleshot(cusphone, "您好,感谢你的致电反馈,稍后会安排业务经理和你联系,请你保持电话畅通。业务经理姓名:"+ name+",电话:"+ phone+"。");
33
-            
34
-            if (result != null)
30
+            int userId = CurrentUser.UserData.F_UserId;
31
+            if (userId > 0)
35 32
             {
36
-               
33
+                Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
34
+                if (string.IsNullOrEmpty(name))
35
+                    return Error("请输入联系人姓名");
36
+                if (string.IsNullOrEmpty(phone))
37
+                    return Error("请输入联系人电话");
38
+                if (string.IsNullOrEmpty(cusphone))
39
+                    return Error("请输入发送号码");
40
+                string msg = "您好,感谢您来电反馈,后续详细咨询也可直接拨打市场经理电话:" + phone + ",姓名:" + name + ",祝您生活愉快!";
41
+                string[] mag = { name, phone };
42
+                SmsSingleSenderResult result = SMSSingleshot(429907, mag, cusphone);
43
+
44
+                if (result != null)
45
+                {
46
+                    AddSmS(cusphone, msg, userId);
47
+                    return Success("发送短信", result);
48
+                }
49
+                else
50
+                {
51
+                    return Error("发送失败,请检查客户电话");
52
+                }
53
+            }
54
+            else
55
+            {
56
+                return Error("无操作权限");
57
+            }
58
+
59
+        }
60
+        public ActionResult GetSmSList(string starttime, string endtime, int pageindex = 1, int pagesize = 10)
61
+        {
62
+            int userId = CurrentUser.UserData.F_UserId;
63
+            if (userId > 0)
64
+            {
65
+                string sql = "";
66
+                DataTable dt = new DataTable();
67
+                if (!string.IsNullOrEmpty(starttime))
68
+                    sql += " and datediff(day,RecvTime,'" + starttime + "')<=0 ";
69
+                if (!string.IsNullOrEmpty(endtime))
70
+                    sql += " and datediff(day,RecvTime,'" + endtime + "')>=0   ";
71
+
72
+                int recordCount = 0;
73
+                dt = BLL.PagerBLL.GetListPager(
74
+                        "T_SMS_RecvSMS",
75
+                        "SMSID",
76
+                        "*",
77
+                        sql,
78
+                        "ORDER BY T_SMS_RecvSMS.SMSID desc",
79
+                        pagesize,
80
+                        pageindex,
81
+                        true,
82
+                        out recordCount);
83
+
84
+                List<Model.T_SMS_RecvSMS> modlelist = new BLL.T_SMS_RecvSMS().DataTableToList(dt);
85
+                if (modlelist.Count > 0)
86
+                {
87
+                    List<RecvSMS> Input = modeltooip(modlelist);
88
+                    var obj = new
89
+                    {
90
+                        state = "success",
91
+                        message = "成功",
92
+                        rows = Input,
93
+                        total = recordCount
94
+                    };
95
+
96
+                    return Content(obj.ToJson()); ;
97
+                }
98
+                else
99
+                {
100
+
101
+                    return Success("暂无短信"); ;
102
+                }
37 103
 
38
-                return Success("发送短信", result);
39 104
             }
40 105
             else
41 106
             {
42
-                return Error ("发送失败,请检查客户电话");
107
+                return Error("无操作权限");
43 108
             }
44 109
         }
45
-        public ActionResult SMSSendSalesman(string name, string phone, string cusphone)
110
+        public List<RecvSMS> modeltooip(List<Model.T_SMS_RecvSMS> model)
46 111
         {
47
-            if (string.IsNullOrEmpty(name))
48
-                return Error("请输入联系人姓名");
49
-            if (string.IsNullOrEmpty(phone))
50
-                return Error("请输入联系人电话");
51
-            if (string.IsNullOrEmpty(cusphone))
52
-                return Error("请输入发送号码");
53
-            SmsSingleSenderResult result = SMSSingleshot(cusphone, "您好,刚有客户反馈有关市场业务/产品/农化问题,请你及时联系提供服务。姓名:"+ name + ",电话:"+ phone + "。");
112
+            List<RecvSMS> SMS = new List<RecvSMS>();
54 113
 
55
-            if (result != null)
114
+            foreach (var it in model)
115
+            {
116
+                RecvSMS Recv = new RecvSMS();
117
+                Recv.SMSID = it.SMSID;
118
+                Recv.CallerNum = it.CallerNum;
119
+                Recv.Content = it.Content;
120
+                if (it.F_UserID > 0)
121
+                {
122
+                    Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(int.Parse(it.F_UserID.ToString()));
123
+                    if (ua != null)
124
+                    {
125
+                        Recv.F_UserID = ua.F_UserCode + "(" + ua.F_UserName + ")";
126
+                    }
127
+                }
128
+                else
129
+                {
130
+                    Recv.F_UserID = "";
131
+                }
132
+                Recv.RecvTime = it.RecvTime.ToString();
133
+                SMS.Add(Recv);
134
+            }
135
+            return SMS;
136
+        }
137
+        public class RecvSMS
138
+        {
139
+            public int SMSID;
140
+            public string CallerNum;
141
+            public string Content;
142
+            public string F_UserID;
143
+            public string RecvTime;
144
+
145
+        }
146
+        public bool AddSmS(string tel, string cont, int F_UserID)
147
+        {
148
+            Model.T_SMS_RecvSMS dModel = new Model.T_SMS_RecvSMS();
149
+            dModel.CallerNum = tel.Trim();
150
+            dModel.Content = cont.Trim();
151
+            dModel.F_UserID = F_UserID;
152
+            dModel.RecvTime = DateTime.Now;
153
+            dModel.RecvModemIMEI = "";
154
+            int b = new BLL.T_SMS_RecvSMS().Add(dModel);
155
+            if (b > 0)
56 156
             {
57
-                return Success("发送短信", result);
157
+                return true;
58 158
             }
59 159
             else
60 160
             {
61
-                return Error("发送失败,请检查电话");
161
+                return false;
62 162
             }
63 163
         }
164
+        public ActionResult SMSSendSalesman(string name, string phone, string cusphone)
165
+        {
166
+            int userId = CurrentUser.UserData.F_UserId;
167
+            if (userId > 0)
168
+            {
169
+                if (string.IsNullOrEmpty(name))
170
+                    return Error("请输入联系人姓名");
171
+                if (string.IsNullOrEmpty(phone))
172
+                    return Error("请输入联系人电话");
173
+                if (string.IsNullOrEmpty(cusphone))
174
+                    return Error("请输入发送号码");
175
+                string msg = "您好,刚有客户意向购买、咨询产品政策问题,客服已做简单解答,但该区域市场详细的产品价格政策及业务情况,还请您及时与客户联系提供具体服务。客户姓名:" + name + ",电话:" + phone + "。祝您工作顺利!";
176
+                string[] mag = { name, phone };
177
+                SmsSingleSenderResult result = SMSSingleshot(433866, mag, cusphone);
178
+
179
+                if (result != null)
180
+                {
181
+
182
+                    AddSmS(cusphone, msg, userId);
183
+                    return Success("发送短信", result);
64 184
 
185
+                }
186
+                else
187
+                {
188
+                    return Error("发送失败,请检查电话");
189
+                }
190
+            }
191
+            else
192
+            {
193
+                return Error("无操作权限");
194
+            }
195
+        }
65 196
         /// <summary>
66 197
         /// 单发短信
67 198
         /// </summary>
68 199
         /// <param name="phone"></param>
69 200
         /// <param name="cont"></param>
70
-        public SmsSingleSenderResult SMSSingleshot(string phone, string cont)
201
+        public SmsSingleSenderResult SMSSingleshot(string  phone,string  cont)
71 202
         {
72 203
             try
73 204
             {
74
-                SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
75
-                var result = ssender.send(0, "86", phone,
76
-                 cont, "", "");
77
-                Console.WriteLine(result);
205
+             
206
+
207
+               SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
208
+                  var result = ssender.send(0, "86", phone,
209
+                cont, "", "");
210
+                   Console.WriteLine(result);
78 211
                 return result;
212
+
79 213
             }
80 214
             catch (JSONException e)
81 215
             {
@@ -94,6 +228,42 @@ namespace CallCenterApi.Interface.Controllers
94 228
             }
95 229
         }
96 230
         /// <summary>
231
+        /// 单发短信
232
+        /// </summary>
233
+        /// <param name="phone"></param>
234
+        /// <param name="cont"></param>
235
+        public SmsSingleSenderResult SMSSingleshot(int templateId, string [] msg,string cusphone)
236
+        {
237
+                try
238
+                {
239
+                SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
240
+                var result = ssender.sendWithParam("86", cusphone,
241
+                    templateId, msg, smsSign, "", "");
242
+              
243
+             //   SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
244
+               //     var result = ssender.send(0, "86", phone,
245
+                 //    cont, "", "");
246
+              //      Console.WriteLine(result);
247
+                    return result;
248
+               
249
+            }
250
+                catch (JSONException e)
251
+                {
252
+                    Console.WriteLine(e);
253
+                    return null;
254
+                }
255
+                catch (HTTPException e)
256
+                {
257
+                    Console.WriteLine(e);
258
+                    return null;
259
+                }
260
+                catch (Exception e)
261
+                {
262
+                    Console.WriteLine(e);
263
+                    return null;
264
+                }
265
+        }
266
+        /// <summary>
97 267
         /// 群发短信
98 268
         /// </summary>
99 269
         /// <param name="phone"></param>
@@ -211,8 +381,10 @@ namespace CallCenterApi.Interface.Controllers
211 381
                                     {
212 382
                                         model.F_SMSReply = int.Parse(replyResult.replys[i].text);
213 383
                                         workOrder.Update(model);
214
-                                        SMSSingleshot(replyResult.replys[i].mobile , "心连心感谢您的评价,祝你生活愉快!");
215
-
384
+                                        string msg = "【心连心客服中心】心连心感谢您的评价,祝你生活愉快!";
385
+                                        SMSSingleshot(replyResult.replys[i].mobile, msg);
386
+                                        string mag = "心连心感谢您的评价,祝你生活愉快!";
387
+                                        AddSmS(replyResult.replys[i].mobile, mag, 0);
216 388
                                     }
217 389
                                     catch
218 390
                                     {
@@ -247,8 +419,34 @@ namespace CallCenterApi.Interface.Controllers
247 419
                 return null;
248 420
             }
249 421
         }
250
-       
251 422
 
423
+        //    /// <summary>
424
+        //    /// 新增接收短信
425
+        //    /// </summary>
426
+        //    /// <returns></returns>
427
+        //    public ActionResult AddRecv(string tel,string cont)
428
+        //    {
429
+        //        ActionResult res = NoToken("未知错误,请重新登录");
430
+
431
+        //            Model.T_SMS_RecvSMS dModel = new Model.T_SMS_RecvSMS();
432
+
433
+        //            dModel.CallerNum = tel.Trim();
434
+        //            dModel.Content = cont.Trim();
435
+        //            dModel.State = 0;
436
+        //            dModel.RecvTime = DateTime.Now;
437
+        //            dModel.F_CreateDate = DateTime.Now;
438
+        //            int b = new BLL.T_SMS_RecvSMS().Add(dModel);
439
+        //            if (b > 0)
440
+        //            {
441
+        //                res = Success("添加成功");
442
+        //            }
443
+        //            else
444
+        //            {
445
+        //                res = Success("添加失败");
446
+        //            }
447
+
448
+        //        return res;
449
+        //    }
252 450
         #region 
253 451
 
254 452
         ////    /// <summary>

+ 19 - 3
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerNewController.cs

@@ -481,7 +481,16 @@ namespace CallCenterApi.Interface.Controllers.customer
481 481
 
482 482
                     if (!string.IsNullOrEmpty(model[i].F_AreaID))
483 483
                     {
484
-                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(model[i].F_AreaID));
484
+                        Model.T_Sys_Department pdModel = new T_Sys_Department();
485
+                        try
486
+                        {
487
+                            pdModel = departmentBLL.GetModel(int.Parse(model[i].F_AreaID));
488
+                        }
489
+                        catch
490
+                        {
491
+                             pdModel = departmentBLL.GetModel(model[i].F_AreaID);
492
+                        }
493
+                           
485 494
                             if (pdModel != null)
486 495
                             {
487 496
                                 Input1.F_AreaName = pdModel.F_DeptName.ToString();
@@ -489,7 +498,15 @@ namespace CallCenterApi.Interface.Controllers.customer
489 498
                     }
490 499
                     if (!string.IsNullOrEmpty(model[i].F_BranchID))
491 500
                     {
492
-                           Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(model[i].F_BranchID));
501
+                        Model.T_Sys_Department pdModel1 = new T_Sys_Department();
502
+                        try
503
+                        {
504
+                            pdModel1 = departmentBLL.GetModel(int.Parse(model[i].F_BranchID));
505
+                        }
506
+                        catch
507
+                        {
508
+                            pdModel1 = departmentBLL.GetModel(model[i].F_BranchID);
509
+                        }
493 510
                             if (pdModel1 != null)
494 511
                             {
495 512
                                 Input1.F_BranchName = pdModel1.F_DeptName.ToString();
@@ -577,7 +594,6 @@ namespace CallCenterApi.Interface.Controllers.customer
577 594
                     }
578 595
                 }
579 596
             }
580
-           
581 597
             model.F_Gender = input.F_Gender;//分公司ID
582 598
             model.F_Salesman = input.F_Salesman;//业务员
583 599
             model.F_SalesPhone = input.F_SalesPhone;//业务员电话

+ 59 - 10
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/knowledge/KnowledgeController.cs

@@ -35,7 +35,10 @@ namespace CallCenterApi.Interface.Controllers.knowledge
35 35
                 string sql = " and F_DeleteFlag=0";
36 36
                 if (pid.Trim() != "")
37 37
                 {
38
-                    sql += " and F_CategoryId=" + pid.Trim();
38
+                DataTable dr = new DataTable();
39
+                dr = new BLL.T_RepositoryCategory().GetList(" 1=1 " + "and F_CategoryId="+ pid).Tables[0];
40
+                string modelList = BindTree(dr, pid);
41
+                sql += " and F_CategoryId in(" + modelList.Trim()+")";
39 42
                 }
40 43
                 if (keywords.Trim() != "")
41 44
                 {
@@ -62,17 +65,17 @@ namespace CallCenterApi.Interface.Controllers.knowledge
62 65
                     pageindex,
63 66
                     true,
64 67
                     out recordCount);
68
+          //  List<Model.TreeModel> modelList = BindTree(dt, "0");
69
+            //System.Collections.Generic.List<Model.T_RepositoryInformation> modelList = new BLL.T_RepositoryInformation().DataTableToList(dt);
65 70
 
66
-                //System.Collections.Generic.List<Model.T_RepositoryInformation> modelList = new BLL.T_RepositoryInformation().DataTableToList(dt);
67
-
68
-                //if (modelList.Count > 0)
69
-                //{
70
-                //    res = Success("加载成功", modelList);
71
-                //}
72
-                //else
73
-                //    res = Error("加载失败");
71
+            //if (modelList.Count > 0)
72
+            //{
73
+            //    res = Success("加载成功", modelList);
74
+            //}
75
+            //else
76
+            //    res = Error("加载失败");
74 77
 
75
-                var obj = new
78
+            var obj = new
76 79
                 {
77 80
                     rows = dt,
78 81
                     total = recordCount
@@ -82,7 +85,53 @@ namespace CallCenterApi.Interface.Controllers.knowledge
82 85
 
83 86
             return res;
84 87
         }
88
+       
89
+        private string  BindTree(DataTable tab, string parentid)
90
+        {
85 91
 
92
+            DataTable tab2 = new DataTable();
93
+            string modelList = parentid;
94
+            var iv = new BLL.T_RepositoryCategory().GetModelList("F_ParentId=" + parentid + " and F_DeleteFlag=0 and F_CategoryType is null order by F_Sort");
95
+           if (iv != null )
96
+            {
97
+                foreach (var it in  iv)
98
+                {
99
+                    modelList += "," + it.F_CategoryId;
100
+                }
101
+            }
102
+            return modelList;
103
+        }
104
+        //private List<Model.TreeModel> BindTree(DataTable tab, string parentid)
105
+        //{
106
+        //    DataTable tab2 = new DataTable();
107
+
108
+        //    if (tab != null && tab.Rows.Count > 0)
109
+        //    {
110
+        //        List<Model.T_RepositoryInformation> categorylist = new BLL.T_RepositoryInformation().DataTableToList(tab);
111
+        //        List<Model.TreeModel> modelList = new List<Model.TreeModel>(categorylist.Count);
112
+        //        for (int i = 0; i < categorylist.Count; i++)
113
+        //        {
114
+        //            Model.TreeModel model = new Model.TreeModel();
115
+        //            string currentID = categorylist[i].F_CategoryId.ToString();//当前功能ID
116
+        //            model.id = currentID;
117
+        //            model.IconCls = "";//图标
118
+        //            model.text = categorylist[i].F_CategoryName;
119
+        //            tab2 = new BLL.T_RepositoryInformation().GetList("F_ParentId=" + currentID + " and F_DeleteFlag=0 and F_CategoryType is null order by F_Sort").Tables[0];
120
+        //            if (tab2 != null && tab2.Rows.Count > 0)
121
+        //            {
122
+        //                model.children = BindTree(tab2, currentID);
123
+        //            }
124
+        //            modelList.Add(model);
125
+        //        }
126
+        //        return modelList;
127
+
128
+        //    }
129
+        //    else
130
+        //    {
131
+        //        return null;
132
+        //    }
133
+
134
+        //}
86 135
         //获取知识库
87 136
         public ActionResult GetInfo(string infoid)
88 137
         {

+ 74 - 50
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WOReportController.cs

@@ -2262,23 +2262,18 @@ namespace CallCenterApi.Interface.Controllers.report
2262 2262
                         break;
2263 2263
                    
2264 2264
                 }
2265
-                if (i>0 )
2265
+                if (i > 0)
2266 2266
                 {
2267
-                    sqltype = $"and F_SalesBase = '"+ template.name + "'" ;
2267
+                    sqltype = $"and F_SalesBase = '" + template.name + "'";
2268 2268
                 }
2269 2269
                 else
2270 2270
                 {
2271
-                    sqltype = $"and F_SalesBase in ('新乡','新疆','九江','东北')";
2272
-                }
2273
-                if (!string.IsNullOrEmpty(salesBase))
2274
-                {
2275
-                    model.salesBase.Add(ReturenTemplate(template, sql, time, lastmouth, lastyear));
2276
-                }
2277
-                else
2278
-                {
2279
-                    model.salesBase.Add(ReturenTemplate(template, sql + sqltype, time, lastmouth, lastyear));
2271
+                    if (string.IsNullOrEmpty(salesBase))
2272
+                    {
2273
+                        sqltype = $"and F_SalesBase in('新乡','新疆', '九江','东北')";
2274
+                    }
2280 2275
                 }
2281
-              
2276
+                model.salesBase.Add(ReturenTemplate(template, sql+ sqltype, time, lastmouth, lastyear));
2282 2277
             }
2283 2278
             #endregion
2284 2279
             #region 产品
@@ -2301,7 +2296,15 @@ namespace CallCenterApi.Interface.Controllers.report
2301 2296
                 }
2302 2297
                 Template template = new Template();
2303 2298
                 template.name = "合计";
2304
-                model.product.Add(ReturenTemplate(template, sql  + $"and F_TS_Category in (" + msf + ")" , time, lastmouth, lastyear));
2299
+                if (string.IsNullOrEmpty(product))
2300
+                {
2301
+                    model.product.Add(ReturenTemplate(template, sql + $"and F_TS_Category in (" + msf + ")", time, lastmouth, lastyear));
2302
+                }
2303
+                else
2304
+                {
2305
+                    model.product.Add(ReturenTemplate(template, sql , time, lastmouth, lastyear));
2306
+                }
2307
+             
2305 2308
                 foreach (var it in dicval)
2306 2309
                 {
2307 2310
                     Template templates = new Template();
@@ -2357,11 +2360,11 @@ namespace CallCenterApi.Interface.Controllers.report
2357 2360
                         break;
2358 2361
                     case 3:
2359 2362
                         template.name = "待回访";
2360
-                        sqlchannel = " and F_State in (10)";
2363
+                        sqlchannel = " and F_State in (10) and F_IsVisit=1";
2361 2364
                         break;
2362 2365
                     case 4:
2363 2366
                         template.name = "已回访";
2364
-                        sqlchannel = " and F_State in (11)";
2367
+                        sqlchannel = " and F_State in (11) and F_IsVisit=1 and F_DealType!='当即办理'  and F_VisitBy !=''";
2365 2368
                         break;
2366 2369
                    
2367 2370
                 }
@@ -2380,6 +2383,7 @@ namespace CallCenterApi.Interface.Controllers.report
2380 2383
                 {
2381 2384
                     case 0:
2382 2385
                         template.name += "合计";
2386
+                        sqlsatisfaction += " and F_VisitResult in ('非常满意','满意','一般','不满意')";
2383 2387
                         break;
2384 2388
                     case 1:
2385 2389
                         template.name = "非常满意";
@@ -2897,12 +2901,14 @@ namespace CallCenterApi.Interface.Controllers.report
2897 2901
         {
2898 2902
             public string F_WorkOrderCode;//工单编号
2899 2903
             public string F_State;//工单状态
2900
-            public string overtime;//超期时间
2904
+            public string   overtime;//超期时间
2905
+            public double  time;
2901 2906
             public string F_Description;//问题描述
2902 2907
             public string F_Responsibility;//责任科室
2903 2908
             public string F_SalesBase;//销售基地
2909
+            public string F_Type;//反馈类型
2904 2910
         }
2905
-       
2911
+    
2906 2912
         /// <summary>
2907 2913
         ///月份投诉处理周期表
2908 2914
         /// </summary>
@@ -2977,15 +2983,18 @@ namespace CallCenterApi.Interface.Controllers.report
2977 2983
             {
2978 2984
                 for (int i=0;i < categorylist.Count; i++)
2979 2985
               {
2980
-                 Complainthandling model = new Complainthandling();
2986
+                    List<float> timehource = new List<float>();
2987
+                    Complainthandling model = new Complainthandling();
2981 2988
                     model.name = categorylist[i].F_QuestionName;
2982 2989
                     model.number = 0;
2983
-                  int efficiency = 0;
2990
+                    int Overdue = 0;
2991
+                    int efficiency = 0;
2984 2992
                     model.worker = new List<worker>();
2985 2993
                     foreach (var it in modellist)
2986 2994
                     {
2987 2995
                         try
2988 2996
                         {
2997
+                            
2989 2998
                             if (int .Parse (it.F_QuestionType) == categorylist[i].F_Id )
2990 2999
                             {
2991 3000
                                 model.number ++;
@@ -2994,39 +3003,8 @@ namespace CallCenterApi.Interface.Controllers.report
2994 3003
                                     efficiency++;
2995 3004
                                     System.TimeSpan id = DateTime.Parse(it.F_DealTime.ToString()) - DateTime.Parse(it.F_CreateOn.ToString());
2996 3005
                                     double t = id.TotalHours;
2997
-                                    List<float> timehource = new List<float>();
2998 3006
                                     timehource.Add((float)t);
2999
-
3000
-                                    if (timehource.Count > 0)
3001
-                                    {
3002
-                                        timehource.Sort((a, b) => b.CompareTo(a));
3003
-                                        model.ongesttime = string.Format("{0:f2}h", timehource[0]);
3004
-                                        model.minimumtime = string.Format("{0:f2}h", timehource[timehource.Count - 1]);
3005
-                                        int n = timehource.Count / 2;
3006
-                                        model.median = string.Format("{0:f2}h", timehource[n]);
3007
-                                        float y = 0;
3008
-                                        foreach (var iu in timehource)
3009
-                                        {
3010
-                                            y += iu;
3011
-                                        }
3012
-                                        model.averageTime = string.Format("{0:f2}h", y / timehource.Count);
3013
-                                    }
3014
-                                    else
3015
-                                    {
3016
-                                        model.ongesttime = "0h";
3017
-                                        model.minimumtime = "0h";
3018
-                                        model.median = "0h";
3019
-                                        model.averageTime = "0h";
3020
-                                    }
3021 3007
                                 }
3022
-                                else
3023
-                                {
3024
-                                    model.ongesttime = "0h";
3025
-                                    model.minimumtime = "0h";
3026
-                                    model.median = "0h";
3027
-                                    model.averageTime = "0h";
3028
-                                }
3029
-                                int Overdue = 0;
3030 3008
                               
3031 3009
                                 if (it .F_IsOver ==1&& it.F_State !=11)
3032 3010
                                 {
@@ -3044,6 +3022,22 @@ namespace CallCenterApi.Interface.Controllers.report
3044 3022
                                         worker.F_State = "异常退回";
3045 3023
                                    else 
3046 3024
                                         worker.F_State = "已处理";
3025
+                                    if (it .F_Type == "1")
3026
+                                    {
3027
+                                        worker.F_Type = "咨询";
3028
+                                    }
3029
+                                    else if (it.F_Type == "2")
3030
+                                    {
3031
+                                        worker.F_Type = "投诉";
3032
+                                    }
3033
+                                    else if (it.F_Type == "3")
3034
+                                    {
3035
+                                        worker.F_Type = "抽检";
3036
+                                    }
3037
+                                    else
3038
+                                    {
3039
+                                        worker.F_Type = "建议及其他";
3040
+                                    }
3047 3041
                                     worker.F_SalesBase = it.F_SalesBase;
3048 3042
                                     worker.F_Description = it.F_Description;
3049 3043
                                     string timeover = "", timeover2 = ""; int x = 0, y = 0;
@@ -3078,6 +3072,7 @@ namespace CallCenterApi.Interface.Controllers.report
3078 3072
                                                             System.TimeSpan id = DateTime.Parse(timeover2) - DateTime.Parse(timeover);
3079 3073
                                                             double a = id.TotalHours;
3080 3074
                                                             worker.overtime = string .Format ("{0:f2}h", a - limit);
3075
+                                                            worker.time = a - limit;
3081 3076
                                                             if (itemlasts[x].F_NextDept > 0)
3082 3077
                                                             {
3083 3078
                                                                 var deptment = departmentBLL.GetModel(int.Parse(itemlasts[x].F_NextDept.ToString()));
@@ -3093,6 +3088,7 @@ namespace CallCenterApi.Interface.Controllers.report
3093 3088
                                                             System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3094 3089
                                                             double a = id.TotalHours;
3095 3090
                                                             worker.overtime = string.Format("{0:f2}h", a - limit);
3091
+                                                            worker.time = a - limit;
3096 3092
                                                             if (itemlasts[y].F_NextDept > 0)
3097 3093
                                                             {
3098 3094
                                                                 var deptment = departmentBLL.GetModel(int.Parse(itemlasts[y].F_NextDept.ToString()));
@@ -3112,6 +3108,7 @@ namespace CallCenterApi.Interface.Controllers.report
3112 3108
                                                     System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3113 3109
                                                     double a = id.TotalHours;
3114 3110
                                                     worker.overtime = string.Format("{0:f2}h", a - limit);
3111
+                                                    worker.time = a - limit;
3115 3112
                                                     if (itemlasts[x].F_NextDept > 0)
3116 3113
                                                     {
3117 3114
                                                         var deptment = departmentBLL.GetModel(int.Parse(itemlasts[x].F_NextDept.ToString()));
@@ -3124,6 +3121,7 @@ namespace CallCenterApi.Interface.Controllers.report
3124 3121
 
3125 3122
 
3126 3123
                                             }
3124
+                                           
3127 3125
                                         }
3128 3126
                                         }
3129 3127
                                     Overdue++;
@@ -3158,11 +3156,37 @@ namespace CallCenterApi.Interface.Controllers.report
3158 3156
                            
3159 3157
                         }
3160 3158
                     }
3159
+                    if (timehource.Count > 0)
3160
+                    {
3161
+                        timehource.Sort((a, b) => b.CompareTo(a));
3162
+                        model.ongesttime = string.Format("{0:f2}h", timehource[0]);
3163
+                        model.minimumtime = string.Format("{0:f2}h", timehource[timehource.Count - 1]);
3164
+                        int n = timehource.Count / 2;
3165
+                        model.median = string.Format("{0:f2}h", timehource[n]);
3166
+                        float y = 0;
3167
+                        foreach (var iu in timehource)
3168
+                        {
3169
+                            y += iu;
3170
+                        }
3171
+                        model.averageTime = string.Format("{0:f2}h", y / timehource.Count);
3172
+                    }
3173
+                    else
3174
+                    {
3175
+                        model.ongesttime = "0h";
3176
+                        model.minimumtime = "0h";
3177
+                        model.median = "0h";
3178
+                        model.averageTime = "0h";
3179
+                    }
3180
+                    model.worker .Sort((a, b) => b.time  .CompareTo(a.time));
3161 3181
                     if (questionName != "")
3162 3182
                         modeNamelList.Add(model);
3163 3183
                     else if (model.number > 0)
3184
+                    {
3185
+                        
3164 3186
                         modeNamelList.Add(model);
3187
+                    }
3165 3188
                 }
3189
+                       
3166 3190
             }
3167 3191
             modeNamelList.Sort((a, b) => b .number .CompareTo(a .number ));
3168 3192
             var obj = new

+ 4 - 4
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/ZuoXiManYiDuController.cs

@@ -96,16 +96,16 @@ namespace CallCenterApi.Interface.Controllers.report
96 96
             //存储数据
97 97
             Dictionary<string, List<List<string>>> body = new Dictionary<string, List<List<string>>>();
98 98
             //坐席
99
-            //DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_RoleId in (1,4,28,29) and F_DeleteFlag=0").Tables[0];//客服坐席、班长坐席、售前坐席、投诉坐席
100
-            DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_DeleteFlag=0").Tables[0];
99
+            //  DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_RoleId in (1,4,28,29) and F_DeleteFlag=0").Tables[0];//客服坐席、班长坐席、售前坐席、投诉坐席
100
+            DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_DeleteFlag=0 and F_SeatFlag=1  ").Tables[0];
101 101
             int allcount = dtable.Rows.Count;
102 102
             for (int i = 0; i < allcount; i++)
103 103
             {
104 104
                 int userid = Convert.ToInt32(dtable.Rows[i]["F_UserId"].ToString());
105 105
                 List<string> bodyitem = new List<string>();
106 106
                 string[] UNDN = getRoleNameAndUserName(userid);
107
-                bodyitem.Add(UNDN[2]);
108
-                DataTable dt = new BLL.T_Call_CallRecords().GetList("UserId='" + userid + "'" + time).Tables[0];
107
+                bodyitem.Add(UNDN[2]+"("+ UNDN[1]+")");
108
+                DataTable dt = new BLL.T_Call_CallRecords().GetList("UserId='" + userid + "'" + time + "and CallType=0 and CallState=1").Tables[0];
109 109
                 //1非常满意、2基本满意、3不满意、4未评价
110 110
                 for (int j = 1; j <= 4; j++)
111 111
                 {

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs

@@ -171,7 +171,7 @@ namespace CallCenterApi.Interface.Controllers.tel
171 171
                 out recordCount);
172 172
 
173 173
             dt.Columns.Add("CusName");
174
-
174
+           
175 175
             var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
176 176
             var users = new BLL.T_Sys_UserAccount().GetModelList("");
177 177
 

+ 10 - 7
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -2990,20 +2990,21 @@ namespace CallCenterApi.Interface.Controllers.weixin
2990 2990
             string smscont = "";
2991 2991
             if (model.F_Type == "1")
2992 2992
             {
2993
-                smscont = "您有一条新的咨询工单,请及时处理";
2993
+                smscont = "咨询";
2994 2994
             }
2995 2995
             else if (model.F_Type == "2")
2996 2996
             {
2997
-                smscont = "您有一条新的投诉工单,请及时处理";
2997
+                smscont = "投诉";
2998 2998
             }
2999 2999
             else if (model.F_Type == "3")
3000 3000
             {
3001
-                smscont = "您有一条新的抽检工单,请及时处理";
3001
+                smscont = "抽检";
3002 3002
             }
3003 3003
             else
3004 3004
             {
3005
-                smscont = "您有一条新的建议工单,请及时处理";
3005
+                smscont = "建议";
3006 3006
             }
3007
+            string[] msg = { smscont };
3007 3008
             string touser = ""; string tousername = "";
3008 3009
             #region 获取接收人
3009 3010
             int deptid = 0;
@@ -3021,7 +3022,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
3021 3022
                 {
3022 3023
                     if (!string.IsNullOrEmpty(clus.F_Mobile))
3023 3024
                     {
3024
-                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(clus.F_Mobile, smscont);
3025
+                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(395191,msg,clus.F_Mobile);
3026
+                      bool n  = new SMSController().AddSmS(clus.F_Mobile, smscont, nowUser.F_UserId );
3025 3027
                     }
3026 3028
 
3027 3029
                 }
@@ -3047,8 +3049,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
3047 3049
                   {
3048 3050
                     if (!string.IsNullOrEmpty(l.F_Mobile))
3049 3051
                     {
3050
-                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(l.F_Mobile, smscont);
3051
-                    }
3052
+                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(395191, msg,l.F_Mobile);
3053
+                            bool n = new SMSController().AddSmS(l.F_Mobile, smscont, nowUser.F_UserId);
3054
+                        }
3052 3055
 
3053 3056
                 }
3054 3057
                 }

+ 5 - 20
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/MaterialManageController.cs

@@ -113,37 +113,22 @@ namespace CallCenterApi.Interface.Controllers.workorder
113 113
                 return Error("获取参数失败");
114 114
             }
115 115
         }
116
-        private string GetIntCode()
117
-        {
118
-            string time = DateTime.Now.ToString("hhmmss");
119
-            Random ran = new Random();
120
-            int RandKey = ran.Next(1000, 9999);
121
-            string timecode = 3 + "" + RandKey + "" + time;
122
-            return timecode;
123
-        }
116
+  
124 117
         //[Authority]
125 118
         //添加物料
126 119
         public ActionResult AddModel(WoMaterialManageInput input)
127 120
         {
128 121
             Model.T_Wo_MaterialManage dModel = new Model.T_Wo_MaterialManage();
129 122
             #region 验证物料编码为11位纯数字
130
-           
123
+            if (string.IsNullOrEmpty(input.F_MaterialCode))
124
+            {
125
+                return Error("请输入物料编码");
126
+            }
131 127
             if (!string.IsNullOrWhiteSpace(input.F_MaterialCode))
132 128
             {
133 129
                 if (!valcode(input.F_MaterialCode))
134 130
                     return Error("物料编号必须是11位数字");
135 131
             }
136
-            if (string.IsNullOrEmpty(input.F_MaterialCode))
137
-            {
138
-                while (true)
139
-                {
140
-                    if (!getunique(0, GetIntCode()))
141
-                    {
142
-                        input.F_MaterialCode = GetIntCode();
143
-                        break;
144
-                    }
145
-                }
146
-            }
147 132
             #endregion
148 133
             #region
149 134
             dModel.F_MaterialCode = input.F_MaterialCode;//物料编号

+ 133 - 95
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

@@ -37,8 +37,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
37 37
         /// 获取工单列表
38 38
         /// </summary>
39 39
         /// <returns></returns>
40
-        public ActionResult GetList(string code, string cusname, string cusphone,string createby, string starttime, string endtime, string keywords, string companyname, string province, string city,
41
-            string country,string telephone, string township, string touser,string strvisit,string endvisit, int source=0,int type = 0, int state=-1, int pageindex = 1,int pagesize = 10)
40
+        public ActionResult GetList(string code, string cusname, string cusphone, string createby, string starttime, string endtime, string keywords, string companyname, string province, string city,
41
+            string country, string telephone, string township, string touser, string strvisit, string endvisit, int source = 0, int type = 0, int status = 0, int state=-1, int pageindex = 1,int pagesize = 10)
42 42
         {
43 43
            
44 44
               int userId = CurrentUser.UserData.F_UserId;
@@ -195,18 +195,26 @@ namespace CallCenterApi.Interface.Controllers.workorder
195 195
                         sql += " and F_State =" + (int)EnumWorkOrderState.finish + " and F_DealBy = '" + ua.F_UserCode + "' ";
196 196
                         break;
197 197
                     case 3://我参与的
198
+                        if (status>0)
199
+                        {
200
+                            sql += $" and F_State ="+ status;
201
+                        }
202
+                        else
203
+                        {
204
+                            sql += $" and F_State in(1,2,3,4)";
205
+                        }
198 206
                         if (ro.F_RoleCode == "XTGLY")
199 207
                         {
200 208
                             if (GetParticipateID() != "")
201 209
                             {
202 210
                                 sql += " and  T_Wo_WorkOrder.F_ID in ( " + GetParticipateID() + ") ";
203
-                                sql += " and F_State =" + (int)EnumWorkOrderState.assign;
204 211
                             }
205 212
                         }
206 213
                         else
207 214
                         {
208 215
                             if (GetParticipateID(ua.F_UserCode) != "")
209 216
                             {
217
+                                
210 218
                                 sql += " and  T_Wo_WorkOrder.F_ID in ( " + GetParticipateID(ua.F_UserCode) + ") ";
211 219
                             }
212 220
                             else
@@ -214,6 +222,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
214 222
                                 return Error("暂无工单");
215 223
                             }
216 224
                         }
225
+                      
217 226
                         break;
218 227
                     case 4://待回访
219 228
                         if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
@@ -663,12 +672,13 @@ namespace CallCenterApi.Interface.Controllers.workorder
663 672
                         case 3://客服已分配
664 673
                             sql = "";
665 674
                             sql += $"  F_IsDelete=0";
675
+                            sql += $" and F_State in(1,2,3,4)";
666 676
                             if (ro.F_RoleCode == "XTGLY")
667 677
                             {
668 678
                                 if (GetParticipateID() != "")
669 679
                                 {
670 680
                                     sql += " and  T_Wo_WorkOrder.F_ID in ( " + GetParticipateID() + ") ";
671
-                                    sql += " and F_State =" + (int)EnumWorkOrderState.assign;
681
+                                   
672 682
                                 }
673 683
                                 else
674 684
                                 {
@@ -848,7 +858,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
848 858
                             sql += $"  F_IsDelete=0";
849 859
                             if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
850 860
                             {
851
-                                sql += $" and F_ID in(" + GetDelay() + ")";
861
+                              
852 862
                             }
853 863
                             else
854 864
                             {
@@ -931,7 +941,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
931 941
                             sql = "";
932 942
                             sql += $"  F_IsDelete=0";
933 943
                             sql += $" and F_IsOver=" + 1;
934
-                            if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "YWY" || ro.F_RoleCode == "BLRY")
944
+                            sql += $" and F_State !=" + 11;
945
+                            if ( ro.F_RoleCode == "YWY" || ro.F_RoleCode == "BLRY")
935 946
                             {
936 947
                                 sql += $" and F_DealBy like '%" + ua.F_UserCode.Trim() + "%'";
937 948
                             }
@@ -984,10 +995,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
984 995
                                     break; ;
985 996
                                 }
986 997
                             }
987
-                            else if (ro.F_RoleCode == "JDYBZZX")
988
-                            {
989
-                                sql += $" and F_CreateBy like '%" + ua.F_UserCode.Trim() + "%'";
990
-                            }
998
+                           
991 999
                             else if (ro.F_RoleCode == "QTJS")
992 1000
                             {
993 1001
                                 CQGD = 0;
@@ -998,6 +1006,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
998 1006
                         case 18://催办
999 1007
                             sql = "";
1000 1008
                             sql += $"  F_IsDelete=0";
1009
+                            sql += $" and F_State !=" + 10;
1010
+                            sql += $" and F_State !=" + 11;
1001 1011
                             var list = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.urge);
1002 1012
                             string str = "";
1003 1013
                            foreach (var it in list)
@@ -2147,11 +2157,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
2147 2157
         public string GetParticipateID(string user)
2148 2158
         {
2149 2159
             string str = string.Empty;
2150
-            str = "select F_WoID from T_Wo_WorkOrderItem_New where F_CreateUser in(" + user + ") and F_OptType in( 1,7)";
2160
+            str = "select F_WoID from T_Wo_WorkOrderItem_New where F_CreateUser in(" + user + ") and F_OptType in( 1)";
2151 2161
 
2152 2162
             ;
2153 2163
             return str;
2154 2164
         }
2165
+    
2155 2166
         /// <summary>
2156 2167
         /// 获取部门待接单的工单编号
2157 2168
         /// </summary>
@@ -2475,6 +2486,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2475 2486
                     {
2476 2487
                         sql += $" and F_State in (11)";
2477 2488
                         sql += $" and F_IsVisit=" + 1; ;
2489
+                        sql += $"and F_DealType != '当即办理'  and F_VisitBy != ''";
2478 2490
                     }
2479 2491
                     else if (state == 10)
2480 2492
                     {
@@ -2485,10 +2497,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
2485 2497
                         sql += $" and F_State=" + state;
2486 2498
                     }
2487 2499
                 }
2488
-                  
2489 2500
                 if (source > 0)//工单来源
2490 2501
                     sql += $" and F_Source=" + source;
2491
-
2492 2502
                 if (!string.IsNullOrWhiteSpace(createby))//创建人
2493 2503
                 {
2494 2504
                     string F_WorkNumber = "";
@@ -2666,7 +2676,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2666 2676
         /// 查询超时工单列表
2667 2677
         /// </summary>
2668 2678
         public ActionResult GetOvertime(string code,string keywords, string cusname, string cusphone, string companyname, string province, string city,
2669
-            string country, string township, string touser, int source = 0, int type = 0,int pageindex = 1, int pagesize = 10)
2679
+         string starttime, string salesBase, string endtime,  string country, string township, string touser, string product,int source = 0,int state=0, int type = 0,int pageindex = 1, int pagesize = 10)
2670 2680
         {
2671 2681
             int userId = CurrentUser.UserData.F_UserId;
2672 2682
             if (userId != 0)
@@ -2688,6 +2698,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
2688 2698
                     sql += $" and F_WorkOrderCode like '%" + code.Trim() + "%'";
2689 2699
                 if (!string.IsNullOrWhiteSpace(keywords))//关键字搜索
2690 2700
                     sql += $"  and ( F_CusName like '%" + keywords.Trim() + "%'or F_CusPhone like '%" + keywords.Trim() + "%' ) ";
2701
+                if (!string.IsNullOrEmpty(starttime))
2702
+                    sql += " and datediff(day,F_CreateOn,'" + starttime + "')<=0 ";
2703
+                if (!string.IsNullOrEmpty(endtime))
2704
+                    sql += " and datediff(day,F_CreateOn,'" + endtime + "')>=0   ";
2705
+                if (!string.IsNullOrWhiteSpace(salesBase))//销售基地
2706
+                    sql += $" and F_SalesBase like '%" + salesBase.Trim() + "%'";
2691 2707
                 if (!string.IsNullOrWhiteSpace(cusname))//客户姓名
2692 2708
                     sql += $" and F_CusName like '%" + cusname.Trim() + "%'";
2693 2709
                 if (!string.IsNullOrWhiteSpace(cusphone))//客户电话
@@ -2702,11 +2718,19 @@ namespace CallCenterApi.Interface.Controllers.workorder
2702 2718
                     sql += $" and F_IncidentCountry like '%" + country.Trim() + "%'";
2703 2719
                 if (!string.IsNullOrWhiteSpace(province))//乡
2704 2720
                     sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
2705
-              
2721
+                if (!string.IsNullOrEmpty(product))
2722
+                {
2723
+                    sql += $" and F_TS_Category='" + product.Trim() + "'";
2724
+                }
2725
+                if (state>0)
2726
+                {
2727
+                    sql += $" and F_State =" + state;
2728
+                }
2706 2729
                 sql += $" and F_IsOver=" + 1;
2730
+                sql += $" and F_State !=" + 11;
2707 2731
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
2708 2732
                 Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
2709
-                if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "YWY" || ro.F_RoleCode == "BLRY")
2733
+                if ( ro.F_RoleCode == "YWY" || ro.F_RoleCode == "BLRY")
2710 2734
                 {
2711 2735
                     sql += $" and F_DealBy like '%" + ua.F_UserCode.Trim() + "%'";
2712 2736
                 }
@@ -2757,10 +2781,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
2757 2781
                         return Error("加载失败");
2758 2782
                     }
2759 2783
                 }
2760
-                else if (ro.F_RoleCode == "JDYBZZX")
2761
-                {
2762
-                    sql += $" and F_CreateBy like '%" + ua.F_UserCode.Trim() + "%'";
2763
-                }
2764 2784
                 else if (ro.F_RoleCode == "QTJS")
2765 2785
                 {
2766 2786
                     return Error("无操作权限!");
@@ -3357,6 +3377,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
3357 3377
                     sql += $" and F_IncidentCountry like '%" + country.Trim() + "%'";
3358 3378
                 if (!string.IsNullOrWhiteSpace(province))//乡
3359 3379
                     sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
3380
+                sql += $" and F_State !=" + 10;
3381
+                sql += $" and F_State !=" + 11;
3360 3382
                 #endregion
3361 3383
                 int recordCount = 0;
3362 3384
                 var list = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.urge);
@@ -4036,7 +4058,16 @@ namespace CallCenterApi.Interface.Controllers.workorder
4036 4058
                     {
4037 4059
                         if (!string.IsNullOrEmpty(cuModel.F_AreaID))
4038 4060
                         {
4039
-                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
4061
+                            Model.T_Sys_Department pdModel = new T_Sys_Department();
4062
+                            try
4063
+                            {
4064
+                               pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
4065
+                            }
4066
+                            catch
4067
+                            {
4068
+                               pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
4069
+                            }
4070
+                         
4040 4071
                             if (pdModel != null)
4041 4072
                             {
4042 4073
                                 model.F_AreaName = pdModel.F_DeptName;
@@ -4044,7 +4075,15 @@ namespace CallCenterApi.Interface.Controllers.workorder
4044 4075
                         }
4045 4076
                         if (!string.IsNullOrEmpty(cuModel.F_BranchID))
4046 4077
                         {
4047
-                            Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));
4078
+                            Model.T_Sys_Department pdModel1 = new T_Sys_Department();
4079
+                            try
4080
+                            {
4081
+                                pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));//通过公司id获取部门
4082
+                            }
4083
+                            catch
4084
+                            {
4085
+                                pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);//通过公司id获取部门
4086
+                            }
4048 4087
                             if (pdModel1 != null)
4049 4088
                             {
4050 4089
                                 model.F_BranchName = pdModel1.F_DeptName;
@@ -4175,7 +4214,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4175 4214
                     }
4176 4215
                     else if (model1[i].F_State == 11)
4177 4216
                     {
4178
-                        model.F_StateName = "已评价";
4217
+                        model.F_StateName = "已回访";
4179 4218
                     }
4180 4219
                     else if (model1[i].F_State == 12)
4181 4220
                     {
@@ -4593,39 +4632,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
4593 4632
             }
4594 4633
             return true;
4595 4634
         }
4596
-        private bool IsMaterial(WorkOrderNewInput input)
4597
-        {
4598
-            bool n= false;
4599
-            if (!string .IsNullOrEmpty (input.F_MaterialID)|| !string.IsNullOrEmpty(input.F_MaterialName)
4600
-               || !string.IsNullOrEmpty(input.F_Model) || !string.IsNullOrEmpty(input.F_Specs)
4601
-                || !string.IsNullOrEmpty(input.F_Level1) || !string.IsNullOrEmpty(input.F_Level2)
4602
-              || !string.IsNullOrEmpty(input.F_Level3) || !string.IsNullOrEmpty(input.F_Brand)
4603
-              || !string.IsNullOrEmpty(input.F_MaterialEffect) || !string.IsNullOrEmpty(input.F_Craft)
4604
-              || !string.IsNullOrEmpty(input.F_Pipeline))
4605
-            {
4606
-                n = true;
4607
-            }
4608
-            return n;
4609
-        }
4610
-        private void AddMait(WorkOrderNewInput input,string usercode)
4611
-        {
4612
-            Model.T_Wo_MaterialManage dModel = new Model.T_Wo_MaterialManage();
4613
-            dModel.F_MaterialCode = input.F_MaterialID.ToString();//物料编号
4614
-            dModel.F_MaterialName = input.F_MaterialName;//物料名称
4615
-            dModel.F_Model = input.F_Model;//型号
4616
-            dModel.F_Specs = input.F_Specs;//规格
4617
-            dModel.F_Level1 = input.F_Level1;//一级分类
4618
-            dModel.F_Level2 = input.F_Level2;//二级分类
4619
-            dModel.F_Level3 = input.F_Level3;//三级分类
4620
-            dModel.F_Brand = input.F_Brand;//品牌
4621
-            dModel.F_MaterialEffect = input.F_MaterialEffect;//复合肥肥效
4622
-            dModel.F_Craft = input.F_Craft;//工艺
4623
-            dModel.F_Pipeline = input.F_Pipeline;//产品线
4624
-            dModel.F_IsDelete = 0;
4625
-            dModel.F_CreateOn = DateTime.Now;
4626
-            dModel.F_CreateBy = usercode;
4627
-            int f = mmBLL.Add(dModel);
4628
-        }
4635
+      
4636
+
4629 4637
       
4630 4638
         /// <summary>
4631 4639
         /// 根据传入的对象和input的内容返回对象(添加修改使用)
@@ -4655,8 +4663,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
4655 4663
                 model.F_Source = model.F_Source.ToString();//工单来源
4656 4664
             }
4657 4665
                 #region 基本字段
4658
-            
4659
-
4660 4666
                 if (input.F_Type == 2 || input.F_Type == 3)
4661 4667
                 {
4662 4668
                     if (string.IsNullOrEmpty(input.F_CustomerID))
@@ -4670,15 +4676,40 @@ namespace CallCenterApi.Interface.Controllers.workorder
4670 4676
                                 Customer.F_Salesman = input.F_Salesman;
4671 4677
                             if (!string.IsNullOrEmpty(input.F_SalesPhone))
4672 4678
                                 Customer.F_SalesPhone = input.F_SalesPhone;
4673
-                            if (!string.IsNullOrEmpty(input.F_Brands))
4674
-                                Customer.F_Brands = input.F_Brands;
4675
-                            if (!string.IsNullOrEmpty(input.F_AreaName))
4676
-                                Customer.F_AreaID = input.F_AreaName.Trim();
4679
+                       
4680
+                       
4681
+                        if (!string.IsNullOrEmpty(input.F_Brands))
4682
+                            Customer.F_SalesPhone = input.F_Brands;
4683
+                        if (!string.IsNullOrEmpty(input.F_AreaName))
4684
+                        {
4685
+                            Model.T_Sys_Department pdModel = new T_Sys_Department();
4686
+                            try
4687
+                            {
4688
+                                pdModel = departmentBLL.GetModel(int.Parse(input.F_AreaName));
4689
+                            }
4690
+                            catch
4691
+                            {
4692
+                                pdModel = departmentBLL.GetModel(input.F_AreaName);
4693
+                            }
4694
+                            Customer.F_AreaID = pdModel.F_DeptId.ToString();
4695
+                        }
4696
+                              
4677 4697
                             if (!string.IsNullOrEmpty(input.F_BranchName))
4678
-                                Customer.F_BranchID = input.F_BranchName.Trim();
4698
+                        {
4699
+                            Model.T_Sys_Department pdModel = new T_Sys_Department();
4700
+                            try
4701
+                            {
4702
+                                pdModel = departmentBLL.GetModel(int.Parse(input.F_BranchName));
4703
+                            }
4704
+                            catch
4705
+                            {
4706
+                                pdModel = departmentBLL.GetModel(input.F_BranchName);
4707
+                            }
4708
+                            Customer.F_BranchID = pdModel.F_DeptId.ToString();
4709
+                        }
4710
+                               
4679 4711
                             cusbll.Update(Customer);
4680 4712
                         }
4681
-                       
4682 4713
 
4683 4714
                     }
4684 4715
                     else
@@ -4691,39 +4722,41 @@ namespace CallCenterApi.Interface.Controllers.workorder
4691 4722
                             if (!string.IsNullOrEmpty(input.F_SalesPhone))
4692 4723
                                 Customer.F_SalesPhone = input.F_SalesPhone;
4693 4724
                             if (!string.IsNullOrEmpty(input.F_Brands))
4694
-                                Customer.F_Brands = input.F_Brands;
4695
-                            if (!string.IsNullOrEmpty(input.F_AreaName))
4696
-                                Customer.F_AreaID = input.F_AreaName.Trim();
4697
-                            if (!string.IsNullOrEmpty(input.F_BranchName))
4698
-                                Customer.F_BranchID = input.F_BranchName.Trim();
4699
-                            cusbll.Update(Customer);
4700
-                        }
4701
-                     
4702
-                    }
4703
-                    if ( IsMaterial(input))
4704
-                    {
4705
-                        if (string.IsNullOrEmpty(input.F_MaterialID))
4725
+                               Customer.F_Brands = input.F_Brands;
4726
+                        if (!string.IsNullOrEmpty(input.F_AreaName))
4706 4727
                         {
4707
-                            while (true)
4728
+                            Model.T_Sys_Department pdModel = new T_Sys_Department();
4729
+                            try
4708 4730
                             {
4709
-                                if (!gematerque(0, GetIntCode()))
4710
-                                {
4711
-                                    input.F_MaterialID = GetIntCode();
4712
-                                    AddMait(input, usercode);
4713
-                                    break;
4714
-                                }
4731
+                                pdModel = departmentBLL.GetModel(int.Parse(input.F_AreaName));
4732
+                            }
4733
+                            catch
4734
+                            {
4735
+                                pdModel = departmentBLL.GetModel(input.F_AreaName);
4715 4736
                             }
4737
+                            Customer.F_AreaID = pdModel.F_DeptId.ToString();
4716 4738
                         }
4717
-                        else
4739
+                               
4740
+                            if (!string.IsNullOrEmpty(input.F_BranchName))
4718 4741
                         {
4719
-                            if (!gematerque(0, input.F_MaterialID))
4720 4742
                             {
4721
-                                AddMait(input, usercode);
4743
+                                Model.T_Sys_Department pdModel = new T_Sys_Department();
4744
+                                try
4745
+                                {
4746
+                                    pdModel = departmentBLL.GetModel(int.Parse(input.F_BranchName));
4747
+                                }
4748
+                                catch
4749
+                                {
4750
+                                    pdModel = departmentBLL.GetModel(input.F_BranchName);
4751
+                                }
4752
+                                Customer.F_BranchID = pdModel.F_DeptId.ToString();
4722 4753
                             }
4723 4754
                         }
4755
+                              
4756
+                            cusbll.Update(Customer);
4757
+                        }
4724 4758
                     }
4725 4759
                 }
4726
-           
4727 4760
             #endregion
4728 4761
             model.F_Canal = input.F_Canal;//生产批次号
4729 4762
             model.F_Type = input.F_Type.ToString();//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
@@ -5865,7 +5898,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
5865 5898
                 {
5866 5899
                     if (!string.IsNullOrEmpty(model.F_CusPhone.Trim () ))
5867 5900
                     {
5868
-                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(model.F_CusPhone.Trim(), smscont);
5901
+                        string msg = "【心连心客服中心】为更好的为你提供服务,请你对我们的服务进行评价,满意请按1,一般请按2,不满意请按3.";
5902
+                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(model.F_CusPhone.Trim(), msg);
5903
+                        bool n = new SMSController().AddSmS(model.F_CusPhone, smscont, nowUser.F_UserId);
5869 5904
                         if (result !=null )
5870 5905
                         {
5871 5906
                             sid = result.sid.Trim ();
@@ -6230,21 +6265,21 @@ namespace CallCenterApi.Interface.Controllers.workorder
6230 6265
             string smscont = "";
6231 6266
             if (model.F_Type == "1")
6232 6267
             {
6233
-                smscont = "您有一条新的咨询工单,请及时处理";
6268
+                smscont = "咨询";
6234 6269
             }
6235 6270
             else if (model.F_Type == "2")
6236 6271
             {
6237
-                smscont = "您有一条新的投诉工单,请及时处理";
6272
+                smscont = "投诉";
6238 6273
             }
6239 6274
             else if (model.F_Type == "3")
6240 6275
             {
6241
-                smscont = "您有一条新的抽检工单,请及时处理";
6276
+                smscont = "抽检";
6242 6277
             }
6243 6278
             else
6244 6279
             {
6245
-                smscont = "您有一条新的建议工单,请及时处理";
6280
+                smscont = "建议";
6246 6281
             }
6247
-
6282
+            string[] mag = { smscont };
6248 6283
             string touser = ""; string tousername = "";
6249 6284
 
6250 6285
             int deptid = 0;
@@ -6262,7 +6297,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
6262 6297
                     {
6263 6298
                         if (!string .IsNullOrEmpty (clus.F_Mobile.Trim ()))
6264 6299
                         {
6265
-                            SmsSingleSenderResult result = new SMSController().SMSSingleshot(clus.F_Mobile.Trim(), smscont);
6300
+                          
6301
+                            SmsSingleSenderResult result = new SMSController().SMSSingleshot(395191, mag, clus.F_Mobile.Trim());
6302
+                            bool n = new SMSController().AddSmS(clus.F_Mobile.Trim(), smscont, nowUser.F_UserId);
6266 6303
                         }
6267 6304
                         
6268 6305
                     }
@@ -6290,7 +6327,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
6290 6327
                     {
6291 6328
                         if (!string.IsNullOrEmpty(l.F_Mobile.Trim ()))
6292 6329
                         {
6293
-                            SmsSingleSenderResult result = new SMSController().SMSSingleshot(l.F_Mobile.Trim(), smscont);
6330
+                            SmsSingleSenderResult result = new SMSController().SMSSingleshot(395191, mag,l.F_Mobile.Trim());
6331
+                            bool n = new SMSController().AddSmS(l.F_Mobile.Trim(), smscont, nowUser.F_UserId);
6294 6332
                         }
6295 6333
 
6296 6334
                     }

+ 6 - 0
codegit/CallCenterApi/CallCenterApi.Model/T_SMS_RecvSMS.cs

@@ -95,5 +95,11 @@ namespace CallCenterApi.Model
95 95
             get { return _f_createdate; }
96 96
             set { _f_createdate = value; }
97 97
         }
98
+        private string _recvmodemimei;
99
+        public string RecvModemIMEI
100
+        {
101
+            get { return _recvmodemimei; }
102
+            set { _recvmodemimei = value; }
103
+        }
98 104
     }
99 105
 }