Kaynağa Gözat

添加党风政风服务

duhongyu 5 yıl önce
ebeveyn
işleme
c53e3bb0d2

+ 1 - 1
CallCenterApi/CallCenterApi.DAL/T_Bus_AssignedItemInfo.cs

@@ -342,7 +342,7 @@ namespace CallCenterApi.DAL
342 342
         {
343 343
             StringBuilder strSql = new StringBuilder();
344 344
             strSql.Append("select F_Id,F_WorkOrderId,F_AssignedId,F_DeptId,F_AssignedOpinion,F_Remark,F_CreateUser,F_CreateTime,F_IsSure,F_State,F_SureTime,F_IsDelete,F_DeleteUser,F_DeleteTime,F_SureUser,F_FeedbackTime,F_LimitTime,F_IsOverdue,F_File,F_Type ");
345
-            strSql.Append(" FROM T_Bus_AssignedItemInfo ");
345
+            strSql.Append(" FROM T_Bus_AssignedItemInfo  WITH(NOLOCK)");
346 346
             if (strWhere.Trim() != "")
347 347
             {
348 348
                 strSql.Append(" where " + strWhere);

+ 1 - 1
CallCenterApi/CallCenterApi.DAL/T_Bus_Feedback.cs

@@ -424,7 +424,7 @@ namespace CallCenterApi.DAL
424 424
         {
425 425
             StringBuilder strSql = new StringBuilder();
426 426
             strSql.Append("select * ");
427
-            strSql.Append(" FROM T_Bus_Feedback ");
427
+            strSql.Append(" FROM T_Bus_Feedback WITH(NOLOCK) ");
428 428
             if (strWhere.Trim() != "")
429 429
             {
430 430
                 strSql.Append(" where " + strWhere);

+ 1 - 1
CallCenterApi/CallCenterApi.DAL/T_Bus_VisitResult.cs

@@ -326,7 +326,7 @@ namespace CallCenterApi.DAL
326 326
         {
327 327
             StringBuilder strSql = new StringBuilder();
328 328
             strSql.Append("select F_Id,F_WorkOrderId,F_AssignedId,F_VisitUser,F_Type,F_IsSatisfie,F_Result,F_LimitTime,F_CallRecordId,F_Remark,F_State,F_CreateUser,F_CreateTime,F_IsDelete,F_DeleteUser,F_DeleteTime,F_File,F_IsPerform ");
329
-            strSql.Append(" FROM T_Bus_VisitResult ");
329
+            strSql.Append(" FROM T_Bus_VisitResult  WITH(NOLOCK)");
330 330
             if (strWhere.Trim() != "")
331 331
             {
332 332
                 strSql.Append(" where " + strWhere);

+ 19 - 9
CallCenterApi/CallCenterApi.DAL/T_Sys_Department.cs

@@ -38,9 +38,9 @@ namespace CallCenterApi.DAL
38 38
         {
39 39
             StringBuilder strSql = new StringBuilder();
40 40
             strSql.Append("insert into T_Sys_Department(");
41
-            strSql.Append("F_DeptName,F_DeptNameSpell,F_DeptNameSpells,F_DeptPhone,F_DeptPhone2,F_DeptTelphone,F_PartentId,F_layer,F_Sort,F_Type,F_Address,F_Remark,F_LeaderUser,F_LeaderUserName,F_TopSplitUser,F_TopSplitUserName,F_TopLeaderUser,F_TopLeaderUserName,F_State,F_CreateUser,F_CreateDate,F_IsDept,F_IsDealDept)");
41
+            strSql.Append("F_DeptName,F_DeptNameSpell,F_DeptNameSpells,F_DeptPhone,F_DeptPhone2,F_DeptTelphone,F_PartentId,F_layer,F_Sort,F_Type,F_Address,F_Remark,F_LeaderUser,F_LeaderUserName,F_TopSplitUser,F_TopSplitUserName,F_TopLeaderUser,F_TopLeaderUserName,F_State,F_CreateUser,F_CreateDate,F_IsDept,F_IsDealDept,F_Valueid)");
42 42
             strSql.Append(" values (");
43
-            strSql.Append("@F_DeptName,@F_DeptNameSpell,@F_DeptNameSpells,@F_DeptPhone,@F_DeptPhone2,@F_DeptTelphone,@F_PartentId,@F_layer,@F_Sort,@F_Type,@F_Address,@F_Remark,@F_LeaderUser,@F_LeaderUserName,@F_TopSplitUser,@F_TopSplitUserName,@F_TopLeaderUser,@F_TopLeaderUserName,@F_State,@F_CreateUser,@F_CreateDate,@F_IsDept,@F_IsDealDept)");
43
+            strSql.Append("@F_DeptName,@F_DeptNameSpell,@F_DeptNameSpells,@F_DeptPhone,@F_DeptPhone2,@F_DeptTelphone,@F_PartentId,@F_layer,@F_Sort,@F_Type,@F_Address,@F_Remark,@F_LeaderUser,@F_LeaderUserName,@F_TopSplitUser,@F_TopSplitUserName,@F_TopLeaderUser,@F_TopLeaderUserName,@F_State,@F_CreateUser,@F_CreateDate,@F_IsDept,@F_IsDealDept,@F_Valueid)");
44 44
             strSql.Append(";select @@IDENTITY");
45 45
             SqlParameter[] parameters = {
46 46
                     new SqlParameter("@F_DeptName", SqlDbType.NVarChar,100),
@@ -65,7 +65,9 @@ namespace CallCenterApi.DAL
65 65
                     new SqlParameter("@F_CreateUser", SqlDbType.VarChar,50),
66 66
                     new SqlParameter("@F_CreateDate", SqlDbType.DateTime),
67 67
                     new SqlParameter("@F_IsDept", SqlDbType.Int,4),
68
-                    new SqlParameter("@F_IsDealDept", SqlDbType.Int,4)};
68
+                    new SqlParameter("@F_IsDealDept", SqlDbType.Int,4),
69
+                      new SqlParameter("@F_Valueid", SqlDbType.Int,4)
70
+            };
69 71
             parameters[0].Value = model.F_DeptName;
70 72
             parameters[1].Value = model.F_DeptNameSpell;
71 73
             parameters[2].Value = model.F_DeptNameSpells;
@@ -89,7 +91,7 @@ namespace CallCenterApi.DAL
89 91
             parameters[20].Value = model.F_CreateDate;
90 92
             parameters[21].Value = model.F_IsDept;
91 93
             parameters[22].Value = model.F_IsDealDept;
92
-
94
+            parameters[23].Value = model.F_Valueid;
93 95
             object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
94 96
             if (obj == null)
95 97
             {
@@ -129,7 +131,8 @@ namespace CallCenterApi.DAL
129 131
             strSql.Append("F_CreateUser=@F_CreateUser,");
130 132
             strSql.Append("F_CreateDate=@F_CreateDate,");
131 133
             strSql.Append("F_IsDept=@F_IsDept,");
132
-            strSql.Append("F_IsDealDept=@F_IsDealDept");
134
+            strSql.Append("F_IsDealDept=@F_IsDealDept,");
135
+            strSql.Append("F_Valueid=@F_Valueid");
133 136
             strSql.Append(" where F_DeptId=@F_DeptId");
134 137
             SqlParameter[] parameters = {
135 138
                     new SqlParameter("@F_DeptName", SqlDbType.NVarChar,100),
@@ -155,6 +158,7 @@ namespace CallCenterApi.DAL
155 158
                     new SqlParameter("@F_CreateDate", SqlDbType.DateTime),
156 159
                     new SqlParameter("@F_IsDept", SqlDbType.Int,4),
157 160
                     new SqlParameter("@F_IsDealDept", SqlDbType.Int,4),
161
+                     new SqlParameter("@F_Valueid", SqlDbType.Int,4),
158 162
                     new SqlParameter("@F_DeptId", SqlDbType.Int,4)};
159 163
             parameters[0].Value = model.F_DeptName;
160 164
             parameters[1].Value = model.F_DeptNameSpell;
@@ -179,7 +183,8 @@ namespace CallCenterApi.DAL
179 183
             parameters[20].Value = model.F_CreateDate;
180 184
             parameters[21].Value = model.F_IsDept;
181 185
             parameters[22].Value = model.F_IsDealDept;
182
-            parameters[23].Value = model.F_DeptId;
186
+            parameters[23].Value = model.F_Valueid;
187
+            parameters[24].Value = model.F_DeptId;
183 188
 
184 189
             int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
185 190
             if (rows > 0)
@@ -243,7 +248,7 @@ namespace CallCenterApi.DAL
243 248
         {
244 249
 
245 250
             StringBuilder strSql = new StringBuilder();
246
-            strSql.Append("select  top 1 F_DeptId,F_DeptName,F_DeptNameSpell,F_DeptNameSpells,F_DeptPhone,F_DeptPhone2,F_DeptTelphone,F_PartentId,F_layer,F_Sort,F_Type,F_Address,F_Remark,F_LeaderUser,F_LeaderUserName,F_TopSplitUser,F_TopSplitUserName,F_TopLeaderUser,F_TopLeaderUserName,F_State,F_CreateUser,F_CreateDate,F_IsDept,F_IsDealDept from T_Sys_Department ");
251
+            strSql.Append("select  top 1 F_DeptId,F_DeptName,F_DeptNameSpell,F_DeptNameSpells,F_DeptPhone,F_DeptPhone2,F_DeptTelphone,F_PartentId,F_layer,F_Sort,F_Type,F_Address,F_Remark,F_LeaderUser,F_LeaderUserName,F_TopSplitUser,F_TopSplitUserName,F_TopLeaderUser,F_TopLeaderUserName,F_State,F_CreateUser,F_CreateDate,F_IsDept,F_IsDealDept,F_Valueid from T_Sys_Department ");
247 252
             strSql.Append(" where F_DeptId=@F_DeptId");
248 253
             SqlParameter[] parameters = {
249 254
                     new SqlParameter("@F_DeptId", SqlDbType.Int,4)
@@ -367,6 +372,11 @@ namespace CallCenterApi.DAL
367 372
                 {
368 373
                     model.F_IsDealDept = int.Parse(row["F_IsDealDept"].ToString());
369 374
                 }
375
+                if (row["F_Valueid"] != null && row["F_Valueid"].ToString() != "")
376
+                {
377
+                    model.F_Valueid = int.Parse(row["F_Valueid"].ToString());
378
+                }
379
+                
370 380
             }
371 381
             return model;
372 382
         }
@@ -377,7 +387,7 @@ namespace CallCenterApi.DAL
377 387
         public DataSet GetList(string strWhere)
378 388
         {
379 389
             StringBuilder strSql = new StringBuilder();
380
-            strSql.Append("select F_DeptId,F_DeptName,F_DeptNameSpell,F_DeptNameSpells,F_DeptPhone,F_DeptPhone2,F_DeptTelphone,F_PartentId,F_layer,F_Sort,F_Type,F_Address,F_Remark,F_LeaderUser,F_LeaderUserName,F_TopSplitUser,F_TopSplitUserName,F_TopLeaderUser,F_TopLeaderUserName,F_State,F_CreateUser,F_CreateDate,F_IsDept,F_IsDealDept ");
390
+            strSql.Append("select F_DeptId,F_DeptName,F_DeptNameSpell,F_DeptNameSpells,F_DeptPhone,F_DeptPhone2,F_DeptTelphone,F_PartentId,F_layer,F_Sort,F_Type,F_Address,F_Remark,F_LeaderUser,F_LeaderUserName,F_TopSplitUser,F_TopSplitUserName,F_TopLeaderUser,F_TopLeaderUserName,F_State,F_CreateUser,F_CreateDate,F_IsDept,F_IsDealDept ,F_Valueid");
381 391
             strSql.Append(" FROM T_Sys_Department ");
382 392
             if (strWhere.Trim() != "")
383 393
             {
@@ -397,7 +407,7 @@ namespace CallCenterApi.DAL
397 407
             {
398 408
                 strSql.Append(" top " + Top.ToString());
399 409
             }
400
-            strSql.Append(" F_DeptId,F_DeptName,F_DeptNameSpell,F_DeptNameSpells,F_DeptPhone,F_DeptPhone2,F_DeptTelphone,F_PartentId,F_layer,F_Sort,F_Type,F_Address,F_Remark,F_LeaderUser,F_LeaderUserName,F_TopSplitUser,F_TopSplitUserName,F_TopLeaderUser,F_TopLeaderUserName,F_State,F_CreateUser,F_CreateDate,F_IsDept,F_IsDealDept ");
410
+            strSql.Append(" F_DeptId,F_DeptName,F_DeptNameSpell,F_DeptNameSpells,F_DeptPhone,F_DeptPhone2,F_DeptTelphone,F_PartentId,F_layer,F_Sort,F_Type,F_Address,F_Remark,F_LeaderUser,F_LeaderUserName,F_TopSplitUser,F_TopSplitUserName,F_TopLeaderUser,F_TopLeaderUserName,F_State,F_CreateUser,F_CreateDate,F_IsDept,F_IsDealDept,F_Valueid ");
401 411
             strSql.Append(" FROM T_Sys_Department ");
402 412
             if (strWhere.Trim() != "")
403 413
             {

+ 24 - 9
CallCenterApi/CallCenterApi.DAL/T_Sys_DictionaryValue.cs

@@ -38,9 +38,9 @@ namespace CallCenterApi.DAL
38 38
         {
39 39
             StringBuilder strSql = new StringBuilder();
40 40
             strSql.Append("insert into T_Sys_DictionaryValue(");
41
-            strSql.Append("F_ItemId,F_Value,F_PrentId,F_Layer,F_IsLeaf,F_Remark,F_State,F_CreateUser,F_CreateDate)");
41
+            strSql.Append("F_ItemId,F_Value,F_PrentId,F_Layer,F_IsLeaf,F_Remark,F_State,F_CreateUser,F_CreateDate,F_Deptid)");
42 42
             strSql.Append(" values (");
43
-            strSql.Append("@F_ItemId,@F_Value,@F_PrentId,@F_Layer,@F_IsLeaf,@F_Remark,@F_State,@F_CreateUser,@F_CreateDate)");
43
+            strSql.Append("@F_ItemId,@F_Value,@F_PrentId,@F_Layer,@F_IsLeaf,@F_Remark,@F_State,@F_CreateUser,@F_CreateDate,@F_Deptid)");
44 44
             strSql.Append(";select @@IDENTITY");
45 45
             SqlParameter[] parameters = {
46 46
                     new SqlParameter("@F_ItemId", SqlDbType.Int,4),
@@ -51,7 +51,10 @@ namespace CallCenterApi.DAL
51 51
                     new SqlParameter("@F_Remark", SqlDbType.NVarChar,-1),
52 52
                     new SqlParameter("@F_State", SqlDbType.Int,4),
53 53
                     new SqlParameter("@F_CreateUser", SqlDbType.VarChar,50),
54
-                    new SqlParameter("@F_CreateDate", SqlDbType.DateTime)};
54
+                    new SqlParameter("@F_CreateDate", SqlDbType.DateTime),
55
+                      new SqlParameter("@F_Deptid", SqlDbType.Int,4)
56
+                    
57
+            };
55 58
             parameters[0].Value = model.F_ItemId;
56 59
             parameters[1].Value = model.F_Value;
57 60
             parameters[2].Value = model.F_PrentId;
@@ -61,7 +64,8 @@ namespace CallCenterApi.DAL
61 64
             parameters[6].Value = model.F_State;
62 65
             parameters[7].Value = model.F_CreateUser;
63 66
             parameters[8].Value = model.F_CreateDate;
64
-
67
+            parameters[9].Value = model.F_Deptid;
68
+            
65 69
             object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
66 70
             if (obj == null)
67 71
             {
@@ -87,7 +91,9 @@ namespace CallCenterApi.DAL
87 91
             strSql.Append("F_Remark=@F_Remark,");
88 92
             strSql.Append("F_State=@F_State,");
89 93
             strSql.Append("F_CreateUser=@F_CreateUser,");
90
-            strSql.Append("F_CreateDate=@F_CreateDate");
94
+            strSql.Append("F_CreateDate=@F_CreateDate,");
95
+            strSql.Append("F_Deptid=@F_Deptid");
96
+            
91 97
             strSql.Append(" where F_ValueId=@F_ValueId");
92 98
             SqlParameter[] parameters = {
93 99
                     new SqlParameter("@F_ItemId", SqlDbType.Int,4),
@@ -99,6 +105,8 @@ namespace CallCenterApi.DAL
99 105
                     new SqlParameter("@F_State", SqlDbType.Int,4),
100 106
                     new SqlParameter("@F_CreateUser", SqlDbType.VarChar,50),
101 107
                     new SqlParameter("@F_CreateDate", SqlDbType.DateTime),
108
+                     new SqlParameter("@F_Deptid", SqlDbType.Int,4),
109
+                    
102 110
                     new SqlParameter("@F_ValueId", SqlDbType.Int,4)};
103 111
             parameters[0].Value = model.F_ItemId;
104 112
             parameters[1].Value = model.F_Value;
@@ -109,7 +117,9 @@ namespace CallCenterApi.DAL
109 117
             parameters[6].Value = model.F_State;
110 118
             parameters[7].Value = model.F_CreateUser;
111 119
             parameters[8].Value = model.F_CreateDate;
112
-            parameters[9].Value = model.F_ValueId;
120
+            parameters[9].Value = model.F_Deptid;
121
+            
122
+            parameters[10].Value = model.F_ValueId;
113 123
 
114 124
             int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
115 125
             if (rows > 0)
@@ -188,7 +198,7 @@ namespace CallCenterApi.DAL
188 198
         {
189 199
 
190 200
             StringBuilder strSql = new StringBuilder();
191
-            strSql.Append("select  top 1 F_ValueId,F_ItemId,F_Value,F_PrentId,F_Layer,F_IsLeaf,F_Remark,F_State,F_CreateUser,F_CreateDate from T_Sys_DictionaryValue ");
201
+            strSql.Append("select  top 1 F_ValueId,F_ItemId,F_Value,F_PrentId,F_Layer,F_IsLeaf,F_Remark,F_State,F_CreateUser,F_CreateDate,F_Deptid from T_Sys_DictionaryValue ");
192 202
             strSql.Append(" where F_ValueId=@F_ValueId");
193 203
             SqlParameter[] parameters = {
194 204
                     new SqlParameter("@F_ValueId", SqlDbType.Int,4)
@@ -263,6 +273,11 @@ namespace CallCenterApi.DAL
263 273
                 {
264 274
                     model.F_CreateDate = DateTime.Parse(row["F_CreateDate"].ToString());
265 275
                 }
276
+                if (row["F_Deptid"] != null && row["F_Deptid"].ToString() != "")
277
+                {
278
+                    model.F_Deptid = int.Parse(row["F_Deptid"].ToString());
279
+                }
280
+                
266 281
             }
267 282
             return model;
268 283
         }
@@ -273,7 +288,7 @@ namespace CallCenterApi.DAL
273 288
         public DataSet GetList(string strWhere)
274 289
         {
275 290
             StringBuilder strSql = new StringBuilder();
276
-            strSql.Append("select F_ValueId,F_ItemId,F_Value,F_PrentId,F_Layer,F_IsLeaf,F_Remark,F_State,F_CreateUser,F_CreateDate ");
291
+            strSql.Append("select F_ValueId,F_ItemId,F_Value,F_PrentId,F_Layer,F_IsLeaf,F_Remark,F_State,F_CreateUser,F_CreateDate ,F_Deptid");
277 292
             strSql.Append(" FROM T_Sys_DictionaryValue ");
278 293
             if (strWhere.Trim() != "")
279 294
             {
@@ -293,7 +308,7 @@ namespace CallCenterApi.DAL
293 308
             {
294 309
                 strSql.Append(" top " + Top.ToString());
295 310
             }
296
-            strSql.Append(" F_ValueId,F_ItemId,F_Value,F_PrentId,F_Layer,F_IsLeaf,F_Remark,F_State,F_CreateUser,F_CreateDate ");
311
+            strSql.Append(" F_ValueId,F_ItemId,F_Value,F_PrentId,F_Layer,F_IsLeaf,F_Remark,F_State,F_CreateUser,F_CreateDate,F_Deptid ");
297 312
             strSql.Append(" FROM T_Sys_DictionaryValue ");
298 313
             if (strWhere.Trim() != "")
299 314
             {

+ 66 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/DepartmentController.cs

@@ -144,7 +144,47 @@ namespace CallCenterApi.Interface.Controllers
144 144
             int id = RequestString.GetInt("id", 0);
145 145
             Model.T_Sys_Department dModel = departmentBLL.GetModel(id);
146 146
             if (dModel != null)
147
+            {
148
+
149
+                string value = "";
150
+                if (dModel.F_Valueid  != null)
151
+                {
152
+                    var dicvalue = new BLL.T_Sys_DictionaryValue ().GetModel((int)dModel.F_Valueid);
153
+                    if (dicvalue != null)
154
+                        value = dicvalue.F_Value ;
155
+                }
156
+                var obj = new
157
+                {
158
+                    F_Address = dModel.F_Address,
159
+                    F_CreateDate = dModel.F_CreateDate,
160
+                    F_CreateUser = dModel.F_CreateUser,
161
+                    F_DeptId = dModel.F_DeptId,
162
+                    F_DeptName = dModel.F_DeptName,
163
+                    F_DeptNameSpell = dModel.F_DeptNameSpell,
164
+                    F_DeptNameSpells = dModel.F_DeptNameSpells,
165
+                    F_DeptPhone = dModel.F_DeptPhone,
166
+                    F_DeptPhone2 = dModel.F_DeptPhone2,
167
+                    F_DeptTelphone = dModel.F_DeptTelphone,
168
+                    F_IsDealDept = dModel.F_IsDealDept,
169
+                    F_IsDept = dModel.F_IsDept,
170
+                    F_LeaderUser = dModel.F_LeaderUser,
171
+                    F_LeaderUserName = dModel.F_LeaderUserName,
172
+                    F_PartentId = dModel.F_PartentId,
173
+                    F_Remark = dModel.F_Remark,
174
+                    F_Sort = dModel.F_Sort,
175
+                    F_State = dModel.F_State,
176
+                    F_TopLeaderUser = dModel.F_TopLeaderUser,
177
+                    F_TopLeaderUserName = dModel.F_TopLeaderUserName,
178
+                    F_TopSplitUser = dModel.F_TopSplitUser,
179
+                    F_TopSplitUserName = dModel.F_TopSplitUserName,
180
+                    F_Type = dModel.F_Type,
181
+                    F_layer = dModel.F_layer,
182
+                    F_Valueid = dModel.F_Valueid,
183
+                    F_Value = value,
184
+                };
147 185
                 return Success("获取信息成功", dModel);
186
+            }
187
+                
148 188
             return Error("获取信息失败");
149 189
 
150 190
         }
@@ -165,6 +205,7 @@ namespace CallCenterApi.Interface.Controllers
165 205
             int sort = RequestString.GetInt("sort", 0);
166 206
             int isdept = RequestString.GetInt("isdept", 0);
167 207
             int isdealdept = RequestString.GetInt("isdealdept", 0);
208
+            int valueid = RequestString.GetInt("valueid", 0);
168 209
             string name = RequestString.GetFormString("name");
169 210
             string phone = RequestString.GetFormString("phone");
170 211
             string leader = RequestString.GetFormString("leader");
@@ -196,10 +237,23 @@ namespace CallCenterApi.Interface.Controllers
196 237
                     dModel.F_IsDealDept = isdealdept;
197 238
                     dModel.F_CreateDate = DateTime.Now;
198 239
                     dModel.F_CreateUser = userModel.F_UserCode;
240
+                    dModel.F_Valueid  = valueid;
199 241
                     
200 242
                     int n = departmentBLL.Add(dModel);
201 243
                     if (n > 0)
244
+                    {
245
+                        if (valueid > 0)
246
+                        {
247
+                            var value = new BLL.T_Sys_DictionaryValue ().GetModel(valueid);
248
+                            if (value != null)
249
+                            {
250
+                                value.F_Deptid  = n;
251
+                            }
252
+                            var b = new BLL.T_Sys_DictionaryValue().Update(value);
253
+                        }
202 254
                         return Success("添加成功", n);
255
+                    }
256
+                       
203 257
                     else
204 258
                         return Error("添加失败");
205 259
                 }
@@ -225,8 +279,20 @@ namespace CallCenterApi.Interface.Controllers
225 279
                         dModel.F_TopLeaderUser = topleader;
226 280
                         dModel.F_IsDept = isdept;
227 281
                         dModel.F_IsDealDept = isdealdept;
282
+                        dModel.F_Valueid = valueid;
228 283
                         if (departmentBLL.Update(dModel))
284
+                        {
285
+                            if (valueid > 0)
286
+                            {
287
+                                var value = new BLL.T_Sys_DictionaryValue().GetModel(valueid);
288
+                                if (value != null)
289
+                                {
290
+                                    value.F_Deptid = dModel.F_DeptId ;
291
+                                }
292
+                                var b = new BLL.T_Sys_DictionaryValue().Update(value);
293
+                            }
229 294
                             return Success("修改成功");
295
+                        }
230 296
                         else
231 297
                             return Error("修改失败");
232 298
                     }

+ 74 - 9
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/DictionaryController.cs

@@ -1,4 +1,5 @@
1 1
 using CallCenter.Utility;
2
+using CallCenterApi.Common;
2 3
 using CallCenterApi.DB;
3 4
 using CallCenterApi.Interface.Controllers.Base;
4 5
 using System;
@@ -15,7 +16,7 @@ namespace CallCenterApi.Interface.Controllers
15 16
     public class DictionaryController : BaseController
16 17
     {
17 18
         private BLL.T_Sys_DictionaryValue dictionaryValueBLL = new BLL.T_Sys_DictionaryValue();
18
-
19
+        private BLL.T_Sys_UserAccount userBLL = new BLL.T_Sys_UserAccount();
19 20
         public ActionResult GetZTreeList()
20 21
         {
21 22
             DataTable dt = new DataTable();
@@ -134,13 +135,15 @@ namespace CallCenterApi.Interface.Controllers
134 135
             return Content(obj.ToJson());
135 136
 
136 137
         }
137
-
138
+        [Authority]
138 139
         /// <summary>
139 140
         /// 获取字典值列表
140 141
         /// </summary>
141 142
         /// <returns></returns>
142
-        public ActionResult GetDicValueListById()
143
+        public ActionResult GetDicValueListById(int type=0)
143 144
         {
145
+            int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
146
+            Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
144 147
             int id = RequestString.GetInt("id", 0);
145 148
             var sql = " F_State=0 ";
146 149
             if (id == 1)
@@ -148,7 +151,21 @@ namespace CallCenterApi.Interface.Controllers
148 151
             else if (id == 2)
149 152
                 sql += " and  (F_PrentId=37 or F_ItemId='" + id + "')";
150 153
             else if (id == 3)
151
-                sql += " and  (F_PrentId=38 or F_ItemId='" + id + "')";
154
+            {
155
+                if (type >0)
156
+                {
157
+                    sql += " and  (F_PrentId=38 or F_ItemId='" + id + "')";
158
+                }
159
+                else
160
+                {
161
+                    if (userModel.F_RoleCode == "DFZF")
162
+                        sql += " and  (F_PrentId=38 or F_ItemId='" + id + "')  and F_Deptid='" + userModel.F_DeptId + "'";
163
+                    else
164
+                        sql += " and  (F_PrentId=38 or F_ItemId='" + id + "')";
165
+                }
166
+               
167
+            }
168
+               
152 169
             else
153 170
                 sql += " and  (F_PrentId='" + id + "' or F_ItemId='" + id + "')";
154 171
             DataTable dt = new DataTable();
@@ -183,7 +200,32 @@ namespace CallCenterApi.Interface.Controllers
183 200
 
184 201
             Model.T_Sys_DictionaryValue valueModel = dictionaryValueBLL.GetModel(id);
185 202
             if (valueModel != null)
186
-                return Success("加载字典值成功", valueModel);
203
+            {
204
+                string deptname="";
205
+                 if (valueModel.F_Deptid!=null )
206
+                {
207
+                    var dept = new BLL.T_Sys_Department().GetModel((int )valueModel.F_Deptid);
208
+                    if (dept != null)
209
+                        deptname = dept.F_DeptName;
210
+                }
211
+                var obj = new
212
+                {
213
+                    F_CreateDate=  valueModel.F_CreateDate ,
214
+                    F_CreateUser = valueModel.F_CreateUser,
215
+                    F_IsLeaf = valueModel.F_IsLeaf,
216
+                    F_ItemId = valueModel.F_ItemId,
217
+                    F_Layer = valueModel.F_Layer,
218
+                    F_PrentId = valueModel.F_PrentId,
219
+                    F_Remark = valueModel.F_Remark,
220
+                    F_State = valueModel.F_State,
221
+                    F_Value = valueModel.F_Value,
222
+                    F_ValueId = valueModel.F_ValueId,
223
+                    F_Deptid = valueModel.F_Deptid,
224
+                    F_DeptName= deptname
225
+                };
226
+                return Success("加载字典值成功", obj);
227
+            }
228
+               
187 229
             else
188 230
                 return Error("加载字典值失败");
189 231
 
@@ -201,10 +243,10 @@ namespace CallCenterApi.Interface.Controllers
201 243
             //int iid = RequestString.GetInt("iid", 0);
202 244
             int pid = RequestString.GetInt("pid", 0);
203 245
             string name = RequestString.GetFormString("name");
204
-
246
+            int deptid = RequestString.GetInt("deptid", 0);
205 247
             Model.T_Sys_DictionaryValue orderModel = new Model.T_Sys_DictionaryValue();
206 248
             BLL.T_Sys_DictionaryValue orderBll = new BLL.T_Sys_DictionaryValue();
207
-
249
+            
208 250
             if (id == 0)
209 251
             {
210 252
                 //var list = orderBll.GetModelList(" F_Value='" + name + "' and F_ItemId='"+pid+"' ");
@@ -219,10 +261,22 @@ namespace CallCenterApi.Interface.Controllers
219 261
                     orderModel.F_Value = name;
220 262
                     orderModel.F_PrentId = pid;
221 263
                     orderModel.F_State = 0;
222
-
264
+                    orderModel.F_Deptid  = deptid;
265
+                    
223 266
                     int n = orderBll.Add(orderModel);
224 267
                     if (n > 0)
268
+                    {
269
+                        if (deptid > 0)
270
+                        {
271
+                            var dept = new BLL.T_Sys_Department().GetModel(deptid);
272
+                            if (dept != null )
273
+                            {
274
+                                dept.F_Valueid = n;                     }
275
+                            var b = new BLL.T_Sys_Department().Update(dept);
276
+                            }
225 277
                         return Success("字典值添加成功", n);
278
+                    }
279
+                       
226 280
                     else
227 281
                         return Error("字典值添加失败");
228 282
                 }
@@ -243,9 +297,20 @@ namespace CallCenterApi.Interface.Controllers
243 297
                         orderModel.F_ItemId = pid;
244 298
                         orderModel.F_Value = name;
245 299
                         orderModel.F_PrentId = pid;
246
-
300
+                        orderModel.F_Deptid = deptid;
247 301
                         if (orderBll.Update(orderModel))
302
+                        {
303
+                            if (deptid > 0)
304
+                            {
305
+                                var dept = new BLL.T_Sys_Department().GetModel(deptid);
306
+                                if (dept != null)
307
+                                {
308
+                                    dept.F_Valueid = orderModel.F_ValueId ;
309
+                                }
310
+                                var b = new BLL.T_Sys_Department().Update(dept);
311
+                            }
248 312
                             return Success("字典值修改成功");
313
+                        }
249 314
                         else
250 315
                             return Error("字典值修改失败");
251 316
                     }

+ 50 - 81
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WorkOrderReportController.cs

@@ -316,15 +316,7 @@ namespace CallCenterApi.Interface.Controllers.report
316 316
             }
317 317
             return Success("成功", newSet);
318 318
         }
319
-        public class deptSatisfiedReport
320
-        {
321
-            public int count = 0;
322
-            public string deptname;
323
-            public int notsatisfiedcount = 0;
324
-            public int satisfiedcount = 0;
325
-            public string satisfiedrate="" ;
326
-            public float fiedrate=0;
327
-        }
319
+  
328 320
         /// <summary>
329 321
         /// 市民满意度评价
330 322
         /// </summary>
@@ -340,30 +332,26 @@ namespace CallCenterApi.Interface.Controllers.report
340 332
             {
341 333
                 end = DateTime.Now;
342 334
             }
343
-            if (isExport)
344
-            {
345
-                Dictionary<string, string> paras = new Dictionary<string, string>();
346
-                paras.Add("@sdate", start.Value.ToString("yyyy-MM-dd"));
347
-                paras.Add("@edate", end.Value.ToString("yyyy-MM-dd"));
348
-                var obj = DbHelperSQL.RunProcedure("P_DeptSatisfiedReport", paras, "DeptSatisfiedReport");
349
-                string[] cols = new string[] { "单位名称", "处理总量", "满意总量", "不满意总量", "满意度" };
350
-                new NPOIHelper().ExportToExcel($"满意度统计报表{Convert.ToDateTime(start).ToString("yyyyMMdd")}-{Convert.ToDateTime(end).ToString("yyyyMMdd")}", obj.Tables[0], cols);
351
-                return Success("导出excel");
352
-            }
335
+           
353 336
             List<deptSatisfiedReport> DeptSatisfiedReport = new List<deptSatisfiedReport>();
354 337
             var workorder = new BLL.T_Bus_AssignedInfo().GetModelList
355
-                (" F_Id IN ((select max(F_Id) from T_Bus_AssignedInfo where F_IsDelete = 0 " +
356
-                "and F_State = 1 and isnull(F_FeedbackTime, '') <> ''  and datediff(day, F_FeedbackTime, '" + start + "') <= 0 " +
357
-                "and datediff(day, F_FeedbackTime, '" + end + "') >= 0  and F_WorkOrderId in (select F_WorkOrderId from" +
358
-                " T_Bus_WorkOrder where F_WorkState = 9)  group by F_WorkOrderId)) ");
359
-
360
-            var visit= new BLL.T_Bus_WorkOrder().GetModelList
361
-                ("F_IsDelete=0 and  F_WorkOrderId in " +
362
-                "(select a.F_WorkOrderId  from T_Bus_AssignedInfo a INNER JOIN T_Bus_VisitResult v " +
363
-                "on a.F_Id = v.F_AssignedId WHERE v.F_IsDelete = 0 and v.F_State = 1 and a.F_Id IN( (select max(F_Id) " +
364
-                "from T_Bus_AssignedInfo where F_IsDelete = 0 and F_State = 1 and isnull(F_FeedbackTime, '') <> ''  " +
365
-                "and datediff(day, F_FeedbackTime, '"+ start + "') <= 0 and datediff(day, F_FeedbackTime, '"+ end + "') >= 0 " +
366
-                "and F_WorkOrderId in (select F_WorkOrderId from T_Bus_WorkOrder where F_WorkState = 9)    group by F_WorkOrderId)) ) ")  ;
338
+                ("   F_Id in ( select MAX (F_Id )  from T_Bus_AssignedInfo    where "+
339
+   " F_IsDelete = 0 and F_IsSure = 1 and F_State = 1 "+
340
+      "  and isnull(F_FeedbackTime, '') <> '' "+
341
+       " and datediff(day, F_FeedbackTime, '" + start + "') <= 0 " +
342
+        "and datediff(day, F_FeedbackTime, '" + end + "') >= 0 and " +
343
+     " F_WorkOrderId in (select F_WorkOrderId from T_Bus_WorkOrder "+
344
+      " where F_WorkState = 9 and F_IsDelete = 0)  group by F_WorkOrderId,F_MainDeptId  ) ");
345
+
346
+            var vis = "select * from T_Bus_AssignedInfo a INNER JOIN T_Bus_VisitResult v  on a.F_Id = v.F_AssignedId WHERE " +
347
+                "v.F_IsDelete = 0 and v.F_State = 1 and a.F_Id IN((select max(F_Id)" +
348
+                " from T_Bus_AssignedInfo where F_IsDelete = 0 and F_State = 1 and isnull(F_FeedbackTime, '') <> ''" +
349
+                "  and datediff(day, F_FeedbackTime, '"+ start + "') <= 0 and datediff(day, F_FeedbackTime, '"+ end + "') >= 0" +
350
+                "  and F_WorkOrderId in (select F_WorkOrderId from T_Bus_WorkOrder where F_WorkState = 9 and F_IsDelete = 0)   " +
351
+                "  group by F_WorkOrderId,F_MainDeptId))";
352
+            DataTable visit = DbHelperSQL.Query(vis).Tables[0];
353
+            List<Model.T_Bus_AssignedInfo> visitlist = new BLL.T_Bus_AssignedInfo().DataTableToList(visit);
354
+         
367 355
 
368 356
             var deptMent = new BLL.T_Sys_Department().GetModelList(" F_State=0 AND F_IsDept='1'  ");
369 357
             if (deptMent!=null )
@@ -377,6 +365,7 @@ namespace CallCenterApi.Interface.Controllers.report
377 365
                     deptSatisfied.satisfiedcount = 0;
378 366
                     deptSatisfied.satisfiedrate = "";
379 367
                     deptSatisfied.fiedrate = 0;
368
+                    deptSatisfied.deptid = it.F_DeptId;
380 369
                     int   visits = 0;
381 370
                     if (workorder !=null )
382 371
                     {
@@ -387,19 +376,23 @@ namespace CallCenterApi.Interface.Controllers.report
387 376
                         }
388 377
                         if (visit!=null )
389 378
                         {
390
-                            foreach (var iv in visit)
379
+                            foreach (var iv in visitlist)
391 380
                             {
392 381
                                 if (iv.F_MainDeptId == it.F_DeptId)
393
-                                  visits++;
394
-                                if (iv.F_MainDeptId == it.F_DeptId&& iv. F_IsSatisfie ==1)
395
-                                    deptSatisfied.satisfiedcount++;
382
+                                {
383
+                                    visits++;
384
+                                    if ( iv.F_IsSatisfie == 1)
385
+                                        deptSatisfied.satisfiedcount++;
386
+                                }
387
+                                
388
+                              
396 389
                             }
397 390
                         }
398 391
                         deptSatisfied.notsatisfiedcount = visits - deptSatisfied.satisfiedcount;
399
-                        if (visits>0)
392
+                        if (deptSatisfied.count > 0)
400 393
                         {
401
-                            deptSatisfied.fiedrate = (float)deptSatisfied.satisfiedcount / visits;
402
-                            deptSatisfied.satisfiedrate = string.Format("{0:f2}%",(float )deptSatisfied.satisfiedcount / visits*100);
394
+                            deptSatisfied.fiedrate = (float)deptSatisfied.satisfiedcount / deptSatisfied.count;
395
+                            deptSatisfied.satisfiedrate = string.Format("{0:f2}%",(float )deptSatisfied.satisfiedcount / deptSatisfied.count * 100);
403 396
                         }
404 397
                         DeptSatisfiedReport.Add(deptSatisfied);
405 398
                     }
@@ -409,55 +402,31 @@ namespace CallCenterApi.Interface.Controllers.report
409 402
                     }
410 403
                 }
411 404
             }
412
-
413
-            DeptSatisfiedReport. Sort((x, y) => y .fiedrate.CompareTo(x .fiedrate));
414
-          //  foreach (var it in DeptSatisfiedReport)
415
-         //   {
416
-           //     if (it.satisfiedrate == "0%")
417
-            //        it.satisfiedrate = "";
418
-           // }
419
-          //  var result = DeptSatisfiedReport.OrderBy(x => x == null     ).ThenBy(x => x.satisfiedrate );
420
-
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-            //string sql = $"select * from dbo.GetDeptSatisfied('{start.Value.ToString("yyyy-MM-dd")}','{end.Value.ToString("yyyy-MM-dd")}') ORDER BY rate DESC";
429
-            //var dtall = DbHelperSQL.Query(sql).Tables[0];
430
-
431
-
432
-
405
+        
406
+           var result = DeptSatisfiedReport.OrderBy(x => x .deptid ).OrderByDescending (x => x.fiedrate);
407
+            if (isExport)
408
+            {
409
+                string[] col = new string[] { "单位名称", "处理总量", "满意总量", "不满意总量", "满意度" };
410
+                new NPOIHelper().SatisfiedToExcel($"满意度统计报表{Convert.ToDateTime(start).ToString("yyyyMMdd")}-{Convert.ToDateTime(end).ToString("yyyyMMdd")}", result, col);
411
+                return Success("导出excel");
412
+                //   Dictionary<string, string> paras = new Dictionary<string, string>();
413
+                //  paras.Add("@sdate", start.Value.ToString("yyyy-MM-dd"));
414
+                //  paras.Add("@edate", end.Value.ToString("yyyy-MM-dd"));
415
+                // var obj = DbHelperSQL.RunProcedure("P_DeptSatisfiedReport", paras, "DeptSatisfiedReport");
416
+                //  string[] cols = new string[] { "单位名称", "处理总量", "满意总量", "不满意总量", "满意度" };
417
+                //  new NPOIHelper().ExportToExcel($"满意度统计报表{Convert.ToDateTime(start).ToString("yyyyMMdd")}-{Convert.ToDateTime(end).ToString("yyyyMMdd")}", obj.Tables[0], cols);
418
+                // return Success("导出excel");
419
+            }
420
+           
421
+           
433 422
             var ob = new
434 423
             {
435 424
                 state = "success",
436 425
                 message = "成功",
437
-                DeptSatisfiedReport = DeptSatisfiedReport,
426
+                DeptSatisfiedReport = result,
438 427
             };
439 428
             return Success("成功", ob );
440
-            //int recordCount = 0;
441
-            //var dt = BLL.PagerBLL.GetListPager(
442
-            //   "("+sql+") as v",
443
-            //    "deptname",
444
-            //    "*",
445
-            //    "",
446
-            //    "ORDER BY rate DESC",
447
-            //    pageSize,
448
-            //    pageIndex,
449
-            //    true,
450
-            //    out recordCount);
451
-
452
-            //var obj = new
453
-            //{
454
-            //    state = "success",
455
-            //    message = "成功",
456
-            //    rows = dt,
457
-            //    total = recordCount
458
-            //};
459
-
460
-            //return Content(obj.ToJson());
429
+         
461 430
         }
462 431
 
463 432
 

+ 22 - 7
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -102,7 +102,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
102 102
             if (strkey.Trim() != "" && strkey != "undefined")
103 103
             {
104 104
                 sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
105
+               
105 106
             }
107
+           
108
+           
106 109
             if (strusercode.Trim() != "" && strusercode != "undefined")
107 110
             {//坐席
108 111
                 var usercode = strusercode.Trim().Split(',');
@@ -143,6 +146,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
143 146
             {
144 147
                 sql += " and ','+F_Key+',' like '%," + keyid + ",%' ";
145 148
             }
149
+            else if (userModel.F_RoleCode == "DFZF")
150
+            {
151
+                sql += " and F_CreateUser ='"+ userModel .F_UserCode + "' ";
152
+            }
146 153
             if (type != 0)
147 154
             {
148 155
                 sql += " and F_InfoType = '" + type + "' ";
@@ -5707,7 +5714,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
5707 5714
             if (userModel.F_RoleCode == "ZXHWY" || userModel.F_RoleCode == "ZXBZ" 
5708 5715
                 || userModel.F_RoleCode == "ZXLD" || userModel.F_RoleCode == "ZXLDGLYGLY"
5709 5716
                 || userModel.F_RoleCode == "ZJZY" || userModel.F_RoleCode == "DBZY"
5710
-                || userModel.F_RoleCode == "11"   || userModel.F_RoleCode == "GLY" || userModel.F_RoleCode == "DDZG") //增加新闻媒体(编号11)的添加工单权限 
5717
+                || userModel.F_RoleCode == "11"   || userModel.F_RoleCode == "GLY" || userModel.F_RoleCode == "DDZG"
5718
+                || userModel.F_RoleCode == "DFZF") //增加新闻媒体(编号11)的添加工单权限 
5711 5719
             {
5712 5720
 
5713 5721
                 int source = RequestString.GetInt("source", 0);
@@ -10975,10 +10983,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
10975 10983
                 Model.T_Bus_AssignedInfo modelT_Bus_AssignedInfo = assignBLL.GetNewModelByWorkOrderID(workorderid);
10976 10984
                 if (modelT_Bus_WorkOrder != null)
10977 10985
                 {
10978
-                    if (modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_CreateUser != userModel.F_UserCode)
10986
+                    if (userModel.F_RoleCode != "GLY" && userModel.F_RoleCode != "DDZG")
10979 10987
                     {
10980
-                        return Error("操作失败");
10988
+                        if (modelT_Bus_AssignedInfo != null && modelT_Bus_AssignedInfo.F_CreateUser != userModel.F_UserCode)
10989
+                        {
10990
+                            return Error("操作失败");
10991
+                        }
10981 10992
                     }
10993
+                   
10982 10994
 
10983 10995
                     using (TransactionScope trans = new TransactionScope())
10984 10996
                     {
@@ -11019,11 +11031,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
11019 11031
                                 
11020 11032
                             }
11021 11033
                         }
11034
+                        if (modelT_Bus_AssignedInfo!=null )
11035
+                        {
11036
+                            modelT_Bus_AssignedInfo.F_IsStandard = isstandard;
11037
+                            modelT_Bus_AssignedInfo.F_StandardIDS = standardids;
11022 11038
 
11023
-                        modelT_Bus_AssignedInfo.F_IsStandard = isstandard;
11024
-                        modelT_Bus_AssignedInfo.F_StandardIDS = standardids;
11025
-
11026
-                        assignBLL.Update(modelT_Bus_AssignedInfo);
11039
+                            assignBLL.Update(modelT_Bus_AssignedInfo);
11040
+                        }
11041
+                      
11027 11042
                         workorderBLL.Update(modelT_Bus_WorkOrder);
11028 11043
                         #endregion
11029 11044
 

+ 7 - 0
CallCenterApi/CallCenterApi.Model/T_Sys_Department.cs

@@ -34,6 +34,8 @@ namespace CallCenterApi.Model
34 34
         private DateTime? _f_createdate;
35 35
         private int? _f_isdept;
36 36
         private int? _f_isdealdept;
37
+        private int? _f_valueid;
38
+        
37 39
         /// <summary>
38 40
         /// 部门id,自增
39 41
         /// </summary>
@@ -226,6 +228,11 @@ namespace CallCenterApi.Model
226 228
             set { _f_isdealdept = value; }
227 229
             get { return _f_isdealdept; }
228 230
         }
231
+        public int? F_Valueid
232
+        {
233
+            set { _f_valueid = value; }
234
+            get { return _f_valueid; }
235
+        }
229 236
         #endregion Model
230 237
 
231 238
     }

+ 10 - 0
CallCenterApi/CallCenterApi.Model/T_Sys_DictionaryValue.cs

@@ -20,6 +20,7 @@ namespace CallCenterApi.Model
20 20
         private int? _f_state;
21 21
         private string _f_createuser;
22 22
         private DateTime? _f_createdate;
23
+        private int? _f_deptid;
23 24
         /// <summary>
24 25
         /// 自增
25 26
         /// </summary>
@@ -100,6 +101,15 @@ namespace CallCenterApi.Model
100 101
             set { _f_createdate = value; }
101 102
             get { return _f_createdate; }
102 103
         }
104
+        /// <summary>
105
+        /// 部门
106
+        /// </summary>
107
+        public int? F_Deptid
108
+        {
109
+            set { _f_deptid = value; }
110
+            get { return _f_deptid; }
111
+        }
112
+        
103 113
         #endregion Model
104 114
 
105 115
     }

+ 1 - 0
CallCenterCommon/CallCenter.Utility/CallCenter.Utility.csproj

@@ -83,6 +83,7 @@
83 83
     <Compile Include="Linq\LinqExtend.cs" />
84 84
     <Compile Include="Linq\PredicateExtensionses.cs" />
85 85
     <Compile Include="log\LogInterface.cs" />
86
+    <Compile Include="NPOI\InPutType.cs" />
86 87
     <Compile Include="RedisHelper.cs" />
87 88
     <Compile Include="SaltAndHashHelper.cs" />
88 89
     <Compile Include="SysInformationHelper.cs" />

+ 24 - 0
CallCenterCommon/CallCenter.Utility/NPOI/InPutType.cs

@@ -0,0 +1,24 @@
1
+
2
+using System;
3
+using System.Collections.Generic;
4
+using System.IO;
5
+using System.Linq;
6
+using System.Text;
7
+
8
+
9
+namespace CallCenter.Utility
10
+{
11
+    
12
+        public class deptSatisfiedReport
13
+        {
14
+            public int count = 0;
15
+            public string deptname;
16
+            public int notsatisfiedcount = 0;
17
+            public int satisfiedcount = 0;
18
+            public string satisfiedrate = "";
19
+            public float fiedrate = 0;
20
+            public int deptid = 0;
21
+        }
22
+
23
+   
24
+}

+ 142 - 0
CallCenterCommon/CallCenter.Utility/NPOI/NPOIHelper.cs

@@ -1,7 +1,9 @@
1 1
 
2 2
 using System;
3
+using System.Collections.Generic;
3 4
 using System.Data;
4 5
 using System.IO;
6
+using System.Linq;
5 7
 using System.Text;
6 8
 using System.Web;
7 9
 using NPOI.HSSF.UserModel;
@@ -9,6 +11,7 @@ using NPOI.SS.UserModel;
9 11
 using NPOI.SS.Util;
10 12
 using NPOI.XSSF.UserModel;
11 13
 
14
+
12 15
 namespace CallCenter.Utility
13 16
 {
14 17
     public class NPOIHelper
@@ -107,7 +110,144 @@ namespace CallCenter.Utility
107 110
             this._filePath = filePath;
108 111
             return ToExcel(table, columns);
109 112
         }
113
+        /// <summary>
114
+        /// 投诉产品日期分布表
115
+        /// </summary>
116
+        /// <param name="ds"></param>
117
+        /// <returns></returns>
118
+        public string SatisfiedToExcel(string Name, IOrderedEnumerable<deptSatisfiedReport>   deptSatisfied, string[] cols = null)
119
+        {
120
+            try
121
+            {
122
+                //if (dt.Rows.Count > 0)
123
+                //{
124
+                HSSFWorkbook workbook = new HSSFWorkbook();
125
+                ISheet sheet = workbook.CreateSheet("Sheet1");
126
+
127
+                ICellStyle HeadercellStyle = workbook.CreateCellStyle();
128
+                HeadercellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
129
+                HeadercellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
130
+                HeadercellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
131
+                HeadercellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
132
+                HeadercellStyle.Alignment = HorizontalAlignment.Center;
133
+                HeadercellStyle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.SkyBlue.Index;
134
+                HeadercellStyle.FillPattern = FillPattern.SolidForeground;
135
+                HeadercellStyle.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.SkyBlue.Index;
136
+
137
+                //字体
138
+                NPOI.SS.UserModel.IFont headerfont = workbook.CreateFont();
139
+                headerfont.Boldweight = (short)FontBoldWeight.Bold;
140
+                headerfont.FontHeightInPoints = 12;
141
+                HeadercellStyle.SetFont(headerfont);
142
+
110 143
 
144
+                //用column name 作为列名
145
+                int icolIndex = 0;
146
+                IRow headerRow = sheet.CreateRow(0);
147
+                foreach (string dc in cols)
148
+                {
149
+                    ICell cell = headerRow.CreateCell(icolIndex);
150
+                    cell.SetCellValue(dc);
151
+                    cell.CellStyle = HeadercellStyle;
152
+                    icolIndex++;
153
+                }
154
+                ICellStyle cellStyle = workbook.CreateCellStyle();
155
+
156
+                //为避免日期格式被Excel自动替换,所以设定 format 为 『@』 表示一率当成text來看
157
+                cellStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("@");
158
+                cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
159
+                cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
160
+                cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
161
+                cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
162
+
163
+
164
+                NPOI.SS.UserModel.IFont cellfont = workbook.CreateFont();
165
+                cellfont.Boldweight = (short)FontBoldWeight.Normal;
166
+                cellStyle.SetFont(cellfont);
167
+
168
+                //建立内容行
169
+                int iRowIndex = 0;
170
+                string strsj = "";
171
+                foreach (var  dr in deptSatisfied )
172
+                {
173
+                    IRow irow = sheet.CreateRow(iRowIndex + 1);
174
+                    for (int i = 0; i <5   ; i++)
175
+                    {
176
+                      
177
+                        switch (i )
178
+                        {
179
+                            case 0:
180
+                                  strsj = dr.deptname;
181
+                                ICell cell = irow.CreateCell(i);
182
+                                cell.SetCellValue(strsj);
183
+                                cell.CellStyle = cellStyle;
184
+                                break;
185
+                            case 1:
186
+                                 strsj = dr.count.ToString ();
187
+                                ICell cell1 = irow.CreateCell(i);
188
+                                cell1.SetCellValue(strsj);
189
+                                cell1.CellStyle = cellStyle;
190
+                                break;
191
+                            case 2:
192
+                                strsj = dr.satisfiedcount.ToString();
193
+                                ICell cell2 = irow.CreateCell(i);
194
+                                cell2.SetCellValue(strsj);
195
+                                cell2.CellStyle = cellStyle;
196
+                                break;
197
+                            case 3:
198
+                                 strsj = dr.notsatisfiedcount.ToString();
199
+                                ICell cell3 = irow.CreateCell(i);
200
+                                cell3.SetCellValue(strsj);
201
+                                cell3.CellStyle = cellStyle;
202
+                                break;
203
+                            case 4:
204
+                                 strsj = dr.satisfiedrate;
205
+                                ICell cell4 = irow.CreateCell(i);
206
+                                cell4.SetCellValue(strsj);
207
+                                cell4.CellStyle = cellStyle;
208
+                                break;
209
+                        }
210
+                    }
211
+                    iRowIndex++;
212
+                }
213
+
214
+                //自适应列宽度
215
+                for (int i = 0; i < icolIndex; i++)
216
+                {
217
+                    sheet.AutoSizeColumn(i);
218
+                }
219
+
220
+                using (MemoryStream ms = new MemoryStream())
221
+                {
222
+                    workbook.Write(ms);
223
+
224
+                    HttpContext curContext = HttpContext.Current;
225
+
226
+
227
+                    // 设置编码和附件格式
228
+                    curContext.Response.ContentType = "application/vnd.ms-excel";
229
+                    curContext.Response.ContentEncoding = Encoding.UTF8;
230
+                    curContext.Response.Charset = "";
231
+                    curContext.Response.AppendHeader("Content-Disposition",
232
+                        "attachment;filename=" + HttpUtility.UrlEncode(Name + ".xls", Encoding.UTF8));
233
+
234
+                    curContext.Response.BinaryWrite(ms.GetBuffer());
235
+
236
+                    workbook = null;
237
+                    ms.Close();
238
+                    ms.Dispose();
239
+
240
+                    curContext.Response.End();
241
+                }
242
+                //}
243
+                return "";
244
+            }
245
+            catch
246
+            {
247
+                return "导出失败!";
248
+            }
249
+
250
+        }
111 251
         /// <summary>
112 252
         /// 弹出下载框导出excel
113 253
         /// </summary>
@@ -497,6 +637,8 @@ namespace CallCenter.Utility
497 637
             }
498 638
         }
499 639
 
640
+      
641
+
500 642
         /// <summary>
501 643
         /// 生成excel到路径
502 644
         /// </summary>