Просмотр исходного кода

导入客户信息时 将来电单位放入缓存

MicroWin10-1604\Administrator лет назад: 8
Родитель
Сommit
654d45d9db

+ 77 - 75
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/UserAccountController.cs

28
             {
28
             {
29
                 DataTable dt = new DataTable();
29
                 DataTable dt = new DataTable();
30
                 string sql = " ";
30
                 string sql = " ";
31
-               
32
-                    if (filter.dptid > 0)
33
-                    {
31
+
32
+                if (filter.dptid > 0)
33
+                {
34
                     Model.T_Sys_Department deptModel = new BLL.T_Sys_Department().GetModel(filter.dptid);
34
                     Model.T_Sys_Department deptModel = new BLL.T_Sys_Department().GetModel(filter.dptid);
35
-                    if (deptModel != null) {
36
-                        sql += " and F_DeptId in ( select F_DeptId from T_Sys_Department where F_DeptCode like '" + deptModel.F_DeptCode + "%') ";
37
-                            }
38
-                    }
39
-                    if (!string.IsNullOrWhiteSpace(filter.Key))
35
+                    if (deptModel != null)
40
                     {
36
                     {
41
-                        sql = "";
42
-                        string str = string.Format(" and (F_UserCode like '%{0}%' or F_UserName like '%{1}%')", filter.Key, filter.Key);
43
-                        sql += str;
37
+                        sql += " and F_DeptId in ( select F_DeptId from T_Sys_Department where F_DeptCode like '" + deptModel.F_DeptCode + "%') ";
44
                     }
38
                     }
45
-                    int recordCount = 0;
46
-                    dt = BLL.PagerBLL.GetListPager(
47
-                                            "T_Sys_UserAccount",
48
-                                            "F_UserId",
49
-                                            "*",
50
-                                            sql,
51
-                                            "ORDER BY F_UserId desc",
52
-                                            filter.PageSize,
53
-                                            filter.PageIndex,
54
-                                            true,
55
-                                            out recordCount);
39
+                }
40
+                if (!string.IsNullOrWhiteSpace(filter.Key))
41
+                {
42
+                    sql = "";
43
+                    string str = string.Format(" and (F_UserCode like '%{0}%' or F_UserName like '%{1}%')", filter.Key, filter.Key);
44
+                    sql += str;
45
+                }
46
+                int recordCount = 0;
47
+                dt = BLL.PagerBLL.GetListPager(
48
+                                        "T_Sys_UserAccount",
49
+                                        "F_UserId",
50
+                                        "*",
51
+                                        sql,
52
+                                        "ORDER BY F_UserId desc",
53
+                                        filter.PageSize,
54
+                                        filter.PageIndex,
55
+                                        true,
56
+                                        out recordCount);
56
 
57
 
57
-                    List<Model.UserAccount> modelList = new BLL.UserAccount().DataTableToList(dt);
58
-                    var obj = new
58
+                List<Model.UserAccount> modelList = new BLL.UserAccount().DataTableToList(dt);
59
+                var obj = new
60
+                {
61
+                    rows = modelList.Select(x => new
59
                     {
62
                     {
60
-                        rows = modelList.Select(x => new
61
-                        {
62
-                            F_UserId = x.F_UserId,
63
-                            F_UserCode = x.F_UserCode,
64
-                            F_ExtensionNumber = x.F_ExtensionNumber,
65
-                            F_UserName = x.F_UserName,
66
-                            F_GroupName = x.F_GroupName,
67
-                            F_DeptId = x.F_DeptId,
68
-                            F_RoleId = x.F_RoleId,
69
-                            F_GroupId = x.F_GroupId,
70
-                            F_SeatFlag = x.F_SeatFlag,
71
-                            F_SeatRight = x.F_SeatRight,
72
-                            F_SeatLevel = x.F_SeatLevel,
73
-                            F_SexFlag = x.F_SexFlag,
74
-                            F_RemindFlag = x.F_RemindFlag,
75
-                            F_Remark = x.F_Remark,
76
-                            F_Telephone = x.F_Telephone,
77
-                            F_Mobile = x.F_Mobile,
78
-                            F_HomePhone = x.F_HomePhone,
79
-                            F_Birthday = x.F_Birthday,
80
-                            F_CreateOn = x.F_CreateOn,
81
-                            F_CancelOn = x.F_CancelOn,
82
-                            F_DeleteFlag = x.F_DeleteFlag,
83
-                            F_APPOnFlag = x.F_APPOnFlag,
84
-                            F_LastActiveTime = x.F_LastActiveTime,
85
-                            F_See = x.F_See,
86
-                            F_HJType = x.F_HJType,
87
-                            F_PId = x.F_PId,
88
-                            F_TmId = x.F_TmId,
89
-                            F_RoleName = x.F_RoleName,
90
-                            F_DeptName = x.F_DeptName,
91
-                            F_WorkNumber = x.F_WorkNumber,
92
-                            //F_WXNo=x.F_WXNo,
93
-                            F_SeatGroup = x.F_SeartGroup
94
-                        }),
95
-                        total = recordCount
96
-                    };
63
+                        F_UserId = x.F_UserId,
64
+                        F_UserCode = x.F_UserCode,
65
+                        F_ExtensionNumber = x.F_ExtensionNumber,
66
+                        F_UserName = x.F_UserName,
67
+                        F_GroupName = x.F_GroupName,
68
+                        F_DeptId = x.F_DeptId,
69
+                        F_RoleId = x.F_RoleId,
70
+                        F_GroupId = x.F_GroupId,
71
+                        F_SeatFlag = x.F_SeatFlag,
72
+                        F_SeatRight = x.F_SeatRight,
73
+                        F_SeatLevel = x.F_SeatLevel,
74
+                        F_SexFlag = x.F_SexFlag,
75
+                        F_RemindFlag = x.F_RemindFlag,
76
+                        F_Remark = x.F_Remark,
77
+                        F_Telephone = x.F_Telephone,
78
+                        F_Mobile = x.F_Mobile,
79
+                        F_HomePhone = x.F_HomePhone,
80
+                        F_Birthday = x.F_Birthday,
81
+                        F_CreateOn = x.F_CreateOn,
82
+                        F_CancelOn = x.F_CancelOn,
83
+                        F_DeleteFlag = x.F_DeleteFlag,
84
+                        F_APPOnFlag = x.F_APPOnFlag,
85
+                        F_LastActiveTime = x.F_LastActiveTime,
86
+                        F_See = x.F_See,
87
+                        F_HJType = x.F_HJType,
88
+                        F_PId = x.F_PId,
89
+                        F_TmId = x.F_TmId,
90
+                        F_RoleName = x.F_RoleName,
91
+                        F_DeptName = x.F_DeptName,
92
+                        F_WorkNumber = x.F_WorkNumber,
93
+                        //F_WXNo=x.F_WXNo,
94
+                        F_SeatGroup = x.F_SeartGroup
95
+                    }),
96
+                    total = recordCount
97
+                };
98
+
99
+                res = Content(obj.ToJson());
100
+
101
+
102
+                dt.Clear();
103
+                dt.Dispose();
97
 
104
 
98
-                    res = Content(obj.ToJson());
99
-                
100
-           
101
-                    dt.Clear();
102
-                    dt.Dispose();
103
-                
104
             }
105
             }
