Browse Source

质检bug,市民资料管理

duhongyu 4 years ago
parent
commit
d80d2bae31

+ 7 - 0
CallCenterApi/CallCenterApi.BLL/T_Cus_CustomerBase.cs

@@ -82,7 +82,14 @@ namespace CallCenterApi.BLL
82 82
 
83 83
             return dal.GetModelByPhone(F_Mobile);
84 84
         }
85
+        /// <summary>
86
+        /// 得到一个对象实体
87
+        /// </summary>
88
+        public CallCenterApi.Model.T_Cus_CustomerBase GetModelBy(string F_Mobile,string F_CustomerName)
89
+        {
85 90
 
91
+            return dal.GetModelBy(F_Mobile, F_CustomerName);
92
+        }
86 93
         /// <summary>
87 94
         /// 获得数据列表
88 95
         /// </summary>

File diff suppressed because it is too large
+ 25 - 0
CallCenterApi/CallCenterApi.DAL/T_Cus_CustomerBase.cs


+ 19 - 6
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/AchievementsController.cs

@@ -85,7 +85,6 @@ namespace CallCenterApi.Interface.Controllers
85 85
         {
86 86
             DataTable dt = new DataTable();
87 87
             string sql = " and F_IsDelete=0 ";
88
-            string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
89 88
             int type = RequestString.GetInt("type", 0);
90 89
            int deptid = RequestString.GetInt("deptid", 0);
91 90
             string strpageindex = RequestString.GetQueryString("page");
@@ -107,11 +106,7 @@ namespace CallCenterApi.Interface.Controllers
107 106
                 }
108 107
             }
109 108
             #region sql 语句相关处理
110
-            if (strstate.Trim() != "" && strstate != "undefined")
111
-            {
112
-
113
-                sql += " and F_WorkState = '" + strstate.Trim() + "' ";
114
-            }
109
+           
115 110
 
116 111
             if (deptid != 0)
117 112
             {
@@ -147,6 +142,24 @@ namespace CallCenterApi.Interface.Controllers
147 142
             };
148 143
             return Content(obj.ToJson());
149 144
         }
145
+        /// <summary>
146
+        /// 加载字典值
147
+        /// </summary>
148
+        /// <returns></returns>
149
+        public ActionResult GetModel(int id)
150
+        {
151
+
152
+            Model.T_Sys_Achievements valueModel = Achievements.GetModel(id);
153
+            if (valueModel != null)
154
+            {
155
+                return Success("加载成功", valueModel);
156
+            }
157
+
158
+            else
159
+                return Error("加载失败");
160
+
161
+        }
162
+
150 163
 
151 164
     }
152 165
 }

+ 5 - 3
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Quality/IndexBaseController.cs

@@ -76,11 +76,13 @@ namespace CallCenterApi.Interface.Controllers.Quality
76 76
 
77 77
         //添加指标
78 78
         [HttpPost]
79
-        public ActionResult AddIndexBase(int cid, int score, int sort, string title, string remark)
79
+        public ActionResult AddIndexBase(int cid,  string title, string remark, int score = 0, int sort = 0)
80 80
         {
81 81
             Model.T_QC_IndexBase dModel = new Model.T_QC_IndexBase();
82
-            
83
-            dModel.F_CategoryId = cid;
82
+            if (cid > 0)
83
+                dModel.F_CategoryId = cid;
84
+            else
85
+                return Error("请选择指标分类");
84 86
             dModel.F_Sort = sort;
85 87
             dModel.F_Score = score;
86 88
 

+ 6 - 27
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Quality/QCManageController.cs

@@ -52,19 +52,9 @@ namespace CallCenterApi.Interface.Controllers.Quality
52 52
                 sql += " and PhoneType='" + PhoneType + "'";
53 53
             }
54 54
 
55
-            if (islike > 0)
55
+            if (phone != null && phone.Trim() != "")
56 56
             {
57
-                if (phone != null && phone.Trim() != "")
58
-                {
59
-                    sql += " and CallNumber like '%" + phone + "%'";
60
-                }
61
-            }
62
-            else
63
-            {
64
-                if (phone != null && phone.Trim() != "")
65
-                {
66
-                    sql += " and CallNumber = '" + phone + "'";
67
-                }
57
+                sql += " and CallNumber like '%" + phone + "%'";
68 58
             }
