Ver Código Fonte

优化卡顿慢

zhoufan 3 anos atrás
pai
commit
bf05aa7b28
20 arquivos alterados com 1740 adições e 802 exclusões
  1. 35 1
      CallCenterApi/CallCenterApi.BLL/T_Sys_AreaChildren.cs
  2. 67 4
      CallCenterApi/CallCenterApi.BLL/T_Sys_Department.cs
  3. 89 7
      CallCenterApi/CallCenterApi.BLL/T_Sys_RoleInfo.cs
  4. 71 4
      CallCenterApi/CallCenterApi.BLL/T_Sys_SeatGroup.cs
  5. 142 5
      CallCenterApi/CallCenterApi.BLL/T_Sys_UserAccount.cs
  6. 97 5
      CallCenterApi/CallCenterApi.BLL/T_Sys_WorkOFFDays.cs
  7. 221 4
      CallCenterApi/CallCenterApi.DAL/T_Sys_UserAccount.cs
  8. 6 6
      CallCenterApi/CallCenterApi.DAL/T_Sys_Users.cs
  9. 2 2
      CallCenterApi/CallCenterApi.DAL/T_Sys_WorkOFFDays.cs
  10. 6 0
      CallCenterApi/CallCenterApi.DB/CallCenterApi.DB.csproj
  11. 12 4
      CallCenterApi/CallCenterApi.DB/DbHelperSQL.cs
  12. 2 1
      CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/AppealController.cs
  13. 3 3
      CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/DepartmentController.cs
  14. 11 3
      CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/UserAccountController.cs
  15. 9 4
      CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallInScreenController.cs
  16. 13 2
      CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs
  17. 32 21
      CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/AffairsController.cs
  18. 2 1
      CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/NoticeCriticismController.cs
  19. 918 724
      CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs
  20. 2 1
      CallCenterCommon/CallCenter.Utility/RedisHelper.cs

+ 35 - 1
CallCenterApi/CallCenterApi.BLL/T_Sys_AreaChildren.cs

@@ -59,13 +59,47 @@ namespace CallCenterApi.BLL
59 59
             return dal.GetModel(F_AreaId);
60 60
         }
61 61
 
62
-        
62
+
63 63
 
64 64
         /// <summary>
65 65
         /// 获得数据列表
66 66
         /// </summary>
67 67
         public DataSet GetList(string strWhere)
68 68
         {
69
+            var dt = GetRedis();
70
+            if (dt != null)
71
+            {
72
+                var ds = new DataSet();
73
+                if (string.IsNullOrEmpty(strWhere))
74
+                {
75
+                    ds.Tables.Add(dt.Copy());
76
+                }
77
+                else
78
+                {
79
+                    var drs = dt.Select(strWhere);
80
+                    if (drs.Length > 0)
81
+                    {
82
+                        ds.Tables.Add(drs.CopyToDataTable());
83
+                    }
84
+                    else
85
+                    {
86
+                        ds.Tables.Add(new DataTable());
87
+                    }
88
+                }
89
+
90
+                return ds;
91
+            }
92
+            else
93
+            {
94
+                return dal.GetList(strWhere);
95
+            }
96
+        }
97
+
98
+        /// <summary>
99
+        /// 获得数据列表
100
+        /// </summary>
101
+        public DataSet GetListNoCache(string strWhere)
102
+        {
69 103
             return dal.GetList(strWhere);
70 104
         }
71 105
         /// <summary>

+ 67 - 4
CallCenterApi/CallCenterApi.BLL/T_Sys_Department.cs

@@ -73,6 +73,45 @@ namespace CallCenterApi.BLL
73 73
             OutRedis();
74 74
             return dal.UpdateSMS( state);
75 75
         }
76
+
77
+        /// <summary>
78
+        /// 根据部门id获取部门名称
79
+        /// </summary>
80
+        /// <param name="ids"></param>
81
+        /// <returns></returns>
82
+        public string GetDeptNames(string ids)
83
+        {
84
+            var dt = GetRedis();
85
+            if (dt != null)
86
+            {
87
+                var drs = dt.Select("F_DeptId in (" + ids + ")");
88
+                if (drs != null && drs.Length > 0)
89
+                {
90
+                    string deptname = string.Empty;
91
+                    foreach (var dr in drs)
92
+                    {
93
+                        deptname += "," + dr["F_DeptName"];
94
+                    }
95
+                    return deptname.Substring(1);
96
+                }
97
+                else
98
+                {
99
+                    return "";
100
+                }
101
+            }
102
+            else
103
+            {
104
+                var dt1 = dal.GetList("F_DeptId in (" + ids + ")").Tables[0];
105
+                string deptname = string.Empty;
106
+                foreach (DataRow dr in dt1.Rows)
107
+                {
108
+                    if (string.IsNullOrEmpty(deptname)) deptname = dr["F_DeptName"].ToString();
109
+                    else deptname += "," + dr["F_DeptName"].ToString();
110
+                }
111
+                return deptname;
112
+            }
113
+        }
114
+
76 115
         /// <summary>
77 116
         /// 得到一个对象实体
78 117
         /// </summary>
@@ -102,17 +141,41 @@ namespace CallCenterApi.BLL
102 141
         /// </summary>
103 142
         public DataSet GetList(string strWhere, string filedOrder = "")
104 143
         {
105
-            //var dt = GetRedis();
106
-            return dal.GetList(strWhere);
144
+            var dt = GetRedis();
145
+            if (dt != null)
146
+            {
147
+                var ds = new DataSet();
148
+                if (string.IsNullOrEmpty(strWhere))
149
+                {
150
+                    ds.Tables.Add(dt.Copy());
151
+                }
152
+                else
153
+                {
154
+                    var drs = dt.Select(strWhere, filedOrder);
155
+                    if (drs.Length > 0)
156
+                    {
157
+                        ds.Tables.Add(drs.CopyToDataTable());
158
+                    }
159
+                    else
160
+                    {
161
+                        ds.Tables.Add(new DataTable());
162
+                    }
163
+                }
107 164
 
165
+                return ds;
166
+            }
167
+            else
168
+            {
169
+                return dal.GetList(strWhere, filedOrder);
170
+            }
108 171
         }
109 172
 
110 173
         /// <summary>
111 174
         /// 获得数据列表
112 175
         /// </summary>
113
-        public DataSet GetListNoCache(string strWhere)
176
+        public DataSet GetListNoCache(string strWhere, string filedOrder = "")
114 177
         {
115
-            return dal.GetList(strWhere);
178
+            return dal.GetList(strWhere, filedOrder);
116 179
         }
117 180
 
118 181
         /// <summary>

+ 89 - 7
CallCenterApi/CallCenterApi.BLL/T_Sys_RoleInfo.cs

@@ -1,4 +1,5 @@
1
-using System;
1
+using CallCenter.Utility;
2
+using System;
2 3
 using System.Collections.Generic;
3 4
 using System.Data;
4 5
 using System.Linq;
@@ -29,6 +30,7 @@ namespace CallCenterApi.BLL
29 30
         /// </summary>
30 31
         public int Add(Model.T_Sys_RoleInfo model)
31 32
         {
33
+            OutRedis();
32 34
             return dal.Add(model);
33 35
         }
34 36
 
@@ -37,6 +39,7 @@ namespace CallCenterApi.BLL
37 39
         /// </summary>
38 40
         public bool Update(Model.T_Sys_RoleInfo model)
39 41
         {
42
+            OutRedis();
40 43
             return dal.Update(model);
41 44
         }
42 45
 
@@ -45,7 +48,7 @@ namespace CallCenterApi.BLL
45 48
         /// </summary>
46 49
         public bool Delete(int F_RoleId)
47 50
         {
48
-
51
+            OutRedis();
49 52
             return dal.Delete(F_RoleId);
50 53
         }
51 54
         /// <summary>
@@ -53,6 +56,7 @@ namespace CallCenterApi.BLL
53 56
         /// </summary>
54 57
         public bool DeleteList(string F_RoleIdlist)
55 58
         {
59
+            OutRedis();
56 60
             return dal.DeleteList(F_RoleIdlist);
57 61
         }
58 62
 
@@ -62,7 +66,23 @@ namespace CallCenterApi.BLL
62 66
         public Model.T_Sys_RoleInfo GetModel(int F_RoleId)