105
             return res;
106
             return res;
106
         }
107
         }
145
                     F_Telephone = userModel.F_Telephone,
146
                     F_Telephone = userModel.F_Telephone,
146
                     F_Mobile = userModel.F_Mobile,
147
                     F_Mobile = userModel.F_Mobile,
147
                     F_HomePhone = userModel.F_HomePhone,
148
                     F_HomePhone = userModel.F_HomePhone,
148
-                    F_Birthday = (userModel.F_Birthday!=null? userModel.F_Birthday.Value.ToString("yyyy-MM-dd"):""),
149
+                    F_Birthday = (userModel.F_Birthday != null ? userModel.F_Birthday.Value.ToString("yyyy-MM-dd") : ""),
149
                     F_CreateOn = userModel.F_CreateOn,
150
                     F_CreateOn = userModel.F_CreateOn,
150
                     F_CancelOn = userModel.F_CancelOn,
151
                     F_CancelOn = userModel.F_CancelOn,
151
                     F_DeleteFlag = userModel.F_DeleteFlag,
152
                     F_DeleteFlag = userModel.F_DeleteFlag,
157
                     F_TmId = userModel.F_TmId,
158
                     F_TmId = userModel.F_TmId,
158
                     F_WorkNumber = userModel.F_WorkNumber,
159
                     F_WorkNumber = userModel.F_WorkNumber,
159
                     //F_WXNo = userModel.F_WXNo,
160
                     //F_WXNo = userModel.F_WXNo,
160
-                    F_SeatGroup=userModel.F_SeartGroup,
161
+                    F_SeatGroup = userModel.F_SeartGroup,
161
                     zxzname = zxzModel?.F_Name ?? "",
162
                     zxzname = zxzModel?.F_Name ?? "",
162
                     depname = depModel?.F_DeptName ?? ""
163
                     depname = depModel?.F_DeptName ?? ""
163
                 });
164
                 });
200
                     userAccountModel.F_RoleId = input.RoleId;
201
                     userAccountModel.F_RoleId = input.RoleId;
201
                 //if (input.GroupId != 0)
202
                 //if (input.GroupId != 0)
202
                 //    userAccountModel.F_GroupId = input.GroupId;
203
                 //    userAccountModel.F_GroupId = input.GroupId;
203
-                
204
+
204
                 userAccountModel.F_SeatFlag = input.IsSeat;
205
                 userAccountModel.F_SeatFlag = input.IsSeat;
205
                 if (input.SearRight != null)
206
                 if (input.SearRight != null)
206
                     userAccountModel.F_SeatRight = input.SearRight;
207
                     userAccountModel.F_SeatRight = input.SearRight;
251
                         res = Error("话务人员数量已超!");
252
                         res = Error("话务人员数量已超!");
252
                     }
253
                     }
253
                 }
254
                 }
