tangjiang 9 月之前
父节点
当前提交
f46a277c72
共有 1 个文件被更改,包括 16 次插入16 次删除
  1. 16 16
      src/Hotline.Application/StatisticalReport/OrderReportApplication.cs

+ 16 - 16
src/Hotline.Application/StatisticalReport/OrderReportApplication.cs

@@ -157,7 +157,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""TraceState"" !=10  and ""t"".""Status"">=2   {2} --and ""t"".""CountersignPosition""<=1 
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -166,7 +166,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2  {2} --and ""t"".""CountersignPosition""<=1 
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -175,7 +175,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""TraceState"" !=10 and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""t"".""CountersignPosition""=0   {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -184,7 +184,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and (SELECT NOW())>""StepExpiredTime"" and ""t"".""CountersignPosition""=0   {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -193,7 +193,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""TraceState"" !=10 and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""CountersignPosition"">0  {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -203,7 +203,7 @@ FROM (
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and (SELECT NOW())>""StepExpiredTime"" 
 			and   ""CountersignPosition"">0  {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -212,7 +212,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""TraceState"" !=10 and ""t"".""Status"">=2 and ""CountersignPosition"">0 {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -221,7 +221,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and ""CountersignPosition"">0 {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL  {4}
 		GROUP BY ""HandlerOrgId""
 		UNION ALL
@@ -355,7 +355,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""TraceState"" !=10 and ""t"".""Status"">=2   {2} --and ""t"".""CountersignPosition""<=1 
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -364,7 +364,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2  {2} --and ""t"".""CountersignPosition""<=1 
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -373,7 +373,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""TraceState"" !=10 and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""t"".""CountersignPosition""=0   {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -382,7 +382,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and (SELECT NOW())>""StepExpiredTime"" and ""t"".""CountersignPosition""=0   {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -391,7 +391,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""TraceState"" !=10 and ""t"".""Status"">=2 and ""HandleTime"">""StepExpiredTime"" and ""CountersignPosition"">0  {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -401,7 +401,7 @@ FROM (
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and (SELECT NOW())>""StepExpiredTime"" 
 			and   ""CountersignPosition"">0  {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -410,7 +410,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""TraceState"" !=10 and ""t"".""Status"">=2 and ""CountersignPosition"">0 {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL {4}
 		GROUP BY ""HandlerOrgId""
 		union ALL
@@ -419,7 +419,7 @@ FROM (
 		 select ""o"".""Id"",SUBSTRING(""t"".""HandlerOrgId"",1,{3}) ""HandlerOrgId"" from ""workflow_trace"" ""t""
 			left join ""order"" ""o"" on ""o"".""Id""=""t"".""ExternalId""
 			where ""o"".""CreationTime"">='{0}' and ""o"".""CreationTime""<='{1}'  and ""t"".""ModuleCode""='OrderHandle' and ""t"".""Status""<2 and ""CountersignPosition"">0 {2}
-			GROUP BY ""HandlerOrgId"",""o"".""Id""
+			GROUP BY SUBSTRING(""t"".""HandlerOrgId"",1,{3}),""o"".""Id""
 		)""s"" where ""HandlerOrgId"" IS not NULL  {4}
 		GROUP BY ""HandlerOrgId""
 		UNION ALL