63 67
         {
64 68
 
65
-            return dal.GetModel(F_RoleId);
69
+            var dt = GetRedis();
70
+            if (dt != null)
71
+            {
72
+                var dr = dt.Select("F_RoleId=" + F_RoleId);
73
+                if (dr != null && dr.Count() > 0)
74
+                {
75
+                    return dal.DataRowToModel(dr[0]);
76
+                }
77
+                else
78
+                {
79
+                    return null;
80
+                }
81
+            }
82
+            else
83
+            {
84
+                return dal.GetModel(F_RoleId);
85
+            }
66 86
         }
67 87
 
68 88
         /// <summary>
@@ -70,7 +90,23 @@ namespace CallCenterApi.BLL
70 90
         /// </summary>
71 91
         public Model.T_Sys_RoleInfo GetModel(string F_RoleCode)
72 92
         {
73
-            return dal.GetModel(F_RoleCode);
93
+            var dt = GetRedis();
94
+            if (dt != null)
95
+            {
96
+                var dr = dt.Select("F_RoleCode='" + F_RoleCode + "'");
97
+                if (dr != null && dr.Count() > 0)
98
+                {
99
+                    return dal.DataRowToModel(dr[0]);
100
+                }
101
+                else
102
+                {
103
+                    return null;
104
+                }
105
+            }
106
+            else
107
+            {
108
+                return dal.GetModel(F_RoleCode);
109
+            }
74 110
         }
75 111
 
76 112
         /// <summary>
@@ -99,8 +135,24 @@ namespace CallCenterApi.BLL
99 135
         /// </summary>
100 136
         public List<Model.T_Sys_RoleInfo> GetModelList(string strWhere)
101 137
         {
102
-            DataSet ds = dal.GetList(strWhere);
103
-            return DataTableToList(ds.Tables[0]);
138
+            //DataSet ds = dal.GetList(strWhere);
139
+            //return DataTableToList(ds.Tables[0]);
140
+            var dt = GetRedis();
141
+            if (dt != null)
142
+            {
143
+                var dtnew = new DataTable();
144
+                var drs = dt.Select(strWhere);
145
+                if (drs.Length > 0)
146
+                {
147
+                    dtnew = drs.CopyToDataTable();
148
+                }
149
+                return DataTableToList(dtnew);
150
+            }
151
+            else
152
+            {
153
+                DataSet ds = dal.GetList(strWhere);
154
+                return DataTableToList(ds.Tables[0]);
155
+            }
104 156
         }
105 157
         /// <summary>
106 158
         /// 获得数据列表
@@ -129,7 +181,10 @@ namespace CallCenterApi.BLL
129 181
         /// </summary>
130 182
         public DataSet GetAllList()
131 183
         {
132
-            return GetList("");
184
+            //return GetList("");
185
+            var ds = new DataSet();
186
+            ds.Tables.Add(GetRedis());
187
+            return ds;
133 188
         }
134 189
 
135 190
         /// <summary>
@@ -150,6 +205,33 @@ namespace CallCenterApi.BLL
150 205
         #endregion  BasicMethod
151 206
         #region  ExtensionMethod
152 207
 
208
+        private DataTable GetRedis()
209
+        {
210
+            var strList = RedisHelper.StringGet("T_Sys_RoleInfo");
211
+            if (strList != null)
212
+            {
213
+                return strList.ToString().ToObject<DataTable>();
214
+            }
215
+            else
216
+            {
217
+                return InRedis();
218
+            }
219
+        }
220
+
221
+        private DataTable InRedis()
222
+        {
223
+            var dt = dal.GetList("").Tables[0];
224
+
225
+            RedisHelper.StringSet("T_Sys_RoleInfo", dt.ToJson(), new TimeSpan(24, 0, 0));
226
+
227
+            return dt;
228
+        }
229
+
230
+        private void OutRedis()
231
+        {
232
+            RedisHelper.KeyDelete("T_Sys_RoleInfo");
233
+        }
234
+
153 235
         #endregion  ExtensionMethod
154 236
     }
155 237
 }

+ 71 - 4
CallCenterApi/CallCenterApi.BLL/T_Sys_SeatGroup.cs

@@ -2,6 +2,9 @@
2 2
 using System.Data;
3 3
 using System.Collections.Generic;
4 4
 using CallCenterApi.Model;
5
+using CallCenter.Utility;
6
+using System.Linq;
7
+
5 8
 namespace CallCenterApi.BLL
6 9
 {
7 10
     /// <summary>
@@ -19,6 +22,7 @@ namespace CallCenterApi.BLL
19 22
         /// </summary>
20 23
         public int Add(CallCenterApi.Model.T_Sys_SeatGroup model)
21 24
         {
25
+            OutRedis();
22 26
             return dal.Add(model);
23 27
         }
24 28
 
@@ -27,6 +31,7 @@ namespace CallCenterApi.BLL
27 31
         /// </summary>
28 32
         public bool Update(CallCenterApi.Model.T_Sys_SeatGroup model)
29 33
         {
34
+            OutRedis();
30 35
             return dal.Update(model);
31 36
         }
32 37
 
@@ -35,7 +40,7 @@ namespace CallCenterApi.BLL
35 40
         /// </summary>
36 41
         public bool Delete(int F_ID)
37 42
         {
38
-
43
+            OutRedis();
39 44
             return dal.Delete(F_ID);
40 45
         }
41 46
         /// <summary>
@@ -43,6 +48,7 @@ namespace CallCenterApi.BLL
43 48
         /// </summary>
44 49
         public bool DeleteList(string F_IDlist)
45 50
         {
51
+            OutRedis();
46 52
             return dal.DeleteList(F_IDlist);
47 53
         }
48 54
 
@@ -51,8 +57,23 @@ namespace CallCenterApi.BLL
51 57
         /// </summary>
52 58
         public CallCenterApi.Model.T_Sys_SeatGroup GetModel(int F_ID)
53 59
         {
54
-
55
-            return dal.GetModel(F_ID);
60
+            var dt = GetRedis();
61
+            if (dt != null)
62
+            {
63
+                var dr = dt.Select("F_ID=" + F_ID);
64
+                if (dr != null && dr.Count() > 0)
65
+                {
66
+                    return dal.DataRowToModel(dr[0]);
67
+                }
68
+                else
69
+                {
70
+                    return null;
71
+                }
72
+            }
73
+            else
74
+            {
75
+                return dal.GetModel(F_ID);
76
+            }
56 77
         }
57 78
 
58 79
         /// <summary>
@@ -60,7 +81,26 @@ namespace CallCenterApi.BLL
60 81
         /// </summary>
61 82
         public DataSet GetList(string strWhere)
62 83
         {
63
-            return dal.GetList(strWhere);
84
+            //return dal.GetList(strWhere);
85
+
86
+            var dt = GetRedis();
87
+            if (dt != null)
88
+            {
89
+                var dtnew = new DataTable();
90
+                var drs = dt.Select(strWhere);
91
+                if (drs.Length > 0)
92
+                {
93
+                    dtnew = drs.CopyToDataTable();
94
+                }
95
+                var ds = new DataSet();
96
+                ds.Tables.Add(dtnew);
97
+                return ds;
98
+            }
99
+            else
100
+            {
101
+                DataSet ds = dal.GetList(strWhere);
102
+                return ds;
103
+            }
64 104
         }
65 105
         /// <summary>
66 106
         /// 获得前几行数据
@@ -132,6 +172,33 @@ namespace CallCenterApi.BLL
132 172
         #endregion  BasicMethod
133 173
         #region  ExtensionMethod
134 174
 
175
+        private DataTable GetRedis()
176
+        {
177
+            var strList = RedisHelper.StringGet("T_Sys_SeatGroup");
178
+            if (strList != null)
179
+            {
180
+                return strList.ToString().ToObject<DataTable>();
181
+            }
182
+            else
183
+            {
184
+                return InRedis();
185
+            }
186
+        }
187
+
188
+        private DataTable InRedis()
189
+        {
190
+            var dt = dal.GetList("").Tables[0];
191
+
192
+            RedisHelper.StringSet("T_Sys_SeatGroup", dt.ToJson(), new TimeSpan(24, 0, 0));
193
+
194
+            return dt;
195
+        }
196
+
197
+        private void OutRedis()
198
+        {
199
+            RedisHelper.KeyDelete("T_Sys_SeatGroup");
200
+        }
201
+
135 202
         #endregion  ExtensionMethod
136 203
     }
137 204
 }

+ 142 - 5
CallCenterApi/CallCenterApi.BLL/T_Sys_UserAccount.cs