254
-                else {
255
+                else
256
+                {
255
                     if (sysUserAccountBll.Add(userAccountModel) > 0)
257
                     if (sysUserAccountBll.Add(userAccountModel) > 0)
256
                         res = Success("新增成功!");
258
                         res = Success("新增成功!");
257
                     else
259
                     else
275
                 string ucode = input.Usercode.Trim();
277
                 string ucode = input.Usercode.Trim();
276
                 if (!string.IsNullOrEmpty(ucode))
278
                 if (!string.IsNullOrEmpty(ucode))
277
                 {
279
                 {
278
-                    Model.T_Sys_UserAccount uModel = new BLL.T_Sys_UserAccount().GetModel(ucode);
279
-                    if (uModel != null)
280
+                    var uModels = new BLL.T_Sys_UserAccount().GetModelList(" F_UserCode='" + ucode + "'");
281
+                    if (uModels.Count() > 1)
280
                     {
282
                     {
281
                         return Error("不能重复添加工号");
283
                         return Error("不能重复添加工号");
282
                     }
284
                     }
288
                 }
290
                 }
289
                 if (input.Username != null)
291
                 if (input.Username != null)
290
                     userAccountModel.F_UserName = input.Username.Trim();
292
                     userAccountModel.F_UserName = input.Username.Trim();
291
-                if(input.Password!=null)
293
+                if (input.Password != null)
292
                     userAccountModel.F_Password = input.Password.Trim();
294
                     userAccountModel.F_Password = input.Password.Trim();
293
                 if (input.Extno != null)
295
                 if (input.Extno != null)
294
                     userAccountModel.F_ExtensionNumber = input.Extno.Trim();
296
                     userAccountModel.F_ExtensionNumber = input.Extno.Trim();
328
 
330
 
329
                 userAccountModel.F_DeleteFlag = 0;
331
                 userAccountModel.F_DeleteFlag = 0;
330
                 if (input.HjType != null)
332
                 if (input.HjType != null)
331
-				    userAccountModel.F_HJType = input.HjType;
333
+                    userAccountModel.F_HJType = input.HjType;
332
 
334
 
333
                 if (input.IsSeat)
335
                 if (input.IsSeat)
334
                 {
336
                 {

+ 13 - 4
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerController.cs

152
                 string tel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
152
                 string tel = HttpUtility.UrlDecode(RequestString.GetQueryString("tel"));
153
                 if (!string.IsNullOrEmpty(tel))
153
                 if (!string.IsNullOrEmpty(tel))
154
                 {
154
                 {
155
-                    Model.T_Cus_CustomerBase userModel = new BLL.T_Cus_CustomerBase().GetModelList(" F_Telephone like '%" + tel + "%' or F_Mobile like '%" + tel + "%' ").Last();
156
-                    if (userModel != null)
155
+                    var userModel = new BLL.T_Cus_CustomerBase().GetModelList(" F_Telephone like '%" + tel + "%' or F_Mobile like '%" + tel + "%' ");
156
+                    if (userModel.Count() > 0)
157
                     {
157
                     {
158
-                        res = Success("获取成功", userModel);
158
+                        res = Success("获取成功", userModel.Last());
159
                     }
159
                     }
160
                     else
160
                     else
161
                     {
161
                     {
527
                         Model.T_Cus_CustomerBase model = new Model.T_Cus_CustomerBase();
527
                         Model.T_Cus_CustomerBase model = new Model.T_Cus_CustomerBase();
528
                         BLL.T_Cus_CustomerBase bll = new BLL.T_Cus_CustomerBase();
528
                         BLL.T_Cus_CustomerBase bll = new BLL.T_Cus_CustomerBase();
529
                         int count = 0;
529
                         int count = 0;
530
+                        //客户名称加入来电单位
531
+                        List<string> lddep = null;
532
+                        lddep = CacheHelper.Get("LDDep") as List<string>;
530
                         for (int i = (sheet.FirstRowNum + 1); i <= sheet.LastRowNum; i++)
533
                         for (int i = (sheet.FirstRowNum + 1); i <= sheet.LastRowNum; i++)
531
                         {
534
                         {
532
                             IRow row = sheet.GetRow(i);
535
                             IRow row = sheet.GetRow(i);
552
                             model.F_CreatedOn = DateTime.Now;
555
                             model.F_CreatedOn = DateTime.Now;
553
                             model.F_DeleteFlag = 0;
556
                             model.F_DeleteFlag = 0;
554
                             int n = bll.Add(model);
557
                             int n = bll.Add(model);
558
+
555
                             if (n > 0)
559
                             if (n > 0)
556
-                            { count++; }
560
+                            {
561
+                                count++;
562
+                                var cusindustry = dataRow[1].ToString();
563
+                                if (!lddep.Contains(cusindustry))
564
+                                    lddep.Add(cusindustry);
565
+                            }
557
                         }
566
                         }
558
                         //if (dt == null || dt.Rows.Count == 0)
567
                         //if (dt == null || dt.Rows.Count == 0)
559
                         if (dt == null || dt.Rows.Count == 0)
568
                         if (dt == null || dt.Rows.Count == 0)