69 59
 
70 60
             if (calltype.Trim() != "")
@@ -102,7 +92,7 @@ namespace CallCenterApi.Interface.Controllers.Quality
102 92
             }
103 93
             if (extnumber.Trim() != "")
104 94
             {
105
-                sql += " and isnull(ExtNumber,'')='" + extnumber.Trim() + "'";
95
+                sql += " and ExtNumber like '%" + extnumber.Trim() + "%'";
106 96
             }
107 97
 
108 98
             if (strpageindex.Trim() != "")
@@ -196,21 +186,10 @@ namespace CallCenterApi.Interface.Controllers.Quality
196 186
                 sql += " and PhoneType='" + PhoneType + "'";
197 187
             }
198 188
 
199
-            if (islike > 0)
189
+            if (phone != null && phone.Trim() != "")
200 190
             {
201
-                if (phone != null && phone.Trim() != "")
202
-                {
203
-                    sql += " and CallNumber like '%" + phone + "%'";
204
-                }
191
+                sql += " and CallNumber like '%" + phone + "%'";
205 192
             }
206
-            else
207
-            {
208
-                if (phone != null && phone.Trim() != "")
209
-                {
210
-                    sql += " and CallNumber = '" + phone + "'";
211
-                }
212
-            }
213
-
214 193
             if (calltype.Trim() != "")
215 194
             {
216 195
                 if (calltype == "3")
@@ -246,7 +225,7 @@ namespace CallCenterApi.Interface.Controllers.Quality
246 225
             }
247 226
             if (extnumber.Trim() != "")
248 227
             {
249
-                sql += " and isnull(ExtNumber,'')='" + extnumber.Trim() + "'";
228
+                sql += " and ExtNumber like'%" + extnumber.Trim() + "%'";
250 229
             }
251 230
 
252 231
             if (strpageindex.Trim() != "")

File diff suppressed because it is too large
+ 3 - 9
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/WebChart/InfoNewController.cs


+ 106 - 38
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerController.cs

@@ -9,6 +9,7 @@ using System.Data;
9 9
 using CallCenter.Utility;
10 10
 using CallCenterApi.Common;
11 11
 using CallCenterApi.DB;
12
+using System.IO;
12 13
 
13 14
 namespace CallCenterApi.Interface.Controllers.customer