@@ -77,6 +77,38 @@ namespace CallCenterApi.BLL
77 77
             OutRedis();
78 78
             return dal.DeleteList(F_UserIdlist, state);
79 79
         }
80
+
81
+        /// <summary>
82
+        /// 根据用户code获取用户名称
83
+        /// </summary>
84
+        /// <param name="code"></param>
85
+        /// <returns></returns>
86
+        public string GetUserName(string code)
87
+        {
88
+            var dt = GetRedis();
89
+            if (dt != null)
90
+            {
91
+                var drs = dt.Select("F_UserCode = '" + code + "'");
92
+                if (drs != null && drs.Length > 0)
93
+                {
94
+                    return drs[0]["F_UserName"].ToString();
95
+                }
96
+                else
97
+                {
98
+                    return "";
99
+                }
100
+            }
101
+            else
102
+            {
103
+                var dt1 = dal.GetList("F_UserCode = '" + code + "'").Tables[0];
104
+                if (dt1.Rows.Count > 0)
105
+                {
106
+                    return dt1.Rows[0]["F_UserName"].ToString();
107
+                }
108
+                return "";
109
+            }
110
+        }
111
+
80 112
         /// <summary>
81 113
         /// 得到一个对象实体
82 114
         /// </summary>
@@ -89,7 +121,30 @@ namespace CallCenterApi.BLL
89 121
                 var dr = dt.Select("F_UserId=" + F_UserId);
90 122
                 if (dr != null && dr.Count() > 0)
91 123
                 {
92
-                    return dal.DataRowToModel(dr[0]);
124
+                    var model = dal.DataRowToModel2(dr[0]);
125
+                    if (model.F_DeptId > 0)
126
+                    {
127
+                        model.depname = new T_Sys_Department().GetModel(model.F_DeptId)?.F_DeptName ?? "";
128
+                    }
129
+                    if (model.F_RoleId > 0)
130
+                    {
131
+                        var role = new T_Sys_RoleInfo().GetModel(model.F_RoleId);
132
+                        if (role != null)
133
+                        {
134
+                            model.rolname = role.F_RoleName;
135
+                            model.F_RoleCode = role.F_RoleCode;
136
+                        }
137
+                    }
138
+                    if (!string.IsNullOrEmpty(model.F_SeartGroupCode))
139
+                    {
140
+                        var group = new T_Sys_SeatGroup().GetList("F_ZXZCode='" + model.F_SeartGroupCode + "' ").Tables[0];
141
+                        if (group != null && group.Rows.Count > 0)
142
+                        {
143
+                            model.zxzname = group.Rows[0]["F_ZXZName"] != null ? group.Rows[0]["F_ZXZName"].ToString() : "";
144
+                        }
145
+                    }
146
+
147
+                    return model;
93 148
                 }
94 149
                 else
95 150
                 {
@@ -114,7 +169,30 @@ namespace CallCenterApi.BLL
114 169
                 var dr = dt.Select("F_UserCode='" + F_UserCode + "'");
115 170
                 if (dr != null && dr.Count() > 0)
116 171
                 {
117
-                    return dal.DataRowToModel(dr[0]);
172
+                    var model = dal.DataRowToModel2(dr[0]);
173
+                    if (model.F_DeptId > 0)
174
+                    {
175
+                        model.depname = new T_Sys_Department().GetModel(model.F_DeptId)?.F_DeptName ?? "";
176
+                    }
177
+                    if (model.F_RoleId > 0)
178
+                    {
179
+                        var role = new T_Sys_RoleInfo().GetModel(model.F_RoleId);
180
+                        if (role != null)
181
+                        {
182
+                            model.rolname = role.F_RoleName;
183
+                            model.F_RoleCode = role.F_RoleCode;
184
+                        }
185
+                    }
186
+                    if (!string.IsNullOrEmpty(model.F_SeartGroupCode))
187
+                    {
188
+                        var group = new T_Sys_SeatGroup().GetList("F_ZXZCode='" + model.F_SeartGroupCode + "' ").Tables[0];
189
+                        if (group != null && group.Rows.Count > 0)
190
+                        {
191
+                            model.zxzname = group.Rows[0]["F_ZXZName"] != null ? group.Rows[0]["F_ZXZName"].ToString() : "";
192
+                        }
193
+                    }
194
+
195
+                    return model;
118 196
                 }
119 197
                 else
120 198
                 {
@@ -168,13 +246,47 @@ namespace CallCenterApi.BLL
168 246
         //    return (Model.T_Sys_UserAccount)objModel;
169 247
         //}
170 248
 
249
+        ///// <summary>
250
+        ///// 获得数据列表
251
+        ///// </summary>
252
+        //public DataSet GetList(string strWhere, string filedOrder = "")
253
+        //{
254
+        //    return dal.GetList(strWhere, filedOrder);
255
+        //    //  return dal.GetList(strWhere, filedOrder);
256
+        //}
257
+
171 258
         /// <summary>
172 259
         /// 获得数据列表
173 260
         /// </summary>
174 261
         public DataSet GetList(string strWhere, string filedOrder = "")
175 262
         {
176
-            return dal.GetList(strWhere, filedOrder);
177
-            //  return dal.GetList(strWhere, filedOrder);
263
+            var dt = GetRedis();
264
+            if (dt != null)
265
+            {
266
+                var ds = new DataSet();
267
+                if (string.IsNullOrEmpty(strWhere))
268
+                {
269
+                    ds.Tables.Add(dt.Copy());
270
+                }
271
+                else
272
+                {
273
+                    var drs = dt.Select(strWhere, filedOrder);
274
+                    if (drs.Length > 0)
275
+                    {
276
+                        ds.Tables.Add(drs.CopyToDataTable());
277
+                    }
278
+                    else
279
+                    {
280
+                        ds.Tables.Add(new DataTable());
281
+                    }
282
+                }
283
+
284
+                return ds;
285
+            }
286
+            else
287
+            {
288
+                return dal.GetList(strWhere, filedOrder);
289
+            }
178 290
         }
179 291
 
180 292
         /// <summary>
@@ -246,12 +358,37 @@ namespace CallCenterApi.BLL
246 358
             int rowsCount = dt.Rows.Count;
247 359
             if (rowsCount > 0)
248 360
             {
361
+                var deptbll = new T_Sys_Department();
362
+                var rolebll = new T_Sys_RoleInfo();
363
+                var seatbll = new T_Sys_SeatGroup();
364
+
249 365
                 Model.T_Sys_UserAccount model;
250 366
                 for (int n = 0; n < rowsCount; n++)
251 367
                 {
252
-                    model = dal.DataRowToModel(dt.Rows[n]);
368
+                    model = dal.DataRowToModel2(dt.Rows[n]);
253 369
                     if (model != null)
254 370
                     {
371
+                        if (model.F_DeptId > 0)
372
+                        {
373
+                            model.depname = deptbll.GetModel(model.F_DeptId)?.F_DeptName ?? "";
374
+                        }
375
+                        if (model.F_RoleId > 0)
376
+                        {
377
+                            var role = rolebll.GetModel(model.F_RoleId);
378
+                            if (role != null)
379
+                            {
380
+                                model.rolname = role.F_RoleName;
381
+                                model.F_RoleCode = role.F_RoleCode;
382
+                            }
383
+                        }
384
+                        if (!string.IsNullOrEmpty(model.F_SeartGroupCode))
385
+                        {
386
+                            var group = seatbll.GetList("F_ZXZCode='" + model.F_SeartGroupCode + "' ").Tables[0];
387
+                            if (group != null && group.Rows.Count > 0)
388
+                            {
389
+                                model.zxzname = group.Rows[0]["F_ZXZName"] != null ? group.Rows[0]["F_ZXZName"].ToString() : "";
390
+                            }
391
+                        }
255 392
                         modelList.Add(model);
256 393
                     }
257 394
                 }

+ 97 - 5
CallCenterApi/CallCenterApi.BLL/T_Sys_WorkOFFDays.cs

@@ -1,4 +1,5 @@
1
-using System;
1
+using CallCenter.Utility;
2
+using System;
2 3
 using System.Collections.Generic;
3 4
 using System.Data;
4 5
 using System.Linq;
@@ -22,6 +23,7 @@ namespace CallCenterApi.BLL
22 23
         /// </summary>
23 24
         public int Add(CallCenterApi.Model.T_Sys_WorkOFFDays model)
24 25
         {
26
+            OutRedis();
25 27
             return dal.Add(model);
26 28
         }
27 29
 
@@ -30,10 +32,12 @@ namespace CallCenterApi.BLL
30 32
         /// </summary>
31 33
         public bool Update(CallCenterApi.Model.T_Sys_WorkOFFDays model)
32 34
         {
35
+            OutRedis();
33 36
             return dal.Update(model);
34 37
         }
35 38
         public bool UpdateState(CallCenterApi.Model.T_Sys_WorkOFFDays model)
36 39
         {
40
+            OutRedis();
37 41
             return dal.UpdateState(model);
38 42
         }
39 43
 
@@ -42,11 +46,12 @@ namespace CallCenterApi.BLL
42 46
         /// </summary>
43 47
         public bool Delete(int F_OffID)
44 48
         {
45
-
49
+            OutRedis();
46 50
             return dal.Delete(F_OffID);
47 51
         }
48 52
         public bool DeleteByDate(string date, string usercode, DateTime nowdate)
49 53
         {
54
+            OutRedis();
50 55
             return dal.DeleteByDate(date, usercode,nowdate);
51 56
         }
52 57
         /// <summary>
@@ -54,6 +59,7 @@ namespace CallCenterApi.BLL
54 59
         /// </summary>
55 60
         public bool DeleteList(string F_OffIDlist)
56 61
         {
62
+            OutRedis();
57 63
             return dal.DeleteList(F_OffIDlist);
58 64
         }
59 65
 
@@ -62,13 +68,70 @@ namespace CallCenterApi.BLL
62 68
         /// </summary>
63 69
         public CallCenterApi.Model.T_Sys_WorkOFFDays GetModel(int F_OffID)
64 70
         {
65
-
66
-            return dal.GetModel(F_OffID);
71
+            var dt = GetRedis();
72
+            if (dt != null)
73
+            {
74
+                var dr = dt.Select("F_OffID=" + F_OffID);
75
+                if (dr != null && dr.Count() > 0)
76
+                {
77
+                    return dal.DataRowToModel(dr[0]);
78
+                }
79
+                else
80
+                {
81
+                    return null;
82
+                }
83
+            }
84
+            else
85
+            {
86
+                return dal.GetModel(F_OffID);
87
+            }
67 88
         }
68 89
         public CallCenterApi.Model.T_Sys_WorkOFFDays GetModel(string date)
69 90
         {
91
+            var dt = GetRedis();
92
+            if (dt != null)
93
+            {
94
+                var dr = dt.Select("F_OffDate='" + date + "'");
95
+                if (dr != null && dr.Count() > 0)
96
+                {
97
+                    return dal.DataRowToModel(dr[0]);
98
+                }
99
+                else
100
+                {
101
+                    return null;
102
+                }
103
+            }
104
+            else
105
+            {
106
+                return dal.GetModel(date);
107
+            }
108
+        }
70 109
 
71
-            return dal.GetModel(date);
110
+        /// <summary>
111
+        /// 获取工作日天数
112
+        /// </summary>
113
+        /// <param name="startdate"></param>
114
+        /// <param name="enddate"></param>
115
+        /// <returns></returns>
116
+        public int GetDays(string strWhere)
117
+        {
118
+            var dt = GetRedis();
119
+            if (dt != null)
120
+            {
121
+                var dr = dt.Select(strWhere);
122
+                if (dr != null && dr.Count() > 0)
123
+                {
124
+                    return dr.Count();
125
+                }
126
+                else
127
+                {
128
+                    return 0;
129
+                }
130
+            }
131
+            else
132
+            {
133
+                return dal.GetRecordCount(strWhere);
134
+            }
72 135
         }
73 136
 
74 137
         /// <summary>
@@ -168,5 +231,34 @@ namespace CallCenterApi.BLL
168 231
         }
169 232
 
170 233
         #endregion  Method
234
+
235
+        private DataTable GetRedis()
236
+        {
237
+            var strList = RedisHelper.StringGet("T_Sys_WorkOFFDays");
238
+            if (strList != null)
239
+            {
240
+                return strList.ToString().ToObject<DataTable>();
241
+            }
242
+            else
243
+            {
244
+                return InRedis();
245
+            }
246
+        }
247
+
248
+        private DataTable InRedis()
249
+        {
250
+            var startdate = "2022-01-01";
251
+            var enddate = DateTime.Now.AddYears(+1).ToString("yyyy") + "-12-31";
252
+            var dt = dal.GetList("F_OffDate>'"+ startdate + "' and F_OffDate<'"+ enddate + "'").Tables[0];
253
+
254
+            RedisHelper.StringSet("T_Sys_WorkOFFDays", dt.ToJson(), new TimeSpan(24, 0, 0));
255
+
256
+            return dt;
257
+        }
258
+
259
+        private void OutRedis()
260
+        {
261
+            RedisHelper.KeyDelete("T_Sys_WorkOFFDays");
262
+        }
171 263
     }
172 264
 }

