Bladeren bron

修改通话时长统计查询bug

mengjie 6 jaren geleden
bovenliggende
commit
a6c8be6f5b

+ 4 - 2
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/TalkTimeController.cs

207
             var userAccountList = new BLL.T_Sys_UserAccount().GetModelList(" F_SeatFlag=1");
207
             var userAccountList = new BLL.T_Sys_UserAccount().GetModelList(" F_SeatFlag=1");
208
             //DataTable dt = DbHelperSQL.Query("SELECT UserId,UserCode,UserName,COUNT(*) AS calloutCount,SUM(TalkLongTime) AS TalkSummaryTime FROM T_Call_CallRecords where 1=1 " + sql + "  GROUP BY UserId,UserCode,UserName").Tables[0];
208
             //DataTable dt = DbHelperSQL.Query("SELECT UserId,UserCode,UserName,COUNT(*) AS calloutCount,SUM(TalkLongTime) AS TalkSummaryTime FROM T_Call_CallRecords where 1=1 " + sql + "  GROUP BY UserId,UserCode,UserName").Tables[0];
209
             //DataTable dt = DbHelperSQL.Query("SELECT UserId,UserCode,UserName,COUNT(*) AS calloutCount FROM T_Call_CallRecords where 1=1 " + sql + "  GROUP BY UserId,UserCode,UserName").Tables[0];
209
             //DataTable dt = DbHelperSQL.Query("SELECT UserId,UserCode,UserName,COUNT(*) AS calloutCount FROM T_Call_CallRecords where 1=1 " + sql + "  GROUP BY UserId,UserCode,UserName").Tables[0];
210
-            var recordstr = " select users.F_UserId,users.F_UserCode,users.F_UserName,COUNT(*) AS calloutCount,SUM(TalkLongTime) AS TalkSummaryTime from T_Sys_UserAccount users left join T_Call_CallRecords WITH(NOLOCK) records on users.F_UserCode = records.UserCode and 1=1 " + sql + " GROUP BY users.F_UserId,users.F_UserCode,users.F_UserName";
210
+            //var recordstr = " select users.F_UserId,users.F_UserCode,users.F_UserName,COUNT(*) AS calloutCount,SUM(TalkLongTime) AS TalkSummaryTime from T_Sys_UserAccount users left join T_Call_CallRecords WITH(NOLOCK) records on users.F_UserCode = records.UserCode and 1=1 " + sql + " GROUP BY users.F_UserId,users.F_UserCode,users.F_UserName";
211
+            var recordstr = " select users.F_UserId,users.F_UserCode,users.F_UserName,COUNT(*) AS calloutCount,SUM(TalkLongTime) AS TalkSummaryTime from T_Sys_UserAccount users left join T_Call_CallRecords records WITH(NOLOCK)  on users.F_UserCode = records.UserCode and 1=1 " + sql + " GROUP BY users.F_UserId,users.F_UserCode,users.F_UserName";
211
             DataTable dt = DbHelperSQL.Query(recordstr).Tables[0];
212
             DataTable dt = DbHelperSQL.Query(recordstr).Tables[0];
212
 
213
 
213
             foreach (Model.T_Sys_UserAccount item in userAccountList)
214
             foreach (Model.T_Sys_UserAccount item in userAccountList)
326
             //20180509 通话时长统计不对  machenyang
327
             //20180509 通话时长统计不对  machenyang
327
             //20180509 通话时长呼入次数 与 坐席工作报表 呼入电话数 数值不统一 修改(原因是一个是根据工号查询,一个是工号姓名【由于可能工号不变,会修改姓名】)  lihai
328
             //20180509 通话时长呼入次数 与 坐席工作报表 呼入电话数 数值不统一 修改(原因是一个是根据工号查询,一个是工号姓名【由于可能工号不变,会修改姓名】)  lihai
328
             //var recordstr = " select records.UserCode,records.UserId,records.UserName,COUNT(*) from T_Call_CallRecords records where 1=1 " + sql + "  and UserCode is not null group by records.UserCode,records.UserId,records.UserName";
329
             //var recordstr = " select records.UserCode,records.UserId,records.UserName,COUNT(*) from T_Call_CallRecords records where 1=1 " + sql + "  and UserCode is not null group by records.UserCode,records.UserId,records.UserName";
329
-            var recordstr = " select records.UserCode,COUNT(*) from T_Call_CallRecords WITH(NOLOCK) records where 1=1 " + sql + "  and UserCode is not null group by records.UserCode";
330
+            //var recordstr = " select records.UserCode,COUNT(*) from T_Call_CallRecords WITH(NOLOCK) records where 1=1 " + sql + "  and UserCode is not null group by records.UserCode";
331
+            var recordstr = " select records.UserCode,COUNT(*) from T_Call_CallRecords records WITH(NOLOCK)  where 1=1 " + sql + "  and UserCode is not null group by records.UserCode";
330
             DataTable dt = DbHelperSQL.Query(recordstr).Tables[0];
332
             DataTable dt = DbHelperSQL.Query(recordstr).Tables[0];
331
             Dictionary<string, int> myDictionary = new Dictionary<string, int>();
333
             Dictionary<string, int> myDictionary = new Dictionary<string, int>();
332
 
334