14 15
 {
@@ -19,7 +20,7 @@ namespace CallCenterApi.Interface.Controllers.customer
19 20
         /// 获取客户列表
20 21
         /// </summary>
21 22
         /// <returns></returns>
22
-        public ActionResult GetList()
23
+        public ActionResult GetList(int isdc=0)
23 24
         {
24 25
             string sql = " and F_DeleteFlag=0";
25 26
             DataTable dt = new DataTable();
@@ -60,11 +61,27 @@ namespace CallCenterApi.Interface.Controllers.customer
60 61
             {
61 62
                 pagesize = Convert.ToInt32(strpagesize);
62 63
             }
64
+            if (isdc>0)
65
+            {
66
+                var dtdc = DbHelperSQL.Query(" F_CustomerName 联系人姓名,F_Mobile 联系人电话,F_Email 邮箱,F_Address 地址,(select count(1) from dbo.T_Bus_WorkOrder where F_IsDelete = 0 and F_CusPhone=a.F_Mobile) as 工单数量 (select count(1) from dbo.T_Call_CallRecords where CallType=0  and CallNumber=a.F_Mobile ) as 来电数量"
67
+                 + " from T_Cus_CustomerBase a WITH(NOLOCK) where 1=1 " + sql ).Tables[0];
68
+                var msg = new NPOIHelper().ExportToExcel("市民资料", dtdc);
69
+                if (msg == "")
70
+                {
71
+                    return Success("导出成功");
72
+                }
73
+                else
74
+                {
75
+                    return Error("导出失败");
76
+                }
77
+            }
78
+           
79
+            string cols = "*,(select count(1) from dbo.T_Bus_WorkOrder where F_IsDelete = 0 and F_CusPhone=a.F_Mobile) as gdCount, (select count(1) from dbo.T_Call_CallRecords where CallType=0  and CallNumber=a.F_Mobile ) as ldCount ";
63 80
             int recordCount = 0;
64 81
             dt = BLL.PagerBLL.GetListPager(
65
-                "T_Cus_CustomerBase",
82
+                "T_Cus_CustomerBase a WITH(NOLOCK) ",
66 83
                 "F_CustomerId",
67
-                "*",
84
+                cols,
68 85
                 sql,
69 86
                 "ORDER BY F_CustomerId desc",
70 87
                 pagesize,
@@ -140,22 +157,6 @@ namespace CallCenterApi.Interface.Controllers.customer
140 157
             {
141 158
                 return Error("请输入客户名称");
142 159
             }            
143
-            //if (!Validate.IsValidPhoneAndMobile(mobile) && !string.IsNullOrEmpty(mobile))
144
-            //{
145
-            //    return Error("请输入有效的客户电话");
146
-            //}
147
-            //if (!Validate.IsValidPhoneAndMobile(telphone) && !string.IsNullOrEmpty(telphone))
148
-            //{
149
-            //    return Error("请输入有效的联系电话");
150
-            //}
151
-            //if (!Validate.IsValidZip(postcode) && !string.IsNullOrEmpty(postcode))
152
-            //{
153
-            //    return Error("请输入有效的邮编号码");
154
-            //}
155
-            //if (!Validate.IsEmail(email) && !string.IsNullOrEmpty(email))
156
-            //{
157
-            //    return Error("请输入有效的Email");
158
-            //}
159 160
             #endregion
160 161
 
161 162
             Model.T_Cus_CustomerBase model = new Model.T_Cus_CustomerBase();
@@ -286,20 +287,13 @@ namespace CallCenterApi.Interface.Controllers.customer
286 287
                 {
287 288
                     Model.T_Cus_CustomerBase model = new Model.T_Cus_CustomerBase();
288 289
                     model.F_CustomerName = dr[0].ToString();    //客户姓名
289
-                    //model.F_CustomerEName = dr[1].ToString();   //联系人
290 290
                     model.F_Sex = dr[1].ToString();   //性别
291 291
                     model.F_Mobile = dr[2].ToString();          //手机号码
292
-                    model.F_Telephone = dr[3].ToString();       //单位电话
293
-                    model.F_ChargeTelephone = dr[4].ToString(); //其它号码
294
-                    model.F_PostCode = dr[5].ToString();        //邮编
295
-                    model.F_Email = dr[6].ToString();           //Email
296
-                    model.F_ChargeDept = dr[7].ToString();      //所在单位
297
-                    model.F_ServiceDept = dr[8].ToString();      //部门
298
-                    model.F_CustomerIndustry = dr[9].ToString();      //职务
292
+                    model.F_Email = dr[3].ToString();           //Email
293
+                    model.F_Address = dr[4].ToString();      //部门
299 294
                     model.F_CreateBy = User.F_UserId;
300 295
                     model.F_CreatedOn = DateTime.Now;
301 296
                     model.F_DeleteFlag = 0;
302
-
303 297
                     if (new BLL.T_Cus_CustomerBase().Add(model) <= 0)
304 298
                     {
305 299
                         return Error("第" + headrow + "行,导入失败!");
@@ -313,6 +307,89 @@ namespace CallCenterApi.Interface.Controllers.customer
313 307
             return Success("导入成功");
314 308
         }
315 309
 
310
+
311
+
312
+
313
+
314
+        ///// <summary>
315
+        ///// 导入excel
316
+        ///// </summary>
317
+        public ActionResult ImportExcel()
318
+        {
319
+                HttpPostedFile _upFile = RequestString.GetFile("upFile");
320
+                if (_upFile != null)
321
+                {
322
+                    int headrow = 0;
323
+                    #region 上传文件
324
+                    string filepath = "";
325
+                    string datepath = DateTime.Now.ToString("yyyyMMddHHMMss");
326
+                    string aLastName = Path.GetExtension(_upFile.FileName);
327
+                    string oriname = Path.GetFileNameWithoutExtension(_upFile.FileName);
328
+                    if (aLastName != ".xls" && aLastName != ".xlsx")
329
+                    {
330
+                        return Error("文件类型错误,请选择Excel文件");
331
+                    }
332
+                    string newpath = datepath + "_" + _upFile.FileName;
333
+                    if (!Directory.Exists(Server.MapPath(this.Request.ApplicationPath + "\\ExcelData")))
334
+                    {
335
+                        Directory.CreateDirectory(Server.MapPath(this.Request.ApplicationPath + "\\ExcelData"));
336
+                    }
337
+                    filepath = this.Request.ApplicationPath + "/ExcelData/" + newpath;
338
+                    string PhysicalPath = Server.MapPath(filepath);
339
+                    _upFile.SaveAs(PhysicalPath);
340
+                    #endregion
341
+                    NPOIHelper np = new NPOIHelper();
342
+                    DataTable dt = np.ExcelToTable(_upFile, headrow);
343
+                    string msg = string.Empty;
344
+                    if (dt == null || dt.Rows.Count == 0)
345
+                        return Error("文件没有数据");
346
+                    else
347
+                    {
348
+                      
349
+                        foreach (DataRow dr in dt.Rows)
350
+                        {
351
+                            headrow = headrow + 1;
352
+                        if (string.IsNullOrEmpty(dr["联系人姓名"].ToString()))
353
+                        {
354
+                            msg = msg + "第" + headrow + "行,联系人姓名,未导入<br>";
355
+                            continue;
356
+                        }
357
+                        if (string.IsNullOrEmpty(dr["联系人电话"].ToString()))
358
+                        {
359
+                            msg = msg + "第" + headrow + "行,联系人电话,未导入<br>";
360
+                            continue;
361
+                        }
362
+                    var    cusmodel = new BLL .T_Cus_CustomerBase().GetModelBy(dr["联系人电话"].ToString(), dr["联系人姓名"].ToString());
363
+                        if (cusmodel!=null )
364
+                        {
365
+                            msg = msg + "第" + headrow + "行,该联系人已存在,未导入<br>";
366
+                            continue;
367
+                        }
368
+                        Model.T_Cus_CustomerBase model = new Model.T_Cus_CustomerBase();
369
+                        model.F_CustomerName = dr["联系人姓名"].ToString(); ;    //
370
+                            model.F_Sex = dr["性别"].ToString(); ;
371
+                        model.F_Mobile = dr["联系人电话"].ToString(); ;            //手机号码
372
+                        model.F_Email = dr["邮箱"].ToString(); ;            //手机号码           //Email
373
+                        model.F_Address = dr["地址"].ToString(); ;      //部门
374
+                            model.F_CreateBy = User.F_UserId;
375
+                            model.F_CreatedOn = DateTime.Now;
376
+                            model.F_DeleteFlag = 0;
377
+                            if (new BLL.T_Cus_CustomerBase().Add(model) <= 0)
378
+                            {
379
+
380
+                                msg = msg + "第" + headrow + "行,客户电话重复,未导入<br>";
381
+                            }
382
+                        }
383
+                        if (string.IsNullOrEmpty(msg))
384
+                            return Success("导入成功 ");
385
+                        else
386
+                            return Error(msg);
387
+                    }
388
+                }
389
+                return Error("数据源上传失败");
390
+           
391
+        }
392
+
316 393
         /// <summary>
317 394
         /// 导出客户信息
318 395
         /// </summary>
@@ -324,8 +401,6 @@ namespace CallCenterApi.Interface.Controllers.customer
324 401
             NPOIHelper npoi = new NPOIHelper();
325 402
             string chargeDept = HttpUtility.UrlDecode(RequestString.GetQueryString("chargeDept"));
326 403
             string keyWord = HttpUtility.UrlDecode(RequestString.GetQueryString("keyWord"));
327
-            //string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
328
-            //string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
329 404
 
330 405
             if (chargeDept.Trim() != "" && chargeDept != "undefined")
331 406
             {
@@ -335,14 +410,7 @@ namespace CallCenterApi.Interface.Controllers.customer
335 410
             {
336 411
                 sql += " and (F_Telephone like '%" + keyWord + "%' or F_Mobile like '%" + keyWord + "%' or F_ChargeTelephone like '%" + keyWord + "%' or F_Fax like '%" + keyWord + "%' or F_CustomerName like '%" + keyWord + "%') ";
337 412
             }
338
-            //if (strstarttime.Trim() != "" && strstarttime != "undefined")
339
-            //{
340
-            //    sql += " and datediff(day,F_CreatedOn,'" + strstarttime + "')<=0 ";
341
-            //}
342
-            //if (strendtime.Trim() != "" && strendtime != "undefined")
343
-            //{
344
-            //    sql += " and datediff(day,F_CreatedOn,'" + strendtime + "')>=0   ";
345
-            //}
413
+           
346 414
             DataTable dt = bll.GetList(" F_DeleteFlag=0 " + sql).Tables[0];
347 415
             string result = npoi.ExportToExcel("客户信息", dt);
348 416
 

+ 1 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/APPSController.cs

@@ -1881,7 +1881,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1881 1881
                 {
1882 1882
                     modelT_Bus_WorkOrder.F_Key = strWrkOrdr_Lv1_Bsn_TpCd;
1883 1883
                 }
1884
-
1884
+                modelT_Bus_WorkOrder.F_IsProtect = 1;
1885 1885
                 modelT_Bus_WorkOrder.F_CreateTime = DateTime.Now;
1886 1886
 
1887 1887
                 modelT_Bus_WorkOrder.F_CreateUser = "jianhang";

+ 31 - 4
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -3141,8 +3141,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
3141 3141
         public ActionResult AddWorkOrderOper()
3142 3142
         {
3143 3143
 
3144
-
3145
-
3146 3144
             string workorderid = RequestString.GetFormString("workorderid");
3147 3145
             string remarks = RequestString.GetFormString("remarks");
3148 3146
             Model.T_Bus_WorkOrder modelT_Bus_WorkOrder = workorderBLL.GetModel(workorderid);
@@ -9079,7 +9077,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
9079 9077
                     modelT_Bus_WorkOrder.F_SplitUser = splituser;
9080 9078
                     modelT_Bus_WorkOrder.F_Level = level;
9081 9079
                     modelT_Bus_WorkOrder.F_VisitType = visittype;
9082
-
9080
+                    Task.Run(() =>
9081
+                    {
9082
+                        saveCus(cusname, cusphone, cusaddress);
9083
+                    });
9083 9084
                     modelT_Bus_WorkOrder.F_Latitude = latitude != "" ? decimal.Parse(latitude) : 0;//纬度
9084 9085
                     modelT_Bus_WorkOrder.F_Longitude = longitude != "" ? decimal.Parse(longitude) : 0;//经度
9085 9086
 
@@ -15352,7 +15353,33 @@ namespace CallCenterApi.Interface.Controllers.workorder
15352 15353
                 return Error("权限不足");
15353 15354
             }
15354 15355
         }
15355
-
15356
+        private BLL.T_Cus_CustomerBase cusBLL = new BLL.T_Cus_CustomerBase();
15357
+        /// <summary>
15358
+        /// 保存客户档案
15359
+        /// </summary>
15360
+        /// <param name="telphone"></param>
15361
+        /// <param name="name"></param>
15362
+        /// <param name="phone"></param>
15363
+        /// <param name="countryid"></param>
15364
+        /// <param name="address"></param>
15365
+        /// <returns></returns>
15366
+        private void  saveCus(string name, string phone, string address)
15367
+        {
15368
+            int res = 0;
15369
+            Model.T_Cus_CustomerBase cusmodel = new Model.T_Cus_CustomerBase();
15370
+            if (!string.IsNullOrWhiteSpace(phone))
15371
+            {
15372
+                cusmodel = cusBLL.GetModelBy(phone, name);
15373
+                if (cusmodel == null)
15374
+                {
15375
+                    cusmodel = new Model.T_Cus_CustomerBase();
15376
+                    cusmodel.F_Address = address;
15377
+                    cusmodel.F_CustomerName = name;
15378
+                    cusmodel.F_Mobile = phone;
15379
+                    res = cusBLL.Add(cusmodel);
15380
+                }
15381
+            }
15382
+        }
15356 15383
         /// <summary>
15357 15384
         /// 审核派单
15358 15385
         /// </summary>