|
|
@@ -214,56 +214,108 @@ namespace CallCenterApi.Interface.Controllers.Assessment
|
|
214
|
214
|
Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
|
|
215
|
215
|
if (userModel == null)
|
|
216
|
216
|
return Error("权限不足!");
|
|
217
|
|
- // string sqlwhere = "";
|
|
218
|
|
- string strdate = "";string edate = "";
|
|
|
217
|
+ string edate = "";
|
|
219
|
218
|
if (userModel.F_RoleCode == "WLDW")
|
|
220
|
219
|
deptid = userModel.F_DeptId;
|
|
221
|
220
|
#region
|
|
|
221
|
+ string strdate = date;
|
|
|
222
|
+ string sqlwhere = "";
|
|
222
|
223
|
if (string.IsNullOrEmpty(date))
|
|
223
|
224
|
{
|
|
224
|
|
- strdate = DateTime.Now.AddMonths (-1).ToString("yyyy-MM")+"-21 00:00:00";
|
|
225
|
|
- edate = DateTime.Now.ToString("yyyy-MM") + "-20 23:59:59";
|
|
|
225
|
+ //strdate = DateTime.Now.ToString("yyyyMM");
|
|
226
|
226
|
|
|
|
227
|
+ string sql = "select top 1 F_BatchNo from T_Data_Supervision order by F_BatchNo desc";
|
|
|
228
|
+ string dates = DbHelperSQL.GetSingle(sql).ToString();
|
|
|
229
|
+ if (!string.IsNullOrEmpty(dates))
|
|
|
230
|
+ {
|
|
|
231
|
+ strdate += dates;
|
|
|
232
|
+ }
|
|
|
233
|
+ sqlwhere += " and F_BatchNo = '" + Convert.ToDateTime(strdate).ToString("yyyyMM") + "'";
|
|
227
|
234
|
}
|
|
228
|
|
- else
|
|
|
235
|
+ //}
|
|
|
236
|
+ if (!string.IsNullOrEmpty(date))
|
|
229
|
237
|
{
|
|
230
|
|
- strdate = Convert.ToDateTime(date).AddMonths(-1).ToString("yyyy-MM") + "-21 00:00:00";
|
|
231
|
|
- edate = Convert.ToDateTime(date).ToString("yyyy-MM") + "-20 23:59:59";
|
|
232
|
|
- }
|
|
233
|
|
- //else
|
|
234
|
|
- //{
|
|
235
|
|
- // sqlwhere += " and F_BatchNo = '" + Convert.ToDateTime(dates).ToString("yyyyMM") + "'";
|
|
236
|
|
- //}
|
|
|
238
|
+ // strdate = DateTime.Now.ToString("yyyyMM");
|
|
|
239
|
+ sqlwhere += " and F_BatchNo = '" +Convert.ToDateTime(strdate).ToString("yyyyMM") + "'";
|
|
237
|
240
|
|
|
|
241
|
+ }
|
|
238
|
242
|
|
|
239
|
|
- //}
|
|
240
|
|
- //if (!string.IsNullOrEmpty(date))
|
|
241
|
|
- //{
|
|
242
|
|
- // // strdate = DateTime.Now.ToString("yyyyMM");
|
|
243
|
|
- // sqlwhere += " and F_BatchNo = '" +Convert.ToDateTime(strdate).ToString("yyyyMM") + "'";
|
|
|
243
|
+ if (deptid > 0)
|
|
|
244
|
+ sqlwhere += " and F_DeptId=" + deptid;
|
|
244
|
245
|
|
|
245
|
|
- //}
|
|
|
246
|
+ var sqlass = "select * from T_Data_Supervision where 1=1 " + sqlwhere + " order by F_ReciveCount desc ";//此处以查收量倒叙排序
|
|
|
247
|
+ #endregion
|
|
|
248
|
+ var list = DbHelperSQL.Query(sqlass).Tables[0];
|
|
|
249
|
+ var obj = new
|
|
|
250
|
+ {
|
|
|
251
|
+ state = "success",
|
|
|
252
|
+ message = "成功",
|
|
|
253
|
+ rows = list,
|
|
|
254
|
+ total = list.Rows.Count
|
|
|
255
|
+ };
|
|
|
256
|
+ return Content(obj.ToJson());
|
|
|
257
|
+ }
|
|
246
|
258
|
|
|
247
|
|
- //if (deptid > 0)
|
|
248
|
|
- // sqlwhere += " and F_DeptId=" + deptid;
|
|
249
|
259
|
|
|
250
|
|
- //var sqlass = "select * from T_Data_Supervision where 1=1 " + sqlwhere + " order by F_ReciveCount desc ";//此处以查收量倒叙排序
|
|
251
|
|
- #endregion
|
|
252
|
|
- Dictionary<string, string> paras = new Dictionary<string, string>();
|
|
253
|
|
- paras.Add("@deptid", deptid.ToString ());
|
|
|
260
|
+ public ActionResult GetDBDataList_1(DateTime ? starttime , DateTime? endtime, int deptid = 0,bool isdc=false )
|
|
|
261
|
+ {
|
|
|
262
|
+ int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
|
|
|
263
|
+ if (userId <= 0)
|
|
|
264
|
+ return Error("权限不足");
|
|
|
265
|
+ Model.T_Sys_UserAccount userModel = userBLL.GetModel(userId);
|
|
|
266
|
+ if (userModel == null)
|
|
|
267
|
+ return Error("权限不足!");
|
|
|
268
|
+ string sqlwhere = "";
|
|
|
269
|
+ string strdate = ""; string edate = "";
|
|
|
270
|
+ if (userModel.F_RoleCode == "WLDW")
|
|
|
271
|
+ deptid = userModel.F_DeptId;
|
|
|
272
|
+ #region
|
|
|
273
|
+ string month = "";
|
|
|
274
|
+ if (starttime==null )
|
|
|
275
|
+ {
|
|
|
276
|
+ strdate = DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-21 00:00:00";
|
|
|
277
|
+ }
|
|
|
278
|
+ else
|
|
|
279
|
+ {
|
|
|
280
|
+ strdate = starttime.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
281
|
+
|
|
|
282
|
+ }
|
|
|
283
|
+ if (endtime == null)
|
|
|
284
|
+ {
|
|
|
285
|
+ edate = DateTime.Now.ToString("yyyy-MM") + "-20 23:59:59";
|
|
|
286
|
+ month = DateTime.Now.Month.ToString();
|
|
|
287
|
+ }
|
|
|
288
|
+ else
|
|
|
289
|
+ {
|
|
|
290
|
+ edate = endtime.Value .ToString("yyyy-MM") + "-20 23:59:59";
|
|
|
291
|
+ month = endtime.Value.Month.ToString();
|
|
|
292
|
+ }
|
|
|
293
|
+ #endregion
|
|
|
294
|
+ Dictionary<string, string> paras = new Dictionary<string, string>();
|
|
|
295
|
+ paras.Add("@deptid", deptid.ToString());
|
|
254
|
296
|
paras.Add("@sdate", strdate);
|
|
255
|
297
|
paras.Add("@edate", edate);
|
|
256
|
|
- var list = DbHelperSQL.RunProcedure("P_DeptData", paras, "DeptData").Tables[0];
|
|
257
|
|
-
|
|
258
|
|
-
|
|
259
|
|
- //var list = DbHelperSQL.Query(sqlass).Tables[0];
|
|
260
|
|
-
|
|
|
298
|
+ var list = DbHelperSQL.RunProcedure("P_DeptDBData", paras, "DeptData").Tables[0];
|
|
|
299
|
+ //var list = DbHelperSQL.Query(sqlass).Tables[0];
|
|
|
300
|
+ if (isdc)
|
|
|
301
|
+ {
|
|
|
302
|
+ NPOIHelper npoi = new NPOIHelper();
|
|
|
303
|
+ if (npoi.DBExportToExcel(list,"督办数据统计",month, Convert.ToDateTime(strdate).ToString("yyyy-MM-dd"),
|
|
|
304
|
+ Convert.ToDateTime(edate).ToString("yyyy-MM-dd")
|
|
|
305
|
+ ) == "")
|
|
|
306
|
+ {
|
|
|
307
|
+ return Success("导出成功");
|
|
|
308
|
+ }
|
|
|
309
|
+ else
|
|
|
310
|
+ {
|
|
|
311
|
+ return Error("导出失败");
|
|
|
312
|
+ }
|
|
|
313
|
+ }
|
|
261
|
314
|
var obj = new
|
|
262
|
315
|
{
|
|
263
|
316
|
state = "success",
|
|
264
|
317
|
message = "成功",
|
|
265
|
|
- rows = list,
|
|
266
|
|
- total = list.Rows.Count
|
|
|
318
|
+ rows = list
|
|
267
|
319
|
};
|
|
268
|
320
|
return Content(obj.ToJson());
|
|
269
|
321
|
}
|