|
@@ -458,3 +458,57 @@ where visittemp."CreationTime">='2024-08-29' and visitdetailtemp."VisitTarget"=1
|
|
|
on aaa."SugarNav_Id" = ccc."OrderId"
|
|
|
|
|
|
|
|
|
+### 重置工单回访部门信息
|
|
|
+update order_visit_detail set
|
|
|
+"VisitOrgCode"= hhh."HandlerOrgId","VisitOrgName"=hhh."HandlerOrgName"
|
|
|
+from (
|
|
|
+select * from (
|
|
|
+select ppp."OrderId",ooo."Id" "VisitDetailId" from(
|
|
|
+select "Id","OrderId" from order_visit where "VisitState" <> 50 and "OrderId" in(
|
|
|
+select "Id" from "order" WHERE "FiledTime">'2024-10-30' and "ActualHandleOrgCode" <> '001' and "Status">300 and "CounterSignType" is null)) ppp
|
|
|
+left join order_visit_detail ooo on ppp."Id"=ooo."VisitId"
|
|
|
+WHERE ooo."VisitTarget"=20) qqq
|
|
|
+left join
|
|
|
+(select aaa.* from workflow_step aaa
|
|
|
+left join (
|
|
|
+select "ExternalId","max"("HandleTime") maxTime from workflow_step where "WorkflowId" in(
|
|
|
+select "WorkflowId" from "order" WHERE "FiledTime">'2024-10-30' and "ActualHandleOrgCode"<>'001' and "Status">=300 and "CounterSignType" is null)
|
|
|
+and "StepType" not in (2,3) AND "IsOrigin"=TRUE group by "ExternalId") bbb on aaa."ExternalId"=bbb."ExternalId"
|
|
|
+where aaa."HandleTime"=bbb.maxTime) www on qqq."OrderId"= www."ExternalId") hhh
|
|
|
+where order_visit_detail."Id" = hhh."VisitDetailId" and hhh."OrderId"='08dcf7df-964a-436c-8f39-bc96ff54522a'
|
|
|
+
|
|
|
+
|
|
|
+### 重置工单实际办理部门和接办信息
|
|
|
+update "order" uuu
|
|
|
+set
|
|
|
+"ActualHandleOrgName"=ccc."HandlerOrgName","ActualHandleOrgCode"=ccc."HandlerOrgId","CurrentHandleOrgId"=ccc."HandlerOrgId","CurrentHandlerName"=ccc."HandlerOrgName"
|
|
|
+from (
|
|
|
+select aaa."ExternalId",aaa."HandlerOrgId",aaa."HandlerOrgName" from workflow_step aaa
|
|
|
+left join (
|
|
|
+select "ExternalId","max"("HandleTime") maxTime from workflow_step where "WorkflowId" in(
|
|
|
+select "WorkflowId" from "order" WHERE "FiledTime">'2024-10-30' and "ActualHandleOrgCode"<>'001' and "Status">=300 and "CounterSignType" is null)
|
|
|
+and "StepType" not in (2,3) AND "IsOrigin"=TRUE group by "ExternalId") bbb on aaa."ExternalId"=bbb."ExternalId"
|
|
|
+where aaa."HandleTime"=bbb.maxTime) ccc where uuu."Id"=ccc."ExternalId" and uuu."Id"='08dcf7df-964a-436c-8f39-bc96ff54522a'
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+### 查询智能回访超过两次的回访工单
|
|
|
+update order_visit_detail set "SeatEvaluate"=4,"VisitContent"='市民未接听电话。'
|
|
|
+where "VisitId" in(
|
|
|
+select "Id" from order_visit WHERE "OrderId" in(
|
|
|
+select "OrderId" from ai_order_visit_detail where "CreationTime">'2024-10-29'
|
|
|
+and "CallTimes">0 and "AiSeatEvaluate" is null and "AiIsContact" is null and "AiVolved" is NULL and "AiOrgProcessingResults" is null
|
|
|
+group by "OrderId") and "VisitState" not in(50,30)) and "VisitTarget"=10;
|
|
|
+
|
|
|
+
|
|
|
+update order_visit_detail set "OrgProcessingResults" ='{"Key":"6","Value":"未接通"}',"VisitContent"='市民未接听电话。',"IsContact"=TRUE,"Volved"=true
|
|
|
+where "VisitId" in(
|
|
|
+select "Id" from order_visit WHERE "OrderId" in(
|
|
|
+select "OrderId" from ai_order_visit_detail where "CreationTime">'2024-10-29'
|
|
|
+and "CallTimes">0 and "AiSeatEvaluate" is null and "AiIsContact" is null and "AiVolved" is NULL and "AiOrgProcessingResults" is null
|
|
|
+group by "OrderId") and "VisitState" not in(50,30)) and "VisitTarget"=20
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|