+ 221 - 4
CallCenterApi/CallCenterApi.DAL/T_Sys_UserAccount.cs

@@ -530,11 +530,14 @@ namespace CallCenterApi.DAL
530 530
                     {
531 531
                         model.F_RoleId = int.Parse(row["F_RoleId"].ToString());
532 532
 
533
-                        var role = new DAL.T_Sys_RoleInfo().GetModel(model.F_RoleId);
534
-                        if (role != null)
533
+                        if (model.F_RoleId > 0)
535 534
                         {
536
-                            model.rolname = role.F_RoleName;
537
-                            model.F_RoleCode = role.F_RoleCode;
535
+                            var role = new DAL.T_Sys_RoleInfo().GetModel(model.F_RoleId);
536
+                            if (role != null)
537
+                            {
538
+                                model.rolname = role.F_RoleName;
539
+                                model.F_RoleCode = role.F_RoleCode;
540
+                            }
538 541
                         }
539 542
                     }
540 543
 
@@ -754,6 +757,220 @@ namespace CallCenterApi.DAL
754 757
         }
755 758
 
756 759
         /// <summary>
760
+        /// 得到一个对象实体
761
+        /// </summary>
762
+        public Model.T_Sys_UserAccount DataRowToModel2(DataRow row)
763
+        {
764
+            Model.T_Sys_UserAccount model = new Model.T_Sys_UserAccount();
765
+            try
766
+            {
767
+                if (row != null)
768
+                {
769
+                    if (row["F_UserId"] != null && row["F_UserId"].ToString() != "")
770
+                    {
771
+                        model.F_UserId = int.Parse(row["F_UserId"].ToString());
772
+                    }
773
+                    if (row["F_UserCode"] != null)
774
+                    {
775
+                        model.F_UserCode = row["F_UserCode"].ToString();
776
+                    }
777
+                    if (row["F_Password"] != null)
778
+                    {
779
+                        model.F_Password = row["F_Password"].ToString();
780
+                    }
781
+                    if (row["F_ExtensionNumber"] != null)
782
+                    {
783
+                        model.F_ExtensionNumber = row["F_ExtensionNumber"].ToString();
784
+                    }
785
+                    if (row["F_UserName"] != null)
786
+                    {
787
+                        model.F_UserName = row["F_UserName"].ToString();
788
+                    }
789
+                    if (row["F_DeptId"] != null && row["F_DeptId"].ToString() != "")
790
+                    {
791
+                        model.F_DeptId = int.Parse(row["F_DeptId"].ToString());
792
+                    }
793
+                    if (row["F_RoleCode"] != null)
794
+                    {
795
+                        model.F_RoleCode = row["F_RoleCode"].ToString();
796
+                    }
797
+                    if (row["F_RoleId"] != null && row["F_RoleId"].ToString() != "")
798
+                    {
799
+                        model.F_RoleId = int.Parse(row["F_RoleId"].ToString());
800
+                    }
801
+
802
+                    if (row["F_GroupId"] != null && row["F_GroupId"].ToString() != "")
803
+                    {
804
+                        model.F_GroupId = int.Parse(row["F_GroupId"].ToString());
805
+                    }
806
+                    if (row["F_SeartGroupID"] != null && row["F_SeartGroupID"].ToString() != "")
807
+                    {
808
+                        model.F_SeartGroupID = int.Parse(row["F_SeartGroupID"].ToString());
809
+                    }
810
+
811
+                    if (row["F_SeatFlag"] != null && row["F_SeatFlag"].ToString() != "")
812
+                    {
813
+                        if ((row["F_SeatFlag"].ToString() == "1") || (row["F_SeatFlag"].ToString().ToLower() == "true"))
814
+                        {
815
+                            model.F_SeatFlag = true;
816
+                        }
817
+                        else
818
+                        {
819
+                            model.F_SeatFlag = false;
820
+                        }
821
+                    }
822
+                    if (row["F_SeatRight"] != null)
823
+                    {
824
+                        model.F_SeatRight = row["F_SeatRight"].ToString();
825
+                    }
826
+                    if (row["F_SeatLevel"] != null)
827
+                    {
828
+                        model.F_SeatLevel = row["F_SeatLevel"].ToString();
829
+                    }
830
+                    if (row["F_SexFlag"] != null)
831
+                    {
832
+                        model.F_SexFlag = row["F_SexFlag"].ToString();
833
+                    }
834
+                    if (row["F_RemindFlag"] != null && row["F_RemindFlag"].ToString() != "")
835
+                    {
836
+                        if ((row["F_RemindFlag"].ToString() == "1") || (row["F_RemindFlag"].ToString().ToLower() == "true"))
837
+                        {
838
+                            model.F_RemindFlag = true;
839
+                        }
840
+                        else
841
+                        {
842
+                            model.F_RemindFlag = false;
843
+                        }
844
+                    }
845
+                    if (row["F_Remark"] != null)
846
+                    {
847
+                        model.F_Remark = row["F_Remark"].ToString();
848
+                    }
849
+                    if (row["F_Telephone"] != null)
850
+                    {
851
+                        model.F_Telephone = row["F_Telephone"].ToString();
852
+                    }
853
+                    if (row["F_Mobile"] != null)
854
+                    {
855
+                        model.F_Mobile = row["F_Mobile"].ToString();
856
+                    }
857
+                    if (row["F_HomePhone"] != null)
858
+                    {
859
+                        model.F_HomePhone = row["F_HomePhone"].ToString();
860
+                    }
861
+                    if (row["F_Birthday"] != null && row["F_Birthday"].ToString() != "")
862
+                    {
863
+                        model.F_Birthday = DateTime.Parse(row["F_Birthday"].ToString());
864
+                    }
865
+                    if (row["F_CreateOn"] != null && row["F_CreateOn"].ToString() != "")
866
+                    {
867
+                        model.F_CreateOn = DateTime.Parse(row["F_CreateOn"].ToString());
868
+                    }
869
+                    if (row["F_CancelOn"] != null && row["F_CancelOn"].ToString() != "")
870
+                    {
871
+                        model.F_CancelOn = DateTime.Parse(row["F_CancelOn"].ToString());
872
+                    }
873
+                    if (row["F_DeleteFlag"] != null && row["F_DeleteFlag"].ToString() != "")
874
+                    {
875
+                        model.F_DeleteFlag = int.Parse(row["F_DeleteFlag"].ToString());
876
+                    }
877
+                    if (row["F_APPOnFlag"] != null && row["F_APPOnFlag"].ToString() != "")
878
+                    {
879
+                        if ((row["F_APPOnFlag"].ToString() == "1") || (row["F_APPOnFlag"].ToString().ToLower() == "true"))
880
+                        {
881
+                            model.F_APPOnFlag = true;
882
+                        }
883
+                        else
884
+                        {
885
+                            model.F_APPOnFlag = false;
886
+                        }
887
+                    }
888
+                    if (row["F_LastActiveTime"] != null && row["F_LastActiveTime"].ToString() != "")
889
+                    {
890
+                        model.F_LastActiveTime = DateTime.Parse(row["F_LastActiveTime"].ToString());
891
+                    }
892
+                    if (row["F_ModifytTime"] != null && row["F_ModifytTime"].ToString() != "")
893
+                    {
894
+                        model.F_ModifytTime = DateTime.Parse(row["F_ModifytTime"].ToString());
895
+                    }
896
+
897
+                    if (row["F_See"] != null)
898
+                    {
899
+                        model.F_See = row["F_See"].ToString();
900
+                    }
901
+                    if (row["F_HJType"] != null && row["F_HJType"].ToString() != "")
902
+                    {
903
+                        model.F_HJType = int.Parse(row["F_HJType"].ToString());
904
+                    }
905
+                    if (row["F_PId"] != null && row["F_PId"].ToString() != "")
906
+                    {
907
+                        model.F_PId = int.Parse(row["F_PId"].ToString());
908
+                    }
909
+                    if (row["F_TmId"] != null && row["F_TmId"].ToString() != "")
910
+                    {
911
+                        model.F_TmId = int.Parse(row["F_TmId"].ToString());
912
+                    }
913
+                    if (row["F_IsSms"] != null && row["F_IsSms"].ToString() != "")
914
+                    {
915
+                        model.F_IsSms = int.Parse(row["F_IsSms"].ToString());
916
+                    }
917
+
918
+                    if (row["F_WorkNumber"] != null)
919
+                    {
920
+                        model.F_WorkNumber = row["F_WorkNumber"].ToString();
921
+                    }
922
+                    if (row["F_DeptCode"] != null)
923
+                    {
924
+                        model.F_DeptCode = row["F_DeptCode"].ToString();
925
+                    }
926
+                    if (row["F_WXNo"] != null)
927
+                    {
928
+                        model.F_WXNo = row["F_WXNo"].ToString();
929
+                    }
930
+                    if (row["F_SeartGroupCode"] != null)
931
+                    {
932
+                        model.F_SeartGroupCode = row["F_SeartGroupCode"].ToString();
933
+                    }
934
+                    model.F_WxOpenId = row["F_WxOpenId"] == DBNull.Value ? "" : row["F_WxOpenId"].ToString();
935
+                    if (row["F_ClassCode"] != null)
936
+                    {
937
+                        model.F_ClassCode = row["F_ClassCode"].ToString();
938
+                    }
939
+                    if (row["F_GroupCode"] != null)
940
+                    {
941
+                        model.F_GroupCode = row["F_GroupCode"].ToString();
942
+                    }
943
+                    if (row["F_Post"] != null)
944
+                    {
945
+                        model.F_Post = row["F_Post"].ToString();
946
+                    }
947
+                    if (row["F_Name"] != null)
948
+                    {
949
+                        model.F_Name = row["F_Name"].ToString();
950
+                    }
951
+                    if (row["F_Company"] != null)
952
+                    {
953
+                        model.F_Company = row["F_Company"].ToString();
954
+                    }
955
+                    if (row["F_Department"] != null)
956
+                    {
957
+                        model.F_Department = row["F_Department"].ToString();
958
+                    }
959
+
960
+                }
961
+            }
962
+            catch (Exception e)
963
+            {
964
+
965
+
966
+            }
967
+
968
+
969
+
970
+            return model;
971
+        }
972
+
973
+        /// <summary>
757 974
         /// 获得数据列表
