privatefinalStringupdateStagePrefix="update cdp_customer_sop_journey set sop_journey_stage='%1$s',sop_journey_stage_enter_time=now() where sop_journey_stage!='%1$s' and sop_journey_id='%2$s'";
privatefinalStringupdateStagePrefix="update cdp_customer_sop_journey set sop_journey_stage='%1$s',sop_journey_stage_enter_time=now() where sop_journey_stage!='%1$s' and sop_journey_id='%2$s'";
privatefinalStringupdateStageSuffix="update cdp_customer_sop_journey t3, (SELECT t1.extra->>'$.sopJourneyStage' as sopJourneyStage,t1.one_id as oneId,t1.org_id as orgId FROM cdp_customer_event t1, (select max(id) as id from cdp_customer_event where org_id='${merchantId}' and event_type='MODIFY_SOP_JOURNEY_STAGE' group by one_id,org_id,extra->>'$.sopJourneyStage') t2 where t1.id=t2.id) t4 set t3.sop_journey_stage=t4.sopJourneyStage,t3.sop_journey_stage_enter_time=now() where t3.one_id=t4.oneId and t3.org_id=t4.orgId and t3.sop_journey_id='${instId}' and t3.sop_journey_stage!=t4.sopJourneyStage;";