758 975
         /// </summary>
759 976
         public DataSet GetList(string strWhere, string filedOrder = "")

+ 6 - 6
CallCenterApi/CallCenterApi.DAL/T_Sys_Users.cs

@@ -188,7 +188,7 @@ namespace CallCenterApi.DAL
188 188
         {
189 189
 
190 190
             StringBuilder strSql = new StringBuilder();
191
-            strSql.Append("select  top 1 F_Id,F_OpenId,F_CreateTime,F_Type,F_Password,F_Name,F_Telphone,F_Sex,F_Province,F_City,F_County,F_Address,F_ImgUrl from T_Sys_Users ");
191
+            strSql.Append("select  top 1 F_Id,F_OpenId,F_CreateTime,F_Type,F_Password,F_Name,F_Telphone,F_Sex,F_Province,F_City,F_County,F_Address,F_ImgUrl from T_Sys_Users with(nolock)");
192 192
             strSql.Append(" where F_OpenId=@F_OpenId");
193 193
             SqlParameter[] parameters = {
194 194
                     new SqlParameter("@F_OpenId", SqlDbType.VarChar,100)
@@ -214,7 +214,7 @@ namespace CallCenterApi.DAL
214 214
         {
215 215
 
216 216
             StringBuilder strSql = new StringBuilder();
217
-            strSql.Append("select  top 1 F_Id,F_OpenId,F_CreateTime,F_Type,F_Password,F_Name,F_Telphone,F_Sex,F_Province,F_City,F_County,F_Address,F_ImgUrl from T_Sys_Users ");
217
+            strSql.Append("select  top 1 F_Id,F_OpenId,F_CreateTime,F_Type,F_Password,F_Name,F_Telphone,F_Sex,F_Province,F_City,F_County,F_Address,F_ImgUrl from T_Sys_Users with(nolock)");
218 218
             strSql.Append(" where F_Id=@F_Id");
219 219
             SqlParameter[] parameters = {
220 220
                     new SqlParameter("@F_Id", SqlDbType.BigInt)
@@ -305,7 +305,7 @@ namespace CallCenterApi.DAL
305 305
         {
306 306
             StringBuilder strSql = new StringBuilder();
307 307
             strSql.Append("select F_Id,F_OpenId,F_CreateTime,F_Type,F_Password,F_Name,F_Telphone,F_Sex,F_Province,F_City,F_County,F_Address,F_ImgUrl ");
308
-            strSql.Append(" FROM T_Sys_Users ");
308
+            strSql.Append(" FROM T_Sys_Users with(nolock)");
309 309
             if (strWhere.Trim() != "")
310 310
             {
311 311
                 strSql.Append(" where " + strWhere);
@@ -325,7 +325,7 @@ namespace CallCenterApi.DAL
325 325
                 strSql.Append(" top " + Top.ToString());
326 326
             }
327 327
             strSql.Append(" F_Id,F_OpenId,F_CreateTime,F_Type,F_Password,F_Name,F_Telphone,F_Sex,F_Province,F_City,F_County,F_Address,F_ImgUrl ");
328
-            strSql.Append(" FROM T_Sys_Users ");
328
+            strSql.Append(" FROM T_Sys_Users with(nolock)");
329 329
             if (strWhere.Trim() != "")
330 330
             {
331 331
                 strSql.Append(" where " + strWhere);
@@ -340,7 +340,7 @@ namespace CallCenterApi.DAL
340 340
         public int GetRecordCount(string strWhere)
341 341
         {
342 342
             StringBuilder strSql = new StringBuilder();
343
-            strSql.Append("select count(1) FROM T_Sys_Users ");
343
+            strSql.Append("select count(1) FROM T_Sys_Users with(nolock)");
344 344
             if (strWhere.Trim() != "")
345 345
             {
346 346
                 strSql.Append(" where " + strWhere);
@@ -371,7 +371,7 @@ namespace CallCenterApi.DAL
371 371
             {
372 372
                 strSql.Append("order by T.F_Id desc");
373 373
             }
374
-            strSql.Append(")AS Row, T.*  from T_Sys_Users T ");
374
+            strSql.Append(")AS Row, T.*  from T_Sys_Users T with(nolock)");
375 375
             if (!string.IsNullOrEmpty(strWhere.Trim()))
376 376
             {
377 377
                 strSql.Append(" WHERE " + strWhere);

+ 2 - 2
CallCenterApi/CallCenterApi.DAL/T_Sys_WorkOFFDays.cs

@@ -307,7 +307,7 @@ namespace CallCenterApi.DAL
307 307
         {
308 308
             StringBuilder strSql = new StringBuilder();
309 309
             strSql.Append("select * ");
310
-            strSql.Append(" FROM T_Sys_WorkOFFDays ");
310
+            strSql.Append(" FROM T_Sys_WorkOFFDays with(nolock)");
311 311
             if (strWhere.Trim() != "")
312 312
             {
313 313
                 strSql.Append(" where " + strWhere);
@@ -342,7 +342,7 @@ namespace CallCenterApi.DAL
342 342
         public int GetRecordCount(string strWhere)
343 343
         {
344 344
             StringBuilder strSql = new StringBuilder();
345
-            strSql.Append("select count(1) FROM T_Sys_WorkOFFDays ");
345
+            strSql.Append("select count(1) FROM T_Sys_WorkOFFDays with(nolock)");
346 346
             if (strWhere.Trim() != "")
347 347
             {
348 348
                 strSql.Append(" where " + strWhere);

+ 6 - 0
CallCenterApi/CallCenterApi.DB/CallCenterApi.DB.csproj

@@ -49,6 +49,12 @@
49 49
   <ItemGroup>
50 50
     <WCFMetadata Include="Connected Services\" />
51 51
   </ItemGroup>
52
+  <ItemGroup>
53
+    <ProjectReference Include="..\..\CallCenterCommon\CallCenter.Utility\CallCenter.Utility.csproj">
54
+      <Project>{4DA219CC-911E-4C81-BB0B-DF5183FD50FF}</Project>
55
+      <Name>CallCenter.Utility</Name>
56
+    </ProjectReference>
57
+  </ItemGroup>
52 58
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
53 59
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
54 60
        Other similar extension points exist, see Microsoft.Common.targets.

+ 12 - 4
CallCenterApi/CallCenterApi.DB/DbHelperSQL.cs

@@ -1,4 +1,5 @@
1
-using System;
1
+using CallCenter.Utility;
2
+using System;
2 3
 using System.Collections;
3 4
 using System.Collections.Generic;
4 5
 using System.Configuration;
@@ -15,6 +16,7 @@ namespace CallCenterApi.DB
15 16
     {
16 17
         //数据库连接字符串(web.config来配置),可以动态更改connectionString支持多数据库.		
17 18
         public static string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
19
+        public static Log log = LogFactory.GetLogger("DbHelperSQL");
18 20
         public DbHelperSQL() { }
19 21
 
20 22
         #region 公用方法
@@ -172,6 +174,8 @@ namespace CallCenterApi.DB
172 174
                     }
173 175
                     catch (System.Data.SqlClient.SqlException e)
174 176
                     {
177
+                        log.Error(SQLString , e);
178
+
175 179
                         connection.Close();
176 180
                         throw e;
177 181
                     }
@@ -506,6 +510,7 @@ namespace CallCenterApi.DB
506 510
                     }
507 511
                     catch (System.Data.SqlClient.SqlException e)
508 512
                     {
513
+                        log.Error(SQLString , e);
509 514
                         connection.Close();
510 515
                         throw e;
511 516
                     }
@@ -591,6 +596,7 @@ namespace CallCenterApi.DB
591 596
                 }
592 597
                 catch (System.Data.SqlClient.SqlException ex)
593 598
                 {
599
+                    log.Error(SQLString , ex);
594 600
                     throw new Exception(ex.Message);
595 601
                 }
596 602
                 return ds;
@@ -683,7 +689,7 @@ namespace CallCenterApi.DB
683 689
                     }
684 690
                     catch (System.Data.SqlClient.SqlException e)
685 691
                     {
686
-                        
692
+                        log.Error(SQLString + "|" + cmdParms.ToDictionary(p => p.ParameterName, p => p.Value?.ToString() ?? "").ToJson(), e);
687 693
                         //throw e;
688 694
                     }
689 695
                     return 0;
@@ -950,8 +956,9 @@ namespace CallCenterApi.DB
950 956
                     }
951 957
                     catch (System.Data.SqlClient.SqlException e)
952 958
                     {
953
-                        return e.Message;
954
-                        //   throw e;
959
+                        log.Error(SQLString + "|" + cmdParms.ToDictionary(p => p.ParameterName, p => p.Value?.ToString() ?? "").ToJson(), e);
960
+
961
+                        throw e;
955 962
                     }
956 963
                 }
957 964
             }
@@ -1039,6 +1046,7 @@ namespace CallCenterApi.DB
1039 1046
                     }
1040 1047
                     catch (System.Data.SqlClient.SqlException ex)
1041 1048
                     {
1049
+                        log.Error(SQLString + "|" + cmdParms.ToDictionary(p => p.ParameterName, p => p.Value?.ToString() ?? "").ToJson(), ex);
1042 1050
                         throw new Exception(ex.Message);
1043 1051
                     }
1044 1052
                     return ds;

+ 2 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/AppealController.cs

@@ -196,7 +196,8 @@ namespace CallCenterApi.Interface.Controllers
196 196
                 string NoticeDeptName = "";
197 197
                 if (dt.Rows[0]["F_DeptIds"] != null && dt.Rows[0]["F_DeptIds"].ToString() != "")
198 198
                 {
199
-                    NoticeDeptName = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dt.Rows[0]["F_DeptIds"].ToString() + "')").ToString();
199
+                    //NoticeDeptName = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dt.Rows[0]["F_DeptIds"].ToString() + "')").ToString();
200
+                    NoticeDeptName = new BLL.T_Sys_Department().GetDeptNames(dt.Rows[0]["F_DeptIds"].ToString());
200 201
                 }
201 202
                 var configfj = configBll.GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
202 203
                 if (configfj != null)

+ 3 - 3
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/DepartmentController.cs

@@ -55,7 +55,7 @@ namespace CallCenterApi.Interface.Controllers
55 55
                 if (iscbdw == 0)
56 56
                 {
57 57
                     
58
-                    dt = departmentBLL.GetList("F_State=0  and (  F_PartentId='" + User.F_DeptId + "' or  EXISTS (select 1 from dbo.SplitToNvarchar(F_Remark, ',') a join" +
58
+                    dt = departmentBLL.GetListNoCache("F_State=0  and (  F_PartentId='" + User.F_DeptId + "' or  EXISTS (select 1 from dbo.SplitToNvarchar(F_Remark, ',') a join" +
59 59
                         "  dbo.SplitToNvarchar((select F_Remark from T_Sys_Department  where F_DeptId = '" + User.F_DeptId + "'), ',') b on a.col = b.col) ) " +
60 60
                         "and F_IsDept =2" + sql, " F_Sort").Tables[0];
61 61
                 }
@@ -93,7 +93,7 @@ namespace CallCenterApi.Interface.Controllers
93 93
         }
94 94
         public ActionResult GetDeptUser(int deptid)
95 95
         {
96
-            var dt = "select count(1) from T_Sys_UserAccount where F_DeptId='" + deptid + "'";
96
+            var dt = "select count(1) from T_Sys_UserAccount with(nolock) where F_DeptId='" + deptid + "'";
97 97
             int usercount = int.Parse(DbHelperSQL.GetSingle(dt).ToString());
98 98
             if (usercount>0)
99 99
             {
@@ -369,7 +369,7 @@ namespace CallCenterApi.Interface.Controllers
369 369
                     model.id = currentID;
370 370
                     model.IconCls = "";//图标
371 371
                     model.text = categorylist[i].F_DeptName;
372
-                    tab2 = new BLL.T_Sys_Department().GetList("F_PartentId=" + currentID + " and F_State=0 and ISNULL(F_IsDealDept, '0') ='1' order by f_sort").Tables[0];
372
+                    tab2 = new BLL.T_Sys_Department().GetList("F_PartentId=" + currentID + " and F_State=0 and ISNULL(F_IsDealDept, '0') ='1' ", "f_sort").Tables[0];
373 373
                     if (tab2 != null && tab2.Rows.Count > 0)
374 374
                     {
375 375
                         model.children = BindTree(tab2, currentID);

+ 11 - 3
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/UserAccountController.cs

@@ -477,21 +477,29 @@ namespace CallCenterApi.Interface.Controllers
477 477
                 }
478 478
                 else
479 479
                 {
480
-                    F_RoleId = DbHelperSQL.GetSingle("select F_RoleId from T_Sys_RoleInfo with(nolock) where F_RoleCode='" + rolecode.Trim() + "'")?.ToString() ?? "0";
480
+                    //F_RoleId = DbHelperSQL.GetSingle("select F_RoleId from T_Sys_RoleInfo with(nolock) where F_RoleCode='" + rolecode.Trim() + "'")?.ToString() ?? "0";
481
+                    //var dt = departmentBLL.GetList("F_RoleCode='" + rolecode.Trim() + "'").Tables[0];
482
+                    //if (dt.Rows.Count > 0)
483
+                    //{
484
+                    //    F_RoleId = dt.Rows[0]["F_RoleId"].ToString();
485
+                    //}
486
+                    F_RoleId = new BLL.T_Sys_RoleInfo().GetModel(rolecode.Trim())?.F_RoleId.ToString() ?? "0";
481 487
                 }
482 488
 
483 489
                 sql += " and F_RoleId = " + F_RoleId;
484 490
             }
485 491
 
486 492
             //List<Model.T_Sys_UserAccount> userList = sysUserAccountBll.GetModelList(sql, " f_userid desc ");
487
-            var userList = sysUserAccountBll.GetList(sql, "CONVERT(int ,F_UserCode ) asc ").Tables[0];
493
+            //var userList = sysUserAccountBll.GetList(sql, "CONVERT(int ,F_UserCode ) asc ").Tables[0];
494
+            var userList = sysUserAccountBll.GetModelList(sql).OrderBy(p => int.Parse(p.F_UserCode));
488 495
             return Success("列表加载成功", userList);
489 496
         }
490 497
 
491 498
         //根据部门获取用户
492 499
         public ActionResult GetDeptUserList(int deptid = 0)
493 500
         {
494
-            var DeptUserList = sysUserAccountBll.GetList("F_DeptId='" + deptid + "' ", " CONVERT(int ,F_UserCode ) asc");
501
+            //var DeptUserList = sysUserAccountBll.GetList("F_DeptId='" + deptid + "' ", " CONVERT(int ,F_UserCode ) asc");
502
+            var DeptUserList = sysUserAccountBll.GetModelList("F_DeptId='" + deptid + "' ").OrderBy(p => int.Parse(p.F_UserCode));
495 503
             return Success("列表加载成功", DeptUserList);
496 504
 
497 505
         }

+ 9 - 4
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallInScreenController.cs

@@ -1,5 +1,6 @@
1 1
 using CallCenter.Utility;
2 2
 using CallCenterApi.Common;
3
+using CallCenterApi.DB;
3 4
 using CallCenterApi.Interface.Controllers.Base;
4 5
 using System;
5 6
 using System.Collections.Generic;
@@ -512,8 +513,10 @@ namespace CallCenterApi.Interface.Controllers.tel
512 513
             Model.T_Call_CallRecords vmodel = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
513 514
             if (vmodel != null)
514 515
             {
515
-                vmodel.F_CallInType = tid;
516
-                if (new BLL.T_Call_CallRecords().Update(vmodel))
516
+                //vmodel.F_CallInType = tid;
517
+                //if (new BLL.T_Call_CallRecords().Update(vmodel))
518
+                bool bl = DbHelperSQL.ExecuteSql("update T_Call_CallRecords set F_CallInType=" + tid + " where CallRecordsId=" + vmodel.CallRecordsId) > 0;
519
+                if (bl)
517 520
                 {
518 521
                     return Success("操作成功");
519 522
                 }
@@ -540,8 +543,10 @@ namespace CallCenterApi.Interface.Controllers.tel
540 543
             Model.T_Call_CallRecords vmodel = new BLL.T_Call_CallRecords().GetModelByCallId(callid);
541 544
             if (vmodel != null)
542 545
             {
543
-                vmodel.F_CallOutType = tid;
544
-                if (new BLL.T_Call_CallRecords().Update(vmodel))
546
+                //vmodel.F_CallOutType = tid;
547
+                //if (new BLL.T_Call_CallRecords().Update(vmodel))
548
+                bool bl = DbHelperSQL.ExecuteSql("update T_Call_CallRecords set F_CallOutType=" + tid + " where CallRecordsId=" + vmodel.CallRecordsId) > 0;
549
+                if (bl)
545 550
                 {
546 551
                     return Success("操作成功");
547 552
                 }

+ 13 - 2
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs

@@ -269,7 +269,8 @@ namespace CallCenterApi.Interface.Controllers.tel
269 269
                     dt = BLL.PagerBLL.GetListPager(
270 270
                         "T_Call_CallRecords WITH(NOLOCK)",
271 271
                         "CallRecordsId",
272
-                        "*,dbo.GetUserName(UserCode) as UserName, WorkOrderId,dbo.GetDictionaryName(F_CallInType) as TypeName",
272
+                        //"*,dbo.GetUserName(UserCode) as UserName, WorkOrderId,dbo.GetDictionaryName(F_CallInType) as TypeName",
273
+                        "*",
273 274
                         sql,
274 275
                         "ORDER BY BeginTime desc ",
275 276
                         pagesize,
@@ -279,6 +280,7 @@ namespace CallCenterApi.Interface.Controllers.tel
279 280
 
280 281
                     var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
281 282
                     dt.Columns.Add("WaitTime", typeof(string));
283
+                    dt.Columns.Add("TypeName", typeof(string));
282 284
                     foreach (DataRow dr in dt.Rows)
283 285
                     {
284 286
                         string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
@@ -311,7 +313,16 @@ namespace CallCenterApi.Interface.Controllers.tel
311 313
                             double tss = double.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
312 314
                             dr["WaitTime"] = DateTimeConvert.parseTimeSeconds(tss, 1);
313 315
                         }
314
-                       
316
+
317
+                        if (dr["F_CallInType"] != null && dr["F_CallInType"].ToString() != "")
318
+                        {
319
+                            int tid = Int32.Parse(dr["F_CallInType"].ToString());
320
+                            var tn = new BLL.T_Sys_DictionaryValue().GetModel(tid);
321
+                            if (tn != null)
322
+                            {
323
+                                dr["TypeName"] = tn.F_Value;
324
+                            }
325
+                        }
315 326
 
316 327
                     }
317 328
                 }

+ 32 - 21
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/AffairsController.cs

@@ -32,6 +32,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
32 32
 
33 33
     public class AffairsController : BaseController
34 34
     {
35
+        private BLL.T_Sys_Department deptBLL = new BLL.T_Sys_Department();
35 36
 
36 37
         #region 上传省政务平台
37 38
         #region 服务工单受理
@@ -512,14 +513,18 @@ namespace CallCenterApi.Interface.Controllers.workorder
512 513
                 jsonList.AREA_CODE = AREA_CODE;
513 514
                 jsonList.TASK_ID = model.F_Id.ToString();
514 515
                 jsonList.TASK_PARENTID = "TOP";
515
-                if (DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_CreateDeptId + "')") != null)
516
-                    jsonList.TASK_OUNAME = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_CreateDeptId + "')").ToString();
517
-                else
518
-                    jsonList.TASK_OUNAME = "";
519
-                if (DbHelperSQL.GetSingle(" select dbo.GetUserName('" + model.F_CreateUser + "')") != null)
520
-                    jsonList.TASK_USERNAME = DbHelperSQL.GetSingle(" select dbo.GetUserName('" + model.F_CreateUser + "')").ToString();
521
-                else
522
-                    jsonList.TASK_USERNAME = model.F_CreateUser;
516
+                //if (DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_CreateDeptId + "')") != null)
517
+                //    jsonList.TASK_OUNAME = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_CreateDeptId + "')").ToString();
518
+                //else
519
+                //    jsonList.TASK_OUNAME = "";
520
+                jsonList.TASK_OUNAME = deptBLL.GetDeptNames(model.F_CreateDeptId.ToString());
521
+                //if (DbHelperSQL.GetSingle(" select dbo.GetUserName('" + model.F_CreateUser + "')") != null)
522
+                //    jsonList.TASK_USERNAME = DbHelperSQL.GetSingle(" select dbo.GetUserName('" + model.F_CreateUser + "')").ToString();
523
+                //else
524
+                //    jsonList.TASK_USERNAME = model.F_CreateUser;
525
+                string username = userBLL.GetUserName(model.F_CreateUser);
526
+                jsonList.TASK_USERNAME = string.IsNullOrEmpty(username)? model.F_CreateUser: username;
527
+
523 528
                 if (string.IsNullOrEmpty(model.F_Result))
524 529
                     jsonList.TASK_CONTENT = "无";
525 530
                 else
@@ -623,12 +628,16 @@ namespace CallCenterApi.Interface.Controllers.workorder
623 628
                 jsonList.AREA_CODE = AREA_CODE;
624 629
                 jsonList.TASK_ID = model.F_Id.ToString();
625 630
                 jsonList.TASK_PARENTID = info1.F_Id.ToString();
626
-                if (DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_CreateDeptId + "')") != null)
627
-                    jsonList.TASK_OUNAME = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_CreateDeptId + "')").ToString();
628
-                if (DbHelperSQL.GetSingle(" select dbo.GetUserName('" + model.F_CreateUser + "')") != null)
629
-                    jsonList.TASK_USERNAME = DbHelperSQL.GetSingle(" select dbo.GetUserName('" + model.F_CreateUser + "')").ToString();
630
-                else
631
-                    jsonList.TASK_USERNAME = model.F_CreateUser;
631
+                //if (DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_CreateDeptId + "')") != null)
632
+                //    jsonList.TASK_OUNAME = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_CreateDeptId + "')").ToString();
633
+                jsonList.TASK_OUNAME = deptBLL.GetDeptNames(model.F_CreateDeptId.ToString());
634
+                //if (DbHelperSQL.GetSingle(" select dbo.GetUserName('" + model.F_CreateUser + "')") != null)
635
+                //    jsonList.TASK_USERNAME = DbHelperSQL.GetSingle(" select dbo.GetUserName('" + model.F_CreateUser + "')").ToString();
636
+                //else
637
+                //    jsonList.TASK_USERNAME = model.F_CreateUser;
638
+                string username = userBLL.GetUserName(model.F_CreateUser);
639
+                jsonList.TASK_USERNAME = string.IsNullOrEmpty(username) ? model.F_CreateUser : username;
640
+
632 641
                 jsonList.TASK_CONTENT = model.F_Result;
633 642
                 jsonList.TASK_ASSIGNTIME = info.F_CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
634 643
                 jsonList.TASK_SIGNTIME = info.F_SureTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
@@ -919,11 +928,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
919 928
                     if (model.F_MainDeptId > 0)
920 929
                     {
921 930
                         jsonList.END_TIME = model.F_DealTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
922
-                        if (DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_MainDeptId + "')") != null)
923
-                            jsonList.DEPT_NAME = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_MainDeptId + "')").ToString();
924
-                        if (DbHelperSQL.GetSingle(" select F_DeptNameSpell  from T_Sys_Department where F_DeptId= '" + model.F_MainDeptId + "'") != null)
925
-                            jsonList.DEPT_CODE = DbHelperSQL.GetSingle(" select F_DeptNameSpell  from T_Sys_Department where F_DeptId= '" + model.F_MainDeptId + "'").ToString();
926
-
931
+                        //if (DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_MainDeptId + "')") != null)
932
+                        //    jsonList.DEPT_NAME = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + model.F_MainDeptId + "')").ToString();
933
+                        jsonList.DEPT_NAME = deptBLL.GetDeptNames(model.F_MainDeptId.ToString());
934
+                        //if (DbHelperSQL.GetSingle(" select F_DeptNameSpell  from T_Sys_Department where F_DeptId= '" + model.F_MainDeptId + "'") != null)
935
+                        //    jsonList.DEPT_CODE = DbHelperSQL.GetSingle(" select F_DeptNameSpell  from T_Sys_Department where F_DeptId= '" + model.F_MainDeptId + "'").ToString();
936
+                        jsonList.DEPT_CODE = deptBLL.GetModelList("F_DeptId= '" + model.F_MainDeptId + "'").FirstOrDefault()?.F_DeptNameSpell ?? "";
927 937
 
928 938
 
929 939
                     }
@@ -2032,8 +2042,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
2032 2042
                         oper.F_Message = userinfo + " 结案了工单,结果:" + (issatisfie == 1 ? "满意" : "不满意");
2033 2043
                         if (isnotice == 1)
2034 2044
                         {
2035
-                            string sql = "select dbo.GetDeptNames('" + deptids + "')";
2036
-                            oper.F_Message = oper.F_Message + ",并通告了交办单位:" + DbHelperSQL.GetSingle(sql);
2045
+                            //string deptname = DbHelperSQL.GetSingle("select dbo.GetDeptNames('" + deptids + "')").ToString();
2046
+                            string deptname = deptBLL.GetDeptNames(deptids);
2047
+                            oper.F_Message = oper.F_Message + ",并通告了交办单位:" + deptname;
2037 2048
                         }
2038 2049
                         if (isstandard == 1)
2039 2050
                         {

+ 2 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/NoticeCriticismController.cs

@@ -171,7 +171,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
171 171
                 string NoticeDeptName = "";
172 172
                 if (dModel.F_DeptIds!= null && dModel.F_DeptIds.ToString() != "")
173 173
                 {
174
-                     NoticeDeptName = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dModel.F_DeptIds.ToString() + "')").ToString ();
174
+                    //NoticeDeptName = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dModel.F_DeptIds.ToString() + "')").ToString ();
175
+                    NoticeDeptName = new BLL.T_Sys_Department().GetDeptNames(dModel.F_DeptIds);
175 176
                 }
176 177
                 var obj = new
177 178
                 {

Diferenças do arquivo suprimidas por serem muito extensas
+ 918 - 724
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs


+ 2 - 1
CallCenterCommon/CallCenter.Utility/RedisHelper.cs

@@ -64,7 +64,8 @@ namespace CallCenter.Utility
64 64
             }
65 65
             else
66 66
             {
67
-                var rt = database.StringGet(key);
67
+                // var rt = database.StringGet(key);
68
+                var rt = database.StringGetAsync(key).Result;
68 69
 
69 70
                 if (rt.IsNull)
70 71
                 {